toilscript 0.0.1 → 0.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.
- package/LICENSE +201 -201
- package/NOTICE +94 -94
- package/README.md +101 -114
- package/bin/asc.js +0 -0
- package/bin/asinit.js +6 -6
- package/dist/asc.generated.d.ts +10027 -0
- package/dist/asc.js +24474 -0
- package/dist/asc.js.map +7 -0
- package/dist/importmap.json +9 -0
- package/dist/toilscript.generated.d.ts +11242 -0
- package/dist/toilscript.js +337 -0
- package/dist/toilscript.js.map +7 -0
- package/dist/web.js +22 -0
- package/lib/binaryen.d.ts +2 -2
- package/lib/binaryen.js +2 -2
- package/package.json +115 -114
- package/std/README.md +6 -6
- package/std/assembly/array.ts +550 -550
- package/std/assembly/arraybuffer.ts +77 -77
- package/std/assembly/atomics.ts +127 -127
- package/std/assembly/bindings/asyncify.ts +16 -16
- package/std/assembly/bindings/dom.ts +291 -291
- package/std/assembly/bindings/node.ts +6 -6
- package/std/assembly/bitflags.ts +53 -53
- package/std/assembly/builtins.ts +2650 -2650
- package/std/assembly/byteslice.ts +177 -177
- package/std/assembly/compat.ts +2 -2
- package/std/assembly/console.ts +42 -42
- package/std/assembly/crypto.ts +9 -9
- package/std/assembly/dataview.ts +181 -181
- package/std/assembly/date.ts +375 -375
- package/std/assembly/diagnostics.ts +11 -11
- package/std/assembly/encoding.ts +151 -151
- package/std/assembly/endian.ts +45 -45
- package/std/assembly/error.ts +44 -44
- package/std/assembly/fixedarray.ts +173 -173
- package/std/assembly/fixedmap.ts +326 -326
- package/std/assembly/fixedset.ts +275 -275
- package/std/assembly/function.ts +42 -42
- package/std/assembly/index.d.ts +2892 -2891
- package/std/assembly/iterator.ts +35 -35
- package/std/assembly/map.ts +269 -269
- package/std/assembly/math.ts +3289 -3289
- package/std/assembly/memory.ts +123 -123
- package/std/assembly/number.ts +388 -388
- package/std/assembly/object.ts +36 -36
- package/std/assembly/performance.ts +9 -9
- package/std/assembly/pointer.ts +80 -80
- package/std/assembly/polyfills.ts +27 -27
- package/std/assembly/process.ts +50 -50
- package/std/assembly/reference.ts +48 -48
- package/std/assembly/regexp.ts +12 -12
- package/std/assembly/rt/README.md +83 -83
- package/std/assembly/rt/common.ts +81 -81
- package/std/assembly/rt/index-incremental.ts +2 -2
- package/std/assembly/rt/index-memory.ts +1 -1
- package/std/assembly/rt/index-minimal.ts +2 -2
- package/std/assembly/rt/index-stub.ts +1 -1
- package/std/assembly/rt/index.d.ts +37 -37
- package/std/assembly/rt/itcms.ts +419 -419
- package/std/assembly/rt/memory-runtime.ts +94 -94
- package/std/assembly/rt/rtrace.ts +15 -15
- package/std/assembly/rt/stub.ts +133 -133
- package/std/assembly/rt/tcms.ts +254 -254
- package/std/assembly/rt/tlsf.ts +592 -592
- package/std/assembly/rt.ts +90 -90
- package/std/assembly/set.ts +225 -225
- package/std/assembly/shared/feature.ts +68 -68
- package/std/assembly/shared/runtime.ts +13 -13
- package/std/assembly/shared/target.ts +11 -11
- package/std/assembly/shared/tsconfig.json +11 -11
- package/std/assembly/shared/typeinfo.ts +72 -72
- package/std/assembly/staticarray.ts +423 -423
- package/std/assembly/string.ts +850 -850
- package/std/assembly/symbol.ts +114 -114
- package/std/assembly/table.ts +16 -16
- package/std/assembly/toilscript.ts +16 -0
- package/std/assembly/tsconfig.json +6 -6
- package/std/assembly/typedarray.ts +1954 -1954
- package/std/assembly/uri.ts +17 -17
- package/std/assembly/util/bytes.ts +107 -107
- package/std/assembly/util/casemap.ts +497 -497
- package/std/assembly/util/error.ts +58 -58
- package/std/assembly/util/hash.ts +117 -117
- package/std/assembly/util/math.ts +1922 -1922
- package/std/assembly/util/memory.ts +290 -290
- package/std/assembly/util/number.ts +873 -873
- package/std/assembly/util/sort.ts +313 -313
- package/std/assembly/util/string.ts +1202 -1202
- package/std/assembly/util/uri.ts +275 -275
- package/std/assembly/vector.ts +4 -4
- package/std/assembly.json +16 -16
- package/std/portable/index.d.ts +461 -461
- package/std/portable/index.js +416 -416
- package/std/portable.json +11 -11
- package/std/types/assembly/index.d.ts +1 -1
- package/std/types/assembly/package.json +2 -2
- package/std/types/portable/index.d.ts +1 -1
- package/std/types/portable/package.json +2 -2
- package/tsconfig-base.json +13 -13
- package/util/README.md +23 -23
- package/util/browser/fs.js +1 -1
- package/util/browser/module.js +5 -5
- package/util/browser/path.js +520 -520
- package/util/browser/process.js +59 -59
- package/util/browser/url.js +23 -23
- package/util/cpu.d.ts +9 -9
- package/util/cpu.js +42 -42
- package/util/find.d.ts +6 -6
- package/util/find.js +20 -20
- package/util/node.d.ts +21 -21
- package/util/node.js +34 -34
- package/util/options.d.ts +70 -70
- package/util/options.js +262 -262
- package/util/terminal.d.ts +52 -52
- package/util/terminal.js +35 -35
- package/util/text.d.ts +26 -26
- package/util/text.js +114 -114
- package/util/tsconfig.json +9 -9
- package/util/web.d.ts +11 -11
- package/util/web.js +33 -33
package/std/assembly/number.ts
CHANGED
|
@@ -1,388 +1,388 @@
|
|
|
1
|
-
import { itoa32, utoa32, itoa64, utoa64, dtoa } from "./util/number";
|
|
2
|
-
import { strtol, strtod } from "./util/string";
|
|
3
|
-
|
|
4
|
-
// @ts-ignore: decorator
|
|
5
|
-
@builtin @inline
|
|
6
|
-
export const NaN: f64 = 0 / 0; // context-aware
|
|
7
|
-
|
|
8
|
-
// @ts-ignore: decorator
|
|
9
|
-
@builtin @inline
|
|
10
|
-
export const Infinity: f64 = 1 / 0; // context-aware
|
|
11
|
-
|
|
12
|
-
// @ts-ignore: decorator
|
|
13
|
-
@builtin
|
|
14
|
-
export declare function isNaN<T extends number>(value: T): bool;
|
|
15
|
-
|
|
16
|
-
// @ts-ignore: decorator
|
|
17
|
-
@builtin
|
|
18
|
-
export declare function isFinite<T extends number>(value: T): bool;
|
|
19
|
-
|
|
20
|
-
@final @unmanaged
|
|
21
|
-
export abstract class I8 {
|
|
22
|
-
|
|
23
|
-
// @ts-ignore: decorator
|
|
24
|
-
@lazy
|
|
25
|
-
static readonly MIN_VALUE: i8 = i8.MIN_VALUE;
|
|
26
|
-
|
|
27
|
-
// @ts-ignore: decorator
|
|
28
|
-
@lazy
|
|
29
|
-
static readonly MAX_VALUE: i8 = i8.MAX_VALUE;
|
|
30
|
-
|
|
31
|
-
/** @deprecated */
|
|
32
|
-
static parseInt(value: string, radix: i32 = 0): i8 {
|
|
33
|
-
return <i8>strtol<i32>(value, radix);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
toString(this: i8, radix: i32 = 10): String {
|
|
37
|
-
return itoa32(this, radix);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@final @unmanaged
|
|
42
|
-
export abstract class I16 {
|
|
43
|
-
|
|
44
|
-
// @ts-ignore: decorator
|
|
45
|
-
@lazy
|
|
46
|
-
static readonly MIN_VALUE: i16 = i16.MIN_VALUE;
|
|
47
|
-
|
|
48
|
-
// @ts-ignore: decorator
|
|
49
|
-
@lazy
|
|
50
|
-
static readonly MAX_VALUE: i16 = i16.MAX_VALUE;
|
|
51
|
-
|
|
52
|
-
/** @deprecated */
|
|
53
|
-
static parseInt(value: string, radix: i32 = 0): i16 {
|
|
54
|
-
return <i16>strtol<i32>(value, radix);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
toString(this: i16, radix: i32 = 10): String {
|
|
58
|
-
return itoa32(this, radix);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@final @unmanaged
|
|
63
|
-
export abstract class I32 {
|
|
64
|
-
|
|
65
|
-
// @ts-ignore: decorator
|
|
66
|
-
@lazy
|
|
67
|
-
static readonly MIN_VALUE: i32 = i32.MIN_VALUE;
|
|
68
|
-
|
|
69
|
-
// @ts-ignore: decorator
|
|
70
|
-
@lazy
|
|
71
|
-
static readonly MAX_VALUE: i32 = i32.MAX_VALUE;
|
|
72
|
-
|
|
73
|
-
/** @deprecated */
|
|
74
|
-
static parseInt(value: string, radix: i32 = 0): i32 {
|
|
75
|
-
return <i32>strtol<i32>(value, radix);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
toString(this: i32, radix: i32 = 10): String {
|
|
79
|
-
return itoa32(this, radix);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
@final @unmanaged
|
|
84
|
-
export abstract class I64 {
|
|
85
|
-
|
|
86
|
-
// @ts-ignore: decorator
|
|
87
|
-
@lazy
|
|
88
|
-
static readonly MIN_VALUE: i64 = i64.MIN_VALUE;
|
|
89
|
-
|
|
90
|
-
// @ts-ignore: decorator
|
|
91
|
-
@lazy
|
|
92
|
-
static readonly MAX_VALUE: i64 = i64.MAX_VALUE;
|
|
93
|
-
|
|
94
|
-
/** @deprecated */
|
|
95
|
-
static parseInt(value: string, radix: i32 = 0): i64 {
|
|
96
|
-
return strtol<i64>(value, radix);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
toString(this: i64, radix: i32 = 10): String {
|
|
100
|
-
return itoa64(this, radix);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@final @unmanaged
|
|
105
|
-
export abstract class Isize {
|
|
106
|
-
|
|
107
|
-
// @ts-ignore: decorator
|
|
108
|
-
@lazy
|
|
109
|
-
static readonly MIN_VALUE: isize = isize.MIN_VALUE;
|
|
110
|
-
|
|
111
|
-
// @ts-ignore: decorator
|
|
112
|
-
@lazy
|
|
113
|
-
static readonly MAX_VALUE: isize = isize.MAX_VALUE;
|
|
114
|
-
|
|
115
|
-
/** @deprecated */
|
|
116
|
-
static parseInt(value: string, radix: i32 = 0): isize {
|
|
117
|
-
return <isize>strtol<i64>(value, radix);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
toString(this: isize, radix: i32 = 10): String {
|
|
121
|
-
if (sizeof<isize>() == 4) {
|
|
122
|
-
return itoa32(<i32>this, radix);
|
|
123
|
-
} else {
|
|
124
|
-
return itoa64(<i64>this, radix);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
@final @unmanaged
|
|
130
|
-
export abstract class U8 {
|
|
131
|
-
|
|
132
|
-
// @ts-ignore: decorator
|
|
133
|
-
@lazy
|
|
134
|
-
static readonly MIN_VALUE: u8 = u8.MIN_VALUE;
|
|
135
|
-
|
|
136
|
-
// @ts-ignore: decorator
|
|
137
|
-
@lazy
|
|
138
|
-
static readonly MAX_VALUE: u8 = u8.MAX_VALUE;
|
|
139
|
-
|
|
140
|
-
/** @deprecated */
|
|
141
|
-
static parseInt(value: string, radix: i32 = 0): u8 {
|
|
142
|
-
return <u8>strtol<i32>(value, radix);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
toString(this: u8, radix: i32 = 10): String {
|
|
146
|
-
return utoa32(this, radix);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
@final @unmanaged
|
|
151
|
-
export abstract class U16 {
|
|
152
|
-
|
|
153
|
-
// @ts-ignore: decorator
|
|
154
|
-
@lazy
|
|
155
|
-
static readonly MIN_VALUE: u16 = u16.MIN_VALUE;
|
|
156
|
-
|
|
157
|
-
// @ts-ignore: decorator
|
|
158
|
-
@lazy
|
|
159
|
-
static readonly MAX_VALUE: u16 = u16.MAX_VALUE;
|
|
160
|
-
|
|
161
|
-
/** @deprecated */
|
|
162
|
-
static parseInt(value: string, radix: i32 = 0): u16 {
|
|
163
|
-
return <u16>strtol<i32>(value, radix);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
toString(this: u16, radix: i32 = 10): String {
|
|
167
|
-
return utoa32(this, radix);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
@final @unmanaged
|
|
172
|
-
export abstract class U32 {
|
|
173
|
-
|
|
174
|
-
// @ts-ignore: decorator
|
|
175
|
-
@lazy
|
|
176
|
-
static readonly MIN_VALUE: u32 = u32.MIN_VALUE;
|
|
177
|
-
|
|
178
|
-
// @ts-ignore: decorator
|
|
179
|
-
@lazy
|
|
180
|
-
static readonly MAX_VALUE: u32 = u32.MAX_VALUE;
|
|
181
|
-
|
|
182
|
-
/** @deprecated */
|
|
183
|
-
static parseInt(value: string, radix: i32 = 0): u32 {
|
|
184
|
-
return <u32>strtol<i32>(value, radix);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
toString(this: u32, radix: i32 = 10): String {
|
|
188
|
-
return utoa32(this, radix);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
@final @unmanaged
|
|
193
|
-
export abstract class U64 {
|
|
194
|
-
|
|
195
|
-
// @ts-ignore: decorator
|
|
196
|
-
@lazy
|
|
197
|
-
static readonly MIN_VALUE: u64 = u64.MIN_VALUE;
|
|
198
|
-
|
|
199
|
-
// @ts-ignore: decorator
|
|
200
|
-
@lazy
|
|
201
|
-
static readonly MAX_VALUE: u64 = u64.MAX_VALUE;
|
|
202
|
-
|
|
203
|
-
/** @deprecated */
|
|
204
|
-
static parseInt(value: string, radix: i32 = 0): u64 {
|
|
205
|
-
return <u64>strtol<i64>(value, radix);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
toString(this: u64, radix: i32 = 10): String {
|
|
209
|
-
return utoa64(this, radix);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
@final @unmanaged
|
|
214
|
-
export abstract class Usize {
|
|
215
|
-
|
|
216
|
-
// @ts-ignore: decorator
|
|
217
|
-
@lazy
|
|
218
|
-
static readonly MIN_VALUE: usize = usize.MIN_VALUE;
|
|
219
|
-
|
|
220
|
-
// @ts-ignore: decorator
|
|
221
|
-
@lazy
|
|
222
|
-
static readonly MAX_VALUE: usize = usize.MAX_VALUE;
|
|
223
|
-
|
|
224
|
-
/** @deprecated */
|
|
225
|
-
static parseInt(value: string, radix: i32 = 0): usize {
|
|
226
|
-
return <usize>strtol<i64>(value, radix);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
toString(this: usize, radix: i32 = 10): String {
|
|
230
|
-
if (sizeof<usize>() == 4) {
|
|
231
|
-
return utoa32(<u32>this, radix);
|
|
232
|
-
} else {
|
|
233
|
-
return utoa64(<u64>this, radix);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
@final @unmanaged
|
|
239
|
-
export abstract class Bool {
|
|
240
|
-
|
|
241
|
-
// @ts-ignore: decorator
|
|
242
|
-
@lazy
|
|
243
|
-
static readonly MIN_VALUE: bool = bool.MIN_VALUE;
|
|
244
|
-
|
|
245
|
-
// @ts-ignore: decorator
|
|
246
|
-
@lazy
|
|
247
|
-
static readonly MAX_VALUE: bool = bool.MAX_VALUE;
|
|
248
|
-
|
|
249
|
-
toString(this: bool, radix: i32 = 0): String {
|
|
250
|
-
return this ? "true" : "false";
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export { Bool as Boolean };
|
|
255
|
-
|
|
256
|
-
@final @unmanaged
|
|
257
|
-
export abstract class F32 {
|
|
258
|
-
|
|
259
|
-
// @ts-ignore: decorator
|
|
260
|
-
@lazy
|
|
261
|
-
static readonly EPSILON: f32 = f32.EPSILON;
|
|
262
|
-
|
|
263
|
-
// @ts-ignore: decorator
|
|
264
|
-
@lazy
|
|
265
|
-
static readonly MIN_VALUE: f32 = f32.MIN_VALUE;
|
|
266
|
-
|
|
267
|
-
// @ts-ignore: decorator
|
|
268
|
-
@lazy
|
|
269
|
-
static readonly MAX_VALUE: f32 = f32.MAX_VALUE;
|
|
270
|
-
|
|
271
|
-
// @ts-ignore: decorator
|
|
272
|
-
@lazy
|
|
273
|
-
static readonly MIN_SAFE_INTEGER: f32 = f32.MIN_SAFE_INTEGER;
|
|
274
|
-
|
|
275
|
-
// @ts-ignore: decorator
|
|
276
|
-
@lazy
|
|
277
|
-
static readonly MAX_SAFE_INTEGER: f32 = f32.MAX_SAFE_INTEGER;
|
|
278
|
-
|
|
279
|
-
// @ts-ignore: decorator
|
|
280
|
-
@lazy
|
|
281
|
-
static readonly POSITIVE_INFINITY: f32 = f32.POSITIVE_INFINITY;
|
|
282
|
-
|
|
283
|
-
// @ts-ignore: decorator
|
|
284
|
-
@lazy
|
|
285
|
-
static readonly NEGATIVE_INFINITY: f32 = f32.NEGATIVE_INFINITY;
|
|
286
|
-
|
|
287
|
-
// @ts-ignore: decorator
|
|
288
|
-
@lazy
|
|
289
|
-
static readonly NaN: f32 = f32.NaN;
|
|
290
|
-
|
|
291
|
-
static isNaN(value: f32): bool {
|
|
292
|
-
return isNaN<f32>(value);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
static isFinite(value: f32): bool {
|
|
296
|
-
return isFinite<f32>(value);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
static isSafeInteger(value: f32): bool {
|
|
300
|
-
return abs<f32>(value) <= f32.MAX_SAFE_INTEGER && trunc<f32>(value) == value;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
static isInteger(value: f32): bool {
|
|
304
|
-
return isFinite<f32>(value) && trunc<f32>(value) == value;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/** @deprecated */
|
|
308
|
-
static parseInt(value: string, radix: i32 = 0): f32 {
|
|
309
|
-
return <f32>strtol<f64>(value, radix);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/** @deprecated */
|
|
313
|
-
static parseFloat(value: string): f32 {
|
|
314
|
-
return <f32>strtod(value);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
toString(this: f32, radix: i32 = 0): String {
|
|
318
|
-
return dtoa(this);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
@final @unmanaged
|
|
323
|
-
export abstract class F64 {
|
|
324
|
-
|
|
325
|
-
// @ts-ignore: decorator
|
|
326
|
-
@lazy
|
|
327
|
-
static readonly EPSILON: f64 = f64.EPSILON;
|
|
328
|
-
|
|
329
|
-
// @ts-ignore: decorator
|
|
330
|
-
@lazy
|
|
331
|
-
static readonly MIN_VALUE: f64 = f64.MIN_VALUE;
|
|
332
|
-
|
|
333
|
-
// @ts-ignore: decorator
|
|
334
|
-
@lazy
|
|
335
|
-
static readonly MAX_VALUE: f64 = f64.MAX_VALUE;
|
|
336
|
-
|
|
337
|
-
// @ts-ignore: decorator
|
|
338
|
-
@lazy
|
|
339
|
-
static readonly MIN_SAFE_INTEGER: f64 = f64.MIN_SAFE_INTEGER;
|
|
340
|
-
|
|
341
|
-
// @ts-ignore: decorator
|
|
342
|
-
@lazy
|
|
343
|
-
static readonly MAX_SAFE_INTEGER: f64 = f64.MAX_SAFE_INTEGER;
|
|
344
|
-
|
|
345
|
-
// @ts-ignore: decorator
|
|
346
|
-
@lazy
|
|
347
|
-
static readonly POSITIVE_INFINITY: f64 = f64.POSITIVE_INFINITY;
|
|
348
|
-
|
|
349
|
-
// @ts-ignore: decorator
|
|
350
|
-
@lazy
|
|
351
|
-
static readonly NEGATIVE_INFINITY: f64 = f64.NEGATIVE_INFINITY;
|
|
352
|
-
|
|
353
|
-
// @ts-ignore: decorator
|
|
354
|
-
@lazy
|
|
355
|
-
static readonly NaN: f64 = f64.NaN;
|
|
356
|
-
|
|
357
|
-
static isNaN(value: f64): bool {
|
|
358
|
-
return isNaN<f64>(value);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
static isFinite(value: f64): bool {
|
|
362
|
-
return isFinite<f64>(value);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
static isSafeInteger(value: f64): bool {
|
|
366
|
-
return abs<f64>(value) <= f64.MAX_SAFE_INTEGER && trunc<f64>(value) == value;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
static isInteger(value: f64): bool {
|
|
370
|
-
return isFinite<f64>(value) && trunc<f64>(value) == value;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/** @deprecated */
|
|
374
|
-
static parseInt(value: string, radix: i32 = 0): f64 {
|
|
375
|
-
return strtol<f64>(value, radix);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/** @deprecated */
|
|
379
|
-
static parseFloat(value: string): f64 {
|
|
380
|
-
return strtod(value);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
toString(this: f64, radix: i32 = 0): String {
|
|
384
|
-
return dtoa(this);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
export { F64 as Number };
|
|
1
|
+
import { itoa32, utoa32, itoa64, utoa64, dtoa } from "./util/number";
|
|
2
|
+
import { strtol, strtod } from "./util/string";
|
|
3
|
+
|
|
4
|
+
// @ts-ignore: decorator
|
|
5
|
+
@builtin @inline
|
|
6
|
+
export const NaN: f64 = 0 / 0; // context-aware
|
|
7
|
+
|
|
8
|
+
// @ts-ignore: decorator
|
|
9
|
+
@builtin @inline
|
|
10
|
+
export const Infinity: f64 = 1 / 0; // context-aware
|
|
11
|
+
|
|
12
|
+
// @ts-ignore: decorator
|
|
13
|
+
@builtin
|
|
14
|
+
export declare function isNaN<T extends number>(value: T): bool;
|
|
15
|
+
|
|
16
|
+
// @ts-ignore: decorator
|
|
17
|
+
@builtin
|
|
18
|
+
export declare function isFinite<T extends number>(value: T): bool;
|
|
19
|
+
|
|
20
|
+
@final @unmanaged
|
|
21
|
+
export abstract class I8 {
|
|
22
|
+
|
|
23
|
+
// @ts-ignore: decorator
|
|
24
|
+
@lazy
|
|
25
|
+
static readonly MIN_VALUE: i8 = i8.MIN_VALUE;
|
|
26
|
+
|
|
27
|
+
// @ts-ignore: decorator
|
|
28
|
+
@lazy
|
|
29
|
+
static readonly MAX_VALUE: i8 = i8.MAX_VALUE;
|
|
30
|
+
|
|
31
|
+
/** @deprecated */
|
|
32
|
+
static parseInt(value: string, radix: i32 = 0): i8 {
|
|
33
|
+
return <i8>strtol<i32>(value, radix);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
toString(this: i8, radix: i32 = 10): String {
|
|
37
|
+
return itoa32(this, radix);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@final @unmanaged
|
|
42
|
+
export abstract class I16 {
|
|
43
|
+
|
|
44
|
+
// @ts-ignore: decorator
|
|
45
|
+
@lazy
|
|
46
|
+
static readonly MIN_VALUE: i16 = i16.MIN_VALUE;
|
|
47
|
+
|
|
48
|
+
// @ts-ignore: decorator
|
|
49
|
+
@lazy
|
|
50
|
+
static readonly MAX_VALUE: i16 = i16.MAX_VALUE;
|
|
51
|
+
|
|
52
|
+
/** @deprecated */
|
|
53
|
+
static parseInt(value: string, radix: i32 = 0): i16 {
|
|
54
|
+
return <i16>strtol<i32>(value, radix);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
toString(this: i16, radix: i32 = 10): String {
|
|
58
|
+
return itoa32(this, radix);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@final @unmanaged
|
|
63
|
+
export abstract class I32 {
|
|
64
|
+
|
|
65
|
+
// @ts-ignore: decorator
|
|
66
|
+
@lazy
|
|
67
|
+
static readonly MIN_VALUE: i32 = i32.MIN_VALUE;
|
|
68
|
+
|
|
69
|
+
// @ts-ignore: decorator
|
|
70
|
+
@lazy
|
|
71
|
+
static readonly MAX_VALUE: i32 = i32.MAX_VALUE;
|
|
72
|
+
|
|
73
|
+
/** @deprecated */
|
|
74
|
+
static parseInt(value: string, radix: i32 = 0): i32 {
|
|
75
|
+
return <i32>strtol<i32>(value, radix);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
toString(this: i32, radix: i32 = 10): String {
|
|
79
|
+
return itoa32(this, radix);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@final @unmanaged
|
|
84
|
+
export abstract class I64 {
|
|
85
|
+
|
|
86
|
+
// @ts-ignore: decorator
|
|
87
|
+
@lazy
|
|
88
|
+
static readonly MIN_VALUE: i64 = i64.MIN_VALUE;
|
|
89
|
+
|
|
90
|
+
// @ts-ignore: decorator
|
|
91
|
+
@lazy
|
|
92
|
+
static readonly MAX_VALUE: i64 = i64.MAX_VALUE;
|
|
93
|
+
|
|
94
|
+
/** @deprecated */
|
|
95
|
+
static parseInt(value: string, radix: i32 = 0): i64 {
|
|
96
|
+
return strtol<i64>(value, radix);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
toString(this: i64, radix: i32 = 10): String {
|
|
100
|
+
return itoa64(this, radix);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@final @unmanaged
|
|
105
|
+
export abstract class Isize {
|
|
106
|
+
|
|
107
|
+
// @ts-ignore: decorator
|
|
108
|
+
@lazy
|
|
109
|
+
static readonly MIN_VALUE: isize = isize.MIN_VALUE;
|
|
110
|
+
|
|
111
|
+
// @ts-ignore: decorator
|
|
112
|
+
@lazy
|
|
113
|
+
static readonly MAX_VALUE: isize = isize.MAX_VALUE;
|
|
114
|
+
|
|
115
|
+
/** @deprecated */
|
|
116
|
+
static parseInt(value: string, radix: i32 = 0): isize {
|
|
117
|
+
return <isize>strtol<i64>(value, radix);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
toString(this: isize, radix: i32 = 10): String {
|
|
121
|
+
if (sizeof<isize>() == 4) {
|
|
122
|
+
return itoa32(<i32>this, radix);
|
|
123
|
+
} else {
|
|
124
|
+
return itoa64(<i64>this, radix);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@final @unmanaged
|
|
130
|
+
export abstract class U8 {
|
|
131
|
+
|
|
132
|
+
// @ts-ignore: decorator
|
|
133
|
+
@lazy
|
|
134
|
+
static readonly MIN_VALUE: u8 = u8.MIN_VALUE;
|
|
135
|
+
|
|
136
|
+
// @ts-ignore: decorator
|
|
137
|
+
@lazy
|
|
138
|
+
static readonly MAX_VALUE: u8 = u8.MAX_VALUE;
|
|
139
|
+
|
|
140
|
+
/** @deprecated */
|
|
141
|
+
static parseInt(value: string, radix: i32 = 0): u8 {
|
|
142
|
+
return <u8>strtol<i32>(value, radix);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
toString(this: u8, radix: i32 = 10): String {
|
|
146
|
+
return utoa32(this, radix);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@final @unmanaged
|
|
151
|
+
export abstract class U16 {
|
|
152
|
+
|
|
153
|
+
// @ts-ignore: decorator
|
|
154
|
+
@lazy
|
|
155
|
+
static readonly MIN_VALUE: u16 = u16.MIN_VALUE;
|
|
156
|
+
|
|
157
|
+
// @ts-ignore: decorator
|
|
158
|
+
@lazy
|
|
159
|
+
static readonly MAX_VALUE: u16 = u16.MAX_VALUE;
|
|
160
|
+
|
|
161
|
+
/** @deprecated */
|
|
162
|
+
static parseInt(value: string, radix: i32 = 0): u16 {
|
|
163
|
+
return <u16>strtol<i32>(value, radix);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
toString(this: u16, radix: i32 = 10): String {
|
|
167
|
+
return utoa32(this, radix);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
@final @unmanaged
|
|
172
|
+
export abstract class U32 {
|
|
173
|
+
|
|
174
|
+
// @ts-ignore: decorator
|
|
175
|
+
@lazy
|
|
176
|
+
static readonly MIN_VALUE: u32 = u32.MIN_VALUE;
|
|
177
|
+
|
|
178
|
+
// @ts-ignore: decorator
|
|
179
|
+
@lazy
|
|
180
|
+
static readonly MAX_VALUE: u32 = u32.MAX_VALUE;
|
|
181
|
+
|
|
182
|
+
/** @deprecated */
|
|
183
|
+
static parseInt(value: string, radix: i32 = 0): u32 {
|
|
184
|
+
return <u32>strtol<i32>(value, radix);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
toString(this: u32, radix: i32 = 10): String {
|
|
188
|
+
return utoa32(this, radix);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@final @unmanaged
|
|
193
|
+
export abstract class U64 {
|
|
194
|
+
|
|
195
|
+
// @ts-ignore: decorator
|
|
196
|
+
@lazy
|
|
197
|
+
static readonly MIN_VALUE: u64 = u64.MIN_VALUE;
|
|
198
|
+
|
|
199
|
+
// @ts-ignore: decorator
|
|
200
|
+
@lazy
|
|
201
|
+
static readonly MAX_VALUE: u64 = u64.MAX_VALUE;
|
|
202
|
+
|
|
203
|
+
/** @deprecated */
|
|
204
|
+
static parseInt(value: string, radix: i32 = 0): u64 {
|
|
205
|
+
return <u64>strtol<i64>(value, radix);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
toString(this: u64, radix: i32 = 10): String {
|
|
209
|
+
return utoa64(this, radix);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@final @unmanaged
|
|
214
|
+
export abstract class Usize {
|
|
215
|
+
|
|
216
|
+
// @ts-ignore: decorator
|
|
217
|
+
@lazy
|
|
218
|
+
static readonly MIN_VALUE: usize = usize.MIN_VALUE;
|
|
219
|
+
|
|
220
|
+
// @ts-ignore: decorator
|
|
221
|
+
@lazy
|
|
222
|
+
static readonly MAX_VALUE: usize = usize.MAX_VALUE;
|
|
223
|
+
|
|
224
|
+
/** @deprecated */
|
|
225
|
+
static parseInt(value: string, radix: i32 = 0): usize {
|
|
226
|
+
return <usize>strtol<i64>(value, radix);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
toString(this: usize, radix: i32 = 10): String {
|
|
230
|
+
if (sizeof<usize>() == 4) {
|
|
231
|
+
return utoa32(<u32>this, radix);
|
|
232
|
+
} else {
|
|
233
|
+
return utoa64(<u64>this, radix);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@final @unmanaged
|
|
239
|
+
export abstract class Bool {
|
|
240
|
+
|
|
241
|
+
// @ts-ignore: decorator
|
|
242
|
+
@lazy
|
|
243
|
+
static readonly MIN_VALUE: bool = bool.MIN_VALUE;
|
|
244
|
+
|
|
245
|
+
// @ts-ignore: decorator
|
|
246
|
+
@lazy
|
|
247
|
+
static readonly MAX_VALUE: bool = bool.MAX_VALUE;
|
|
248
|
+
|
|
249
|
+
toString(this: bool, radix: i32 = 0): String {
|
|
250
|
+
return this ? "true" : "false";
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export { Bool as Boolean };
|
|
255
|
+
|
|
256
|
+
@final @unmanaged
|
|
257
|
+
export abstract class F32 {
|
|
258
|
+
|
|
259
|
+
// @ts-ignore: decorator
|
|
260
|
+
@lazy
|
|
261
|
+
static readonly EPSILON: f32 = f32.EPSILON;
|
|
262
|
+
|
|
263
|
+
// @ts-ignore: decorator
|
|
264
|
+
@lazy
|
|
265
|
+
static readonly MIN_VALUE: f32 = f32.MIN_VALUE;
|
|
266
|
+
|
|
267
|
+
// @ts-ignore: decorator
|
|
268
|
+
@lazy
|
|
269
|
+
static readonly MAX_VALUE: f32 = f32.MAX_VALUE;
|
|
270
|
+
|
|
271
|
+
// @ts-ignore: decorator
|
|
272
|
+
@lazy
|
|
273
|
+
static readonly MIN_SAFE_INTEGER: f32 = f32.MIN_SAFE_INTEGER;
|
|
274
|
+
|
|
275
|
+
// @ts-ignore: decorator
|
|
276
|
+
@lazy
|
|
277
|
+
static readonly MAX_SAFE_INTEGER: f32 = f32.MAX_SAFE_INTEGER;
|
|
278
|
+
|
|
279
|
+
// @ts-ignore: decorator
|
|
280
|
+
@lazy
|
|
281
|
+
static readonly POSITIVE_INFINITY: f32 = f32.POSITIVE_INFINITY;
|
|
282
|
+
|
|
283
|
+
// @ts-ignore: decorator
|
|
284
|
+
@lazy
|
|
285
|
+
static readonly NEGATIVE_INFINITY: f32 = f32.NEGATIVE_INFINITY;
|
|
286
|
+
|
|
287
|
+
// @ts-ignore: decorator
|
|
288
|
+
@lazy
|
|
289
|
+
static readonly NaN: f32 = f32.NaN;
|
|
290
|
+
|
|
291
|
+
static isNaN(value: f32): bool {
|
|
292
|
+
return isNaN<f32>(value);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
static isFinite(value: f32): bool {
|
|
296
|
+
return isFinite<f32>(value);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
static isSafeInteger(value: f32): bool {
|
|
300
|
+
return abs<f32>(value) <= f32.MAX_SAFE_INTEGER && trunc<f32>(value) == value;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
static isInteger(value: f32): bool {
|
|
304
|
+
return isFinite<f32>(value) && trunc<f32>(value) == value;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** @deprecated */
|
|
308
|
+
static parseInt(value: string, radix: i32 = 0): f32 {
|
|
309
|
+
return <f32>strtol<f64>(value, radix);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** @deprecated */
|
|
313
|
+
static parseFloat(value: string): f32 {
|
|
314
|
+
return <f32>strtod(value);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
toString(this: f32, radix: i32 = 0): String {
|
|
318
|
+
return dtoa(this);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
@final @unmanaged
|
|
323
|
+
export abstract class F64 {
|
|
324
|
+
|
|
325
|
+
// @ts-ignore: decorator
|
|
326
|
+
@lazy
|
|
327
|
+
static readonly EPSILON: f64 = f64.EPSILON;
|
|
328
|
+
|
|
329
|
+
// @ts-ignore: decorator
|
|
330
|
+
@lazy
|
|
331
|
+
static readonly MIN_VALUE: f64 = f64.MIN_VALUE;
|
|
332
|
+
|
|
333
|
+
// @ts-ignore: decorator
|
|
334
|
+
@lazy
|
|
335
|
+
static readonly MAX_VALUE: f64 = f64.MAX_VALUE;
|
|
336
|
+
|
|
337
|
+
// @ts-ignore: decorator
|
|
338
|
+
@lazy
|
|
339
|
+
static readonly MIN_SAFE_INTEGER: f64 = f64.MIN_SAFE_INTEGER;
|
|
340
|
+
|
|
341
|
+
// @ts-ignore: decorator
|
|
342
|
+
@lazy
|
|
343
|
+
static readonly MAX_SAFE_INTEGER: f64 = f64.MAX_SAFE_INTEGER;
|
|
344
|
+
|
|
345
|
+
// @ts-ignore: decorator
|
|
346
|
+
@lazy
|
|
347
|
+
static readonly POSITIVE_INFINITY: f64 = f64.POSITIVE_INFINITY;
|
|
348
|
+
|
|
349
|
+
// @ts-ignore: decorator
|
|
350
|
+
@lazy
|
|
351
|
+
static readonly NEGATIVE_INFINITY: f64 = f64.NEGATIVE_INFINITY;
|
|
352
|
+
|
|
353
|
+
// @ts-ignore: decorator
|
|
354
|
+
@lazy
|
|
355
|
+
static readonly NaN: f64 = f64.NaN;
|
|
356
|
+
|
|
357
|
+
static isNaN(value: f64): bool {
|
|
358
|
+
return isNaN<f64>(value);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
static isFinite(value: f64): bool {
|
|
362
|
+
return isFinite<f64>(value);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
static isSafeInteger(value: f64): bool {
|
|
366
|
+
return abs<f64>(value) <= f64.MAX_SAFE_INTEGER && trunc<f64>(value) == value;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
static isInteger(value: f64): bool {
|
|
370
|
+
return isFinite<f64>(value) && trunc<f64>(value) == value;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/** @deprecated */
|
|
374
|
+
static parseInt(value: string, radix: i32 = 0): f64 {
|
|
375
|
+
return strtol<f64>(value, radix);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/** @deprecated */
|
|
379
|
+
static parseFloat(value: string): f64 {
|
|
380
|
+
return strtod(value);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
toString(this: f64, radix: i32 = 0): String {
|
|
384
|
+
return dtoa(this);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export { F64 as Number };
|