Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/libasync.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ addToLibrary({
var fiber = Fibers.nextFiber;
Fibers.nextFiber = 0;
#if ASYNCIFY_DEBUG >= 2
dbg("ASYNCIFY/FIBER: trampoline jump into fiber", fiber, new Error().stack);
dbg('ASYNCIFY/FIBER: trampoline jump into fiber', fiber, new Error().stack);
#endif
Fibers.finishContextSwitch(fiber);
} while (Fibers.nextFiber);
Expand Down Expand Up @@ -574,7 +574,7 @@ addToLibrary({
},
},

emscripten_fiber_swap__deps: ["$Asyncify", "$Fibers", '$stackSave'],
emscripten_fiber_swap__deps: ['$Asyncify', '$Fibers', '$stackSave'],
emscripten_fiber_swap__async: true,
emscripten_fiber_swap: (oldFiber, newFiber) => {
if (ABORT) return;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libbootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// it itself depends on the struct info information.

#if !BOOTSTRAPPING_STRUCT_INFO
assert(false, "libbootstrap.js only designed for use with BOOTSTRAPPING_STRUCT_INFO")
assert(false, 'libbootstrap.js only designed for use with BOOTSTRAPPING_STRUCT_INFO')
#endif

assert(Object.keys(LibraryManager.library).length === 0);
Expand Down
28 changes: 14 additions & 14 deletions src/lib/libbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ var LibraryBrowser = {

#if expectToReceiveOnModule('elementPointerLock')
if (Module['elementPointerLock']) {
canvas.addEventListener("click", (ev) => {
canvas.addEventListener('click', (ev) => {
if (!Browser.pointerLock && Browser.getCanvas().requestPointerLock) {
Browser.getCanvas().requestPointerLock();
ev.preventDefault();
Expand Down Expand Up @@ -265,7 +265,7 @@ var LibraryBrowser = {
}

// create a new parent to ensure the canvas has no siblings. this allows browsers to optimize full screen performance when its parent is the full screen root
var canvasContainer = document.createElement("div");
var canvasContainer = document.createElement('div');
canvas.parentNode.insertBefore(canvasContainer, canvas);
canvasContainer.appendChild(canvas);

Expand All @@ -287,7 +287,7 @@ var LibraryBrowser = {

exitFullscreen() {
// This is workaround for chrome. Trying to exit from fullscreen
// not in fullscreen state will cause "TypeError: Document not active"
// not in fullscreen state will cause 'TypeError: Document not active'
// in chrome. See https://github.com/emscripten-core/emscripten/pull/8236
if (!Browser.isFullscreen) {
return false;
Expand Down Expand Up @@ -425,7 +425,7 @@ var LibraryBrowser = {
Browser.mouseY = y;
},

// Unpack a "mouse" event, handling SDL touch paths and pointerlock compatibility stuff.
// Unpack a 'mouse' event, handling SDL touch paths and pointerlock compatibility stuff.
calculateMouseEvent(event) { // event should be mousemove, mousedown or mouseup
if (Browser.pointerLock) {
// When the pointer is locked, calculate the coordinates
Expand All @@ -446,7 +446,7 @@ var LibraryBrowser = {
if (event.type === 'touchstart' || event.type === 'touchend' || event.type === 'touchmove') {
var touch = event.touch;
if (touch === undefined) {
return; // the "touch" property is only defined in SDL
return; // the 'touch' property is only defined in SDL

}
var coords = Browser.calculateMouseCoords(touch.pageX, touch.pageY);
Expand Down Expand Up @@ -484,7 +484,7 @@ var LibraryBrowser = {
windowedHeight: 0,
setFullscreenCanvasSize() {
// check if SDL is available
if (typeof SDL != "undefined") {
if (typeof SDL != 'undefined') {
var flags = {{{ makeGetValue('SDL.screen', '0', 'u32') }}};
flags = flags | 0x00800000; // set SDL_FULLSCREEN flag
{{{ makeSetValue('SDL.screen', '0', 'flags', 'i32') }}};
Expand All @@ -495,7 +495,7 @@ var LibraryBrowser = {

setWindowedCanvasSize() {
// check if SDL is available
if (typeof SDL != "undefined") {
if (typeof SDL != 'undefined') {
var flags = {{{ makeGetValue('SDL.screen', '0', 'u32') }}};
flags = flags & ~0x00800000; // clear SDL_FULLSCREEN flag
{{{ makeSetValue('SDL.screen', '0', 'flags', 'i32') }}};
Expand Down Expand Up @@ -532,19 +532,19 @@ var LibraryBrowser = {
if (canvas.width != w) canvas.width = w;
if (canvas.height != h) canvas.height = h;
if (typeof canvas.style != 'undefined') {
canvas.style.removeProperty( "width");
canvas.style.removeProperty("height");
canvas.style.removeProperty( 'width');
canvas.style.removeProperty('height');
}
} else {
if (canvas.width != wNative) canvas.width = wNative;
if (canvas.height != hNative) canvas.height = hNative;
if (typeof canvas.style != 'undefined') {
if (w != wNative || h != hNative) {
canvas.style.setProperty( "width", w + "px", "important");
canvas.style.setProperty("height", h + "px", "important");
canvas.style.setProperty( 'width', w + 'px', 'important');
canvas.style.setProperty('height', h + 'px', 'important');
} else {
canvas.style.removeProperty( "width");
canvas.style.removeProperty("height");
canvas.style.removeProperty( 'width');
canvas.style.removeProperty('height');
}
}
}
Expand Down Expand Up @@ -851,7 +851,7 @@ var LibraryBrowser = {
var canvas = /** @type {HTMLCanvasElement} */(Browser.preloadedImages[path]);
if (!canvas) return 0;

var ctx = canvas.getContext("2d");
var ctx = canvas.getContext('2d');
var image = ctx.getImageData(0, 0, canvas.width, canvas.height);
var buf = _malloc(canvas.width * canvas.height * 4);

Expand Down
4 changes: 2 additions & 2 deletions src/lib/libc_preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ addToLibrary({
},

// Finds the index of closing parens from the opening parens at arr[i].
// Used polymorphically for strings ("foo") and token arrays (['(', 'foo', ')']) as input.
// Used polymorphically for strings ('foo') and token arrays (['(', 'foo', ')']) as input.
$find_closing_parens_index: (arr, i, opening='(', closing=')') => {
for (var nesting = 0; i < arr.length; ++i) {
if (arr[i] == opening) ++nesting;
Expand Down Expand Up @@ -65,7 +65,7 @@ addToLibrary({
function classifyChar(str, idx) {
var cc = str.charCodeAt(idx);
#if ASSERTIONS
assert(!(cc > 127), "only 7-bit ASCII can be used in preprocessor #if/#ifdef/#define statements");
assert(!(cc > 127), 'only 7-bit ASCII can be used in preprocessor #if/#ifdef/#define statements');
#endif
if (cc > 32) {
if (cc < 48) return 1; // an operator symbol, any of !"#$%&'()*+,-./
Expand Down
84 changes: 42 additions & 42 deletions src/lib/libcore.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ addToLibrary({
err(`growMemory: Attempted to grow heap from ${oldHeapSize} bytes to ${size} bytes, but got error: ${e}`);
#endif
}
// implicit 0 return to save code size (caller will cast "undefined" into 0
// implicit 0 return to save code size (caller will cast 'undefined' into 0
// anyhow)
},

Expand Down Expand Up @@ -339,7 +339,7 @@ addToLibrary({
#endif

#if EMSCRIPTEN_TRACING
traceLogMessage("Emscripten", `Enlarging memory arrays from ${oldSize} to ${newSize}`);
traceLogMessage('Emscripten', `Enlarging memory arrays from ${oldSize} to ${newSize}`);
// And now report the new layout
_emscripten_trace_report_memory_layout();
#endif
Expand Down Expand Up @@ -678,25 +678,25 @@ addToLibrary({
if (!valid6regx.test(str)) {
return null;
}
if (str === "::") {
if (str === '::') {
return [0, 0, 0, 0, 0, 0, 0, 0];
}
// Z placeholder to keep track of zeros when splitting the string on ":"
if (str.startsWith("::")) {
str = str.replace("::", "Z:"); // leading zeros case
// Z placeholder to keep track of zeros when splitting the string on ':'
if (str.startsWith('::')) {
str = str.replace('::', 'Z:'); // leading zeros case
} else {
str = str.replace("::", ":Z:");
str = str.replace('::', ':Z:');
}

if (str.indexOf(".") > 0) {
if (str.indexOf('.') > 0) {
// parse IPv4 embedded address
str = str.replace(new RegExp('[.]', 'g'), ":");
words = str.split(":");
str = str.replace(new RegExp('[.]', 'g'), ':');
words = str.split(':');
words[words.length-4] = Number(words[words.length-4]) + Number(words[words.length-3])*256;
words[words.length-3] = Number(words[words.length-2]) + Number(words[words.length-1])*256;
words = words.slice(0, words.length-2);
} else {
words = str.split(":");
words = str.split(':');
}

offset = 0; z = 0;
Expand Down Expand Up @@ -740,7 +740,7 @@ addToLibrary({
// +--------------------------------------+----+---------------------+
// |0000..............................0000|FFFF| IPv4 ADDRESS | (mapped)
// +--------------------------------------+----+---------------------+
var str = "";
var str = '';
var word = 0;
var longest = 0;
var lastzero = 0;
Expand All @@ -761,7 +761,7 @@ addToLibrary({
// Handle IPv4-compatible, IPv4-mapped, loopback and any/unspecified addresses

var hasipv4 = true;
var v4part = "";
var v4part = '';
// check if the 10 high-order bytes are all zeros (first 5 words)
for (i = 0; i < 5; i++) {
if (parts[i] !== 0) { hasipv4 = false; break; }
Expand All @@ -772,16 +772,16 @@ addToLibrary({
v4part = inetNtop4(parts[6] | (parts[7] << 16));
// IPv4-mapped IPv6 address if 16-bit value (bytes 11 and 12) == 0xFFFF (6th word)
if (parts[5] === -1) {
str = "::ffff:";
str = '::ffff:';
str += v4part;
return str;
}
// IPv4-compatible IPv6 address if 16-bit value (bytes 11 and 12) == 0x0000 (6th word)
if (parts[5] === 0) {
str = "::";
str = '::';
// special case IPv6 addresses
if (v4part === "0.0.0.0") v4part = ""; // any/unspecified address
if (v4part === "0.0.0.1") v4part = "1";// loopback address
if (v4part === '0.0.0.0') v4part = ''; // any/unspecified address
if (v4part === '0.0.0.1') v4part = '1';// loopback address
str += v4part;
return str;
}
Expand All @@ -806,18 +806,18 @@ addToLibrary({

for (word = 0; word < 8; word++) {
if (longest > 1) {
// compress contiguous zeros - to produce "::"
// compress contiguous zeros - to produce '::'
if (parts[word] === 0 && word >= zstart && word < (zstart + longest) ) {
if (word === zstart) {
str += ":";
if (zstart === 0) str += ":"; //leading zeros case
str += ':';
if (zstart === 0) str += ':'; //leading zeros case
}
continue;
}
}
// converts 16-bit words from big-endian to little-endian before converting to hex string
str += Number(_ntohs(parts[word] & 0xffff)).toString(16);
str += word < 7 ? ":" : "";
str += word < 7 ? ':' : '';
}
return str;
},
Expand Down Expand Up @@ -1345,7 +1345,7 @@ addToLibrary({
emscripten_run_script_string__noleakcheck: true,
emscripten_run_script_string__deps: ['$lengthBytesUTF8', '$stringToUTF8', 'realloc'],
emscripten_run_script_string: (ptr) => {
{{{ makeEval("var s = eval(UTF8ToString(ptr));") }}}
{{{ makeEval('var s = eval(UTF8ToString(ptr));') }}}
if (s == null) {
return 0;
}
Expand Down Expand Up @@ -1387,7 +1387,7 @@ addToLibrary({
`,
#else
// Modern environment where performance.now() is supported:
// N.B. a shorter form "_emscripten_get_now = performance.now;" is
// N.B. a shorter form '_emscripten_get_now = performance.now;' is
// unfortunately not allowed even in current browsers (e.g. FF Nightly 75).
emscripten_get_now: () => performance.now(),
#endif
Expand Down Expand Up @@ -1667,9 +1667,9 @@ addToLibrary({
#endif

// Parses as much of the given JS string to an integer, with quiet error
// handling (returns a NaN on error). E.g. jstoi_q("123abc") returns 123.
// Note that "smart" radix handling is employed for input string:
// "0314" is parsed as octal, and "0x1234" is parsed as base-16.
// handling (returns a NaN on error). E.g. jstoi_q('123abc') returns 123.
// Note that 'smart' radix handling is employed for input string:
// '0314' is parsed as octal, and '0x1234' is parsed as base-16.
$jstoi_q__docs: '/** @suppress {checkTypes} */',
$jstoi_q: (str) => parseInt(str),

Expand Down Expand Up @@ -1720,7 +1720,7 @@ addToLibrary({
return process.argv[1].replace(/\\/g, '/');
}
#endif
return "./this.program";
return './this.program';
},
#else
$getExecutableName: () => thisProgram,
Expand Down Expand Up @@ -1985,7 +1985,7 @@ addToLibrary({
// 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
// 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') {
#if RUNTIME_DEBUG
Expand Down Expand Up @@ -2538,14 +2538,14 @@ function wrapSyscallFunction(x, library, isWasi) {
}
}
pre += `dbg('syscall! ${x}: [' + Array.prototype.slice.call(arguments) + ']');\n`;
pre += "var canWarn = true;\n";
pre += "var ret = (() => {";
post += "})();\n";
post += "if (ret && ret < 0 && canWarn) {\n";
post += " dbg(`error: syscall may have failed with ${-ret} (${strError(-ret)})`);\n";
post += "}\n";
post += "dbg(`syscall return: ${ret}`);\n";
post += "return ret;\n";
pre += 'var canWarn = true;\n';
pre += 'var ret = (() => {';
post += '})();\n';
post += 'if (ret && ret < 0 && canWarn) {\n';
post += ' dbg(`error: syscall may have failed with ${-ret} (${strError(-ret)})`);\n';
post += '}\n';
post += 'dbg(`syscall return: ${ret}`);\n';
post += 'return ret;\n';
// Emit dependency to strError() since we added use of it above.
library[x + '__deps'].push('$strError');
#endif
Expand All @@ -2554,21 +2554,21 @@ function wrapSyscallFunction(x, library, isWasi) {
if (canThrow) {
pre += 'try {\n';
handler +=
"} catch (e) {\n" +
'} catch (e) {\n' +
" if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e;\n";
#if SYSCALL_DEBUG
handler +=
" dbg(`error: syscall failed with ${e.errno} (${strError(e.errno)})`);\n" +
" canWarn = false;\n";
' dbg(`error: syscall failed with ${e.errno} (${strError(e.errno)})`);\n' +
' canWarn = false;\n';
#endif
// Musl syscalls are negated.
if (isWasi) {
handler += " return e.errno;\n";
handler += ' return e.errno;\n';
} else {
// Musl syscalls are negated.
handler += " return -e.errno;\n";
handler += ' return -e.errno;\n';
}
handler += "}\n";
handler += '}\n';
}
post = handler + post;

Expand Down
Loading