relaton-un 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/Gemfile +2 -0
- data/lib/relaton/un/bibdata.rb +1 -0
- data/lib/relaton/un/bibitem.rb +1 -0
- data/lib/relaton/un/ext.rb +7 -3
- data/lib/relaton/un/token_generator.rb +25 -79
- data/lib/relaton/un/version.rb +1 -1
- data/lib/relaton/un/wasm/decoder.rb +434 -0
- data/lib/relaton/un/wasm/instance.rb +101 -0
- data/lib/relaton/un/wasm/interpreter.rb +613 -0
- data/lib/relaton/un/wasm/memory.rb +112 -0
- data/lib/relaton/un/wasm/module.rb +47 -0
- data/lib/relaton/un/wasm.rb +17 -0
- data/{relaton_un.gemspec → relaton-un.gemspec} +1 -2
- data/resp.html +10 -10
- metadata +15 -25
- data/grammars/basicdoc.rng +0 -2140
- data/grammars/biblio-standoc.rng +0 -268
- data/grammars/biblio.rng +0 -2129
- data/grammars/relaton-un-compile.rng +0 -11
- data/grammars/relaton-un.rng +0 -122
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Un
|
|
5
|
+
module Wasm
|
|
6
|
+
class Memory
|
|
7
|
+
PAGE = 65_536
|
|
8
|
+
|
|
9
|
+
attr_reader :max_pages
|
|
10
|
+
|
|
11
|
+
def initialize(initial_pages:, max_pages: nil)
|
|
12
|
+
@pages = initial_pages
|
|
13
|
+
@max_pages = max_pages
|
|
14
|
+
@buf = String.new("\x00".b * (initial_pages * PAGE), encoding: Encoding::ASCII_8BIT)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def size_pages
|
|
18
|
+
@pages
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def grow(delta)
|
|
22
|
+
new_pages = @pages + delta
|
|
23
|
+
return -1 if @max_pages && new_pages > @max_pages
|
|
24
|
+
|
|
25
|
+
old = @pages
|
|
26
|
+
@pages = new_pages
|
|
27
|
+
@buf << ("\x00".b * (delta * PAGE))
|
|
28
|
+
old
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def read(addr, len)
|
|
32
|
+
bounds!(addr, len)
|
|
33
|
+
@buf.byteslice(addr, len)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def write(addr, bytes)
|
|
37
|
+
bytes = bytes.b
|
|
38
|
+
bounds!(addr, bytes.bytesize)
|
|
39
|
+
@buf.bytesplice(addr, bytes.bytesize, bytes)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def load_u8(addr)
|
|
43
|
+
bounds!(addr, 1)
|
|
44
|
+
@buf.getbyte(addr)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def load_i8(addr)
|
|
48
|
+
v = load_u8(addr)
|
|
49
|
+
v >= 0x80 ? v - 0x100 : v
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def load_u16(addr)
|
|
53
|
+
bounds!(addr, 2)
|
|
54
|
+
@buf.byteslice(addr, 2).unpack1("v")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def load_i16(addr)
|
|
58
|
+
v = load_u16(addr)
|
|
59
|
+
v >= 0x8000 ? v - 0x10000 : v
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def load_u32(addr)
|
|
63
|
+
bounds!(addr, 4)
|
|
64
|
+
@buf.byteslice(addr, 4).unpack1("V")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def load_i32(addr)
|
|
68
|
+
v = load_u32(addr)
|
|
69
|
+
v >= 0x8000_0000 ? v - 0x1_0000_0000 : v
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def load_u64(addr)
|
|
73
|
+
bounds!(addr, 8)
|
|
74
|
+
@buf.byteslice(addr, 8).unpack1("Q<")
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def load_i64(addr)
|
|
78
|
+
v = load_u64(addr)
|
|
79
|
+
v >= 0x8000_0000_0000_0000 ? v - 0x1_0000_0000_0000_0000 : v
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def store_u8(addr, val)
|
|
83
|
+
bounds!(addr, 1)
|
|
84
|
+
@buf.setbyte(addr, val & 0xff)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def store_u16(addr, val)
|
|
88
|
+
bounds!(addr, 2)
|
|
89
|
+
@buf.bytesplice(addr, 2, [val & 0xffff].pack("v"))
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def store_u32(addr, val)
|
|
93
|
+
bounds!(addr, 4)
|
|
94
|
+
@buf.bytesplice(addr, 4, [val & 0xffff_ffff].pack("V"))
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def store_u64(addr, val)
|
|
98
|
+
bounds!(addr, 8)
|
|
99
|
+
@buf.bytesplice(addr, 8, [val & 0xffff_ffff_ffff_ffff].pack("Q<"))
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
private
|
|
103
|
+
|
|
104
|
+
def bounds!(addr, len)
|
|
105
|
+
return if addr >= 0 && addr + len <= @buf.bytesize
|
|
106
|
+
|
|
107
|
+
raise Trap, "out of bounds memory access (addr=#{addr}, len=#{len}, size=#{@buf.bytesize})"
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Un
|
|
5
|
+
module Wasm
|
|
6
|
+
FuncType = Struct.new(:params, :results)
|
|
7
|
+
Import = Struct.new(:mod, :field, :kind, :desc)
|
|
8
|
+
Export = Struct.new(:name, :kind, :index)
|
|
9
|
+
Global = Struct.new(:type, :mutable, :init_expr)
|
|
10
|
+
Element = Struct.new(:table_idx, :offset_expr, :func_indices)
|
|
11
|
+
Data = Struct.new(:mem_idx, :offset_expr, :bytes)
|
|
12
|
+
Code = Struct.new(:locals, :body)
|
|
13
|
+
|
|
14
|
+
MemoryType = Struct.new(:initial, :max)
|
|
15
|
+
TableType = Struct.new(:elem_type, :initial, :max)
|
|
16
|
+
|
|
17
|
+
class Module
|
|
18
|
+
attr_reader :types, :imports, :function_type_indices, :tables, :memories,
|
|
19
|
+
:globals, :exports, :elements, :code, :data, :start
|
|
20
|
+
|
|
21
|
+
def initialize
|
|
22
|
+
@types = []
|
|
23
|
+
@imports = []
|
|
24
|
+
@function_type_indices = []
|
|
25
|
+
@tables = []
|
|
26
|
+
@memories = []
|
|
27
|
+
@globals = []
|
|
28
|
+
@exports = []
|
|
29
|
+
@elements = []
|
|
30
|
+
@code = []
|
|
31
|
+
@data = []
|
|
32
|
+
@start = nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.parse(bytes)
|
|
36
|
+
Decoder.new(bytes).decode
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Number of imported functions (they precede module-defined functions
|
|
40
|
+
# in the funcidx space).
|
|
41
|
+
def imported_function_count
|
|
42
|
+
@imports.count { |i| i.kind == :func }
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Un
|
|
5
|
+
module Wasm
|
|
6
|
+
class Trap < StandardError; end
|
|
7
|
+
class DecodeError < StandardError; end
|
|
8
|
+
class LinkError < StandardError; end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
require_relative "wasm/memory"
|
|
14
|
+
require_relative "wasm/decoder"
|
|
15
|
+
require_relative "wasm/module"
|
|
16
|
+
require_relative "wasm/interpreter"
|
|
17
|
+
require_relative "wasm/instance"
|
|
@@ -34,8 +34,7 @@ Gem::Specification.new do |spec|
|
|
|
34
34
|
|
|
35
35
|
spec.add_dependency "addressable", "~> 2.8"
|
|
36
36
|
spec.add_dependency "faraday", "~> 2.7"
|
|
37
|
-
spec.add_dependency "relaton-bib", "~> 2.
|
|
37
|
+
spec.add_dependency "relaton-bib", "~> 2.1.0"
|
|
38
38
|
spec.add_dependency "relaton-core", "~> 0.0.13"
|
|
39
|
-
spec.add_dependency "wasmtime", "~> 41.0"
|
|
40
39
|
end
|
|
41
40
|
# rubocop:enable Metrics/BlockLength
|
data/resp.html
CHANGED
|
@@ -62,16 +62,16 @@
|
|
|
62
62
|
</div><input type="hidden" id="view:_id1:_id2:hdnSubj" name="view:_id1:_id2:hdnSubj" value=""></div></div></div><div class="container" id="mainContent"><div id="view:_id1:_id2:cbMain">
|
|
63
63
|
<div class="panelHeight">
|
|
64
64
|
<div class="row"><div class="col-md-4"><h5><span class="ucase">DAILY DOCUMENTS</span></h5><span id="view:_id1:_id2:cbMain:cfDDs"><p><a href="http://www.un.org/en/documents/journal.asp" target="_blank"><i class="fa fa-file"></i>  Daily Journal (New York)</a></p> <p><a href="http://daccess-ods.un.org/ods/dailyListOfDocuments.htm" target="_blank"><i class="fa fa-file"></i>  Daily Documents</a></p> <p><a href="http://www.unog.ch/__80256ee600586f34.nsf/httpDailyBulletin_External?ReadForm" target="_blank"><i class="fa fa-file"></i>  Daily Bulletin (Geneva)</a></p></span></div><div class="col-md-4"><h5><span class="ucase">MOST DOWNLOADED DOCUMENTS (1-5)</span></h5><span id="view:_id1:_id2:cbMain:cfMDDs1"><p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=A/RES/70/1&Lang=E" target="_blank"><i class="fa fa-file"></i>  A/RES/70/1</a></p> <p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=A/RES/73/195&Lang=E" target="_blank"><i class="fa fa-file"></i>  A/RES/73/195</a></p> <p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=E/2019/68&Lang=E" target="_blank"><i class="fa fa-file"></i>  E/2019/68</a></p> <p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=S/AC.44/2019/18&Lang=E" target="_blank"><i class="fa fa-file"></i>  S/AC.44/2019/18</a></p> <p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=A/RES/217(III)&Lang=E" target="_blank"><i class="fa fa-file"></i>  A/RES/217(III)</a></p></span></div><div class="col-md-4"><h5><span class="ucase">MOST DOWNLOADED DOCUMENTS (6-10)</span></h5><span id="view:_id1:_id2:cbMain:cfMDDs2"><p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=S/RES/2511(2020)&Lang=E" target="_blank"><i class="fa fa-file"></i>  S/RES/2511(2020)</a></p> <p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=A/74/102/ADD.2&Lang=E" target="_blank"><i class="fa fa-file"></i>  A/74/102/ADD.2</a></p> <p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=S/2020/157&Lang=E" target="_blank"><i class="fa fa-file"></i>  S/2020/157</a></p> <p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=A/RES/71/1&Lang=E" target="_blank"><i class="fa fa-file"></i>  A/RES/71/1</a></p> <p><a href="http://daccess-ods.un.org/access.nsf/Get?Open&DS=E/CN.6/2020/3&Lang=E" target="_blank"><i class="fa fa-file"></i>  E/CN.6/2020/3</a></p></span></div></div><p class="pageHeader">Official Document System of the United Nations</p><div class="row"><div class="col-md-12"><div id="view:_id1:_id2:cbMain:en">
|
|
65
|
-
<div id="view:_id1:_id2:cbMain:_id150:inputRichText1">The Official Document System (ODS) is an online database of UN documents that was first launched in 1993 and updated in 2016. ODS has full-text, born-digital UN documents published from 1993 onward, including documents of the Security Council, the General Assembly, the Economic and Social Council and their subsidiaries, as well as administrative issuances and other documents. <br>
|
|
66
|
-
<br>
|
|
67
|
-
The database also includes scanned documents published between 1946 and 1993, including all resolutions of the principal organs, all documents of the Security Council and the General Assembly Official Records. Documents are available in the official languages of the UN; some documents are also available in German. <br>
|
|
68
|
-
<br>
|
|
69
|
-
ODS does not have the following types of materials: documents issued before 1993 that have not yet been digitized, <a href="http://www.un.org/press/en" target="_blank">press releases</a>, <a href="https://shop.un.org/" target="_blank">sales publications</a>, such as the Yearbook and the <a href="https://treaties.un.org/" target="_blank">Treaty Series</a>, and documents that do not have a UN symbol. <br>
|
|
70
|
-
<br>
|
|
71
|
-
ODS is maintained by the <a href="https://unite.un.org/" target="_blank">Office of Information and Communications Technology (OICT)</a>. New documents are added by the Department for General Assembly and Conference Management (DGACM). Scanned documents and metadata are contributed by the Dag Hammarskjöld Library and the UN Office at Geneva Library. <br>
|
|
72
|
-
<br>
|
|
73
|
-
This website is best used in recent versions of all major browsers. To download multiple documents, please use Google Chrome or Opera.<br>
|
|
74
|
-
<br>
|
|
65
|
+
<div id="view:_id1:_id2:cbMain:_id150:inputRichText1">The Official Document System (ODS) is an online database of UN documents that was first launched in 1993 and updated in 2016. ODS has full-text, born-digital UN documents published from 1993 onward, including documents of the Security Council, the General Assembly, the Economic and Social Council and their subsidiaries, as well as administrative issuances and other documents. <br>
|
|
66
|
+
<br>
|
|
67
|
+
The database also includes scanned documents published between 1946 and 1993, including all resolutions of the principal organs, all documents of the Security Council and the General Assembly Official Records. Documents are available in the official languages of the UN; some documents are also available in German. <br>
|
|
68
|
+
<br>
|
|
69
|
+
ODS does not have the following types of materials: documents issued before 1993 that have not yet been digitized, <a href="http://www.un.org/press/en" target="_blank">press releases</a>, <a href="https://shop.un.org/" target="_blank">sales publications</a>, such as the Yearbook and the <a href="https://treaties.un.org/" target="_blank">Treaty Series</a>, and documents that do not have a UN symbol. <br>
|
|
70
|
+
<br>
|
|
71
|
+
ODS is maintained by the <a href="https://unite.un.org/" target="_blank">Office of Information and Communications Technology (OICT)</a>. New documents are added by the Department for General Assembly and Conference Management (DGACM). Scanned documents and metadata are contributed by the Dag Hammarskjöld Library and the UN Office at Geneva Library. <br>
|
|
72
|
+
<br>
|
|
73
|
+
This website is best used in recent versions of all major browsers. To download multiple documents, please use Google Chrome or Opera.<br>
|
|
74
|
+
<br>
|
|
75
75
|
If you have any questions or problems, please contact the Information and Communications Technology Service Desk by <a href="mailto:helpdeskoict@un.org?Subject=ODS">e-mail</a>.</div></div>
|
|
76
76
|
</div></div></div>
|
|
77
77
|
</div>
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-un
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-05-22 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: addressable
|
|
@@ -43,14 +44,14 @@ dependencies:
|
|
|
43
44
|
requirements:
|
|
44
45
|
- - "~>"
|
|
45
46
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 2.
|
|
47
|
+
version: 2.1.0
|
|
47
48
|
type: :runtime
|
|
48
49
|
prerelease: false
|
|
49
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
51
|
requirements:
|
|
51
52
|
- - "~>"
|
|
52
53
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 2.
|
|
54
|
+
version: 2.1.0
|
|
54
55
|
- !ruby/object:Gem::Dependency
|
|
55
56
|
name: relaton-core
|
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -65,20 +66,6 @@ dependencies:
|
|
|
65
66
|
- - "~>"
|
|
66
67
|
- !ruby/object:Gem::Version
|
|
67
68
|
version: 0.0.13
|
|
68
|
-
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: wasmtime
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - "~>"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '41.0'
|
|
75
|
-
type: :runtime
|
|
76
|
-
prerelease: false
|
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - "~>"
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '41.0'
|
|
82
69
|
description: 'Relaton::Un: retrieve CC Standards for bibliographic use using the IsoBibliographicItem
|
|
83
70
|
model'
|
|
84
71
|
email:
|
|
@@ -100,11 +87,6 @@ files:
|
|
|
100
87
|
- bin/console
|
|
101
88
|
- bin/rspec
|
|
102
89
|
- bin/setup
|
|
103
|
-
- grammars/basicdoc.rng
|
|
104
|
-
- grammars/biblio-standoc.rng
|
|
105
|
-
- grammars/biblio.rng
|
|
106
|
-
- grammars/relaton-un-compile.rng
|
|
107
|
-
- grammars/relaton-un.rng
|
|
108
90
|
- lib/relaton/un.rb
|
|
109
91
|
- lib/relaton/un/bibdata.rb
|
|
110
92
|
- lib/relaton/un/bibitem.rb
|
|
@@ -121,8 +103,14 @@ files:
|
|
|
121
103
|
- lib/relaton/un/token_generator.rb
|
|
122
104
|
- lib/relaton/un/util.rb
|
|
123
105
|
- lib/relaton/un/version.rb
|
|
106
|
+
- lib/relaton/un/wasm.rb
|
|
107
|
+
- lib/relaton/un/wasm/decoder.rb
|
|
108
|
+
- lib/relaton/un/wasm/instance.rb
|
|
109
|
+
- lib/relaton/un/wasm/interpreter.rb
|
|
110
|
+
- lib/relaton/un/wasm/memory.rb
|
|
111
|
+
- lib/relaton/un/wasm/module.rb
|
|
124
112
|
- lib/relaton/un/wasm_v_bg.wasm
|
|
125
|
-
-
|
|
113
|
+
- relaton-un.gemspec
|
|
126
114
|
- resp.html
|
|
127
115
|
homepage: https://github.com/relaton/relaton-un
|
|
128
116
|
licenses:
|
|
@@ -130,6 +118,7 @@ licenses:
|
|
|
130
118
|
metadata:
|
|
131
119
|
homepage_uri: https://github.com/relaton/relaton-un
|
|
132
120
|
source_code_uri: https://github.com/relaton/relaton-un
|
|
121
|
+
post_install_message:
|
|
133
122
|
rdoc_options: []
|
|
134
123
|
require_paths:
|
|
135
124
|
- lib
|
|
@@ -144,7 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
144
133
|
- !ruby/object:Gem::Version
|
|
145
134
|
version: '0'
|
|
146
135
|
requirements: []
|
|
147
|
-
rubygems_version: 3.
|
|
136
|
+
rubygems_version: 3.5.22
|
|
137
|
+
signing_key:
|
|
148
138
|
specification_version: 4
|
|
149
139
|
summary: 'Relaton::Un: retrieve CC Standards for bibliographic use using the IsoBibliographicItem
|
|
150
140
|
model'
|