aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
authortim.dawborn <tim.dawborn@gmail.com>2011-06-23 13:50:19 +1000
committertim.dawborn <tim.dawborn@gmail.com>2011-06-23 13:50:19 +1000
commit89ecb3e21c105df110a3c62a2d3366864fc5fe3c (patch)
tree787cede07897558a047b8da4295f35ba2d6c1b76 /src/preamble.js
parent68b06527633437767bbeaeb7cdf6a122db78ef56 (diff)
* propogated return value from main back to the return value from Module.run
* improved the behaviour of ungetc * added optional argument to intArrayFromString to not add the trailing NULL -- useful when adding JS strings as the data in the virtual file system
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index e7cbcce6..cfab022e 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -549,7 +549,7 @@ function jrint(label, obj) { // XXX manual debugging
// This processes a JS string into a C-line array of numbers, 0-terminated.
// For LLVM-originating strings, see parser.js:parseLLVMString function
-function intArrayFromString(stringy) {
+function intArrayFromString(stringy, dontAddNull) {
var ret = [];
var t;
var i = 0;
@@ -557,7 +557,8 @@ function intArrayFromString(stringy) {
ret.push(stringy.charCodeAt(i));
i = i + 1;
}
- ret.push(0);
+ if (!dontAddNull)
+ ret.push(0);
return ret;
}
Module['intArrayFromString'] = intArrayFromString;