diff --git a/static/OpenBirchWasm/OpenBirch.js b/static/OpenBirchWasm/OpenBirch.js old mode 100644 new mode 100755 index d6c36b1..e43cd9a --- a/static/OpenBirchWasm/OpenBirch.js +++ b/static/OpenBirchWasm/OpenBirch.js @@ -12,7 +12,7 @@ // after the generated code, you will need to define var Module = {}; // before the code. Then that object will be used in the code, and you // can continue to use Module afterwards as well. -var Module2 = typeof Module2 != 'undefined' ? Module2 : {}; +var Module = typeof Module != 'undefined' ? Module : {}; // Determine the runtime environment we are in. You can customize this by // setting the ENVIRONMENT setting at compile time (see settings.js). @@ -25,7 +25,7 @@ var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string'; var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; -if (Module2['ENVIRONMENT']) { +if (Module['ENVIRONMENT']) { throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)'); } @@ -46,7 +46,7 @@ if (ENVIRONMENT_IS_NODE) { // we collect those properties and reapply _after_ we configure // the current environment's defaults to avoid having to be so // defensive during initialization. -var moduleOverrides = Object.assign({}, Module2); +var moduleOverrides = Object.assign({}, Module); var arguments_ = []; var thisProgram = './this.program'; @@ -57,8 +57,8 @@ var quit_ = (status, toThrow) => { // `/` should be present at the end if `scriptDirectory` is not empty var scriptDirectory = ''; function locateFile(path) { - if (Module2['locateFile']) { - return Module2['locateFile'](path, scriptDirectory); + if (Module['locateFile']) { + return Module['locateFile'](path, scriptDirectory); } return scriptDirectory + path; } @@ -105,14 +105,14 @@ readAsync = (filename, binary = true) => { }); }; // end include: node_shell_read.js - if (!Module2['thisProgram'] && process.argv.length > 1) { + if (!Module['thisProgram'] && process.argv.length > 1) { thisProgram = process.argv[1].replace(/\\/g, '/'); } arguments_ = process.argv.slice(2); if (typeof module != 'undefined') { - module['exports'] = Module2; + module['exports'] = Module; } process.on('uncaughtException', (ex) => { @@ -204,11 +204,11 @@ if (ENVIRONMENT_IS_WORKER) { throw new Error('environment detection error'); } -var out = Module2['print'] || console.log.bind(console); -var err = Module2['printErr'] || console.error.bind(console); +var out = Module['print'] || console.log.bind(console); +var err = Module['printErr'] || console.error.bind(console); // Merge back in the overrides -Object.assign(Module2, moduleOverrides); +Object.assign(Module, moduleOverrides); // Free the object hierarchy contained in the overrides, this lets the GC // reclaim data used. moduleOverrides = null; @@ -219,23 +219,23 @@ checkIncomingModuleAPI(); // expected to arrive, and second, by using a local everywhere else that can be // minified. -if (Module2['arguments']) arguments_ = Module2['arguments'];legacyModuleProp('arguments', 'arguments_'); +if (Module['arguments']) arguments_ = Module['arguments'];legacyModuleProp('arguments', 'arguments_'); -if (Module2['thisProgram']) thisProgram = Module2['thisProgram'];legacyModuleProp('thisProgram', 'thisProgram'); +if (Module['thisProgram']) thisProgram = Module['thisProgram'];legacyModuleProp('thisProgram', 'thisProgram'); -if (Module2['quit']) quit_ = Module2['quit'];legacyModuleProp('quit', 'quit_'); +if (Module['quit']) quit_ = Module['quit'];legacyModuleProp('quit', 'quit_'); // perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message // Assertions on removed incoming Module JS APIs. -assert(typeof Module2['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead'); -assert(typeof Module2['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead'); -assert(typeof Module2['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead'); -assert(typeof Module2['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead'); -assert(typeof Module2['read'] == 'undefined', 'Module.read option was removed'); -assert(typeof Module2['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)'); -assert(typeof Module2['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)'); -assert(typeof Module2['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)'); -assert(typeof Module2['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY'); +assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead'); +assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead'); +assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead'); +assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead'); +assert(typeof Module['read'] == 'undefined', 'Module.read option was removed'); +assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)'); +assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)'); +assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)'); +assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY'); legacyModuleProp('asm', 'wasmExports'); legacyModuleProp('readAsync', 'readAsync'); legacyModuleProp('readBinary', 'readBinary'); @@ -266,7 +266,7 @@ assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at bui // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html var wasmBinary; -if (Module2['wasmBinary']) wasmBinary = Module2['wasmBinary'];legacyModuleProp('wasmBinary', 'wasmBinary'); +if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];legacyModuleProp('wasmBinary', 'wasmBinary'); if (typeof WebAssembly != 'object') { err('no native wasm support detected'); @@ -352,24 +352,24 @@ var HEAP, // include: runtime_shared.js function updateMemoryViews() { var b = wasmMemory.buffer; - Module2['HEAP8'] = HEAP8 = new Int8Array(b); - Module2['HEAP16'] = HEAP16 = new Int16Array(b); - Module2['HEAPU8'] = HEAPU8 = new Uint8Array(b); - Module2['HEAPU16'] = HEAPU16 = new Uint16Array(b); - Module2['HEAP32'] = HEAP32 = new Int32Array(b); - Module2['HEAPU32'] = HEAPU32 = new Uint32Array(b); - Module2['HEAPF32'] = HEAPF32 = new Float32Array(b); - Module2['HEAPF64'] = HEAPF64 = new Float64Array(b); + Module['HEAP8'] = HEAP8 = new Int8Array(b); + Module['HEAP16'] = HEAP16 = new Int16Array(b); + Module['HEAPU8'] = HEAPU8 = new Uint8Array(b); + Module['HEAPU16'] = HEAPU16 = new Uint16Array(b); + Module['HEAP32'] = HEAP32 = new Int32Array(b); + Module['HEAPU32'] = HEAPU32 = new Uint32Array(b); + Module['HEAPF32'] = HEAPF32 = new Float32Array(b); + Module['HEAPF64'] = HEAPF64 = new Float64Array(b); } // end include: runtime_shared.js -assert(!Module2['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time') +assert(!Module['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time') assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, 'JS engine does not provide full typed array support'); // If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY -assert(!Module2['wasmMemory'], 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally'); -assert(!Module2['INITIAL_MEMORY'], 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically'); +assert(!Module['wasmMemory'], 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally'); +assert(!Module['INITIAL_MEMORY'], 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically'); // include: runtime_stack_check.js // Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode. @@ -427,10 +427,10 @@ var __ATPOSTRUN__ = []; // functions called after the main() is called var runtimeInitialized = false; function preRun() { - if (Module2['preRun']) { - if (typeof Module2['preRun'] == 'function') Module2['preRun'] = [Module2['preRun']]; - while (Module2['preRun'].length) { - addOnPreRun(Module2['preRun'].shift()); + if (Module['preRun']) { + if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; + while (Module['preRun'].length) { + addOnPreRun(Module['preRun'].shift()); } } callRuntimeCallbacks(__ATPRERUN__); @@ -443,7 +443,7 @@ function initRuntime() { checkStackCookie(); -if (!Module2['noFSInit'] && !FS.init.initialized) +if (!Module['noFSInit'] && !FS.init.initialized) FS.init(); FS.ignorePermissions = false; @@ -454,10 +454,10 @@ TTY.init(); function postRun() { checkStackCookie(); - if (Module2['postRun']) { - if (typeof Module2['postRun'] == 'function') Module2['postRun'] = [Module2['postRun']]; - while (Module2['postRun'].length) { - addOnPostRun(Module2['postRun'].shift()); + if (Module['postRun']) { + if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; + while (Module['postRun'].length) { + addOnPostRun(Module['postRun'].shift()); } } @@ -516,7 +516,7 @@ function getUniqueRunDependency(id) { function addRunDependency(id) { runDependencies++; - Module2['monitorRunDependencies']?.(runDependencies); + Module['monitorRunDependencies']?.(runDependencies); if (id) { assert(!runDependencyTracking[id]); @@ -550,7 +550,7 @@ function addRunDependency(id) { function removeRunDependency(id) { runDependencies--; - Module2['monitorRunDependencies']?.(runDependencies); + Module['monitorRunDependencies']?.(runDependencies); if (id) { assert(runDependencyTracking[id]); @@ -573,7 +573,7 @@ function removeRunDependency(id) { /** @param {string|number=} what */ function abort(what) { - Module2['onAbort']?.(what); + Module['onAbort']?.(what); what = 'Aborted(' + what + ')'; // TODO(sbc): Should we remove printing and leave it up to whoever @@ -778,11 +778,11 @@ function createWasm() { // Async compilation can be confusing when an error on the page overwrites Module // (for example, if the order of elements is wrong, and the one defining Module is // later), so we save Module and check it later. - var trueModule = Module2; + var trueModule = Module; function receiveInstantiationResult(result) { // 'result' is a ResultObject object which has both the module and instance. // receiveInstance() will swap in the exports (to Module.asm) so they can be called - assert(Module2 === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?'); + assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?'); trueModule = null; // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line. // When the regression is fixed, can restore the above PTHREADS-enabled path. @@ -795,9 +795,9 @@ function createWasm() { // performing. // Also pthreads and wasm workers initialize the wasm instance through this // path. - if (Module2['instantiateWasm']) { + if (Module['instantiateWasm']) { try { - return Module2['instantiateWasm'](info, receiveInstance); + return Module['instantiateWasm'](info, receiveInstance); } catch(e) { err(`Module.instantiateWasm callback failed with error: ${e}`); return false; @@ -816,8 +816,8 @@ var tempI64; // include: runtime_debug.js function legacyModuleProp(prop, newName, incoming=true) { - if (!Object.getOwnPropertyDescriptor(Module2, prop)) { - Object.defineProperty(Module2, prop, { + if (!Object.getOwnPropertyDescriptor(Module, prop)) { + Object.defineProperty(Module, prop, { configurable: true, get() { let extra = incoming ? ' (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)' : ''; @@ -829,7 +829,7 @@ function legacyModuleProp(prop, newName, incoming=true) { } function ignoredModuleProp(prop) { - if (Object.getOwnPropertyDescriptor(Module2, prop)) { + if (Object.getOwnPropertyDescriptor(Module, prop)) { abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`); } } @@ -892,8 +892,8 @@ function missingLibrarySymbol(sym) { } function unexportedRuntimeSymbol(sym) { - if (!Object.getOwnPropertyDescriptor(Module2, sym)) { - Object.defineProperty(Module2, sym, { + if (!Object.getOwnPropertyDescriptor(Module, sym)) { + Object.defineProperty(Module, sym, { configurable: true, get() { var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`; @@ -923,15 +923,15 @@ function dbg(...args) { this.message = `Program terminated with exit(${status})`; this.status = status; } - Module2['ExitStatus'] = ExitStatus; + Module['ExitStatus'] = ExitStatus; var callRuntimeCallbacks = (callbacks) => { while (callbacks.length > 0) { // Pass the module as the first argument. - callbacks.shift()(Module2); + callbacks.shift()(Module); } }; - Module2['callRuntimeCallbacks'] = callRuntimeCallbacks; + Module['callRuntimeCallbacks'] = callRuntimeCallbacks; /** @@ -952,10 +952,10 @@ function dbg(...args) { default: abort(`invalid type for getValue: ${type}`); } } - Module2['getValue'] = getValue; + Module['getValue'] = getValue; - var noExitRuntime = Module2['noExitRuntime'] || true; - Module2['noExitRuntime'] = noExitRuntime; + var noExitRuntime = Module['noExitRuntime'] || true; + Module['noExitRuntime'] = noExitRuntime; var ptrToString = (ptr) => { assert(typeof ptr === 'number'); @@ -963,7 +963,7 @@ function dbg(...args) { ptr >>>= 0; return '0x' + ptr.toString(16).padStart(8, '0'); }; - Module2['ptrToString'] = ptrToString; + Module['ptrToString'] = ptrToString; /** @@ -985,13 +985,13 @@ function dbg(...args) { default: abort(`invalid type for setValue: ${type}`); } } - Module2['setValue'] = setValue; + Module['setValue'] = setValue; var stackRestore = (val) => __emscripten_stack_restore(val); - Module2['stackRestore'] = stackRestore; + Module['stackRestore'] = stackRestore; var stackSave = () => _emscripten_stack_get_current(); - Module2['stackSave'] = stackSave; + Module['stackSave'] = stackSave; var warnOnce = (text) => { warnOnce.shown ||= {}; @@ -1001,10 +1001,10 @@ function dbg(...args) { err(text); } }; - Module2['warnOnce'] = warnOnce; + Module['warnOnce'] = warnOnce; var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined; - Module2['UTF8Decoder'] = UTF8Decoder; + Module['UTF8Decoder'] = UTF8Decoder; /** * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given @@ -1057,7 +1057,7 @@ function dbg(...args) { } return str; }; - Module2['UTF8ArrayToString'] = UTF8ArrayToString; + Module['UTF8ArrayToString'] = UTF8ArrayToString; /** * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the @@ -1078,18 +1078,18 @@ function dbg(...args) { assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`); return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ''; }; - Module2['UTF8ToString'] = UTF8ToString; + Module['UTF8ToString'] = UTF8ToString; var ___assert_fail = (condition, filename, line, func) => { abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']); }; - Module2['___assert_fail'] = ___assert_fail; + Module['___assert_fail'] = ___assert_fail; var exceptionCaught = []; - Module2['exceptionCaught'] = exceptionCaught; + Module['exceptionCaught'] = exceptionCaught; var uncaughtExceptionCount = 0; - Module2['uncaughtExceptionCount'] = uncaughtExceptionCount; + Module['uncaughtExceptionCount'] = uncaughtExceptionCount; var ___cxa_begin_catch = (ptr) => { var info = new ExceptionInfo(ptr); if (!info.get_caught()) { @@ -1101,11 +1101,11 @@ function dbg(...args) { ___cxa_increment_exception_refcount(info.excPtr); return info.get_exception_ptr(); }; - Module2['___cxa_begin_catch'] = ___cxa_begin_catch; + Module['___cxa_begin_catch'] = ___cxa_begin_catch; var exceptionLast = 0; - Module2['exceptionLast'] = exceptionLast; + Module['exceptionLast'] = exceptionLast; var ___cxa_end_catch = () => { @@ -1118,7 +1118,7 @@ function dbg(...args) { ___cxa_decrement_exception_refcount(info.excPtr); exceptionLast = 0; // XXX in decRef? }; - Module2['___cxa_end_catch'] = ___cxa_end_catch; + Module['___cxa_end_catch'] = ___cxa_end_catch; class ExceptionInfo { @@ -1193,7 +1193,7 @@ function dbg(...args) { return this.excPtr; } } - Module2['ExceptionInfo'] = ExceptionInfo; + Module['ExceptionInfo'] = ExceptionInfo; var ___resumeException = (ptr) => { if (!exceptionLast) { @@ -1201,11 +1201,11 @@ function dbg(...args) { } throw exceptionLast; }; - Module2['___resumeException'] = ___resumeException; + Module['___resumeException'] = ___resumeException; var setTempRet0 = (val) => __emscripten_tempret_set(val); - Module2['setTempRet0'] = setTempRet0; + Module['setTempRet0'] = setTempRet0; var findMatchingCatch = (args) => { var thrown = exceptionLast?.excPtr; @@ -1242,15 +1242,15 @@ function dbg(...args) { setTempRet0(thrownType); return thrown; }; - Module2['findMatchingCatch'] = findMatchingCatch; + Module['findMatchingCatch'] = findMatchingCatch; var ___cxa_find_matching_catch_2 = () => findMatchingCatch([]); - Module2['___cxa_find_matching_catch_2'] = ___cxa_find_matching_catch_2; + Module['___cxa_find_matching_catch_2'] = ___cxa_find_matching_catch_2; var ___cxa_find_matching_catch_3 = (arg0) => findMatchingCatch([arg0]); - Module2['___cxa_find_matching_catch_3'] = ___cxa_find_matching_catch_3; + Module['___cxa_find_matching_catch_3'] = ___cxa_find_matching_catch_3; var ___cxa_find_matching_catch_5 = (arg0,arg1,arg2) => findMatchingCatch([arg0,arg1,arg2]); - Module2['___cxa_find_matching_catch_5'] = ___cxa_find_matching_catch_5; + Module['___cxa_find_matching_catch_5'] = ___cxa_find_matching_catch_5; @@ -1270,7 +1270,7 @@ function dbg(...args) { exceptionLast = new CppException(ptr); throw exceptionLast; }; - Module2['___cxa_rethrow'] = ___cxa_rethrow; + Module['___cxa_rethrow'] = ___cxa_rethrow; @@ -1282,10 +1282,10 @@ function dbg(...args) { uncaughtExceptionCount++; throw exceptionLast; }; - Module2['___cxa_throw'] = ___cxa_throw; + Module['___cxa_throw'] = ___cxa_throw; var ___cxa_uncaught_exceptions = () => uncaughtExceptionCount; - Module2['___cxa_uncaught_exceptions'] = ___cxa_uncaught_exceptions; + Module['___cxa_uncaught_exceptions'] = ___cxa_uncaught_exceptions; var PATH = { @@ -1356,7 +1356,7 @@ function dbg(...args) { join:(...paths) => PATH.normalize(paths.join('/')), join2:(l, r) => PATH.normalize(l + '/' + r), }; - Module2['PATH'] = PATH; + Module['PATH'] = PATH; var initRandomFill = () => { if (typeof crypto == 'object' && typeof crypto['getRandomValues'] == 'function') { @@ -1386,12 +1386,12 @@ function dbg(...args) { // we couldn't find a proper implementation, as Math.random() is not suitable for /dev/random, see emscripten-core/emscripten/pull/7096 abort('no cryptographic support found for randomDevice. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: (array) => { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };'); }; - Module2['initRandomFill'] = initRandomFill; + Module['initRandomFill'] = initRandomFill; var randomFill = (view) => { // Lazily init on the first invocation. return (randomFill = initRandomFill())(view); }; - Module2['randomFill'] = randomFill; + Module['randomFill'] = randomFill; @@ -1448,12 +1448,12 @@ function dbg(...args) { return outputParts.join('/'); }, }; - Module2['PATH_FS'] = PATH_FS; + Module['PATH_FS'] = PATH_FS; var FS_stdin_getChar_buffer = []; - Module2['FS_stdin_getChar_buffer'] = FS_stdin_getChar_buffer; + Module['FS_stdin_getChar_buffer'] = FS_stdin_getChar_buffer; var lengthBytesUTF8 = (str) => { var len = 0; @@ -1475,7 +1475,7 @@ function dbg(...args) { } return len; }; - Module2['lengthBytesUTF8'] = lengthBytesUTF8; + Module['lengthBytesUTF8'] = lengthBytesUTF8; var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`); @@ -1524,7 +1524,7 @@ function dbg(...args) { heap[outIdx] = 0; return outIdx - startIdx; }; - Module2['stringToUTF8Array'] = stringToUTF8Array; + Module['stringToUTF8Array'] = stringToUTF8Array; /** @type {function(string, boolean=, number=)} */ function intArrayFromString(stringy, dontAddNull, length) { var len = length > 0 ? length : lengthBytesUTF8(stringy)+1; @@ -1533,7 +1533,7 @@ function dbg(...args) { if (dontAddNull) u8array.length = numBytesWritten; return u8array; } - Module2['intArrayFromString'] = intArrayFromString; + Module['intArrayFromString'] = intArrayFromString; var FS_stdin_getChar = () => { if (!FS_stdin_getChar_buffer.length) { var result = null; @@ -1582,7 +1582,7 @@ function dbg(...args) { } return FS_stdin_getChar_buffer.shift(); }; - Module2['FS_stdin_getChar'] = FS_stdin_getChar; + Module['FS_stdin_getChar'] = FS_stdin_getChar; var TTY = { ttys:[], init() { @@ -1724,24 +1724,24 @@ function dbg(...args) { }, }, }; - Module2['TTY'] = TTY; + Module['TTY'] = TTY; var zeroMemory = (address, size) => { HEAPU8.fill(0, address, address + size); return address; }; - Module2['zeroMemory'] = zeroMemory; + Module['zeroMemory'] = zeroMemory; var alignMemory = (size, alignment) => { assert(alignment, "alignment argument is required"); return Math.ceil(size / alignment) * alignment; }; - Module2['alignMemory'] = alignMemory; + Module['alignMemory'] = alignMemory; var mmapAlloc = (size) => { abort('internal error: mmapAlloc called but `emscripten_builtin_memalign` native symbol not exported'); }; - Module2['mmapAlloc'] = mmapAlloc; + Module['mmapAlloc'] = mmapAlloc; var MEMFS = { ops_table:null, mount(mount) { @@ -2063,7 +2063,7 @@ function dbg(...args) { }, }, }; - Module2['MEMFS'] = MEMFS; + Module['MEMFS'] = MEMFS; /** @param {boolean=} noRunDep */ var asyncLoad = (url, onload, onerror, noRunDep) => { @@ -2084,16 +2084,16 @@ function dbg(...args) { ); if (dep) addRunDependency(dep); }; - Module2['asyncLoad'] = asyncLoad; + Module['asyncLoad'] = asyncLoad; var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => { FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); }; - Module2['FS_createDataFile'] = FS_createDataFile; + Module['FS_createDataFile'] = FS_createDataFile; - var preloadPlugins = Module2['preloadPlugins'] || []; - Module2['preloadPlugins'] = preloadPlugins; + var preloadPlugins = Module['preloadPlugins'] || []; + Module['preloadPlugins'] = preloadPlugins; var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { // Ensure plugins are ready. if (typeof Browser != 'undefined') Browser.init(); @@ -2108,7 +2108,7 @@ function dbg(...args) { }); return handled; }; - Module2['FS_handledByPreloadPlugin'] = FS_handledByPreloadPlugin; + Module['FS_handledByPreloadPlugin'] = FS_handledByPreloadPlugin; var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => { // TODO we should allow people to just pass in a complete filename instead // of parent and name being that we just join them anyways @@ -2138,7 +2138,7 @@ function dbg(...args) { processData(url); } }; - Module2['FS_createPreloadedFile'] = FS_createPreloadedFile; + Module['FS_createPreloadedFile'] = FS_createPreloadedFile; var FS_modeStringToFlags = (str) => { var flagModes = { @@ -2155,7 +2155,7 @@ function dbg(...args) { } return flags; }; - Module2['FS_modeStringToFlags'] = FS_modeStringToFlags; + Module['FS_modeStringToFlags'] = FS_modeStringToFlags; var FS_getMode = (canRead, canWrite) => { var mode = 0; @@ -2163,7 +2163,7 @@ function dbg(...args) { if (canWrite) mode |= 146; return mode; }; - Module2['FS_getMode'] = FS_getMode; + Module['FS_getMode'] = FS_getMode; @@ -2173,7 +2173,7 @@ function dbg(...args) { var strError = (errno) => { return UTF8ToString(_strerror(errno)); }; - Module2['strError'] = strError; + Module['strError'] = strError; var ERRNO_CODES = { 'EPERM': 63, @@ -2298,7 +2298,7 @@ function dbg(...args) { 'EOWNERDEAD': 62, 'ESTRPIPE': 135, }; - Module2['ERRNO_CODES'] = ERRNO_CODES; + Module['ERRNO_CODES'] = ERRNO_CODES; var FS = { root:null, mounts:[], @@ -3233,7 +3233,7 @@ function dbg(...args) { if (stream.stream_ops.open) { stream.stream_ops.open(stream); } - if (Module2['logReadFiles'] && !(flags & 1)) { + if (Module['logReadFiles'] && !(flags & 1)) { if (!FS.readFiles) FS.readFiles = {}; if (!(path in FS.readFiles)) { FS.readFiles[path] = 1; @@ -3504,18 +3504,18 @@ function dbg(...args) { // default tty devices. however, if the standard streams // have been overwritten we create a unique device for // them instead. - if (Module2['stdin']) { - FS.createDevice('/dev', 'stdin', Module2['stdin']); + if (Module['stdin']) { + FS.createDevice('/dev', 'stdin', Module['stdin']); } else { FS.symlink('/dev/tty', '/dev/stdin'); } - if (Module2['stdout']) { - FS.createDevice('/dev', 'stdout', null, Module2['stdout']); + if (Module['stdout']) { + FS.createDevice('/dev', 'stdout', null, Module['stdout']); } else { FS.symlink('/dev/tty', '/dev/stdout'); } - if (Module2['stderr']) { - FS.createDevice('/dev', 'stderr', null, Module2['stderr']); + if (Module['stderr']) { + FS.createDevice('/dev', 'stderr', null, Module['stderr']); } else { FS.symlink('/dev/tty1', '/dev/stderr'); } @@ -3552,9 +3552,9 @@ function dbg(...args) { FS.init.initialized = true; // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here - Module2['stdin'] = input || Module2['stdin']; - Module2['stdout'] = output || Module2['stdout']; - Module2['stderr'] = error || Module2['stderr']; + Module['stdin'] = input || Module['stdin']; + Module['stdout'] = output || Module['stdout']; + Module['stderr'] = error || Module['stderr']; FS.createStandardStreams(); }, @@ -3899,7 +3899,7 @@ function dbg(...args) { abort('FS.standardizePath has been removed; use PATH.normalize instead'); }, }; - Module2['FS'] = FS; + Module['FS'] = FS; var SYSCALLS = { DEFAULT_POLLMASK:5, @@ -3967,7 +3967,7 @@ function dbg(...args) { return ret; }, }; - Module2['SYSCALLS'] = SYSCALLS; + Module['SYSCALLS'] = SYSCALLS; function ___syscall_chdir(path) { try { @@ -3979,7 +3979,7 @@ function dbg(...args) { return -e.errno; } } - Module2['___syscall_chdir'] = ___syscall_chdir; + Module['___syscall_chdir'] = ___syscall_chdir; /** @suppress {duplicate } */ function syscallGetVarargI() { @@ -3989,9 +3989,9 @@ function dbg(...args) { SYSCALLS.varargs += 4; return ret; } - Module2['syscallGetVarargI'] = syscallGetVarargI; + Module['syscallGetVarargI'] = syscallGetVarargI; var syscallGetVarargP = syscallGetVarargI; - Module2['syscallGetVarargP'] = syscallGetVarargP; + Module['syscallGetVarargP'] = syscallGetVarargP; function ___syscall_fcntl64(fd, cmd, varargs) { @@ -4039,14 +4039,14 @@ function dbg(...args) { return -e.errno; } } - Module2['___syscall_fcntl64'] = ___syscall_fcntl64; + Module['___syscall_fcntl64'] = ___syscall_fcntl64; var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!'); return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); }; - Module2['stringToUTF8'] = stringToUTF8; + Module['stringToUTF8'] = stringToUTF8; function ___syscall_getcwd(buf, size) { try { @@ -4061,7 +4061,7 @@ function dbg(...args) { return -e.errno; } } - Module2['___syscall_getcwd'] = ___syscall_getcwd; + Module['___syscall_getcwd'] = ___syscall_getcwd; function ___syscall_ioctl(fd, op, varargs) { @@ -4158,7 +4158,7 @@ function dbg(...args) { return -e.errno; } } - Module2['___syscall_ioctl'] = ___syscall_ioctl; + Module['___syscall_ioctl'] = ___syscall_ioctl; function ___syscall_openat(dirfd, path, flags, varargs) { @@ -4174,15 +4174,15 @@ function dbg(...args) { return -e.errno; } } - Module2['___syscall_openat'] = ___syscall_openat; + Module['___syscall_openat'] = ___syscall_openat; var __abort_js = () => { abort('native code called abort()'); }; - Module2['__abort_js'] = __abort_js; + Module['__abort_js'] = __abort_js; var __embind_register_bigint = (primitiveType, name, size, minRange, maxRange) => {}; - Module2['__embind_register_bigint'] = __embind_register_bigint; + Module['__embind_register_bigint'] = __embind_register_bigint; var embind_init_charCodes = () => { var codes = new Array(256); @@ -4191,9 +4191,9 @@ function dbg(...args) { } embind_charCodes = codes; }; - Module2['embind_init_charCodes'] = embind_init_charCodes; + Module['embind_init_charCodes'] = embind_init_charCodes; var embind_charCodes; - Module2['embind_charCodes'] = embind_charCodes; + Module['embind_charCodes'] = embind_charCodes; var readLatin1String = (ptr) => { var ret = ""; var c = ptr; @@ -4202,32 +4202,32 @@ function dbg(...args) { } return ret; }; - Module2['readLatin1String'] = readLatin1String; + Module['readLatin1String'] = readLatin1String; var awaitingDependencies = { }; - Module2['awaitingDependencies'] = awaitingDependencies; + Module['awaitingDependencies'] = awaitingDependencies; var registeredTypes = { }; - Module2['registeredTypes'] = registeredTypes; + Module['registeredTypes'] = registeredTypes; var typeDependencies = { }; - Module2['typeDependencies'] = typeDependencies; + Module['typeDependencies'] = typeDependencies; var BindingError; - Module2['BindingError'] = BindingError; + Module['BindingError'] = BindingError; var throwBindingError = (message) => { throw new BindingError(message); }; - Module2['throwBindingError'] = throwBindingError; + Module['throwBindingError'] = throwBindingError; var InternalError; - Module2['InternalError'] = InternalError; + Module['InternalError'] = InternalError; var throwInternalError = (message) => { throw new InternalError(message); }; - Module2['throwInternalError'] = throwInternalError; + Module['throwInternalError'] = throwInternalError; var whenDependentTypesAreResolved = (myTypes, dependentTypes, getTypeConverters) => { myTypes.forEach(function(type) { typeDependencies[type] = dependentTypes; @@ -4267,7 +4267,7 @@ function dbg(...args) { onComplete(typeConverters); } }; - Module2['whenDependentTypesAreResolved'] = whenDependentTypesAreResolved; + Module['whenDependentTypesAreResolved'] = whenDependentTypesAreResolved; /** @param {Object=} options */ function sharedRegisterType(rawType, registeredInstance, options = {}) { var name = registeredInstance.name; @@ -4291,7 +4291,7 @@ function dbg(...args) { callbacks.forEach((cb) => cb()); } } - Module2['sharedRegisterType'] = sharedRegisterType; + Module['sharedRegisterType'] = sharedRegisterType; /** @param {Object=} options */ function registerType(rawType, registeredInstance, options = {}) { if (!('argPackAdvance' in registeredInstance)) { @@ -4299,10 +4299,10 @@ function dbg(...args) { } return sharedRegisterType(rawType, registeredInstance, options); } - Module2['registerType'] = registerType; + Module['registerType'] = registerType; var GenericWireTypeSize = 8; - Module2['GenericWireTypeSize'] = GenericWireTypeSize; + Module['GenericWireTypeSize'] = GenericWireTypeSize; /** @suppress {globalThis} */ var __embind_register_bool = (rawType, name, trueValue, falseValue) => { name = readLatin1String(name); @@ -4323,14 +4323,14 @@ function dbg(...args) { destructorFunction: null, // This type does not need a destructor }); }; - Module2['__embind_register_bool'] = __embind_register_bool; + Module['__embind_register_bool'] = __embind_register_bool; var emval_freelist = []; - Module2['emval_freelist'] = emval_freelist; + Module['emval_freelist'] = emval_freelist; var emval_handles = []; - Module2['emval_handles'] = emval_handles; + Module['emval_handles'] = emval_handles; var __emval_decref = (handle) => { if (handle > 9 && 0 === --emval_handles[handle + 1]) { assert(emval_handles[handle] !== undefined, `Decref for unallocated handle.`); @@ -4338,7 +4338,7 @@ function dbg(...args) { emval_freelist.push(handle); } }; - Module2['__emval_decref'] = __emval_decref; + Module['__emval_decref'] = __emval_decref; @@ -4347,7 +4347,7 @@ function dbg(...args) { var count_emval_handles = () => { return emval_handles.length / 2 - 5 - emval_freelist.length; }; - Module2['count_emval_handles'] = count_emval_handles; + Module['count_emval_handles'] = count_emval_handles; var init_emval = () => { // reserve 0 and some special values. These never get de-allocated. @@ -4359,9 +4359,9 @@ function dbg(...args) { false, 1, ); assert(emval_handles.length === 5 * 2); - Module2['count_emval_handles'] = count_emval_handles; + Module['count_emval_handles'] = count_emval_handles; }; - Module2['init_emval'] = init_emval; + Module['init_emval'] = init_emval; var Emval = { toValue:(handle) => { if (!handle) { @@ -4386,13 +4386,13 @@ function dbg(...args) { } }, }; - Module2['Emval'] = Emval; + Module['Emval'] = Emval; /** @suppress {globalThis} */ function readPointer(pointer) { return this['fromWireType'](HEAPU32[((pointer)>>2)]); } - Module2['readPointer'] = readPointer; + Module['readPointer'] = readPointer; var EmValType = { name: 'emscripten::val', @@ -4409,9 +4409,9 @@ function dbg(...args) { // TODO: do we need a deleteObject here? write a test where // emval is passed into JS via an interface }; - Module2['EmValType'] = EmValType; + Module['EmValType'] = EmValType; var __embind_register_emval = (rawType) => registerType(rawType, EmValType); - Module2['__embind_register_emval'] = __embind_register_emval; + Module['__embind_register_emval'] = __embind_register_emval; var embindRepr = (v) => { if (v === null) { @@ -4424,7 +4424,7 @@ function dbg(...args) { return '' + v; } }; - Module2['embindRepr'] = embindRepr; + Module['embindRepr'] = embindRepr; var floatReadValueFromPointer = (name, width) => { switch (width) { @@ -4438,7 +4438,7 @@ function dbg(...args) { throw new TypeError(`invalid float width (${width}): ${name}`); } }; - Module2['floatReadValueFromPointer'] = floatReadValueFromPointer; + Module['floatReadValueFromPointer'] = floatReadValueFromPointer; var __embind_register_float = (rawType, name, size) => { @@ -4459,7 +4459,7 @@ function dbg(...args) { destructorFunction: null, // This type does not need a destructor }); }; - Module2['__embind_register_float'] = __embind_register_float; + Module['__embind_register_float'] = __embind_register_float; var integerReadValueFromPointer = (name, width, signed) => { @@ -4478,7 +4478,7 @@ function dbg(...args) { throw new TypeError(`invalid integer width (${width}): ${name}`); } }; - Module2['integerReadValueFromPointer'] = integerReadValueFromPointer; + Module['integerReadValueFromPointer'] = integerReadValueFromPointer; /** @suppress {globalThis} */ @@ -4529,7 +4529,7 @@ function dbg(...args) { destructorFunction: null, // This type does not need a destructor }); }; - Module2['__embind_register_integer'] = __embind_register_integer; + Module['__embind_register_integer'] = __embind_register_integer; var __embind_register_memory_view = (rawType, dataTypeIndex, name) => { @@ -4562,7 +4562,7 @@ function dbg(...args) { ignoreDuplicateRegistrations: true, }); }; - Module2['__embind_register_memory_view'] = __embind_register_memory_view; + Module['__embind_register_memory_view'] = __embind_register_memory_view; @@ -4668,13 +4668,13 @@ function dbg(...args) { }, }); }; - Module2['__embind_register_std_string'] = __embind_register_std_string; + Module['__embind_register_std_string'] = __embind_register_std_string; var UTF16Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf-16le') : undefined;; - Module2['UTF16Decoder'] = UTF16Decoder; + Module['UTF16Decoder'] = UTF16Decoder; var UTF16ToString = (ptr, maxBytesToRead) => { assert(ptr % 2 == 0, 'Pointer passed to UTF16ToString must be aligned to two bytes!'); var endPtr = ptr; @@ -4708,7 +4708,7 @@ function dbg(...args) { return str; }; - Module2['UTF16ToString'] = UTF16ToString; + Module['UTF16ToString'] = UTF16ToString; var stringToUTF16 = (str, outPtr, maxBytesToWrite) => { assert(outPtr % 2 == 0, 'Pointer passed to stringToUTF16 must be aligned to two bytes!'); @@ -4729,12 +4729,12 @@ function dbg(...args) { HEAP16[((outPtr)>>1)] = 0; return outPtr - startPtr; }; - Module2['stringToUTF16'] = stringToUTF16; + Module['stringToUTF16'] = stringToUTF16; var lengthBytesUTF16 = (str) => { return str.length*2; }; - Module2['lengthBytesUTF16'] = lengthBytesUTF16; + Module['lengthBytesUTF16'] = lengthBytesUTF16; var UTF32ToString = (ptr, maxBytesToRead) => { assert(ptr % 4 == 0, 'Pointer passed to UTF32ToString must be aligned to four bytes!'); @@ -4758,7 +4758,7 @@ function dbg(...args) { } return str; }; - Module2['UTF32ToString'] = UTF32ToString; + Module['UTF32ToString'] = UTF32ToString; var stringToUTF32 = (str, outPtr, maxBytesToWrite) => { assert(outPtr % 4 == 0, 'Pointer passed to stringToUTF32 must be aligned to four bytes!'); @@ -4784,7 +4784,7 @@ function dbg(...args) { HEAP32[((outPtr)>>2)] = 0; return outPtr - startPtr; }; - Module2['stringToUTF32'] = stringToUTF32; + Module['stringToUTF32'] = stringToUTF32; var lengthBytesUTF32 = (str) => { var len = 0; @@ -4798,7 +4798,7 @@ function dbg(...args) { return len; }; - Module2['lengthBytesUTF32'] = lengthBytesUTF32; + Module['lengthBytesUTF32'] = lengthBytesUTF32; var __embind_register_std_wstring = (rawType, charSize, name) => { name = readLatin1String(name); var decodeString, encodeString, readCharAt, lengthBytesUTF; @@ -4865,7 +4865,7 @@ function dbg(...args) { } }); }; - Module2['__embind_register_std_wstring'] = __embind_register_std_wstring; + Module['__embind_register_std_wstring'] = __embind_register_std_wstring; var __embind_register_void = (rawType, name) => { @@ -4879,7 +4879,7 @@ function dbg(...args) { 'toWireType': (destructors, o) => undefined, }); }; - Module2['__embind_register_void'] = __embind_register_void; + Module['__embind_register_void'] = __embind_register_void; @@ -4897,10 +4897,10 @@ function dbg(...args) { FS.createDataFile(name, null, HEAP8.subarray(content, content + len), true, true, true); } while (HEAPU32[((ptr)>>2)]); }; - Module2['__emscripten_fs_load_embedded_files'] = __emscripten_fs_load_embedded_files; + Module['__emscripten_fs_load_embedded_files'] = __emscripten_fs_load_embedded_files; var __emscripten_memcpy_js = (dest, src, num) => HEAPU8.copyWithin(dest, src, src + num); - Module2['__emscripten_memcpy_js'] = __emscripten_memcpy_js; + Module['__emscripten_memcpy_js'] = __emscripten_memcpy_js; var __tzset_js = (timezone, daylight, std_name, dst_name) => { @@ -4928,9 +4928,20 @@ function dbg(...args) { HEAP32[((daylight)>>2)] = Number(winterOffset != summerOffset); - var extractZone = (date) => date.toLocaleTimeString(undefined, {hour12:false, timeZoneName:'short'}).split(' ')[1]; - var winterName = extractZone(winter); - var summerName = extractZone(summer); + var extractZone = (timezoneOffset) => { + // Why inverse sign? + // Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset + var sign = timezoneOffset >= 0 ? "-" : "+"; + + var absOffset = Math.abs(timezoneOffset) + var hours = String(Math.floor(absOffset / 60)).padStart(2, "0"); + var minutes = String(absOffset % 60).padStart(2, "0"); + + return `UTC${sign}${hours}${minutes}`; + } + + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); assert(winterName); assert(summerName); assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`); @@ -4944,32 +4955,32 @@ function dbg(...args) { stringToUTF8(summerName, std_name, 17); } }; - Module2['__tzset_js'] = __tzset_js; + Module['__tzset_js'] = __tzset_js; var getHeapMax = () => HEAPU8.length; - Module2['getHeapMax'] = getHeapMax; + Module['getHeapMax'] = getHeapMax; var abortOnCannotGrowMemory = (requestedSize) => { abort(`Cannot enlarge memory arrays to size ${requestedSize} bytes (OOM). Either (1) compile with -sINITIAL_MEMORY=X with X higher than the current value ${HEAP8.length}, (2) compile with -sALLOW_MEMORY_GROWTH which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -sABORTING_MALLOC=0`); }; - Module2['abortOnCannotGrowMemory'] = abortOnCannotGrowMemory; + Module['abortOnCannotGrowMemory'] = abortOnCannotGrowMemory; var _emscripten_resize_heap = (requestedSize) => { var oldSize = HEAPU8.length; // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned. requestedSize >>>= 0; abortOnCannotGrowMemory(requestedSize); }; - Module2['_emscripten_resize_heap'] = _emscripten_resize_heap; + Module['_emscripten_resize_heap'] = _emscripten_resize_heap; var ENV = { }; - Module2['ENV'] = ENV; + Module['ENV'] = ENV; var getExecutableName = () => { return thisProgram || './this.program'; }; - Module2['getExecutableName'] = getExecutableName; + Module['getExecutableName'] = getExecutableName; var getEnvStrings = () => { if (!getEnvStrings.strings) { // Default values. @@ -5000,7 +5011,7 @@ function dbg(...args) { } return getEnvStrings.strings; }; - Module2['getEnvStrings'] = getEnvStrings; + Module['getEnvStrings'] = getEnvStrings; var stringToAscii = (str, buffer) => { for (var i = 0; i < str.length; ++i) { @@ -5010,7 +5021,7 @@ function dbg(...args) { // Null-terminate the string HEAP8[buffer] = 0; }; - Module2['stringToAscii'] = stringToAscii; + Module['stringToAscii'] = stringToAscii; var _environ_get = (__environ, environ_buf) => { var bufSize = 0; getEnvStrings().forEach((string, i) => { @@ -5021,7 +5032,7 @@ function dbg(...args) { }); return 0; }; - Module2['_environ_get'] = _environ_get; + Module['_environ_get'] = _environ_get; var _environ_sizes_get = (penviron_count, penviron_buf_size) => { var strings = getEnvStrings(); @@ -5031,7 +5042,7 @@ function dbg(...args) { HEAPU32[((penviron_buf_size)>>2)] = bufSize; return 0; }; - Module2['_environ_sizes_get'] = _environ_sizes_get; + Module['_environ_sizes_get'] = _environ_sizes_get; function _fd_close(fd) { try { @@ -5044,7 +5055,7 @@ function dbg(...args) { return e.errno; } } - Module2['_fd_close'] = _fd_close; + Module['_fd_close'] = _fd_close; /** @param {number=} offset */ var doReadv = (stream, iov, iovcnt, offset) => { @@ -5063,7 +5074,7 @@ function dbg(...args) { } return ret; }; - Module2['doReadv'] = doReadv; + Module['doReadv'] = doReadv; function _fd_read(fd, iov, iovcnt, pnum) { try { @@ -5077,7 +5088,7 @@ function dbg(...args) { return e.errno; } } - Module2['_fd_read'] = _fd_read; + Module['_fd_read'] = _fd_read; var convertI32PairToI53Checked = (lo, hi) => { @@ -5085,7 +5096,7 @@ function dbg(...args) { assert(hi === (hi|0)); // hi should be a i32 return ((hi + 0x200000) >>> 0 < 0x400001 - !!lo) ? (lo >>> 0) + hi * 4294967296 : NaN; }; - Module2['convertI32PairToI53Checked'] = convertI32PairToI53Checked; + Module['convertI32PairToI53Checked'] = convertI32PairToI53Checked; function _fd_seek(fd,offset_low, offset_high,whence,newOffset) { var offset = convertI32PairToI53Checked(offset_low, offset_high); @@ -5104,7 +5115,7 @@ function dbg(...args) { } ; } - Module2['_fd_seek'] = _fd_seek; + Module['_fd_seek'] = _fd_seek; /** @param {number=} offset */ var doWritev = (stream, iov, iovcnt, offset) => { @@ -5122,7 +5133,7 @@ function dbg(...args) { } return ret; }; - Module2['doWritev'] = doWritev; + Module['doWritev'] = doWritev; function _fd_write(fd, iov, iovcnt, pnum) { try { @@ -5136,29 +5147,29 @@ function dbg(...args) { return e.errno; } } - Module2['_fd_write'] = _fd_write; + Module['_fd_write'] = _fd_write; var _llvm_eh_typeid_for = (type) => type; - Module2['_llvm_eh_typeid_for'] = _llvm_eh_typeid_for; + Module['_llvm_eh_typeid_for'] = _llvm_eh_typeid_for; var stackAlloc = (sz) => __emscripten_stack_alloc(sz); - Module2['stackAlloc'] = stackAlloc; + Module['stackAlloc'] = stackAlloc; var stringToUTF8OnStack = (str) => { var size = lengthBytesUTF8(str) + 1; var ret = stackAlloc(size); stringToUTF8(str, ret, size); return ret; }; - Module2['stringToUTF8OnStack'] = stringToUTF8OnStack; + Module['stringToUTF8OnStack'] = stringToUTF8OnStack; var wasmTableMirror = []; - Module2['wasmTableMirror'] = wasmTableMirror; + Module['wasmTableMirror'] = wasmTableMirror; /** @type {WebAssembly.Table} */ var wasmTable; - Module2['wasmTable'] = wasmTable; + Module['wasmTable'] = wasmTable; var getWasmTableEntry = (funcPtr) => { var func = wasmTableMirror[funcPtr]; if (!func) { @@ -5168,18 +5179,18 @@ function dbg(...args) { assert(wasmTable.get(funcPtr) == func, 'JavaScript-side Wasm function table mirror is out of date!'); return func; }; - Module2['getWasmTableEntry'] = getWasmTableEntry; + Module['getWasmTableEntry'] = getWasmTableEntry; var ALLOC_NORMAL = 0; - Module2['ALLOC_NORMAL'] = ALLOC_NORMAL; + Module['ALLOC_NORMAL'] = ALLOC_NORMAL; var ALLOC_STACK = 1; - Module2['ALLOC_STACK'] = ALLOC_STACK; + Module['ALLOC_STACK'] = ALLOC_STACK; @@ -5200,20 +5211,20 @@ function dbg(...args) { HEAPU8.set(slab, ret); return ret; }; - Module2['allocate'] = allocate; + Module['allocate'] = allocate; var getCFunc = (ident) => { - var func = Module2['_' + ident]; // closure exported function + var func = Module['_' + ident]; // closure exported function assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported'); return func; }; - Module2['getCFunc'] = getCFunc; + Module['getCFunc'] = getCFunc; var writeArrayToMemory = (array, buffer) => { assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)') HEAP8.set(array, buffer); }; - Module2['writeArrayToMemory'] = writeArrayToMemory; + Module['writeArrayToMemory'] = writeArrayToMemory; @@ -5277,7 +5288,7 @@ function dbg(...args) { ret = onDone(ret); return ret; }; - Module2['ccall'] = ccall; + Module['ccall'] = ccall; @@ -5289,28 +5300,28 @@ function dbg(...args) { var cwrap = (ident, returnType, argTypes, opts) => { return (...args) => ccall(ident, returnType, argTypes, args, opts); }; - Module2['cwrap'] = cwrap; + Module['cwrap'] = cwrap; var FS_createPath = FS.createPath; - Module2['FS_createPath'] = FS_createPath; + Module['FS_createPath'] = FS_createPath; var FS_unlink = (path) => FS.unlink(path); - Module2['FS_unlink'] = FS_unlink; + Module['FS_unlink'] = FS_unlink; var FS_createLazyFile = FS.createLazyFile; - Module2['FS_createLazyFile'] = FS_createLazyFile; + Module['FS_createLazyFile'] = FS_createLazyFile; var FS_createDevice = FS.createDevice; - Module2['FS_createDevice'] = FS_createDevice; + Module['FS_createDevice'] = FS_createDevice; var incrementExceptionRefcount = (ptr) => ___cxa_increment_exception_refcount(ptr); - Module2['incrementExceptionRefcount'] = incrementExceptionRefcount; + Module['incrementExceptionRefcount'] = incrementExceptionRefcount; var decrementExceptionRefcount = (ptr) => ___cxa_decrement_exception_refcount(ptr); - Module2['decrementExceptionRefcount'] = decrementExceptionRefcount; + Module['decrementExceptionRefcount'] = decrementExceptionRefcount; @@ -5334,15 +5345,15 @@ function dbg(...args) { stackRestore(sp); return [type, message]; }; - Module2['getExceptionMessageCommon'] = getExceptionMessageCommon; + Module['getExceptionMessageCommon'] = getExceptionMessageCommon; var getExceptionMessage = (ptr) => getExceptionMessageCommon(ptr); - Module2['getExceptionMessage'] = getExceptionMessage; + Module['getExceptionMessage'] = getExceptionMessage; FS.createPreloadedFile = FS_createPreloadedFile; - FS.staticInit();Module2["FS_createPath"] = FS.createPath;Module2["FS_createDataFile"] = FS.createDataFile;Module2["FS_createPreloadedFile"] = FS.createPreloadedFile;Module2["FS_unlink"] = FS.unlink;Module2["FS_createLazyFile"] = FS.createLazyFile;Module2["FS_createDevice"] = FS.createDevice;; + FS.staticInit();Module["FS_createPath"] = FS.createPath;Module["FS_createDataFile"] = FS.createDataFile;Module["FS_createPreloadedFile"] = FS.createPreloadedFile;Module["FS_unlink"] = FS.unlink;Module["FS_createLazyFile"] = FS.createLazyFile;Module["FS_createDevice"] = FS.createDevice;; embind_init_charCodes(); -BindingError = Module2['BindingError'] = class BindingError extends Error { constructor(message) { super(message); this.name = 'BindingError'; }}; -InternalError = Module2['InternalError'] = class InternalError extends Error { constructor(message) { super(message); this.name = 'InternalError'; }}; +BindingError = Module['BindingError'] = class BindingError extends Error { constructor(message) { super(message); this.name = 'BindingError'; }}; +InternalError = Module['InternalError'] = class InternalError extends Error { constructor(message) { super(message); this.name = 'InternalError'; }}; init_emval();; function checkIncomingModuleAPI() { ignoredModuleProp('fetchSettings'); @@ -5488,9 +5499,9 @@ var wasmImports = { var wasmExports = createWasm(); var ___wasm_call_ctors = createExportWrapper('__wasm_call_ctors', 0); var ___getTypeName = createExportWrapper('__getTypeName', 1); -var _eval = Module2['_eval'] = createExportWrapper('eval', 1); +var _eval = Module['_eval'] = createExportWrapper('eval', 2); var _malloc = createExportWrapper('malloc', 1); -var _resetState = Module2['_resetState'] = createExportWrapper('resetState', 0); +var _resetState = Module['_resetState'] = createExportWrapper('resetState', 0); var _main = createExportWrapper('__main_argc_argv', 2); var ___cxa_free_exception = createExportWrapper('__cxa_free_exception', 1); var _strerror = createExportWrapper('strerror', 1); @@ -5510,14 +5521,14 @@ var ___cxa_increment_exception_refcount = createExportWrapper('__cxa_increment_e var ___get_exception_message = createExportWrapper('__get_exception_message', 3); var ___cxa_can_catch = createExportWrapper('__cxa_can_catch', 3); var ___cxa_is_pointer_type = createExportWrapper('__cxa_is_pointer_type', 1); -var dynCall_viijjiiii = Module2['dynCall_viijjiiii'] = createExportWrapper('dynCall_viijjiiii', 11); -var dynCall_jiji = Module2['dynCall_jiji'] = createExportWrapper('dynCall_jiji', 5); -var dynCall_viijii = Module2['dynCall_viijii'] = createExportWrapper('dynCall_viijii', 7); -var dynCall_jiiii = Module2['dynCall_jiiii'] = createExportWrapper('dynCall_jiiii', 5); -var dynCall_iiiiij = Module2['dynCall_iiiiij'] = createExportWrapper('dynCall_iiiiij', 7); -var dynCall_iiiiijj = Module2['dynCall_iiiiijj'] = createExportWrapper('dynCall_iiiiijj', 9); -var dynCall_iiiiiijj = Module2['dynCall_iiiiiijj'] = createExportWrapper('dynCall_iiiiiijj', 10); -var ___emscripten_embedded_file_data = Module2['___emscripten_embedded_file_data'] = 99360; +var dynCall_viijjiiii = Module['dynCall_viijjiiii'] = createExportWrapper('dynCall_viijjiiii', 11); +var dynCall_jiji = Module['dynCall_jiji'] = createExportWrapper('dynCall_jiji', 5); +var dynCall_viijii = Module['dynCall_viijii'] = createExportWrapper('dynCall_viijii', 7); +var dynCall_jiiii = Module['dynCall_jiiii'] = createExportWrapper('dynCall_jiiii', 5); +var dynCall_iiiiij = Module['dynCall_iiiiij'] = createExportWrapper('dynCall_iiiiij', 7); +var dynCall_iiiiijj = Module['dynCall_iiiiijj'] = createExportWrapper('dynCall_iiiiijj', 9); +var dynCall_iiiiiijj = Module['dynCall_iiiiiijj'] = createExportWrapper('dynCall_iiiiiijj', 10); +var ___emscripten_embedded_file_data = Module['___emscripten_embedded_file_data'] = 100676; function invoke_iii(index,a1,a2) { var sp = stackSave(); try { @@ -5874,22 +5885,22 @@ function invoke_jiiii(index,a1,a2,a3,a4) { // include: postamble.js // === Auto-generated postamble setup entry stuff === -Module2['addRunDependency'] = addRunDependency; -Module2['removeRunDependency'] = removeRunDependency; -Module2['ccall'] = ccall; -Module2['cwrap'] = cwrap; -Module2['setValue'] = setValue; -Module2['getValue'] = getValue; -Module2['UTF8ToString'] = UTF8ToString; -Module2['intArrayFromString'] = intArrayFromString; -Module2['FS_createPreloadedFile'] = FS_createPreloadedFile; -Module2['FS_unlink'] = FS_unlink; -Module2['FS_createPath'] = FS_createPath; -Module2['FS_createDevice'] = FS_createDevice; -Module2['FS_createDataFile'] = FS_createDataFile; -Module2['FS_createLazyFile'] = FS_createLazyFile; -Module2['ALLOC_NORMAL'] = ALLOC_NORMAL; -Module2['allocate'] = allocate; +Module['addRunDependency'] = addRunDependency; +Module['removeRunDependency'] = removeRunDependency; +Module['ccall'] = ccall; +Module['cwrap'] = cwrap; +Module['setValue'] = setValue; +Module['getValue'] = getValue; +Module['UTF8ToString'] = UTF8ToString; +Module['intArrayFromString'] = intArrayFromString; +Module['FS_createPreloadedFile'] = FS_createPreloadedFile; +Module['FS_unlink'] = FS_unlink; +Module['FS_createPath'] = FS_createPath; +Module['FS_createDevice'] = FS_createDevice; +Module['FS_createDataFile'] = FS_createDataFile; +Module['FS_createLazyFile'] = FS_createLazyFile; +Module['ALLOC_NORMAL'] = ALLOC_NORMAL; +Module['allocate'] = allocate; var calledRun; @@ -5929,24 +5940,24 @@ function run(args = arguments_) { // or while the async setStatus time below was happening if (calledRun) return; calledRun = true; - Module2['calledRun'] = true; + Module['calledRun'] = true; if (ABORT) return; initRuntime(); - Module2['onRuntimeInitialized']?.(); + Module['onRuntimeInitialized']?.(); - assert(!Module2['_main'], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'); + assert(!Module['_main'], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'); postRun(); } - if (Module2['setStatus']) { - Module2['setStatus']('Running...'); + if (Module['setStatus']) { + Module['setStatus']('Running...'); setTimeout(function() { setTimeout(function() { - Module2['setStatus'](''); + Module['setStatus'](''); }, 1); doRun(); }, 1); @@ -5996,10 +6007,10 @@ function checkUnflushedContent() { } } -if (Module2['preInit']) { - if (typeof Module2['preInit'] == 'function') Module2['preInit'] = [Module2['preInit']]; - while (Module2['preInit'].length > 0) { - Module2['preInit'].pop()(); +if (Module['preInit']) { + if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']]; + while (Module['preInit'].length > 0) { + Module['preInit'].pop()(); } } diff --git a/static/OpenBirchWasm/OpenBirch.wasm b/static/OpenBirchWasm/OpenBirch.wasm old mode 100644 new mode 100755 index 2a102d6..2554529 Binary files a/static/OpenBirchWasm/OpenBirch.wasm and b/static/OpenBirchWasm/OpenBirch.wasm differ diff --git a/static/OpenBirchWasm/OpenBirchWrapper.js b/static/OpenBirchWasm/OpenBirchWrapper.js index 349701d..5dd6dc0 100644 --- a/static/OpenBirchWasm/OpenBirchWrapper.js +++ b/static/OpenBirchWasm/OpenBirchWrapper.js @@ -7,10 +7,10 @@ function str2C(s) { return ret; } -window.runEval = function (inputText) { +window.runEval = function (inputText, stopAssignments = false) { console.log("input: " + inputText); var inputPtr = str2C(inputText); - var resultPointer = Module2._eval(inputPtr); + var resultPointer = Module._eval(inputPtr, stopAssignments); var resultString = ""; @@ -19,7 +19,7 @@ window.runEval = function (inputText) { if (resultPointer) { var i = 0; while (true) { - var charCode = Module2.getValue(resultPointer + i, 'i8'); + var charCode = Module.getValue(resultPointer + i, 'i8'); if (charCode === 0) break; resultString += String.fromCharCode(charCode); i++;