aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/library.js23
-rw-r--r--src/parseTools.js2
-rw-r--r--src/preamble.js4
3 files changed, 16 insertions, 13 deletions
diff --git a/src/library.js b/src/library.js
index 3ed0771e..83da2faf 100644
--- a/src/library.js
+++ b/src/library.js
@@ -559,25 +559,28 @@ LibraryManager.library = {
};
}
var utf8 = new Runtime.UTF8Processor();
- function simpleOutput(val) {
- if (val === null || val === {{{ charCode('\n') }}}) {
- output.printer(output.buffer.join(''));
- output.buffer = [];
- } else {
- output.buffer.push(utf8.processCChar(val));
- }
+ function createSimpleOutput() {
+ var fn = function (val) {
+ if (val === null || val === {{{ charCode('\n') }}}) {
+ fn.printer(fn.buffer.join(''));
+ fn.buffer = [];
+ } else {
+ fn.buffer.push(utf8.processCChar(val));
+ }
+ };
+ return fn;
}
if (!output) {
stdoutOverridden = false;
- output = simpleOutput;
+ output = createSimpleOutput();
}
if (!output.printer) output.printer = Module['print'];
if (!output.buffer) output.buffer = [];
if (!error) {
stderrOverridden = false;
- error = simpleOutput;
+ error = createSimpleOutput();
}
- if (!error.printer) error.printer = Module['print'];
+ if (!error.printer) error.printer = Module['printErr'];
if (!error.buffer) error.buffer = [];
// Create the temporary folder, if not already created
diff --git a/src/parseTools.js b/src/parseTools.js
index eb200c65..a5785e27 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1231,7 +1231,7 @@ function indexizeFunctions(value, type) {
// add signature to library functions that we now know need indexing
var sig = Functions.implementedFunctions[value] || Functions.unimplementedFunctions[value];
if (!sig) {
- sig = Functions.unimplementedFunctions[value] = Functions.getSignature(out.returnType, out.segments ? out.segments.map(function(segment) { return segment[0].text }) : []);
+ sig = Functions.unimplementedFunctions[value] = Functions.getSignature(out.returnType, out.segments ? out.segments.map(function(segment) { return segment[0].text }) : [], isVarArgsFunctionType(type));
}
return Functions.getIndex(value, undefined, sig);
}
diff --git a/src/preamble.js b/src/preamble.js
index c9e7e4eb..41017676 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -784,7 +784,7 @@ Module['writeArrayToMemory'] = writeArrayToMemory;
{{{ reSign }}}
#if PRECISE_I32_MUL
-if (!Math['imul']) Math['imul'] = function(a, b) {
+if (!Math.imul) Math.imul = function(a, b) {
var ah = a >>> 16;
var al = a & 0xffff;
var bh = b >>> 16;
@@ -792,7 +792,7 @@ 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(a, b) {
return (a*b)|0; // fast but imprecise
};
#endif