@raviqqe/stak 0.12.14 → 0.12.16

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@raviqqe/stak",
3
3
  "type": "module",
4
4
  "description": "Stak Scheme in WebAssembly",
5
- "version": "0.12.14",
5
+ "version": "0.12.16",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/stak_wasm.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Runs a Scheme script with standard input and returns its standard output.
5
+ */
6
+ export function run(source: string, input: Uint8Array, heap_size: number): Uint8Array;
3
7
  /**
4
8
  * Compiles source codes in Scheme.
5
9
  */
@@ -8,10 +12,6 @@ export function compile(source: string): Uint8Array;
8
12
  * Interprets bytecode with standard input and returns its standard output.
9
13
  */
10
14
  export function interpret(bytecode: Uint8Array, input: Uint8Array, heap_size: number): Uint8Array;
11
- /**
12
- * Runs a Scheme script with standard input and returns its standard output.
13
- */
14
- export function run(source: string, input: Uint8Array, heap_size: number): Uint8Array;
15
15
  /**
16
16
  * Runs a REPL interpreter.
17
17
  */
@@ -33,8 +33,8 @@ export interface InitOutput {
33
33
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
34
34
  readonly __externref_table_dealloc: (a: number) => void;
35
35
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
36
- readonly closure26_externref_shim: (a: number, b: number, c: any) => void;
37
- readonly closure50_externref_shim: (a: number, b: number, c: any, d: any) => void;
36
+ readonly closure18_externref_shim: (a: number, b: number, c: any) => void;
37
+ readonly closure42_externref_shim: (a: number, b: number, c: any, d: any) => void;
38
38
  readonly __wbindgen_start: () => void;
39
39
  }
40
40
 
package/stak_wasm.js CHANGED
@@ -198,6 +198,13 @@ function getDataViewMemory0() {
198
198
  return cachedDataViewMemory0;
199
199
  }
200
200
 
201
+ function passArray8ToWasm0(arg, malloc) {
202
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
203
+ getUint8ArrayMemory0().set(arg, ptr / 1);
204
+ WASM_VECTOR_LEN = arg.length;
205
+ return ptr;
206
+ }
207
+
201
208
  function takeFromExternrefTable0(idx) {
202
209
  const value = wasm.__wbindgen_export_2.get(idx);
203
210
  wasm.__externref_table_dealloc(idx);
@@ -209,62 +216,56 @@ function getArrayU8FromWasm0(ptr, len) {
209
216
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
210
217
  }
211
218
  /**
212
- * Compiles source codes in Scheme.
219
+ * Runs a Scheme script with standard input and returns its standard output.
213
220
  * @param {string} source
221
+ * @param {Uint8Array} input
222
+ * @param {number} heap_size
214
223
  * @returns {Uint8Array}
215
224
  */
216
- export function compile(source) {
225
+ export function run(source, input, heap_size) {
217
226
  const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
218
227
  const len0 = WASM_VECTOR_LEN;
219
- const ret = wasm.compile(ptr0, len0);
228
+ const ptr1 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
229
+ const len1 = WASM_VECTOR_LEN;
230
+ const ret = wasm.run(ptr0, len0, ptr1, len1, heap_size);
220
231
  if (ret[3]) {
221
232
  throw takeFromExternrefTable0(ret[2]);
222
233
  }
223
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
234
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
224
235
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
225
- return v2;
236
+ return v3;
226
237
  }
227
238
 
228
- function passArray8ToWasm0(arg, malloc) {
229
- const ptr = malloc(arg.length * 1, 1) >>> 0;
230
- getUint8ArrayMemory0().set(arg, ptr / 1);
231
- WASM_VECTOR_LEN = arg.length;
232
- return ptr;
233
- }
234
239
  /**
235
- * Interprets bytecode with standard input and returns its standard output.
236
- * @param {Uint8Array} bytecode
237
- * @param {Uint8Array} input
238
- * @param {number} heap_size
240
+ * Compiles source codes in Scheme.
241
+ * @param {string} source
239
242
  * @returns {Uint8Array}
240
243
  */
241
- export function interpret(bytecode, input, heap_size) {
242
- const ptr0 = passArray8ToWasm0(bytecode, wasm.__wbindgen_malloc);
244
+ export function compile(source) {
245
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
243
246
  const len0 = WASM_VECTOR_LEN;
244
- const ptr1 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
245
- const len1 = WASM_VECTOR_LEN;
246
- const ret = wasm.interpret(ptr0, len0, ptr1, len1, heap_size);
247
+ const ret = wasm.compile(ptr0, len0);
247
248
  if (ret[3]) {
248
249
  throw takeFromExternrefTable0(ret[2]);
249
250
  }
250
- var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
251
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
251
252
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
252
- return v3;
253
+ return v2;
253
254
  }
254
255
 
255
256
  /**
256
- * Runs a Scheme script with standard input and returns its standard output.
257
- * @param {string} source
257
+ * Interprets bytecode with standard input and returns its standard output.
258
+ * @param {Uint8Array} bytecode
258
259
  * @param {Uint8Array} input
259
260
  * @param {number} heap_size
260
261
  * @returns {Uint8Array}
261
262
  */
262
- export function run(source, input, heap_size) {
263
- const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
263
+ export function interpret(bytecode, input, heap_size) {
264
+ const ptr0 = passArray8ToWasm0(bytecode, wasm.__wbindgen_malloc);
264
265
  const len0 = WASM_VECTOR_LEN;
265
266
  const ptr1 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
266
267
  const len1 = WASM_VECTOR_LEN;
267
- const ret = wasm.run(ptr0, len0, ptr1, len1, heap_size);
268
+ const ret = wasm.interpret(ptr0, len0, ptr1, len1, heap_size);
268
269
  if (ret[3]) {
269
270
  throw takeFromExternrefTable0(ret[2]);
270
271
  }
@@ -284,11 +285,11 @@ export function repl(heap_size) {
284
285
  }
285
286
 
286
287
  function __wbg_adapter_24(arg0, arg1, arg2) {
287
- wasm.closure26_externref_shim(arg0, arg1, arg2);
288
+ wasm.closure18_externref_shim(arg0, arg1, arg2);
288
289
  }
289
290
 
290
- function __wbg_adapter_39(arg0, arg1, arg2, arg3) {
291
- wasm.closure50_externref_shim(arg0, arg1, arg2, arg3);
291
+ function __wbg_adapter_45(arg0, arg1, arg2, arg3) {
292
+ wasm.closure42_externref_shim(arg0, arg1, arg2, arg3);
292
293
  }
293
294
 
294
295
  async function __wbg_load(module, imports) {
@@ -340,7 +341,7 @@ function __wbg_get_imports() {
340
341
  const a = state0.a;
341
342
  state0.a = 0;
342
343
  try {
343
- return __wbg_adapter_39(a, state0.b, arg0, arg1);
344
+ return __wbg_adapter_45(a, state0.b, arg0, arg1);
344
345
  } finally {
345
346
  state0.a = a;
346
347
  }
@@ -362,7 +363,7 @@ function __wbg_get_imports() {
362
363
  const ret = arg0.queueMicrotask;
363
364
  return ret;
364
365
  };
365
- imports.wbg.__wbg_readstdin_676c1614412f2916 = function() {
366
+ imports.wbg.__wbg_readstdin_4dd8b04540d459a1 = function() {
366
367
  const ret = read_stdin();
367
368
  return ret;
368
369
  };
@@ -394,11 +395,11 @@ function __wbg_get_imports() {
394
395
  const ret = arg0.then(arg1, arg2);
395
396
  return ret;
396
397
  };
397
- imports.wbg.__wbg_writestderr_5e57e8a45c060c3b = function(arg0) {
398
+ imports.wbg.__wbg_writestderr_69cca5310dfe2f78 = function(arg0) {
398
399
  const ret = write_stderr(arg0);
399
400
  return ret;
400
401
  };
401
- imports.wbg.__wbg_writestdout_508916e56ccc3abc = function(arg0) {
402
+ imports.wbg.__wbg_writestdout_2f4beeeab3ecd16d = function(arg0) {
402
403
  const ret = write_stdout(arg0);
403
404
  return ret;
404
405
  };
@@ -411,8 +412,8 @@ function __wbg_get_imports() {
411
412
  const ret = false;
412
413
  return ret;
413
414
  };
414
- imports.wbg.__wbindgen_closure_wrapper99 = function(arg0, arg1, arg2) {
415
- const ret = makeMutClosure(arg0, arg1, 27, __wbg_adapter_24);
415
+ imports.wbg.__wbindgen_closure_wrapper90 = function(arg0, arg1, arg2) {
416
+ const ret = makeMutClosure(arg0, arg1, 19, __wbg_adapter_24);
416
417
  return ret;
417
418
  };
418
419
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
package/stak_wasm_bg.wasm CHANGED
Binary file