@raviqqe/stak 0.11.7 → 0.11.9

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.11.7",
5
+ "version": "0.11.9",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/stak_wasm.d.ts CHANGED
@@ -1,29 +1,29 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Runs a REPL interpreter.
5
- */
6
- export function repl(heap_size: number): Promise<void>;
7
- /**
8
- * Compiles source codes in Scheme.
4
+ * Runs a Scheme script with standard input and returns its standard output.
9
5
  */
10
- export function compile(source: string): Uint8Array;
6
+ export function run(source: string, input: Uint8Array, heap_size: number): Uint8Array;
11
7
  /**
12
8
  * Interprets bytecode with standard input and returns its standard output.
13
9
  */
14
10
  export function interpret(bytecode: Uint8Array, input: Uint8Array, heap_size: number): Uint8Array;
15
11
  /**
16
- * Runs a Scheme script with standard input and returns its standard output.
12
+ * Compiles source codes in Scheme.
17
13
  */
18
- export function run(source: string, input: Uint8Array, heap_size: number): Uint8Array;
14
+ export function compile(source: string): Uint8Array;
15
+ /**
16
+ * Runs a REPL interpreter.
17
+ */
18
+ export function repl(heap_size: number): Promise<void>;
19
19
 
20
20
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
21
21
 
22
22
  export interface InitOutput {
23
23
  readonly memory: WebAssembly.Memory;
24
- readonly repl: (a: number) => any;
25
24
  readonly compile: (a: number, b: number) => [number, number, number, number];
26
25
  readonly interpret: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
26
+ readonly repl: (a: number) => any;
27
27
  readonly run: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
28
28
  readonly __wbindgen_exn_store: (a: number) => void;
29
29
  readonly __externref_table_alloc: () => number;
@@ -34,7 +34,7 @@ export interface InitOutput {
34
34
  readonly __externref_table_dealloc: (a: number) => void;
35
35
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
36
36
  readonly closure33_externref_shim: (a: number, b: number, c: any) => void;
37
- readonly closure55_externref_shim: (a: number, b: number, c: any, d: any) => void;
37
+ readonly closure57_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
@@ -197,14 +197,12 @@ function getDataViewMemory0() {
197
197
  }
198
198
  return cachedDataViewMemory0;
199
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;
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;
208
206
  }
209
207
 
210
208
  function takeFromExternrefTable0(idx) {
@@ -218,28 +216,26 @@ function getArrayU8FromWasm0(ptr, len) {
218
216
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
219
217
  }
220
218
  /**
221
- * Compiles source codes in Scheme.
219
+ * Runs a Scheme script with standard input and returns its standard output.
222
220
  * @param {string} source
221
+ * @param {Uint8Array} input
222
+ * @param {number} heap_size
223
223
  * @returns {Uint8Array}
224
224
  */
225
- export function compile(source) {
225
+ export function run(source, input, heap_size) {
226
226
  const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
227
227
  const len0 = WASM_VECTOR_LEN;
228
- 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);
229
231
  if (ret[3]) {
230
232
  throw takeFromExternrefTable0(ret[2]);
231
233
  }
232
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
234
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
233
235
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
234
- return v2;
236
+ return v3;
235
237
  }
236
238
 
237
- function passArray8ToWasm0(arg, malloc) {
238
- const ptr = malloc(arg.length * 1, 1) >>> 0;
239
- getUint8ArrayMemory0().set(arg, ptr / 1);
240
- WASM_VECTOR_LEN = arg.length;
241
- return ptr;
242
- }
243
239
  /**
244
240
  * Interprets bytecode with standard input and returns its standard output.
245
241
  * @param {Uint8Array} bytecode
@@ -262,24 +258,30 @@ export function interpret(bytecode, input, heap_size) {
262
258
  }
263
259
 
264
260
  /**
265
- * Runs a Scheme script with standard input and returns its standard output.
261
+ * Compiles source codes in Scheme.
266
262
  * @param {string} source
267
- * @param {Uint8Array} input
268
- * @param {number} heap_size
269
263
  * @returns {Uint8Array}
270
264
  */
271
- export function run(source, input, heap_size) {
265
+ export function compile(source) {
272
266
  const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
273
267
  const len0 = WASM_VECTOR_LEN;
274
- const ptr1 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
275
- const len1 = WASM_VECTOR_LEN;
276
- const ret = wasm.run(ptr0, len0, ptr1, len1, heap_size);
268
+ const ret = wasm.compile(ptr0, len0);
277
269
  if (ret[3]) {
278
270
  throw takeFromExternrefTable0(ret[2]);
279
271
  }
280
- var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
272
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
281
273
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
282
- return v3;
274
+ return v2;
275
+ }
276
+
277
+ /**
278
+ * Runs a REPL interpreter.
279
+ * @param {number} heap_size
280
+ * @returns {Promise<void>}
281
+ */
282
+ export function repl(heap_size) {
283
+ const ret = wasm.repl(heap_size);
284
+ return ret;
283
285
  }
284
286
 
285
287
  function __wbg_adapter_24(arg0, arg1, arg2) {
@@ -287,7 +289,7 @@ function __wbg_adapter_24(arg0, arg1, arg2) {
287
289
  }
288
290
 
289
291
  function __wbg_adapter_45(arg0, arg1, arg2, arg3) {
290
- wasm.closure55_externref_shim(arg0, arg1, arg2, arg3);
292
+ wasm.closure57_externref_shim(arg0, arg1, arg2, arg3);
291
293
  }
292
294
 
293
295
  async function __wbg_load(module, imports) {
@@ -361,7 +363,7 @@ function __wbg_get_imports() {
361
363
  const ret = arg0.queueMicrotask;
362
364
  return ret;
363
365
  };
364
- imports.wbg.__wbg_readstdin_fef0ab9493b922dc = function() {
366
+ imports.wbg.__wbg_readstdin_397badeaadecad8a = function() {
365
367
  const ret = read_stdin();
366
368
  return ret;
367
369
  };
@@ -393,11 +395,11 @@ function __wbg_get_imports() {
393
395
  const ret = arg0.then(arg1, arg2);
394
396
  return ret;
395
397
  };
396
- imports.wbg.__wbg_writestderr_3e03a033e339cec3 = function(arg0) {
398
+ imports.wbg.__wbg_writestderr_89ebdcb15680582e = function(arg0) {
397
399
  const ret = write_stderr(arg0);
398
400
  return ret;
399
401
  };
400
- imports.wbg.__wbg_writestdout_44f94959473f17c3 = function(arg0) {
402
+ imports.wbg.__wbg_writestdout_05ad3300bf790c89 = function(arg0) {
401
403
  const ret = write_stdout(arg0);
402
404
  return ret;
403
405
  };
package/stak_wasm_bg.wasm CHANGED
Binary file