summaryrefslogtreecommitdiff
path: root/themes/dist
diff options
context:
space:
mode:
Diffstat (limited to 'themes/dist')
-rw-r--r--themes/dist/output.js279
-rwxr-xr-xthemes/dist/output.wasmbin134949 -> 135615 bytes
2 files changed, 147 insertions, 132 deletions
diff --git a/themes/dist/output.js b/themes/dist/output.js
index 83ee836..079be8d 100644
--- a/themes/dist/output.js
+++ b/themes/dist/output.js
@@ -479,13 +479,15 @@ function assert(condition, text) {
// include: runtime_strings.js
-// runtime_strings.js: Strings related runtime functions that are part of both MINIMAL_RUNTIME and regular runtime.
+// runtime_strings.js: String related runtime functions that are part of both
+// MINIMAL_RUNTIME and regular runtime.
var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') : undefined;
-// Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the given array that contains uint8 values, returns
-// a copy of that string as a Javascript String object.
/**
+ * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
+ * array that contains uint8 values, returns a copy of that string as a
+ * Javascript String object.
* heapOrArray is either a regular array, or a JavaScript typed array view.
* @param {number} idx
* @param {number=} maxBytesToRead
@@ -494,16 +496,19 @@ var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') :
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
var endIdx = idx + maxBytesToRead;
var endPtr = idx;
- // TextDecoder needs to know the byte length in advance, it doesn't stop on null terminator by itself.
- // Also, use the length info to avoid running tiny strings through TextDecoder, since .subarray() allocates garbage.
- // (As a tiny code save trick, compare endPtr against endIdx using a negation, so that undefined means Infinity)
+ // TextDecoder needs to know the byte length in advance, it doesn't stop on
+ // null terminator by itself. Also, use the length info to avoid running tiny
+ // strings through TextDecoder, since .subarray() allocates garbage.
+ // (As a tiny code save trick, compare endPtr against endIdx using a negation,
+ // so that undefined means Infinity)
while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
}
var str = '';
- // If building with TextDecoder, we have already computed the string length above, so test loop end condition against that
+ // If building with TextDecoder, we have already computed the string length
+ // above, so test loop end condition against that
while (idx < endPtr) {
// For UTF8 byte structure, see:
// http://en.wikipedia.org/wiki/UTF-8#Description
@@ -531,48 +536,63 @@ function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
return str;
}
-// Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the emscripten HEAP, returns a
-// copy of that string as a Javascript String object.
-// maxBytesToRead: an optional length that specifies the maximum number of bytes to read. You can omit
-// this parameter to scan the string until the first \0 byte. If maxBytesToRead is
-// passed, and the string at [ptr, ptr+maxBytesToReadr[ contains a null byte in the
-// middle, then the string will cut short at that byte index (i.e. maxBytesToRead will
-// not produce a string of exact length [ptr, ptr+maxBytesToRead[)
-// N.B. mixing frequent uses of UTF8ToString() with and without maxBytesToRead may
-// throw JS JIT optimizations off, so it is worth to consider consistently using one
-// style or the other.
/**
+ * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
+ * emscripten HEAP, returns a copy of that string as a Javascript String object.
+ *
* @param {number} ptr
- * @param {number=} maxBytesToRead
+ * @param {number=} maxBytesToRead - An optional length that specifies the
+ * maximum number of bytes to read. You can omit this parameter to scan the
+ * string until the first \0 byte. If maxBytesToRead is passed, and the string
+ * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
+ * string will cut short at that byte index (i.e. maxBytesToRead will not
+ * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing
+ * frequent uses of UTF8ToString() with and without maxBytesToRead may throw
+ * JS JIT optimizations off, so it is worth to consider consistently using one
* @return {string}
*/
function UTF8ToString(ptr, maxBytesToRead) {
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
}
-// Copies the given Javascript String object 'str' to the given byte array at address 'outIdx',
-// encoded in UTF8 form and null-terminated. The copy will require at most str.length*4+1 bytes of space in the HEAP.
-// Use the function lengthBytesUTF8 to compute the exact number of bytes (excluding null terminator) that this function will write.
-// Parameters:
-// str: the Javascript string to copy.
-// heap: the array to copy to. Each index in this array is assumed to be one 8-byte element.
-// outIdx: The starting offset in the array to begin the copying.
-// maxBytesToWrite: The maximum number of bytes this function can write to the array.
-// This count should include the null terminator,
-// i.e. if maxBytesToWrite=1, only the null terminator will be written and nothing else.
-// maxBytesToWrite=0 does not write any bytes to the output, not even the null terminator.
-// Returns the number of bytes written, EXCLUDING the null terminator.
-
+/**
+ * Copies the given Javascript String object 'str' to the given byte array at
+ * address 'outIdx', encoded in UTF8 form and null-terminated. The copy will
+ * require at most str.length*4+1 bytes of space in the HEAP. Use the function
+ * lengthBytesUTF8 to compute the exact number of bytes (excluding null
+ * terminator) that this function will write.
+ *
+ * @param {string} str - The Javascript string to copy.
+ * @param {ArrayBufferView|Array<number>} heap - The array to copy to. Each
+ * index in this array is assumed
+ * to be one 8-byte element.
+ * @param {number} outIdx - The starting offset in the array to begin the copying.
+ * @param {number} maxBytesToWrite - The maximum number of bytes this function
+ * can write to the array. This count should
+ * include the null terminator, i.e. if
+ * maxBytesToWrite=1, only the null terminator
+ * will be written and nothing else.
+ * maxBytesToWrite=0 does not write any bytes
+ * to the output, not even the null
+ * terminator.
+ * @return {number} The number of bytes written, EXCLUDING the null terminator.
+ */
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
- if (!(maxBytesToWrite > 0)) // Parameter maxBytesToWrite is not optional. Negative values, 0, null, undefined and false each don't write out any bytes.
+ // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
+ // undefined and false each don't write out any bytes.
+ if (!(maxBytesToWrite > 0))
return 0;
var startIdx = outIdx;
var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
for (var i = 0; i < str.length; ++i) {
- // 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.
+ // 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.
// See http://unicode.org/faq/utf_bom.html#utf16-3
- // 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
+ // 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
var u = str.charCodeAt(i); // possibly a lead surrogate
if (u >= 0xD800 && u <= 0xDFFF) {
var u1 = str.charCodeAt(++i);
@@ -604,21 +624,33 @@ function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
return outIdx - startIdx;
}
-// Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr',
-// null-terminated and encoded in UTF8 form. The copy will require at most str.length*4+1 bytes of space in the HEAP.
-// Use the function lengthBytesUTF8 to compute the exact number of bytes (excluding null terminator) that this function will write.
-// Returns the number of bytes written, EXCLUDING the null terminator.
-
+/**
+ * Copies the given Javascript String object 'str' to the emscripten HEAP at
+ * address 'outPtr', null-terminated and encoded in UTF8 form. The copy will
+ * require at most str.length*4+1 bytes of space in the HEAP.
+ * Use the function lengthBytesUTF8 to compute the exact number of bytes
+ * (excluding null terminator) that this function will write.
+ *
+ * @return {number} The number of bytes written, EXCLUDING the null terminator.
+ */
function 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);
}
-// Returns the number of bytes the given Javascript string takes if encoded as a UTF8 byte array, EXCLUDING the null terminator byte.
+/**
+ * Returns the number of bytes the given Javascript string takes if encoded as a
+ * UTF8 byte array, EXCLUDING the null terminator byte.
+ *
+ * @param {string} str - JavaScript string to operator on
+ * @return {number} Length, in bytes, of the UTF8 encoded string.
+ */
function lengthBytesUTF8(str) {
var len = 0;
for (var i = 0; i < str.length; ++i) {
- // 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.
+ // 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.
// See http://unicode.org/faq/utf_bom.html#utf16-3
var c = str.charCodeAt(i); // possibly a lead surrogate
if (c <= 0x7F) {
@@ -669,12 +701,12 @@ function updateGlobalBufferAndViews(buf) {
Module['HEAPF64'] = HEAPF64 = new Float64Array(buf);
}
-var TOTAL_STACK = 5242880;
-if (Module['TOTAL_STACK']) assert(TOTAL_STACK === Module['TOTAL_STACK'], 'the stack size can no longer be determined at runtime')
+var STACK_SIZE = 5242880;
+if (Module['STACK_SIZE']) assert(STACK_SIZE === Module['STACK_SIZE'], 'the stack size can no longer be determined at runtime')
var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 16777216;legacyModuleProp('INITIAL_MEMORY', 'INITIAL_MEMORY');
-assert(INITIAL_MEMORY >= TOTAL_STACK, 'INITIAL_MEMORY should be larger than TOTAL_STACK, was ' + INITIAL_MEMORY + '! (TOTAL_STACK=' + TOTAL_STACK + ')');
+assert(INITIAL_MEMORY >= STACK_SIZE, 'INITIAL_MEMORY should be larger than STACK_SIZE, was ' + INITIAL_MEMORY + '! (STACK_SIZE=' + STACK_SIZE + ')');
// check for full engine support (use string 'subarray' to avoid closure compiler confusion)
assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined,
@@ -905,10 +937,8 @@ function removeRunDependency(id) {
/** @param {string|number=} what */
function abort(what) {
- {
- if (Module['onAbort']) {
- Module['onAbort'](what);
- }
+ if (Module['onAbort']) {
+ Module['onAbort'](what);
}
what = 'Aborted(' + what + ')';
@@ -1206,27 +1236,6 @@ var ASM_CONSTS = {
}
}
- function withStackSave(f) {
- var stack = stackSave();
- var ret = f();
- stackRestore(stack);
- return ret;
- }
- function demangle(func) {
- warnOnce('warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling');
- return func;
- }
-
- function demangleAll(text) {
- var regex =
- /\b_Z[\w\d_]+/g;
- return text.replace(regex,
- function(x) {
- var y = demangle(x);
- return x === y ? x : (y + ' [' + x + ']');
- });
- }
-
/**
* @param {number} ptr
@@ -1248,35 +1257,6 @@ var ASM_CONSTS = {
return null;
}
- function handleException(e) {
- // Certain exception types we do not treat as errors since they are used for
- // internal control flow.
- // 1. ExitStatus, which is thrown by exit()
- // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others
- // that wish to return to JS event loop.
- if (e instanceof ExitStatus || e == 'unwind') {
- return EXITSTATUS;
- }
- quit_(1, e);
- }
-
- function jsStackTrace() {
- var error = new Error();
- if (!error.stack) {
- // IE10+ special cases: It does have callstack info, but it is only
- // populated if an Error object is thrown, so try that as a special-case.
- try {
- throw new Error();
- } catch(e) {
- error = e;
- }
- if (!error.stack) {
- return '(no stack trace available)';
- }
- }
- return error.stack.toString();
- }
-
/**
* @param {number} ptr
@@ -1298,12 +1278,6 @@ var ASM_CONSTS = {
}
}
- function stackTrace() {
- var js = jsStackTrace();
- if (Module['extraStackTrace']) js += '\n' + Module['extraStackTrace']();
- return demangleAll(js);
- }
-
function warnOnce(text) {
if (!warnOnce.shown) warnOnce.shown = {};
if (!warnOnce.shown[text]) {
@@ -1313,11 +1287,6 @@ var ASM_CONSTS = {
}
}
- function writeArrayToMemory(array, buffer) {
- assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
- HEAP8.set(array, buffer);
- }
-
function __emscripten_fetch_free(id) {
var xhr = Fetch.xhrs[id];
if (xhr) {
@@ -1332,6 +1301,21 @@ var ASM_CONSTS = {
function readI53FromI64(ptr) {
return HEAPU32[ptr>>2] + HEAP32[ptr+4>>2] * 4294967296;
}
+
+ function __isLeapYear(year) {
+ return year%4 === 0 && (year%100 !== 0 || year%400 === 0);
+ }
+
+ var __MONTH_DAYS_LEAP_CUMULATIVE = [0,31,60,91,121,152,182,213,244,274,305,335];
+
+ var __MONTH_DAYS_REGULAR_CUMULATIVE = [0,31,59,90,120,151,181,212,243,273,304,334];
+ function __yday_from_date(date) {
+ var isLeapYear = __isLeapYear(date.getFullYear());
+ var monthDaysCumulative = (isLeapYear ? __MONTH_DAYS_LEAP_CUMULATIVE : __MONTH_DAYS_REGULAR_CUMULATIVE);
+ var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; // -1 since it's days since Jan 1
+
+ return yday;
+ }
function __localtime_js(time, tmPtr) {
var date = new Date(readI53FromI64(time)*1000);
HEAP32[((tmPtr)>>2)] = date.getSeconds();
@@ -1342,12 +1326,12 @@ var ASM_CONSTS = {
HEAP32[(((tmPtr)+(20))>>2)] = date.getFullYear()-1900;
HEAP32[(((tmPtr)+(24))>>2)] = date.getDay();
- var start = new Date(date.getFullYear(), 0, 1);
- var yday = ((date.getTime() - start.getTime()) / (1000 * 60 * 60 * 24))|0;
+ var yday = __yday_from_date(date)|0;
HEAP32[(((tmPtr)+(28))>>2)] = yday;
HEAP32[(((tmPtr)+(36))>>2)] = -(date.getTimezoneOffset() * 60);
// Attention: DST is in December in South, and some regions don't have DST at all.
+ var start = new Date(date.getFullYear(), 0, 1);
var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
var winterOffset = start.getTimezoneOffset();
var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset))|0;
@@ -1360,7 +1344,8 @@ var ASM_CONSTS = {
if (ret) stringToUTF8Array(str, HEAP8, ret, size);
return ret;
}
- function _tzset_impl(timezone, daylight, tzname) {
+ function __tzset_js(timezone, daylight, tzname) {
+ // TODO: Use (malleable) environment variables instead of system settings.
var currentYear = new Date().getFullYear();
var winter = new Date(currentYear, 0, 1);
var summer = new Date(currentYear, 6, 1);
@@ -1377,7 +1362,7 @@ var ASM_CONSTS = {
// Coordinated Universal Time (UTC) and local standard time."), the same
// as returned by stdTimezoneOffset.
// See http://pubs.opengroup.org/onlinepubs/009695399/functions/tzset.html
- HEAP32[((timezone)>>2)] = stdTimezoneOffset * 60;
+ HEAPU32[((timezone)>>2)] = stdTimezoneOffset * 60;
HEAP32[((daylight)>>2)] = Number(winterOffset != summerOffset);
@@ -1398,12 +1383,6 @@ var ASM_CONSTS = {
HEAPU32[(((tzname)+(4))>>2)] = winterNamePtr;
}
}
- function __tzset_js(timezone, daylight, tzname) {
- // TODO: Use (malleable) environment variables instead of system settings.
- if (__tzset_js.called) return;
- __tzset_js.called = true;
- _tzset_impl(timezone, daylight, tzname);
- }
function _abort() {
abort('native code called abort()');
@@ -1413,6 +1392,12 @@ var ASM_CONSTS = {
return Date.now();
}
+ function withStackSave(f) {
+ var stack = stackSave();
+ var ret = f();
+ stackRestore(stack);
+ return ret;
+ }
var JSEvents = {inEventHandler:0,removeAllEventListeners:function() {
for (var i = JSEvents.eventHandlers.length-1; i >= 0; --i) {
JSEvents._removeHandler(i);
@@ -1963,6 +1948,17 @@ var ASM_CONSTS = {
}
}
+ function handleException(e) {
+ // Certain exception types we do not treat as errors since they are used for
+ // internal control flow.
+ // 1. ExitStatus, which is thrown by exit()
+ // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others
+ // that wish to return to JS event loop.
+ if (e instanceof ExitStatus || e == 'unwind') {
+ return EXITSTATUS;
+ }
+ quit_(1, e);
+ }
function callUserCallback(func) {
if (ABORT) {
err('user callback triggered after runtime exited or application aborted. Ignoring.');
@@ -2555,6 +2551,28 @@ var ASM_CONSTS = {
return success ? 0 : -5;
}
+ var SYSCALLS = {varargs:undefined,get:function() {
+ assert(SYSCALLS.varargs != undefined);
+ SYSCALLS.varargs += 4;
+ var ret = HEAP32[(((SYSCALLS.varargs)-(4))>>2)];
+ return ret;
+ },getStr:function(ptr) {
+ var ret = UTF8ToString(ptr);
+ return ret;
+ }};
+ function _fd_close(fd) {
+ abort('fd_close called without SYSCALLS_REQUIRE_FILESYSTEM');
+ }
+
+ function convertI32PairToI53Checked(lo, hi) {
+ assert(lo == (lo >>> 0) || lo == (lo|0)); // lo should either be a i32 or a u32
+ assert(hi === (hi|0)); // hi should be a i32
+ return ((hi + 0x200000) >>> 0 < 0x400001 - !!lo) ? (lo >>> 0) + hi * 4294967296 : NaN;
+ }
+ function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
+ return 70;
+ }
+
var printCharBuffers = [null,[],[]];
function printChar(stream, curr) {
var buffer = printCharBuffers[stream];
@@ -2572,16 +2590,6 @@ var ASM_CONSTS = {
if (printCharBuffers[1].length) printChar(1, 10);
if (printCharBuffers[2].length) printChar(2, 10);
}
-
- var SYSCALLS = {varargs:undefined,get:function() {
- assert(SYSCALLS.varargs != undefined);
- SYSCALLS.varargs += 4;
- var ret = HEAP32[(((SYSCALLS.varargs)-(4))>>2)];
- return ret;
- },getStr:function(ptr) {
- var ret = UTF8ToString(ptr);
- return ret;
- }};
function _fd_write(fd, iov, iovcnt, pnum) {
// hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0
var num = 0;
@@ -3118,6 +3126,7 @@ var ASM_CONSTS = {
_proc_exit(status);
}
+
Fetch.staticInit();;
var GLctx;;
var miniTempWebGLFloatBuffersStorage = new Float32Array(288);
@@ -3148,6 +3157,8 @@ var asmLibraryArg = {
"emscripten_webgl_create_context": _emscripten_webgl_create_context,
"emscripten_webgl_init_context_attributes": _emscripten_webgl_init_context_attributes,
"emscripten_webgl_make_context_current": _emscripten_webgl_make_context_current,
+ "fd_close": _fd_close,
+ "fd_seek": _fd_seek,
"fd_write": _fd_write,
"glAttachShader": _glAttachShader,
"glBindBuffer": _glBindBuffer,
@@ -3272,8 +3283,8 @@ var unexportedRuntimeSymbols = [
'registerFunctions',
'prettyPrint',
'getCompilerSetting',
- 'print',
- 'printErr',
+ 'out',
+ 'err',
'callMain',
'abort',
'keepRuntimeAlive',
@@ -3535,7 +3546,6 @@ var missingLibrarySymbols = [
'writeI53ToU64Signaling',
'readI53FromU64',
'convertI32PairToI53',
- 'convertI32PairToI53Checked',
'convertU32PairToI53',
'getCFunc',
'ccall',
@@ -3565,6 +3575,7 @@ var missingLibrarySymbols = [
'lengthBytesUTF32',
'allocateUTF8OnStack',
'writeStringToMemory',
+ 'writeArrayToMemory',
'writeAsciiToMemory',
'getSocketFromFD',
'getSocketAddress',
@@ -3603,6 +3614,10 @@ var missingLibrarySymbols = [
'registerBatteryEventCallback',
'setCanvasElementSize',
'getCanvasElementSize',
+ 'demangle',
+ 'demangleAll',
+ 'jsStackTrace',
+ 'stackTrace',
'getEnvStrings',
'checkWasiClock',
'createDyncallWrapper',
diff --git a/themes/dist/output.wasm b/themes/dist/output.wasm
index 4e62096..33cd231 100755
--- a/themes/dist/output.wasm
+++ b/themes/dist/output.wasm
Binary files differ