diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-31 17:15:45 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-31 17:15:45 -0800 |
commit | ac0972ebf6cb8ff17f1bbbf01526d29fd2d2f420 (patch) | |
tree | 499dd06881cddf43520b40cc62b51276ca411c60 /emscripten.py | |
parent | 64c779641a2a9587613cc65ad7251890f18e25c3 (diff) | |
parent | 375eb145c8a6c1627a8b93f81d40fd1aa7fc899b (diff) |
Merge branch 'incoming'
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/emscripten.py b/emscripten.py index 68fb4aee..2ceb5e13 100755 --- a/emscripten.py +++ b/emscripten.py @@ -232,8 +232,8 @@ def emscript(infile, settings, outfile, libraries=[]): # merge forwarded data if settings.get('ASM_JS'): all_exported_functions = set(settings['EXPORTED_FUNCTIONS']) # both asm.js and otherwise - for additional_export in ['_malloc', '_free']: # additional functions to export from asm, if they are implemented - all_exported_functions.add(additional_export) + for additional_export in settings['DEFAULT_LIBRARY_FUNCS_TO_INCLUDE']: # additional functions to export from asm, if they are implemented + all_exported_functions.add('_' + additional_export) exported_implemented_functions = set() for func_js, curr_forwarded_data in outputs: curr_forwarded_json = json.loads(curr_forwarded_data) @@ -327,7 +327,8 @@ def emscript(infile, settings, outfile, libraries=[]): fundamentals = ['Math', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint16Array', 'Uint32Array', 'Float32Array', 'Float64Array'] math_envs = ['Runtime.bitshift64', 'Math.min'] # TODO: move min to maths asm_setup = '\n'.join(['var %s = %s;' % (f.replace('.', '_'), f) for f in math_envs]) - basic_funcs = ['abort', 'assert', 'asmPrintInt', 'asmPrintFloat'] + [m.replace('.', '_') for m in math_envs] + basic_funcs = ['abort', 'assert', 'asmPrintInt', 'asmPrintFloat', 'copyTempDouble', 'copyTempFloat'] + [m.replace('.', '_') for m in math_envs] + if settings['SAFE_HEAP']: basic_funcs += ['SAFE_HEAP_LOAD', 'SAFE_HEAP_STORE', 'SAFE_HEAP_CLEAR'] basic_vars = ['STACKTOP', 'STACK_MAX', 'tempDoublePtr', 'ABORT'] basic_float_vars = ['NaN', 'Infinity'] if forwarded_json['Types']['preciseI64MathUsed']: @@ -394,11 +395,11 @@ var i64Math_modulo = function(a, b, c, d, e) { i64Math.modulo(a, b, c, d, e) }; # finalize funcs_js = ''' %s -function asmPrintInt(x) { - Module.print('int ' + x);// + ' ' + new Error().stack); +function asmPrintInt(x, y) { + Module.print('int ' + x + ',' + y);// + ' ' + new Error().stack); } -function asmPrintFloat(x) { - Module.print('float ' + x);// + ' ' + new Error().stack); +function asmPrintFloat(x, y) { + Module.print('float ' + x + ',' + y);// + ' ' + new Error().stack); } var asm = (function(global, env, buffer) { 'use asm'; @@ -440,7 +441,7 @@ var asm = (function(global, env, buffer) { value = value|0; tempRet%d = value; } -''' % (i, i) for i in range(10)]) + funcs_js.replace('\n', '\n ') + ''' +''' % (i, i) for i in range(10)]) + funcs_js + ''' %s |