@raviqqe/stak 0.3.14 → 0.3.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/README.md +1 -0
- package/package.json +1 -1
- package/stak_wasm.d.ts +5 -0
- package/stak_wasm.js +21 -0
- package/stak_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ To install Stak Scheme as a library in your Rust project, run:
|
|
|
25
25
|
```sh
|
|
26
26
|
cargo add stak
|
|
27
27
|
cargo add --build stak-build
|
|
28
|
+
cargo install stak-compile
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
For full examples, see [the `examples` directory](https://github.com/raviqqe/stak/tree/main/examples).
|
package/package.json
CHANGED
package/stak_wasm.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export function compile(source: string): Uint8Array;
|
|
|
8
8
|
* Interprets bytecodes with standard input and returns its standard output.
|
|
9
9
|
*/
|
|
10
10
|
export function interpret(bytecodes: 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;
|
|
11
15
|
|
|
12
16
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
13
17
|
|
|
@@ -15,6 +19,7 @@ export interface InitOutput {
|
|
|
15
19
|
readonly memory: WebAssembly.Memory;
|
|
16
20
|
readonly compile: (a: number, b: number) => [number, number, number, number];
|
|
17
21
|
readonly interpret: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
22
|
+
readonly run: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
18
23
|
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
19
24
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
20
25
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
package/stak_wasm.js
CHANGED
|
@@ -128,6 +128,27 @@ export function interpret(bytecodes, input, heap_size) {
|
|
|
128
128
|
return v3;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Runs a Scheme script with standard input and returns its standard output.
|
|
133
|
+
* @param {string} source
|
|
134
|
+
* @param {Uint8Array} input
|
|
135
|
+
* @param {number} heap_size
|
|
136
|
+
* @returns {Uint8Array}
|
|
137
|
+
*/
|
|
138
|
+
export function run(source, input, heap_size) {
|
|
139
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
140
|
+
const len0 = WASM_VECTOR_LEN;
|
|
141
|
+
const ptr1 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
|
|
142
|
+
const len1 = WASM_VECTOR_LEN;
|
|
143
|
+
const ret = wasm.run(ptr0, len0, ptr1, len1, heap_size);
|
|
144
|
+
if (ret[3]) {
|
|
145
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
146
|
+
}
|
|
147
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
148
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
149
|
+
return v3;
|
|
150
|
+
}
|
|
151
|
+
|
|
131
152
|
async function __wbg_load(module, imports) {
|
|
132
153
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
133
154
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
package/stak_wasm_bg.wasm
CHANGED
|
Binary file
|