woxi-wasm 0.1.0 → 0.2.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.
- package/package.json +1 -1
- package/pkg/woxi.d.ts +57 -57
- package/pkg/woxi.js +155 -155
- package/pkg/woxi_bg.wasm +0 -0
package/package.json
CHANGED
package/pkg/woxi.d.ts
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Return the playable audio (base64-encoded) from the last `evaluate()`
|
|
5
|
+
* call, if any. Returns an empty string when there is no sound.
|
|
6
|
+
*/
|
|
7
|
+
export function get_sound(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Remove all host-registered in-memory files.
|
|
10
|
+
*/
|
|
11
|
+
export function clear_virtual_files(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Return SVG rendering of the last text result (with superscripts etc.).
|
|
14
|
+
* Returns an empty string when there is no output SVG (e.g. for Graphics results).
|
|
15
|
+
*/
|
|
16
|
+
export function get_output_svg(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Split `input` into top-level statements and return a JSON array of strings.
|
|
19
|
+
* Lets the front-end loop one statement at a time so output (and side
|
|
20
|
+
* effects like `Pause[n]`) appear progressively rather than batched.
|
|
21
|
+
*/
|
|
22
|
+
export function split_statements(input: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Register (or replace) an in-memory file so `Import["name"]` can read it
|
|
25
|
+
* in the browser.
|
|
26
|
+
*/
|
|
27
|
+
export function set_virtual_file(name: string, data: Uint8Array): void;
|
|
3
28
|
/**
|
|
4
29
|
* Render a Manipulate body, its extra display elements, and any pending
|
|
5
30
|
* interactive write-backs in one call. Used by widgets that have display
|
|
@@ -16,37 +41,9 @@
|
|
|
16
41
|
*/
|
|
17
42
|
export function evaluate_manipulate_full(body: string, displays_json: string, bindings_json: string, mutations_json: string): string;
|
|
18
43
|
/**
|
|
19
|
-
*
|
|
20
|
-
* in the browser.
|
|
21
|
-
*/
|
|
22
|
-
export function set_virtual_file(name: string, data: Uint8Array): void;
|
|
23
|
-
/**
|
|
24
|
-
* Return the captured SVG graphics from the last `evaluate()` call, if any.
|
|
25
|
-
* Returns an empty string when there is no graphics output.
|
|
26
|
-
*/
|
|
27
|
-
export function get_graphics(): string;
|
|
28
|
-
/**
|
|
29
|
-
* Evaluate all top-level statements and return a JSON array of output items.
|
|
30
|
-
* Each item has a "type" field ("text", "graphics", "print", "warning", "error",
|
|
31
|
-
* "manipulate") and corresponding content fields.
|
|
32
|
-
*/
|
|
33
|
-
export function evaluate_all(input: string): string;
|
|
34
|
-
/**
|
|
35
|
-
* Evaluate a single statement and return a JSON array of output items
|
|
36
|
-
* (same shape as `evaluate_all`'s elements). Use together with
|
|
37
|
-
* `split_statements` for progressive output.
|
|
38
|
-
*/
|
|
39
|
-
export function evaluate_statement(stmt: string): string;
|
|
40
|
-
/**
|
|
41
|
-
* Split `input` into top-level statements and return a JSON array of strings.
|
|
42
|
-
* Lets the front-end loop one statement at a time so output (and side
|
|
43
|
-
* effects like `Pause[n]`) appear progressively rather than batched.
|
|
44
|
-
*/
|
|
45
|
-
export function split_statements(input: string): string;
|
|
46
|
-
/**
|
|
47
|
-
* Remove all host-registered in-memory files.
|
|
44
|
+
* Enable or disable dark mode for SVG output colors.
|
|
48
45
|
*/
|
|
49
|
-
export function
|
|
46
|
+
export function set_dark_mode(enabled: boolean): void;
|
|
50
47
|
/**
|
|
51
48
|
* Evaluate a Manipulate body with a specific set of variable bindings
|
|
52
49
|
* and return a single JSON output item representing the result.
|
|
@@ -61,38 +58,20 @@ export function clear_virtual_files(): void;
|
|
|
61
58
|
*/
|
|
62
59
|
export function evaluate_manipulate(body: string, bindings_json: string): string;
|
|
63
60
|
/**
|
|
64
|
-
* Evaluate
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Return SVG rendering of the last text result (with superscripts etc.).
|
|
69
|
-
* Returns an empty string when there is no output SVG (e.g. for Graphics results).
|
|
70
|
-
*/
|
|
71
|
-
export function get_output_svg(): string;
|
|
72
|
-
/**
|
|
73
|
-
* Enable or disable dark mode for SVG output colors.
|
|
74
|
-
*/
|
|
75
|
-
export function set_dark_mode(enabled: boolean): void;
|
|
76
|
-
/**
|
|
77
|
-
* Evaluate a Wolfram Language expression and return the result.
|
|
78
|
-
* If the expression produces Print output, it is prepended to the result.
|
|
79
|
-
*/
|
|
80
|
-
export function evaluate(input: string): string;
|
|
81
|
-
/**
|
|
82
|
-
* Return warnings from the last `evaluate()` call as newline-separated text.
|
|
83
|
-
* Returns an empty string when there are no warnings.
|
|
61
|
+
* Evaluate all top-level statements and return a JSON array of output items.
|
|
62
|
+
* Each item has a "type" field ("text", "graphics", "print", "warning", "error",
|
|
63
|
+
* "manipulate") and corresponding content fields.
|
|
84
64
|
*/
|
|
85
|
-
export function
|
|
65
|
+
export function evaluate_all(input: string): string;
|
|
86
66
|
/**
|
|
87
|
-
* Return the
|
|
88
|
-
*
|
|
67
|
+
* Return the captured GraphicsBox expression from the last `evaluate()` call.
|
|
68
|
+
* Returns an empty string when there is no graphics output.
|
|
89
69
|
*/
|
|
90
|
-
export function
|
|
70
|
+
export function get_graphicsbox(): string;
|
|
91
71
|
/**
|
|
92
72
|
* Clear all interpreter state (variables and function definitions).
|
|
93
73
|
*/
|
|
94
74
|
export function clear(): void;
|
|
95
|
-
export function init(): void;
|
|
96
75
|
/**
|
|
97
76
|
* Evaluate each Manipulate control's `Enabled` condition against a binding
|
|
98
77
|
* set and return a JSON array of booleans (one per control, in order).
|
|
@@ -105,7 +84,28 @@ export function init(): void;
|
|
|
105
84
|
*/
|
|
106
85
|
export function evaluate_manipulate_enabled(conditions_json: string, bindings_json: string): string;
|
|
107
86
|
/**
|
|
108
|
-
*
|
|
87
|
+
* Evaluate a single statement and return a JSON array of output items
|
|
88
|
+
* (same shape as `evaluate_all`'s elements). Use together with
|
|
89
|
+
* `split_statements` for progressive output.
|
|
90
|
+
*/
|
|
91
|
+
export function evaluate_statement(stmt: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* Evaluate, returning only the final expression result (no Print output).
|
|
94
|
+
*/
|
|
95
|
+
export function evaluate_expr(input: string): string;
|
|
96
|
+
/**
|
|
97
|
+
* Return warnings from the last `evaluate()` call as newline-separated text.
|
|
98
|
+
* Returns an empty string when there are no warnings.
|
|
99
|
+
*/
|
|
100
|
+
export function get_warnings(): string;
|
|
101
|
+
/**
|
|
102
|
+
* Return the captured SVG graphics from the last `evaluate()` call, if any.
|
|
109
103
|
* Returns an empty string when there is no graphics output.
|
|
110
104
|
*/
|
|
111
|
-
export function
|
|
105
|
+
export function get_graphics(): string;
|
|
106
|
+
export function init(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Evaluate a Wolfram Language expression and return the result.
|
|
109
|
+
* If the expression produces Print output, it is prepended to the result.
|
|
110
|
+
*/
|
|
111
|
+
export function evaluate(input: string): string;
|
package/pkg/woxi.js
CHANGED
|
@@ -176,75 +176,40 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
176
176
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* elements (e.g. a `Checkbox` grid) that both read and rewrite shared
|
|
182
|
-
* state.
|
|
183
|
-
*
|
|
184
|
-
* `displays_json` and `mutations_json` are JSON string arrays. Each
|
|
185
|
-
* mutation is an assignment (e.g. `data[[3, 5]] = 1`) applied before the
|
|
186
|
-
* re-render; the updated value of every mutated variable is returned under
|
|
187
|
-
* `state` so the frontend can keep its binding set in sync.
|
|
188
|
-
*
|
|
189
|
-
* The result is `{"output":{svg|text|textSvg}, "displays":[<tree>…],
|
|
190
|
-
* "state":{name:value,…}}`.
|
|
191
|
-
* @param {string} body
|
|
192
|
-
* @param {string} displays_json
|
|
193
|
-
* @param {string} bindings_json
|
|
194
|
-
* @param {string} mutations_json
|
|
179
|
+
* Return the playable audio (base64-encoded) from the last `evaluate()`
|
|
180
|
+
* call, if any. Returns an empty string when there is no sound.
|
|
195
181
|
* @returns {string}
|
|
196
182
|
*/
|
|
197
|
-
exports.
|
|
198
|
-
let
|
|
199
|
-
let
|
|
183
|
+
exports.get_sound = function() {
|
|
184
|
+
let deferred1_0;
|
|
185
|
+
let deferred1_1;
|
|
200
186
|
try {
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const len1 = WASM_VECTOR_LEN;
|
|
205
|
-
const ptr2 = passStringToWasm0(bindings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
206
|
-
const len2 = WASM_VECTOR_LEN;
|
|
207
|
-
const ptr3 = passStringToWasm0(mutations_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
208
|
-
const len3 = WASM_VECTOR_LEN;
|
|
209
|
-
const ret = wasm.evaluate_manipulate_full(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
210
|
-
deferred5_0 = ret[0];
|
|
211
|
-
deferred5_1 = ret[1];
|
|
187
|
+
const ret = wasm.get_sound();
|
|
188
|
+
deferred1_0 = ret[0];
|
|
189
|
+
deferred1_1 = ret[1];
|
|
212
190
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
213
191
|
} finally {
|
|
214
|
-
wasm.__wbindgen_free(
|
|
192
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
215
193
|
}
|
|
216
194
|
};
|
|
217
195
|
|
|
218
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
219
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
220
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
221
|
-
WASM_VECTOR_LEN = arg.length;
|
|
222
|
-
return ptr;
|
|
223
|
-
}
|
|
224
196
|
/**
|
|
225
|
-
*
|
|
226
|
-
* in the browser.
|
|
227
|
-
* @param {string} name
|
|
228
|
-
* @param {Uint8Array} data
|
|
197
|
+
* Remove all host-registered in-memory files.
|
|
229
198
|
*/
|
|
230
|
-
exports.
|
|
231
|
-
|
|
232
|
-
const len0 = WASM_VECTOR_LEN;
|
|
233
|
-
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
234
|
-
const len1 = WASM_VECTOR_LEN;
|
|
235
|
-
wasm.set_virtual_file(ptr0, len0, ptr1, len1);
|
|
199
|
+
exports.clear_virtual_files = function() {
|
|
200
|
+
wasm.clear_virtual_files();
|
|
236
201
|
};
|
|
237
202
|
|
|
238
203
|
/**
|
|
239
|
-
* Return
|
|
240
|
-
* Returns an empty string when there is no
|
|
204
|
+
* Return SVG rendering of the last text result (with superscripts etc.).
|
|
205
|
+
* Returns an empty string when there is no output SVG (e.g. for Graphics results).
|
|
241
206
|
* @returns {string}
|
|
242
207
|
*/
|
|
243
|
-
exports.
|
|
208
|
+
exports.get_output_svg = function() {
|
|
244
209
|
let deferred1_0;
|
|
245
210
|
let deferred1_1;
|
|
246
211
|
try {
|
|
247
|
-
const ret = wasm.
|
|
212
|
+
const ret = wasm.get_output_svg();
|
|
248
213
|
deferred1_0 = ret[0];
|
|
249
214
|
deferred1_1 = ret[1];
|
|
250
215
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -254,19 +219,19 @@ exports.get_graphics = function() {
|
|
|
254
219
|
};
|
|
255
220
|
|
|
256
221
|
/**
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
222
|
+
* Split `input` into top-level statements and return a JSON array of strings.
|
|
223
|
+
* Lets the front-end loop one statement at a time so output (and side
|
|
224
|
+
* effects like `Pause[n]`) appear progressively rather than batched.
|
|
260
225
|
* @param {string} input
|
|
261
226
|
* @returns {string}
|
|
262
227
|
*/
|
|
263
|
-
exports.
|
|
228
|
+
exports.split_statements = function(input) {
|
|
264
229
|
let deferred2_0;
|
|
265
230
|
let deferred2_1;
|
|
266
231
|
try {
|
|
267
232
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
268
233
|
const len0 = WASM_VECTOR_LEN;
|
|
269
|
-
const ret = wasm.
|
|
234
|
+
const ret = wasm.split_statements(ptr0, len0);
|
|
270
235
|
deferred2_0 = ret[0];
|
|
271
236
|
deferred2_1 = ret[1];
|
|
272
237
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -275,55 +240,72 @@ exports.evaluate_all = function(input) {
|
|
|
275
240
|
}
|
|
276
241
|
};
|
|
277
242
|
|
|
243
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
244
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
245
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
246
|
+
WASM_VECTOR_LEN = arg.length;
|
|
247
|
+
return ptr;
|
|
248
|
+
}
|
|
278
249
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* @param {
|
|
283
|
-
* @returns {string}
|
|
250
|
+
* Register (or replace) an in-memory file so `Import["name"]` can read it
|
|
251
|
+
* in the browser.
|
|
252
|
+
* @param {string} name
|
|
253
|
+
* @param {Uint8Array} data
|
|
284
254
|
*/
|
|
285
|
-
exports.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const ret = wasm.evaluate_statement(ptr0, len0);
|
|
292
|
-
deferred2_0 = ret[0];
|
|
293
|
-
deferred2_1 = ret[1];
|
|
294
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
295
|
-
} finally {
|
|
296
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
297
|
-
}
|
|
255
|
+
exports.set_virtual_file = function(name, data) {
|
|
256
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
257
|
+
const len0 = WASM_VECTOR_LEN;
|
|
258
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
259
|
+
const len1 = WASM_VECTOR_LEN;
|
|
260
|
+
wasm.set_virtual_file(ptr0, len0, ptr1, len1);
|
|
298
261
|
};
|
|
299
262
|
|
|
300
263
|
/**
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
264
|
+
* Render a Manipulate body, its extra display elements, and any pending
|
|
265
|
+
* interactive write-backs in one call. Used by widgets that have display
|
|
266
|
+
* elements (e.g. a `Checkbox` grid) that both read and rewrite shared
|
|
267
|
+
* state.
|
|
268
|
+
*
|
|
269
|
+
* `displays_json` and `mutations_json` are JSON string arrays. Each
|
|
270
|
+
* mutation is an assignment (e.g. `data[[3, 5]] = 1`) applied before the
|
|
271
|
+
* re-render; the updated value of every mutated variable is returned under
|
|
272
|
+
* `state` so the frontend can keep its binding set in sync.
|
|
273
|
+
*
|
|
274
|
+
* The result is `{"output":{svg|text|textSvg}, "displays":[<tree>…],
|
|
275
|
+
* "state":{name:value,…}}`.
|
|
276
|
+
* @param {string} body
|
|
277
|
+
* @param {string} displays_json
|
|
278
|
+
* @param {string} bindings_json
|
|
279
|
+
* @param {string} mutations_json
|
|
305
280
|
* @returns {string}
|
|
306
281
|
*/
|
|
307
|
-
exports.
|
|
308
|
-
let
|
|
309
|
-
let
|
|
282
|
+
exports.evaluate_manipulate_full = function(body, displays_json, bindings_json, mutations_json) {
|
|
283
|
+
let deferred5_0;
|
|
284
|
+
let deferred5_1;
|
|
310
285
|
try {
|
|
311
|
-
const ptr0 = passStringToWasm0(
|
|
286
|
+
const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
312
287
|
const len0 = WASM_VECTOR_LEN;
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
288
|
+
const ptr1 = passStringToWasm0(displays_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
289
|
+
const len1 = WASM_VECTOR_LEN;
|
|
290
|
+
const ptr2 = passStringToWasm0(bindings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
291
|
+
const len2 = WASM_VECTOR_LEN;
|
|
292
|
+
const ptr3 = passStringToWasm0(mutations_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
293
|
+
const len3 = WASM_VECTOR_LEN;
|
|
294
|
+
const ret = wasm.evaluate_manipulate_full(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
295
|
+
deferred5_0 = ret[0];
|
|
296
|
+
deferred5_1 = ret[1];
|
|
316
297
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
317
298
|
} finally {
|
|
318
|
-
wasm.__wbindgen_free(
|
|
299
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
319
300
|
}
|
|
320
301
|
};
|
|
321
302
|
|
|
322
303
|
/**
|
|
323
|
-
*
|
|
304
|
+
* Enable or disable dark mode for SVG output colors.
|
|
305
|
+
* @param {boolean} enabled
|
|
324
306
|
*/
|
|
325
|
-
exports.
|
|
326
|
-
wasm.
|
|
307
|
+
exports.set_dark_mode = function(enabled) {
|
|
308
|
+
wasm.set_dark_mode(enabled);
|
|
327
309
|
};
|
|
328
310
|
|
|
329
311
|
/**
|
|
@@ -359,17 +341,19 @@ exports.evaluate_manipulate = function(body, bindings_json) {
|
|
|
359
341
|
};
|
|
360
342
|
|
|
361
343
|
/**
|
|
362
|
-
* Evaluate
|
|
344
|
+
* Evaluate all top-level statements and return a JSON array of output items.
|
|
345
|
+
* Each item has a "type" field ("text", "graphics", "print", "warning", "error",
|
|
346
|
+
* "manipulate") and corresponding content fields.
|
|
363
347
|
* @param {string} input
|
|
364
348
|
* @returns {string}
|
|
365
349
|
*/
|
|
366
|
-
exports.
|
|
350
|
+
exports.evaluate_all = function(input) {
|
|
367
351
|
let deferred2_0;
|
|
368
352
|
let deferred2_1;
|
|
369
353
|
try {
|
|
370
354
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
371
355
|
const len0 = WASM_VECTOR_LEN;
|
|
372
|
-
const ret = wasm.
|
|
356
|
+
const ret = wasm.evaluate_all(ptr0, len0);
|
|
373
357
|
deferred2_0 = ret[0];
|
|
374
358
|
deferred2_1 = ret[1];
|
|
375
359
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -379,15 +363,15 @@ exports.evaluate_expr = function(input) {
|
|
|
379
363
|
};
|
|
380
364
|
|
|
381
365
|
/**
|
|
382
|
-
* Return
|
|
383
|
-
* Returns an empty string when there is no output
|
|
366
|
+
* Return the captured GraphicsBox expression from the last `evaluate()` call.
|
|
367
|
+
* Returns an empty string when there is no graphics output.
|
|
384
368
|
* @returns {string}
|
|
385
369
|
*/
|
|
386
|
-
exports.
|
|
370
|
+
exports.get_graphicsbox = function() {
|
|
387
371
|
let deferred1_0;
|
|
388
372
|
let deferred1_1;
|
|
389
373
|
try {
|
|
390
|
-
const ret = wasm.
|
|
374
|
+
const ret = wasm.get_graphicsbox();
|
|
391
375
|
deferred1_0 = ret[0];
|
|
392
376
|
deferred1_1 = ret[1];
|
|
393
377
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -397,26 +381,76 @@ exports.get_output_svg = function() {
|
|
|
397
381
|
};
|
|
398
382
|
|
|
399
383
|
/**
|
|
400
|
-
*
|
|
401
|
-
* @param {boolean} enabled
|
|
384
|
+
* Clear all interpreter state (variables and function definitions).
|
|
402
385
|
*/
|
|
403
|
-
exports.
|
|
404
|
-
wasm.
|
|
386
|
+
exports.clear = function() {
|
|
387
|
+
wasm.clear();
|
|
405
388
|
};
|
|
406
389
|
|
|
407
390
|
/**
|
|
408
|
-
* Evaluate
|
|
409
|
-
*
|
|
391
|
+
* Evaluate each Manipulate control's `Enabled` condition against a binding
|
|
392
|
+
* set and return a JSON array of booleans (one per control, in order).
|
|
393
|
+
*
|
|
394
|
+
* `conditions_json` is a JSON string array aligned with the control list;
|
|
395
|
+
* an empty string marks a control with no condition (always enabled).
|
|
396
|
+
* `bindings_json` is the same JSON object of variable bindings used by
|
|
397
|
+
* `evaluate_manipulate`. Used by the Playground to grey out controls that a
|
|
398
|
+
* `Enabled -> Dynamic[…]` option has switched off for the current state.
|
|
399
|
+
* @param {string} conditions_json
|
|
400
|
+
* @param {string} bindings_json
|
|
401
|
+
* @returns {string}
|
|
402
|
+
*/
|
|
403
|
+
exports.evaluate_manipulate_enabled = function(conditions_json, bindings_json) {
|
|
404
|
+
let deferred3_0;
|
|
405
|
+
let deferred3_1;
|
|
406
|
+
try {
|
|
407
|
+
const ptr0 = passStringToWasm0(conditions_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
408
|
+
const len0 = WASM_VECTOR_LEN;
|
|
409
|
+
const ptr1 = passStringToWasm0(bindings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
410
|
+
const len1 = WASM_VECTOR_LEN;
|
|
411
|
+
const ret = wasm.evaluate_manipulate_enabled(ptr0, len0, ptr1, len1);
|
|
412
|
+
deferred3_0 = ret[0];
|
|
413
|
+
deferred3_1 = ret[1];
|
|
414
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
415
|
+
} finally {
|
|
416
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Evaluate a single statement and return a JSON array of output items
|
|
422
|
+
* (same shape as `evaluate_all`'s elements). Use together with
|
|
423
|
+
* `split_statements` for progressive output.
|
|
424
|
+
* @param {string} stmt
|
|
425
|
+
* @returns {string}
|
|
426
|
+
*/
|
|
427
|
+
exports.evaluate_statement = function(stmt) {
|
|
428
|
+
let deferred2_0;
|
|
429
|
+
let deferred2_1;
|
|
430
|
+
try {
|
|
431
|
+
const ptr0 = passStringToWasm0(stmt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
432
|
+
const len0 = WASM_VECTOR_LEN;
|
|
433
|
+
const ret = wasm.evaluate_statement(ptr0, len0);
|
|
434
|
+
deferred2_0 = ret[0];
|
|
435
|
+
deferred2_1 = ret[1];
|
|
436
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
437
|
+
} finally {
|
|
438
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Evaluate, returning only the final expression result (no Print output).
|
|
410
444
|
* @param {string} input
|
|
411
445
|
* @returns {string}
|
|
412
446
|
*/
|
|
413
|
-
exports.
|
|
447
|
+
exports.evaluate_expr = function(input) {
|
|
414
448
|
let deferred2_0;
|
|
415
449
|
let deferred2_1;
|
|
416
450
|
try {
|
|
417
451
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
418
452
|
const len0 = WASM_VECTOR_LEN;
|
|
419
|
-
const ret = wasm.
|
|
453
|
+
const ret = wasm.evaluate_expr(ptr0, len0);
|
|
420
454
|
deferred2_0 = ret[0];
|
|
421
455
|
deferred2_1 = ret[1];
|
|
422
456
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -444,15 +478,15 @@ exports.get_warnings = function() {
|
|
|
444
478
|
};
|
|
445
479
|
|
|
446
480
|
/**
|
|
447
|
-
* Return the
|
|
448
|
-
*
|
|
481
|
+
* Return the captured SVG graphics from the last `evaluate()` call, if any.
|
|
482
|
+
* Returns an empty string when there is no graphics output.
|
|
449
483
|
* @returns {string}
|
|
450
484
|
*/
|
|
451
|
-
exports.
|
|
485
|
+
exports.get_graphics = function() {
|
|
452
486
|
let deferred1_0;
|
|
453
487
|
let deferred1_1;
|
|
454
488
|
try {
|
|
455
|
-
const ret = wasm.
|
|
489
|
+
const ret = wasm.get_graphics();
|
|
456
490
|
deferred1_0 = ret[0];
|
|
457
491
|
deferred1_1 = ret[1];
|
|
458
492
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -461,62 +495,28 @@ exports.get_sound = function() {
|
|
|
461
495
|
}
|
|
462
496
|
};
|
|
463
497
|
|
|
464
|
-
/**
|
|
465
|
-
* Clear all interpreter state (variables and function definitions).
|
|
466
|
-
*/
|
|
467
|
-
exports.clear = function() {
|
|
468
|
-
wasm.clear();
|
|
469
|
-
};
|
|
470
|
-
|
|
471
498
|
exports.init = function() {
|
|
472
499
|
wasm.init();
|
|
473
500
|
};
|
|
474
501
|
|
|
475
502
|
/**
|
|
476
|
-
* Evaluate
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
* `conditions_json` is a JSON string array aligned with the control list;
|
|
480
|
-
* an empty string marks a control with no condition (always enabled).
|
|
481
|
-
* `bindings_json` is the same JSON object of variable bindings used by
|
|
482
|
-
* `evaluate_manipulate`. Used by the Playground to grey out controls that a
|
|
483
|
-
* `Enabled -> Dynamic[…]` option has switched off for the current state.
|
|
484
|
-
* @param {string} conditions_json
|
|
485
|
-
* @param {string} bindings_json
|
|
503
|
+
* Evaluate a Wolfram Language expression and return the result.
|
|
504
|
+
* If the expression produces Print output, it is prepended to the result.
|
|
505
|
+
* @param {string} input
|
|
486
506
|
* @returns {string}
|
|
487
507
|
*/
|
|
488
|
-
exports.
|
|
489
|
-
let
|
|
490
|
-
let
|
|
508
|
+
exports.evaluate = function(input) {
|
|
509
|
+
let deferred2_0;
|
|
510
|
+
let deferred2_1;
|
|
491
511
|
try {
|
|
492
|
-
const ptr0 = passStringToWasm0(
|
|
512
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
493
513
|
const len0 = WASM_VECTOR_LEN;
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
deferred3_0 = ret[0];
|
|
498
|
-
deferred3_1 = ret[1];
|
|
499
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
500
|
-
} finally {
|
|
501
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Return the captured GraphicsBox expression from the last `evaluate()` call.
|
|
507
|
-
* Returns an empty string when there is no graphics output.
|
|
508
|
-
* @returns {string}
|
|
509
|
-
*/
|
|
510
|
-
exports.get_graphicsbox = function() {
|
|
511
|
-
let deferred1_0;
|
|
512
|
-
let deferred1_1;
|
|
513
|
-
try {
|
|
514
|
-
const ret = wasm.get_graphicsbox();
|
|
515
|
-
deferred1_0 = ret[0];
|
|
516
|
-
deferred1_1 = ret[1];
|
|
514
|
+
const ret = wasm.evaluate(ptr0, len0);
|
|
515
|
+
deferred2_0 = ret[0];
|
|
516
|
+
deferred2_1 = ret[1];
|
|
517
517
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
518
518
|
} finally {
|
|
519
|
-
wasm.__wbindgen_free(
|
|
519
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
520
520
|
}
|
|
521
521
|
};
|
|
522
522
|
|
|
@@ -553,7 +553,7 @@ exports.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
|
553
553
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
554
554
|
};
|
|
555
555
|
|
|
556
|
-
exports.
|
|
556
|
+
exports.__wbg___woxi_fetch_url_a5ed8b2ee9da4ed7 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
557
557
|
const ret = __woxi_fetch_url(getStringFromWasm0(arg1, arg2));
|
|
558
558
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
559
559
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -561,7 +561,7 @@ exports.__wbg___woxi_fetch_url_b456f49aff4e3138 = function() { return handleErro
|
|
|
561
561
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
562
562
|
}, arguments) };
|
|
563
563
|
|
|
564
|
-
exports.
|
|
564
|
+
exports.__wbg___woxi_report_panic_be5ad4a7b740d1b8 = function() { return handleError(function (arg0, arg1) {
|
|
565
565
|
__woxi_report_panic(getStringFromWasm0(arg0, arg1));
|
|
566
566
|
}, arguments) };
|
|
567
567
|
|
package/pkg/woxi_bg.wasm
CHANGED
|
Binary file
|