unzip-b0fc9445.js 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718
  1. /**
  2. * Cesium - https://github.com/AnalyticalGraphicsInc/cesium
  3. *
  4. * Copyright 2011-2017 Cesium Contributors
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. * Columbus View (Pat. Pend.)
  19. *
  20. * Portions licensed separately.
  21. * See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md for full licensing details.
  22. */
  23. define(['exports'], function (exports) { 'use strict';
  24. // Copyright 2010 The Emscripten Authors. All rights reserved.
  25. // Emscripten is available under two separate licenses, the MIT license and the
  26. // University of Illinois/NCSA Open Source License. Both these licenses can be
  27. // found in the LICENSE file.
  28. // The Module object: Our interface to the outside world. We import
  29. // and export values on it. There are various ways Module can be used:
  30. // 1. Not defined. We create it here
  31. // 2. A function parameter, function(Module) { ..generated code.. }
  32. // 3. pre-run appended it, var Module = {}; ..generated code..
  33. // 4. External script tag defines var Module.
  34. // We need to check if Module already exists (e.g. case 3 above).
  35. // Substitution will be replaced with actual code on later stage of the build,
  36. // this way Closure Compiler will not mangle it (e.g. case 4. above).
  37. // Note that if you want to run closure, and also to use Module
  38. // after the generated code, you will need to define var Module = {};
  39. // before the code. Then that object will be used in the code, and you
  40. // can continue to use Module afterwards as well.
  41. if (typeof WebAssembly !== 'undefined') {
  42. var Module = typeof Module !== 'undefined' ? Module : {};
  43. // --pre-jses are emitted after the Module integration code, so that they can
  44. // refer to Module (if they choose; they can also define Module)
  45. // {{PRE_JSES}}
  46. // Sometimes an existing Module object exists with properties
  47. // meant to overwrite the default module functionality. Here
  48. // we collect those properties and reapply _after_ we configure
  49. // the current environment's defaults to avoid having to be so
  50. // defensive during initialization.
  51. var moduleOverrides = {};
  52. var key;
  53. for (key in Module) {
  54. if (Module.hasOwnProperty(key)) {
  55. moduleOverrides[key] = Module[key];
  56. }
  57. }
  58. Module['arguments'] = [];
  59. Module['thisProgram'] = './this.program';
  60. Module['quit'] = function(status, toThrow) {
  61. throw toThrow;
  62. };
  63. Module['preRun'] = [];
  64. Module['postRun'] = [];
  65. // Determine the runtime environment we are in. You can customize this by
  66. // setting the ENVIRONMENT setting at compile time (see settings.js).
  67. var ENVIRONMENT_IS_WEB = false;
  68. var ENVIRONMENT_IS_WORKER = false;
  69. var ENVIRONMENT_IS_NODE = false;
  70. var ENVIRONMENT_HAS_NODE = false;
  71. var ENVIRONMENT_IS_SHELL = false;
  72. ENVIRONMENT_IS_WEB = typeof window === 'object';
  73. ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
  74. // A web environment like Electron.js can have Node enabled, so we must
  75. // distinguish between Node-enabled environments and Node environments per se.
  76. // This will allow the former to do things like mount NODEFS.
  77. ENVIRONMENT_HAS_NODE = typeof process === 'object' && typeof require === 'function';
  78. ENVIRONMENT_IS_NODE = ENVIRONMENT_HAS_NODE && !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_WORKER;
  79. ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
  80. if (Module['ENVIRONMENT']) {
  81. 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)');
  82. }
  83. // Three configurations we can be running in:
  84. // 1) We could be the application main() thread running in the main JS UI thread. (ENVIRONMENT_IS_WORKER == false and ENVIRONMENT_IS_PTHREAD == false)
  85. // 2) We could be the application main() thread proxied to worker. (with Emscripten -s PROXY_TO_WORKER=1) (ENVIRONMENT_IS_WORKER == true, ENVIRONMENT_IS_PTHREAD == false)
  86. // 3) We could be an application pthread running in a worker. (ENVIRONMENT_IS_WORKER == true and ENVIRONMENT_IS_PTHREAD == true)
  87. // `/` should be present at the end if `scriptDirectory` is not empty
  88. var scriptDirectory = '';
  89. function locateFile(path) {
  90. if (Module['locateFile']) {
  91. return Module['locateFile'](path, scriptDirectory);
  92. } else {
  93. return scriptDirectory + path;
  94. }
  95. }
  96. if (ENVIRONMENT_IS_NODE) {
  97. scriptDirectory = __dirname + '/';
  98. // Expose functionality in the same simple way that the shells work
  99. // Note that we pollute the global namespace here, otherwise we break in node
  100. var nodeFS;
  101. var nodePath;
  102. Module['read'] = function shell_read(filename, binary) {
  103. var ret;
  104. if (!nodeFS) nodeFS = require('fs');
  105. if (!nodePath) nodePath = require('path');
  106. filename = nodePath['normalize'](filename);
  107. ret = nodeFS['readFileSync'](filename);
  108. return binary ? ret : ret.toString();
  109. };
  110. Module['readBinary'] = function readBinary(filename) {
  111. var ret = Module['read'](filename, true);
  112. if (!ret.buffer) {
  113. ret = new Uint8Array(ret);
  114. }
  115. assert(ret.buffer);
  116. return ret;
  117. };
  118. if (process['argv'].length > 1) {
  119. Module['thisProgram'] = process['argv'][1].replace(/\\/g, '/');
  120. }
  121. Module['arguments'] = process['argv'].slice(2);
  122. if (typeof module !== 'undefined') {
  123. module['exports'] = Module;
  124. }
  125. process['on']('uncaughtException', function(ex) {
  126. // suppress ExitStatus exceptions from showing an error
  127. if (!(ex instanceof ExitStatus)) {
  128. throw ex;
  129. }
  130. });
  131. // Currently node will swallow unhandled rejections, but this behavior is
  132. // deprecated, and in the future it will exit with error status.
  133. process['on']('unhandledRejection', abort);
  134. Module['quit'] = function(status) {
  135. process['exit'](status);
  136. };
  137. Module['inspect'] = function () { return '[Emscripten Module object]'; };
  138. } else
  139. if (ENVIRONMENT_IS_SHELL) {
  140. if (typeof read != 'undefined') {
  141. Module['read'] = function shell_read(f) {
  142. return read(f);
  143. };
  144. }
  145. Module['readBinary'] = function readBinary(f) {
  146. var data;
  147. if (typeof readbuffer === 'function') {
  148. return new Uint8Array(readbuffer(f));
  149. }
  150. data = read(f, 'binary');
  151. assert(typeof data === 'object');
  152. return data;
  153. };
  154. if (typeof scriptArgs != 'undefined') {
  155. Module['arguments'] = scriptArgs;
  156. } else if (typeof arguments != 'undefined') {
  157. Module['arguments'] = arguments;
  158. }
  159. if (typeof quit === 'function') {
  160. Module['quit'] = function(status) {
  161. quit(status);
  162. };
  163. }
  164. } else
  165. if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
  166. if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled
  167. scriptDirectory = self.location.href;
  168. } else if (document.currentScript) { // web
  169. scriptDirectory = document.currentScript.src;
  170. }
  171. // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.
  172. // otherwise, slice off the final part of the url to find the script directory.
  173. // if scriptDirectory does not contain a slash, lastIndexOf will return -1,
  174. // and scriptDirectory will correctly be replaced with an empty string.
  175. if (scriptDirectory.indexOf('blob:') !== 0) {
  176. scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf('/')+1);
  177. } else {
  178. scriptDirectory = '';
  179. }
  180. Module['read'] = function shell_read(url) {
  181. var xhr = new XMLHttpRequest();
  182. xhr.open('GET', url, false);
  183. xhr.send(null);
  184. return xhr.responseText;
  185. };
  186. if (ENVIRONMENT_IS_WORKER) {
  187. Module['readBinary'] = function readBinary(url) {
  188. var xhr = new XMLHttpRequest();
  189. xhr.open('GET', url, false);
  190. xhr.responseType = 'arraybuffer';
  191. xhr.send(null);
  192. return new Uint8Array(xhr.response);
  193. };
  194. }
  195. Module['readAsync'] = function readAsync(url, onload, onerror) {
  196. var xhr = new XMLHttpRequest();
  197. xhr.open('GET', url, true);
  198. xhr.responseType = 'arraybuffer';
  199. xhr.onload = function xhr_onload() {
  200. if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
  201. onload(xhr.response);
  202. return;
  203. }
  204. onerror();
  205. };
  206. xhr.onerror = onerror;
  207. xhr.send(null);
  208. };
  209. Module['setWindowTitle'] = function(title) { document.title = title; };
  210. } else
  211. {
  212. throw new Error('environment detection error');
  213. }
  214. // Set up the out() and err() hooks, which are how we can print to stdout or
  215. // stderr, respectively.
  216. // If the user provided Module.print or printErr, use that. Otherwise,
  217. // console.log is checked first, as 'print' on the web will open a print dialogue
  218. // printErr is preferable to console.warn (works better in shells)
  219. // bind(console) is necessary to fix IE/Edge closed dev tools panel behavior.
  220. var out = Module['print'] || (typeof console !== 'undefined' ? console.log.bind(console) : (typeof print !== 'undefined' ? print : null));
  221. var err = Module['printErr'] || (typeof printErr !== 'undefined' ? printErr : ((typeof console !== 'undefined' && console.warn.bind(console)) || out));
  222. // Merge back in the overrides
  223. for (key in moduleOverrides) {
  224. if (moduleOverrides.hasOwnProperty(key)) {
  225. Module[key] = moduleOverrides[key];
  226. }
  227. }
  228. // Free the object hierarchy contained in the overrides, this lets the GC
  229. // reclaim data used e.g. in memoryInitializerRequest, which is a large typed array.
  230. moduleOverrides = undefined;
  231. // perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
  232. assert(typeof Module['memoryInitializerPrefixURL'] === 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
  233. assert(typeof Module['pthreadMainPrefixURL'] === 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
  234. assert(typeof Module['cdInitializerPrefixURL'] === 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
  235. assert(typeof Module['filePackagePrefixURL'] === 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
  236. // stack management, and other functionality that is provided by the compiled code,
  237. // should not be used before it is ready
  238. stackSave = stackRestore = stackAlloc = function() {
  239. abort('cannot use the stack before compiled code is ready to run, and has provided stack access');
  240. };
  241. function warnOnce(text) {
  242. if (!warnOnce.shown) warnOnce.shown = {};
  243. if (!warnOnce.shown[text]) {
  244. warnOnce.shown[text] = 1;
  245. //err(text);
  246. }
  247. }
  248. var asm2wasmImports = { // special asm2wasm imports
  249. "f64-rem": function(x, y) {
  250. return x % y;
  251. },
  252. "debugger": function() {
  253. debugger;
  254. }
  255. };
  256. var functionPointers = new Array(0);
  257. var tempRet0 = 0;
  258. var setTempRet0 = function(value) {
  259. tempRet0 = value;
  260. };
  261. var getTempRet0 = function() {
  262. return tempRet0;
  263. };
  264. // === Preamble library stuff ===
  265. // Documentation for the public APIs defined in this file must be updated in:
  266. // site/source/docs/api_reference/preamble.js.rst
  267. // A prebuilt local version of the documentation is available at:
  268. // site/build/text/docs/api_reference/preamble.js.txt
  269. // You can also build docs locally as HTML or other formats in site/
  270. // An online HTML version (which may be of a different version of Emscripten)
  271. // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
  272. if (typeof WebAssembly !== 'object') {
  273. abort('No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.');
  274. }
  275. /** @type {function(number, string, boolean=)} */
  276. function getValue(ptr, type, noSafe) {
  277. type = type || 'i8';
  278. if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit
  279. switch(type) {
  280. case 'i1': return HEAP8[((ptr)>>0)];
  281. case 'i8': return HEAP8[((ptr)>>0)];
  282. case 'i16': return HEAP16[((ptr)>>1)];
  283. case 'i32': return HEAP32[((ptr)>>2)];
  284. case 'i64': return HEAP32[((ptr)>>2)];
  285. case 'float': return HEAPF32[((ptr)>>2)];
  286. case 'double': return HEAPF64[((ptr)>>3)];
  287. default: abort('invalid type for getValue: ' + type);
  288. }
  289. return null;
  290. }
  291. // Wasm globals
  292. var wasmMemory;
  293. // Potentially used for direct table calls.
  294. var wasmTable;
  295. //========================================
  296. // Runtime essentials
  297. //========================================
  298. // whether we are quitting the application. no code should run after this.
  299. // set in exit() and abort()
  300. var ABORT = false;
  301. /** @type {function(*, string=)} */
  302. function assert(condition, text) {
  303. if (!condition) {
  304. abort('Assertion failed: ' + text);
  305. }
  306. }
  307. // Returns the C function with a specified identifier (for C++, you need to do manual name mangling)
  308. function getCFunc(ident) {
  309. var func = Module['_' + ident]; // closure exported function
  310. assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported');
  311. return func;
  312. }
  313. // C calling interface.
  314. function ccall(ident, returnType, argTypes, args, opts) {
  315. // For fast lookup of conversion functions
  316. var toC = {
  317. 'string': function(str) {
  318. var ret = 0;
  319. if (str !== null && str !== undefined && str !== 0) { // null string
  320. // at most 4 bytes per UTF-8 code point, +1 for the trailing '\0'
  321. var len = (str.length << 2) + 1;
  322. ret = stackAlloc(len);
  323. stringToUTF8(str, ret, len);
  324. }
  325. return ret;
  326. },
  327. 'array': function(arr) {
  328. var ret = stackAlloc(arr.length);
  329. writeArrayToMemory(arr, ret);
  330. return ret;
  331. }
  332. };
  333. function convertReturnValue(ret) {
  334. if (returnType === 'string') return UTF8ToString(ret);
  335. if (returnType === 'boolean') return Boolean(ret);
  336. return ret;
  337. }
  338. var func = getCFunc(ident);
  339. var cArgs = [];
  340. var stack = 0;
  341. assert(returnType !== 'array', 'Return type should not be "array".');
  342. if (args) {
  343. for (var i = 0; i < args.length; i++) {
  344. var converter = toC[argTypes[i]];
  345. if (converter) {
  346. if (stack === 0) stack = stackSave();
  347. cArgs[i] = converter(args[i]);
  348. } else {
  349. cArgs[i] = args[i];
  350. }
  351. }
  352. }
  353. var ret = func.apply(null, cArgs);
  354. ret = convertReturnValue(ret);
  355. if (stack !== 0) stackRestore(stack);
  356. return ret;
  357. }
  358. function cwrap(ident, returnType, argTypes, opts) {
  359. return function() {
  360. return ccall(ident, returnType, argTypes, arguments);
  361. }
  362. }
  363. // Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the given array that contains uint8 values, returns
  364. // a copy of that string as a Javascript String object.
  365. var UTF8Decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
  366. /**
  367. * @param {number} idx
  368. * @param {number=} maxBytesToRead
  369. * @return {string}
  370. */
  371. function UTF8ArrayToString(u8Array, idx, maxBytesToRead) {
  372. var endIdx = idx + maxBytesToRead;
  373. var endPtr = idx;
  374. // TextDecoder needs to know the byte length in advance, it doesn't stop on null terminator by itself.
  375. // Also, use the length info to avoid running tiny strings through TextDecoder, since .subarray() allocates garbage.
  376. // (As a tiny code save trick, compare endPtr against endIdx using a negation, so that undefined means Infinity)
  377. while (u8Array[endPtr] && !(endPtr >= endIdx)) ++endPtr;
  378. if (endPtr - idx > 16 && u8Array.subarray && UTF8Decoder) {
  379. return UTF8Decoder.decode(u8Array.subarray(idx, endPtr));
  380. } else {
  381. var str = '';
  382. // If building with TextDecoder, we have already computed the string length above, so test loop end condition against that
  383. while (idx < endPtr) {
  384. // For UTF8 byte structure, see:
  385. // http://en.wikipedia.org/wiki/UTF-8#Description
  386. // https://www.ietf.org/rfc/rfc2279.txt
  387. // https://tools.ietf.org/html/rfc3629
  388. var u0 = u8Array[idx++];
  389. if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; }
  390. var u1 = u8Array[idx++] & 63;
  391. if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; }
  392. var u2 = u8Array[idx++] & 63;
  393. if ((u0 & 0xF0) == 0xE0) {
  394. u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
  395. } else {
  396. if ((u0 & 0xF8) != 0xF0) warnOnce('Invalid UTF-8 leading byte 0x' + u0.toString(16) + ' encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!');
  397. u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (u8Array[idx++] & 63);
  398. }
  399. if (u0 < 0x10000) {
  400. str += String.fromCharCode(u0);
  401. } else {
  402. var ch = u0 - 0x10000;
  403. str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
  404. }
  405. }
  406. }
  407. return str;
  408. }
  409. // Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the emscripten HEAP, returns a
  410. // copy of that string as a Javascript String object.
  411. // maxBytesToRead: an optional length that specifies the maximum number of bytes to read. You can omit
  412. // this parameter to scan the string until the first \0 byte. If maxBytesToRead is
  413. // passed, and the string at [ptr, ptr+maxBytesToReadr[ contains a null byte in the
  414. // middle, then the string will cut short at that byte index (i.e. maxBytesToRead will
  415. // not produce a string of exact length [ptr, ptr+maxBytesToRead[)
  416. // N.B. mixing frequent uses of UTF8ToString() with and without maxBytesToRead may
  417. // throw JS JIT optimizations off, so it is worth to consider consistently using one
  418. // style or the other.
  419. /**
  420. * @param {number} ptr
  421. * @param {number=} maxBytesToRead
  422. * @return {string}
  423. */
  424. function UTF8ToString(ptr, maxBytesToRead) {
  425. return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
  426. }
  427. // Copies the given Javascript String object 'str' to the given byte array at address 'outIdx',
  428. // encoded in UTF8 form and null-terminated. The copy will require at most str.length*4+1 bytes of space in the HEAP.
  429. // Use the function lengthBytesUTF8 to compute the exact number of bytes (excluding null terminator) that this function will write.
  430. // Parameters:
  431. // str: the Javascript string to copy.
  432. // outU8Array: the array to copy to. Each index in this array is assumed to be one 8-byte element.
  433. // outIdx: The starting offset in the array to begin the copying.
  434. // maxBytesToWrite: The maximum number of bytes this function can write to the array.
  435. // This count should include the null terminator,
  436. // i.e. if maxBytesToWrite=1, only the null terminator will be written and nothing else.
  437. // maxBytesToWrite=0 does not write any bytes to the output, not even the null terminator.
  438. // Returns the number of bytes written, EXCLUDING the null terminator.
  439. function stringToUTF8Array(str, outU8Array, outIdx, maxBytesToWrite) {
  440. if (!(maxBytesToWrite > 0)) // Parameter maxBytesToWrite is not optional. Negative values, 0, null, undefined and false each don't write out any bytes.
  441. return 0;
  442. var startIdx = outIdx;
  443. var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
  444. for (var i = 0; i < str.length; ++i) {
  445. // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! So decode UTF16->UTF32->UTF8.
  446. // See http://unicode.org/faq/utf_bom.html#utf16-3
  447. // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description and https://www.ietf.org/rfc/rfc2279.txt and https://tools.ietf.org/html/rfc3629
  448. var u = str.charCodeAt(i); // possibly a lead surrogate
  449. if (u >= 0xD800 && u <= 0xDFFF) {
  450. var u1 = str.charCodeAt(++i);
  451. u = 0x10000 + ((u & 0x3FF) << 10) | (u1 & 0x3FF);
  452. }
  453. if (u <= 0x7F) {
  454. if (outIdx >= endIdx) break;
  455. outU8Array[outIdx++] = u;
  456. } else if (u <= 0x7FF) {
  457. if (outIdx + 1 >= endIdx) break;
  458. outU8Array[outIdx++] = 0xC0 | (u >> 6);
  459. outU8Array[outIdx++] = 0x80 | (u & 63);
  460. } else if (u <= 0xFFFF) {
  461. if (outIdx + 2 >= endIdx) break;
  462. outU8Array[outIdx++] = 0xE0 | (u >> 12);
  463. outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
  464. outU8Array[outIdx++] = 0x80 | (u & 63);
  465. } else {
  466. if (outIdx + 3 >= endIdx) break;
  467. if (u >= 0x200000) warnOnce('Invalid Unicode code point 0x' + u.toString(16) + ' encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF).');
  468. outU8Array[outIdx++] = 0xF0 | (u >> 18);
  469. outU8Array[outIdx++] = 0x80 | ((u >> 12) & 63);
  470. outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
  471. outU8Array[outIdx++] = 0x80 | (u & 63);
  472. }
  473. }
  474. // Null-terminate the pointer to the buffer.
  475. outU8Array[outIdx] = 0;
  476. return outIdx - startIdx;
  477. }
  478. // Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',
  479. // null-terminated and encoded in UTF8 form. The copy will require at most str.length*4+1 bytes of space in the HEAP.
  480. // Use the function lengthBytesUTF8 to compute the exact number of bytes (excluding null terminator) that this function will write.
  481. // Returns the number of bytes written, EXCLUDING the null terminator.
  482. function stringToUTF8(str, outPtr, maxBytesToWrite) {
  483. assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
  484. return stringToUTF8Array(str, HEAPU8,outPtr, maxBytesToWrite);
  485. }
  486. // Given a pointer 'ptr' to a null-terminated UTF16LE-encoded string in the emscripten HEAP, returns
  487. // a copy of that string as a Javascript String object.
  488. var UTF16Decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-16le') : undefined;
  489. function writeArrayToMemory(array, buffer) {
  490. assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)');
  491. HEAP8.set(array, buffer);
  492. }
  493. function demangle(func) {
  494. return func;
  495. }
  496. function demangleAll(text) {
  497. var regex =
  498. /__Z[\w\d_]+/g;
  499. return text.replace(regex,
  500. function(x) {
  501. var y = demangle(x);
  502. return x === y ? x : (y + ' [' + x + ']');
  503. });
  504. }
  505. function jsStackTrace() {
  506. var err = new Error();
  507. if (!err.stack) {
  508. // IE10+ special cases: It does have callstack info, but it is only populated if an Error object is thrown,
  509. // so try that as a special-case.
  510. try {
  511. throw new Error(0);
  512. } catch(e) {
  513. err = e;
  514. }
  515. if (!err.stack) {
  516. return '(no stack trace available)';
  517. }
  518. }
  519. return err.stack.toString();
  520. }
  521. function stackTrace() {
  522. var js = jsStackTrace();
  523. if (Module['extraStackTrace']) js += '\n' + Module['extraStackTrace']();
  524. return demangleAll(js);
  525. }
  526. var WASM_PAGE_SIZE = 65536;
  527. function alignUp(x, multiple) {
  528. if (x % multiple > 0) {
  529. x += multiple - (x % multiple);
  530. }
  531. return x;
  532. }
  533. var /** @type {ArrayBuffer} */
  534. buffer,
  535. /** @type {Int8Array} */
  536. HEAP8,
  537. /** @type {Uint8Array} */
  538. HEAPU8,
  539. /** @type {Int16Array} */
  540. HEAP16,
  541. /** @type {Uint16Array} */
  542. HEAPU16,
  543. /** @type {Int32Array} */
  544. HEAP32,
  545. /** @type {Uint32Array} */
  546. HEAPU32,
  547. /** @type {Float32Array} */
  548. HEAPF32,
  549. /** @type {Float64Array} */
  550. HEAPF64;
  551. function updateGlobalBufferViews() {
  552. Module['HEAP8'] = HEAP8 = new Int8Array(buffer);
  553. Module['HEAP16'] = HEAP16 = new Int16Array(buffer);
  554. Module['HEAP32'] = HEAP32 = new Int32Array(buffer);
  555. Module['HEAPU8'] = HEAPU8 = new Uint8Array(buffer);
  556. Module['HEAPU16'] = HEAPU16 = new Uint16Array(buffer);
  557. Module['HEAPU32'] = HEAPU32 = new Uint32Array(buffer);
  558. Module['HEAPF32'] = HEAPF32 = new Float32Array(buffer);
  559. Module['HEAPF64'] = HEAPF64 = new Float64Array(buffer);
  560. }
  561. var STACK_BASE = 15104,
  562. STACK_MAX = 5257984,
  563. DYNAMIC_BASE = 5257984,
  564. DYNAMICTOP_PTR = 15072;
  565. assert(STACK_BASE % 16 === 0, 'stack must start aligned');
  566. assert(DYNAMIC_BASE % 16 === 0, 'heap must start aligned');
  567. var TOTAL_STACK = 5242880;
  568. if (Module['TOTAL_STACK']) assert(TOTAL_STACK === Module['TOTAL_STACK'], 'the stack size can no longer be determined at runtime');
  569. var INITIAL_TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 16777216;
  570. if (INITIAL_TOTAL_MEMORY < TOTAL_STACK) err('TOTAL_MEMORY should be larger than TOTAL_STACK, was ' + INITIAL_TOTAL_MEMORY + '! (TOTAL_STACK=' + TOTAL_STACK + ')');
  571. // Initialize the runtime's memory
  572. // check for full engine support (use string 'subarray' to avoid closure compiler confusion)
  573. assert(typeof Int32Array !== 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray !== undefined && Int32Array.prototype.set !== undefined,
  574. 'JS engine does not provide full typed array support');
  575. // Use a provided buffer, if there is one, or else allocate a new one
  576. if (Module['buffer']) {
  577. buffer = Module['buffer'];
  578. assert(buffer.byteLength === INITIAL_TOTAL_MEMORY, 'provided buffer should be ' + INITIAL_TOTAL_MEMORY + ' bytes, but it is ' + buffer.byteLength);
  579. } else {
  580. // Use a WebAssembly memory where available
  581. if (typeof WebAssembly === 'object' && typeof WebAssembly.Memory === 'function') {
  582. assert(INITIAL_TOTAL_MEMORY % WASM_PAGE_SIZE === 0);
  583. wasmMemory = new WebAssembly.Memory({ 'initial': INITIAL_TOTAL_MEMORY / WASM_PAGE_SIZE });
  584. buffer = wasmMemory.buffer;
  585. } else
  586. {
  587. buffer = new ArrayBuffer(INITIAL_TOTAL_MEMORY);
  588. }
  589. assert(buffer.byteLength === INITIAL_TOTAL_MEMORY);
  590. }
  591. updateGlobalBufferViews();
  592. HEAP32[DYNAMICTOP_PTR>>2] = DYNAMIC_BASE;
  593. // Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
  594. function writeStackCookie() {
  595. assert((STACK_MAX & 3) == 0);
  596. HEAPU32[(STACK_MAX >> 2)-1] = 0x02135467;
  597. HEAPU32[(STACK_MAX >> 2)-2] = 0x89BACDFE;
  598. }
  599. function checkStackCookie() {
  600. if (HEAPU32[(STACK_MAX >> 2)-1] != 0x02135467 || HEAPU32[(STACK_MAX >> 2)-2] != 0x89BACDFE) {
  601. abort('Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x' + HEAPU32[(STACK_MAX >> 2)-2].toString(16) + ' ' + HEAPU32[(STACK_MAX >> 2)-1].toString(16));
  602. }
  603. // Also test the global address 0 for integrity.
  604. if (HEAP32[0] !== 0x63736d65 /* 'emsc' */) abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
  605. }
  606. function abortStackOverflow(allocSize) {
  607. abort('Stack overflow! Attempted to allocate ' + allocSize + ' bytes on the stack, but stack has only ' + (STACK_MAX - stackSave() + allocSize) + ' bytes available!');
  608. }
  609. HEAP32[0] = 0x63736d65; /* 'emsc' */
  610. // Endianness check (note: assumes compiler arch was little-endian)
  611. HEAP16[1] = 0x6373;
  612. if (HEAPU8[2] !== 0x73 || HEAPU8[3] !== 0x63) throw 'Runtime error: expected the system to be little-endian!';
  613. function callRuntimeCallbacks(callbacks) {
  614. while(callbacks.length > 0) {
  615. var callback = callbacks.shift();
  616. if (typeof callback == 'function') {
  617. callback();
  618. continue;
  619. }
  620. var func = callback.func;
  621. if (typeof func === 'number') {
  622. if (callback.arg === undefined) {
  623. Module['dynCall_v'](func);
  624. } else {
  625. Module['dynCall_vi'](func, callback.arg);
  626. }
  627. } else {
  628. func(callback.arg === undefined ? null : callback.arg);
  629. }
  630. }
  631. }
  632. var __ATPRERUN__ = []; // functions called before the runtime is initialized
  633. var __ATINIT__ = []; // functions called during startup
  634. var __ATMAIN__ = []; // functions called when main() is to be run
  635. var __ATPOSTRUN__ = []; // functions called after the main() is called
  636. var runtimeInitialized = false;
  637. var runtimeExited = false;
  638. function preRun() {
  639. // compatibility - merge in anything from Module['preRun'] at this time
  640. if (Module['preRun']) {
  641. if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
  642. while (Module['preRun'].length) {
  643. addOnPreRun(Module['preRun'].shift());
  644. }
  645. }
  646. callRuntimeCallbacks(__ATPRERUN__);
  647. }
  648. function ensureInitRuntime() {
  649. checkStackCookie();
  650. if (runtimeInitialized) return;
  651. runtimeInitialized = true;
  652. callRuntimeCallbacks(__ATINIT__);
  653. }
  654. function preMain() {
  655. checkStackCookie();
  656. callRuntimeCallbacks(__ATMAIN__);
  657. }
  658. function postRun() {
  659. checkStackCookie();
  660. // compatibility - merge in anything from Module['postRun'] at this time
  661. if (Module['postRun']) {
  662. if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
  663. while (Module['postRun'].length) {
  664. addOnPostRun(Module['postRun'].shift());
  665. }
  666. }
  667. callRuntimeCallbacks(__ATPOSTRUN__);
  668. }
  669. function addOnPreRun(cb) {
  670. __ATPRERUN__.unshift(cb);
  671. }
  672. function addOnPostRun(cb) {
  673. __ATPOSTRUN__.unshift(cb);
  674. }
  675. 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');
  676. 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');
  677. 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');
  678. 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');
  679. // A counter of dependencies for calling run(). If we need to
  680. // do asynchronous work before running, increment this and
  681. // decrement it. Incrementing must happen in a place like
  682. // Module.preRun (used by emcc to add file preloading).
  683. // Note that you can add dependencies in preRun, even though
  684. // it happens right before run - run will be postponed until
  685. // the dependencies are met.
  686. var runDependencies = 0;
  687. var runDependencyWatcher = null;
  688. var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
  689. var runDependencyTracking = {};
  690. function addRunDependency(id) {
  691. runDependencies++;
  692. if (Module['monitorRunDependencies']) {
  693. Module['monitorRunDependencies'](runDependencies);
  694. }
  695. if (id) {
  696. assert(!runDependencyTracking[id]);
  697. runDependencyTracking[id] = 1;
  698. if (runDependencyWatcher === null && typeof setInterval !== 'undefined') {
  699. // Check for missing dependencies every few seconds
  700. runDependencyWatcher = setInterval(function() {
  701. if (ABORT) {
  702. clearInterval(runDependencyWatcher);
  703. runDependencyWatcher = null;
  704. return;
  705. }
  706. }, 10000);
  707. }
  708. }
  709. }
  710. function removeRunDependency(id) {
  711. runDependencies--;
  712. if (Module['monitorRunDependencies']) {
  713. Module['monitorRunDependencies'](runDependencies);
  714. }
  715. if (id) {
  716. assert(runDependencyTracking[id]);
  717. delete runDependencyTracking[id];
  718. } else {
  719. err('warning: run dependency removed without ID');
  720. }
  721. if (runDependencies == 0) {
  722. if (runDependencyWatcher !== null) {
  723. clearInterval(runDependencyWatcher);
  724. runDependencyWatcher = null;
  725. }
  726. if (dependenciesFulfilled) {
  727. var callback = dependenciesFulfilled;
  728. dependenciesFulfilled = null;
  729. callback(); // can add another dependenciesFulfilled
  730. }
  731. }
  732. }
  733. Module["preloadedImages"] = {}; // maps url to image data
  734. Module["preloadedAudios"] = {}; // maps url to audio data
  735. // show errors on likely calls to FS when it was not included
  736. var FS = {
  737. error: function() {
  738. 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');
  739. },
  740. init: function() { FS.error(); },
  741. createDataFile: function() { FS.error(); },
  742. createPreloadedFile: function() { FS.error(); },
  743. createLazyFile: function() { FS.error(); },
  744. open: function() { FS.error(); },
  745. mkdev: function() { FS.error(); },
  746. registerDevice: function() { FS.error(); },
  747. analyzePath: function() { FS.error(); },
  748. loadFilesFromDB: function() { FS.error(); },
  749. ErrnoError: function ErrnoError() { FS.error(); },
  750. };
  751. Module['FS_createDataFile'] = FS.createDataFile;
  752. Module['FS_createPreloadedFile'] = FS.createPreloadedFile;
  753. // Copyright 2017 The Emscripten Authors. All rights reserved.
  754. // Emscripten is available under two separate licenses, the MIT license and the
  755. // University of Illinois/NCSA Open Source License. Both these licenses can be
  756. // found in the LICENSE file.
  757. // Prefix of data URIs emitted by SINGLE_FILE and related options.
  758. var dataURIPrefix = 'data:application/octet-stream;base64,';
  759. // Indicates whether filename is a base64 data URI.
  760. function isDataURI(filename) {
  761. return String.prototype.startsWith ?
  762. filename.startsWith(dataURIPrefix) :
  763. filename.indexOf(dataURIPrefix) === 0;
  764. }
  765. var wasmBinaryFile = 'ThirdParty/unzip.wasm';
  766. if (!isDataURI(wasmBinaryFile)) {
  767. wasmBinaryFile = locateFile(wasmBinaryFile);
  768. }
  769. function getBinary() {
  770. try {
  771. if (Module['wasmBinary']) {
  772. return new Uint8Array(Module['wasmBinary']);
  773. }
  774. if (Module['readBinary']) {
  775. return Module['readBinary'](wasmBinaryFile);
  776. } else {
  777. throw "both async and sync fetching of the wasm failed";
  778. }
  779. }
  780. catch (err) {
  781. abort(err);
  782. }
  783. }
  784. function getBinaryPromise() {
  785. // if we don't have the binary yet, and have the Fetch api, use that
  786. // in some environments, like Electron's render process, Fetch api may be present, but have a different context than expected, let's only use it on the Web
  787. if (!Module['wasmBinary'] && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === 'function') {
  788. return fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(function(response) {
  789. if (!response['ok']) {
  790. throw "failed to load wasm binary file at '" + wasmBinaryFile + "'";
  791. }
  792. return response['arrayBuffer']();
  793. }).catch(function () {
  794. return getBinary();
  795. });
  796. }
  797. // Otherwise, getBinary should be able to get it synchronously
  798. return new Promise(function(resolve, reject) {
  799. resolve(getBinary());
  800. });
  801. }
  802. // Create the wasm instance.
  803. // Receives the wasm imports, returns the exports.
  804. function createWasm(env) {
  805. // prepare imports
  806. var info = {
  807. 'env': env
  808. ,
  809. 'global': {
  810. 'NaN': NaN,
  811. 'Infinity': Infinity
  812. },
  813. 'global.Math': Math,
  814. 'asm2wasm': asm2wasmImports
  815. };
  816. // Load the wasm module and create an instance of using native support in the JS engine.
  817. // handle a generated wasm instance, receiving its exports and
  818. // performing other necessary setup
  819. function receiveInstance(instance, module) {
  820. var exports = instance.exports;
  821. Module['asm'] = exports;
  822. removeRunDependency('wasm-instantiate');
  823. }
  824. addRunDependency('wasm-instantiate');
  825. // Async compilation can be confusing when an error on the page overwrites Module
  826. // (for example, if the order of elements is wrong, and the one defining Module is
  827. // later), so we save Module and check it later.
  828. var trueModule = Module;
  829. function receiveInstantiatedSource(output) {
  830. // 'output' is a WebAssemblyInstantiatedSource object which has both the module and instance.
  831. // receiveInstance() will swap in the exports (to Module.asm) so they can be called
  832. assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?');
  833. trueModule = null;
  834. // 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.
  835. // When the regression is fixed, can restore the above USE_PTHREADS-enabled path.
  836. receiveInstance(output['instance']);
  837. }
  838. function instantiateArrayBuffer(receiver) {
  839. return getBinaryPromise().then(function(binary) {
  840. return WebAssembly.instantiate(binary, info);
  841. }).then(receiver, function(reason) {
  842. //err('failed to asynchronously prepare wasm: ' + reason);
  843. //abort(reason);
  844. });
  845. }
  846. // Prefer streaming instantiation if available.
  847. function instantiateAsync() {
  848. if (!Module['wasmBinary'] &&
  849. typeof WebAssembly.instantiateStreaming === 'function' &&
  850. !isDataURI(wasmBinaryFile) &&
  851. typeof fetch === 'function') {
  852. fetch(wasmBinaryFile, { credentials: 'same-origin' }).then(function (response) {
  853. return WebAssembly.instantiateStreaming(response, info)
  854. .then(receiveInstantiatedSource, function(reason) {
  855. // We expect the most common failure cause to be a bad MIME type for the binary,
  856. // in which case falling back to ArrayBuffer instantiation should work.
  857. // err('wasm streaming compile failed: ' + reason);
  858. // err('falling back to ArrayBuffer instantiation');
  859. instantiateArrayBuffer(receiveInstantiatedSource);
  860. });
  861. });
  862. } else {
  863. return instantiateArrayBuffer(receiveInstantiatedSource);
  864. }
  865. }
  866. // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback
  867. // to manually instantiate the Wasm module themselves. This allows pages to run the instantiation parallel
  868. // to any other async startup actions they are performing.
  869. if (Module['instantiateWasm']) {
  870. try {
  871. return Module['instantiateWasm'](info, receiveInstance);
  872. } catch(e) {
  873. //err('Module.instantiateWasm callback failed with error: ' + e);
  874. return false;
  875. }
  876. }
  877. instantiateAsync();
  878. return {}; // no exports yet; we'll fill them in later
  879. }
  880. // Provide an "asm.js function" for the application, called to "link" the asm.js module. We instantiate
  881. // the wasm module at that time, and it receives imports and provides exports and so forth, the app
  882. // doesn't need to care that it is wasm or asm.js.
  883. Module['asm'] = function(global, env, providedBuffer) {
  884. // memory was already allocated (so js could use the buffer)
  885. env['memory'] = wasmMemory
  886. ;
  887. // import table
  888. env['table'] = wasmTable = new WebAssembly.Table({
  889. 'initial': 22,
  890. 'maximum': 22,
  891. 'element': 'anyfunc'
  892. });
  893. // With the wasm backend __memory_base and __table_base and only needed for
  894. // relocatable output.
  895. env['__memory_base'] = 1024; // tell the memory segments where to place themselves
  896. // table starts at 0 by default (even in dynamic linking, for the main module)
  897. env['__table_base'] = 0;
  898. var exports = createWasm(env);
  899. assert(exports, 'binaryen setup failed (no wasm support?)');
  900. return exports;
  901. };
  902. // STATICTOP = STATIC_BASE + 14080;
  903. /* global initializers */ /*__ATINIT__.push();*/
  904. /* no memory initializer */
  905. var tempDoublePtr = 15088;
  906. assert(tempDoublePtr % 8 == 0);
  907. // {{PRE_LIBRARY}}
  908. function ___lock() {}
  909. var SYSCALLS={buffers:[null,[],[]],printChar:function (stream, curr) {
  910. var buffer = SYSCALLS.buffers[stream];
  911. assert(buffer);
  912. if (curr === 0 || curr === 10) {
  913. (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));
  914. buffer.length = 0;
  915. } else {
  916. buffer.push(curr);
  917. }
  918. },varargs:0,get:function (varargs) {
  919. SYSCALLS.varargs += 4;
  920. var ret = HEAP32[(((SYSCALLS.varargs)-(4))>>2)];
  921. return ret;
  922. },getStr:function () {
  923. var ret = UTF8ToString(SYSCALLS.get());
  924. return ret;
  925. },get64:function () {
  926. var low = SYSCALLS.get(), high = SYSCALLS.get();
  927. if (low >= 0) assert(high === 0);
  928. else assert(high === -1);
  929. return low;
  930. },getZero:function () {
  931. assert(SYSCALLS.get() === 0);
  932. }};function ___syscall140(which, varargs) {SYSCALLS.varargs = varargs;
  933. try {
  934. // llseek
  935. var stream = SYSCALLS.getStreamFromFD(), offset_high = SYSCALLS.get(), offset_low = SYSCALLS.get(), result = SYSCALLS.get(), whence = SYSCALLS.get();
  936. abort('it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM');
  937. return 0;
  938. } catch (e) {
  939. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  940. return -e.errno;
  941. }
  942. }
  943. function flush_NO_FILESYSTEM() {
  944. // flush anything remaining in the buffers during shutdown
  945. var fflush = Module["_fflush"];
  946. if (fflush) fflush(0);
  947. var buffers = SYSCALLS.buffers;
  948. if (buffers[1].length) SYSCALLS.printChar(1, 10);
  949. if (buffers[2].length) SYSCALLS.printChar(2, 10);
  950. }function ___syscall146(which, varargs) {SYSCALLS.varargs = varargs;
  951. try {
  952. // writev
  953. // hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0
  954. var stream = SYSCALLS.get(), iov = SYSCALLS.get(), iovcnt = SYSCALLS.get();
  955. var ret = 0;
  956. for (var i = 0; i < iovcnt; i++) {
  957. var ptr = HEAP32[(((iov)+(i*8))>>2)];
  958. var len = HEAP32[(((iov)+(i*8 + 4))>>2)];
  959. for (var j = 0; j < len; j++) {
  960. SYSCALLS.printChar(stream, HEAPU8[ptr+j]);
  961. }
  962. ret += len;
  963. }
  964. return ret;
  965. } catch (e) {
  966. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  967. return -e.errno;
  968. }
  969. }
  970. function ___syscall54(which, varargs) {SYSCALLS.varargs = varargs;
  971. try {
  972. // ioctl
  973. return 0;
  974. } catch (e) {
  975. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  976. return -e.errno;
  977. }
  978. }
  979. function ___syscall6(which, varargs) {SYSCALLS.varargs = varargs;
  980. try {
  981. // close
  982. var stream = SYSCALLS.getStreamFromFD();
  983. abort('it should not be possible to operate on streams when !SYSCALLS_REQUIRE_FILESYSTEM');
  984. return 0;
  985. } catch (e) {
  986. if (typeof FS === 'undefined' || !(e instanceof FS.ErrnoError)) abort(e);
  987. return -e.errno;
  988. }
  989. }
  990. function ___unlock() {}
  991. function _emscripten_get_heap_size() {
  992. return HEAP8.length;
  993. }
  994. function _emscripten_memcpy_big(dest, src, num) {
  995. HEAPU8.set(HEAPU8.subarray(src, src+num), dest);
  996. }
  997. function ___setErrNo(value) {
  998. if (Module['___errno_location']) HEAP32[((Module['___errno_location']())>>2)]=value;
  999. else err('failed to set errno from JS');
  1000. return value;
  1001. }
  1002. function abortOnCannotGrowMemory(requestedSize) {
  1003. abort('Cannot enlarge memory arrays to size ' + requestedSize + ' bytes (OOM). Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value ' + HEAP8.length + ', (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ');
  1004. }
  1005. function emscripten_realloc_buffer(size) {
  1006. var PAGE_MULTIPLE = 65536;
  1007. size = alignUp(size, PAGE_MULTIPLE); // round up to wasm page size
  1008. var oldSize = buffer.byteLength;
  1009. // native wasm support
  1010. // note that this is *not* threadsafe. multiple threads can call .grow(), and each
  1011. // presents a delta, so in theory we may over-allocate here (e.g. if two threads
  1012. // ask to grow from 256MB to 512MB, we get 2 requests to add +256MB, and may end
  1013. // up growing to 768MB (even though we may have been able to make do with 512MB).
  1014. // TODO: consider decreasing the step sizes in emscripten_resize_heap
  1015. try {
  1016. var result = wasmMemory.grow((size - oldSize) / 65536); // .grow() takes a delta compared to the previous size
  1017. if (result !== (-1 | 0)) {
  1018. // success in native wasm memory growth, get the buffer from the memory
  1019. buffer = wasmMemory.buffer;
  1020. return true;
  1021. } else {
  1022. return false;
  1023. }
  1024. } catch(e) {
  1025. console.error('emscripten_realloc_buffer: Attempted to grow from ' + oldSize + ' bytes to ' + size + ' bytes, but got error: ' + e);
  1026. return false;
  1027. }
  1028. }function _emscripten_resize_heap(requestedSize) {
  1029. var oldSize = _emscripten_get_heap_size();
  1030. // With pthreads, races can happen (another thread might increase the size in between), so return a failure, and let the caller retry.
  1031. assert(requestedSize > oldSize);
  1032. var PAGE_MULTIPLE = 65536;
  1033. var LIMIT = 2147483648 - PAGE_MULTIPLE; // We can do one page short of 2GB as theoretical maximum.
  1034. if (requestedSize > LIMIT) {
  1035. err('Cannot enlarge memory, asked to go up to ' + requestedSize + ' bytes, but the limit is ' + LIMIT + ' bytes!');
  1036. return false;
  1037. }
  1038. var MIN_TOTAL_MEMORY = 16777216;
  1039. var newSize = Math.max(oldSize, MIN_TOTAL_MEMORY); // So the loop below will not be infinite, and minimum asm.js memory size is 16MB.
  1040. // TODO: see realloc_buffer - for PTHREADS we may want to decrease these jumps
  1041. while (newSize < requestedSize) { // Keep incrementing the heap size as long as it's less than what is requested.
  1042. if (newSize <= 536870912) {
  1043. newSize = alignUp(2 * newSize, PAGE_MULTIPLE); // Simple heuristic: double until 1GB...
  1044. } else {
  1045. // ..., but after that, add smaller increments towards 2GB, which we cannot reach
  1046. newSize = Math.min(alignUp((3 * newSize + 2147483648) / 4, PAGE_MULTIPLE), LIMIT);
  1047. }
  1048. if (newSize === oldSize) {
  1049. warnOnce('Cannot ask for more memory since we reached the practical limit in browsers (which is just below 2GB), so the request would have failed. Requesting only ' + HEAP8.length);
  1050. }
  1051. }
  1052. if (!emscripten_realloc_buffer(newSize)) {
  1053. err('Failed to grow the heap from ' + oldSize + ' bytes to ' + newSize + ' bytes, not enough memory!');
  1054. return false;
  1055. }
  1056. updateGlobalBufferViews();
  1057. return true;
  1058. }
  1059. // ASM_LIBRARY EXTERN PRIMITIVES: Int8Array,Int32Array
  1060. function nullFunc_ii(x) { err("Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); err("Build with ASSERTIONS=2 for more info.");abort(x); }
  1061. function nullFunc_iiii(x) { err("Invalid function pointer called with signature 'iiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); err("Build with ASSERTIONS=2 for more info.");abort(x); }
  1062. function nullFunc_jiji(x) { err("Invalid function pointer called with signature 'jiji'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); err("Build with ASSERTIONS=2 for more info.");abort(x); }
  1063. function nullFunc_vii(x) { err("Invalid function pointer called with signature 'vii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); err("Build with ASSERTIONS=2 for more info.");abort(x); }
  1064. var asmGlobalArg = {};
  1065. var asmLibraryArg = {
  1066. "abort": abort,
  1067. "setTempRet0": setTempRet0,
  1068. "getTempRet0": getTempRet0,
  1069. "abortStackOverflow": abortStackOverflow,
  1070. "nullFunc_ii": nullFunc_ii,
  1071. "nullFunc_iiii": nullFunc_iiii,
  1072. "nullFunc_jiji": nullFunc_jiji,
  1073. "nullFunc_vii": nullFunc_vii,
  1074. "___lock": ___lock,
  1075. "___setErrNo": ___setErrNo,
  1076. "___syscall140": ___syscall140,
  1077. "___syscall146": ___syscall146,
  1078. "___syscall54": ___syscall54,
  1079. "___syscall6": ___syscall6,
  1080. "___unlock": ___unlock,
  1081. "_emscripten_get_heap_size": _emscripten_get_heap_size,
  1082. "_emscripten_memcpy_big": _emscripten_memcpy_big,
  1083. "_emscripten_resize_heap": _emscripten_resize_heap,
  1084. "abortOnCannotGrowMemory": abortOnCannotGrowMemory,
  1085. "emscripten_realloc_buffer": emscripten_realloc_buffer,
  1086. "flush_NO_FILESYSTEM": flush_NO_FILESYSTEM,
  1087. "tempDoublePtr": tempDoublePtr,
  1088. "DYNAMICTOP_PTR": DYNAMICTOP_PTR
  1089. };
  1090. // EMSCRIPTEN_START_ASM
  1091. var asm =Module["asm"]// EMSCRIPTEN_END_ASM
  1092. (asmGlobalArg, asmLibraryArg, buffer);
  1093. var real____errno_location = asm["___errno_location"];
  1094. asm["___errno_location"] = function() {
  1095. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1096. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1097. return real____errno_location.apply(null, arguments);
  1098. };
  1099. var real__fflush = asm["_fflush"];
  1100. asm["_fflush"] = function() {
  1101. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1102. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1103. return real__fflush.apply(null, arguments);
  1104. };
  1105. var real__free = asm["_free"];
  1106. asm["_free"] = function() {
  1107. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1108. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1109. return real__free.apply(null, arguments);
  1110. };
  1111. var real__freePointer = asm["_freePointer"];
  1112. asm["_freePointer"] = function() {
  1113. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1114. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1115. return real__freePointer.apply(null, arguments);
  1116. };
  1117. var real__llvm_bswap_i32 = asm["_llvm_bswap_i32"];
  1118. asm["_llvm_bswap_i32"] = function() {
  1119. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1120. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1121. return real__llvm_bswap_i32.apply(null, arguments);
  1122. };
  1123. var real__malloc = asm["_malloc"];
  1124. asm["_malloc"] = function() {
  1125. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1126. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1127. return real__malloc.apply(null, arguments);
  1128. };
  1129. var real__sbrk = asm["_sbrk"];
  1130. asm["_sbrk"] = function() {
  1131. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1132. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1133. return real__sbrk.apply(null, arguments);
  1134. };
  1135. var real__unzip = asm["_unzip"];
  1136. asm["_unzip"] = function() {
  1137. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1138. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1139. return real__unzip.apply(null, arguments);
  1140. };
  1141. var real_establishStackSpace = asm["establishStackSpace"];
  1142. asm["establishStackSpace"] = function() {
  1143. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1144. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1145. return real_establishStackSpace.apply(null, arguments);
  1146. };
  1147. var real_stackAlloc = asm["stackAlloc"];
  1148. asm["stackAlloc"] = function() {
  1149. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1150. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1151. return real_stackAlloc.apply(null, arguments);
  1152. };
  1153. var real_stackRestore = asm["stackRestore"];
  1154. asm["stackRestore"] = function() {
  1155. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1156. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1157. return real_stackRestore.apply(null, arguments);
  1158. };
  1159. var real_stackSave = asm["stackSave"];
  1160. asm["stackSave"] = function() {
  1161. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1162. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1163. return real_stackSave.apply(null, arguments);
  1164. };
  1165. Module["asm"] = asm;
  1166. var ___errno_location = Module["___errno_location"] = function() {
  1167. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1168. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1169. return Module["asm"]["___errno_location"].apply(null, arguments)
  1170. };
  1171. var _emscripten_replace_memory = Module["_emscripten_replace_memory"] = function() {
  1172. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1173. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1174. return Module["asm"]["_emscripten_replace_memory"].apply(null, arguments)
  1175. };
  1176. var _fflush = Module["_fflush"] = function() {
  1177. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1178. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1179. return Module["asm"]["_fflush"].apply(null, arguments)
  1180. };
  1181. var _free = Module["_free"] = function() {
  1182. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1183. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1184. return Module["asm"]["_free"].apply(null, arguments)
  1185. };
  1186. var _freePointer = Module["_freePointer"] = function() {
  1187. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1188. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1189. return Module["asm"]["_freePointer"].apply(null, arguments)
  1190. };
  1191. var _llvm_bswap_i32 = Module["_llvm_bswap_i32"] = function() {
  1192. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1193. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1194. return Module["asm"]["_llvm_bswap_i32"].apply(null, arguments)
  1195. };
  1196. var _malloc = Module["_malloc"] = function() {
  1197. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1198. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1199. return Module["asm"]["_malloc"].apply(null, arguments)
  1200. };
  1201. var _memcpy = Module["_memcpy"] = function() {
  1202. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1203. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1204. return Module["asm"]["_memcpy"].apply(null, arguments)
  1205. };
  1206. var _memset = Module["_memset"] = function() {
  1207. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1208. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1209. return Module["asm"]["_memset"].apply(null, arguments)
  1210. };
  1211. var _sbrk = Module["_sbrk"] = function() {
  1212. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1213. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1214. return Module["asm"]["_sbrk"].apply(null, arguments)
  1215. };
  1216. var _unzip = Module["_unzip"] = function() {
  1217. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1218. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1219. return Module["asm"]["_unzip"].apply(null, arguments)
  1220. };
  1221. var establishStackSpace = Module["establishStackSpace"] = function() {
  1222. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1223. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1224. return Module["asm"]["establishStackSpace"].apply(null, arguments)
  1225. };
  1226. var stackAlloc = Module["stackAlloc"] = function() {
  1227. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1228. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1229. return Module["asm"]["stackAlloc"].apply(null, arguments)
  1230. };
  1231. var stackRestore = Module["stackRestore"] = function() {
  1232. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1233. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1234. return Module["asm"]["stackRestore"].apply(null, arguments)
  1235. };
  1236. var stackSave = Module["stackSave"] = function() {
  1237. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1238. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1239. return Module["asm"]["stackSave"].apply(null, arguments)
  1240. };
  1241. var dynCall_ii = Module["dynCall_ii"] = function() {
  1242. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1243. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1244. return Module["asm"]["dynCall_ii"].apply(null, arguments)
  1245. };
  1246. var dynCall_iiii = Module["dynCall_iiii"] = function() {
  1247. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1248. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1249. return Module["asm"]["dynCall_iiii"].apply(null, arguments)
  1250. };
  1251. var dynCall_jiji = Module["dynCall_jiji"] = function() {
  1252. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1253. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1254. return Module["asm"]["dynCall_jiji"].apply(null, arguments)
  1255. };
  1256. var dynCall_vii = Module["dynCall_vii"] = function() {
  1257. assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
  1258. assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
  1259. return Module["asm"]["dynCall_vii"].apply(null, arguments)
  1260. };
  1261. // === Auto-generated postamble setup entry stuff ===
  1262. Module['asm'] = asm;
  1263. if (!Module["intArrayFromString"]) Module["intArrayFromString"] = function() { abort("'intArrayFromString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1264. if (!Module["intArrayToString"]) Module["intArrayToString"] = function() { abort("'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1265. Module["ccall"] = ccall;
  1266. Module["cwrap"] = cwrap;
  1267. if (!Module["setValue"]) Module["setValue"] = function() { abort("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1268. Module["getValue"] = getValue;
  1269. if (!Module["allocate"]) Module["allocate"] = function() { abort("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1270. if (!Module["getMemory"]) Module["getMemory"] = function() { abort("'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1271. if (!Module["AsciiToString"]) Module["AsciiToString"] = function() { abort("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1272. if (!Module["stringToAscii"]) Module["stringToAscii"] = function() { abort("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1273. if (!Module["UTF8ArrayToString"]) Module["UTF8ArrayToString"] = function() { abort("'UTF8ArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1274. if (!Module["UTF8ToString"]) Module["UTF8ToString"] = function() { abort("'UTF8ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1275. if (!Module["stringToUTF8Array"]) Module["stringToUTF8Array"] = function() { abort("'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1276. if (!Module["stringToUTF8"]) Module["stringToUTF8"] = function() { abort("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1277. if (!Module["lengthBytesUTF8"]) Module["lengthBytesUTF8"] = function() { abort("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1278. if (!Module["UTF16ToString"]) Module["UTF16ToString"] = function() { abort("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1279. if (!Module["stringToUTF16"]) Module["stringToUTF16"] = function() { abort("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1280. if (!Module["lengthBytesUTF16"]) Module["lengthBytesUTF16"] = function() { abort("'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1281. if (!Module["UTF32ToString"]) Module["UTF32ToString"] = function() { abort("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1282. if (!Module["stringToUTF32"]) Module["stringToUTF32"] = function() { abort("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1283. if (!Module["lengthBytesUTF32"]) Module["lengthBytesUTF32"] = function() { abort("'lengthBytesUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1284. if (!Module["allocateUTF8"]) Module["allocateUTF8"] = function() { abort("'allocateUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1285. if (!Module["stackTrace"]) Module["stackTrace"] = function() { abort("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1286. if (!Module["addOnPreRun"]) Module["addOnPreRun"] = function() { abort("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1287. if (!Module["addOnInit"]) Module["addOnInit"] = function() { abort("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1288. if (!Module["addOnPreMain"]) Module["addOnPreMain"] = function() { abort("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1289. if (!Module["addOnExit"]) Module["addOnExit"] = function() { abort("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1290. if (!Module["addOnPostRun"]) Module["addOnPostRun"] = function() { abort("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1291. if (!Module["writeStringToMemory"]) Module["writeStringToMemory"] = function() { abort("'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1292. if (!Module["writeArrayToMemory"]) Module["writeArrayToMemory"] = function() { abort("'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1293. if (!Module["writeAsciiToMemory"]) Module["writeAsciiToMemory"] = function() { abort("'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1294. if (!Module["addRunDependency"]) Module["addRunDependency"] = function() { abort("'addRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1295. if (!Module["removeRunDependency"]) Module["removeRunDependency"] = function() { abort("'removeRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1296. if (!Module["ENV"]) Module["ENV"] = function() { abort("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1297. if (!Module["FS"]) Module["FS"] = function() { abort("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1298. if (!Module["FS_createFolder"]) Module["FS_createFolder"] = function() { abort("'FS_createFolder' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1299. if (!Module["FS_createPath"]) Module["FS_createPath"] = function() { abort("'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1300. if (!Module["FS_createDataFile"]) Module["FS_createDataFile"] = function() { abort("'FS_createDataFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1301. if (!Module["FS_createPreloadedFile"]) Module["FS_createPreloadedFile"] = function() { abort("'FS_createPreloadedFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1302. if (!Module["FS_createLazyFile"]) Module["FS_createLazyFile"] = function() { abort("'FS_createLazyFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1303. if (!Module["FS_createLink"]) Module["FS_createLink"] = function() { abort("'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1304. if (!Module["FS_createDevice"]) Module["FS_createDevice"] = function() { abort("'FS_createDevice' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1305. if (!Module["FS_unlink"]) Module["FS_unlink"] = function() { abort("'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"); };
  1306. if (!Module["GL"]) Module["GL"] = function() { abort("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1307. if (!Module["dynamicAlloc"]) Module["dynamicAlloc"] = function() { abort("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1308. if (!Module["warnOnce"]) Module["warnOnce"] = function() { abort("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1309. if (!Module["loadDynamicLibrary"]) Module["loadDynamicLibrary"] = function() { abort("'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1310. if (!Module["loadWebAssemblyModule"]) Module["loadWebAssemblyModule"] = function() { abort("'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1311. if (!Module["getLEB"]) Module["getLEB"] = function() { abort("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1312. if (!Module["getFunctionTables"]) Module["getFunctionTables"] = function() { abort("'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1313. if (!Module["alignFunctionTables"]) Module["alignFunctionTables"] = function() { abort("'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1314. if (!Module["registerFunctions"]) Module["registerFunctions"] = function() { abort("'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1315. if (!Module["addFunction"]) Module["addFunction"] = function() { abort("'addFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1316. if (!Module["removeFunction"]) Module["removeFunction"] = function() { abort("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1317. if (!Module["getFuncWrapper"]) Module["getFuncWrapper"] = function() { abort("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1318. if (!Module["prettyPrint"]) Module["prettyPrint"] = function() { abort("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1319. if (!Module["makeBigInt"]) Module["makeBigInt"] = function() { abort("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1320. if (!Module["dynCall"]) Module["dynCall"] = function() { abort("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1321. if (!Module["getCompilerSetting"]) Module["getCompilerSetting"] = function() { abort("'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1322. if (!Module["stackSave"]) Module["stackSave"] = function() { abort("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1323. if (!Module["stackRestore"]) Module["stackRestore"] = function() { abort("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1324. if (!Module["stackAlloc"]) Module["stackAlloc"] = function() { abort("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1325. if (!Module["establishStackSpace"]) Module["establishStackSpace"] = function() { abort("'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1326. if (!Module["print"]) Module["print"] = function() { abort("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1327. if (!Module["printErr"]) Module["printErr"] = function() { abort("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1328. if (!Module["getTempRet0"]) Module["getTempRet0"] = function() { abort("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1329. if (!Module["setTempRet0"]) Module["setTempRet0"] = function() { abort("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };
  1330. if (!Module["Pointer_stringify"]) Module["Pointer_stringify"] = function() { abort("'Pointer_stringify' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); };if (!Module["ALLOC_NORMAL"]) Object.defineProperty(Module, "ALLOC_NORMAL", { get: function() { abort("'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); } });
  1331. if (!Module["ALLOC_STACK"]) Object.defineProperty(Module, "ALLOC_STACK", { get: function() { abort("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); } });
  1332. if (!Module["ALLOC_DYNAMIC"]) Object.defineProperty(Module, "ALLOC_DYNAMIC", { get: function() { abort("'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); } });
  1333. if (!Module["ALLOC_NONE"]) Object.defineProperty(Module, "ALLOC_NONE", { get: function() { abort("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)"); } });
  1334. /**
  1335. * @constructor
  1336. * @extends {Error}
  1337. * @this {ExitStatus}
  1338. */
  1339. function ExitStatus(status) {
  1340. this.name = "ExitStatus";
  1341. this.message = "Program terminated with exit(" + status + ")";
  1342. this.status = status;
  1343. } ExitStatus.prototype = new Error();
  1344. ExitStatus.prototype.constructor = ExitStatus;
  1345. dependenciesFulfilled = function runCaller() {
  1346. // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false)
  1347. if (!Module['calledRun']) run();
  1348. if (!Module['calledRun']) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled
  1349. };
  1350. /** @type {function(Array=)} */
  1351. function run(args) {
  1352. args = args || Module['arguments'];
  1353. if (runDependencies > 0) {
  1354. return;
  1355. }
  1356. writeStackCookie();
  1357. preRun();
  1358. if (runDependencies > 0) return; // a preRun added a dependency, run will be called later
  1359. if (Module['calledRun']) return; // run may have just been called through dependencies being fulfilled just in this very frame
  1360. function doRun() {
  1361. if (Module['calledRun']) return; // run may have just been called while the async setStatus time below was happening
  1362. Module['calledRun'] = true;
  1363. if (ABORT) return;
  1364. ensureInitRuntime();
  1365. preMain();
  1366. if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized']();
  1367. assert(!Module['_main'], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]');
  1368. postRun();
  1369. }
  1370. if (Module['setStatus']) {
  1371. Module['setStatus']('Running...');
  1372. setTimeout(function() {
  1373. setTimeout(function() {
  1374. Module['setStatus']('');
  1375. }, 1);
  1376. doRun();
  1377. }, 1);
  1378. } else {
  1379. doRun();
  1380. }
  1381. checkStackCookie();
  1382. }
  1383. Module['run'] = run;
  1384. var abortDecorators = [];
  1385. function abort(what) {
  1386. if (Module['onAbort']) {
  1387. Module['onAbort'](what);
  1388. }
  1389. if (what !== undefined) {
  1390. //out(what);
  1391. //err(what);
  1392. what = '"' + what + '"';
  1393. } else {
  1394. what = '';
  1395. }
  1396. ABORT = true;
  1397. var extra = '';
  1398. var output = 'abort(' + what + ') at ' + stackTrace() + extra;
  1399. if (abortDecorators) {
  1400. abortDecorators.forEach(function(decorator) {
  1401. output = decorator(output, what);
  1402. });
  1403. }
  1404. throw output;
  1405. }
  1406. Module['abort'] = abort;
  1407. if (Module['preInit']) {
  1408. if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
  1409. while (Module['preInit'].length > 0) {
  1410. Module['preInit'].pop()();
  1411. }
  1412. }
  1413. Module["noExitRuntime"] = true;
  1414. run();
  1415. } else {
  1416. var Module = null;
  1417. }
  1418. var unzip = Module;
  1419. // {{MODULE_ADDITIONS}}
  1420. exports.unzip = unzip;
  1421. });