@grain/stdlib 0.6.6 → 0.7.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.
- package/CHANGELOG.md +67 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/array.gr +55 -7
- package/array.md +606 -560
- package/bigint.md +228 -228
- package/buffer.gr +85 -53
- package/buffer.md +442 -319
- package/bytes.gr +112 -35
- package/bytes.md +299 -219
- package/char.gr +201 -99
- package/char.md +447 -120
- package/exception.gr +11 -11
- package/exception.md +29 -4
- package/float32.gr +327 -3
- package/float32.md +698 -111
- package/float64.gr +320 -3
- package/float64.md +698 -111
- package/fs.gr +1082 -0
- package/fs.md +630 -0
- package/hash.gr +142 -88
- package/hash.md +105 -17
- package/int16.md +178 -178
- package/int32.gr +26 -5
- package/int32.md +266 -231
- package/int64.gr +27 -2
- package/int64.md +266 -231
- package/int8.md +178 -178
- package/json.gr +366 -51
- package/json.md +431 -15
- package/list.gr +328 -31
- package/list.md +759 -336
- package/map.gr +20 -12
- package/map.md +266 -260
- package/marshal.gr +41 -40
- package/marshal.md +14 -14
- package/number.gr +278 -35
- package/number.md +688 -269
- package/option.md +162 -162
- package/package.json +5 -3
- package/path.gr +48 -0
- package/path.md +180 -89
- package/pervasives.gr +2 -2
- package/pervasives.md +275 -275
- package/priorityqueue.gr +7 -7
- package/priorityqueue.md +131 -131
- package/queue.gr +183 -29
- package/queue.md +404 -148
- package/random.md +43 -43
- package/range.gr +4 -4
- package/range.md +42 -42
- package/rational.md +123 -123
- package/regex.gr +52 -51
- package/regex.md +102 -102
- package/result.md +118 -118
- package/runtime/atof/common.md +39 -39
- package/runtime/atof/decimal.gr +6 -6
- package/runtime/atof/decimal.md +14 -14
- package/runtime/atof/lemire.gr +5 -5
- package/runtime/atof/lemire.md +1 -1
- package/runtime/atof/parse.gr +16 -16
- package/runtime/atof/parse.md +2 -2
- package/runtime/atof/slow.md +1 -1
- package/runtime/atof/table.md +2 -2
- package/runtime/atoi/parse.gr +3 -3
- package/runtime/atoi/parse.md +1 -1
- package/runtime/bigint.gr +15 -47
- package/runtime/bigint.md +54 -60
- package/runtime/compare.gr +2 -2
- package/runtime/compare.md +8 -8
- package/runtime/dataStructures.md +211 -211
- package/runtime/debugPrint.gr +4 -1
- package/runtime/debugPrint.md +9 -9
- package/runtime/equal.gr +99 -77
- package/runtime/equal.md +8 -8
- package/runtime/exception.gr +62 -82
- package/runtime/exception.md +62 -11
- package/runtime/gc.gr +39 -45
- package/runtime/gc.md +4 -4
- package/runtime/malloc.gr +7 -7
- package/runtime/malloc.md +13 -13
- package/runtime/math/kernel/cos.gr +70 -0
- package/runtime/math/kernel/cos.md +14 -0
- package/runtime/math/kernel/sin.gr +65 -0
- package/runtime/math/kernel/sin.md +14 -0
- package/runtime/math/kernel/tan.gr +136 -0
- package/runtime/math/kernel/tan.md +14 -0
- package/runtime/math/rempio2.gr +244 -0
- package/runtime/math/rempio2.md +14 -0
- package/runtime/math/trig.gr +130 -0
- package/runtime/math/trig.md +28 -0
- package/runtime/math/umuldi.gr +26 -0
- package/runtime/math/umuldi.md +14 -0
- package/runtime/numberUtils.gr +29 -29
- package/runtime/numberUtils.md +12 -12
- package/runtime/numbers.gr +373 -381
- package/runtime/numbers.md +348 -342
- package/runtime/string.gr +37 -105
- package/runtime/string.md +20 -26
- package/runtime/unsafe/constants.md +24 -24
- package/runtime/unsafe/conv.md +19 -19
- package/runtime/unsafe/memory.gr +24 -20
- package/runtime/unsafe/memory.md +27 -7
- package/runtime/unsafe/offsets.gr +36 -0
- package/runtime/unsafe/offsets.md +88 -0
- package/runtime/unsafe/panic.gr +28 -0
- package/runtime/unsafe/panic.md +14 -0
- package/runtime/unsafe/tags.md +32 -32
- package/runtime/unsafe/wasmf32.md +28 -28
- package/runtime/unsafe/wasmf64.md +28 -28
- package/runtime/unsafe/wasmi32.md +47 -47
- package/runtime/unsafe/wasmi64.md +50 -50
- package/runtime/utf8.gr +189 -0
- package/runtime/utf8.md +117 -0
- package/runtime/wasi.gr +4 -2
- package/runtime/wasi.md +147 -147
- package/set.gr +18 -11
- package/set.md +253 -247
- package/stack.gr +171 -2
- package/stack.md +371 -89
- package/string.gr +352 -557
- package/string.md +298 -255
- package/uint16.md +170 -170
- package/uint32.gr +25 -4
- package/uint32.md +249 -214
- package/uint64.gr +25 -5
- package/uint64.md +249 -214
- package/uint8.md +170 -170
- package/uri.gr +57 -53
- package/uri.md +88 -89
- package/wasi/file.gr +67 -59
- package/wasi/file.md +308 -308
- package/wasi/process.md +26 -26
- package/wasi/random.md +12 -12
- package/wasi/time.md +16 -16
- package/runtime/utils/printing.gr +0 -60
- package/runtime/utils/printing.md +0 -26
|
@@ -9,619 +9,619 @@ Functions and constants included in the DataStructures module.
|
|
|
9
9
|
### DataStructures.**allocateArray**
|
|
10
10
|
|
|
11
11
|
```grain
|
|
12
|
-
allocateArray
|
|
12
|
+
allocateArray: (size: WasmI32) => WasmI32
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Allocates a new Grain array.
|
|
16
16
|
|
|
17
17
|
Parameters:
|
|
18
18
|
|
|
19
|
-
|param|type|description|
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
| param | type | description |
|
|
20
|
+
| ------ | --------- | ---------------------------------------------------- |
|
|
21
|
+
| `size` | `WasmI32` | The number of elements to be contained in this array |
|
|
22
22
|
|
|
23
23
|
Returns:
|
|
24
24
|
|
|
25
|
-
|type|description|
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
| type | description |
|
|
26
|
+
| --------- | ------------------------ |
|
|
27
|
+
| `WasmI32` | The pointer to the array |
|
|
28
28
|
|
|
29
29
|
### DataStructures.**allocateTuple**
|
|
30
30
|
|
|
31
31
|
```grain
|
|
32
|
-
allocateTuple
|
|
32
|
+
allocateTuple: (size: WasmI32) => WasmI32
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Allocates a new Grain tuple.
|
|
36
36
|
|
|
37
37
|
Parameters:
|
|
38
38
|
|
|
39
|
-
|param|type|description|
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
| param | type | description |
|
|
40
|
+
| ------ | --------- | ---------------------------------------------------- |
|
|
41
|
+
| `size` | `WasmI32` | The number of elements to be contained in this tuple |
|
|
42
42
|
|
|
43
43
|
Returns:
|
|
44
44
|
|
|
45
|
-
|type|description|
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
| type | description |
|
|
46
|
+
| --------- | ------------------------ |
|
|
47
|
+
| `WasmI32` | The pointer to the tuple |
|
|
48
48
|
|
|
49
49
|
### DataStructures.**allocateBytes**
|
|
50
50
|
|
|
51
51
|
```grain
|
|
52
|
-
allocateBytes
|
|
52
|
+
allocateBytes: (size: WasmI32) => WasmI32
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
Allocates a new Grain bytes.
|
|
56
56
|
|
|
57
57
|
Parameters:
|
|
58
58
|
|
|
59
|
-
|param|type|description|
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
| param | type | description |
|
|
60
|
+
| ------ | --------- | -------------------------------------------------- |
|
|
61
|
+
| `size` | `WasmI32` | The number of bytes to be contained in this buffer |
|
|
62
62
|
|
|
63
63
|
Returns:
|
|
64
64
|
|
|
65
|
-
|type|description|
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
| type | description |
|
|
66
|
+
| --------- | ------------------------ |
|
|
67
|
+
| `WasmI32` | The pointer to the bytes |
|
|
68
68
|
|
|
69
69
|
### DataStructures.**allocateString**
|
|
70
70
|
|
|
71
71
|
```grain
|
|
72
|
-
allocateString
|
|
72
|
+
allocateString: (size: WasmI32) => WasmI32
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
Allocates a new Grain string.
|
|
76
76
|
|
|
77
77
|
Parameters:
|
|
78
78
|
|
|
79
|
-
|param|type|description|
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
| param | type | description |
|
|
80
|
+
| ------ | --------- | --------------------------------------------- |
|
|
81
|
+
| `size` | `WasmI32` | The size (in bytes) of the string to allocate |
|
|
82
82
|
|
|
83
83
|
Returns:
|
|
84
84
|
|
|
85
|
-
|type|description|
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
| type | description |
|
|
86
|
+
| --------- | ------------------------- |
|
|
87
|
+
| `WasmI32` | The pointer to the string |
|
|
88
88
|
|
|
89
89
|
### DataStructures.**allocateInt32**
|
|
90
90
|
|
|
91
91
|
```grain
|
|
92
|
-
allocateInt32
|
|
92
|
+
allocateInt32: () => WasmI32
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
Allocates a new Int32.
|
|
96
96
|
|
|
97
97
|
Returns:
|
|
98
98
|
|
|
99
|
-
|type|description|
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
| type | description |
|
|
100
|
+
| --------- | ------------------------------ |
|
|
101
|
+
| `WasmI32` | The pointer to the empty Int32 |
|
|
102
102
|
|
|
103
103
|
### DataStructures.**newInt32**
|
|
104
104
|
|
|
105
105
|
```grain
|
|
106
|
-
newInt32
|
|
106
|
+
newInt32: (int: WasmI32) => WasmI32
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
Allocates a new Int32 with a prepopulated value
|
|
110
110
|
|
|
111
111
|
Parameters:
|
|
112
112
|
|
|
113
|
-
|param|type|description|
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
| param | type | description |
|
|
114
|
+
| ----- | --------- | ------------------ |
|
|
115
|
+
| `int` | `WasmI32` | The value to store |
|
|
116
116
|
|
|
117
117
|
Returns:
|
|
118
118
|
|
|
119
|
-
|type|description|
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
| type | description |
|
|
120
|
+
| --------- | ------------------------ |
|
|
121
|
+
| `WasmI32` | The pointer to the Int32 |
|
|
122
122
|
|
|
123
123
|
### DataStructures.**allocateUint32**
|
|
124
124
|
|
|
125
125
|
```grain
|
|
126
|
-
allocateUint32
|
|
126
|
+
allocateUint32: () => WasmI32
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
Allocates a new Uint32.
|
|
130
130
|
|
|
131
131
|
Returns:
|
|
132
132
|
|
|
133
|
-
|type|description|
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
| type | description |
|
|
134
|
+
| --------- | ------------------------------- |
|
|
135
|
+
| `WasmI32` | The pointer to the empty Uint32 |
|
|
136
136
|
|
|
137
137
|
### DataStructures.**newUint32**
|
|
138
138
|
|
|
139
139
|
```grain
|
|
140
|
-
newUint32
|
|
140
|
+
newUint32: (int: WasmI32) => WasmI32
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
Allocates a new Uint32 with a prepopulated value
|
|
144
144
|
|
|
145
145
|
Parameters:
|
|
146
146
|
|
|
147
|
-
|param|type|description|
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
| param | type | description |
|
|
148
|
+
| ----- | --------- | ------------------ |
|
|
149
|
+
| `int` | `WasmI32` | The value to store |
|
|
150
150
|
|
|
151
151
|
Returns:
|
|
152
152
|
|
|
153
|
-
|type|description|
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
| type | description |
|
|
154
|
+
| --------- | ------------------------- |
|
|
155
|
+
| `WasmI32` | The pointer to the Uint32 |
|
|
156
156
|
|
|
157
157
|
### DataStructures.**allocateInt64**
|
|
158
158
|
|
|
159
159
|
```grain
|
|
160
|
-
allocateInt64
|
|
160
|
+
allocateInt64: () => WasmI32
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
Allocates a new Int64.
|
|
164
164
|
|
|
165
165
|
Returns:
|
|
166
166
|
|
|
167
|
-
|type|description|
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
| type | description |
|
|
168
|
+
| --------- | ------------------------------ |
|
|
169
|
+
| `WasmI32` | The pointer to the empty Int64 |
|
|
170
170
|
|
|
171
171
|
### DataStructures.**newInt64**
|
|
172
172
|
|
|
173
173
|
```grain
|
|
174
|
-
newInt64
|
|
174
|
+
newInt64: (int: WasmI64) => WasmI32
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
Allocates a new Int64 with a prepopulated value
|
|
178
178
|
|
|
179
179
|
Parameters:
|
|
180
180
|
|
|
181
|
-
|param|type|description|
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
| param | type | description |
|
|
182
|
+
| ----- | --------- | ------------------ |
|
|
183
|
+
| `int` | `WasmI64` | The value to store |
|
|
184
184
|
|
|
185
185
|
Returns:
|
|
186
186
|
|
|
187
|
-
|type|description|
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
| type | description |
|
|
188
|
+
| --------- | ------------------------ |
|
|
189
|
+
| `WasmI32` | The pointer to the Int64 |
|
|
190
190
|
|
|
191
191
|
### DataStructures.**allocateUint64**
|
|
192
192
|
|
|
193
193
|
```grain
|
|
194
|
-
allocateUint64
|
|
194
|
+
allocateUint64: () => WasmI32
|
|
195
195
|
```
|
|
196
196
|
|
|
197
197
|
Allocates a new Uint64.
|
|
198
198
|
|
|
199
199
|
Returns:
|
|
200
200
|
|
|
201
|
-
|type|description|
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
| type | description |
|
|
202
|
+
| --------- | ------------------------------- |
|
|
203
|
+
| `WasmI32` | The pointer to the empty Uint64 |
|
|
204
204
|
|
|
205
205
|
### DataStructures.**newUint64**
|
|
206
206
|
|
|
207
207
|
```grain
|
|
208
|
-
newUint64
|
|
208
|
+
newUint64: (int: WasmI64) => WasmI32
|
|
209
209
|
```
|
|
210
210
|
|
|
211
211
|
Allocates a new Uint64 with a prepopulated value
|
|
212
212
|
|
|
213
213
|
Parameters:
|
|
214
214
|
|
|
215
|
-
|param|type|description|
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
| param | type | description |
|
|
216
|
+
| ----- | --------- | ------------------ |
|
|
217
|
+
| `int` | `WasmI64` | The value to store |
|
|
218
218
|
|
|
219
219
|
Returns:
|
|
220
220
|
|
|
221
|
-
|type|description|
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
| type | description |
|
|
222
|
+
| --------- | ------------------------- |
|
|
223
|
+
| `WasmI32` | The pointer to the Uint64 |
|
|
224
224
|
|
|
225
225
|
### DataStructures.**allocateFloat32**
|
|
226
226
|
|
|
227
227
|
```grain
|
|
228
|
-
allocateFloat32
|
|
228
|
+
allocateFloat32: () => WasmI32
|
|
229
229
|
```
|
|
230
230
|
|
|
231
231
|
Allocates a new Float32.
|
|
232
232
|
|
|
233
233
|
Returns:
|
|
234
234
|
|
|
235
|
-
|type|description|
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
| type | description |
|
|
236
|
+
| --------- | -------------------------------- |
|
|
237
|
+
| `WasmI32` | The pointer to the empty Float32 |
|
|
238
238
|
|
|
239
239
|
### DataStructures.**newFloat32**
|
|
240
240
|
|
|
241
241
|
```grain
|
|
242
|
-
newFloat32
|
|
242
|
+
newFloat32: (float: WasmF32) => WasmI32
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
Allocates a new Float32 with a prepopulated value
|
|
246
246
|
|
|
247
247
|
Parameters:
|
|
248
248
|
|
|
249
|
-
|param|type|description|
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
| param | type | description |
|
|
250
|
+
| ------- | --------- | ------------------ |
|
|
251
|
+
| `float` | `WasmF32` | The value to store |
|
|
252
252
|
|
|
253
253
|
Returns:
|
|
254
254
|
|
|
255
|
-
|type|description|
|
|
256
|
-
|
|
257
|
-
|
|
255
|
+
| type | description |
|
|
256
|
+
| --------- | -------------------------- |
|
|
257
|
+
| `WasmI32` | the pointer to the Float32 |
|
|
258
258
|
|
|
259
259
|
### DataStructures.**allocateFloat64**
|
|
260
260
|
|
|
261
261
|
```grain
|
|
262
|
-
allocateFloat64
|
|
262
|
+
allocateFloat64: () => WasmI32
|
|
263
263
|
```
|
|
264
264
|
|
|
265
265
|
Allocates a new Float64.
|
|
266
266
|
|
|
267
267
|
Returns:
|
|
268
268
|
|
|
269
|
-
|type|description|
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
| type | description |
|
|
270
|
+
| --------- | -------------------------------- |
|
|
271
|
+
| `WasmI32` | The pointer to the empty Float64 |
|
|
272
272
|
|
|
273
273
|
### DataStructures.**newFloat64**
|
|
274
274
|
|
|
275
275
|
```grain
|
|
276
|
-
newFloat64
|
|
276
|
+
newFloat64: (float: WasmF64) => WasmI32
|
|
277
277
|
```
|
|
278
278
|
|
|
279
279
|
Allocates a new Float64 with a prepopulated value
|
|
280
280
|
|
|
281
281
|
Parameters:
|
|
282
282
|
|
|
283
|
-
|param|type|description|
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
| param | type | description |
|
|
284
|
+
| ------- | --------- | ------------------ |
|
|
285
|
+
| `float` | `WasmF64` | The value to store |
|
|
286
286
|
|
|
287
287
|
Returns:
|
|
288
288
|
|
|
289
|
-
|type|description|
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
| type | description |
|
|
290
|
+
| --------- | -------------------------- |
|
|
291
|
+
| `WasmI32` | The pointer to the Float64 |
|
|
292
292
|
|
|
293
293
|
### DataStructures.**allocateRational**
|
|
294
294
|
|
|
295
295
|
```grain
|
|
296
|
-
allocateRational
|
|
296
|
+
allocateRational: () => WasmI32
|
|
297
297
|
```
|
|
298
298
|
|
|
299
299
|
Allocates a new Rational.
|
|
300
300
|
|
|
301
301
|
Returns:
|
|
302
302
|
|
|
303
|
-
|type|description|
|
|
304
|
-
|
|
305
|
-
|
|
303
|
+
| type | description |
|
|
304
|
+
| --------- | --------------------------------- |
|
|
305
|
+
| `WasmI32` | The pointer to the empty Rational |
|
|
306
306
|
|
|
307
307
|
### DataStructures.**newRational**
|
|
308
308
|
|
|
309
309
|
```grain
|
|
310
|
-
newRational
|
|
310
|
+
newRational: (numerator: WasmI32, denominator: WasmI32) => WasmI32
|
|
311
311
|
```
|
|
312
312
|
|
|
313
313
|
Allocates a new Rational with a prepopulated value
|
|
314
314
|
|
|
315
315
|
Parameters:
|
|
316
316
|
|
|
317
|
-
|param|type|description|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
317
|
+
| param | type | description |
|
|
318
|
+
| ------------- | --------- | ------------------------------ |
|
|
319
|
+
| `numerator` | `WasmI32` | The numerator value to store |
|
|
320
|
+
| `denominator` | `WasmI32` | The denominator value to store |
|
|
321
321
|
|
|
322
322
|
Returns:
|
|
323
323
|
|
|
324
|
-
|type|description|
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
| type | description |
|
|
325
|
+
| --------- | --------------------------- |
|
|
326
|
+
| `WasmI32` | The pointer to the Rational |
|
|
327
327
|
|
|
328
328
|
### DataStructures.**loadAdtVariant**
|
|
329
329
|
|
|
330
330
|
```grain
|
|
331
|
-
loadAdtVariant
|
|
331
|
+
loadAdtVariant: (ptr: WasmI32) => WasmI32
|
|
332
332
|
```
|
|
333
333
|
|
|
334
334
|
Load the (tagged) variant of an ADT.
|
|
335
335
|
|
|
336
336
|
Parameters:
|
|
337
337
|
|
|
338
|
-
|param|type|description|
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
| param | type | description |
|
|
339
|
+
| ----- | --------- | --------------------------- |
|
|
340
|
+
| `ptr` | `WasmI32` | Untagged pointer to the ADT |
|
|
341
341
|
|
|
342
342
|
Returns:
|
|
343
343
|
|
|
344
|
-
|type|description|
|
|
345
|
-
|
|
346
|
-
|
|
344
|
+
| type | description |
|
|
345
|
+
| --------- | --------------------------- |
|
|
346
|
+
| `WasmI32` | The (tagged) ADT variant id |
|
|
347
347
|
|
|
348
348
|
### DataStructures.**stringSize**
|
|
349
349
|
|
|
350
350
|
```grain
|
|
351
|
-
stringSize
|
|
351
|
+
stringSize: (ptr: WasmI32) => WasmI32
|
|
352
352
|
```
|
|
353
353
|
|
|
354
354
|
Load an untagged string's size.
|
|
355
355
|
|
|
356
356
|
Parameters:
|
|
357
357
|
|
|
358
|
-
|param|type|description|
|
|
359
|
-
|
|
360
|
-
|
|
358
|
+
| param | type | description |
|
|
359
|
+
| ----- | --------- | ------------------------------ |
|
|
360
|
+
| `ptr` | `WasmI32` | Untagged pointer to the string |
|
|
361
361
|
|
|
362
362
|
Returns:
|
|
363
363
|
|
|
364
|
-
|type|description|
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
| type | description |
|
|
365
|
+
| --------- | -------------------------- |
|
|
366
|
+
| `WasmI32` | The string size (in bytes) |
|
|
367
367
|
|
|
368
368
|
### DataStructures.**bytesSize**
|
|
369
369
|
|
|
370
370
|
```grain
|
|
371
|
-
bytesSize
|
|
371
|
+
bytesSize: (ptr: WasmI32) => WasmI32
|
|
372
372
|
```
|
|
373
373
|
|
|
374
374
|
Load an untagged Bytes' size.
|
|
375
375
|
|
|
376
376
|
Parameters:
|
|
377
377
|
|
|
378
|
-
|param|type|description|
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
| param | type | description |
|
|
379
|
+
| ----- | --------- | ----------------------------- |
|
|
380
|
+
| `ptr` | `WasmI32` | Untagged pointer to the Bytes |
|
|
381
381
|
|
|
382
382
|
Returns:
|
|
383
383
|
|
|
384
|
-
|type|description|
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
| type | description |
|
|
385
|
+
| --------- | ------------------------- |
|
|
386
|
+
| `WasmI32` | The Bytes size (in bytes) |
|
|
387
387
|
|
|
388
388
|
### DataStructures.**tagSimpleNumber**
|
|
389
389
|
|
|
390
390
|
```grain
|
|
391
|
-
tagSimpleNumber
|
|
391
|
+
tagSimpleNumber: (num: WasmI32) => Number
|
|
392
392
|
```
|
|
393
393
|
|
|
394
394
|
Tag a simple number.
|
|
395
395
|
|
|
396
396
|
Parameters:
|
|
397
397
|
|
|
398
|
-
|param|type|description|
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
| param | type | description |
|
|
399
|
+
| ----- | --------- | ----------------- |
|
|
400
|
+
| `num` | `WasmI32` | The number to tag |
|
|
401
401
|
|
|
402
402
|
Returns:
|
|
403
403
|
|
|
404
|
-
|type|description|
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
| type | description |
|
|
405
|
+
| -------- | ----------------- |
|
|
406
|
+
| `Number` | The tagged number |
|
|
407
407
|
|
|
408
408
|
### DataStructures.**untagSimpleNumber**
|
|
409
409
|
|
|
410
410
|
```grain
|
|
411
|
-
untagSimpleNumber
|
|
411
|
+
untagSimpleNumber: (num: Number) => WasmI32
|
|
412
412
|
```
|
|
413
413
|
|
|
414
414
|
Untag a simple number.
|
|
415
415
|
|
|
416
416
|
Parameters:
|
|
417
417
|
|
|
418
|
-
|param|type|description|
|
|
419
|
-
|
|
420
|
-
|
|
418
|
+
| param | type | description |
|
|
419
|
+
| ----- | -------- | ------------------- |
|
|
420
|
+
| `num` | `Number` | The number to untag |
|
|
421
421
|
|
|
422
422
|
Returns:
|
|
423
423
|
|
|
424
|
-
|type|description|
|
|
425
|
-
|
|
426
|
-
|
|
424
|
+
| type | description |
|
|
425
|
+
| --------- | ------------------- |
|
|
426
|
+
| `WasmI32` | The untagged number |
|
|
427
427
|
|
|
428
428
|
### DataStructures.**tagChar**
|
|
429
429
|
|
|
430
430
|
```grain
|
|
431
|
-
tagChar
|
|
431
|
+
tagChar: (char: WasmI32) => Char
|
|
432
432
|
```
|
|
433
433
|
|
|
434
434
|
Tag a char.
|
|
435
435
|
|
|
436
436
|
Parameters:
|
|
437
437
|
|
|
438
|
-
|param|type|description|
|
|
439
|
-
|
|
440
|
-
|
|
438
|
+
| param | type | description |
|
|
439
|
+
| ------ | --------- | -------------- |
|
|
440
|
+
| `char` | `WasmI32` | The usv to tag |
|
|
441
441
|
|
|
442
442
|
Returns:
|
|
443
443
|
|
|
444
|
-
|type|description|
|
|
445
|
-
|
|
446
|
-
|
|
444
|
+
| type | description |
|
|
445
|
+
| ------ | --------------- |
|
|
446
|
+
| `Char` | The tagged char |
|
|
447
447
|
|
|
448
448
|
### DataStructures.**untagChar**
|
|
449
449
|
|
|
450
450
|
```grain
|
|
451
|
-
untagChar
|
|
451
|
+
untagChar: (char: Char) => WasmI32
|
|
452
452
|
```
|
|
453
453
|
|
|
454
454
|
Untag a char.
|
|
455
455
|
|
|
456
456
|
Parameters:
|
|
457
457
|
|
|
458
|
-
|param|type|description|
|
|
459
|
-
|
|
460
|
-
|
|
458
|
+
| param | type | description |
|
|
459
|
+
| ------ | ------ | ----------------- |
|
|
460
|
+
| `char` | `Char` | The char to untag |
|
|
461
461
|
|
|
462
462
|
Returns:
|
|
463
463
|
|
|
464
|
-
|type|description|
|
|
465
|
-
|
|
466
|
-
|
|
464
|
+
| type | description |
|
|
465
|
+
| --------- | ---------------- |
|
|
466
|
+
| `WasmI32` | The untagged usv |
|
|
467
467
|
|
|
468
468
|
### DataStructures.**tagInt8**
|
|
469
469
|
|
|
470
470
|
```grain
|
|
471
|
-
tagInt8
|
|
471
|
+
tagInt8: (int: WasmI32) => Int8
|
|
472
472
|
```
|
|
473
473
|
|
|
474
474
|
Tag an int8.
|
|
475
475
|
|
|
476
476
|
Parameters:
|
|
477
477
|
|
|
478
|
-
|param|type|description|
|
|
479
|
-
|
|
480
|
-
|
|
478
|
+
| param | type | description |
|
|
479
|
+
| ----- | --------- | --------------- |
|
|
480
|
+
| `int` | `WasmI32` | The int8 to tag |
|
|
481
481
|
|
|
482
482
|
Returns:
|
|
483
483
|
|
|
484
|
-
|type|description|
|
|
485
|
-
|
|
486
|
-
|
|
484
|
+
| type | description |
|
|
485
|
+
| ------ | --------------- |
|
|
486
|
+
| `Int8` | The tagged int8 |
|
|
487
487
|
|
|
488
488
|
### DataStructures.**untagInt8**
|
|
489
489
|
|
|
490
490
|
```grain
|
|
491
|
-
untagInt8
|
|
491
|
+
untagInt8: (int: Int8) => WasmI32
|
|
492
492
|
```
|
|
493
493
|
|
|
494
494
|
Untag an int8.
|
|
495
495
|
|
|
496
496
|
Parameters:
|
|
497
497
|
|
|
498
|
-
|param|type|description|
|
|
499
|
-
|
|
500
|
-
|
|
498
|
+
| param | type | description |
|
|
499
|
+
| ----- | ------ | ----------------- |
|
|
500
|
+
| `int` | `Int8` | The int8 to untag |
|
|
501
501
|
|
|
502
502
|
Returns:
|
|
503
503
|
|
|
504
|
-
|type|description|
|
|
505
|
-
|
|
506
|
-
|
|
504
|
+
| type | description |
|
|
505
|
+
| --------- | ----------------- |
|
|
506
|
+
| `WasmI32` | The untagged int8 |
|
|
507
507
|
|
|
508
508
|
### DataStructures.**tagInt16**
|
|
509
509
|
|
|
510
510
|
```grain
|
|
511
|
-
tagInt16
|
|
511
|
+
tagInt16: (int: WasmI32) => Int16
|
|
512
512
|
```
|
|
513
513
|
|
|
514
514
|
Tag an int16.
|
|
515
515
|
|
|
516
516
|
Parameters:
|
|
517
517
|
|
|
518
|
-
|param|type|description|
|
|
519
|
-
|
|
520
|
-
|
|
518
|
+
| param | type | description |
|
|
519
|
+
| ----- | --------- | ---------------- |
|
|
520
|
+
| `int` | `WasmI32` | The int16 to tag |
|
|
521
521
|
|
|
522
522
|
Returns:
|
|
523
523
|
|
|
524
|
-
|type|description|
|
|
525
|
-
|
|
526
|
-
|
|
524
|
+
| type | description |
|
|
525
|
+
| ------- | ---------------- |
|
|
526
|
+
| `Int16` | The tagged int16 |
|
|
527
527
|
|
|
528
528
|
### DataStructures.**untagInt16**
|
|
529
529
|
|
|
530
530
|
```grain
|
|
531
|
-
untagInt16
|
|
531
|
+
untagInt16: (int: Int16) => WasmI32
|
|
532
532
|
```
|
|
533
533
|
|
|
534
534
|
Untag an int16.
|
|
535
535
|
|
|
536
536
|
Parameters:
|
|
537
537
|
|
|
538
|
-
|param|type|description|
|
|
539
|
-
|
|
540
|
-
|
|
538
|
+
| param | type | description |
|
|
539
|
+
| ----- | ------- | ------------------ |
|
|
540
|
+
| `int` | `Int16` | The int16 to untag |
|
|
541
541
|
|
|
542
542
|
Returns:
|
|
543
543
|
|
|
544
|
-
|type|description|
|
|
545
|
-
|
|
546
|
-
|
|
544
|
+
| type | description |
|
|
545
|
+
| --------- | ------------------ |
|
|
546
|
+
| `WasmI32` | The untagged int16 |
|
|
547
547
|
|
|
548
548
|
### DataStructures.**tagUint8**
|
|
549
549
|
|
|
550
550
|
```grain
|
|
551
|
-
tagUint8
|
|
551
|
+
tagUint8: (int: WasmI32) => Uint8
|
|
552
552
|
```
|
|
553
553
|
|
|
554
554
|
Tag a uint8.
|
|
555
555
|
|
|
556
556
|
Parameters:
|
|
557
557
|
|
|
558
|
-
|param|type|description|
|
|
559
|
-
|
|
560
|
-
|
|
558
|
+
| param | type | description |
|
|
559
|
+
| ----- | --------- | ---------------- |
|
|
560
|
+
| `int` | `WasmI32` | The uint8 to tag |
|
|
561
561
|
|
|
562
562
|
Returns:
|
|
563
563
|
|
|
564
|
-
|type|description|
|
|
565
|
-
|
|
566
|
-
|
|
564
|
+
| type | description |
|
|
565
|
+
| ------- | ---------------- |
|
|
566
|
+
| `Uint8` | The tagged uint8 |
|
|
567
567
|
|
|
568
568
|
### DataStructures.**untagUint8**
|
|
569
569
|
|
|
570
570
|
```grain
|
|
571
|
-
untagUint8
|
|
571
|
+
untagUint8: (int: Uint8) => WasmI32
|
|
572
572
|
```
|
|
573
573
|
|
|
574
574
|
Untag a uint8.
|
|
575
575
|
|
|
576
576
|
Parameters:
|
|
577
577
|
|
|
578
|
-
|param|type|description|
|
|
579
|
-
|
|
580
|
-
|
|
578
|
+
| param | type | description |
|
|
579
|
+
| ----- | ------- | ------------------ |
|
|
580
|
+
| `int` | `Uint8` | The uint8 to untag |
|
|
581
581
|
|
|
582
582
|
Returns:
|
|
583
583
|
|
|
584
|
-
|type|description|
|
|
585
|
-
|
|
586
|
-
|
|
584
|
+
| type | description |
|
|
585
|
+
| --------- | ------------------ |
|
|
586
|
+
| `WasmI32` | The untagged uint8 |
|
|
587
587
|
|
|
588
588
|
### DataStructures.**tagUint16**
|
|
589
589
|
|
|
590
590
|
```grain
|
|
591
|
-
tagUint16
|
|
591
|
+
tagUint16: (int: WasmI32) => Uint16
|
|
592
592
|
```
|
|
593
593
|
|
|
594
594
|
Tag a uint16.
|
|
595
595
|
|
|
596
596
|
Parameters:
|
|
597
597
|
|
|
598
|
-
|param|type|description|
|
|
599
|
-
|
|
600
|
-
|
|
598
|
+
| param | type | description |
|
|
599
|
+
| ----- | --------- | ----------------- |
|
|
600
|
+
| `int` | `WasmI32` | The uint16 to tag |
|
|
601
601
|
|
|
602
602
|
Returns:
|
|
603
603
|
|
|
604
|
-
|type|description|
|
|
605
|
-
|
|
606
|
-
|
|
604
|
+
| type | description |
|
|
605
|
+
| -------- | ----------------- |
|
|
606
|
+
| `Uint16` | The tagged uint16 |
|
|
607
607
|
|
|
608
608
|
### DataStructures.**untagUint16**
|
|
609
609
|
|
|
610
610
|
```grain
|
|
611
|
-
untagUint16
|
|
611
|
+
untagUint16: (int: Uint16) => WasmI32
|
|
612
612
|
```
|
|
613
613
|
|
|
614
614
|
Untag a uint16.
|
|
615
615
|
|
|
616
616
|
Parameters:
|
|
617
617
|
|
|
618
|
-
|param|type|description|
|
|
619
|
-
|
|
620
|
-
|
|
618
|
+
| param | type | description |
|
|
619
|
+
| ----- | -------- | ------------------- |
|
|
620
|
+
| `int` | `Uint16` | The uint16 to untag |
|
|
621
621
|
|
|
622
622
|
Returns:
|
|
623
623
|
|
|
624
|
-
|type|description|
|
|
625
|
-
|
|
626
|
-
|
|
624
|
+
| type | description |
|
|
625
|
+
| --------- | ------------------- |
|
|
626
|
+
| `WasmI32` | The untagged uint16 |
|
|
627
627
|
|