toilscript 0.0.1 → 0.1.0

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.
Files changed (120) hide show
  1. package/LICENSE +201 -201
  2. package/NOTICE +94 -94
  3. package/README.md +101 -114
  4. package/bin/asc.js +0 -0
  5. package/bin/asinit.js +0 -0
  6. package/dist/asc.generated.d.ts +10022 -0
  7. package/dist/asc.js +24457 -0
  8. package/dist/asc.js.map +7 -0
  9. package/dist/importmap.json +9 -0
  10. package/dist/toilscript.generated.d.ts +11237 -0
  11. package/dist/toilscript.js +337 -0
  12. package/dist/toilscript.js.map +7 -0
  13. package/dist/web.js +22 -0
  14. package/lib/binaryen.d.ts +2 -2
  15. package/lib/binaryen.js +2 -2
  16. package/package.json +115 -114
  17. package/std/README.md +6 -6
  18. package/std/assembly/array.ts +550 -550
  19. package/std/assembly/arraybuffer.ts +77 -77
  20. package/std/assembly/atomics.ts +127 -127
  21. package/std/assembly/bindings/asyncify.ts +16 -16
  22. package/std/assembly/bindings/dom.ts +291 -291
  23. package/std/assembly/bindings/node.ts +6 -6
  24. package/std/assembly/bitflags.ts +53 -53
  25. package/std/assembly/builtins.ts +2650 -2650
  26. package/std/assembly/byteslice.ts +177 -177
  27. package/std/assembly/compat.ts +2 -2
  28. package/std/assembly/console.ts +42 -42
  29. package/std/assembly/crypto.ts +9 -9
  30. package/std/assembly/dataview.ts +181 -181
  31. package/std/assembly/date.ts +375 -375
  32. package/std/assembly/diagnostics.ts +11 -11
  33. package/std/assembly/encoding.ts +151 -151
  34. package/std/assembly/endian.ts +45 -45
  35. package/std/assembly/error.ts +44 -44
  36. package/std/assembly/fixedarray.ts +173 -173
  37. package/std/assembly/fixedmap.ts +326 -326
  38. package/std/assembly/fixedset.ts +275 -275
  39. package/std/assembly/function.ts +42 -42
  40. package/std/assembly/index.d.ts +2891 -2891
  41. package/std/assembly/iterator.ts +35 -35
  42. package/std/assembly/map.ts +269 -269
  43. package/std/assembly/math.ts +3289 -3289
  44. package/std/assembly/memory.ts +123 -123
  45. package/std/assembly/number.ts +388 -388
  46. package/std/assembly/object.ts +36 -36
  47. package/std/assembly/performance.ts +9 -9
  48. package/std/assembly/pointer.ts +80 -80
  49. package/std/assembly/polyfills.ts +27 -27
  50. package/std/assembly/process.ts +50 -50
  51. package/std/assembly/reference.ts +48 -48
  52. package/std/assembly/regexp.ts +12 -12
  53. package/std/assembly/rt/README.md +83 -83
  54. package/std/assembly/rt/common.ts +81 -81
  55. package/std/assembly/rt/index-incremental.ts +2 -2
  56. package/std/assembly/rt/index-memory.ts +1 -1
  57. package/std/assembly/rt/index-minimal.ts +2 -2
  58. package/std/assembly/rt/index-stub.ts +1 -1
  59. package/std/assembly/rt/index.d.ts +37 -37
  60. package/std/assembly/rt/itcms.ts +419 -419
  61. package/std/assembly/rt/memory-runtime.ts +94 -94
  62. package/std/assembly/rt/rtrace.ts +15 -15
  63. package/std/assembly/rt/stub.ts +133 -133
  64. package/std/assembly/rt/tcms.ts +254 -254
  65. package/std/assembly/rt/tlsf.ts +592 -592
  66. package/std/assembly/rt.ts +90 -90
  67. package/std/assembly/set.ts +225 -225
  68. package/std/assembly/shared/feature.ts +68 -68
  69. package/std/assembly/shared/runtime.ts +13 -13
  70. package/std/assembly/shared/target.ts +11 -11
  71. package/std/assembly/shared/tsconfig.json +11 -11
  72. package/std/assembly/shared/typeinfo.ts +72 -72
  73. package/std/assembly/staticarray.ts +423 -423
  74. package/std/assembly/string.ts +850 -850
  75. package/std/assembly/symbol.ts +114 -114
  76. package/std/assembly/table.ts +16 -16
  77. package/std/assembly/tsconfig.json +6 -6
  78. package/std/assembly/typedarray.ts +1954 -1954
  79. package/std/assembly/uri.ts +17 -17
  80. package/std/assembly/util/bytes.ts +107 -107
  81. package/std/assembly/util/casemap.ts +497 -497
  82. package/std/assembly/util/error.ts +58 -58
  83. package/std/assembly/util/hash.ts +117 -117
  84. package/std/assembly/util/math.ts +1922 -1922
  85. package/std/assembly/util/memory.ts +290 -290
  86. package/std/assembly/util/number.ts +873 -873
  87. package/std/assembly/util/sort.ts +313 -313
  88. package/std/assembly/util/string.ts +1202 -1202
  89. package/std/assembly/util/uri.ts +275 -275
  90. package/std/assembly/vector.ts +4 -4
  91. package/std/assembly.json +16 -16
  92. package/std/portable/index.d.ts +461 -461
  93. package/std/portable/index.js +416 -416
  94. package/std/portable.json +11 -11
  95. package/std/types/assembly/index.d.ts +1 -1
  96. package/std/types/assembly/package.json +2 -2
  97. package/std/types/portable/index.d.ts +1 -1
  98. package/std/types/portable/package.json +2 -2
  99. package/tsconfig-base.json +13 -13
  100. package/util/README.md +23 -23
  101. package/util/browser/fs.js +1 -1
  102. package/util/browser/module.js +5 -5
  103. package/util/browser/path.js +520 -520
  104. package/util/browser/process.js +59 -59
  105. package/util/browser/url.js +23 -23
  106. package/util/cpu.d.ts +9 -9
  107. package/util/cpu.js +42 -42
  108. package/util/find.d.ts +6 -6
  109. package/util/find.js +20 -20
  110. package/util/node.d.ts +21 -21
  111. package/util/node.js +34 -34
  112. package/util/options.d.ts +70 -70
  113. package/util/options.js +262 -262
  114. package/util/terminal.d.ts +52 -52
  115. package/util/terminal.js +35 -35
  116. package/util/text.d.ts +26 -26
  117. package/util/text.js +114 -114
  118. package/util/tsconfig.json +9 -9
  119. package/util/web.d.ts +11 -11
  120. package/util/web.js +33 -33
@@ -1,123 +1,123 @@
1
- import { memcmp, memmove, memset } from "./util/memory";
2
- import { E_NOTIMPLEMENTED } from "./util/error";
3
-
4
- /** Memory manager interface. */
5
- export namespace memory {
6
-
7
- /** Gets the size of the memory in pages. */
8
- // @ts-ignore: decorator
9
- @builtin
10
- export declare function size(): i32;
11
-
12
- /** Grows the memory by the given size in pages and returns the previous size in pages. */
13
- // @ts-ignore: decorator
14
- @unsafe @builtin
15
- export declare function grow(pages: i32): i32;
16
-
17
- /** Fills a section in memory with the specified byte value. */
18
- // @ts-ignore: decorator
19
- @unsafe @builtin
20
- export function fill(dst: usize, c: u8, n: usize): void {
21
- memset(dst, c, n); // fallback if "bulk-memory" isn't enabled
22
- }
23
-
24
- /** Copies a section of memory to another. Has move semantics. */
25
- // @ts-ignore: decorator
26
- @unsafe @builtin
27
- export function copy(dst: usize, src: usize, n: usize): void {
28
- memmove(dst, src, n); // fallback if "bulk-memory" isn't enabled
29
- }
30
-
31
- export namespace atomic {
32
-
33
- // @ts-ignore: decorator
34
- @unsafe @builtin
35
- export declare function wait32(ptr: usize, expected: i32, timeout: i64): AtomicWaitResult;
36
-
37
- // @ts-ignore: decorator
38
- @unsafe @builtin
39
- export declare function wait64(ptr: usize, expected: i64, timeout: i64): AtomicWaitResult;
40
- }
41
-
42
- /** Initializes a memory segment. */
43
- // @ts-ignore: decorator
44
- @unsafe
45
- export function init(segmentIndex: u32, srcOffset: usize, dstOffset: usize, n: usize): void {
46
- throw new Error(E_NOTIMPLEMENTED);
47
- }
48
-
49
- /** Drops a memory segment. */
50
- // @ts-ignore: decorator
51
- @unsafe
52
- export function drop(segmentIndex: u32): void {
53
- throw new Error(E_NOTIMPLEMENTED);
54
- }
55
-
56
- /** Repeats a section of memory at a specific address. */
57
- // @ts-ignore: decorator
58
- @unsafe
59
- export function repeat(dst: usize, src: usize, srcLength: usize, count: usize): void {
60
- let index: usize = 0;
61
- let total = srcLength * count;
62
- while (index < total) {
63
- memory.copy(dst + index, src, srcLength);
64
- index += srcLength;
65
- }
66
- }
67
-
68
- /** Compares a section of memory to another. */
69
- // @ts-ignore: decorator
70
- @inline
71
- export function compare(vl: usize, vr: usize, n: usize): i32 {
72
- return memcmp(vl, vr, n);
73
- }
74
-
75
- /** Gets a pointer to a static chunk of memory of the given size. */
76
- // @ts-ignore: decorator
77
- @builtin
78
- export declare function data<T>(size: T, align?: i32): usize;
79
- }
80
-
81
- // @ts-ignore: decorator
82
- @builtin
83
- export declare const __data_end: usize;
84
-
85
- // @ts-ignore: decorator
86
- @builtin
87
- export declare let __stack_pointer: usize;
88
-
89
- // @ts-ignore: decorator
90
- @builtin
91
- export declare const __heap_base: usize;
92
-
93
- /** Heap memory interface. */
94
- export namespace heap {
95
-
96
- /** Allocates a chunk of memory of at least the specified size. */
97
- // @ts-ignore: decorator
98
- @unsafe export function alloc(size: usize): usize {
99
- return __alloc(size);
100
- }
101
-
102
- /** Reallocates a chunk of memory to have at least the specified size. */
103
- // @ts-ignore: decorator
104
- @unsafe export function realloc(ptr: usize, size: usize): usize {
105
- return __realloc(ptr, size);
106
- }
107
-
108
- /** Frees a chunk of memory. Does hardly anything (most recent block only) with the stub runtime. */
109
- // @ts-ignore: decorator
110
- @unsafe export function free(ptr: usize): void {
111
- __free(ptr);
112
- }
113
-
114
- /** Dangerously resets the entire heap. Specific to the stub runtime. */
115
- // @ts-ignore: decorator
116
- @unsafe export function reset(): void {
117
- if (isDefined(__reset)) {
118
- __reset();
119
- } else {
120
- throw new Error(E_NOTIMPLEMENTED);
121
- }
122
- }
123
- }
1
+ import { memcmp, memmove, memset } from "./util/memory";
2
+ import { E_NOTIMPLEMENTED } from "./util/error";
3
+
4
+ /** Memory manager interface. */
5
+ export namespace memory {
6
+
7
+ /** Gets the size of the memory in pages. */
8
+ // @ts-ignore: decorator
9
+ @builtin
10
+ export declare function size(): i32;
11
+
12
+ /** Grows the memory by the given size in pages and returns the previous size in pages. */
13
+ // @ts-ignore: decorator
14
+ @unsafe @builtin
15
+ export declare function grow(pages: i32): i32;
16
+
17
+ /** Fills a section in memory with the specified byte value. */
18
+ // @ts-ignore: decorator
19
+ @unsafe @builtin
20
+ export function fill(dst: usize, c: u8, n: usize): void {
21
+ memset(dst, c, n); // fallback if "bulk-memory" isn't enabled
22
+ }
23
+
24
+ /** Copies a section of memory to another. Has move semantics. */
25
+ // @ts-ignore: decorator
26
+ @unsafe @builtin
27
+ export function copy(dst: usize, src: usize, n: usize): void {
28
+ memmove(dst, src, n); // fallback if "bulk-memory" isn't enabled
29
+ }
30
+
31
+ export namespace atomic {
32
+
33
+ // @ts-ignore: decorator
34
+ @unsafe @builtin
35
+ export declare function wait32(ptr: usize, expected: i32, timeout: i64): AtomicWaitResult;
36
+
37
+ // @ts-ignore: decorator
38
+ @unsafe @builtin
39
+ export declare function wait64(ptr: usize, expected: i64, timeout: i64): AtomicWaitResult;
40
+ }
41
+
42
+ /** Initializes a memory segment. */
43
+ // @ts-ignore: decorator
44
+ @unsafe
45
+ export function init(segmentIndex: u32, srcOffset: usize, dstOffset: usize, n: usize): void {
46
+ throw new Error(E_NOTIMPLEMENTED);
47
+ }
48
+
49
+ /** Drops a memory segment. */
50
+ // @ts-ignore: decorator
51
+ @unsafe
52
+ export function drop(segmentIndex: u32): void {
53
+ throw new Error(E_NOTIMPLEMENTED);
54
+ }
55
+
56
+ /** Repeats a section of memory at a specific address. */
57
+ // @ts-ignore: decorator
58
+ @unsafe
59
+ export function repeat(dst: usize, src: usize, srcLength: usize, count: usize): void {
60
+ let index: usize = 0;
61
+ let total = srcLength * count;
62
+ while (index < total) {
63
+ memory.copy(dst + index, src, srcLength);
64
+ index += srcLength;
65
+ }
66
+ }
67
+
68
+ /** Compares a section of memory to another. */
69
+ // @ts-ignore: decorator
70
+ @inline
71
+ export function compare(vl: usize, vr: usize, n: usize): i32 {
72
+ return memcmp(vl, vr, n);
73
+ }
74
+
75
+ /** Gets a pointer to a static chunk of memory of the given size. */
76
+ // @ts-ignore: decorator
77
+ @builtin
78
+ export declare function data<T>(size: T, align?: i32): usize;
79
+ }
80
+
81
+ // @ts-ignore: decorator
82
+ @builtin
83
+ export declare const __data_end: usize;
84
+
85
+ // @ts-ignore: decorator
86
+ @builtin
87
+ export declare let __stack_pointer: usize;
88
+
89
+ // @ts-ignore: decorator
90
+ @builtin
91
+ export declare const __heap_base: usize;
92
+
93
+ /** Heap memory interface. */
94
+ export namespace heap {
95
+
96
+ /** Allocates a chunk of memory of at least the specified size. */
97
+ // @ts-ignore: decorator
98
+ @unsafe export function alloc(size: usize): usize {
99
+ return __alloc(size);
100
+ }
101
+
102
+ /** Reallocates a chunk of memory to have at least the specified size. */
103
+ // @ts-ignore: decorator
104
+ @unsafe export function realloc(ptr: usize, size: usize): usize {
105
+ return __realloc(ptr, size);
106
+ }
107
+
108
+ /** Frees a chunk of memory. Does hardly anything (most recent block only) with the stub runtime. */
109
+ // @ts-ignore: decorator
110
+ @unsafe export function free(ptr: usize): void {
111
+ __free(ptr);
112
+ }
113
+
114
+ /** Dangerously resets the entire heap. Specific to the stub runtime. */
115
+ // @ts-ignore: decorator
116
+ @unsafe export function reset(): void {
117
+ if (isDefined(__reset)) {
118
+ __reset();
119
+ } else {
120
+ throw new Error(E_NOTIMPLEMENTED);
121
+ }
122
+ }
123
+ }