diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-07 10:34:48 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-07 10:34:48 -0800 |
commit | 006059dbb9c3a6863e8ef2870d3aecafc93b2529 (patch) | |
tree | 708b5d018892c12041f317a6a94f7ac16a78fa0f | |
parent | b787395d8ff7a8ae0a173e25f903e5b9d425960e (diff) |
simple asm mode that just exports main
-rwxr-xr-x | emscripten.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/emscripten.py b/emscripten.py index 6d99ee5d..9978001e 100755 --- a/emscripten.py +++ b/emscripten.py @@ -292,6 +292,7 @@ def emscript(infile, settings, outfile, libraries=[]): last_forwarded_json = json.loads(last_forwarded_data) if settings.get('ASM_JS'): + simple = os.environ.get('EMCC_SIMPLE_ASM') class Counter: i = 0 def make_table(sig, raw): @@ -337,9 +338,12 @@ var i64Math_modulo = function(a, b, c, d, e) { i64Math.modulo(a, b, c, d, e) }; # calculate exports exported_implemented_functions = list(exported_implemented_functions) exports = [] - for export in exported_implemented_functions + asm_runtime_funcs + function_tables: - exports.append("'%s': %s" % (export, export)) - exports = '{ ' + ', '.join(exports) + ' }' + if not simple: + for export in exported_implemented_functions + asm_runtime_funcs + function_tables: + exports.append("'%s': %s" % (export, export)) + exports = '{ ' + ', '.join(exports) + ' }' + else: + exports = '_main' # calculate globals try: del forwarded_json['Variables']['globals']['_llvm_global_ctors'] # not a true variable @@ -353,7 +357,10 @@ var i64Math_modulo = function(a, b, c, d, e) { i64Math.modulo(a, b, c, d, e) }; # sent data sending = '{ ' + ', '.join([s + ': ' + s for s in fundamentals + basic_funcs + global_funcs + basic_vars + global_vars]) + ' }' # received - receiving = ';\n'.join(['var ' + s + ' = Module["' + s + '"] = asm.' + s for s in exported_implemented_functions + function_tables]) + if not simple: + receiving = ';\n'.join(['var ' + s + ' = Module["' + s + '"] = asm.' + s for s in exported_implemented_functions + function_tables]) + else: + receiving = 'var _main = Module["_main"] = asm;' # finalize funcs_js = ''' %s |