@raviqqe/stak 0.10.18 → 0.10.20
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/README.md +1 -1
- package/package.json +1 -1
- package/stak_wasm.d.ts +11 -1
- package/stak_wasm.js +262 -2
- package/stak_wasm_bg.wasm +0 -0
package/README.md
CHANGED
package/package.json
CHANGED
package/stak_wasm.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Runs a REPL interpreter.
|
|
5
|
+
*/
|
|
6
|
+
export function repl(heap_size: number): Promise<void>;
|
|
3
7
|
/**
|
|
4
8
|
* Compiles source codes in Scheme.
|
|
5
9
|
*/
|
|
@@ -17,14 +21,20 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
17
21
|
|
|
18
22
|
export interface InitOutput {
|
|
19
23
|
readonly memory: WebAssembly.Memory;
|
|
24
|
+
readonly repl: (a: number) => any;
|
|
20
25
|
readonly compile: (a: number, b: number) => [number, number, number, number];
|
|
21
26
|
readonly interpret: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
22
27
|
readonly run: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
23
|
-
readonly
|
|
28
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
29
|
+
readonly __externref_table_alloc: () => number;
|
|
30
|
+
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
31
|
+
readonly __wbindgen_export_3: WebAssembly.Table;
|
|
24
32
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
25
33
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
26
34
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
27
35
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
36
|
+
readonly closure24_externref_shim: (a: number, b: number, c: any) => void;
|
|
37
|
+
readonly closure46_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
28
38
|
readonly __wbindgen_start: () => void;
|
|
29
39
|
}
|
|
30
40
|
|
package/stak_wasm.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
let wasm;
|
|
2
2
|
|
|
3
|
+
function addToExternrefTable0(obj) {
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
6
|
+
return idx;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function handleError(f, args) {
|
|
10
|
+
try {
|
|
11
|
+
return f.apply(this, args);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
const idx = addToExternrefTable0(e);
|
|
14
|
+
wasm.__wbindgen_exn_store(idx);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
3
18
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
4
19
|
|
|
5
20
|
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
@@ -18,6 +33,106 @@ function getStringFromWasm0(ptr, len) {
|
|
|
18
33
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
19
34
|
}
|
|
20
35
|
|
|
36
|
+
function isLikeNone(x) {
|
|
37
|
+
return x === undefined || x === null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
41
|
+
? { register: () => {}, unregister: () => {} }
|
|
42
|
+
: new FinalizationRegistry(state => {
|
|
43
|
+
wasm.__wbindgen_export_3.get(state.dtor)(state.a, state.b)
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
47
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
48
|
+
const real = (...args) => {
|
|
49
|
+
// First up with a closure we increment the internal reference
|
|
50
|
+
// count. This ensures that the Rust closure environment won't
|
|
51
|
+
// be deallocated while we're invoking it.
|
|
52
|
+
state.cnt++;
|
|
53
|
+
const a = state.a;
|
|
54
|
+
state.a = 0;
|
|
55
|
+
try {
|
|
56
|
+
return f(a, state.b, ...args);
|
|
57
|
+
} finally {
|
|
58
|
+
if (--state.cnt === 0) {
|
|
59
|
+
wasm.__wbindgen_export_3.get(state.dtor)(a, state.b);
|
|
60
|
+
CLOSURE_DTORS.unregister(state);
|
|
61
|
+
} else {
|
|
62
|
+
state.a = a;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
real.original = state;
|
|
67
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
68
|
+
return real;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function debugString(val) {
|
|
72
|
+
// primitive types
|
|
73
|
+
const type = typeof val;
|
|
74
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
75
|
+
return `${val}`;
|
|
76
|
+
}
|
|
77
|
+
if (type == 'string') {
|
|
78
|
+
return `"${val}"`;
|
|
79
|
+
}
|
|
80
|
+
if (type == 'symbol') {
|
|
81
|
+
const description = val.description;
|
|
82
|
+
if (description == null) {
|
|
83
|
+
return 'Symbol';
|
|
84
|
+
} else {
|
|
85
|
+
return `Symbol(${description})`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (type == 'function') {
|
|
89
|
+
const name = val.name;
|
|
90
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
91
|
+
return `Function(${name})`;
|
|
92
|
+
} else {
|
|
93
|
+
return 'Function';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// objects
|
|
97
|
+
if (Array.isArray(val)) {
|
|
98
|
+
const length = val.length;
|
|
99
|
+
let debug = '[';
|
|
100
|
+
if (length > 0) {
|
|
101
|
+
debug += debugString(val[0]);
|
|
102
|
+
}
|
|
103
|
+
for(let i = 1; i < length; i++) {
|
|
104
|
+
debug += ', ' + debugString(val[i]);
|
|
105
|
+
}
|
|
106
|
+
debug += ']';
|
|
107
|
+
return debug;
|
|
108
|
+
}
|
|
109
|
+
// Test for built-in
|
|
110
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
111
|
+
let className;
|
|
112
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
113
|
+
className = builtInMatches[1];
|
|
114
|
+
} else {
|
|
115
|
+
// Failed to match the standard '[object ClassName]'
|
|
116
|
+
return toString.call(val);
|
|
117
|
+
}
|
|
118
|
+
if (className == 'Object') {
|
|
119
|
+
// we're a user defined class or Object
|
|
120
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
121
|
+
// easier than looping through ownProperties of `val`.
|
|
122
|
+
try {
|
|
123
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
124
|
+
} catch (_) {
|
|
125
|
+
return 'Object';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// errors
|
|
129
|
+
if (val instanceof Error) {
|
|
130
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
131
|
+
}
|
|
132
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
133
|
+
return className;
|
|
134
|
+
}
|
|
135
|
+
|
|
21
136
|
let WASM_VECTOR_LEN = 0;
|
|
22
137
|
|
|
23
138
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -74,8 +189,26 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
74
189
|
return ptr;
|
|
75
190
|
}
|
|
76
191
|
|
|
192
|
+
let cachedDataViewMemory0 = null;
|
|
193
|
+
|
|
194
|
+
function getDataViewMemory0() {
|
|
195
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
196
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
197
|
+
}
|
|
198
|
+
return cachedDataViewMemory0;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Runs a REPL interpreter.
|
|
202
|
+
* @param {number} heap_size
|
|
203
|
+
* @returns {Promise<void>}
|
|
204
|
+
*/
|
|
205
|
+
export function repl(heap_size) {
|
|
206
|
+
const ret = wasm.repl(heap_size);
|
|
207
|
+
return ret;
|
|
208
|
+
}
|
|
209
|
+
|
|
77
210
|
function takeFromExternrefTable0(idx) {
|
|
78
|
-
const value = wasm.
|
|
211
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
79
212
|
wasm.__externref_table_dealloc(idx);
|
|
80
213
|
return value;
|
|
81
214
|
}
|
|
@@ -149,6 +282,14 @@ export function run(source, input, heap_size) {
|
|
|
149
282
|
return v3;
|
|
150
283
|
}
|
|
151
284
|
|
|
285
|
+
function __wbg_adapter_24(arg0, arg1, arg2) {
|
|
286
|
+
wasm.closure24_externref_shim(arg0, arg1, arg2);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function __wbg_adapter_45(arg0, arg1, arg2, arg3) {
|
|
290
|
+
wasm.closure46_externref_shim(arg0, arg1, arg2, arg3);
|
|
291
|
+
}
|
|
292
|
+
|
|
152
293
|
async function __wbg_load(module, imports) {
|
|
153
294
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
154
295
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
@@ -183,12 +324,109 @@ async function __wbg_load(module, imports) {
|
|
|
183
324
|
function __wbg_get_imports() {
|
|
184
325
|
const imports = {};
|
|
185
326
|
imports.wbg = {};
|
|
327
|
+
imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
328
|
+
const ret = arg0.call(arg1);
|
|
329
|
+
return ret;
|
|
330
|
+
}, arguments) };
|
|
331
|
+
imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
332
|
+
const ret = arg0.call(arg1, arg2);
|
|
333
|
+
return ret;
|
|
334
|
+
}, arguments) };
|
|
335
|
+
imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
336
|
+
try {
|
|
337
|
+
var state0 = {a: arg0, b: arg1};
|
|
338
|
+
var cb0 = (arg0, arg1) => {
|
|
339
|
+
const a = state0.a;
|
|
340
|
+
state0.a = 0;
|
|
341
|
+
try {
|
|
342
|
+
return __wbg_adapter_45(a, state0.b, arg0, arg1);
|
|
343
|
+
} finally {
|
|
344
|
+
state0.a = a;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
const ret = new Promise(cb0);
|
|
348
|
+
return ret;
|
|
349
|
+
} finally {
|
|
350
|
+
state0.a = state0.b = 0;
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
354
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
355
|
+
return ret;
|
|
356
|
+
};
|
|
357
|
+
imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
|
|
358
|
+
queueMicrotask(arg0);
|
|
359
|
+
};
|
|
360
|
+
imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
|
|
361
|
+
const ret = arg0.queueMicrotask;
|
|
362
|
+
return ret;
|
|
363
|
+
};
|
|
364
|
+
imports.wbg.__wbg_readstdin_4ca5ce2adbb3c7bf = function() {
|
|
365
|
+
const ret = read_stdin();
|
|
366
|
+
return ret;
|
|
367
|
+
};
|
|
368
|
+
imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
|
|
369
|
+
const ret = Promise.resolve(arg0);
|
|
370
|
+
return ret;
|
|
371
|
+
};
|
|
372
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
|
|
373
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
374
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
375
|
+
};
|
|
376
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
|
|
377
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
378
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
379
|
+
};
|
|
380
|
+
imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
|
|
381
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
382
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
383
|
+
};
|
|
384
|
+
imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
|
|
385
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
386
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
387
|
+
};
|
|
388
|
+
imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
|
|
389
|
+
const ret = arg0.then(arg1);
|
|
390
|
+
return ret;
|
|
391
|
+
};
|
|
392
|
+
imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
|
|
393
|
+
const ret = arg0.then(arg1, arg2);
|
|
394
|
+
return ret;
|
|
395
|
+
};
|
|
396
|
+
imports.wbg.__wbg_writestderr_6db02e7c3ead7907 = function(arg0) {
|
|
397
|
+
const ret = write_stderr(arg0);
|
|
398
|
+
return ret;
|
|
399
|
+
};
|
|
400
|
+
imports.wbg.__wbg_writestdout_730893a776ce84a1 = function(arg0) {
|
|
401
|
+
const ret = write_stdout(arg0);
|
|
402
|
+
return ret;
|
|
403
|
+
};
|
|
404
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
405
|
+
const obj = arg0.original;
|
|
406
|
+
if (obj.cnt-- == 1) {
|
|
407
|
+
obj.a = 0;
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
const ret = false;
|
|
411
|
+
return ret;
|
|
412
|
+
};
|
|
413
|
+
imports.wbg.__wbindgen_closure_wrapper84 = function(arg0, arg1, arg2) {
|
|
414
|
+
const ret = makeMutClosure(arg0, arg1, 25, __wbg_adapter_24);
|
|
415
|
+
return ret;
|
|
416
|
+
};
|
|
417
|
+
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
418
|
+
const ret = debugString(arg1);
|
|
419
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
420
|
+
const len1 = WASM_VECTOR_LEN;
|
|
421
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
422
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
423
|
+
};
|
|
186
424
|
imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
|
|
187
425
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
188
426
|
return ret;
|
|
189
427
|
};
|
|
190
428
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
191
|
-
const table = wasm.
|
|
429
|
+
const table = wasm.__wbindgen_export_2;
|
|
192
430
|
const offset = table.grow(4);
|
|
193
431
|
table.set(0, undefined);
|
|
194
432
|
table.set(offset + 0, undefined);
|
|
@@ -197,6 +435,27 @@ function __wbg_get_imports() {
|
|
|
197
435
|
table.set(offset + 3, false);
|
|
198
436
|
;
|
|
199
437
|
};
|
|
438
|
+
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
439
|
+
const ret = typeof(arg0) === 'function';
|
|
440
|
+
return ret;
|
|
441
|
+
};
|
|
442
|
+
imports.wbg.__wbindgen_is_null = function(arg0) {
|
|
443
|
+
const ret = arg0 === null;
|
|
444
|
+
return ret;
|
|
445
|
+
};
|
|
446
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
447
|
+
const ret = arg0 === undefined;
|
|
448
|
+
return ret;
|
|
449
|
+
};
|
|
450
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
451
|
+
const obj = arg1;
|
|
452
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
453
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
454
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
455
|
+
};
|
|
456
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
457
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
458
|
+
};
|
|
200
459
|
|
|
201
460
|
return imports;
|
|
202
461
|
}
|
|
@@ -208,6 +467,7 @@ function __wbg_init_memory(imports, memory) {
|
|
|
208
467
|
function __wbg_finalize_init(instance, module) {
|
|
209
468
|
wasm = instance.exports;
|
|
210
469
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
470
|
+
cachedDataViewMemory0 = null;
|
|
211
471
|
cachedUint8ArrayMemory0 = null;
|
|
212
472
|
|
|
213
473
|
|
package/stak_wasm_bg.wasm
CHANGED
|
Binary file
|