mimium-web 4.0.2 → 4.1.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/README.md CHANGED
@@ -73,6 +73,8 @@ mimium can describe digital signal processing algorithm from very low-level, lik
73
73
 
74
74
  mimium's VM design is inspired by Lua, that can be easily embedded on Rust application through the plugin system. External functions (closures) defined in Rust can be easily called from mimium.
75
75
 
76
+ Also, the code itself can be transpiled into Rust code which enables a quick prototyping of the development of native audio application.
77
+
76
78
  ## Installation
77
79
 
78
80
  The easiest way to start mimium is using [Visual Studio Code Extension](https://github.com/mimium-org/mimium-language). The extention will automatically download CLI tool `mimium-cli` and language server (support for syntactic highlight and error reporting) when installed.
package/mimium_web.d.ts CHANGED
@@ -18,6 +18,8 @@ export class Context {
18
18
  clear_virtual_file_cache(): void;
19
19
  compile(src: string): Promise<void>;
20
20
  compile_direct(src: string): void;
21
+ emit_rust(src: string): Promise<string>;
22
+ emit_rust_direct(src: string): string;
21
23
  export_virtual_file_cache_json(): string;
22
24
  get_input_channels(): number;
23
25
  get_output_channels(): number;
@@ -57,6 +59,8 @@ export interface InitOutput {
57
59
  readonly context_clear_virtual_file_cache: (a: number) => [number, number];
58
60
  readonly context_compile: (a: number, b: number, c: number) => any;
59
61
  readonly context_compile_direct: (a: number, b: number, c: number) => [number, number];
62
+ readonly context_emit_rust: (a: number, b: number, c: number) => any;
63
+ readonly context_emit_rust_direct: (a: number, b: number, c: number) => [number, number, number, number];
60
64
  readonly context_export_virtual_file_cache_json: (a: number) => [number, number, number, number];
61
65
  readonly context_get_input_channels: (a: number) => number;
62
66
  readonly context_get_output_channels: (a: number) => number;
package/mimium_web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* @ts-self-types="./mimium_web.d.ts" */
2
- import { __mimium_test_clear_cache, __mimium_test_put_cache, export_virtual_file_cache_json, get_env, has_network_api, import_virtual_file_cache_json, preload_mimium_lib_cache, preload_user_module_cache, read_file, set_module_base_url } from './snippets/mimium-lang-bd76372349d54b1b/src/utils/fileloader.js';
2
+ import { __mimium_test_clear_cache, __mimium_test_put_cache, export_virtual_file_cache_json, get_env, has_network_api, import_virtual_file_cache_json, preload_mimium_lib_cache, preload_user_module_cache, read_file, set_module_base_url } from './snippets/mimium-lang-f542d5fedb13efa4/src/utils/fileloader.js';
3
3
 
4
4
  export class Config {
5
5
  static __wrap(ptr) {
@@ -119,6 +119,40 @@ export class Context {
119
119
  throw takeFromExternrefTable0(ret[0]);
120
120
  }
121
121
  }
122
+ /**
123
+ * @param {string} src
124
+ * @returns {Promise<string>}
125
+ */
126
+ emit_rust(src) {
127
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
128
+ const len0 = WASM_VECTOR_LEN;
129
+ const ret = wasm.context_emit_rust(this.__wbg_ptr, ptr0, len0);
130
+ return ret;
131
+ }
132
+ /**
133
+ * @param {string} src
134
+ * @returns {string}
135
+ */
136
+ emit_rust_direct(src) {
137
+ let deferred3_0;
138
+ let deferred3_1;
139
+ try {
140
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
141
+ const len0 = WASM_VECTOR_LEN;
142
+ const ret = wasm.context_emit_rust_direct(this.__wbg_ptr, ptr0, len0);
143
+ var ptr2 = ret[0];
144
+ var len2 = ret[1];
145
+ if (ret[3]) {
146
+ ptr2 = 0; len2 = 0;
147
+ throw takeFromExternrefTable0(ret[2]);
148
+ }
149
+ deferred3_0 = ptr2;
150
+ deferred3_1 = len2;
151
+ return getStringFromWasm0(ptr2, len2);
152
+ } finally {
153
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
154
+ }
155
+ }
122
156
  /**
123
157
  * @returns {string}
124
158
  */
@@ -263,10 +297,10 @@ if (Symbol.dispose) Context.prototype[Symbol.dispose] = Context.prototype.free;
263
297
  function __wbg_get_imports() {
264
298
  const import0 = {
265
299
  __proto__: null,
266
- __wbg___mimium_test_clear_cache_ac3d36d139954c1c: function() { return handleError(function () {
300
+ __wbg___mimium_test_clear_cache_4d7214f571b2d154: function() { return handleError(function () {
267
301
  __mimium_test_clear_cache();
268
302
  }, arguments); },
269
- __wbg___mimium_test_put_cache_64881a34222d78b1: function() { return handleError(function (arg0, arg1, arg2, arg3) {
303
+ __wbg___mimium_test_put_cache_93e377b579f7a8ae: function() { return handleError(function (arg0, arg1, arg2, arg3) {
270
304
  __mimium_test_put_cache(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
271
305
  }, arguments); },
272
306
  __wbg___wbindgen_copy_to_typed_array_d2f20acdab8e0740: function(arg0, arg1, arg2) {
@@ -308,25 +342,25 @@ function __wbg_get_imports() {
308
342
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
309
343
  }
310
344
  },
311
- __wbg_export_virtual_file_cache_json_1769c56dd617c6f1: function() { return handleError(function (arg0) {
345
+ __wbg_export_virtual_file_cache_json_a9372a73058fe29e: function() { return handleError(function (arg0) {
312
346
  const ret = export_virtual_file_cache_json();
313
347
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
314
348
  const len1 = WASM_VECTOR_LEN;
315
349
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
316
350
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
317
351
  }, arguments); },
318
- __wbg_get_env_15f6eccf5a29bb6c: function() { return handleError(function (arg0, arg1, arg2) {
352
+ __wbg_get_env_95c2579aff2308c6: function() { return handleError(function (arg0, arg1, arg2) {
319
353
  const ret = get_env(getStringFromWasm0(arg1, arg2));
320
354
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
355
  const len1 = WASM_VECTOR_LEN;
322
356
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
323
357
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
324
358
  }, arguments); },
325
- __wbg_has_network_api_7895ce50a07de4f2: function() { return handleError(function () {
359
+ __wbg_has_network_api_93e94d307b86400a: function() { return handleError(function () {
326
360
  const ret = has_network_api();
327
361
  return ret;
328
362
  }, arguments); },
329
- __wbg_import_virtual_file_cache_json_c2014f77d0d9584f: function() { return handleError(function (arg0, arg1) {
363
+ __wbg_import_virtual_file_cache_json_e37d725fcd2ca2ae: function() { return handleError(function (arg0, arg1) {
330
364
  import_virtual_file_cache_json(getStringFromWasm0(arg0, arg1));
331
365
  }, arguments); },
332
366
  __wbg_new_227d7c05414eb861: function() {
@@ -351,11 +385,11 @@ function __wbg_get_imports() {
351
385
  state0.a = state0.b = 0;
352
386
  }
353
387
  },
354
- __wbg_preload_mimium_lib_cache_bf926acad27a759a: function() { return handleError(function (arg0, arg1) {
388
+ __wbg_preload_mimium_lib_cache_69b1e3248fea76ea: function() { return handleError(function (arg0, arg1) {
355
389
  const ret = preload_mimium_lib_cache(getStringFromWasm0(arg0, arg1));
356
390
  return ret;
357
391
  }, arguments); },
358
- __wbg_preload_user_module_cache_072b8d97bfe99430: function() { return handleError(function (arg0, arg1, arg2, arg3) {
392
+ __wbg_preload_user_module_cache_08fde44d9f8b09b5: function() { return handleError(function (arg0, arg1, arg2, arg3) {
359
393
  const ret = preload_user_module_cache(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
360
394
  return ret;
361
395
  }, arguments); },
@@ -366,7 +400,7 @@ function __wbg_get_imports() {
366
400
  __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
367
401
  queueMicrotask(arg0);
368
402
  },
369
- __wbg_read_file_1138d323b4b3bb77: function() { return handleError(function (arg0, arg1, arg2) {
403
+ __wbg_read_file_04f4fad7489c9fc5: function() { return handleError(function (arg0, arg1, arg2) {
370
404
  const ret = read_file(getStringFromWasm0(arg1, arg2));
371
405
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
372
406
  const len1 = WASM_VECTOR_LEN;
@@ -377,7 +411,7 @@ function __wbg_get_imports() {
377
411
  const ret = Promise.resolve(arg0);
378
412
  return ret;
379
413
  },
380
- __wbg_set_module_base_url_e10bc1e23ecd08ce: function() { return handleError(function (arg0, arg1) {
414
+ __wbg_set_module_base_url_e302f48fccf34850: function() { return handleError(function (arg0, arg1) {
381
415
  set_module_base_url(getStringFromWasm0(arg0, arg1));
382
416
  }, arguments); },
383
417
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Tomoya Matsuura <me@matsuuratomoya.com>"
6
6
  ],
7
7
  "description": "mimium wasm binding package.",
8
- "version": "4.0.2",
8
+ "version": "4.1.0",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",