Fossil SCM

fossil-scm / extsrc / pikchr.js
Blame History Raw 758 lines
1
// This code implements the `-sMODULARIZE` settings by taking the generated
2
// JS program code (INNER_JS_CODE) and wrapping it in a factory function.
3
4
// Single threaded MINIMAL_RUNTIME programs do not need access to
5
// document.currentScript, so a simple export declaration is enough.
6
var initPikchrModule = (() => {
7
// When MODULARIZE this JS may be executed later,
8
// after document.currentScript is gone, so we save it.
9
// In EXPORT_ES6 mode we can just use 'import.meta.url'.
10
var _scriptName = globalThis.document?.currentScript?.src;
11
return async function(moduleArg = {}) {
12
var moduleRtn;
13
14
// include: shell.js
15
// include: minimum_runtime_check.js
16
// end include: minimum_runtime_check.js
17
// The Module object: Our interface to the outside world. We import
18
// and export values on it. There are various ways Module can be used:
19
// 1. Not defined. We create it here
20
// 2. A function parameter, function(moduleArg) => Promise<Module>
21
// 3. pre-run appended it, var Module = {}; ..generated code..
22
// 4. External script tag defines var Module.
23
// We need to check if Module already exists (e.g. case 3 above).
24
// Substitution will be replaced with actual code on later stage of the build,
25
// this way Closure Compiler will not mangle it (e.g. case 4. above).
26
// Note that if you want to run closure, and also to use Module
27
// after the generated code, you will need to define var Module = {};
28
// before the code. Then that object will be used in the code, and you
29
// can continue to use Module afterwards as well.
30
var Module = moduleArg;
31
32
// Determine the runtime environment we are in. You can customize this by
33
// setting the ENVIRONMENT setting at compile time (see settings.js).
34
var ENVIRONMENT_IS_WEB = true;
35
36
var ENVIRONMENT_IS_WORKER = false;
37
38
// --pre-jses are emitted after the Module integration code, so that they can
39
// refer to Module (if they choose; they can also define Module)
40
var arguments_ = [];
41
42
var thisProgram = "./this.program";
43
44
var quit_ = (status, toThrow) => {
45
throw toThrow;
46
};
47
48
// `/` should be present at the end if `scriptDirectory` is not empty
49
var scriptDirectory = "";
50
51
function locateFile(path) {
52
if (Module["locateFile"]) {
53
return Module["locateFile"](path, scriptDirectory);
54
}
55
return scriptDirectory + path;
56
}
57
58
// Hooks that are implemented differently in different runtime environments.
59
var readAsync, readBinary;
60
61
// Note that this includes Node.js workers when relevant (pthreads is enabled).
62
// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
63
// ENVIRONMENT_IS_NODE.
64
if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
65
try {
66
scriptDirectory = new URL(".", _scriptName).href;
67
} catch {}
68
{
69
// include: web_or_worker_shell_read.js
70
readAsync = async url => {
71
var response = await fetch(url, {
72
credentials: "same-origin"
73
});
74
if (response.ok) {
75
return response.arrayBuffer();
76
}
77
throw new Error(response.status + " : " + response.url);
78
};
79
}
80
} else {}
81
82
var out = console.log.bind(console);
83
84
var err = console.error.bind(console);
85
86
// end include: shell.js
87
// include: preamble.js
88
// === Preamble library stuff ===
89
// Documentation for the public APIs defined in this file must be updated in:
90
// site/source/docs/api_reference/preamble.js.rst
91
// A prebuilt local version of the documentation is available at:
92
// site/build/text/docs/api_reference/preamble.js.txt
93
// You can also build docs locally as HTML or other formats in site/
94
// An online HTML version (which may be of a different version of Emscripten)
95
// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
96
var wasmBinary;
97
98
// Wasm globals
99
//========================================
100
// Runtime essentials
101
//========================================
102
// whether we are quitting the application. no code should run after this.
103
// set in exit() and abort()
104
var ABORT = false;
105
106
// set by exit() and abort(). Passed to 'onExit' handler.
107
// NOTE: This is also used as the process return code in shell environments
108
// but only when noExitRuntime is false.
109
var EXITSTATUS;
110
111
// include: runtime_common.js
112
// include: runtime_stack_check.js
113
// end include: runtime_stack_check.js
114
// include: runtime_exceptions.js
115
// end include: runtime_exceptions.js
116
// include: runtime_debug.js
117
// end include: runtime_debug.js
118
var readyPromiseResolve, readyPromiseReject;
119
120
// Memory management
121
var /** @type {!Int8Array} */ HEAP8, /** @type {!Uint8Array} */ HEAPU8, /** @type {!Int16Array} */ HEAP16, /** @type {!Uint16Array} */ HEAPU16, /** @type {!Int32Array} */ HEAP32, /** @type {!Uint32Array} */ HEAPU32, /** @type {!Float32Array} */ HEAPF32, /** @type {!Float64Array} */ HEAPF64;
122
123
// BigInt64Array type is not correctly defined in closure
124
var /** not-@type {!BigInt64Array} */ HEAP64, /* BigUint64Array type is not correctly defined in closure
125
/** not-@type {!BigUint64Array} */ HEAPU64;
126
127
var runtimeInitialized = false;
128
129
function updateMemoryViews() {
130
var b = wasmMemory.buffer;
131
HEAP8 = new Int8Array(b);
132
HEAP16 = new Int16Array(b);
133
HEAPU8 = new Uint8Array(b);
134
HEAPU16 = new Uint16Array(b);
135
HEAP32 = new Int32Array(b);
136
HEAPU32 = new Uint32Array(b);
137
HEAPF32 = new Float32Array(b);
138
HEAPF64 = new Float64Array(b);
139
HEAP64 = new BigInt64Array(b);
140
HEAPU64 = new BigUint64Array(b);
141
}
142
143
// include: memoryprofiler.js
144
// end include: memoryprofiler.js
145
// end include: runtime_common.js
146
function preRun() {
147
if (Module["preRun"]) {
148
if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ];
149
while (Module["preRun"].length) {
150
addOnPreRun(Module["preRun"].shift());
151
}
152
}
153
// Begin ATPRERUNS hooks
154
callRuntimeCallbacks(onPreRuns);
155
}
156
157
function initRuntime() {
158
runtimeInitialized = true;
159
// No ATINITS hooks
160
wasmExports["e"]();
161
}
162
163
function postRun() {
164
// PThreads reuse the runtime from the main thread.
165
if (Module["postRun"]) {
166
if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ];
167
while (Module["postRun"].length) {
168
addOnPostRun(Module["postRun"].shift());
169
}
170
}
171
// Begin ATPOSTRUNS hooks
172
callRuntimeCallbacks(onPostRuns);
173
}
174
175
/** @param {string|number=} what */ function abort(what) {
176
Module["onAbort"]?.(what);
177
what = "Aborted(" + what + ")";
178
// TODO(sbc): Should we remove printing and leave it up to whoever
179
// catches the exception?
180
err(what);
181
ABORT = true;
182
what += ". Build with -sASSERTIONS for more info.";
183
// Use a wasm runtime error, because a JS error might be seen as a foreign
184
// exception, which means we'd run destructors on it. We need the error to
185
// simply make the program stop.
186
// FIXME This approach does not work in Wasm EH because it currently does not assume
187
// all RuntimeErrors are from traps; it decides whether a RuntimeError is from
188
// a trap or not based on a hidden field within the object. So at the moment
189
// we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that
190
// allows this in the wasm spec.
191
// Suppress closure compiler warning here. Closure compiler's builtin extern
192
// definition for WebAssembly.RuntimeError claims it takes no arguments even
193
// though it can.
194
// TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
195
/** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what);
196
readyPromiseReject?.(e);
197
// Throw the error whether or not MODULARIZE is set because abort is used
198
// in code paths apart from instantiation where an exception is expected
199
// to be thrown when abort is called.
200
throw e;
201
}
202
203
var wasmBinaryFile;
204
205
function findWasmBinary() {
206
return locateFile("pikchr-v8806526039.wasm");
207
}
208
209
function getBinarySync(file) {
210
if (file == wasmBinaryFile && wasmBinary) {
211
return new Uint8Array(wasmBinary);
212
}
213
if (readBinary) {
214
return readBinary(file);
215
}
216
// Throwing a plain string here, even though it not normally advisable since
217
// this gets turning into an `abort` in instantiateArrayBuffer.
218
throw "both async and sync fetching of the wasm failed";
219
}
220
221
async function getWasmBinary(binaryFile) {
222
// If we don't have the binary yet, load it asynchronously using readAsync.
223
if (!wasmBinary) {
224
// Fetch the binary using readAsync
225
try {
226
var response = await readAsync(binaryFile);
227
return new Uint8Array(response);
228
} catch {}
229
}
230
// Otherwise, getBinarySync should be able to get it synchronously
231
return getBinarySync(binaryFile);
232
}
233
234
async function instantiateArrayBuffer(binaryFile, imports) {
235
try {
236
var binary = await getWasmBinary(binaryFile);
237
var instance = await WebAssembly.instantiate(binary, imports);
238
return instance;
239
} catch (reason) {
240
err(`failed to asynchronously prepare wasm: ${reason}`);
241
abort(reason);
242
}
243
}
244
245
async function instantiateAsync(binary, binaryFile, imports) {
246
if (!binary) {
247
try {
248
var response = fetch(binaryFile, {
249
credentials: "same-origin"
250
});
251
var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
252
return instantiationResult;
253
} catch (reason) {
254
// We expect the most common failure cause to be a bad MIME type for the binary,
255
// in which case falling back to ArrayBuffer instantiation should work.
256
err(`wasm streaming compile failed: ${reason}`);
257
err("falling back to ArrayBuffer instantiation");
258
}
259
}
260
return instantiateArrayBuffer(binaryFile, imports);
261
}
262
263
function getWasmImports() {
264
// prepare imports
265
var imports = {
266
"a": wasmImports
267
};
268
return imports;
269
}
270
271
// Create the wasm instance.
272
// Receives the wasm imports, returns the exports.
273
async function createWasm() {
274
// Load the wasm module and create an instance of using native support in the JS engine.
275
// handle a generated wasm instance, receiving its exports and
276
// performing other necessary setup
277
/** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) {
278
wasmExports = instance.exports;
279
assignWasmExports(wasmExports);
280
updateMemoryViews();
281
return wasmExports;
282
}
283
// Prefer streaming instantiation if available.
284
function receiveInstantiationResult(result) {
285
// 'result' is a ResultObject object which has both the module and instance.
286
// receiveInstance() will swap in the exports (to Module.asm) so they can be called
287
// TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line.
288
// When the regression is fixed, can restore the above PTHREADS-enabled path.
289
return receiveInstance(result["instance"]);
290
}
291
var info = getWasmImports();
292
// User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback
293
// to manually instantiate the Wasm module themselves. This allows pages to
294
// run the instantiation parallel to any other async startup actions they are
295
// performing.
296
// Also pthreads and wasm workers initialize the wasm instance through this
297
// path.
298
if (Module["instantiateWasm"]) {
299
return new Promise((resolve, reject) => {
300
Module["instantiateWasm"](info, (inst, mod) => {
301
resolve(receiveInstance(inst, mod));
302
});
303
});
304
}
305
wasmBinaryFile ??= findWasmBinary();
306
var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
307
var exports = receiveInstantiationResult(result);
308
return exports;
309
}
310
311
// end include: preamble.js
312
// Begin JS library code
313
class ExitStatus {
314
name="ExitStatus";
315
constructor(status) {
316
this.message = `Program terminated with exit(${status})`;
317
this.status = status;
318
}
319
}
320
321
var callRuntimeCallbacks = callbacks => {
322
while (callbacks.length > 0) {
323
// Pass the module as the first argument.
324
callbacks.shift()(Module);
325
}
326
};
327
328
var onPostRuns = [];
329
330
var addOnPostRun = cb => onPostRuns.push(cb);
331
332
var onPreRuns = [];
333
334
var addOnPreRun = cb => onPreRuns.push(cb);
335
336
/**
337
* @param {number} ptr
338
* @param {string} type
339
*/ function getValue(ptr, type = "i8") {
340
if (type.endsWith("*")) type = "*";
341
switch (type) {
342
case "i1":
343
return HEAP8[ptr];
344
345
case "i8":
346
return HEAP8[ptr];
347
348
case "i16":
349
return HEAP16[((ptr) >> 1)];
350
351
case "i32":
352
return HEAP32[((ptr) >> 2)];
353
354
case "i64":
355
return HEAP64[((ptr) >> 3)];
356
357
case "float":
358
return HEAPF32[((ptr) >> 2)];
359
360
case "double":
361
return HEAPF64[((ptr) >> 3)];
362
363
case "*":
364
return HEAPU32[((ptr) >> 2)];
365
366
default:
367
abort(`invalid type for getValue: ${type}`);
368
}
369
}
370
371
var noExitRuntime = true;
372
373
/**
374
* @param {number} ptr
375
* @param {number} value
376
* @param {string} type
377
*/ function setValue(ptr, value, type = "i8") {
378
if (type.endsWith("*")) type = "*";
379
switch (type) {
380
case "i1":
381
HEAP8[ptr] = value;
382
break;
383
384
case "i8":
385
HEAP8[ptr] = value;
386
break;
387
388
case "i16":
389
HEAP16[((ptr) >> 1)] = value;
390
break;
391
392
case "i32":
393
HEAP32[((ptr) >> 2)] = value;
394
break;
395
396
case "i64":
397
HEAP64[((ptr) >> 3)] = BigInt(value);
398
break;
399
400
case "float":
401
HEAPF32[((ptr) >> 2)] = value;
402
break;
403
404
case "double":
405
HEAPF64[((ptr) >> 3)] = value;
406
break;
407
408
case "*":
409
HEAPU32[((ptr) >> 2)] = value;
410
break;
411
412
default:
413
abort(`invalid type for setValue: ${type}`);
414
}
415
}
416
417
var stackRestore = val => __emscripten_stack_restore(val);
418
419
var stackSave = () => _emscripten_stack_get_current();
420
421
var UTF8Decoder = new TextDecoder;
422
423
var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
424
var maxIdx = idx + maxBytesToRead;
425
if (ignoreNul) return maxIdx;
426
// TextDecoder needs to know the byte length in advance, it doesn't stop on
427
// null terminator by itself.
428
// As a tiny code save trick, compare idx against maxIdx using a negation,
429
// so that maxBytesToRead=undefined/NaN means Infinity.
430
while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx;
431
return idx;
432
};
433
434
/**
435
* Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
436
* emscripten HEAP, returns a copy of that string as a Javascript String object.
437
*
438
* @param {number} ptr
439
* @param {number=} maxBytesToRead - An optional length that specifies the
440
* maximum number of bytes to read. You can omit this parameter to scan the
441
* string until the first 0 byte. If maxBytesToRead is passed, and the string
442
* at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
443
* string will cut short at that byte index.
444
* @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character.
445
* @return {string}
446
*/ var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => {
447
if (!ptr) return "";
448
var end = findStringEnd(HEAPU8, ptr, maxBytesToRead, ignoreNul);
449
return UTF8Decoder.decode(HEAPU8.subarray(ptr, end));
450
};
451
452
var ___assert_fail = (condition, filename, line, func) => abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]);
453
454
var abortOnCannotGrowMemory = requestedSize => {
455
abort("OOM");
456
};
457
458
var _emscripten_resize_heap = requestedSize => {
459
var oldSize = HEAPU8.length;
460
// With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
461
requestedSize >>>= 0;
462
abortOnCannotGrowMemory(requestedSize);
463
};
464
465
var runtimeKeepaliveCounter = 0;
466
467
var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
468
469
var _proc_exit = code => {
470
EXITSTATUS = code;
471
if (!keepRuntimeAlive()) {
472
Module["onExit"]?.(code);
473
ABORT = true;
474
}
475
quit_(code, new ExitStatus(code));
476
};
477
478
/** @param {boolean|number=} implicit */ var exitJS = (status, implicit) => {
479
EXITSTATUS = status;
480
_proc_exit(status);
481
};
482
483
var _exit = exitJS;
484
485
var getCFunc = ident => {
486
var func = Module["_" + ident];
487
// closure exported function
488
return func;
489
};
490
491
var writeArrayToMemory = (array, buffer) => {
492
HEAP8.set(array, buffer);
493
};
494
495
var lengthBytesUTF8 = str => {
496
var len = 0;
497
for (var i = 0; i < str.length; ++i) {
498
// Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
499
// unit, not a Unicode code point of the character! So decode
500
// UTF16->UTF32->UTF8.
501
// See http://unicode.org/faq/utf_bom.html#utf16-3
502
var c = str.charCodeAt(i);
503
// possibly a lead surrogate
504
if (c <= 127) {
505
len++;
506
} else if (c <= 2047) {
507
len += 2;
508
} else if (c >= 55296 && c <= 57343) {
509
len += 4;
510
++i;
511
} else {
512
len += 3;
513
}
514
}
515
return len;
516
};
517
518
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
519
// Parameter maxBytesToWrite is not optional. Negative values, 0, null,
520
// undefined and false each don't write out any bytes.
521
if (!(maxBytesToWrite > 0)) return 0;
522
var startIdx = outIdx;
523
var endIdx = outIdx + maxBytesToWrite - 1;
524
// -1 for string null terminator.
525
for (var i = 0; i < str.length; ++i) {
526
// For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
527
// and https://www.ietf.org/rfc/rfc2279.txt
528
// and https://tools.ietf.org/html/rfc3629
529
var u = str.codePointAt(i);
530
if (u <= 127) {
531
if (outIdx >= endIdx) break;
532
heap[outIdx++] = u;
533
} else if (u <= 2047) {
534
if (outIdx + 1 >= endIdx) break;
535
heap[outIdx++] = 192 | (u >> 6);
536
heap[outIdx++] = 128 | (u & 63);
537
} else if (u <= 65535) {
538
if (outIdx + 2 >= endIdx) break;
539
heap[outIdx++] = 224 | (u >> 12);
540
heap[outIdx++] = 128 | ((u >> 6) & 63);
541
heap[outIdx++] = 128 | (u & 63);
542
} else {
543
if (outIdx + 3 >= endIdx) break;
544
heap[outIdx++] = 240 | (u >> 18);
545
heap[outIdx++] = 128 | ((u >> 12) & 63);
546
heap[outIdx++] = 128 | ((u >> 6) & 63);
547
heap[outIdx++] = 128 | (u & 63);
548
// Gotcha: if codePoint is over 0xFFFF, it is represented as a surrogate pair in UTF-16.
549
// We need to manually skip over the second code unit for correct iteration.
550
i++;
551
}
552
}
553
// Null-terminate the pointer to the buffer.
554
heap[outIdx] = 0;
555
return outIdx - startIdx;
556
};
557
558
var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
559
560
var stackAlloc = sz => __emscripten_stack_alloc(sz);
561
562
var stringToUTF8OnStack = str => {
563
var size = lengthBytesUTF8(str) + 1;
564
var ret = stackAlloc(size);
565
stringToUTF8(str, ret, size);
566
return ret;
567
};
568
569
/**
570
* @param {string|null=} returnType
571
* @param {Array=} argTypes
572
* @param {Array=} args
573
* @param {Object=} opts
574
*/ var ccall = (ident, returnType, argTypes, args, opts) => {
575
// For fast lookup of conversion functions
576
var toC = {
577
"string": str => {
578
var ret = 0;
579
if (str !== null && str !== undefined && str !== 0) {
580
// null string
581
ret = stringToUTF8OnStack(str);
582
}
583
return ret;
584
},
585
"array": arr => {
586
var ret = stackAlloc(arr.length);
587
writeArrayToMemory(arr, ret);
588
return ret;
589
}
590
};
591
function convertReturnValue(ret) {
592
if (returnType === "string") {
593
return UTF8ToString(ret);
594
}
595
if (returnType === "boolean") return Boolean(ret);
596
return ret;
597
}
598
var func = getCFunc(ident);
599
var cArgs = [];
600
var stack = 0;
601
if (args) {
602
for (var i = 0; i < args.length; i++) {
603
var converter = toC[argTypes[i]];
604
if (converter) {
605
if (stack === 0) stack = stackSave();
606
cArgs[i] = converter(args[i]);
607
} else {
608
cArgs[i] = args[i];
609
}
610
}
611
}
612
var ret = func(...cArgs);
613
function onDone(ret) {
614
if (stack !== 0) stackRestore(stack);
615
return convertReturnValue(ret);
616
}
617
ret = onDone(ret);
618
return ret;
619
};
620
621
/**
622
* @param {string=} returnType
623
* @param {Array=} argTypes
624
* @param {Object=} opts
625
*/ var cwrap = (ident, returnType, argTypes, opts) => {
626
// When the function takes numbers and returns a number, we can just return
627
// the original function
628
var numericArgs = !argTypes || argTypes.every(type => type === "number" || type === "boolean");
629
var numericRet = returnType !== "string";
630
if (numericRet && numericArgs && !opts) {
631
return getCFunc(ident);
632
}
633
return (...args) => ccall(ident, returnType, argTypes, args, opts);
634
};
635
636
// End JS library code
637
// include: postlibrary.js
638
// This file is included after the automatically-generated JS library code
639
// but before the wasm module is created.
640
{
641
// Begin ATMODULES hooks
642
if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
643
if (Module["print"]) out = Module["print"];
644
if (Module["printErr"]) err = Module["printErr"];
645
if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
646
// End ATMODULES hooks
647
if (Module["arguments"]) arguments_ = Module["arguments"];
648
if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
649
if (Module["preInit"]) {
650
if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ];
651
while (Module["preInit"].length > 0) {
652
Module["preInit"].shift()();
653
}
654
}
655
}
656
657
// Begin runtime exports
658
Module["stackSave"] = stackSave;
659
660
Module["stackRestore"] = stackRestore;
661
662
Module["stackAlloc"] = stackAlloc;
663
664
Module["ccall"] = ccall;
665
666
Module["cwrap"] = cwrap;
667
668
Module["setValue"] = setValue;
669
670
Module["getValue"] = getValue;
671
672
// End runtime exports
673
// Begin JS library exports
674
// End JS library exports
675
// end include: postlibrary.js
676
// Imports from the Wasm binary.
677
var _pikchr_version, _pikchr, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, memory, __indirect_function_table, wasmMemory;
678
679
function assignWasmExports(wasmExports) {
680
_pikchr_version = Module["_pikchr_version"] = wasmExports["f"];
681
_pikchr = Module["_pikchr"] = wasmExports["g"];
682
__emscripten_stack_restore = wasmExports["h"];
683
__emscripten_stack_alloc = wasmExports["i"];
684
_emscripten_stack_get_current = wasmExports["j"];
685
memory = wasmMemory = wasmExports["d"];
686
__indirect_function_table = wasmExports["__indirect_function_table"];
687
}
688
689
var wasmImports = {
690
/** @export */ a: ___assert_fail,
691
/** @export */ b: _emscripten_resize_heap,
692
/** @export */ c: _exit
693
};
694
695
// include: postamble.js
696
// === Auto-generated postamble setup entry stuff ===
697
function run() {
698
preRun();
699
function doRun() {
700
// run may have just been called through dependencies being fulfilled just in this very frame,
701
// or while the async setStatus time below was happening
702
Module["calledRun"] = true;
703
if (ABORT) return;
704
initRuntime();
705
readyPromiseResolve?.(Module);
706
Module["onRuntimeInitialized"]?.();
707
postRun();
708
}
709
if (Module["setStatus"]) {
710
Module["setStatus"]("Running...");
711
setTimeout(() => {
712
setTimeout(() => Module["setStatus"](""), 1);
713
doRun();
714
}, 1);
715
} else {
716
doRun();
717
}
718
}
719
720
var wasmExports;
721
722
// In modularize mode the generated code is within a factory function so we
723
// can use await here (since it's not top-level-await).
724
wasmExports = await (createWasm());
725
726
run();
727
728
// end include: postamble.js
729
// include: postamble_modularize.js
730
// In MODULARIZE mode we wrap the generated code in a factory function
731
// and return either the Module itself, or a promise of the module.
732
// We assign to the `moduleRtn` global here and configure closure to see
733
// this as an extern so it won't get minified.
734
if (runtimeInitialized) {
735
moduleRtn = Module;
736
} else {
737
// Set up the promise that indicates the Module is initialized
738
moduleRtn = new Promise((resolve, reject) => {
739
readyPromiseResolve = resolve;
740
readyPromiseReject = reject;
741
});
742
}
743
744
745
return moduleRtn;
746
};
747
})();
748
749
// Export using a UMD style export, or ES6 exports if selected
750
if (typeof exports === 'object' && typeof module === 'object') {
751
module.exports = initPikchrModule;
752
// This default export looks redundant, but it allows TS to import this
753
// commonjs style module.
754
module.exports.default = initPikchrModule;
755
} else if (typeof define === 'function' && define['amd'])
756
define([], () => initPikchrModule);
757
758

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button