Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Play around with sieves and benchmarking...

Views: 276
Image: ubuntu2004
1
2
3
// Support for growable heap + pthreads, where the buffer may change, so JS views
4
// must be updated.
5
function GROWABLE_HEAP_I8() {
6
if (wasmMemory.buffer != buffer) {
7
updateGlobalBufferAndViews(wasmMemory.buffer);
8
}
9
return HEAP8;
10
}
11
function GROWABLE_HEAP_U8() {
12
if (wasmMemory.buffer != buffer) {
13
updateGlobalBufferAndViews(wasmMemory.buffer);
14
}
15
return HEAPU8;
16
}
17
function GROWABLE_HEAP_I16() {
18
if (wasmMemory.buffer != buffer) {
19
updateGlobalBufferAndViews(wasmMemory.buffer);
20
}
21
return HEAP16;
22
}
23
function GROWABLE_HEAP_U16() {
24
if (wasmMemory.buffer != buffer) {
25
updateGlobalBufferAndViews(wasmMemory.buffer);
26
}
27
return HEAPU16;
28
}
29
function GROWABLE_HEAP_I32() {
30
if (wasmMemory.buffer != buffer) {
31
updateGlobalBufferAndViews(wasmMemory.buffer);
32
}
33
return HEAP32;
34
}
35
function GROWABLE_HEAP_U32() {
36
if (wasmMemory.buffer != buffer) {
37
updateGlobalBufferAndViews(wasmMemory.buffer);
38
}
39
return HEAPU32;
40
}
41
function GROWABLE_HEAP_F32() {
42
if (wasmMemory.buffer != buffer) {
43
updateGlobalBufferAndViews(wasmMemory.buffer);
44
}
45
return HEAPF32;
46
}
47
function GROWABLE_HEAP_F64() {
48
if (wasmMemory.buffer != buffer) {
49
updateGlobalBufferAndViews(wasmMemory.buffer);
50
}
51
return HEAPF64;
52
}
53
54
var Module = typeof Module !== "undefined" ? Module : {};
55
56
var moduleOverrides = {};
57
58
var key;
59
60
for (key in Module) {
61
if (Module.hasOwnProperty(key)) {
62
moduleOverrides[key] = Module[key];
63
}
64
}
65
66
var arguments_ = [];
67
68
var thisProgram = "./this.program";
69
70
var quit_ = function(status, toThrow) {
71
throw toThrow;
72
};
73
74
var ENVIRONMENT_IS_WEB = false;
75
76
var ENVIRONMENT_IS_WORKER = false;
77
78
var ENVIRONMENT_IS_NODE = false;
79
80
var ENVIRONMENT_IS_SHELL = false;
81
82
ENVIRONMENT_IS_WEB = typeof window === "object";
83
84
ENVIRONMENT_IS_WORKER = typeof importScripts === "function";
85
86
ENVIRONMENT_IS_NODE = typeof process === "object" && typeof process.versions === "object" && typeof process.versions.node === "string";
87
88
ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
89
90
if (Module["ENVIRONMENT"]) {
91
throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");
92
}
93
94
var ENVIRONMENT_IS_PTHREAD = Module["ENVIRONMENT_IS_PTHREAD"] || false;
95
96
var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : undefined;
97
98
if (ENVIRONMENT_IS_WORKER) {
99
_scriptDir = self.location.href;
100
} else if (ENVIRONMENT_IS_NODE) {
101
_scriptDir = __filename;
102
}
103
104
var scriptDirectory = "";
105
106
function locateFile(path) {
107
if (Module["locateFile"]) {
108
return Module["locateFile"](path, scriptDirectory);
109
}
110
return scriptDirectory + path;
111
}
112
113
var read_, readAsync, readBinary, setWindowTitle;
114
115
var nodeFS;
116
117
var nodePath;
118
119
if (ENVIRONMENT_IS_NODE) {
120
if (ENVIRONMENT_IS_WORKER) {
121
scriptDirectory = require("path").dirname(scriptDirectory) + "/";
122
} else {
123
scriptDirectory = __dirname + "/";
124
}
125
read_ = function shell_read(filename, binary) {
126
if (!nodeFS) nodeFS = require("fs");
127
if (!nodePath) nodePath = require("path");
128
filename = nodePath["normalize"](filename);
129
return nodeFS["readFileSync"](filename, binary ? null : "utf8");
130
};
131
readBinary = function readBinary(filename) {
132
var ret = read_(filename, true);
133
if (!ret.buffer) {
134
ret = new Uint8Array(ret);
135
}
136
assert(ret.buffer);
137
return ret;
138
};
139
if (process["argv"].length > 1) {
140
thisProgram = process["argv"][1].replace(/\\/g, "/");
141
}
142
arguments_ = process["argv"].slice(2);
143
if (typeof module !== "undefined") {
144
module["exports"] = Module;
145
}
146
process["on"]("uncaughtException", function(ex) {
147
if (!(ex instanceof ExitStatus)) {
148
throw ex;
149
}
150
});
151
process["on"]("unhandledRejection", abort);
152
quit_ = function(status) {
153
process["exit"](status);
154
};
155
Module["inspect"] = function() {
156
return "[Emscripten Module object]";
157
};
158
var nodeWorkerThreads;
159
try {
160
nodeWorkerThreads = require("worker_threads");
161
} catch (e) {
162
console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?');
163
throw e;
164
}
165
global.Worker = nodeWorkerThreads.Worker;
166
} else if (ENVIRONMENT_IS_SHELL) {
167
if (typeof read != "undefined") {
168
read_ = function shell_read(f) {
169
return read(f);
170
};
171
}
172
readBinary = function readBinary(f) {
173
var data;
174
if (typeof readbuffer === "function") {
175
return new Uint8Array(readbuffer(f));
176
}
177
data = read(f, "binary");
178
assert(typeof data === "object");
179
return data;
180
};
181
if (typeof scriptArgs != "undefined") {
182
arguments_ = scriptArgs;
183
} else if (typeof arguments != "undefined") {
184
arguments_ = arguments;
185
}
186
if (typeof quit === "function") {
187
quit_ = function(status) {
188
quit(status);
189
};
190
}
191
if (typeof print !== "undefined") {
192
if (typeof console === "undefined") console = {};
193
console.log = print;
194
console.warn = console.error = typeof printErr !== "undefined" ? printErr : print;
195
}
196
} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
197
if (ENVIRONMENT_IS_WORKER) {
198
scriptDirectory = self.location.href;
199
} else if (typeof document !== "undefined" && document.currentScript) {
200
scriptDirectory = document.currentScript.src;
201
}
202
if (scriptDirectory.indexOf("blob:") !== 0) {
203
scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1);
204
} else {
205
scriptDirectory = "";
206
}
207
if (ENVIRONMENT_IS_NODE) {
208
read_ = function shell_read(filename, binary) {
209
if (!nodeFS) nodeFS = require("fs");
210
if (!nodePath) nodePath = require("path");
211
filename = nodePath["normalize"](filename);
212
return nodeFS["readFileSync"](filename, binary ? null : "utf8");
213
};
214
readBinary = function readBinary(filename) {
215
var ret = read_(filename, true);
216
if (!ret.buffer) {
217
ret = new Uint8Array(ret);
218
}
219
assert(ret.buffer);
220
return ret;
221
};
222
} else {
223
read_ = function(url) {
224
var xhr = new XMLHttpRequest();
225
xhr.open("GET", url, false);
226
xhr.send(null);
227
return xhr.responseText;
228
};
229
if (ENVIRONMENT_IS_WORKER) {
230
readBinary = function(url) {
231
var xhr = new XMLHttpRequest();
232
xhr.open("GET", url, false);
233
xhr.responseType = "arraybuffer";
234
xhr.send(null);
235
return new Uint8Array(xhr.response);
236
};
237
}
238
readAsync = function(url, onload, onerror) {
239
var xhr = new XMLHttpRequest();
240
xhr.open("GET", url, true);
241
xhr.responseType = "arraybuffer";
242
xhr.onload = function() {
243
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
244
onload(xhr.response);
245
return;
246
}
247
onerror();
248
};
249
xhr.onerror = onerror;
250
xhr.send(null);
251
};
252
}
253
setWindowTitle = function(title) {
254
document.title = title;
255
};
256
} else {
257
throw new Error("environment detection error");
258
}
259
260
if (ENVIRONMENT_IS_NODE) {
261
if (typeof performance === "undefined") {
262
global.performance = require("perf_hooks").performance;
263
}
264
}
265
266
var out = Module["print"] || console.log.bind(console);
267
268
var err = Module["printErr"] || console.warn.bind(console);
269
270
for (key in moduleOverrides) {
271
if (moduleOverrides.hasOwnProperty(key)) {
272
Module[key] = moduleOverrides[key];
273
}
274
}
275
276
moduleOverrides = null;
277
278
if (Module["arguments"]) arguments_ = Module["arguments"];
279
280
if (!Object.getOwnPropertyDescriptor(Module, "arguments")) {
281
Object.defineProperty(Module, "arguments", {
282
configurable: true,
283
get: function() {
284
abort("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
285
}
286
});
287
}
288
289
if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
290
291
if (!Object.getOwnPropertyDescriptor(Module, "thisProgram")) {
292
Object.defineProperty(Module, "thisProgram", {
293
configurable: true,
294
get: function() {
295
abort("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
296
}
297
});
298
}
299
300
if (Module["quit"]) quit_ = Module["quit"];
301
302
if (!Object.getOwnPropertyDescriptor(Module, "quit")) {
303
Object.defineProperty(Module, "quit", {
304
configurable: true,
305
get: function() {
306
abort("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
307
}
308
});
309
}
310
311
assert(typeof Module["memoryInitializerPrefixURL"] === "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");
312
313
assert(typeof Module["pthreadMainPrefixURL"] === "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");
314
315
assert(typeof Module["cdInitializerPrefixURL"] === "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead");
316
317
assert(typeof Module["filePackagePrefixURL"] === "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead");
318
319
assert(typeof Module["read"] === "undefined", "Module.read option was removed (modify read_ in JS)");
320
321
assert(typeof Module["readAsync"] === "undefined", "Module.readAsync option was removed (modify readAsync in JS)");
322
323
assert(typeof Module["readBinary"] === "undefined", "Module.readBinary option was removed (modify readBinary in JS)");
324
325
assert(typeof Module["setWindowTitle"] === "undefined", "Module.setWindowTitle option was removed (modify setWindowTitle in JS)");
326
327
assert(typeof Module["TOTAL_MEMORY"] === "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY");
328
329
if (!Object.getOwnPropertyDescriptor(Module, "read")) {
330
Object.defineProperty(Module, "read", {
331
configurable: true,
332
get: function() {
333
abort("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
334
}
335
});
336
}
337
338
if (!Object.getOwnPropertyDescriptor(Module, "readAsync")) {
339
Object.defineProperty(Module, "readAsync", {
340
configurable: true,
341
get: function() {
342
abort("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
343
}
344
});
345
}
346
347
if (!Object.getOwnPropertyDescriptor(Module, "readBinary")) {
348
Object.defineProperty(Module, "readBinary", {
349
configurable: true,
350
get: function() {
351
abort("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
352
}
353
});
354
}
355
356
if (!Object.getOwnPropertyDescriptor(Module, "setWindowTitle")) {
357
Object.defineProperty(Module, "setWindowTitle", {
358
configurable: true,
359
get: function() {
360
abort("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
361
}
362
});
363
}
364
365
var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js";
366
367
var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js";
368
369
var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js";
370
371
var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js";
372
373
assert(ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER || ENVIRONMENT_IS_NODE, "Pthreads do not work in this environment yet (need Web Workers, or an alternative to them)");
374
375
var STACK_ALIGN = 16;
376
377
function alignMemory(size, factor) {
378
if (!factor) factor = STACK_ALIGN;
379
return Math.ceil(size / factor) * factor;
380
}
381
382
function getNativeTypeSize(type) {
383
switch (type) {
384
case "i1":
385
case "i8":
386
return 1;
387
388
case "i16":
389
return 2;
390
391
case "i32":
392
return 4;
393
394
case "i64":
395
return 8;
396
397
case "float":
398
return 4;
399
400
case "double":
401
return 8;
402
403
default:
404
{
405
if (type[type.length - 1] === "*") {
406
return 4;
407
} else if (type[0] === "i") {
408
var bits = Number(type.substr(1));
409
assert(bits % 8 === 0, "getNativeTypeSize invalid bits " + bits + ", type " + type);
410
return bits / 8;
411
} else {
412
return 0;
413
}
414
}
415
}
416
}
417
418
function warnOnce(text) {
419
if (!warnOnce.shown) warnOnce.shown = {};
420
if (!warnOnce.shown[text]) {
421
warnOnce.shown[text] = 1;
422
err(text);
423
}
424
}
425
426
function convertJsFunctionToWasm(func, sig) {
427
if (typeof WebAssembly.Function === "function") {
428
var typeNames = {
429
"i": "i32",
430
"j": "i64",
431
"f": "f32",
432
"d": "f64"
433
};
434
var type = {
435
parameters: [],
436
results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ]
437
};
438
for (var i = 1; i < sig.length; ++i) {
439
type.parameters.push(typeNames[sig[i]]);
440
}
441
return new WebAssembly.Function(type, func);
442
}
443
var typeSection = [ 1, 0, 1, 96 ];
444
var sigRet = sig.slice(0, 1);
445
var sigParam = sig.slice(1);
446
var typeCodes = {
447
"i": 127,
448
"j": 126,
449
"f": 125,
450
"d": 124
451
};
452
typeSection.push(sigParam.length);
453
for (var i = 0; i < sigParam.length; ++i) {
454
typeSection.push(typeCodes[sigParam[i]]);
455
}
456
if (sigRet == "v") {
457
typeSection.push(0);
458
} else {
459
typeSection = typeSection.concat([ 1, typeCodes[sigRet] ]);
460
}
461
typeSection[1] = typeSection.length - 2;
462
var bytes = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0 ].concat(typeSection, [ 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ]));
463
var module = new WebAssembly.Module(bytes);
464
var instance = new WebAssembly.Instance(module, {
465
"e": {
466
"f": func
467
}
468
});
469
var wrappedFunc = instance.exports["f"];
470
return wrappedFunc;
471
}
472
473
var freeTableIndexes = [];
474
475
var functionsInTableMap;
476
477
function getEmptyTableSlot() {
478
if (freeTableIndexes.length) {
479
return freeTableIndexes.pop();
480
}
481
try {
482
wasmTable.grow(1);
483
} catch (err) {
484
if (!(err instanceof RangeError)) {
485
throw err;
486
}
487
throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";
488
}
489
return wasmTable.length - 1;
490
}
491
492
function addFunctionWasm(func, sig) {
493
if (!functionsInTableMap) {
494
functionsInTableMap = new WeakMap();
495
for (var i = 0; i < wasmTable.length; i++) {
496
var item = wasmTable.get(i);
497
if (item) {
498
functionsInTableMap.set(item, i);
499
}
500
}
501
}
502
if (functionsInTableMap.has(func)) {
503
return functionsInTableMap.get(func);
504
}
505
var ret = getEmptyTableSlot();
506
try {
507
wasmTable.set(ret, func);
508
} catch (err) {
509
if (!(err instanceof TypeError)) {
510
throw err;
511
}
512
assert(typeof sig !== "undefined", "Missing signature argument to addFunction: " + func);
513
var wrapped = convertJsFunctionToWasm(func, sig);
514
wasmTable.set(ret, wrapped);
515
}
516
functionsInTableMap.set(func, ret);
517
return ret;
518
}
519
520
function removeFunction(index) {
521
functionsInTableMap.delete(wasmTable.get(index));
522
freeTableIndexes.push(index);
523
}
524
525
function addFunction(func, sig) {
526
assert(typeof func !== "undefined");
527
return addFunctionWasm(func, sig);
528
}
529
530
var tempRet0 = 0;
531
532
var setTempRet0 = function(value) {
533
tempRet0 = value;
534
};
535
536
var getTempRet0 = function() {
537
return tempRet0;
538
};
539
540
var Atomics_load = Atomics.load;
541
542
var Atomics_store = Atomics.store;
543
544
var Atomics_compareExchange = Atomics.compareExchange;
545
546
var wasmBinary;
547
548
if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
549
550
if (!Object.getOwnPropertyDescriptor(Module, "wasmBinary")) {
551
Object.defineProperty(Module, "wasmBinary", {
552
configurable: true,
553
get: function() {
554
abort("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
555
}
556
});
557
}
558
559
var noExitRuntime = Module["noExitRuntime"] || true;
560
561
if (!Object.getOwnPropertyDescriptor(Module, "noExitRuntime")) {
562
Object.defineProperty(Module, "noExitRuntime", {
563
configurable: true,
564
get: function() {
565
abort("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
566
}
567
});
568
}
569
570
if (typeof WebAssembly !== "object") {
571
abort("no native wasm support detected");
572
}
573
574
function setValue(ptr, value, type, noSafe) {
575
type = type || "i8";
576
if (type.charAt(type.length - 1) === "*") type = "i32";
577
switch (type) {
578
case "i1":
579
GROWABLE_HEAP_I8()[ptr >> 0] = value;
580
break;
581
582
case "i8":
583
GROWABLE_HEAP_I8()[ptr >> 0] = value;
584
break;
585
586
case "i16":
587
GROWABLE_HEAP_I16()[ptr >> 1] = value;
588
break;
589
590
case "i32":
591
GROWABLE_HEAP_I32()[ptr >> 2] = value;
592
break;
593
594
case "i64":
595
tempI64 = [ value >>> 0, (tempDouble = value, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ],
596
GROWABLE_HEAP_I32()[ptr >> 2] = tempI64[0], GROWABLE_HEAP_I32()[ptr + 4 >> 2] = tempI64[1];
597
break;
598
599
case "float":
600
GROWABLE_HEAP_F32()[ptr >> 2] = value;
601
break;
602
603
case "double":
604
GROWABLE_HEAP_F64()[ptr >> 3] = value;
605
break;
606
607
default:
608
abort("invalid type for setValue: " + type);
609
}
610
}
611
612
function getValue(ptr, type, noSafe) {
613
type = type || "i8";
614
if (type.charAt(type.length - 1) === "*") type = "i32";
615
switch (type) {
616
case "i1":
617
return GROWABLE_HEAP_I8()[ptr >> 0];
618
619
case "i8":
620
return GROWABLE_HEAP_I8()[ptr >> 0];
621
622
case "i16":
623
return GROWABLE_HEAP_I16()[ptr >> 1];
624
625
case "i32":
626
return GROWABLE_HEAP_I32()[ptr >> 2];
627
628
case "i64":
629
return GROWABLE_HEAP_I32()[ptr >> 2];
630
631
case "float":
632
return GROWABLE_HEAP_F32()[ptr >> 2];
633
634
case "double":
635
return GROWABLE_HEAP_F64()[ptr >> 3];
636
637
default:
638
abort("invalid type for getValue: " + type);
639
}
640
return null;
641
}
642
643
var wasmMemory;
644
645
var wasmModule;
646
647
var ABORT = false;
648
649
var EXITSTATUS;
650
651
function assert(condition, text) {
652
if (!condition) {
653
abort("Assertion failed: " + text);
654
}
655
}
656
657
function getCFunc(ident) {
658
var func = Module["_" + ident];
659
assert(func, "Cannot call unknown function " + ident + ", make sure it is exported");
660
return func;
661
}
662
663
function ccall(ident, returnType, argTypes, args, opts) {
664
var toC = {
665
"string": function(str) {
666
var ret = 0;
667
if (str !== null && str !== undefined && str !== 0) {
668
var len = (str.length << 2) + 1;
669
ret = stackAlloc(len);
670
stringToUTF8(str, ret, len);
671
}
672
return ret;
673
},
674
"array": function(arr) {
675
var ret = stackAlloc(arr.length);
676
writeArrayToMemory(arr, ret);
677
return ret;
678
}
679
};
680
function convertReturnValue(ret) {
681
if (returnType === "string") return UTF8ToString(ret);
682
if (returnType === "boolean") return Boolean(ret);
683
return ret;
684
}
685
var func = getCFunc(ident);
686
var cArgs = [];
687
var stack = 0;
688
assert(returnType !== "array", 'Return type should not be "array".');
689
if (args) {
690
for (var i = 0; i < args.length; i++) {
691
var converter = toC[argTypes[i]];
692
if (converter) {
693
if (stack === 0) stack = stackSave();
694
cArgs[i] = converter(args[i]);
695
} else {
696
cArgs[i] = args[i];
697
}
698
}
699
}
700
var ret = func.apply(null, cArgs);
701
ret = convertReturnValue(ret);
702
if (stack !== 0) stackRestore(stack);
703
return ret;
704
}
705
706
function cwrap(ident, returnType, argTypes, opts) {
707
return function() {
708
return ccall(ident, returnType, argTypes, arguments, opts);
709
};
710
}
711
712
var ALLOC_NORMAL = 0;
713
714
var ALLOC_STACK = 1;
715
716
function allocate(slab, allocator) {
717
var ret;
718
assert(typeof allocator === "number", "allocate no longer takes a type argument");
719
assert(typeof slab !== "number", "allocate no longer takes a number as arg0");
720
if (allocator == ALLOC_STACK) {
721
ret = stackAlloc(slab.length);
722
} else {
723
ret = _malloc(slab.length);
724
}
725
if (slab.subarray || slab.slice) {
726
GROWABLE_HEAP_U8().set(slab, ret);
727
} else {
728
GROWABLE_HEAP_U8().set(new Uint8Array(slab), ret);
729
}
730
return ret;
731
}
732
733
function TextDecoderWrapper(encoding) {
734
var textDecoder = new TextDecoder(encoding);
735
this.decode = function(data) {
736
assert(data instanceof Uint8Array);
737
if (data.buffer instanceof SharedArrayBuffer) {
738
data = new Uint8Array(data);
739
}
740
return textDecoder.decode.call(textDecoder, data);
741
};
742
}
743
744
var UTF8Decoder = typeof TextDecoder !== "undefined" ? new TextDecoderWrapper("utf8") : undefined;
745
746
function UTF8ArrayToString(heap, idx, maxBytesToRead) {
747
var endIdx = idx + maxBytesToRead;
748
var endPtr = idx;
749
while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr;
750
if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) {
751
return UTF8Decoder.decode(heap.subarray(idx, endPtr));
752
} else {
753
var str = "";
754
while (idx < endPtr) {
755
var u0 = heap[idx++];
756
if (!(u0 & 128)) {
757
str += String.fromCharCode(u0);
758
continue;
759
}
760
var u1 = heap[idx++] & 63;
761
if ((u0 & 224) == 192) {
762
str += String.fromCharCode((u0 & 31) << 6 | u1);
763
continue;
764
}
765
var u2 = heap[idx++] & 63;
766
if ((u0 & 240) == 224) {
767
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
768
} else {
769
if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!");
770
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63;
771
}
772
if (u0 < 65536) {
773
str += String.fromCharCode(u0);
774
} else {
775
var ch = u0 - 65536;
776
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
777
}
778
}
779
}
780
return str;
781
}
782
783
function UTF8ToString(ptr, maxBytesToRead) {
784
return ptr ? UTF8ArrayToString(GROWABLE_HEAP_U8(), ptr, maxBytesToRead) : "";
785
}
786
787
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
788
if (!(maxBytesToWrite > 0)) return 0;
789
var startIdx = outIdx;
790
var endIdx = outIdx + maxBytesToWrite - 1;
791
for (var i = 0; i < str.length; ++i) {
792
var u = str.charCodeAt(i);
793
if (u >= 55296 && u <= 57343) {
794
var u1 = str.charCodeAt(++i);
795
u = 65536 + ((u & 1023) << 10) | u1 & 1023;
796
}
797
if (u <= 127) {
798
if (outIdx >= endIdx) break;
799
heap[outIdx++] = u;
800
} else if (u <= 2047) {
801
if (outIdx + 1 >= endIdx) break;
802
heap[outIdx++] = 192 | u >> 6;
803
heap[outIdx++] = 128 | u & 63;
804
} else if (u <= 65535) {
805
if (outIdx + 2 >= endIdx) break;
806
heap[outIdx++] = 224 | u >> 12;
807
heap[outIdx++] = 128 | u >> 6 & 63;
808
heap[outIdx++] = 128 | u & 63;
809
} else {
810
if (outIdx + 3 >= endIdx) break;
811
if (u >= 2097152) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x1FFFFF).");
812
heap[outIdx++] = 240 | u >> 18;
813
heap[outIdx++] = 128 | u >> 12 & 63;
814
heap[outIdx++] = 128 | u >> 6 & 63;
815
heap[outIdx++] = 128 | u & 63;
816
}
817
}
818
heap[outIdx] = 0;
819
return outIdx - startIdx;
820
}
821
822
function stringToUTF8(str, outPtr, maxBytesToWrite) {
823
assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
824
return stringToUTF8Array(str, GROWABLE_HEAP_U8(), outPtr, maxBytesToWrite);
825
}
826
827
function lengthBytesUTF8(str) {
828
var len = 0;
829
for (var i = 0; i < str.length; ++i) {
830
var u = str.charCodeAt(i);
831
if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023;
832
if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4;
833
}
834
return len;
835
}
836
837
function AsciiToString(ptr) {
838
var str = "";
839
while (1) {
840
var ch = GROWABLE_HEAP_U8()[ptr++ >> 0];
841
if (!ch) return str;
842
str += String.fromCharCode(ch);
843
}
844
}
845
846
function stringToAscii(str, outPtr) {
847
return writeAsciiToMemory(str, outPtr, false);
848
}
849
850
var UTF16Decoder = typeof TextDecoder !== "undefined" ? new TextDecoderWrapper("utf-16le") : undefined;
851
852
function UTF16ToString(ptr, maxBytesToRead) {
853
assert(ptr % 2 == 0, "Pointer passed to UTF16ToString must be aligned to two bytes!");
854
var endPtr = ptr;
855
var idx = endPtr >> 1;
856
var maxIdx = idx + maxBytesToRead / 2;
857
while (!(idx >= maxIdx) && GROWABLE_HEAP_U16()[idx]) ++idx;
858
endPtr = idx << 1;
859
if (endPtr - ptr > 32 && UTF16Decoder) {
860
return UTF16Decoder.decode(GROWABLE_HEAP_U8().subarray(ptr, endPtr));
861
} else {
862
var str = "";
863
for (var i = 0; !(i >= maxBytesToRead / 2); ++i) {
864
var codeUnit = GROWABLE_HEAP_I16()[ptr + i * 2 >> 1];
865
if (codeUnit == 0) break;
866
str += String.fromCharCode(codeUnit);
867
}
868
return str;
869
}
870
}
871
872
function stringToUTF16(str, outPtr, maxBytesToWrite) {
873
assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!");
874
assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
875
if (maxBytesToWrite === undefined) {
876
maxBytesToWrite = 2147483647;
877
}
878
if (maxBytesToWrite < 2) return 0;
879
maxBytesToWrite -= 2;
880
var startPtr = outPtr;
881
var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
882
for (var i = 0; i < numCharsToWrite; ++i) {
883
var codeUnit = str.charCodeAt(i);
884
GROWABLE_HEAP_I16()[outPtr >> 1] = codeUnit;
885
outPtr += 2;
886
}
887
GROWABLE_HEAP_I16()[outPtr >> 1] = 0;
888
return outPtr - startPtr;
889
}
890
891
function lengthBytesUTF16(str) {
892
return str.length * 2;
893
}
894
895
function UTF32ToString(ptr, maxBytesToRead) {
896
assert(ptr % 4 == 0, "Pointer passed to UTF32ToString must be aligned to four bytes!");
897
var i = 0;
898
var str = "";
899
while (!(i >= maxBytesToRead / 4)) {
900
var utf32 = GROWABLE_HEAP_I32()[ptr + i * 4 >> 2];
901
if (utf32 == 0) break;
902
++i;
903
if (utf32 >= 65536) {
904
var ch = utf32 - 65536;
905
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
906
} else {
907
str += String.fromCharCode(utf32);
908
}
909
}
910
return str;
911
}
912
913
function stringToUTF32(str, outPtr, maxBytesToWrite) {
914
assert(outPtr % 4 == 0, "Pointer passed to stringToUTF32 must be aligned to four bytes!");
915
assert(typeof maxBytesToWrite == "number", "stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
916
if (maxBytesToWrite === undefined) {
917
maxBytesToWrite = 2147483647;
918
}
919
if (maxBytesToWrite < 4) return 0;
920
var startPtr = outPtr;
921
var endPtr = startPtr + maxBytesToWrite - 4;
922
for (var i = 0; i < str.length; ++i) {
923
var codeUnit = str.charCodeAt(i);
924
if (codeUnit >= 55296 && codeUnit <= 57343) {
925
var trailSurrogate = str.charCodeAt(++i);
926
codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023;
927
}
928
GROWABLE_HEAP_I32()[outPtr >> 2] = codeUnit;
929
outPtr += 4;
930
if (outPtr + 4 > endPtr) break;
931
}
932
GROWABLE_HEAP_I32()[outPtr >> 2] = 0;
933
return outPtr - startPtr;
934
}
935
936
function lengthBytesUTF32(str) {
937
var len = 0;
938
for (var i = 0; i < str.length; ++i) {
939
var codeUnit = str.charCodeAt(i);
940
if (codeUnit >= 55296 && codeUnit <= 57343) ++i;
941
len += 4;
942
}
943
return len;
944
}
945
946
function allocateUTF8(str) {
947
var size = lengthBytesUTF8(str) + 1;
948
var ret = _malloc(size);
949
if (ret) stringToUTF8Array(str, GROWABLE_HEAP_I8(), ret, size);
950
return ret;
951
}
952
953
function allocateUTF8OnStack(str) {
954
var size = lengthBytesUTF8(str) + 1;
955
var ret = stackAlloc(size);
956
stringToUTF8Array(str, GROWABLE_HEAP_I8(), ret, size);
957
return ret;
958
}
959
960
function writeStringToMemory(string, buffer, dontAddNull) {
961
warnOnce("writeStringToMemory is deprecated and should not be called! Use stringToUTF8() instead!");
962
var lastChar, end;
963
if (dontAddNull) {
964
end = buffer + lengthBytesUTF8(string);
965
lastChar = GROWABLE_HEAP_I8()[end];
966
}
967
stringToUTF8(string, buffer, Infinity);
968
if (dontAddNull) GROWABLE_HEAP_I8()[end] = lastChar;
969
}
970
971
function writeArrayToMemory(array, buffer) {
972
assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)");
973
GROWABLE_HEAP_I8().set(array, buffer);
974
}
975
976
function writeAsciiToMemory(str, buffer, dontAddNull) {
977
for (var i = 0; i < str.length; ++i) {
978
assert(str.charCodeAt(i) === str.charCodeAt(i) & 255);
979
GROWABLE_HEAP_I8()[buffer++ >> 0] = str.charCodeAt(i);
980
}
981
if (!dontAddNull) GROWABLE_HEAP_I8()[buffer >> 0] = 0;
982
}
983
984
function alignUp(x, multiple) {
985
if (x % multiple > 0) {
986
x += multiple - x % multiple;
987
}
988
return x;
989
}
990
991
var HEAP, buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
992
993
if (ENVIRONMENT_IS_PTHREAD) {
994
buffer = Module["buffer"];
995
}
996
997
function updateGlobalBufferAndViews(buf) {
998
buffer = buf;
999
Module["HEAP8"] = HEAP8 = new Int8Array(buf);
1000
Module["HEAP16"] = HEAP16 = new Int16Array(buf);
1001
Module["HEAP32"] = HEAP32 = new Int32Array(buf);
1002
Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf);
1003
Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf);
1004
Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf);
1005
Module["HEAPF32"] = HEAPF32 = new Float32Array(buf);
1006
Module["HEAPF64"] = HEAPF64 = new Float64Array(buf);
1007
}
1008
1009
var TOTAL_STACK = 5242880;
1010
1011
if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime");
1012
1013
var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;
1014
1015
if (!Object.getOwnPropertyDescriptor(Module, "INITIAL_MEMORY")) {
1016
Object.defineProperty(Module, "INITIAL_MEMORY", {
1017
configurable: true,
1018
get: function() {
1019
abort("Module.INITIAL_MEMORY has been replaced with plain INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)");
1020
}
1021
});
1022
}
1023
1024
assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")");
1025
1026
assert(typeof Int32Array !== "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray !== undefined && Int32Array.prototype.set !== undefined, "JS engine does not provide full typed array support");
1027
1028
if (ENVIRONMENT_IS_PTHREAD) {
1029
wasmMemory = Module["wasmMemory"];
1030
buffer = Module["buffer"];
1031
} else {
1032
if (Module["wasmMemory"]) {
1033
wasmMemory = Module["wasmMemory"];
1034
} else {
1035
wasmMemory = new WebAssembly.Memory({
1036
"initial": INITIAL_MEMORY / 65536,
1037
"maximum": 2147483648 / 65536,
1038
"shared": true
1039
});
1040
if (!(wasmMemory.buffer instanceof SharedArrayBuffer)) {
1041
err("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag");
1042
if (ENVIRONMENT_IS_NODE) {
1043
console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)");
1044
}
1045
throw Error("bad memory");
1046
}
1047
}
1048
}
1049
1050
if (wasmMemory) {
1051
buffer = wasmMemory.buffer;
1052
}
1053
1054
INITIAL_MEMORY = buffer.byteLength;
1055
1056
assert(INITIAL_MEMORY % 65536 === 0);
1057
1058
updateGlobalBufferAndViews(buffer);
1059
1060
var wasmTable;
1061
1062
function writeStackCookie() {
1063
var max = _emscripten_stack_get_end();
1064
assert((max & 3) == 0);
1065
GROWABLE_HEAP_U32()[(max >> 2) + 1] = 34821223;
1066
GROWABLE_HEAP_U32()[(max >> 2) + 2] = 2310721022;
1067
GROWABLE_HEAP_I32()[0] = 1668509029;
1068
}
1069
1070
function checkStackCookie() {
1071
if (ABORT) return;
1072
var max = _emscripten_stack_get_end();
1073
var cookie1 = GROWABLE_HEAP_U32()[(max >> 2) + 1];
1074
var cookie2 = GROWABLE_HEAP_U32()[(max >> 2) + 2];
1075
if (cookie1 != 34821223 || cookie2 != 2310721022) {
1076
abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " " + cookie1.toString(16));
1077
}
1078
if (GROWABLE_HEAP_I32()[0] !== 1668509029) abort("Runtime error: The application has corrupted its heap memory area (address zero)!");
1079
}
1080
1081
(function() {
1082
var h16 = new Int16Array(1);
1083
var h8 = new Int8Array(h16.buffer);
1084
h16[0] = 25459;
1085
if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)";
1086
})();
1087
1088
var __ATPRERUN__ = [];
1089
1090
var __ATINIT__ = [];
1091
1092
var __ATMAIN__ = [];
1093
1094
var __ATEXIT__ = [];
1095
1096
var __ATPOSTRUN__ = [];
1097
1098
var runtimeInitialized = false;
1099
1100
var runtimeExited = false;
1101
1102
function preRun() {
1103
if (ENVIRONMENT_IS_PTHREAD) return;
1104
if (Module["preRun"]) {
1105
if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ];
1106
while (Module["preRun"].length) {
1107
addOnPreRun(Module["preRun"].shift());
1108
}
1109
}
1110
callRuntimeCallbacks(__ATPRERUN__);
1111
}
1112
1113
function initRuntime() {
1114
checkStackCookie();
1115
assert(!runtimeInitialized);
1116
runtimeInitialized = true;
1117
if (ENVIRONMENT_IS_PTHREAD) return;
1118
callRuntimeCallbacks(__ATINIT__);
1119
}
1120
1121
function preMain() {
1122
checkStackCookie();
1123
if (ENVIRONMENT_IS_PTHREAD) return;
1124
callRuntimeCallbacks(__ATMAIN__);
1125
}
1126
1127
function exitRuntime() {
1128
checkStackCookie();
1129
if (ENVIRONMENT_IS_PTHREAD) return;
1130
runtimeExited = true;
1131
}
1132
1133
function postRun() {
1134
checkStackCookie();
1135
if (ENVIRONMENT_IS_PTHREAD) return;
1136
if (Module["postRun"]) {
1137
if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ];
1138
while (Module["postRun"].length) {
1139
addOnPostRun(Module["postRun"].shift());
1140
}
1141
}
1142
callRuntimeCallbacks(__ATPOSTRUN__);
1143
}
1144
1145
function addOnPreRun(cb) {
1146
__ATPRERUN__.unshift(cb);
1147
}
1148
1149
function addOnInit(cb) {
1150
__ATINIT__.unshift(cb);
1151
}
1152
1153
function addOnPreMain(cb) {
1154
__ATMAIN__.unshift(cb);
1155
}
1156
1157
function addOnExit(cb) {}
1158
1159
function addOnPostRun(cb) {
1160
__ATPOSTRUN__.unshift(cb);
1161
}
1162
1163
assert(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
1164
1165
assert(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
1166
1167
assert(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
1168
1169
assert(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");
1170
1171
var runDependencies = 0;
1172
1173
var runDependencyWatcher = null;
1174
1175
var dependenciesFulfilled = null;
1176
1177
var runDependencyTracking = {};
1178
1179
function getUniqueRunDependency(id) {
1180
var orig = id;
1181
while (1) {
1182
if (!runDependencyTracking[id]) return id;
1183
id = orig + Math.random();
1184
}
1185
}
1186
1187
function addRunDependency(id) {
1188
assert(!ENVIRONMENT_IS_PTHREAD, "addRunDependency cannot be used in a pthread worker");
1189
runDependencies++;
1190
if (Module["monitorRunDependencies"]) {
1191
Module["monitorRunDependencies"](runDependencies);
1192
}
1193
if (id) {
1194
assert(!runDependencyTracking[id]);
1195
runDependencyTracking[id] = 1;
1196
if (runDependencyWatcher === null && typeof setInterval !== "undefined") {
1197
runDependencyWatcher = setInterval(function() {
1198
if (ABORT) {
1199
clearInterval(runDependencyWatcher);
1200
runDependencyWatcher = null;
1201
return;
1202
}
1203
var shown = false;
1204
for (var dep in runDependencyTracking) {
1205
if (!shown) {
1206
shown = true;
1207
err("still waiting on run dependencies:");
1208
}
1209
err("dependency: " + dep);
1210
}
1211
if (shown) {
1212
err("(end of list)");
1213
}
1214
}, 1e4);
1215
}
1216
} else {
1217
err("warning: run dependency added without ID");
1218
}
1219
}
1220
1221
function removeRunDependency(id) {
1222
runDependencies--;
1223
if (Module["monitorRunDependencies"]) {
1224
Module["monitorRunDependencies"](runDependencies);
1225
}
1226
if (id) {
1227
assert(runDependencyTracking[id]);
1228
delete runDependencyTracking[id];
1229
} else {
1230
err("warning: run dependency removed without ID");
1231
}
1232
if (runDependencies == 0) {
1233
if (runDependencyWatcher !== null) {
1234
clearInterval(runDependencyWatcher);
1235
runDependencyWatcher = null;
1236
}
1237
if (dependenciesFulfilled) {
1238
var callback = dependenciesFulfilled;
1239
dependenciesFulfilled = null;
1240
callback();
1241
}
1242
}
1243
}
1244
1245
Module["preloadedImages"] = {};
1246
1247
Module["preloadedAudios"] = {};
1248
1249
function abort(what) {
1250
if (Module["onAbort"]) {
1251
Module["onAbort"](what);
1252
}
1253
if (ENVIRONMENT_IS_PTHREAD) console.error("Pthread aborting at " + new Error().stack);
1254
what += "";
1255
err(what);
1256
ABORT = true;
1257
EXITSTATUS = 1;
1258
var output = "abort(" + what + ") at " + stackTrace();
1259
what = output;
1260
var e = new WebAssembly.RuntimeError(what);
1261
throw e;
1262
}
1263
1264
var FS = {
1265
error: function() {
1266
abort("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -s FORCE_FILESYSTEM=1");
1267
},
1268
init: function() {
1269
FS.error();
1270
},
1271
createDataFile: function() {
1272
FS.error();
1273
},
1274
createPreloadedFile: function() {
1275
FS.error();
1276
},
1277
createLazyFile: function() {
1278
FS.error();
1279
},
1280
open: function() {
1281
FS.error();
1282
},
1283
mkdev: function() {
1284
FS.error();
1285
},
1286
registerDevice: function() {
1287
FS.error();
1288
},
1289
analyzePath: function() {
1290
FS.error();
1291
},
1292
loadFilesFromDB: function() {
1293
FS.error();
1294
},
1295
ErrnoError: function ErrnoError() {
1296
FS.error();
1297
}
1298
};
1299
1300
Module["FS_createDataFile"] = FS.createDataFile;
1301
1302
Module["FS_createPreloadedFile"] = FS.createPreloadedFile;
1303
1304
var dataURIPrefix = "data:application/octet-stream;base64,";
1305
1306
function isDataURI(filename) {
1307
return filename.startsWith(dataURIPrefix);
1308
}
1309
1310
function isFileURI(filename) {
1311
return filename.startsWith("file://");
1312
}
1313
1314
function createExportWrapper(name, fixedasm) {
1315
return function() {
1316
var displayName = name;
1317
var asm = fixedasm;
1318
if (!fixedasm) {
1319
asm = Module["asm"];
1320
}
1321
assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization");
1322
assert(!runtimeExited, "native function `" + displayName + "` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
1323
if (!asm[name]) {
1324
assert(asm[name], "exported native function `" + displayName + "` not found");
1325
}
1326
return asm[name].apply(null, arguments);
1327
};
1328
}
1329
1330
var wasmBinaryFile;
1331
1332
wasmBinaryFile = "sieve.wasm";
1333
1334
if (!isDataURI(wasmBinaryFile)) {
1335
wasmBinaryFile = locateFile(wasmBinaryFile);
1336
}
1337
1338
function getBinary(file) {
1339
try {
1340
if (file == wasmBinaryFile && wasmBinary) {
1341
return new Uint8Array(wasmBinary);
1342
}
1343
if (readBinary) {
1344
return readBinary(file);
1345
} else {
1346
throw "both async and sync fetching of the wasm failed";
1347
}
1348
} catch (err) {
1349
abort(err);
1350
}
1351
}
1352
1353
function getBinaryPromise() {
1354
if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
1355
if (typeof fetch === "function" && !isFileURI(wasmBinaryFile)) {
1356
return fetch(wasmBinaryFile, {
1357
credentials: "same-origin"
1358
}).then(function(response) {
1359
if (!response["ok"]) {
1360
throw "failed to load wasm binary file at '" + wasmBinaryFile + "'";
1361
}
1362
return response["arrayBuffer"]();
1363
}).catch(function() {
1364
return getBinary(wasmBinaryFile);
1365
});
1366
} else {
1367
if (readAsync) {
1368
return new Promise(function(resolve, reject) {
1369
readAsync(wasmBinaryFile, function(response) {
1370
resolve(new Uint8Array(response));
1371
}, reject);
1372
});
1373
}
1374
}
1375
}
1376
return Promise.resolve().then(function() {
1377
return getBinary(wasmBinaryFile);
1378
});
1379
}
1380
1381
function createWasm() {
1382
var info = {
1383
"env": asmLibraryArg,
1384
"wasi_snapshot_preview1": asmLibraryArg
1385
};
1386
function receiveInstance(instance, module) {
1387
var exports = instance.exports;
1388
Module["asm"] = exports;
1389
wasmTable = Module["asm"]["__indirect_function_table"];
1390
assert(wasmTable, "table not found in wasm exports");
1391
addOnInit(Module["asm"]["__wasm_call_ctors"]);
1392
PThread.tlsInitFunctions.push(Module["asm"]["emscripten_tls_init"]);
1393
wasmModule = module;
1394
if (!ENVIRONMENT_IS_PTHREAD) {
1395
removeRunDependency("wasm-instantiate");
1396
}
1397
}
1398
if (!ENVIRONMENT_IS_PTHREAD) {
1399
addRunDependency("wasm-instantiate");
1400
}
1401
var trueModule = Module;
1402
function receiveInstantiationResult(result) {
1403
assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?");
1404
trueModule = null;
1405
receiveInstance(result["instance"], result["module"]);
1406
}
1407
function instantiateArrayBuffer(receiver) {
1408
return getBinaryPromise().then(function(binary) {
1409
var result = WebAssembly.instantiate(binary, info);
1410
return result;
1411
}).then(receiver, function(reason) {
1412
err("failed to asynchronously prepare wasm: " + reason);
1413
if (isFileURI(wasmBinaryFile)) {
1414
err("warning: Loading from a file URI (" + wasmBinaryFile + ") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing");
1415
}
1416
abort(reason);
1417
});
1418
}
1419
function instantiateAsync() {
1420
if (!wasmBinary && typeof WebAssembly.instantiateStreaming === "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch === "function") {
1421
return fetch(wasmBinaryFile, {
1422
credentials: "same-origin"
1423
}).then(function(response) {
1424
var result = WebAssembly.instantiateStreaming(response, info);
1425
return result.then(receiveInstantiationResult, function(reason) {
1426
err("wasm streaming compile failed: " + reason);
1427
err("falling back to ArrayBuffer instantiation");
1428
return instantiateArrayBuffer(receiveInstantiationResult);
1429
});
1430
});
1431
} else {
1432
return instantiateArrayBuffer(receiveInstantiationResult);
1433
}
1434
}
1435
if (Module["instantiateWasm"]) {
1436
try {
1437
var exports = Module["instantiateWasm"](info, receiveInstance);
1438
return exports;
1439
} catch (e) {
1440
err("Module.instantiateWasm callback failed with error: " + e);
1441
return false;
1442
}
1443
}
1444
instantiateAsync();
1445
return {};
1446
}
1447
1448
var tempDouble;
1449
1450
var tempI64;
1451
1452
var ASM_CONSTS = {
1453
2172: function() {
1454
throw "Canceled!";
1455
},
1456
2190: function($0, $1) {
1457
setTimeout(function() {
1458
__emscripten_do_dispatch_to_thread($0, $1);
1459
}, 0);
1460
}
1461
};
1462
1463
function initPthreadsJS() {
1464
PThread.initRuntime();
1465
}
1466
1467
function callRuntimeCallbacks(callbacks) {
1468
while (callbacks.length > 0) {
1469
var callback = callbacks.shift();
1470
if (typeof callback == "function") {
1471
callback(Module);
1472
continue;
1473
}
1474
var func = callback.func;
1475
if (typeof func === "number") {
1476
if (callback.arg === undefined) {
1477
wasmTable.get(func)();
1478
} else {
1479
wasmTable.get(func)(callback.arg);
1480
}
1481
} else {
1482
func(callback.arg === undefined ? null : callback.arg);
1483
}
1484
}
1485
}
1486
1487
function demangle(func) {
1488
warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");
1489
return func;
1490
}
1491
1492
function demangleAll(text) {
1493
var regex = /\b_Z[\w\d_]+/g;
1494
return text.replace(regex, function(x) {
1495
var y = demangle(x);
1496
return x === y ? x : y + " [" + x + "]";
1497
});
1498
}
1499
1500
var ERRNO_CODES = {
1501
EPERM: 63,
1502
ENOENT: 44,
1503
ESRCH: 71,
1504
EINTR: 27,
1505
EIO: 29,
1506
ENXIO: 60,
1507
E2BIG: 1,
1508
ENOEXEC: 45,
1509
EBADF: 8,
1510
ECHILD: 12,
1511
EAGAIN: 6,
1512
EWOULDBLOCK: 6,
1513
ENOMEM: 48,
1514
EACCES: 2,
1515
EFAULT: 21,
1516
ENOTBLK: 105,
1517
EBUSY: 10,
1518
EEXIST: 20,
1519
EXDEV: 75,
1520
ENODEV: 43,
1521
ENOTDIR: 54,
1522
EISDIR: 31,
1523
EINVAL: 28,
1524
ENFILE: 41,
1525
EMFILE: 33,
1526
ENOTTY: 59,
1527
ETXTBSY: 74,
1528
EFBIG: 22,
1529
ENOSPC: 51,
1530
ESPIPE: 70,
1531
EROFS: 69,
1532
EMLINK: 34,
1533
EPIPE: 64,
1534
EDOM: 18,
1535
ERANGE: 68,
1536
ENOMSG: 49,
1537
EIDRM: 24,
1538
ECHRNG: 106,
1539
EL2NSYNC: 156,
1540
EL3HLT: 107,
1541
EL3RST: 108,
1542
ELNRNG: 109,
1543
EUNATCH: 110,
1544
ENOCSI: 111,
1545
EL2HLT: 112,
1546
EDEADLK: 16,
1547
ENOLCK: 46,
1548
EBADE: 113,
1549
EBADR: 114,
1550
EXFULL: 115,
1551
ENOANO: 104,
1552
EBADRQC: 103,
1553
EBADSLT: 102,
1554
EDEADLOCK: 16,
1555
EBFONT: 101,
1556
ENOSTR: 100,
1557
ENODATA: 116,
1558
ETIME: 117,
1559
ENOSR: 118,
1560
ENONET: 119,
1561
ENOPKG: 120,
1562
EREMOTE: 121,
1563
ENOLINK: 47,
1564
EADV: 122,
1565
ESRMNT: 123,
1566
ECOMM: 124,
1567
EPROTO: 65,
1568
EMULTIHOP: 36,
1569
EDOTDOT: 125,
1570
EBADMSG: 9,
1571
ENOTUNIQ: 126,
1572
EBADFD: 127,
1573
EREMCHG: 128,
1574
ELIBACC: 129,
1575
ELIBBAD: 130,
1576
ELIBSCN: 131,
1577
ELIBMAX: 132,
1578
ELIBEXEC: 133,
1579
ENOSYS: 52,
1580
ENOTEMPTY: 55,
1581
ENAMETOOLONG: 37,
1582
ELOOP: 32,
1583
EOPNOTSUPP: 138,
1584
EPFNOSUPPORT: 139,
1585
ECONNRESET: 15,
1586
ENOBUFS: 42,
1587
EAFNOSUPPORT: 5,
1588
EPROTOTYPE: 67,
1589
ENOTSOCK: 57,
1590
ENOPROTOOPT: 50,
1591
ESHUTDOWN: 140,
1592
ECONNREFUSED: 14,
1593
EADDRINUSE: 3,
1594
ECONNABORTED: 13,
1595
ENETUNREACH: 40,
1596
ENETDOWN: 38,
1597
ETIMEDOUT: 73,
1598
EHOSTDOWN: 142,
1599
EHOSTUNREACH: 23,
1600
EINPROGRESS: 26,
1601
EALREADY: 7,
1602
EDESTADDRREQ: 17,
1603
EMSGSIZE: 35,
1604
EPROTONOSUPPORT: 66,
1605
ESOCKTNOSUPPORT: 137,
1606
EADDRNOTAVAIL: 4,
1607
ENETRESET: 39,
1608
EISCONN: 30,
1609
ENOTCONN: 53,
1610
ETOOMANYREFS: 141,
1611
EUSERS: 136,
1612
EDQUOT: 19,
1613
ESTALE: 72,
1614
ENOTSUP: 138,
1615
ENOMEDIUM: 148,
1616
EILSEQ: 25,
1617
EOVERFLOW: 61,
1618
ECANCELED: 11,
1619
ENOTRECOVERABLE: 56,
1620
EOWNERDEAD: 62,
1621
ESTRPIPE: 135
1622
};
1623
1624
function _emscripten_futex_wake(addr, count) {
1625
if (addr <= 0 || addr > GROWABLE_HEAP_I8().length || addr & 3 != 0 || count < 0) return -28;
1626
if (count == 0) return 0;
1627
if (count >= 2147483647) count = Infinity;
1628
assert(__emscripten_main_thread_futex > 0);
1629
var mainThreadWaitAddress = Atomics.load(GROWABLE_HEAP_I32(), __emscripten_main_thread_futex >> 2);
1630
var mainThreadWoken = 0;
1631
if (mainThreadWaitAddress == addr) {
1632
assert(!ENVIRONMENT_IS_WEB);
1633
var loadedAddr = Atomics.compareExchange(GROWABLE_HEAP_I32(), __emscripten_main_thread_futex >> 2, mainThreadWaitAddress, 0);
1634
if (loadedAddr == mainThreadWaitAddress) {
1635
--count;
1636
mainThreadWoken = 1;
1637
if (count <= 0) return 1;
1638
}
1639
}
1640
var ret = Atomics.notify(GROWABLE_HEAP_I32(), addr >> 2, count);
1641
if (ret >= 0) return ret + mainThreadWoken;
1642
throw "Atomics.notify returned an unexpected value " + ret;
1643
}
1644
1645
Module["_emscripten_futex_wake"] = _emscripten_futex_wake;
1646
1647
function killThread(pthread_ptr) {
1648
if (ENVIRONMENT_IS_PTHREAD) throw "Internal Error! killThread() can only ever be called from main application thread!";
1649
if (!pthread_ptr) throw "Internal Error! Null pthread_ptr in killThread!";
1650
GROWABLE_HEAP_I32()[pthread_ptr + 12 >> 2] = 0;
1651
var pthread = PThread.pthreads[pthread_ptr];
1652
pthread.worker.terminate();
1653
PThread.freeThreadData(pthread);
1654
PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(pthread.worker), 1);
1655
pthread.worker.pthread = undefined;
1656
}
1657
1658
function cancelThread(pthread_ptr) {
1659
if (ENVIRONMENT_IS_PTHREAD) throw "Internal Error! cancelThread() can only ever be called from main application thread!";
1660
if (!pthread_ptr) throw "Internal Error! Null pthread_ptr in cancelThread!";
1661
var pthread = PThread.pthreads[pthread_ptr];
1662
pthread.worker.postMessage({
1663
"cmd": "cancel"
1664
});
1665
}
1666
1667
function cleanupThread(pthread_ptr) {
1668
if (ENVIRONMENT_IS_PTHREAD) throw "Internal Error! cleanupThread() can only ever be called from main application thread!";
1669
if (!pthread_ptr) throw "Internal Error! Null pthread_ptr in cleanupThread!";
1670
var pthread = PThread.pthreads[pthread_ptr];
1671
if (pthread) {
1672
GROWABLE_HEAP_I32()[pthread_ptr + 12 >> 2] = 0;
1673
var worker = pthread.worker;
1674
PThread.returnWorkerToPool(worker);
1675
}
1676
}
1677
1678
var PThread = {
1679
unusedWorkers: [],
1680
runningWorkers: [],
1681
tlsInitFunctions: [],
1682
initMainThreadBlock: function() {
1683
assert(!ENVIRONMENT_IS_PTHREAD);
1684
},
1685
initRuntime: function() {
1686
var tb = _malloc(228);
1687
for (var i = 0; i < 228 / 4; ++i) GROWABLE_HEAP_U32()[tb / 4 + i] = 0;
1688
GROWABLE_HEAP_I32()[tb + 12 >> 2] = tb;
1689
var headPtr = tb + 152;
1690
GROWABLE_HEAP_I32()[headPtr >> 2] = headPtr;
1691
var tlsMemory = _malloc(512);
1692
for (var i = 0; i < 128; ++i) GROWABLE_HEAP_U32()[tlsMemory / 4 + i] = 0;
1693
Atomics.store(GROWABLE_HEAP_U32(), tb + 100 >> 2, tlsMemory);
1694
Atomics.store(GROWABLE_HEAP_U32(), tb + 40 >> 2, tb);
1695
__emscripten_thread_init(tb, !ENVIRONMENT_IS_WORKER, 1);
1696
_emscripten_register_main_browser_thread_id(tb);
1697
PThread.mainRuntimeThread = true;
1698
},
1699
initWorker: function() {},
1700
pthreads: {},
1701
threadExitHandlers: [],
1702
runExitHandlers: function() {
1703
while (PThread.threadExitHandlers.length > 0) {
1704
PThread.threadExitHandlers.pop()();
1705
}
1706
if (ENVIRONMENT_IS_PTHREAD && _pthread_self()) ___pthread_tsd_run_dtors();
1707
},
1708
runExitHandlersAndDeinitThread: function(tb, exitCode) {
1709
Atomics.store(GROWABLE_HEAP_U32(), tb + 56 >> 2, 1);
1710
Atomics.store(GROWABLE_HEAP_U32(), tb + 60 >> 2, 0);
1711
PThread.runExitHandlers();
1712
Atomics.store(GROWABLE_HEAP_U32(), tb + 4 >> 2, exitCode);
1713
Atomics.store(GROWABLE_HEAP_U32(), tb + 0 >> 2, 1);
1714
_emscripten_futex_wake(tb + 0, 2147483647);
1715
__emscripten_thread_init(0, 0, 0);
1716
},
1717
setExitStatus: function(status) {
1718
EXITSTATUS = status;
1719
},
1720
threadExit: function(exitCode) {
1721
var tb = _pthread_self();
1722
if (tb) {
1723
err("Pthread 0x" + tb.toString(16) + " exited.");
1724
PThread.runExitHandlersAndDeinitThread(tb, exitCode);
1725
if (ENVIRONMENT_IS_PTHREAD) {
1726
postMessage({
1727
"cmd": "exit"
1728
});
1729
}
1730
}
1731
},
1732
threadCancel: function() {
1733
PThread.runExitHandlersAndDeinitThread(_pthread_self(), -1);
1734
postMessage({
1735
"cmd": "cancelDone"
1736
});
1737
},
1738
terminateAllThreads: function() {
1739
for (var t in PThread.pthreads) {
1740
var pthread = PThread.pthreads[t];
1741
if (pthread && pthread.worker) {
1742
PThread.returnWorkerToPool(pthread.worker);
1743
}
1744
}
1745
PThread.pthreads = {};
1746
for (var i = 0; i < PThread.unusedWorkers.length; ++i) {
1747
var worker = PThread.unusedWorkers[i];
1748
assert(!worker.pthread);
1749
worker.terminate();
1750
}
1751
PThread.unusedWorkers = [];
1752
for (var i = 0; i < PThread.runningWorkers.length; ++i) {
1753
var worker = PThread.runningWorkers[i];
1754
var pthread = worker.pthread;
1755
assert(pthread, "This Worker should have a pthread it is executing");
1756
PThread.freeThreadData(pthread);
1757
worker.terminate();
1758
}
1759
PThread.runningWorkers = [];
1760
},
1761
freeThreadData: function(pthread) {
1762
if (!pthread) return;
1763
if (pthread.threadInfoStruct) {
1764
var tlsMemory = GROWABLE_HEAP_I32()[pthread.threadInfoStruct + 100 >> 2];
1765
GROWABLE_HEAP_I32()[pthread.threadInfoStruct + 100 >> 2] = 0;
1766
_free(tlsMemory);
1767
_free(pthread.threadInfoStruct);
1768
}
1769
pthread.threadInfoStruct = 0;
1770
if (pthread.allocatedOwnStack && pthread.stackBase) _free(pthread.stackBase);
1771
pthread.stackBase = 0;
1772
if (pthread.worker) pthread.worker.pthread = null;
1773
},
1774
returnWorkerToPool: function(worker) {
1775
PThread.runWithoutMainThreadQueuedCalls(function() {
1776
delete PThread.pthreads[worker.pthread.threadInfoStruct];
1777
PThread.unusedWorkers.push(worker);
1778
PThread.runningWorkers.splice(PThread.runningWorkers.indexOf(worker), 1);
1779
PThread.freeThreadData(worker.pthread);
1780
worker.pthread = undefined;
1781
});
1782
},
1783
runWithoutMainThreadQueuedCalls: function(func) {
1784
assert(PThread.mainRuntimeThread, "runWithoutMainThreadQueuedCalls must be done on the main runtime thread");
1785
assert(__emscripten_allow_main_runtime_queued_calls);
1786
GROWABLE_HEAP_I32()[__emscripten_allow_main_runtime_queued_calls >> 2] = 0;
1787
try {
1788
func();
1789
} finally {
1790
GROWABLE_HEAP_I32()[__emscripten_allow_main_runtime_queued_calls >> 2] = 1;
1791
}
1792
},
1793
receiveObjectTransfer: function(data) {},
1794
threadInit: function() {
1795
for (var i in PThread.tlsInitFunctions) {
1796
PThread.tlsInitFunctions[i]();
1797
}
1798
},
1799
loadWasmModuleToWorker: function(worker, onFinishedLoading) {
1800
worker.onmessage = function(e) {
1801
var d = e["data"];
1802
var cmd = d["cmd"];
1803
if (worker.pthread) PThread.currentProxiedOperationCallerThread = worker.pthread.threadInfoStruct;
1804
if (d["targetThread"] && d["targetThread"] != _pthread_self()) {
1805
var thread = PThread.pthreads[d.targetThread];
1806
if (thread) {
1807
thread.worker.postMessage(e.data, d["transferList"]);
1808
} else {
1809
console.error('Internal error! Worker sent a message "' + cmd + '" to target pthread ' + d["targetThread"] + ", but that thread no longer exists!");
1810
}
1811
PThread.currentProxiedOperationCallerThread = undefined;
1812
return;
1813
}
1814
if (cmd === "processQueuedMainThreadWork") {
1815
_emscripten_main_thread_process_queued_calls();
1816
} else if (cmd === "spawnThread") {
1817
spawnThread(e.data);
1818
} else if (cmd === "cleanupThread") {
1819
cleanupThread(d["thread"]);
1820
} else if (cmd === "killThread") {
1821
killThread(d["thread"]);
1822
} else if (cmd === "cancelThread") {
1823
cancelThread(d["thread"]);
1824
} else if (cmd === "loaded") {
1825
worker.loaded = true;
1826
if (onFinishedLoading) onFinishedLoading(worker);
1827
if (worker.runPthread) {
1828
worker.runPthread();
1829
delete worker.runPthread;
1830
}
1831
} else if (cmd === "print") {
1832
out("Thread " + d["threadId"] + ": " + d["text"]);
1833
} else if (cmd === "printErr") {
1834
err("Thread " + d["threadId"] + ": " + d["text"]);
1835
} else if (cmd === "alert") {
1836
alert("Thread " + d["threadId"] + ": " + d["text"]);
1837
} else if (cmd === "exit") {
1838
var detached = worker.pthread && Atomics.load(GROWABLE_HEAP_U32(), worker.pthread.threadInfoStruct + 64 >> 2);
1839
if (detached) {
1840
PThread.returnWorkerToPool(worker);
1841
}
1842
} else if (cmd === "exitProcess") {
1843
err("exitProcess requested by worker");
1844
try {
1845
exit(d["returnCode"]);
1846
} catch (e) {
1847
if (e instanceof ExitStatus) return;
1848
throw e;
1849
}
1850
} else if (cmd === "cancelDone") {
1851
PThread.returnWorkerToPool(worker);
1852
} else if (cmd === "objectTransfer") {
1853
PThread.receiveObjectTransfer(e.data);
1854
} else if (e.data.target === "setimmediate") {
1855
worker.postMessage(e.data);
1856
} else {
1857
err("worker sent an unknown command " + cmd);
1858
}
1859
PThread.currentProxiedOperationCallerThread = undefined;
1860
};
1861
worker.onerror = function(e) {
1862
err("pthread sent an error! " + e.filename + ":" + e.lineno + ": " + e.message);
1863
};
1864
if (ENVIRONMENT_IS_NODE) {
1865
worker.on("message", function(data) {
1866
worker.onmessage({
1867
data: data
1868
});
1869
});
1870
worker.on("error", function(data) {
1871
worker.onerror(data);
1872
});
1873
worker.on("exit", function(data) {});
1874
}
1875
assert(wasmMemory instanceof WebAssembly.Memory, "WebAssembly memory should have been loaded by now!");
1876
assert(wasmModule instanceof WebAssembly.Module, "WebAssembly Module should have been loaded by now!");
1877
worker.postMessage({
1878
"cmd": "load",
1879
"urlOrBlob": Module["mainScriptUrlOrBlob"] || _scriptDir,
1880
"wasmMemory": wasmMemory,
1881
"wasmModule": wasmModule
1882
});
1883
},
1884
allocateUnusedWorker: function() {
1885
var pthreadMainJs = locateFile("sieve.worker.js");
1886
PThread.unusedWorkers.push(new Worker(pthreadMainJs));
1887
},
1888
getNewWorker: function() {
1889
if (PThread.unusedWorkers.length == 0) {
1890
PThread.allocateUnusedWorker();
1891
PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0]);
1892
}
1893
return PThread.unusedWorkers.pop();
1894
},
1895
busySpinWait: function(msecs) {
1896
var t = performance.now() + msecs;
1897
while (performance.now() < t) {
1898
}
1899
}
1900
};
1901
1902
function establishStackSpace(stackTop, stackMax) {
1903
_emscripten_stack_set_limits(stackTop, stackMax);
1904
stackRestore(stackTop);
1905
writeStackCookie();
1906
}
1907
1908
Module["establishStackSpace"] = establishStackSpace;
1909
1910
function invokeEntryPoint(ptr, arg) {
1911
return wasmTable.get(ptr)(arg);
1912
}
1913
1914
Module["invokeEntryPoint"] = invokeEntryPoint;
1915
1916
function jsStackTrace() {
1917
var error = new Error();
1918
if (!error.stack) {
1919
try {
1920
throw new Error();
1921
} catch (e) {
1922
error = e;
1923
}
1924
if (!error.stack) {
1925
return "(no stack trace available)";
1926
}
1927
}
1928
return error.stack.toString();
1929
}
1930
1931
var runtimeKeepaliveCounter = 0;
1932
1933
function keepRuntimeAlive() {
1934
return noExitRuntime || runtimeKeepaliveCounter > 0;
1935
}
1936
1937
Module["keepRuntimeAlive"] = keepRuntimeAlive;
1938
1939
function stackTrace() {
1940
var js = jsStackTrace();
1941
if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"]();
1942
return demangleAll(js);
1943
}
1944
1945
function ___assert_fail(condition, filename, line, func) {
1946
abort("Assertion failed: " + UTF8ToString(condition) + ", at: " + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]);
1947
}
1948
1949
function ___call_main(argc, argv) {
1950
var returnCode = _main(argc, argv);
1951
out("Proxied main thread 0x" + _pthread_self().toString(16) + " finished with return code " + returnCode + ". EXIT_RUNTIME=0 set, so keeping main thread alive for asynchronous event operations.");
1952
}
1953
1954
var _emscripten_get_now;
1955
1956
if (ENVIRONMENT_IS_NODE) {
1957
_emscripten_get_now = function() {
1958
var t = process["hrtime"]();
1959
return t[0] * 1e3 + t[1] / 1e6;
1960
};
1961
} else if (ENVIRONMENT_IS_PTHREAD) {
1962
_emscripten_get_now = function() {
1963
return performance.now() - Module["__performance_now_clock_drift"];
1964
};
1965
} else if (typeof dateNow !== "undefined") {
1966
_emscripten_get_now = dateNow;
1967
} else _emscripten_get_now = function() {
1968
return performance.now();
1969
};
1970
1971
var _emscripten_get_now_is_monotonic = true;
1972
1973
function setErrNo(value) {
1974
GROWABLE_HEAP_I32()[___errno_location() >> 2] = value;
1975
return value;
1976
}
1977
1978
function _clock_gettime(clk_id, tp) {
1979
var now;
1980
if (clk_id === 0) {
1981
now = Date.now();
1982
} else if ((clk_id === 1 || clk_id === 4) && _emscripten_get_now_is_monotonic) {
1983
now = _emscripten_get_now();
1984
} else {
1985
setErrNo(28);
1986
return -1;
1987
}
1988
GROWABLE_HEAP_I32()[tp >> 2] = now / 1e3 | 0;
1989
GROWABLE_HEAP_I32()[tp + 4 >> 2] = now % 1e3 * 1e3 * 1e3 | 0;
1990
return 0;
1991
}
1992
1993
function ___clock_gettime(a0, a1) {
1994
return _clock_gettime(a0, a1);
1995
}
1996
1997
function _pthread_cleanup_push(routine, arg) {
1998
PThread.threadExitHandlers.push(function() {
1999
wasmTable.get(routine)(arg);
2000
});
2001
}
2002
2003
function ___cxa_thread_atexit(a0, a1) {
2004
return _pthread_cleanup_push(a0, a1);
2005
}
2006
2007
function __emscripten_notify_thread_queue(targetThreadId, mainThreadId) {
2008
if (targetThreadId == mainThreadId) {
2009
postMessage({
2010
"cmd": "processQueuedMainThreadWork"
2011
});
2012
} else if (ENVIRONMENT_IS_PTHREAD) {
2013
postMessage({
2014
"targetThread": targetThreadId,
2015
"cmd": "processThreadQueue"
2016
});
2017
} else {
2018
var pthread = PThread.pthreads[targetThreadId];
2019
var worker = pthread && pthread.worker;
2020
if (!worker) {
2021
err("Cannot send message to thread with ID " + targetThreadId + ", unknown thread ID!");
2022
return;
2023
}
2024
worker.postMessage({
2025
"cmd": "processThreadQueue"
2026
});
2027
}
2028
return 1;
2029
}
2030
2031
var readAsmConstArgsArray = [];
2032
2033
function readAsmConstArgs(sigPtr, buf) {
2034
assert(Array.isArray(readAsmConstArgsArray));
2035
assert(buf % 16 == 0);
2036
readAsmConstArgsArray.length = 0;
2037
var ch;
2038
buf >>= 2;
2039
while (ch = GROWABLE_HEAP_U8()[sigPtr++]) {
2040
assert(ch === 100 || ch === 102 || ch === 105);
2041
var double = ch < 105;
2042
if (double && buf & 1) buf++;
2043
readAsmConstArgsArray.push(double ? GROWABLE_HEAP_F64()[buf++ >> 1] : GROWABLE_HEAP_I32()[buf]);
2044
++buf;
2045
}
2046
return readAsmConstArgsArray;
2047
}
2048
2049
function _emscripten_asm_const_int(code, sigPtr, argbuf) {
2050
var args = readAsmConstArgs(sigPtr, argbuf);
2051
if (!ASM_CONSTS.hasOwnProperty(code)) abort("No EM_ASM constant found at address " + code);
2052
return ASM_CONSTS[code].apply(null, args);
2053
}
2054
2055
function _emscripten_conditional_set_current_thread_status_js(expectedStatus, newStatus) {}
2056
2057
function _emscripten_conditional_set_current_thread_status(expectedStatus, newStatus) {}
2058
2059
function _emscripten_futex_wait(addr, val, timeout) {
2060
if (addr <= 0 || addr > GROWABLE_HEAP_I8().length || addr & 3 != 0) return -28;
2061
if (!ENVIRONMENT_IS_WEB) {
2062
var ret = Atomics.wait(GROWABLE_HEAP_I32(), addr >> 2, val, timeout);
2063
if (ret === "timed-out") return -73;
2064
if (ret === "not-equal") return -6;
2065
if (ret === "ok") return 0;
2066
throw "Atomics.wait returned an unexpected value " + ret;
2067
} else {
2068
if (Atomics.load(GROWABLE_HEAP_I32(), addr >> 2) != val) {
2069
return -6;
2070
}
2071
var tNow = performance.now();
2072
var tEnd = tNow + timeout;
2073
assert(__emscripten_main_thread_futex > 0);
2074
var lastAddr = Atomics.exchange(GROWABLE_HEAP_I32(), __emscripten_main_thread_futex >> 2, addr);
2075
assert(lastAddr == 0);
2076
while (1) {
2077
tNow = performance.now();
2078
if (tNow > tEnd) {
2079
lastAddr = Atomics.exchange(GROWABLE_HEAP_I32(), __emscripten_main_thread_futex >> 2, 0);
2080
assert(lastAddr == addr || lastAddr == 0);
2081
return -73;
2082
}
2083
lastAddr = Atomics.exchange(GROWABLE_HEAP_I32(), __emscripten_main_thread_futex >> 2, 0);
2084
assert(lastAddr == addr || lastAddr == 0);
2085
if (lastAddr == 0) {
2086
break;
2087
}
2088
_emscripten_main_thread_process_queued_calls();
2089
if (Atomics.load(GROWABLE_HEAP_I32(), addr >> 2) != val) {
2090
return -6;
2091
}
2092
lastAddr = Atomics.exchange(GROWABLE_HEAP_I32(), __emscripten_main_thread_futex >> 2, addr);
2093
assert(lastAddr == 0);
2094
}
2095
return 0;
2096
}
2097
}
2098
2099
function _emscripten_memcpy_big(dest, src, num) {
2100
GROWABLE_HEAP_U8().copyWithin(dest, src, src + num);
2101
}
2102
2103
function _emscripten_proxy_to_main_thread_js(index, sync) {
2104
var numCallArgs = arguments.length - 2;
2105
if (numCallArgs > 20 - 1) throw "emscripten_proxy_to_main_thread_js: Too many arguments " + numCallArgs + " to proxied function idx=" + index + ", maximum supported is " + (20 - 1) + "!";
2106
var stack = stackSave();
2107
var serializedNumCallArgs = numCallArgs;
2108
var args = stackAlloc(serializedNumCallArgs * 8);
2109
var b = args >> 3;
2110
for (var i = 0; i < numCallArgs; i++) {
2111
var arg = arguments[2 + i];
2112
GROWABLE_HEAP_F64()[b + i] = arg;
2113
}
2114
var ret = _emscripten_run_in_main_runtime_thread_js(index, serializedNumCallArgs, args, sync);
2115
stackRestore(stack);
2116
return ret;
2117
}
2118
2119
var _emscripten_receive_on_main_thread_js_callArgs = [];
2120
2121
function _emscripten_receive_on_main_thread_js(index, numCallArgs, args) {
2122
_emscripten_receive_on_main_thread_js_callArgs.length = numCallArgs;
2123
var b = args >> 3;
2124
for (var i = 0; i < numCallArgs; i++) {
2125
_emscripten_receive_on_main_thread_js_callArgs[i] = GROWABLE_HEAP_F64()[b + i];
2126
}
2127
var isEmAsmConst = index < 0;
2128
var func = !isEmAsmConst ? proxiedFunctionTable[index] : ASM_CONSTS[-index - 1];
2129
assert(func.length == numCallArgs, "Call args mismatch in emscripten_receive_on_main_thread_js");
2130
return func.apply(null, _emscripten_receive_on_main_thread_js_callArgs);
2131
}
2132
2133
function emscripten_realloc_buffer(size) {
2134
try {
2135
wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16);
2136
updateGlobalBufferAndViews(wasmMemory.buffer);
2137
return 1;
2138
} catch (e) {
2139
console.error("emscripten_realloc_buffer: Attempted to grow heap from " + buffer.byteLength + " bytes to " + size + " bytes, but got error: " + e);
2140
}
2141
}
2142
2143
function _emscripten_resize_heap(requestedSize) {
2144
var oldSize = GROWABLE_HEAP_U8().length;
2145
requestedSize = requestedSize >>> 0;
2146
if (requestedSize <= oldSize) {
2147
return false;
2148
}
2149
var maxHeapSize = 2147483648;
2150
if (requestedSize > maxHeapSize) {
2151
err("Cannot enlarge memory, asked to go up to " + requestedSize + " bytes, but the limit is " + maxHeapSize + " bytes!");
2152
return false;
2153
}
2154
for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
2155
var overGrownHeapSize = oldSize * (1 + .2 / cutDown);
2156
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
2157
var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536));
2158
var replacement = emscripten_realloc_buffer(newSize);
2159
if (replacement) {
2160
return true;
2161
}
2162
}
2163
err("Failed to grow the heap from " + oldSize + " bytes to " + newSize + " bytes, not enough memory!");
2164
return false;
2165
}
2166
2167
var JSEvents = {
2168
inEventHandler: 0,
2169
removeAllEventListeners: function() {
2170
for (var i = JSEvents.eventHandlers.length - 1; i >= 0; --i) {
2171
JSEvents._removeHandler(i);
2172
}
2173
JSEvents.eventHandlers = [];
2174
JSEvents.deferredCalls = [];
2175
},
2176
registerRemoveEventListeners: function() {
2177
if (!JSEvents.removeEventListenersRegistered) {
2178
__ATEXIT__.push(JSEvents.removeAllEventListeners);
2179
JSEvents.removeEventListenersRegistered = true;
2180
}
2181
},
2182
deferredCalls: [],
2183
deferCall: function(targetFunction, precedence, argsList) {
2184
function arraysHaveEqualContent(arrA, arrB) {
2185
if (arrA.length != arrB.length) return false;
2186
for (var i in arrA) {
2187
if (arrA[i] != arrB[i]) return false;
2188
}
2189
return true;
2190
}
2191
for (var i in JSEvents.deferredCalls) {
2192
var call = JSEvents.deferredCalls[i];
2193
if (call.targetFunction == targetFunction && arraysHaveEqualContent(call.argsList, argsList)) {
2194
return;
2195
}
2196
}
2197
JSEvents.deferredCalls.push({
2198
targetFunction: targetFunction,
2199
precedence: precedence,
2200
argsList: argsList
2201
});
2202
JSEvents.deferredCalls.sort(function(x, y) {
2203
return x.precedence < y.precedence;
2204
});
2205
},
2206
removeDeferredCalls: function(targetFunction) {
2207
for (var i = 0; i < JSEvents.deferredCalls.length; ++i) {
2208
if (JSEvents.deferredCalls[i].targetFunction == targetFunction) {
2209
JSEvents.deferredCalls.splice(i, 1);
2210
--i;
2211
}
2212
}
2213
},
2214
canPerformEventHandlerRequests: function() {
2215
return JSEvents.inEventHandler && JSEvents.currentEventHandler.allowsDeferredCalls;
2216
},
2217
runDeferredCalls: function() {
2218
if (!JSEvents.canPerformEventHandlerRequests()) {
2219
return;
2220
}
2221
for (var i = 0; i < JSEvents.deferredCalls.length; ++i) {
2222
var call = JSEvents.deferredCalls[i];
2223
JSEvents.deferredCalls.splice(i, 1);
2224
--i;
2225
call.targetFunction.apply(null, call.argsList);
2226
}
2227
},
2228
eventHandlers: [],
2229
removeAllHandlersOnTarget: function(target, eventTypeString) {
2230
for (var i = 0; i < JSEvents.eventHandlers.length; ++i) {
2231
if (JSEvents.eventHandlers[i].target == target && (!eventTypeString || eventTypeString == JSEvents.eventHandlers[i].eventTypeString)) {
2232
JSEvents._removeHandler(i--);
2233
}
2234
}
2235
},
2236
_removeHandler: function(i) {
2237
var h = JSEvents.eventHandlers[i];
2238
h.target.removeEventListener(h.eventTypeString, h.eventListenerFunc, h.useCapture);
2239
JSEvents.eventHandlers.splice(i, 1);
2240
},
2241
registerOrRemoveHandler: function(eventHandler) {
2242
var jsEventHandler = function jsEventHandler(event) {
2243
++JSEvents.inEventHandler;
2244
JSEvents.currentEventHandler = eventHandler;
2245
JSEvents.runDeferredCalls();
2246
eventHandler.handlerFunc(event);
2247
JSEvents.runDeferredCalls();
2248
--JSEvents.inEventHandler;
2249
};
2250
if (eventHandler.callbackfunc) {
2251
eventHandler.eventListenerFunc = jsEventHandler;
2252
eventHandler.target.addEventListener(eventHandler.eventTypeString, jsEventHandler, eventHandler.useCapture);
2253
JSEvents.eventHandlers.push(eventHandler);
2254
JSEvents.registerRemoveEventListeners();
2255
} else {
2256
for (var i = 0; i < JSEvents.eventHandlers.length; ++i) {
2257
if (JSEvents.eventHandlers[i].target == eventHandler.target && JSEvents.eventHandlers[i].eventTypeString == eventHandler.eventTypeString) {
2258
JSEvents._removeHandler(i--);
2259
}
2260
}
2261
}
2262
},
2263
queueEventHandlerOnThread_iiii: function(targetThread, eventHandlerFunc, eventTypeId, eventData, userData) {
2264
var stackTop = stackSave();
2265
var varargs = stackAlloc(12);
2266
GROWABLE_HEAP_I32()[varargs >> 2] = eventTypeId;
2267
GROWABLE_HEAP_I32()[varargs + 4 >> 2] = eventData;
2268
GROWABLE_HEAP_I32()[varargs + 8 >> 2] = userData;
2269
__emscripten_call_on_thread(0, targetThread, 637534208, eventHandlerFunc, eventData, varargs);
2270
stackRestore(stackTop);
2271
},
2272
getTargetThreadForEventCallback: function(targetThread) {
2273
switch (targetThread) {
2274
case 1:
2275
return 0;
2276
2277
case 2:
2278
return PThread.currentProxiedOperationCallerThread;
2279
2280
default:
2281
return targetThread;
2282
}
2283
},
2284
getNodeNameForTarget: function(target) {
2285
if (!target) return "";
2286
if (target == window) return "#window";
2287
if (target == screen) return "#screen";
2288
return target && target.nodeName ? target.nodeName : "";
2289
},
2290
fullscreenEnabled: function() {
2291
return document.fullscreenEnabled || document.webkitFullscreenEnabled;
2292
}
2293
};
2294
2295
function stringToNewUTF8(jsString) {
2296
var length = lengthBytesUTF8(jsString) + 1;
2297
var cString = _malloc(length);
2298
stringToUTF8(jsString, cString, length);
2299
return cString;
2300
}
2301
2302
function _emscripten_set_offscreencanvas_size_on_target_thread_js(targetThread, targetCanvas, width, height) {
2303
var stackTop = stackSave();
2304
var varargs = stackAlloc(12);
2305
var targetCanvasPtr = 0;
2306
if (targetCanvas) {
2307
targetCanvasPtr = stringToNewUTF8(targetCanvas);
2308
}
2309
GROWABLE_HEAP_I32()[varargs >> 2] = targetCanvasPtr;
2310
GROWABLE_HEAP_I32()[varargs + 4 >> 2] = width;
2311
GROWABLE_HEAP_I32()[varargs + 8 >> 2] = height;
2312
__emscripten_call_on_thread(0, targetThread, 657457152, 0, targetCanvasPtr, varargs);
2313
stackRestore(stackTop);
2314
}
2315
2316
function _emscripten_set_offscreencanvas_size_on_target_thread(targetThread, targetCanvas, width, height) {
2317
targetCanvas = targetCanvas ? UTF8ToString(targetCanvas) : "";
2318
_emscripten_set_offscreencanvas_size_on_target_thread_js(targetThread, targetCanvas, width, height);
2319
}
2320
2321
function maybeCStringToJsString(cString) {
2322
return cString > 2 ? UTF8ToString(cString) : cString;
2323
}
2324
2325
var specialHTMLTargets = [ 0, typeof document !== "undefined" ? document : 0, typeof window !== "undefined" ? window : 0 ];
2326
2327
function findEventTarget(target) {
2328
target = maybeCStringToJsString(target);
2329
var domElement = specialHTMLTargets[target] || (typeof document !== "undefined" ? document.querySelector(target) : undefined);
2330
return domElement;
2331
}
2332
2333
function findCanvasEventTarget(target) {
2334
return findEventTarget(target);
2335
}
2336
2337
function _emscripten_set_canvas_element_size_calling_thread(target, width, height) {
2338
var canvas = findCanvasEventTarget(target);
2339
if (!canvas) return -4;
2340
if (canvas.canvasSharedPtr) {
2341
GROWABLE_HEAP_I32()[canvas.canvasSharedPtr >> 2] = width;
2342
GROWABLE_HEAP_I32()[canvas.canvasSharedPtr + 4 >> 2] = height;
2343
}
2344
if (canvas.offscreenCanvas || !canvas.controlTransferredOffscreen) {
2345
if (canvas.offscreenCanvas) canvas = canvas.offscreenCanvas;
2346
var autoResizeViewport = false;
2347
if (canvas.GLctxObject && canvas.GLctxObject.GLctx) {
2348
var prevViewport = canvas.GLctxObject.GLctx.getParameter(2978);
2349
autoResizeViewport = prevViewport[0] === 0 && prevViewport[1] === 0 && prevViewport[2] === canvas.width && prevViewport[3] === canvas.height;
2350
}
2351
canvas.width = width;
2352
canvas.height = height;
2353
if (autoResizeViewport) {
2354
canvas.GLctxObject.GLctx.viewport(0, 0, width, height);
2355
}
2356
} else if (canvas.canvasSharedPtr) {
2357
var targetThread = GROWABLE_HEAP_I32()[canvas.canvasSharedPtr + 8 >> 2];
2358
_emscripten_set_offscreencanvas_size_on_target_thread(targetThread, target, width, height);
2359
return 1;
2360
} else {
2361
return -4;
2362
}
2363
return 0;
2364
}
2365
2366
function _emscripten_set_canvas_element_size_main_thread(target, width, height) {
2367
if (ENVIRONMENT_IS_PTHREAD) return _emscripten_proxy_to_main_thread_js(1, 1, target, width, height);
2368
return _emscripten_set_canvas_element_size_calling_thread(target, width, height);
2369
}
2370
2371
function _emscripten_set_canvas_element_size(target, width, height) {
2372
var canvas = findCanvasEventTarget(target);
2373
if (canvas) {
2374
return _emscripten_set_canvas_element_size_calling_thread(target, width, height);
2375
} else {
2376
return _emscripten_set_canvas_element_size_main_thread(target, width, height);
2377
}
2378
}
2379
2380
function _emscripten_set_current_thread_status_js(newStatus) {}
2381
2382
function _emscripten_set_current_thread_status(newStatus) {}
2383
2384
function _emscripten_set_thread_name(threadId, name) {}
2385
2386
function __webgl_enable_ANGLE_instanced_arrays(ctx) {
2387
var ext = ctx.getExtension("ANGLE_instanced_arrays");
2388
if (ext) {
2389
ctx["vertexAttribDivisor"] = function(index, divisor) {
2390
ext["vertexAttribDivisorANGLE"](index, divisor);
2391
};
2392
ctx["drawArraysInstanced"] = function(mode, first, count, primcount) {
2393
ext["drawArraysInstancedANGLE"](mode, first, count, primcount);
2394
};
2395
ctx["drawElementsInstanced"] = function(mode, count, type, indices, primcount) {
2396
ext["drawElementsInstancedANGLE"](mode, count, type, indices, primcount);
2397
};
2398
return 1;
2399
}
2400
}
2401
2402
function __webgl_enable_OES_vertex_array_object(ctx) {
2403
var ext = ctx.getExtension("OES_vertex_array_object");
2404
if (ext) {
2405
ctx["createVertexArray"] = function() {
2406
return ext["createVertexArrayOES"]();
2407
};
2408
ctx["deleteVertexArray"] = function(vao) {
2409
ext["deleteVertexArrayOES"](vao);
2410
};
2411
ctx["bindVertexArray"] = function(vao) {
2412
ext["bindVertexArrayOES"](vao);
2413
};
2414
ctx["isVertexArray"] = function(vao) {
2415
return ext["isVertexArrayOES"](vao);
2416
};
2417
return 1;
2418
}
2419
}
2420
2421
function __webgl_enable_WEBGL_draw_buffers(ctx) {
2422
var ext = ctx.getExtension("WEBGL_draw_buffers");
2423
if (ext) {
2424
ctx["drawBuffers"] = function(n, bufs) {
2425
ext["drawBuffersWEBGL"](n, bufs);
2426
};
2427
return 1;
2428
}
2429
}
2430
2431
function __webgl_enable_WEBGL_multi_draw(ctx) {
2432
return !!(ctx.multiDrawWebgl = ctx.getExtension("WEBGL_multi_draw"));
2433
}
2434
2435
var GL = {
2436
counter: 1,
2437
buffers: [],
2438
programs: [],
2439
framebuffers: [],
2440
renderbuffers: [],
2441
textures: [],
2442
shaders: [],
2443
vaos: [],
2444
contexts: {},
2445
offscreenCanvases: {},
2446
queries: [],
2447
stringCache: {},
2448
unpackAlignment: 4,
2449
recordError: function recordError(errorCode) {
2450
if (!GL.lastError) {
2451
GL.lastError = errorCode;
2452
}
2453
},
2454
getNewId: function(table) {
2455
var ret = GL.counter++;
2456
for (var i = table.length; i < ret; i++) {
2457
table[i] = null;
2458
}
2459
return ret;
2460
},
2461
getSource: function(shader, count, string, length) {
2462
var source = "";
2463
for (var i = 0; i < count; ++i) {
2464
var len = length ? GROWABLE_HEAP_I32()[length + i * 4 >> 2] : -1;
2465
source += UTF8ToString(GROWABLE_HEAP_I32()[string + i * 4 >> 2], len < 0 ? undefined : len);
2466
}
2467
return source;
2468
},
2469
createContext: function(canvas, webGLContextAttributes) {
2470
if (!canvas.getContextSafariWebGL2Fixed) {
2471
canvas.getContextSafariWebGL2Fixed = canvas.getContext;
2472
canvas.getContext = function(ver, attrs) {
2473
var gl = canvas.getContextSafariWebGL2Fixed(ver, attrs);
2474
return ver == "webgl" == gl instanceof WebGLRenderingContext ? gl : null;
2475
};
2476
}
2477
var ctx = canvas.getContext("webgl", webGLContextAttributes);
2478
if (!ctx) return 0;
2479
var handle = GL.registerContext(ctx, webGLContextAttributes);
2480
return handle;
2481
},
2482
registerContext: function(ctx, webGLContextAttributes) {
2483
var handle = _malloc(8);
2484
GROWABLE_HEAP_I32()[handle + 4 >> 2] = _pthread_self();
2485
var context = {
2486
handle: handle,
2487
attributes: webGLContextAttributes,
2488
version: webGLContextAttributes.majorVersion,
2489
GLctx: ctx
2490
};
2491
if (ctx.canvas) ctx.canvas.GLctxObject = context;
2492
GL.contexts[handle] = context;
2493
if (typeof webGLContextAttributes.enableExtensionsByDefault === "undefined" || webGLContextAttributes.enableExtensionsByDefault) {
2494
GL.initExtensions(context);
2495
}
2496
return handle;
2497
},
2498
makeContextCurrent: function(contextHandle) {
2499
GL.currentContext = GL.contexts[contextHandle];
2500
Module.ctx = GLctx = GL.currentContext && GL.currentContext.GLctx;
2501
return !(contextHandle && !GLctx);
2502
},
2503
getContext: function(contextHandle) {
2504
return GL.contexts[contextHandle];
2505
},
2506
deleteContext: function(contextHandle) {
2507
if (GL.currentContext === GL.contexts[contextHandle]) GL.currentContext = null;
2508
if (typeof JSEvents === "object") JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);
2509
if (GL.contexts[contextHandle] && GL.contexts[contextHandle].GLctx.canvas) GL.contexts[contextHandle].GLctx.canvas.GLctxObject = undefined;
2510
_free(GL.contexts[contextHandle].handle);
2511
GL.contexts[contextHandle] = null;
2512
},
2513
initExtensions: function(context) {
2514
if (!context) context = GL.currentContext;
2515
if (context.initExtensionsDone) return;
2516
context.initExtensionsDone = true;
2517
var GLctx = context.GLctx;
2518
__webgl_enable_ANGLE_instanced_arrays(GLctx);
2519
__webgl_enable_OES_vertex_array_object(GLctx);
2520
__webgl_enable_WEBGL_draw_buffers(GLctx);
2521
{
2522
GLctx.disjointTimerQueryExt = GLctx.getExtension("EXT_disjoint_timer_query");
2523
}
2524
__webgl_enable_WEBGL_multi_draw(GLctx);
2525
var exts = GLctx.getSupportedExtensions() || [];
2526
exts.forEach(function(ext) {
2527
if (!ext.includes("lose_context") && !ext.includes("debug")) {
2528
GLctx.getExtension(ext);
2529
}
2530
});
2531
}
2532
};
2533
2534
var __emscripten_webgl_power_preferences = [ "default", "low-power", "high-performance" ];
2535
2536
function _emscripten_webgl_do_create_context(target, attributes) {
2537
assert(attributes);
2538
var a = attributes >> 2;
2539
var powerPreference = GROWABLE_HEAP_I32()[a + (24 >> 2)];
2540
var contextAttributes = {
2541
"alpha": !!GROWABLE_HEAP_I32()[a + (0 >> 2)],
2542
"depth": !!GROWABLE_HEAP_I32()[a + (4 >> 2)],
2543
"stencil": !!GROWABLE_HEAP_I32()[a + (8 >> 2)],
2544
"antialias": !!GROWABLE_HEAP_I32()[a + (12 >> 2)],
2545
"premultipliedAlpha": !!GROWABLE_HEAP_I32()[a + (16 >> 2)],
2546
"preserveDrawingBuffer": !!GROWABLE_HEAP_I32()[a + (20 >> 2)],
2547
"powerPreference": __emscripten_webgl_power_preferences[powerPreference],
2548
"failIfMajorPerformanceCaveat": !!GROWABLE_HEAP_I32()[a + (28 >> 2)],
2549
majorVersion: GROWABLE_HEAP_I32()[a + (32 >> 2)],
2550
minorVersion: GROWABLE_HEAP_I32()[a + (36 >> 2)],
2551
enableExtensionsByDefault: GROWABLE_HEAP_I32()[a + (40 >> 2)],
2552
explicitSwapControl: GROWABLE_HEAP_I32()[a + (44 >> 2)],
2553
proxyContextToMainThread: GROWABLE_HEAP_I32()[a + (48 >> 2)],
2554
renderViaOffscreenBackBuffer: GROWABLE_HEAP_I32()[a + (52 >> 2)]
2555
};
2556
var canvas = findCanvasEventTarget(target);
2557
if (!canvas) {
2558
return 0;
2559
}
2560
if (contextAttributes.explicitSwapControl) {
2561
return 0;
2562
}
2563
var contextHandle = GL.createContext(canvas, contextAttributes);
2564
return contextHandle;
2565
}
2566
2567
function _emscripten_webgl_create_context(a0, a1) {
2568
return _emscripten_webgl_do_create_context(a0, a1);
2569
}
2570
2571
function flush_NO_FILESYSTEM() {
2572
if (typeof _fflush !== "undefined") _fflush(0);
2573
var buffers = SYSCALLS.buffers;
2574
if (buffers[1].length) SYSCALLS.printChar(1, 10);
2575
if (buffers[2].length) SYSCALLS.printChar(2, 10);
2576
}
2577
2578
var SYSCALLS = {
2579
mappings: {},
2580
buffers: [ null, [], [] ],
2581
printChar: function(stream, curr) {
2582
var buffer = SYSCALLS.buffers[stream];
2583
assert(buffer);
2584
if (curr === 0 || curr === 10) {
2585
(stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));
2586
buffer.length = 0;
2587
} else {
2588
buffer.push(curr);
2589
}
2590
},
2591
varargs: undefined,
2592
get: function() {
2593
assert(SYSCALLS.varargs != undefined);
2594
SYSCALLS.varargs += 4;
2595
var ret = GROWABLE_HEAP_I32()[SYSCALLS.varargs - 4 >> 2];
2596
return ret;
2597
},
2598
getStr: function(ptr) {
2599
var ret = UTF8ToString(ptr);
2600
return ret;
2601
},
2602
get64: function(low, high) {
2603
if (low >= 0) assert(high === 0); else assert(high === -1);
2604
return low;
2605
}
2606
};
2607
2608
function _fd_write(fd, iov, iovcnt, pnum) {
2609
if (ENVIRONMENT_IS_PTHREAD) return _emscripten_proxy_to_main_thread_js(2, 1, fd, iov, iovcnt, pnum);
2610
var num = 0;
2611
for (var i = 0; i < iovcnt; i++) {
2612
var ptr = GROWABLE_HEAP_I32()[iov + i * 8 >> 2];
2613
var len = GROWABLE_HEAP_I32()[iov + (i * 8 + 4) >> 2];
2614
for (var j = 0; j < len; j++) {
2615
SYSCALLS.printChar(fd, GROWABLE_HEAP_U8()[ptr + j]);
2616
}
2617
num += len;
2618
}
2619
GROWABLE_HEAP_I32()[pnum >> 2] = num;
2620
return 0;
2621
}
2622
2623
function spawnThread(threadParams) {
2624
if (ENVIRONMENT_IS_PTHREAD) throw "Internal Error! spawnThread() can only ever be called from main application thread!";
2625
var worker = PThread.getNewWorker();
2626
if (!worker) {
2627
return 6;
2628
}
2629
if (worker.pthread !== undefined) throw "Internal error!";
2630
if (!threadParams.pthread_ptr) throw "Internal error, no pthread ptr!";
2631
PThread.runningWorkers.push(worker);
2632
var tlsMemory = _malloc(128 * 4);
2633
for (var i = 0; i < 128; ++i) {
2634
GROWABLE_HEAP_I32()[tlsMemory + i * 4 >> 2] = 0;
2635
}
2636
var stackHigh = threadParams.stackBase + threadParams.stackSize;
2637
var pthread = PThread.pthreads[threadParams.pthread_ptr] = {
2638
worker: worker,
2639
stackBase: threadParams.stackBase,
2640
stackSize: threadParams.stackSize,
2641
allocatedOwnStack: threadParams.allocatedOwnStack,
2642
threadInfoStruct: threadParams.pthread_ptr
2643
};
2644
var tis = pthread.threadInfoStruct >> 2;
2645
Atomics.store(GROWABLE_HEAP_U32(), tis + (64 >> 2), threadParams.detached);
2646
Atomics.store(GROWABLE_HEAP_U32(), tis + (100 >> 2), tlsMemory);
2647
Atomics.store(GROWABLE_HEAP_U32(), tis + (40 >> 2), pthread.threadInfoStruct);
2648
Atomics.store(GROWABLE_HEAP_U32(), tis + (80 >> 2), threadParams.stackSize);
2649
Atomics.store(GROWABLE_HEAP_U32(), tis + (76 >> 2), stackHigh);
2650
Atomics.store(GROWABLE_HEAP_U32(), tis + (104 >> 2), threadParams.stackSize);
2651
Atomics.store(GROWABLE_HEAP_U32(), tis + (104 + 8 >> 2), stackHigh);
2652
Atomics.store(GROWABLE_HEAP_U32(), tis + (104 + 12 >> 2), threadParams.detached);
2653
var global_libc = _emscripten_get_global_libc();
2654
var global_locale = global_libc + 40;
2655
Atomics.store(GROWABLE_HEAP_U32(), tis + (172 >> 2), global_locale);
2656
worker.pthread = pthread;
2657
var msg = {
2658
"cmd": "run",
2659
"start_routine": threadParams.startRoutine,
2660
"arg": threadParams.arg,
2661
"threadInfoStruct": threadParams.pthread_ptr,
2662
"stackBase": threadParams.stackBase,
2663
"stackSize": threadParams.stackSize
2664
};
2665
worker.runPthread = function() {
2666
msg.time = performance.now();
2667
worker.postMessage(msg, threadParams.transferList);
2668
};
2669
if (worker.loaded) {
2670
worker.runPthread();
2671
delete worker.runPthread;
2672
}
2673
return 0;
2674
}
2675
2676
function _pthread_create(pthread_ptr, attr, start_routine, arg) {
2677
if (typeof SharedArrayBuffer === "undefined") {
2678
err("Current environment does not support SharedArrayBuffer, pthreads are not available!");
2679
return 6;
2680
}
2681
if (!pthread_ptr) {
2682
err("pthread_create called with a null thread pointer!");
2683
return 28;
2684
}
2685
var transferList = [];
2686
var error = 0;
2687
if (ENVIRONMENT_IS_PTHREAD && (transferList.length === 0 || error)) {
2688
return _emscripten_sync_run_in_main_thread_4(687865856, pthread_ptr, attr, start_routine, arg);
2689
}
2690
if (error) return error;
2691
var stackSize = 0;
2692
var stackBase = 0;
2693
var detached = 0;
2694
if (attr && attr != -1) {
2695
stackSize = GROWABLE_HEAP_I32()[attr >> 2];
2696
stackSize += 81920;
2697
stackBase = GROWABLE_HEAP_I32()[attr + 8 >> 2];
2698
detached = GROWABLE_HEAP_I32()[attr + 12 >> 2] !== 0;
2699
} else {
2700
stackSize = 2097152;
2701
}
2702
var allocatedOwnStack = stackBase == 0;
2703
if (allocatedOwnStack) {
2704
stackBase = _memalign(16, stackSize);
2705
} else {
2706
stackBase -= stackSize;
2707
assert(stackBase > 0);
2708
}
2709
var threadInfoStruct = _malloc(228);
2710
for (var i = 0; i < 228 >> 2; ++i) GROWABLE_HEAP_U32()[(threadInfoStruct >> 2) + i] = 0;
2711
GROWABLE_HEAP_I32()[pthread_ptr >> 2] = threadInfoStruct;
2712
GROWABLE_HEAP_I32()[threadInfoStruct + 12 >> 2] = threadInfoStruct;
2713
var headPtr = threadInfoStruct + 152;
2714
GROWABLE_HEAP_I32()[headPtr >> 2] = headPtr;
2715
var threadParams = {
2716
stackBase: stackBase,
2717
stackSize: stackSize,
2718
allocatedOwnStack: allocatedOwnStack,
2719
detached: detached,
2720
startRoutine: start_routine,
2721
pthread_ptr: threadInfoStruct,
2722
arg: arg,
2723
transferList: transferList
2724
};
2725
if (ENVIRONMENT_IS_PTHREAD) {
2726
threadParams.cmd = "spawnThread";
2727
postMessage(threadParams, transferList);
2728
return 0;
2729
}
2730
return spawnThread(threadParams);
2731
}
2732
2733
function _setTempRet0(val) {
2734
setTempRet0(val);
2735
}
2736
2737
if (!ENVIRONMENT_IS_PTHREAD) PThread.initMainThreadBlock();
2738
2739
var GLctx;
2740
2741
var proxiedFunctionTable = [ null, _emscripten_set_canvas_element_size_main_thread, _fd_write ];
2742
2743
var ASSERTIONS = true;
2744
2745
function intArrayFromString(stringy, dontAddNull, length) {
2746
var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
2747
var u8array = new Array(len);
2748
var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
2749
if (dontAddNull) u8array.length = numBytesWritten;
2750
return u8array;
2751
}
2752
2753
function intArrayToString(array) {
2754
var ret = [];
2755
for (var i = 0; i < array.length; i++) {
2756
var chr = array[i];
2757
if (chr > 255) {
2758
if (ASSERTIONS) {
2759
assert(false, "Character code " + chr + " (" + String.fromCharCode(chr) + ") at offset " + i + " not in 0x00-0xFF.");
2760
}
2761
chr &= 255;
2762
}
2763
ret.push(String.fromCharCode(chr));
2764
}
2765
return ret.join("");
2766
}
2767
2768
var asmLibraryArg = {
2769
"__assert_fail": ___assert_fail,
2770
"__call_main": ___call_main,
2771
"__clock_gettime": ___clock_gettime,
2772
"__cxa_thread_atexit": ___cxa_thread_atexit,
2773
"_emscripten_notify_thread_queue": __emscripten_notify_thread_queue,
2774
"emscripten_asm_const_int": _emscripten_asm_const_int,
2775
"emscripten_conditional_set_current_thread_status": _emscripten_conditional_set_current_thread_status,
2776
"emscripten_futex_wait": _emscripten_futex_wait,
2777
"emscripten_futex_wake": _emscripten_futex_wake,
2778
"emscripten_get_now": _emscripten_get_now,
2779
"emscripten_memcpy_big": _emscripten_memcpy_big,
2780
"emscripten_receive_on_main_thread_js": _emscripten_receive_on_main_thread_js,
2781
"emscripten_resize_heap": _emscripten_resize_heap,
2782
"emscripten_set_canvas_element_size": _emscripten_set_canvas_element_size,
2783
"emscripten_set_current_thread_status": _emscripten_set_current_thread_status,
2784
"emscripten_set_thread_name": _emscripten_set_thread_name,
2785
"emscripten_webgl_create_context": _emscripten_webgl_create_context,
2786
"fd_write": _fd_write,
2787
"initPthreadsJS": initPthreadsJS,
2788
"memory": wasmMemory,
2789
"pthread_create": _pthread_create,
2790
"setTempRet0": _setTempRet0
2791
};
2792
2793
var asm = createWasm();
2794
2795
var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors");
2796
2797
var _malloc = Module["_malloc"] = createExportWrapper("malloc");
2798
2799
var _free = Module["_free"] = createExportWrapper("free");
2800
2801
var _fflush = Module["_fflush"] = createExportWrapper("fflush");
2802
2803
var _main = Module["_main"] = createExportWrapper("main");
2804
2805
var _emscripten_tls_init = Module["_emscripten_tls_init"] = createExportWrapper("emscripten_tls_init");
2806
2807
var _emscripten_current_thread_process_queued_calls = Module["_emscripten_current_thread_process_queued_calls"] = createExportWrapper("emscripten_current_thread_process_queued_calls");
2808
2809
var _emscripten_register_main_browser_thread_id = Module["_emscripten_register_main_browser_thread_id"] = createExportWrapper("emscripten_register_main_browser_thread_id");
2810
2811
var _emscripten_main_browser_thread_id = Module["_emscripten_main_browser_thread_id"] = createExportWrapper("emscripten_main_browser_thread_id");
2812
2813
var __emscripten_do_dispatch_to_thread = Module["__emscripten_do_dispatch_to_thread"] = createExportWrapper("_emscripten_do_dispatch_to_thread");
2814
2815
var _emscripten_sync_run_in_main_thread_2 = Module["_emscripten_sync_run_in_main_thread_2"] = createExportWrapper("emscripten_sync_run_in_main_thread_2");
2816
2817
var _emscripten_sync_run_in_main_thread_4 = Module["_emscripten_sync_run_in_main_thread_4"] = createExportWrapper("emscripten_sync_run_in_main_thread_4");
2818
2819
var _emscripten_main_thread_process_queued_calls = Module["_emscripten_main_thread_process_queued_calls"] = createExportWrapper("emscripten_main_thread_process_queued_calls");
2820
2821
var _emscripten_run_in_main_runtime_thread_js = Module["_emscripten_run_in_main_runtime_thread_js"] = createExportWrapper("emscripten_run_in_main_runtime_thread_js");
2822
2823
var __emscripten_call_on_thread = Module["__emscripten_call_on_thread"] = createExportWrapper("_emscripten_call_on_thread");
2824
2825
var _emscripten_proxy_main = Module["_emscripten_proxy_main"] = createExportWrapper("emscripten_proxy_main");
2826
2827
var __emscripten_thread_init = Module["__emscripten_thread_init"] = createExportWrapper("_emscripten_thread_init");
2828
2829
var _pthread_self = Module["_pthread_self"] = createExportWrapper("pthread_self");
2830
2831
var ___pthread_tsd_run_dtors = Module["___pthread_tsd_run_dtors"] = createExportWrapper("__pthread_tsd_run_dtors");
2832
2833
var _emscripten_get_global_libc = Module["_emscripten_get_global_libc"] = createExportWrapper("emscripten_get_global_libc");
2834
2835
var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location");
2836
2837
var ___emscripten_pthread_data_constructor = Module["___emscripten_pthread_data_constructor"] = createExportWrapper("__emscripten_pthread_data_constructor");
2838
2839
var stackSave = Module["stackSave"] = createExportWrapper("stackSave");
2840
2841
var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore");
2842
2843
var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc");
2844
2845
var _emscripten_stack_init = Module["_emscripten_stack_init"] = function() {
2846
return (_emscripten_stack_init = Module["_emscripten_stack_init"] = Module["asm"]["emscripten_stack_init"]).apply(null, arguments);
2847
};
2848
2849
var _emscripten_stack_set_limits = Module["_emscripten_stack_set_limits"] = function() {
2850
return (_emscripten_stack_set_limits = Module["_emscripten_stack_set_limits"] = Module["asm"]["emscripten_stack_set_limits"]).apply(null, arguments);
2851
};
2852
2853
var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = function() {
2854
return (_emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = Module["asm"]["emscripten_stack_get_free"]).apply(null, arguments);
2855
};
2856
2857
var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = function() {
2858
return (_emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = Module["asm"]["emscripten_stack_get_end"]).apply(null, arguments);
2859
};
2860
2861
var _memalign = Module["_memalign"] = createExportWrapper("memalign");
2862
2863
var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji");
2864
2865
var __emscripten_allow_main_runtime_queued_calls = Module["__emscripten_allow_main_runtime_queued_calls"] = 2164;
2866
2867
var __emscripten_main_thread_futex = Module["__emscripten_main_thread_futex"] = 3416;
2868
2869
if (!Object.getOwnPropertyDescriptor(Module, "intArrayFromString")) Module["intArrayFromString"] = function() {
2870
abort("'intArrayFromString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2871
};
2872
2873
if (!Object.getOwnPropertyDescriptor(Module, "intArrayToString")) Module["intArrayToString"] = function() {
2874
abort("'intArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2875
};
2876
2877
if (!Object.getOwnPropertyDescriptor(Module, "ccall")) Module["ccall"] = function() {
2878
abort("'ccall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2879
};
2880
2881
if (!Object.getOwnPropertyDescriptor(Module, "cwrap")) Module["cwrap"] = function() {
2882
abort("'cwrap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2883
};
2884
2885
if (!Object.getOwnPropertyDescriptor(Module, "setValue")) Module["setValue"] = function() {
2886
abort("'setValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2887
};
2888
2889
if (!Object.getOwnPropertyDescriptor(Module, "getValue")) Module["getValue"] = function() {
2890
abort("'getValue' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2891
};
2892
2893
if (!Object.getOwnPropertyDescriptor(Module, "allocate")) Module["allocate"] = function() {
2894
abort("'allocate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2895
};
2896
2897
if (!Object.getOwnPropertyDescriptor(Module, "UTF8ArrayToString")) Module["UTF8ArrayToString"] = function() {
2898
abort("'UTF8ArrayToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2899
};
2900
2901
if (!Object.getOwnPropertyDescriptor(Module, "UTF8ToString")) Module["UTF8ToString"] = function() {
2902
abort("'UTF8ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2903
};
2904
2905
if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8Array")) Module["stringToUTF8Array"] = function() {
2906
abort("'stringToUTF8Array' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2907
};
2908
2909
if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF8")) Module["stringToUTF8"] = function() {
2910
abort("'stringToUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2911
};
2912
2913
if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF8")) Module["lengthBytesUTF8"] = function() {
2914
abort("'lengthBytesUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2915
};
2916
2917
if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = function() {
2918
abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2919
};
2920
2921
if (!Object.getOwnPropertyDescriptor(Module, "addOnPreRun")) Module["addOnPreRun"] = function() {
2922
abort("'addOnPreRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2923
};
2924
2925
if (!Object.getOwnPropertyDescriptor(Module, "addOnInit")) Module["addOnInit"] = function() {
2926
abort("'addOnInit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2927
};
2928
2929
if (!Object.getOwnPropertyDescriptor(Module, "addOnPreMain")) Module["addOnPreMain"] = function() {
2930
abort("'addOnPreMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2931
};
2932
2933
if (!Object.getOwnPropertyDescriptor(Module, "addOnExit")) Module["addOnExit"] = function() {
2934
abort("'addOnExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2935
};
2936
2937
if (!Object.getOwnPropertyDescriptor(Module, "addOnPostRun")) Module["addOnPostRun"] = function() {
2938
abort("'addOnPostRun' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2939
};
2940
2941
if (!Object.getOwnPropertyDescriptor(Module, "writeStringToMemory")) Module["writeStringToMemory"] = function() {
2942
abort("'writeStringToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2943
};
2944
2945
if (!Object.getOwnPropertyDescriptor(Module, "writeArrayToMemory")) Module["writeArrayToMemory"] = function() {
2946
abort("'writeArrayToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2947
};
2948
2949
if (!Object.getOwnPropertyDescriptor(Module, "writeAsciiToMemory")) Module["writeAsciiToMemory"] = function() {
2950
abort("'writeAsciiToMemory' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2951
};
2952
2953
if (!Object.getOwnPropertyDescriptor(Module, "addRunDependency")) Module["addRunDependency"] = function() {
2954
abort("'addRunDependency' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
2955
};
2956
2957
if (!Object.getOwnPropertyDescriptor(Module, "removeRunDependency")) Module["removeRunDependency"] = function() {
2958
abort("'removeRunDependency' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
2959
};
2960
2961
if (!Object.getOwnPropertyDescriptor(Module, "FS_createFolder")) Module["FS_createFolder"] = function() {
2962
abort("'FS_createFolder' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2963
};
2964
2965
if (!Object.getOwnPropertyDescriptor(Module, "FS_createPath")) Module["FS_createPath"] = function() {
2966
abort("'FS_createPath' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
2967
};
2968
2969
if (!Object.getOwnPropertyDescriptor(Module, "FS_createDataFile")) Module["FS_createDataFile"] = function() {
2970
abort("'FS_createDataFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
2971
};
2972
2973
if (!Object.getOwnPropertyDescriptor(Module, "FS_createPreloadedFile")) Module["FS_createPreloadedFile"] = function() {
2974
abort("'FS_createPreloadedFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
2975
};
2976
2977
if (!Object.getOwnPropertyDescriptor(Module, "FS_createLazyFile")) Module["FS_createLazyFile"] = function() {
2978
abort("'FS_createLazyFile' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
2979
};
2980
2981
if (!Object.getOwnPropertyDescriptor(Module, "FS_createLink")) Module["FS_createLink"] = function() {
2982
abort("'FS_createLink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2983
};
2984
2985
if (!Object.getOwnPropertyDescriptor(Module, "FS_createDevice")) Module["FS_createDevice"] = function() {
2986
abort("'FS_createDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
2987
};
2988
2989
if (!Object.getOwnPropertyDescriptor(Module, "FS_unlink")) Module["FS_unlink"] = function() {
2990
abort("'FS_unlink' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you");
2991
};
2992
2993
if (!Object.getOwnPropertyDescriptor(Module, "getLEB")) Module["getLEB"] = function() {
2994
abort("'getLEB' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2995
};
2996
2997
if (!Object.getOwnPropertyDescriptor(Module, "getFunctionTables")) Module["getFunctionTables"] = function() {
2998
abort("'getFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
2999
};
3000
3001
if (!Object.getOwnPropertyDescriptor(Module, "alignFunctionTables")) Module["alignFunctionTables"] = function() {
3002
abort("'alignFunctionTables' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3003
};
3004
3005
if (!Object.getOwnPropertyDescriptor(Module, "registerFunctions")) Module["registerFunctions"] = function() {
3006
abort("'registerFunctions' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3007
};
3008
3009
if (!Object.getOwnPropertyDescriptor(Module, "addFunction")) Module["addFunction"] = function() {
3010
abort("'addFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3011
};
3012
3013
if (!Object.getOwnPropertyDescriptor(Module, "removeFunction")) Module["removeFunction"] = function() {
3014
abort("'removeFunction' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3015
};
3016
3017
if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = function() {
3018
abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3019
};
3020
3021
if (!Object.getOwnPropertyDescriptor(Module, "prettyPrint")) Module["prettyPrint"] = function() {
3022
abort("'prettyPrint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3023
};
3024
3025
if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = function() {
3026
abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3027
};
3028
3029
if (!Object.getOwnPropertyDescriptor(Module, "getCompilerSetting")) Module["getCompilerSetting"] = function() {
3030
abort("'getCompilerSetting' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3031
};
3032
3033
if (!Object.getOwnPropertyDescriptor(Module, "print")) Module["print"] = function() {
3034
abort("'print' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3035
};
3036
3037
if (!Object.getOwnPropertyDescriptor(Module, "printErr")) Module["printErr"] = function() {
3038
abort("'printErr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3039
};
3040
3041
if (!Object.getOwnPropertyDescriptor(Module, "getTempRet0")) Module["getTempRet0"] = function() {
3042
abort("'getTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3043
};
3044
3045
if (!Object.getOwnPropertyDescriptor(Module, "setTempRet0")) Module["setTempRet0"] = function() {
3046
abort("'setTempRet0' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3047
};
3048
3049
if (!Object.getOwnPropertyDescriptor(Module, "callMain")) Module["callMain"] = function() {
3050
abort("'callMain' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3051
};
3052
3053
if (!Object.getOwnPropertyDescriptor(Module, "abort")) Module["abort"] = function() {
3054
abort("'abort' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3055
};
3056
3057
if (!Object.getOwnPropertyDescriptor(Module, "stringToNewUTF8")) Module["stringToNewUTF8"] = function() {
3058
abort("'stringToNewUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3059
};
3060
3061
if (!Object.getOwnPropertyDescriptor(Module, "setFileTime")) Module["setFileTime"] = function() {
3062
abort("'setFileTime' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3063
};
3064
3065
if (!Object.getOwnPropertyDescriptor(Module, "emscripten_realloc_buffer")) Module["emscripten_realloc_buffer"] = function() {
3066
abort("'emscripten_realloc_buffer' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3067
};
3068
3069
if (!Object.getOwnPropertyDescriptor(Module, "ENV")) Module["ENV"] = function() {
3070
abort("'ENV' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3071
};
3072
3073
if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_CODES")) Module["ERRNO_CODES"] = function() {
3074
abort("'ERRNO_CODES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3075
};
3076
3077
if (!Object.getOwnPropertyDescriptor(Module, "ERRNO_MESSAGES")) Module["ERRNO_MESSAGES"] = function() {
3078
abort("'ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3079
};
3080
3081
if (!Object.getOwnPropertyDescriptor(Module, "setErrNo")) Module["setErrNo"] = function() {
3082
abort("'setErrNo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3083
};
3084
3085
if (!Object.getOwnPropertyDescriptor(Module, "inetPton4")) Module["inetPton4"] = function() {
3086
abort("'inetPton4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3087
};
3088
3089
if (!Object.getOwnPropertyDescriptor(Module, "inetNtop4")) Module["inetNtop4"] = function() {
3090
abort("'inetNtop4' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3091
};
3092
3093
if (!Object.getOwnPropertyDescriptor(Module, "inetPton6")) Module["inetPton6"] = function() {
3094
abort("'inetPton6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3095
};
3096
3097
if (!Object.getOwnPropertyDescriptor(Module, "inetNtop6")) Module["inetNtop6"] = function() {
3098
abort("'inetNtop6' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3099
};
3100
3101
if (!Object.getOwnPropertyDescriptor(Module, "readSockaddr")) Module["readSockaddr"] = function() {
3102
abort("'readSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3103
};
3104
3105
if (!Object.getOwnPropertyDescriptor(Module, "writeSockaddr")) Module["writeSockaddr"] = function() {
3106
abort("'writeSockaddr' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3107
};
3108
3109
if (!Object.getOwnPropertyDescriptor(Module, "DNS")) Module["DNS"] = function() {
3110
abort("'DNS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3111
};
3112
3113
if (!Object.getOwnPropertyDescriptor(Module, "getHostByName")) Module["getHostByName"] = function() {
3114
abort("'getHostByName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3115
};
3116
3117
if (!Object.getOwnPropertyDescriptor(Module, "GAI_ERRNO_MESSAGES")) Module["GAI_ERRNO_MESSAGES"] = function() {
3118
abort("'GAI_ERRNO_MESSAGES' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3119
};
3120
3121
if (!Object.getOwnPropertyDescriptor(Module, "Protocols")) Module["Protocols"] = function() {
3122
abort("'Protocols' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3123
};
3124
3125
if (!Object.getOwnPropertyDescriptor(Module, "Sockets")) Module["Sockets"] = function() {
3126
abort("'Sockets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3127
};
3128
3129
if (!Object.getOwnPropertyDescriptor(Module, "getRandomDevice")) Module["getRandomDevice"] = function() {
3130
abort("'getRandomDevice' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3131
};
3132
3133
if (!Object.getOwnPropertyDescriptor(Module, "traverseStack")) Module["traverseStack"] = function() {
3134
abort("'traverseStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3135
};
3136
3137
if (!Object.getOwnPropertyDescriptor(Module, "UNWIND_CACHE")) Module["UNWIND_CACHE"] = function() {
3138
abort("'UNWIND_CACHE' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3139
};
3140
3141
if (!Object.getOwnPropertyDescriptor(Module, "withBuiltinMalloc")) Module["withBuiltinMalloc"] = function() {
3142
abort("'withBuiltinMalloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3143
};
3144
3145
if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgsArray")) Module["readAsmConstArgsArray"] = function() {
3146
abort("'readAsmConstArgsArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3147
};
3148
3149
if (!Object.getOwnPropertyDescriptor(Module, "readAsmConstArgs")) Module["readAsmConstArgs"] = function() {
3150
abort("'readAsmConstArgs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3151
};
3152
3153
if (!Object.getOwnPropertyDescriptor(Module, "mainThreadEM_ASM")) Module["mainThreadEM_ASM"] = function() {
3154
abort("'mainThreadEM_ASM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3155
};
3156
3157
if (!Object.getOwnPropertyDescriptor(Module, "jstoi_q")) Module["jstoi_q"] = function() {
3158
abort("'jstoi_q' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3159
};
3160
3161
if (!Object.getOwnPropertyDescriptor(Module, "jstoi_s")) Module["jstoi_s"] = function() {
3162
abort("'jstoi_s' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3163
};
3164
3165
if (!Object.getOwnPropertyDescriptor(Module, "getExecutableName")) Module["getExecutableName"] = function() {
3166
abort("'getExecutableName' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3167
};
3168
3169
if (!Object.getOwnPropertyDescriptor(Module, "listenOnce")) Module["listenOnce"] = function() {
3170
abort("'listenOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3171
};
3172
3173
if (!Object.getOwnPropertyDescriptor(Module, "autoResumeAudioContext")) Module["autoResumeAudioContext"] = function() {
3174
abort("'autoResumeAudioContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3175
};
3176
3177
if (!Object.getOwnPropertyDescriptor(Module, "dynCallLegacy")) Module["dynCallLegacy"] = function() {
3178
abort("'dynCallLegacy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3179
};
3180
3181
if (!Object.getOwnPropertyDescriptor(Module, "getDynCaller")) Module["getDynCaller"] = function() {
3182
abort("'getDynCaller' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3183
};
3184
3185
if (!Object.getOwnPropertyDescriptor(Module, "dynCall")) Module["dynCall"] = function() {
3186
abort("'dynCall' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3187
};
3188
3189
if (!Object.getOwnPropertyDescriptor(Module, "callRuntimeCallbacks")) Module["callRuntimeCallbacks"] = function() {
3190
abort("'callRuntimeCallbacks' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3191
};
3192
3193
if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepaliveCounter")) Module["runtimeKeepaliveCounter"] = function() {
3194
abort("'runtimeKeepaliveCounter' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3195
};
3196
3197
if (!Object.getOwnPropertyDescriptor(Module, "keepRuntimeAlive")) Module["keepRuntimeAlive"] = function() {
3198
abort("'keepRuntimeAlive' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3199
};
3200
3201
if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePush")) Module["runtimeKeepalivePush"] = function() {
3202
abort("'runtimeKeepalivePush' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3203
};
3204
3205
if (!Object.getOwnPropertyDescriptor(Module, "runtimeKeepalivePop")) Module["runtimeKeepalivePop"] = function() {
3206
abort("'runtimeKeepalivePop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3207
};
3208
3209
if (!Object.getOwnPropertyDescriptor(Module, "callUserCallback")) Module["callUserCallback"] = function() {
3210
abort("'callUserCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3211
};
3212
3213
if (!Object.getOwnPropertyDescriptor(Module, "maybeExit")) Module["maybeExit"] = function() {
3214
abort("'maybeExit' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3215
};
3216
3217
if (!Object.getOwnPropertyDescriptor(Module, "asmjsMangle")) Module["asmjsMangle"] = function() {
3218
abort("'asmjsMangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3219
};
3220
3221
if (!Object.getOwnPropertyDescriptor(Module, "reallyNegative")) Module["reallyNegative"] = function() {
3222
abort("'reallyNegative' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3223
};
3224
3225
if (!Object.getOwnPropertyDescriptor(Module, "unSign")) Module["unSign"] = function() {
3226
abort("'unSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3227
};
3228
3229
if (!Object.getOwnPropertyDescriptor(Module, "reSign")) Module["reSign"] = function() {
3230
abort("'reSign' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3231
};
3232
3233
if (!Object.getOwnPropertyDescriptor(Module, "formatString")) Module["formatString"] = function() {
3234
abort("'formatString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3235
};
3236
3237
if (!Object.getOwnPropertyDescriptor(Module, "PATH")) Module["PATH"] = function() {
3238
abort("'PATH' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3239
};
3240
3241
if (!Object.getOwnPropertyDescriptor(Module, "PATH_FS")) Module["PATH_FS"] = function() {
3242
abort("'PATH_FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3243
};
3244
3245
if (!Object.getOwnPropertyDescriptor(Module, "SYSCALLS")) Module["SYSCALLS"] = function() {
3246
abort("'SYSCALLS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3247
};
3248
3249
if (!Object.getOwnPropertyDescriptor(Module, "syscallMmap2")) Module["syscallMmap2"] = function() {
3250
abort("'syscallMmap2' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3251
};
3252
3253
if (!Object.getOwnPropertyDescriptor(Module, "syscallMunmap")) Module["syscallMunmap"] = function() {
3254
abort("'syscallMunmap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3255
};
3256
3257
if (!Object.getOwnPropertyDescriptor(Module, "getSocketFromFD")) Module["getSocketFromFD"] = function() {
3258
abort("'getSocketFromFD' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3259
};
3260
3261
if (!Object.getOwnPropertyDescriptor(Module, "getSocketAddress")) Module["getSocketAddress"] = function() {
3262
abort("'getSocketAddress' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3263
};
3264
3265
if (!Object.getOwnPropertyDescriptor(Module, "JSEvents")) Module["JSEvents"] = function() {
3266
abort("'JSEvents' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3267
};
3268
3269
if (!Object.getOwnPropertyDescriptor(Module, "registerKeyEventCallback")) Module["registerKeyEventCallback"] = function() {
3270
abort("'registerKeyEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3271
};
3272
3273
if (!Object.getOwnPropertyDescriptor(Module, "specialHTMLTargets")) Module["specialHTMLTargets"] = function() {
3274
abort("'specialHTMLTargets' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3275
};
3276
3277
if (!Object.getOwnPropertyDescriptor(Module, "maybeCStringToJsString")) Module["maybeCStringToJsString"] = function() {
3278
abort("'maybeCStringToJsString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3279
};
3280
3281
if (!Object.getOwnPropertyDescriptor(Module, "findEventTarget")) Module["findEventTarget"] = function() {
3282
abort("'findEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3283
};
3284
3285
if (!Object.getOwnPropertyDescriptor(Module, "findCanvasEventTarget")) Module["findCanvasEventTarget"] = function() {
3286
abort("'findCanvasEventTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3287
};
3288
3289
if (!Object.getOwnPropertyDescriptor(Module, "getBoundingClientRect")) Module["getBoundingClientRect"] = function() {
3290
abort("'getBoundingClientRect' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3291
};
3292
3293
if (!Object.getOwnPropertyDescriptor(Module, "fillMouseEventData")) Module["fillMouseEventData"] = function() {
3294
abort("'fillMouseEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3295
};
3296
3297
if (!Object.getOwnPropertyDescriptor(Module, "registerMouseEventCallback")) Module["registerMouseEventCallback"] = function() {
3298
abort("'registerMouseEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3299
};
3300
3301
if (!Object.getOwnPropertyDescriptor(Module, "registerWheelEventCallback")) Module["registerWheelEventCallback"] = function() {
3302
abort("'registerWheelEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3303
};
3304
3305
if (!Object.getOwnPropertyDescriptor(Module, "registerUiEventCallback")) Module["registerUiEventCallback"] = function() {
3306
abort("'registerUiEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3307
};
3308
3309
if (!Object.getOwnPropertyDescriptor(Module, "registerFocusEventCallback")) Module["registerFocusEventCallback"] = function() {
3310
abort("'registerFocusEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3311
};
3312
3313
if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceOrientationEventData")) Module["fillDeviceOrientationEventData"] = function() {
3314
abort("'fillDeviceOrientationEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3315
};
3316
3317
if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceOrientationEventCallback")) Module["registerDeviceOrientationEventCallback"] = function() {
3318
abort("'registerDeviceOrientationEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3319
};
3320
3321
if (!Object.getOwnPropertyDescriptor(Module, "fillDeviceMotionEventData")) Module["fillDeviceMotionEventData"] = function() {
3322
abort("'fillDeviceMotionEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3323
};
3324
3325
if (!Object.getOwnPropertyDescriptor(Module, "registerDeviceMotionEventCallback")) Module["registerDeviceMotionEventCallback"] = function() {
3326
abort("'registerDeviceMotionEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3327
};
3328
3329
if (!Object.getOwnPropertyDescriptor(Module, "screenOrientation")) Module["screenOrientation"] = function() {
3330
abort("'screenOrientation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3331
};
3332
3333
if (!Object.getOwnPropertyDescriptor(Module, "fillOrientationChangeEventData")) Module["fillOrientationChangeEventData"] = function() {
3334
abort("'fillOrientationChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3335
};
3336
3337
if (!Object.getOwnPropertyDescriptor(Module, "registerOrientationChangeEventCallback")) Module["registerOrientationChangeEventCallback"] = function() {
3338
abort("'registerOrientationChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3339
};
3340
3341
if (!Object.getOwnPropertyDescriptor(Module, "fillFullscreenChangeEventData")) Module["fillFullscreenChangeEventData"] = function() {
3342
abort("'fillFullscreenChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3343
};
3344
3345
if (!Object.getOwnPropertyDescriptor(Module, "registerFullscreenChangeEventCallback")) Module["registerFullscreenChangeEventCallback"] = function() {
3346
abort("'registerFullscreenChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3347
};
3348
3349
if (!Object.getOwnPropertyDescriptor(Module, "registerRestoreOldStyle")) Module["registerRestoreOldStyle"] = function() {
3350
abort("'registerRestoreOldStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3351
};
3352
3353
if (!Object.getOwnPropertyDescriptor(Module, "hideEverythingExceptGivenElement")) Module["hideEverythingExceptGivenElement"] = function() {
3354
abort("'hideEverythingExceptGivenElement' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3355
};
3356
3357
if (!Object.getOwnPropertyDescriptor(Module, "restoreHiddenElements")) Module["restoreHiddenElements"] = function() {
3358
abort("'restoreHiddenElements' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3359
};
3360
3361
if (!Object.getOwnPropertyDescriptor(Module, "setLetterbox")) Module["setLetterbox"] = function() {
3362
abort("'setLetterbox' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3363
};
3364
3365
if (!Object.getOwnPropertyDescriptor(Module, "currentFullscreenStrategy")) Module["currentFullscreenStrategy"] = function() {
3366
abort("'currentFullscreenStrategy' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3367
};
3368
3369
if (!Object.getOwnPropertyDescriptor(Module, "restoreOldWindowedStyle")) Module["restoreOldWindowedStyle"] = function() {
3370
abort("'restoreOldWindowedStyle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3371
};
3372
3373
if (!Object.getOwnPropertyDescriptor(Module, "softFullscreenResizeWebGLRenderTarget")) Module["softFullscreenResizeWebGLRenderTarget"] = function() {
3374
abort("'softFullscreenResizeWebGLRenderTarget' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3375
};
3376
3377
if (!Object.getOwnPropertyDescriptor(Module, "doRequestFullscreen")) Module["doRequestFullscreen"] = function() {
3378
abort("'doRequestFullscreen' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3379
};
3380
3381
if (!Object.getOwnPropertyDescriptor(Module, "fillPointerlockChangeEventData")) Module["fillPointerlockChangeEventData"] = function() {
3382
abort("'fillPointerlockChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3383
};
3384
3385
if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockChangeEventCallback")) Module["registerPointerlockChangeEventCallback"] = function() {
3386
abort("'registerPointerlockChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3387
};
3388
3389
if (!Object.getOwnPropertyDescriptor(Module, "registerPointerlockErrorEventCallback")) Module["registerPointerlockErrorEventCallback"] = function() {
3390
abort("'registerPointerlockErrorEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3391
};
3392
3393
if (!Object.getOwnPropertyDescriptor(Module, "requestPointerLock")) Module["requestPointerLock"] = function() {
3394
abort("'requestPointerLock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3395
};
3396
3397
if (!Object.getOwnPropertyDescriptor(Module, "fillVisibilityChangeEventData")) Module["fillVisibilityChangeEventData"] = function() {
3398
abort("'fillVisibilityChangeEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3399
};
3400
3401
if (!Object.getOwnPropertyDescriptor(Module, "registerVisibilityChangeEventCallback")) Module["registerVisibilityChangeEventCallback"] = function() {
3402
abort("'registerVisibilityChangeEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3403
};
3404
3405
if (!Object.getOwnPropertyDescriptor(Module, "registerTouchEventCallback")) Module["registerTouchEventCallback"] = function() {
3406
abort("'registerTouchEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3407
};
3408
3409
if (!Object.getOwnPropertyDescriptor(Module, "fillGamepadEventData")) Module["fillGamepadEventData"] = function() {
3410
abort("'fillGamepadEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3411
};
3412
3413
if (!Object.getOwnPropertyDescriptor(Module, "registerGamepadEventCallback")) Module["registerGamepadEventCallback"] = function() {
3414
abort("'registerGamepadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3415
};
3416
3417
if (!Object.getOwnPropertyDescriptor(Module, "registerBeforeUnloadEventCallback")) Module["registerBeforeUnloadEventCallback"] = function() {
3418
abort("'registerBeforeUnloadEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3419
};
3420
3421
if (!Object.getOwnPropertyDescriptor(Module, "fillBatteryEventData")) Module["fillBatteryEventData"] = function() {
3422
abort("'fillBatteryEventData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3423
};
3424
3425
if (!Object.getOwnPropertyDescriptor(Module, "battery")) Module["battery"] = function() {
3426
abort("'battery' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3427
};
3428
3429
if (!Object.getOwnPropertyDescriptor(Module, "registerBatteryEventCallback")) Module["registerBatteryEventCallback"] = function() {
3430
abort("'registerBatteryEventCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3431
};
3432
3433
if (!Object.getOwnPropertyDescriptor(Module, "setCanvasElementSize")) Module["setCanvasElementSize"] = function() {
3434
abort("'setCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3435
};
3436
3437
if (!Object.getOwnPropertyDescriptor(Module, "getCanvasElementSize")) Module["getCanvasElementSize"] = function() {
3438
abort("'getCanvasElementSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3439
};
3440
3441
if (!Object.getOwnPropertyDescriptor(Module, "polyfillSetImmediate")) Module["polyfillSetImmediate"] = function() {
3442
abort("'polyfillSetImmediate' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3443
};
3444
3445
if (!Object.getOwnPropertyDescriptor(Module, "demangle")) Module["demangle"] = function() {
3446
abort("'demangle' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3447
};
3448
3449
if (!Object.getOwnPropertyDescriptor(Module, "demangleAll")) Module["demangleAll"] = function() {
3450
abort("'demangleAll' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3451
};
3452
3453
if (!Object.getOwnPropertyDescriptor(Module, "jsStackTrace")) Module["jsStackTrace"] = function() {
3454
abort("'jsStackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3455
};
3456
3457
if (!Object.getOwnPropertyDescriptor(Module, "stackTrace")) Module["stackTrace"] = function() {
3458
abort("'stackTrace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3459
};
3460
3461
if (!Object.getOwnPropertyDescriptor(Module, "getEnvStrings")) Module["getEnvStrings"] = function() {
3462
abort("'getEnvStrings' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3463
};
3464
3465
if (!Object.getOwnPropertyDescriptor(Module, "checkWasiClock")) Module["checkWasiClock"] = function() {
3466
abort("'checkWasiClock' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3467
};
3468
3469
if (!Object.getOwnPropertyDescriptor(Module, "flush_NO_FILESYSTEM")) Module["flush_NO_FILESYSTEM"] = function() {
3470
abort("'flush_NO_FILESYSTEM' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3471
};
3472
3473
if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64")) Module["writeI53ToI64"] = function() {
3474
abort("'writeI53ToI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3475
};
3476
3477
if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Clamped")) Module["writeI53ToI64Clamped"] = function() {
3478
abort("'writeI53ToI64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3479
};
3480
3481
if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToI64Signaling")) Module["writeI53ToI64Signaling"] = function() {
3482
abort("'writeI53ToI64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3483
};
3484
3485
if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Clamped")) Module["writeI53ToU64Clamped"] = function() {
3486
abort("'writeI53ToU64Clamped' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3487
};
3488
3489
if (!Object.getOwnPropertyDescriptor(Module, "writeI53ToU64Signaling")) Module["writeI53ToU64Signaling"] = function() {
3490
abort("'writeI53ToU64Signaling' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3491
};
3492
3493
if (!Object.getOwnPropertyDescriptor(Module, "readI53FromI64")) Module["readI53FromI64"] = function() {
3494
abort("'readI53FromI64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3495
};
3496
3497
if (!Object.getOwnPropertyDescriptor(Module, "readI53FromU64")) Module["readI53FromU64"] = function() {
3498
abort("'readI53FromU64' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3499
};
3500
3501
if (!Object.getOwnPropertyDescriptor(Module, "convertI32PairToI53")) Module["convertI32PairToI53"] = function() {
3502
abort("'convertI32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3503
};
3504
3505
if (!Object.getOwnPropertyDescriptor(Module, "convertU32PairToI53")) Module["convertU32PairToI53"] = function() {
3506
abort("'convertU32PairToI53' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3507
};
3508
3509
if (!Object.getOwnPropertyDescriptor(Module, "uncaughtExceptionCount")) Module["uncaughtExceptionCount"] = function() {
3510
abort("'uncaughtExceptionCount' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3511
};
3512
3513
if (!Object.getOwnPropertyDescriptor(Module, "exceptionLast")) Module["exceptionLast"] = function() {
3514
abort("'exceptionLast' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3515
};
3516
3517
if (!Object.getOwnPropertyDescriptor(Module, "exceptionCaught")) Module["exceptionCaught"] = function() {
3518
abort("'exceptionCaught' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3519
};
3520
3521
if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfoAttrs")) Module["ExceptionInfoAttrs"] = function() {
3522
abort("'ExceptionInfoAttrs' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3523
};
3524
3525
if (!Object.getOwnPropertyDescriptor(Module, "ExceptionInfo")) Module["ExceptionInfo"] = function() {
3526
abort("'ExceptionInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3527
};
3528
3529
if (!Object.getOwnPropertyDescriptor(Module, "CatchInfo")) Module["CatchInfo"] = function() {
3530
abort("'CatchInfo' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3531
};
3532
3533
if (!Object.getOwnPropertyDescriptor(Module, "exception_addRef")) Module["exception_addRef"] = function() {
3534
abort("'exception_addRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3535
};
3536
3537
if (!Object.getOwnPropertyDescriptor(Module, "exception_decRef")) Module["exception_decRef"] = function() {
3538
abort("'exception_decRef' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3539
};
3540
3541
if (!Object.getOwnPropertyDescriptor(Module, "Browser")) Module["Browser"] = function() {
3542
abort("'Browser' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3543
};
3544
3545
if (!Object.getOwnPropertyDescriptor(Module, "funcWrappers")) Module["funcWrappers"] = function() {
3546
abort("'funcWrappers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3547
};
3548
3549
if (!Object.getOwnPropertyDescriptor(Module, "getFuncWrapper")) Module["getFuncWrapper"] = function() {
3550
abort("'getFuncWrapper' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3551
};
3552
3553
if (!Object.getOwnPropertyDescriptor(Module, "setMainLoop")) Module["setMainLoop"] = function() {
3554
abort("'setMainLoop' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3555
};
3556
3557
if (!Object.getOwnPropertyDescriptor(Module, "tempFixedLengthArray")) Module["tempFixedLengthArray"] = function() {
3558
abort("'tempFixedLengthArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3559
};
3560
3561
if (!Object.getOwnPropertyDescriptor(Module, "miniTempWebGLFloatBuffers")) Module["miniTempWebGLFloatBuffers"] = function() {
3562
abort("'miniTempWebGLFloatBuffers' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3563
};
3564
3565
if (!Object.getOwnPropertyDescriptor(Module, "heapObjectForWebGLType")) Module["heapObjectForWebGLType"] = function() {
3566
abort("'heapObjectForWebGLType' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3567
};
3568
3569
if (!Object.getOwnPropertyDescriptor(Module, "heapAccessShiftForWebGLHeap")) Module["heapAccessShiftForWebGLHeap"] = function() {
3570
abort("'heapAccessShiftForWebGLHeap' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3571
};
3572
3573
if (!Object.getOwnPropertyDescriptor(Module, "GL")) Module["GL"] = function() {
3574
abort("'GL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3575
};
3576
3577
if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGet")) Module["emscriptenWebGLGet"] = function() {
3578
abort("'emscriptenWebGLGet' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3579
};
3580
3581
if (!Object.getOwnPropertyDescriptor(Module, "computeUnpackAlignedImageSize")) Module["computeUnpackAlignedImageSize"] = function() {
3582
abort("'computeUnpackAlignedImageSize' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3583
};
3584
3585
if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetTexPixelData")) Module["emscriptenWebGLGetTexPixelData"] = function() {
3586
abort("'emscriptenWebGLGetTexPixelData' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3587
};
3588
3589
if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetUniform")) Module["emscriptenWebGLGetUniform"] = function() {
3590
abort("'emscriptenWebGLGetUniform' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3591
};
3592
3593
if (!Object.getOwnPropertyDescriptor(Module, "webglGetUniformLocation")) Module["webglGetUniformLocation"] = function() {
3594
abort("'webglGetUniformLocation' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3595
};
3596
3597
if (!Object.getOwnPropertyDescriptor(Module, "webglPrepareUniformLocationsBeforeFirstUse")) Module["webglPrepareUniformLocationsBeforeFirstUse"] = function() {
3598
abort("'webglPrepareUniformLocationsBeforeFirstUse' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3599
};
3600
3601
if (!Object.getOwnPropertyDescriptor(Module, "webglGetLeftBracePos")) Module["webglGetLeftBracePos"] = function() {
3602
abort("'webglGetLeftBracePos' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3603
};
3604
3605
if (!Object.getOwnPropertyDescriptor(Module, "emscriptenWebGLGetVertexAttrib")) Module["emscriptenWebGLGetVertexAttrib"] = function() {
3606
abort("'emscriptenWebGLGetVertexAttrib' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3607
};
3608
3609
if (!Object.getOwnPropertyDescriptor(Module, "writeGLArray")) Module["writeGLArray"] = function() {
3610
abort("'writeGLArray' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3611
};
3612
3613
if (!Object.getOwnPropertyDescriptor(Module, "FS")) Module["FS"] = function() {
3614
abort("'FS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3615
};
3616
3617
if (!Object.getOwnPropertyDescriptor(Module, "mmapAlloc")) Module["mmapAlloc"] = function() {
3618
abort("'mmapAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3619
};
3620
3621
if (!Object.getOwnPropertyDescriptor(Module, "MEMFS")) Module["MEMFS"] = function() {
3622
abort("'MEMFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3623
};
3624
3625
if (!Object.getOwnPropertyDescriptor(Module, "TTY")) Module["TTY"] = function() {
3626
abort("'TTY' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3627
};
3628
3629
if (!Object.getOwnPropertyDescriptor(Module, "PIPEFS")) Module["PIPEFS"] = function() {
3630
abort("'PIPEFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3631
};
3632
3633
if (!Object.getOwnPropertyDescriptor(Module, "SOCKFS")) Module["SOCKFS"] = function() {
3634
abort("'SOCKFS' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3635
};
3636
3637
if (!Object.getOwnPropertyDescriptor(Module, "_setNetworkCallback")) Module["_setNetworkCallback"] = function() {
3638
abort("'_setNetworkCallback' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3639
};
3640
3641
if (!Object.getOwnPropertyDescriptor(Module, "AL")) Module["AL"] = function() {
3642
abort("'AL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3643
};
3644
3645
if (!Object.getOwnPropertyDescriptor(Module, "SDL_unicode")) Module["SDL_unicode"] = function() {
3646
abort("'SDL_unicode' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3647
};
3648
3649
if (!Object.getOwnPropertyDescriptor(Module, "SDL_ttfContext")) Module["SDL_ttfContext"] = function() {
3650
abort("'SDL_ttfContext' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3651
};
3652
3653
if (!Object.getOwnPropertyDescriptor(Module, "SDL_audio")) Module["SDL_audio"] = function() {
3654
abort("'SDL_audio' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3655
};
3656
3657
if (!Object.getOwnPropertyDescriptor(Module, "SDL")) Module["SDL"] = function() {
3658
abort("'SDL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3659
};
3660
3661
if (!Object.getOwnPropertyDescriptor(Module, "SDL_gfx")) Module["SDL_gfx"] = function() {
3662
abort("'SDL_gfx' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3663
};
3664
3665
if (!Object.getOwnPropertyDescriptor(Module, "GLUT")) Module["GLUT"] = function() {
3666
abort("'GLUT' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3667
};
3668
3669
if (!Object.getOwnPropertyDescriptor(Module, "EGL")) Module["EGL"] = function() {
3670
abort("'EGL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3671
};
3672
3673
if (!Object.getOwnPropertyDescriptor(Module, "GLFW_Window")) Module["GLFW_Window"] = function() {
3674
abort("'GLFW_Window' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3675
};
3676
3677
if (!Object.getOwnPropertyDescriptor(Module, "GLFW")) Module["GLFW"] = function() {
3678
abort("'GLFW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3679
};
3680
3681
if (!Object.getOwnPropertyDescriptor(Module, "GLEW")) Module["GLEW"] = function() {
3682
abort("'GLEW' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3683
};
3684
3685
if (!Object.getOwnPropertyDescriptor(Module, "IDBStore")) Module["IDBStore"] = function() {
3686
abort("'IDBStore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3687
};
3688
3689
if (!Object.getOwnPropertyDescriptor(Module, "runAndAbortIfError")) Module["runAndAbortIfError"] = function() {
3690
abort("'runAndAbortIfError' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3691
};
3692
3693
Module["PThread"] = PThread;
3694
3695
if (!Object.getOwnPropertyDescriptor(Module, "killThread")) Module["killThread"] = function() {
3696
abort("'killThread' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3697
};
3698
3699
if (!Object.getOwnPropertyDescriptor(Module, "cleanupThread")) Module["cleanupThread"] = function() {
3700
abort("'cleanupThread' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3701
};
3702
3703
if (!Object.getOwnPropertyDescriptor(Module, "cancelThread")) Module["cancelThread"] = function() {
3704
abort("'cancelThread' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3705
};
3706
3707
if (!Object.getOwnPropertyDescriptor(Module, "spawnThread")) Module["spawnThread"] = function() {
3708
abort("'spawnThread' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3709
};
3710
3711
if (!Object.getOwnPropertyDescriptor(Module, "establishStackSpace")) Module["establishStackSpace"] = function() {
3712
abort("'establishStackSpace' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3713
};
3714
3715
if (!Object.getOwnPropertyDescriptor(Module, "invokeEntryPoint")) Module["invokeEntryPoint"] = function() {
3716
abort("'invokeEntryPoint' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3717
};
3718
3719
if (!Object.getOwnPropertyDescriptor(Module, "warnOnce")) Module["warnOnce"] = function() {
3720
abort("'warnOnce' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3721
};
3722
3723
if (!Object.getOwnPropertyDescriptor(Module, "stackSave")) Module["stackSave"] = function() {
3724
abort("'stackSave' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3725
};
3726
3727
if (!Object.getOwnPropertyDescriptor(Module, "stackRestore")) Module["stackRestore"] = function() {
3728
abort("'stackRestore' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3729
};
3730
3731
if (!Object.getOwnPropertyDescriptor(Module, "stackAlloc")) Module["stackAlloc"] = function() {
3732
abort("'stackAlloc' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3733
};
3734
3735
if (!Object.getOwnPropertyDescriptor(Module, "AsciiToString")) Module["AsciiToString"] = function() {
3736
abort("'AsciiToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3737
};
3738
3739
if (!Object.getOwnPropertyDescriptor(Module, "stringToAscii")) Module["stringToAscii"] = function() {
3740
abort("'stringToAscii' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3741
};
3742
3743
if (!Object.getOwnPropertyDescriptor(Module, "UTF16ToString")) Module["UTF16ToString"] = function() {
3744
abort("'UTF16ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3745
};
3746
3747
if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF16")) Module["stringToUTF16"] = function() {
3748
abort("'stringToUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3749
};
3750
3751
if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF16")) Module["lengthBytesUTF16"] = function() {
3752
abort("'lengthBytesUTF16' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3753
};
3754
3755
if (!Object.getOwnPropertyDescriptor(Module, "UTF32ToString")) Module["UTF32ToString"] = function() {
3756
abort("'UTF32ToString' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3757
};
3758
3759
if (!Object.getOwnPropertyDescriptor(Module, "stringToUTF32")) Module["stringToUTF32"] = function() {
3760
abort("'stringToUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3761
};
3762
3763
if (!Object.getOwnPropertyDescriptor(Module, "lengthBytesUTF32")) Module["lengthBytesUTF32"] = function() {
3764
abort("'lengthBytesUTF32' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3765
};
3766
3767
if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8")) Module["allocateUTF8"] = function() {
3768
abort("'allocateUTF8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3769
};
3770
3771
if (!Object.getOwnPropertyDescriptor(Module, "allocateUTF8OnStack")) Module["allocateUTF8OnStack"] = function() {
3772
abort("'allocateUTF8OnStack' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3773
};
3774
3775
Module["writeStackCookie"] = writeStackCookie;
3776
3777
Module["checkStackCookie"] = checkStackCookie;
3778
3779
Module["PThread"] = PThread;
3780
3781
Module["wasmMemory"] = wasmMemory;
3782
3783
Module["ExitStatus"] = ExitStatus;
3784
3785
if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_NORMAL")) Object.defineProperty(Module, "ALLOC_NORMAL", {
3786
configurable: true,
3787
get: function() {
3788
abort("'ALLOC_NORMAL' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3789
}
3790
});
3791
3792
if (!Object.getOwnPropertyDescriptor(Module, "ALLOC_STACK")) Object.defineProperty(Module, "ALLOC_STACK", {
3793
configurable: true,
3794
get: function() {
3795
abort("'ALLOC_STACK' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)");
3796
}
3797
});
3798
3799
var calledRun;
3800
3801
function ExitStatus(status) {
3802
this.name = "ExitStatus";
3803
this.message = "Program terminated with exit(" + status + ")";
3804
this.status = status;
3805
}
3806
3807
var calledMain = false;
3808
3809
dependenciesFulfilled = function runCaller() {
3810
if (!calledRun) run();
3811
if (!calledRun) dependenciesFulfilled = runCaller;
3812
};
3813
3814
function callMain(args) {
3815
assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
3816
assert(__ATPRERUN__.length == 0, "cannot call main when preRun functions remain to be called");
3817
var entryFunction = Module["_emscripten_proxy_main"];
3818
args = args || [];
3819
var argc = args.length + 1;
3820
var argv = stackAlloc((argc + 1) * 4);
3821
GROWABLE_HEAP_I32()[argv >> 2] = allocateUTF8OnStack(thisProgram);
3822
for (var i = 1; i < argc; i++) {
3823
GROWABLE_HEAP_I32()[(argv >> 2) + i] = allocateUTF8OnStack(args[i - 1]);
3824
}
3825
GROWABLE_HEAP_I32()[(argv >> 2) + argc] = 0;
3826
try {
3827
var ret = entryFunction(argc, argv);
3828
assert(ret == 0, "_emscripten_proxy_main failed to start proxy thread: " + ret);
3829
} finally {
3830
calledMain = true;
3831
}
3832
}
3833
3834
function stackCheckInit() {
3835
_emscripten_stack_init();
3836
writeStackCookie();
3837
}
3838
3839
function run(args) {
3840
args = args || arguments_;
3841
if (runDependencies > 0) {
3842
return;
3843
}
3844
stackCheckInit();
3845
if (ENVIRONMENT_IS_PTHREAD) {
3846
initRuntime();
3847
postMessage({
3848
"cmd": "loaded"
3849
});
3850
return;
3851
}
3852
preRun();
3853
if (runDependencies > 0) {
3854
return;
3855
}
3856
function doRun() {
3857
if (calledRun) return;
3858
calledRun = true;
3859
Module["calledRun"] = true;
3860
if (ABORT) return;
3861
initRuntime();
3862
preMain();
3863
if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
3864
if (shouldRunNow) callMain(args);
3865
postRun();
3866
}
3867
if (Module["setStatus"]) {
3868
Module["setStatus"]("Running...");
3869
setTimeout(function() {
3870
setTimeout(function() {
3871
Module["setStatus"]("");
3872
}, 1);
3873
doRun();
3874
}, 1);
3875
} else {
3876
doRun();
3877
}
3878
checkStackCookie();
3879
}
3880
3881
Module["run"] = run;
3882
3883
function checkUnflushedContent() {
3884
var oldOut = out;
3885
var oldErr = err;
3886
var has = false;
3887
out = err = function(x) {
3888
has = true;
3889
};
3890
try {
3891
var flush = flush_NO_FILESYSTEM;
3892
if (flush) flush();
3893
} catch (e) {}
3894
out = oldOut;
3895
err = oldErr;
3896
if (has) {
3897
warnOnce("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.");
3898
warnOnce("(this may also be due to not including full filesystem support - try building with -s FORCE_FILESYSTEM=1)");
3899
}
3900
}
3901
3902
function exit(status, implicit) {
3903
EXITSTATUS = status;
3904
checkUnflushedContent();
3905
if (implicit && keepRuntimeAlive() && status === 0) {
3906
return;
3907
}
3908
if (!implicit) {
3909
if (ENVIRONMENT_IS_PTHREAD) {
3910
err("Pthread 0x" + _pthread_self().toString(16) + " called exit(), posting exitProcess.");
3911
postMessage({
3912
"cmd": "exitProcess",
3913
"returnCode": status
3914
});
3915
throw new ExitStatus(status);
3916
} else {
3917
err("main thread called exit: keepRuntimeAlive=" + keepRuntimeAlive() + " (counter=" + runtimeKeepaliveCounter + ")");
3918
}
3919
}
3920
if (keepRuntimeAlive()) {
3921
if (!implicit) {
3922
var msg = "program exited (with status: " + status + "), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)";
3923
err(msg);
3924
}
3925
} else {
3926
PThread.terminateAllThreads();
3927
exitRuntime();
3928
if (Module["onExit"]) Module["onExit"](status);
3929
ABORT = true;
3930
}
3931
quit_(status, new ExitStatus(status));
3932
}
3933
3934
if (Module["preInit"]) {
3935
if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ];
3936
while (Module["preInit"].length > 0) {
3937
Module["preInit"].pop()();
3938
}
3939
}
3940
3941
var shouldRunNow = true;
3942
3943
if (Module["noInitialRun"]) shouldRunNow = false;
3944
3945
if (ENVIRONMENT_IS_PTHREAD) {
3946
noExitRuntime = false;
3947
PThread.initWorker();
3948
}
3949
3950
run();
3951
3952