aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-04 13:42:11 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-04 13:42:11 -0800
commitd0be88b6b1c498edca654701b86c4b7621135fcd (patch)
treeb029447e18f5dd13c9ff9777f92e594f3c6b6bb6
parenta9ef49d8c97dcaed3cc7778acf61de978efdd5ff (diff)
parent8a419cd95dad82f649f16d339dbbe3de3bb0db32 (diff)
Merge pull request #1735 from juj/name_js_functions
Name js functions.
-rw-r--r--src/library.js56
-rw-r--r--src/library_browser.js50
-rw-r--r--src/library_fs.js28
-rw-r--r--src/library_gl.js106
-rw-r--r--src/library_glut.js2
-rw-r--r--src/library_idbfs.js26
-rw-r--r--src/library_sdl.js12
-rw-r--r--src/library_sockfs.js4
-rw-r--r--src/preamble.js6
-rw-r--r--src/proxyClient.js2
-rw-r--r--src/proxyWorker.js20
-rw-r--r--src/runtime.js4
-rw-r--r--src/shell.js22
13 files changed, 169 insertions, 169 deletions
diff --git a/src/library.js b/src/library.js
index e3cdc7c3..106c4f74 100644
--- a/src/library.js
+++ b/src/library.js
@@ -1602,12 +1602,12 @@ LibraryManager.library = {
if (format.indexOf('%n') >= 0) {
// need to track soFar
var _get = get;
- get = function() {
+ get = function get() {
soFar++;
return _get();
}
var _unget = unget;
- unget = function() {
+ unget = function unget() {
soFar--;
return _unget();
}
@@ -2755,12 +2755,12 @@ LibraryManager.library = {
return -1;
}
var buffer = [];
- var get = function() {
+ function get() {
var c = _fgetc(stream);
buffer.push(c);
return c;
};
- var unget = function() {
+ function unget() {
_ungetc(buffer.pop(), stream);
};
return __scanString(format, get, unget, varargs);
@@ -2777,8 +2777,8 @@ LibraryManager.library = {
// int sscanf(const char *restrict s, const char *restrict format, ... );
// http://pubs.opengroup.org/onlinepubs/000095399/functions/scanf.html
var index = 0;
- var get = function() { return {{{ makeGetValue('s', 'index++', 'i8') }}}; };
- var unget = function() { index--; };
+ function get() { return {{{ makeGetValue('s', 'index++', 'i8') }}}; };
+ function unget() { index--; };
return __scanString(format, get, unget, varargs);
},
snprintf__deps: ['_formatString'],
@@ -3040,7 +3040,7 @@ LibraryManager.library = {
},
bsearch: function(key, base, num, size, compar) {
- var cmp = function(x, y) {
+ function cmp(x, y) {
#if ASM_JS
return Module['dynCall_iii'](compar, x, y);
#else
@@ -5108,7 +5108,7 @@ LibraryManager.library = {
table[from + i] = {};
sigs.forEach(function(sig) { // TODO: new Function etc.
var full = 'dynCall_' + sig;
- table[from + i][sig] = function() {
+ table[from + i][sig] = function dynCall_sig() {
arguments[0] -= from;
return asm[full].apply(null, arguments);
}
@@ -5132,7 +5132,7 @@ LibraryManager.library = {
// patch js module dynCall_* to use functionTable
sigs.forEach(function(sig) {
- jsModule['dynCall_' + sig] = function() {
+ jsModule['dynCall_' + sig] = function dynCall_sig() {
return table[arguments[0]][sig].apply(null, arguments);
};
});
@@ -5596,7 +5596,7 @@ LibraryManager.library = {
var WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
- var leadingSomething = function(value, digits, character) {
+ function leadingSomething(value, digits, character) {
var str = typeof value === 'number' ? value.toString() : (value || '');
while (str.length < digits) {
str = character[0]+str;
@@ -5604,12 +5604,12 @@ LibraryManager.library = {
return str;
};
- var leadingNulls = function(value, digits) {
+ function leadingNulls(value, digits) {
return leadingSomething(value, digits, '0');
};
- var compareByDay = function(date1, date2) {
- var sgn = function(value) {
+ function compareByDay(date1, date2) {
+ function sgn(value) {
return value < 0 ? -1 : (value > 0 ? 1 : 0);
};
@@ -5622,7 +5622,7 @@ LibraryManager.library = {
return compare;
};
- var getFirstWeekStartDate = function(janFourth) {
+ function getFirstWeekStartDate(janFourth) {
switch (janFourth.getDay()) {
case 0: // Sunday
return new Date(janFourth.getFullYear()-1, 11, 29);
@@ -5641,7 +5641,7 @@ LibraryManager.library = {
}
};
- var getWeekBasedYear = function(date) {
+ function getWeekBasedYear(date) {
var thisDate = __addDays(new Date(date.tm_year+1900, 0, 1), date.tm_yday);
var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4);
@@ -5928,8 +5928,8 @@ LibraryManager.library = {
var matches = new RegExp('^'+pattern).exec(Pointer_stringify(buf))
// Module['print'](Pointer_stringify(buf)+ ' is matched by '+((new RegExp('^'+pattern)).source)+' into: '+JSON.stringify(matches));
- var initDate = function() {
- var fixup = function(value, min, max) {
+ function initDate() {
+ function fixup(value, min, max) {
return (typeof value !== 'number' || isNaN(value)) ? min : (value>=min ? (value<=max ? value: max): min);
};
return {
@@ -5946,7 +5946,7 @@ LibraryManager.library = {
var date = initDate();
var value;
- var getMatch = function(symbol) {
+ function getMatch(symbol) {
var pos = capture.indexOf(symbol);
// check if symbol appears in regexp
if (pos >= 0) {
@@ -7681,7 +7681,7 @@ LibraryManager.library = {
var session = Module['webrtc']['session'];
var peer = new Peer(broker);
var listenOptions = Module['webrtc']['hostOptions'] || {};
- peer.onconnection = function(connection) {
+ peer.onconnection = function peer_onconnection(connection) {
console.log('connected');
var addr;
/* If this peer is connecting to the host, assign 10.0.0.1 to the host so it can be
@@ -7695,7 +7695,7 @@ LibraryManager.library = {
}
connection['addr'] = addr;
Sockets.connections[addr] = connection;
- connection.ondisconnect = function() {
+ connection.ondisconnect = function connection_ondisconnect() {
console.log('disconnect');
// Don't return the host address (10.0.0.1) to the pool
if (!(session && session === Sockets.connections[addr]['route'])) {
@@ -7707,12 +7707,12 @@ LibraryManager.library = {
Module['webrtc']['ondisconnect'](peer);
}
};
- connection.onerror = function(error) {
+ connection.onerror = function connection_onerror(error) {
if (Module['webrtc']['onerror'] && 'function' === typeof Module['webrtc']['onerror']) {
Module['webrtc']['onerror'](error);
}
};
- connection.onmessage = function(label, message) {
+ connection.onmessage = function connection_onmessage(label, message) {
if ('unreliable' === label) {
handleMessage(addr, message.data);
}
@@ -7722,13 +7722,13 @@ LibraryManager.library = {
Module['webrtc']['onconnect'](peer);
}
};
- peer.onpending = function(pending) {
+ peer.onpending = function peer_onpending(pending) {
console.log('pending from: ', pending['route'], '; initiated by: ', (pending['incoming']) ? 'remote' : 'local');
};
- peer.onerror = function(error) {
+ peer.onerror = function peer_onerror(error) {
console.error(error);
};
- peer.onroute = function(route) {
+ peer.onroute = function peer_onroute(route) {
if (Module['webrtc']['onpeer'] && 'function' === typeof Module['webrtc']['onpeer']) {
Module['webrtc']['onpeer'](peer, route);
}
@@ -7744,7 +7744,7 @@ LibraryManager.library = {
console.log("unable to deliver message: ", addr, header[1], message);
}
}
- window.onbeforeunload = function() {
+ window.onbeforeunload = function window_onbeforeunload() {
var ids = Object.keys(Sockets.connections);
ids.forEach(function(id) {
Sockets.connections[id].close();
@@ -7813,7 +7813,7 @@ LibraryManager.library = {
}
info.addr = Sockets.localAddr; // 10.0.0.254
info.host = __inet_ntop4_raw(info.addr);
- info.close = function() {
+ info.close = function info_close() {
Sockets.portmap[info.port] = undefined;
}
Sockets.portmap[info.port] = info;
@@ -8724,6 +8724,6 @@ function autoAddDeps(object, name) {
// Add aborting stubs for various libc stuff needed by libc++
['pthread_cond_signal', 'pthread_equal', 'wcstol', 'wcstoll', 'wcstoul', 'wcstoull', 'wcstof', 'wcstod', 'wcstold', 'pthread_join', 'pthread_detach', 'catgets', 'catopen', 'catclose', 'fputwc', '__lockfile', '__unlockfile'].forEach(function(aborter) {
- LibraryManager.library[aborter] = function() { throw 'TODO: ' + aborter };
+ LibraryManager.library[aborter] = function aborting_stub() { throw 'TODO: ' + aborter };
});
diff --git a/src/library_browser.js b/src/library_browser.js
index 59d2945e..71923743 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -4,12 +4,12 @@
mergeInto(LibraryManager.library, {
$Browser__deps: ['$PATH'],
- $Browser__postset: 'Module["requestFullScreen"] = function(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };\n' + // exports
- 'Module["requestAnimationFrame"] = function(func) { Browser.requestAnimationFrame(func) };\n' +
- 'Module["setCanvasSize"] = function(width, height, noUpdates) { Browser.setCanvasSize(width, height, noUpdates) };\n' +
- 'Module["pauseMainLoop"] = function() { Browser.mainLoop.pause() };\n' +
- 'Module["resumeMainLoop"] = function() { Browser.mainLoop.resume() };\n' +
- 'Module["getUserMedia"] = function() { Browser.getUserMedia() }',
+ $Browser__postset: 'Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };\n' + // exports
+ 'Module["requestAnimationFrame"] = function Module_requestAnimationFrame(func) { Browser.requestAnimationFrame(func) };\n' +
+ 'Module["setCanvasSize"] = function Module_setCanvasSize(width, height, noUpdates) { Browser.setCanvasSize(width, height, noUpdates) };\n' +
+ 'Module["pauseMainLoop"] = function Module_pauseMainLoop() { Browser.mainLoop.pause() };\n' +
+ 'Module["resumeMainLoop"] = function Module_resumeMainLoop() { Browser.mainLoop.resume() };\n' +
+ 'Module["getUserMedia"] = function Module_getUserMedia() { Browser.getUserMedia() }',
$Browser: {
mainLoop: {
scheduler: null,
@@ -77,10 +77,10 @@ mergeInto(LibraryManager.library, {
// might create some side data structure for use later (like an Image element, etc.).
var imagePlugin = {};
- imagePlugin['canHandle'] = function(name) {
+ imagePlugin['canHandle'] = function imagePlugin_canHandle(name) {
return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/i.test(name);
};
- imagePlugin['handle'] = function(byteArray, name, onload, onerror) {
+ imagePlugin['handle'] = function imagePlugin_handle(byteArray, name, onload, onerror) {
var b = null;
if (Browser.hasBlobConstructor) {
try {
@@ -103,7 +103,7 @@ mergeInto(LibraryManager.library, {
assert(typeof url == 'string', 'createObjectURL must return a url as a string');
#endif
var img = new Image();
- img.onload = function() {
+ img.onload = function img_onload() {
assert(img.complete, 'Image ' + name + ' could not be decoded');
var canvas = document.createElement('canvas');
canvas.width = img.width;
@@ -114,7 +114,7 @@ mergeInto(LibraryManager.library, {
Browser.URLObject.revokeObjectURL(url);
if (onload) onload(byteArray);
};
- img.onerror = function(event) {
+ img.onerror = function img_onerror(event) {
console.log('Image ' + url + ' could not be decoded');
if (onerror) onerror();
};
@@ -123,10 +123,10 @@ mergeInto(LibraryManager.library, {
Module['preloadPlugins'].push(imagePlugin);
var audioPlugin = {};
- audioPlugin['canHandle'] = function(name) {
+ audioPlugin['canHandle'] = function audioPlugin_canHandle(name) {
return !Module.noAudioDecoding && name.substr(-4) in { '.ogg': 1, '.wav': 1, '.mp3': 1 };
};
- audioPlugin['handle'] = function(byteArray, name, onload, onerror) {
+ audioPlugin['handle'] = function audioPlugin_handle(byteArray, name, onload, onerror) {
var done = false;
function finish(audio) {
if (done) return;
@@ -152,7 +152,7 @@ mergeInto(LibraryManager.library, {
#endif
var audio = new Audio();
audio.addEventListener('canplaythrough', function() { finish(audio) }, false); // use addEventListener due to chromium bug 124926
- audio.onerror = function(event) {
+ audio.onerror = function audio_onerror(event) {
if (done) return;
console.log('warning: browser could not fully decode audio ' + name + ', trying slower base64 approach');
function encode64(data) {
@@ -268,7 +268,7 @@ mergeInto(LibraryManager.library, {
(function(prop) {
switch (typeof tempCtx[prop]) {
case 'function': {
- wrapper[prop] = function() {
+ wrapper[prop] = function gl_wrapper() {
if (GL.debug) {
var printArgs = Array.prototype.slice.call(arguments).map(Runtime.prettyPrint);
Module.printErr('[gl_f:' + prop + ':' + printArgs + ']');
@@ -497,7 +497,7 @@ mergeInto(LibraryManager.library, {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';
- xhr.onload = function() {
+ xhr.onload = function xhr_onload() {
if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
onload(xhr.response);
} else {
@@ -610,7 +610,7 @@ mergeInto(LibraryManager.library, {
http.responseType = 'arraybuffer';
// LOAD
- http.onload = function(e) {
+ http.onload = function http_onload(e) {
if (http.status == 200) {
FS.createDataFile( _file.substr(0, index), _file.substr(index + 1), new Uint8Array(http.response), true, true);
if (onload) Runtime.dynCall('vii', onload, [arg, file]);
@@ -620,12 +620,12 @@ mergeInto(LibraryManager.library, {
};
// ERROR
- http.onerror = function(e) {
+ http.onerror = function http_onerror(e) {
if (onerror) Runtime.dynCall('vii', onerror, [arg, http.status]);
};
// PROGRESS
- http.onprogress = function(e) {
+ http.onprogress = function http_onprogress(e) {
var percentComplete = (e.position / e.totalSize)*100;
if (onprogress) Runtime.dynCall('vii', onprogress, [arg, percentComplete]);
};
@@ -705,7 +705,7 @@ mergeInto(LibraryManager.library, {
assert(runDependencies === 0, 'async_load_script must be run when no other dependencies are active');
var script = document.createElement('script');
- script.onload = function() {
+ script.onload = function script_onload() {
if (runDependencies > 0) {
dependenciesFulfilled = onload;
} else {
@@ -720,7 +720,7 @@ mergeInto(LibraryManager.library, {
emscripten_set_main_loop: function(func, fps, simulateInfiniteLoop) {
Module['noExitRuntime'] = true;
- Browser.mainLoop.runner = function() {
+ Browser.mainLoop.runner = function Browser_mainLoop_runner() {
if (ABORT) return;
if (Browser.mainLoop.queue.length > 0) {
var start = Date.now();
@@ -777,11 +777,11 @@ mergeInto(LibraryManager.library, {
Browser.mainLoop.scheduler();
}
if (fps && fps > 0) {
- Browser.mainLoop.scheduler = function() {
+ Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler() {
setTimeout(Browser.mainLoop.runner, 1000/fps); // doing this each time means that on exception, we stop
}
} else {
- Browser.mainLoop.scheduler = function() {
+ Browser.mainLoop.scheduler = function Browser_mainLoop_scheduler() {
Browser.requestAnimationFrame(Browser.mainLoop.runner);
}
}
@@ -870,14 +870,14 @@ mergeInto(LibraryManager.library, {
emscripten_get_now: function() {
if (!_emscripten_get_now.actual) {
if (ENVIRONMENT_IS_NODE) {
- _emscripten_get_now.actual = function() {
+ _emscripten_get_now.actual = function _emscripten_get_now_actual() {
var t = process['hrtime']();
return t[0] * 1e3 + t[1] / 1e6;
}
} else if (typeof dateNow !== 'undefined') {
_emscripten_get_now.actual = dateNow;
} else if (ENVIRONMENT_IS_WEB && window['performance'] && window['performance']['now']) {
- _emscripten_get_now.actual = function() { return window['performance']['now'](); };
+ _emscripten_get_now.actual = function _emscripten_get_now_actual() { return window['performance']['now'](); };
} else {
_emscripten_get_now.actual = Date.now;
}
@@ -895,7 +895,7 @@ mergeInto(LibraryManager.library, {
buffer: 0,
bufferSize: 0
};
- info.worker.onmessage = function(msg) {
+ info.worker.onmessage = function info_worker_onmessage(msg) {
var info = Browser.workers[id];
if (!info) return; // worker was destroyed meanwhile
var callbackId = msg.data['callbackId'];
diff --git a/src/library_fs.js b/src/library_fs.js
index aece2664..16512385 100644
--- a/src/library_fs.js
+++ b/src/library_fs.js
@@ -439,7 +439,7 @@ mergeInto(LibraryManager.library, {
var completed = 0;
var total = FS.mounts.length;
- var done = function(err) {
+ function done(err) {
if (err) {
return callback(err);
}
@@ -1326,11 +1326,11 @@ mergeInto(LibraryManager.library, {
if (typeof XMLHttpRequest !== 'undefined') {
if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc';
// Lazy chunked Uint8Array (implements get and length from Uint8Array). Actual getting is abstracted away for eventual reuse.
- var LazyUint8Array = function() {
+ function LazyUint8Array() {
this.lengthKnown = false;
this.chunks = []; // Loaded chunks. Index is the chunk number
}
- LazyUint8Array.prototype.get = function(idx) {
+ LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) {
if (idx > this.length-1 || idx < 0) {
return undefined;
}
@@ -1338,10 +1338,10 @@ mergeInto(LibraryManager.library, {
var chunkNum = Math.floor(idx / this.chunkSize);
return this.getter(chunkNum)[chunkOffset];
}
- LazyUint8Array.prototype.setDataGetter = function(getter) {
+ LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) {
this.getter = getter;
}
- LazyUint8Array.prototype.cacheLength = function() {
+ LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() {
// Find length
var xhr = new XMLHttpRequest();
xhr.open('HEAD', url, false);
@@ -1437,7 +1437,7 @@ mergeInto(LibraryManager.library, {
var keys = Object.keys(node.stream_ops);
keys.forEach(function(key) {
var fn = node.stream_ops[key];
- stream_ops[key] = function() {
+ stream_ops[key] = function forceLoadLazyFile() {
if (!FS.forceLoadFile(node)) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
@@ -1445,7 +1445,7 @@ mergeInto(LibraryManager.library, {
};
});
// use a custom read function
- stream_ops.read = function(stream, buffer, offset, length, position) {
+ stream_ops.read = function stream_ops_read(stream, buffer, offset, length, position) {
if (!FS.forceLoadFile(node)) {
throw new FS.ErrnoError(ERRNO_CODES.EIO);
}
@@ -1539,12 +1539,12 @@ mergeInto(LibraryManager.library, {
} catch (e) {
return onerror(e);
}
- openRequest.onupgradeneeded = function() {
+ openRequest.onupgradeneeded = function openRequest_onupgradeneeded() {
console.log('creating db');
var db = openRequest.result;
db.createObjectStore(FS.DB_STORE_NAME);
};
- openRequest.onsuccess = function() {
+ openRequest.onsuccess = function openRequest_onsuccess() {
var db = openRequest.result;
var transaction = db.transaction([FS.DB_STORE_NAME], 'readwrite');
var files = transaction.objectStore(FS.DB_STORE_NAME);
@@ -1554,8 +1554,8 @@ mergeInto(LibraryManager.library, {
}
paths.forEach(function(path) {
var putRequest = files.put(FS.analyzePath(path).object.contents, path);
- putRequest.onsuccess = function() { ok++; if (ok + fail == total) finish() };
- putRequest.onerror = function() { fail++; if (ok + fail == total) finish() };
+ putRequest.onsuccess = function putRequest_onsuccess() { ok++; if (ok + fail == total) finish() };
+ putRequest.onerror = function putRequest_onerror() { fail++; if (ok + fail == total) finish() };
});
transaction.onerror = onerror;
};
@@ -1573,7 +1573,7 @@ mergeInto(LibraryManager.library, {
return onerror(e);
}
openRequest.onupgradeneeded = onerror; // no database to load from
- openRequest.onsuccess = function() {
+ openRequest.onsuccess = function openRequest_onsuccess() {
var db = openRequest.result;
try {
var transaction = db.transaction([FS.DB_STORE_NAME], 'readonly');
@@ -1588,7 +1588,7 @@ mergeInto(LibraryManager.library, {
}
paths.forEach(function(path) {
var getRequest = files.get(path);
- getRequest.onsuccess = function() {
+ getRequest.onsuccess = function getRequest_onsuccess() {
if (FS.analyzePath(path).exists) {
FS.unlink(path);
}
@@ -1596,7 +1596,7 @@ mergeInto(LibraryManager.library, {
ok++;
if (ok + fail == total) finish();
};
- getRequest.onerror = function() { fail++; if (ok + fail == total) finish() };
+ getRequest.onerror = function getRequest_onerror() { fail++; if (ok + fail == total) finish() };
});
transaction.onerror = onerror;
};
diff --git a/src/library_gl.js b/src/library_gl.js
index 6ae20185..7074f844 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -1682,7 +1682,7 @@ var LibraryGL = {
};
var glEnable = _glEnable;
- _glEnable = function(cap) {
+ _glEnable = function _glEnable(cap) {
// Clean up the renderer on any change to the rendering state. The optimization of
// skipping renderer setup is aimed at the case of multiple glDraw* right after each other
if (GL.immediate.lastRenderer) GL.immediate.lastRenderer.cleanup();
@@ -1704,7 +1704,7 @@ var LibraryGL = {
};
var glDisable = _glDisable;
- _glDisable = function(cap) {
+ _glDisable = function _glDisable(cap) {
if (GL.immediate.lastRenderer) GL.immediate.lastRenderer.cleanup();
if (cap == 0x0B60 /* GL_FOG */) {
GLEmulation.fogEnabled = false;
@@ -1722,7 +1722,7 @@ var LibraryGL = {
}
glDisable(cap);
};
- _glIsEnabled = function(cap) {
+ _glIsEnabled = function _glIsEnabled(cap) {
if (cap == 0x0B60 /* GL_FOG */) {
return GLEmulation.fogEnabled ? 1 : 0;
} else if (!(cap in validCapabilities)) {
@@ -1732,7 +1732,7 @@ var LibraryGL = {
};
var glGetBooleanv = _glGetBooleanv;
- _glGetBooleanv = function(pname, p) {
+ _glGetBooleanv = function _glGetBooleanv(pname, p) {
var attrib = GLEmulation.getAttributeFromCapability(pname);
if (attrib !== null) {
var result = GL.immediate.enabledClientAttributes[attrib];
@@ -1743,7 +1743,7 @@ var LibraryGL = {
};
var glGetIntegerv = _glGetIntegerv;
- _glGetIntegerv = function(pname, params) {
+ _glGetIntegerv = function _glGetIntegerv(pname, params) {
switch (pname) {
case 0x84E2: pname = Module.ctx.MAX_TEXTURE_IMAGE_UNITS /* fake it */; break; // GL_MAX_TEXTURE_UNITS
case 0x8B4A: { // GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB
@@ -1812,7 +1812,7 @@ var LibraryGL = {
};
var glGetString = _glGetString;
- _glGetString = function(name_) {
+ _glGetString = function _glGetString(name_) {
if (GL.stringCache[name_]) return GL.stringCache[name_];
switch(name_) {
case 0x1F03 /* GL_EXTENSIONS */: // Add various extensions that we can support
@@ -1836,7 +1836,7 @@ var LibraryGL = {
GL.shaderOriginalSources = {};
#endif
var glCreateShader = _glCreateShader;
- _glCreateShader = function(shaderType) {
+ _glCreateShader = function _glCreateShader(shaderType) {
var id = glCreateShader(shaderType);
GL.shaderInfos[id] = {
type: shaderType,
@@ -1846,7 +1846,7 @@ var LibraryGL = {
};
var glShaderSource = _glShaderSource;
- _glShaderSource = function(shader, count, string, length) {
+ _glShaderSource = function _glShaderSource(shader, count, string, length) {
var source = GL.getSource(shader, count, string, length);
#if GL_DEBUG
console.log("glShaderSource: Input: \n" + source);
@@ -1959,7 +1959,7 @@ var LibraryGL = {
};
var glCompileShader = _glCompileShader;
- _glCompileShader = function(shader) {
+ _glCompileShader = function _glCompileShader(shader) {
Module.ctx.compileShader(GL.shaders[shader]);
#if GL_DEBUG
if (!Module.ctx.getShaderParameter(GL.shaders[shader], Module.ctx.COMPILE_STATUS)) {
@@ -1974,14 +1974,14 @@ var LibraryGL = {
GL.programShaders = {};
var glAttachShader = _glAttachShader;
- _glAttachShader = function(program, shader) {
+ _glAttachShader = function _glAttachShader(program, shader) {
if (!GL.programShaders[program]) GL.programShaders[program] = [];
GL.programShaders[program].push(shader);
glAttachShader(program, shader);
};
var glDetachShader = _glDetachShader;
- _glDetachShader = function(program, shader) {
+ _glDetachShader = function _glDetachShader(program, shader) {
var programShader = GL.programShaders[program];
if (!programShader) {
Module.printErr('WARNING: _glDetachShader received invalid program: ' + program);
@@ -1993,7 +1993,7 @@ var LibraryGL = {
};
var glUseProgram = _glUseProgram;
- _glUseProgram = function(program) {
+ _glUseProgram = function _glUseProgram(program) {
#if GL_DEBUG
if (GL.debug) {
Module.printErr('[using program with shaders]');
@@ -2010,7 +2010,7 @@ var LibraryGL = {
}
var glDeleteProgram = _glDeleteProgram;
- _glDeleteProgram = function(program) {
+ _glDeleteProgram = function _glDeleteProgram(program) {
glDeleteProgram(program);
if (program == GL.currProgram) GL.currProgram = 0;
};
@@ -2018,12 +2018,12 @@ var LibraryGL = {
// If attribute 0 was not bound, bind it to 0 for WebGL performance reasons. Track if 0 is free for that.
var zeroUsedPrograms = {};
var glBindAttribLocation = _glBindAttribLocation;
- _glBindAttribLocation = function(program, index, name) {
+ _glBindAttribLocation = function _glBindAttribLocation(program, index, name) {
if (index == 0) zeroUsedPrograms[program] = true;
glBindAttribLocation(program, index, name);
};
var glLinkProgram = _glLinkProgram;
- _glLinkProgram = function(program) {
+ _glLinkProgram = function _glLinkProgram(program) {
if (!(program in zeroUsedPrograms)) {
Module.ctx.bindAttribLocation(GL.programs[program], 0, 'a_position');
}
@@ -2031,7 +2031,7 @@ var LibraryGL = {
};
var glBindBuffer = _glBindBuffer;
- _glBindBuffer = function(target, buffer) {
+ _glBindBuffer = function _glBindBuffer(target, buffer) {
glBindBuffer(target, buffer);
if (target == Module.ctx.ARRAY_BUFFER) {
if (GLEmulation.currentVao) {
@@ -2046,7 +2046,7 @@ var LibraryGL = {
};
var glGetFloatv = _glGetFloatv;
- _glGetFloatv = function(pname, params) {
+ _glGetFloatv = function _glGetFloatv(pname, params) {
if (pname == 0x0BA6) { // GL_MODELVIEW_MATRIX
HEAPF32.set(GL.immediate.matrix['m'], params >> 2);
} else if (pname == 0x0BA7) { // GL_PROJECTION_MATRIX
@@ -2069,7 +2069,7 @@ var LibraryGL = {
};
var glHint = _glHint;
- _glHint = function(target, mode) {
+ _glHint = function _glHint(target, mode) {
if (target == 0x84EF) { // GL_TEXTURE_COMPRESSION_HINT
return;
}
@@ -2077,21 +2077,21 @@ var LibraryGL = {
};
var glEnableVertexAttribArray = _glEnableVertexAttribArray;
- _glEnableVertexAttribArray = function(index) {
+ _glEnableVertexAttribArray = function _glEnableVertexAttribArray(index) {
glEnableVertexAttribArray(index);
GLEmulation.enabledVertexAttribArrays[index] = 1;
if (GLEmulation.currentVao) GLEmulation.currentVao.enabledVertexAttribArrays[index] = 1;
};
var glDisableVertexAttribArray = _glDisableVertexAttribArray;
- _glDisableVertexAttribArray = function(index) {
+ _glDisableVertexAttribArray = function _glDisableVertexAttribArray(index) {
glDisableVertexAttribArray(index);
delete GLEmulation.enabledVertexAttribArrays[index];
if (GLEmulation.currentVao) delete GLEmulation.currentVao.enabledVertexAttribArrays[index];
};
var glVertexAttribPointer = _glVertexAttribPointer;
- _glVertexAttribPointer = function(index, size, type, normalized, stride, pointer) {
+ _glVertexAttribPointer = function _glVertexAttribPointer(index, size, type, normalized, stride, pointer) {
glVertexAttribPointer(index, size, type, normalized, stride, pointer);
if (GLEmulation.currentVao) { // TODO: avoid object creation here? likely not hot though
GLEmulation.currentVao.vertexAttribPointers[index] = [index, size, type, normalized, stride, pointer];
@@ -2212,14 +2212,14 @@ var LibraryGL = {
function CNaiveListMap() {
var list = [];
- this.insert = function(key, val) {
+ this.insert = function CNaiveListMap_insert(key, val) {
if (this.contains(key|0)) return false;
list.push([key, val]);
return true;
};
var __contains_i;
- this.contains = function(key) {
+ this.contains = function CNaiveListMap_contains(key) {
for (__contains_i = 0; __contains_i < list.length; ++__contains_i) {
if (list[__contains_i][0] === key) return true;
}
@@ -2227,7 +2227,7 @@ var LibraryGL = {
};
var __get_i;
- this.get = function(key) {
+ this.get = function CNaiveListMap_get(key) {
for (__get_i = 0; __get_i < list.length; ++__get_i) {
if (list[__get_i][0] === key) return list[__get_i][1];
}
@@ -2261,7 +2261,7 @@ var LibraryGL = {
function CNLNode() {
var map = new CNaiveListMap();
- this.child = function(keyFrag) {
+ this.child = function CNLNode_child(keyFrag) {
if (!map.contains(keyFrag|0)) {
map.insert(keyFrag|0, new CNLNode());
}
@@ -2269,11 +2269,11 @@ var LibraryGL = {
};
this.value = undefined;
- this.get = function() {
+ this.get = function CNLNode_get() {
return this.value;
};
- this.set = function(val) {
+ this.set = function CNLNode_set(val) {
this.value = val;
};
}
@@ -2281,22 +2281,22 @@ var LibraryGL = {
function CKeyView(root) {
var cur;
- this.reset = function() {
+ this.reset = function CKeyView_reset() {
cur = root;
return this;
};
this.reset();
- this.next = function(keyFrag) {
+ this.next = function CKeyView_next(keyFrag) {
cur = cur.child(keyFrag);
return this;
};
- this.get = function() {
+ this.get = function CKeyView_get() {
return cur.get();
};
- this.set = function(val) {
+ this.set = function CKeyView_set(val) {
cur.set(val);
};
};
@@ -2304,17 +2304,17 @@ var LibraryGL = {
var root;
var staticKeyView;
- this.createKeyView = function() {
+ this.createKeyView = function CNLNode_createKeyView() {
return new CKeyView(root);
}
- this.clear = function() {
+ this.clear = function CNLNode_clear() {
root = new CNLNode();
staticKeyView = this.createKeyView();
};
this.clear();
- this.getStaticKeyView = function() {
+ this.getStaticKeyView = function CNLNode_getStaticKeyView() {
staticKeyView.reset();
return staticKeyView;
};
@@ -2548,7 +2548,7 @@ var LibraryGL = {
GL_SRC_ALPHA
];
- this.traverseState = function(keyView) {
+ this.traverseState = function CTexEnv_traverseState(keyView) {
keyView.next(this.mode);
keyView.next(this.colorCombiner);
keyView.next(this.alphaCombiner);
@@ -2584,7 +2584,7 @@ var LibraryGL = {
this.enabled_tex3D = false;
this.enabled_texCube = false;
- this.traverseState = function(keyView) {
+ this.traverseState = function CTexUnit_traverseState(keyView) {
var texUnitType = this.getTexType();
keyView.next(texUnitType);
if (!texUnitType) return;
@@ -2593,11 +2593,11 @@ var LibraryGL = {
};
// Class impls:
- CTexUnit.prototype.enabled = function() {
+ CTexUnit.prototype.enabled = function CTexUnit_enabled() {
return this.getTexType() != 0;
}
- CTexUnit.prototype.genPassLines = function(passOutputVar, passInputVar, texUnitID) {
+ CTexUnit.prototype.genPassLines = function CTexUnit_genPassLines(passOutputVar, passInputVar, texUnitID) {
if (!this.enabled()) {
return ["vec4 " + passOutputVar + " = " + passInputVar + ";"];
}
@@ -2605,7 +2605,7 @@ var LibraryGL = {
return this.env.genPassLines(passOutputVar, passInputVar, texUnitID);
}
- CTexUnit.prototype.getTexType = function() {
+ CTexUnit.prototype.getTexType = function CTexUnit_getTexType() {
if (this.enabled_texCube) {
return GL_TEXTURE_CUBE_MAP;
} else if (this.enabled_tex3D) {
@@ -2618,7 +2618,7 @@ var LibraryGL = {
return 0;
}
- CTexEnv.prototype.genPassLines = function(passOutputVar, passInputVar, texUnitID) {
+ CTexEnv.prototype.genPassLines = function CTexEnv_genPassLines(passOutputVar, passInputVar, texUnitID) {
switch (this.mode) {
case GL_REPLACE: {
/* RGB:
@@ -2740,9 +2740,9 @@ var LibraryGL = {
return Abort_NoSupport("Unsupported TexEnv mode: 0x" + this.mode.toString(16));
}
- CTexEnv.prototype.genCombinerLines = function(isColor, outputVar,
- passInputVar, texUnitID,
- combiner, srcArr, opArr)
+ CTexEnv.prototype.genCombinerLines = function CTexEnv_getCombinerLines(isColor, outputVar,
+ passInputVar, texUnitID,
+ combiner, srcArr, opArr)
{
var argsNeeded = null;
switch (combiner) {
@@ -3598,7 +3598,7 @@ var LibraryGL = {
// Replace some functions with immediate-mode aware versions. If there are no client
// attributes enabled, and we use webgl-friendly modes (no GL_QUADS), then no need
// for emulation
- _glDrawArrays = function(mode, first, count) {
+ _glDrawArrays = function _glDrawArrays(mode, first, count) {
if (GL.immediate.totalEnabledClientAttributes == 0 && mode <= 6) {
Module.ctx.drawArrays(mode, first, count);
return;
@@ -3614,7 +3614,7 @@ var LibraryGL = {
GL.immediate.mode = -1;
};
- _glDrawElements = function(mode, count, type, indices, start, end) { // start, end are given if we come from glDrawRangeElements
+ _glDrawElements = function _glDrawElements(mode, count, type, indices, start, end) { // start, end are given if we come from glDrawRangeElements
if (GL.immediate.totalEnabledClientAttributes == 0 && mode <= 6 && GL.currElementArrayBuffer) {
Module.ctx.drawElements(mode, count, type, indices);
return;
@@ -3654,43 +3654,43 @@ var LibraryGL = {
}
var glActiveTexture = _glActiveTexture;
- _glActiveTexture = function(texture) {
+ _glActiveTexture = function _glActiveTexture(texture) {
GL.immediate.TexEnvJIT.hook_activeTexture(texture);
glActiveTexture(texture);
};
var glEnable = _glEnable;
- _glEnable = function(cap) {
+ _glEnable = function _glEnable(cap) {
GL.immediate.TexEnvJIT.hook_enable(cap);
glEnable(cap);
};
var glDisable = _glDisable;
- _glDisable = function(cap) {
+ _glDisable = function _glDisable(cap) {
GL.immediate.TexEnvJIT.hook_disable(cap);
glDisable(cap);
};
var glTexEnvf = (typeof(_glTexEnvf) != 'undefined') ? _glTexEnvf : function(){};
- _glTexEnvf = function(target, pname, param) {
+ _glTexEnvf = function _glTexEnvf(target, pname, param) {
GL.immediate.TexEnvJIT.hook_texEnvf(target, pname, param);
// Don't call old func, since we are the implementor.
//glTexEnvf(target, pname, param);
};
var glTexEnvi = (typeof(_glTexEnvi) != 'undefined') ? _glTexEnvi : function(){};
- _glTexEnvi = function(target, pname, param) {
+ _glTexEnvi = function _glTexEnvi(target, pname, param) {
GL.immediate.TexEnvJIT.hook_texEnvi(target, pname, param);
// Don't call old func, since we are the implementor.
//glTexEnvi(target, pname, param);
};
var glTexEnvfv = (typeof(_glTexEnvfv) != 'undefined') ? _glTexEnvfv : function(){};
- _glTexEnvfv = function(target, pname, param) {
+ _glTexEnvfv = function _glTexEnvfv(target, pname, param) {
GL.immediate.TexEnvJIT.hook_texEnvfv(target, pname, param);
// Don't call old func, since we are the implementor.
//glTexEnvfv(target, pname, param);
};
var glGetIntegerv = _glGetIntegerv;
- _glGetIntegerv = function(pname, params) {
+ _glGetIntegerv = function _glGetIntegerv(pname, params) {
switch (pname) {
case 0x8B8D: { // GL_CURRENT_PROGRAM
// Just query directly so we're working with WebGL objects.
@@ -4733,7 +4733,7 @@ LibraryGL.emscripten_GetProcAddress__deps = [function() {
tableImpl += '}\nreturn 0;';
LibraryManager.library.emscripten_procAddressTable = new Function('name', tableImpl);
}, 'emscripten_procAddressTable'];
-LibraryGL.emscripten_GetProcAddress = function(name) {
+LibraryGL.emscripten_GetProcAddress = function _LibraryGL_emscripten_GetProcAddress(name) {
name = name.replace('EXT', '').replace('ARB', '');
switch(name) { // misc renamings
case 'glCreateProgramObject': name = 'glCreateProgram'; break;
diff --git a/src/library_glut.js b/src/library_glut.js
index fefe7bd3..5e303fd2 100644
--- a/src/library_glut.js
+++ b/src/library_glut.js
@@ -372,7 +372,7 @@ var LibraryGLUT = {
},
glutIdleFunc: function(func) {
- var callback = function() {
+ function callback() {
if (GLUT.idleFunc) {
Runtime.dynCall('v', GLUT.idleFunc);
Browser.safeSetTimeout(callback, 0);
diff --git a/src/library_idbfs.js b/src/library_idbfs.js
index ab55673f..7f50f17e 100644
--- a/src/library_idbfs.js
+++ b/src/library_idbfs.js
@@ -58,7 +58,7 @@ mergeInto(LibraryManager.library, {
}
var completed = 0;
- var done = function(err) {
+ function done(err) {
if (err) return callback(err);
if (++completed >= total) {
return callback(null);
@@ -68,7 +68,7 @@ mergeInto(LibraryManager.library, {
// create a single transaction to handle and IDB reads / writes we'll need to do
var db = src.type === 'remote' ? src.db : dst.db;
var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readwrite');
- transaction.onerror = function() { callback(this.error); };
+ transaction.onerror = function transaction_onerror() { callback(this.error); };
var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
for (var path in create) {
@@ -92,8 +92,8 @@ mergeInto(LibraryManager.library, {
} else {
// save file to IDB
var req = store.put(entry, path);
- req.onsuccess = function() { done(null); };
- req.onerror = function() { done(this.error); };
+ req.onsuccess = function req_onsuccess() { done(null); };
+ req.onerror = function req_onerror() { done(this.error); };
}
}
@@ -117,18 +117,18 @@ mergeInto(LibraryManager.library, {
} else {
// delete file from IDB
var req = store.delete(path);
- req.onsuccess = function() { done(null); };
- req.onerror = function() { done(this.error); };
+ req.onsuccess = function req_onsuccess() { done(null); };
+ req.onerror = function req_onerror() { done(this.error); };
}
}
},
getLocalSet: function(mount, callback) {
var files = {};
- var isRealDir = function(p) {
+ function isRealDir(p) {
return p !== '.' && p !== '..';
};
- var toAbsolute = function(root) {
+ function toAbsolute(root) {
return function(p) {
return PATH.join2(root, p);
}
@@ -177,17 +177,17 @@ mergeInto(LibraryManager.library, {
} catch (e) {
return onerror(e);
}
- req.onupgradeneeded = function() {
+ req.onupgradeneeded = function req_onupgradeneeded() {
db = req.result;
db.createObjectStore(IDBFS.DB_STORE_NAME);
};
- req.onsuccess = function() {
+ req.onsuccess = function req_onsuccess() {
db = req.result;
// add to the cache
IDBFS.dbs[name] = db;
callback(null, db);
};
- req.onerror = function() {
+ req.onerror = function req_onerror() {
callback(this.error);
};
},
@@ -198,10 +198,10 @@ mergeInto(LibraryManager.library, {
if (err) return callback(err);
var transaction = db.transaction([IDBFS.DB_STORE_NAME], 'readonly');
- transaction.onerror = function() { callback(this.error); };
+ transaction.onerror = function transaction_onerror() { callback(this.error); };
var store = transaction.objectStore(IDBFS.DB_STORE_NAME);
- store.openCursor().onsuccess = function(event) {
+ store.openCursor().onsuccess = function store_openCursor_onsuccess(event) {
var cursor = event.target.result;
if (!cursor) {
return callback(null, { type: 'remote', db: db, files: files });
diff --git a/src/library_sdl.js b/src/library_sdl.js
index 04a66351..0cf6c97a 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -1301,12 +1301,12 @@ var LibrarySDL = {
IMG_Load_RW: function(rwopsID, freeSrc) {
try {
// stb_image integration support
- var cleanup = function() {
+ function cleanup() {
if (rwops && freeSrc) _SDL_FreeRW(rwopsID);
};
function addCleanup(func) {
var old = cleanup;
- cleanup = function() {
+ cleanup = function added_cleanup() {
old();
func();
}
@@ -1481,7 +1481,7 @@ var LibrarySDL = {
SDL.audio.buffer = _malloc(SDL.audio.bufferSize);
// Create a callback function that will be routinely called to ask more audio data from the user application.
- SDL.audio.caller = function() {
+ SDL.audio.caller = function SDL_audio_caller() {
if (!SDL.audio) {
return;
}
@@ -1495,7 +1495,7 @@ var LibrarySDL = {
SDL.audio.audioOutput['mozSetup'](SDL.audio.channels, SDL.audio.freq); // use string attributes on mozOutput for closure compiler
SDL.audio.mozBuffer = new Float32Array(totalSamples);
SDL.audio.nextPlayTime = 0;
- SDL.audio.pushAudio = function(ptr, size) {
+ SDL.audio.pushAudio = function SDL_audio_pushAudio(ptr, size) {
var mozBuffer = SDL.audio.mozBuffer;
// The input audio data for SDL audio is either 8-bit or 16-bit interleaved across channels, output for Mozilla Audio Data API
// needs to be Float32 interleaved, so perform a sample conversion.
@@ -1862,7 +1862,7 @@ var LibrarySDL = {
audio.frequency = info.audio.frequency;
// TODO: handle N loops. Behavior matches Mix_PlayMusic
audio.loop = loops != 0;
- audio['onended'] = function() { // TODO: cache these
+ audio['onended'] = function SDL_audio_onended() { // TODO: cache these
channelInfo.audio = null;
if (SDL.channelFinished) {
Runtime.getFuncWrapper(SDL.channelFinished, 'vi')(channel);
@@ -1889,7 +1889,7 @@ var LibrarySDL = {
source.loop = false;
source.buffer = context.createBuffer(numChannels, 1, audio.frequency);
var jsNode = context.createJavaScriptNode(2048, numChannels, numChannels);
- jsNode.onaudioprocess = function(event) {
+ jsNode.onaudioprocess = function jsNode_onaudioprocess(event) {
var buffers = new Array(numChannels);
for (var i = 0; i < numChannels; ++i) {
buffers[i] = event.outputBuffer.getChannelData(i);
diff --git a/src/library_sockfs.js b/src/library_sockfs.js
index af29d11b..a57a51a1 100644
--- a/src/library_sockfs.js
+++ b/src/library_sockfs.js
@@ -208,7 +208,7 @@ mergeInto(LibraryManager.library, {
}
};
- var handleMessage = function(data) {
+ function handleMessage(data) {
assert(typeof data !== 'string' && data.byteLength !== undefined); // must receive an ArrayBuffer
data = new Uint8Array(data); // make a typed array view on the array buffer
@@ -247,7 +247,7 @@ mergeInto(LibraryManager.library, {
});
} else {
peer.socket.onopen = handleOpen;
- peer.socket.onmessage = function(event) {
+ peer.socket.onmessage = function peer_socket_onmessage(event) {
handleMessage(event.data);
};
}
diff --git a/src/preamble.js b/src/preamble.js
index 9e72e7b8..c88e4052 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -1060,7 +1060,7 @@ Module['writeAsciiToMemory'] = writeAsciiToMemory;
{{{ reSign }}}
#if PRECISE_I32_MUL
-if (!Math['imul']) Math['imul'] = function(a, b) {
+if (!Math['imul']) Math['imul'] = function imul(a, b) {
var ah = a >>> 16;
var al = a & 0xffff;
var bh = b >>> 16;
@@ -1068,14 +1068,14 @@ if (!Math['imul']) Math['imul'] = function(a, b) {
return (al*bl + ((ah*bl + al*bh) << 16))|0;
};
#else
-Math['imul'] = function(a, b) {
+Math['imul'] = function imul(a, b) {
return (a*b)|0; // fast but imprecise
};
#endif
Math.imul = Math['imul'];
#if TO_FLOAT32
-if (!Math['toFloat32']) Math['toFloat32'] = function(x) {
+if (!Math['toFloat32']) Math['toFloat32'] = function toFloat32(x) {
return x;
};
Math.toFloat32 = Math['toFloat32'];
diff --git a/src/proxyClient.js b/src/proxyClient.js
index 38ea5771..8f4ad7a6 100644
--- a/src/proxyClient.js
+++ b/src/proxyClient.js
@@ -5,7 +5,7 @@ Module.ctx = Module.canvas.getContext('2d');
var worker = new Worker('{{{ filename }}}.js');
-worker.onmessage = function(event) {
+worker.onmessage = function worker_onmessage(event) {
var data = event.data;
switch (data.target) {
case 'stdout': {
diff --git a/src/proxyWorker.js b/src/proxyWorker.js
index 29b2528d..5d34b900 100644
--- a/src/proxyWorker.js
+++ b/src/proxyWorker.js
@@ -2,12 +2,12 @@
function EventListener() {
this.listeners = {};
- this.addEventListener = function(event, func) {
+ this.addEventListener = function addEventListener(event, func) {
if (!this.listeners[event]) this.listeners[event] = [];
this.listeners[event].push(func);
};
- this.fireEvent = function(event) {
+ this.fireEvent = function fireEvent(event) {
event.preventDefault = function(){};
if (event.type in this.listeners) {
@@ -22,17 +22,17 @@ var window = this;
var windowExtra = new EventListener();
for (var x in windowExtra) window[x] = windowExtra[x];
-window.close = function() {
+window.close = function window_close() {
postMessage({ target: 'window', method: 'close' });
};
var document = new EventListener();
-document.createElement = function(what) {
+document.createElement = function document_createElement(what) {
switch(what) {
case 'canvas': {
var canvas = new EventListener();
- canvas.ensureData = function() {
+ canvas.ensureData = function canvas_ensureData() {
if (!canvas.data || canvas.data.width !== canvas.width || canvas.data.height !== canvas.height) {
canvas.data = {
width: canvas.width,
@@ -42,7 +42,7 @@ document.createElement = function(what) {
postMessage({ target: 'canvas', op: 'resize', width: canvas.width, height: canvas.height });
}
};
- canvas.getContext = function(type) {
+ canvas.getContext = function canvas_getContext(type) {
assert(type == '2d');
return {
getImageData: function(x, y, w, h) {
@@ -63,7 +63,7 @@ document.createElement = function(what) {
};
};
canvas.boundingClientRect = {};
- canvas.getBoundingClientRect = function() {
+ canvas.getBoundingClientRect = function canvas_getBoundingClientRect() {
return {
width: canvas.boundingClientRect.width,
height: canvas.boundingClientRect.height,
@@ -89,10 +89,10 @@ Module.canvas = document.createElement('canvas');
Module.setStatus = function(){};
-Module.print = function(x) {
+Module.print = function Module_print(x) {
postMessage({ target: 'stdout', content: x });
};
-Module.printErr = function(x) {
+Module.printErr = function Module_printErr(x) {
postMessage({ target: 'stderr', content: x });
};
@@ -112,7 +112,7 @@ function messageResender() {
}
}
-onmessage = function(message) {
+onmessage = function onmessage(message) {
if (!calledMain) {
if (!messageBuffer) {
messageBuffer = [];
diff --git a/src/runtime.js b/src/runtime.js
index ca2304da..3f89dc84 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -394,7 +394,7 @@ var Runtime = {
getFuncWrapper: function(func, sig) {
assert(sig);
if (!Runtime.funcWrappers[func]) {
- Runtime.funcWrappers[func] = function() {
+ Runtime.funcWrappers[func] = function dynCall_wrapper() {
return Runtime.dynCall(sig, func, arguments);
};
}
@@ -452,7 +452,7 @@ var Runtime = {
buffer.length = 0;
return ret;
}
- this.processJSString = function(string) {
+ this.processJSString = function processJSString(string) {
string = unescape(encodeURIComponent(string));
var ret = [];
for (var i = 0; i < string.length; i++) {
diff --git a/src/shell.js b/src/shell.js
index be23b3c1..b68e16d9 100644
--- a/src/shell.js
+++ b/src/shell.js
@@ -38,17 +38,17 @@ var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIR
if (ENVIRONMENT_IS_NODE) {
// Expose functionality in the same simple way that the shells work
// Note that we pollute the global namespace here, otherwise we break in node
- Module['print'] = function(x) {
+ Module['print'] = function print(x) {
process['stdout'].write(x + '\n');
};
- Module['printErr'] = function(x) {
+ Module['printErr'] = function printErr(x) {
process['stderr'].write(x + '\n');
};
var nodeFS = require('fs');
var nodePath = require('path');
- Module['read'] = function(filename, binary) {
+ Module['read'] = function read(filename, binary) {
filename = nodePath['normalize'](filename);
var ret = nodeFS['readFileSync'](filename);
// The path is absolute if the normalized version is the same as the resolved.
@@ -60,9 +60,9 @@ if (ENVIRONMENT_IS_NODE) {
return ret;
};
- Module['readBinary'] = function(filename) { return Module['read'](filename, true) };
+ Module['readBinary'] = function readBinary(filename) { return Module['read'](filename, true) };
- Module['load'] = function(f) {
+ Module['load'] = function load(f) {
globalEval(read(f));
};
@@ -77,10 +77,10 @@ else if (ENVIRONMENT_IS_SHELL) {
if (typeof read != 'undefined') {
Module['read'] = read;
} else {
- Module['read'] = function() { throw 'no read() available (jsc?)' };
+ Module['read'] = function read() { throw 'no read() available (jsc?)' };
}
- Module['readBinary'] = function(f) {
+ Module['readBinary'] = function readBinary(f) {
return read(f, 'binary');
};
@@ -93,7 +93,7 @@ else if (ENVIRONMENT_IS_SHELL) {
this['{{{ EXPORT_NAME }}}'] = Module;
}
else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
- Module['read'] = function(url) {
+ Module['read'] = function read(url) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false);
xhr.send(null);
@@ -105,10 +105,10 @@ else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
}
if (typeof console !== 'undefined') {
- Module['print'] = function(x) {
+ Module['print'] = function print(x) {
console.log(x);
};
- Module['printErr'] = function(x) {
+ Module['printErr'] = function printErr(x) {
console.log(x);
};
} else {
@@ -136,7 +136,7 @@ function globalEval(x) {
eval.call(null, x);
}
if (!Module['load'] == 'undefined' && Module['read']) {
- Module['load'] = function(f) {
+ Module['load'] = function load(f) {
globalEval(Module['read'](f));
};
}