aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-24 19:34:25 +0100
committerAlon Zakai <alonzakai@gmail.com>2012-12-07 14:23:18 -0800
commitdf6018759a472685fee5fafd188f091dab5fd4fd (patch)
tree223143ffb1dd7477a2077143fc9336244c1367e2 /src
parent887ef685cd7e6d9af9e45016dc6c714feaf281d3 (diff)
add asm imports and exports, hello world works
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js1
-rw-r--r--src/modules.js1
-rw-r--r--src/postamble.js4
3 files changed, 4 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index a7c04c89..90e74db6 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -420,6 +420,7 @@ function JSify(data, functionsOnly, givenFunctions) {
snippet = snippet.replace('{', '{ var ret = (function() { if (Runtime.debug) Module.printErr("[library call:' + ident + ': " + Array.prototype.slice.call(arguments).map(Runtime.prettyPrint) + "]"); ');
snippet = snippet.substr(0, snippet.length-1) + '}).apply(this, arguments); if (Runtime.debug && typeof ret !== "undefined") Module.printErr(" [ return:" + Runtime.prettyPrint(ret)); return ret; }';
}
+ if (ASM_JS) Functions.libraryFunctions.push(ident);
}
var postsetId = ident + '__postset';
diff --git a/src/modules.js b/src/modules.js
index f9173f8e..94fe582c 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -218,6 +218,7 @@ var Types = {
var Functions = {
// All functions that will be implemented in this file
implementedFunctions: {},
+ libraryFunctions: [], // functions added from the library
indexedFunctions: {},
nextIndex: 2, // Start at a non-0 (even, see below) value
diff --git a/src/postamble.js b/src/postamble.js
index 144b5af9..83a4daa6 100644
--- a/src/postamble.js
+++ b/src/postamble.js
@@ -19,11 +19,11 @@ Module.callMain = function callMain(args) {
#if CATCH_EXIT_CODE
try {
- return _main(argc, argv, 0);
+ return Module['_main'](argc, argv, 0);
}
catch(e) { if (e.name == "ExitStatus") return e.status; throw e; }
#else
- return _main(argc, argv, 0);
+ return Module['_main'](argc, argv, 0);
#endif
}