diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-08-15 16:51:29 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-08-15 16:51:29 -0700 |
commit | 41e7af7eeb7f0d0a3991abd7ff87177308570c54 (patch) | |
tree | 3c0684b6549c0e186032ca38252bc40fc4657273 /emscripten.py | |
parent | b1eaf55eefb815e8f3556b59ce64e6d1e0f55d55 (diff) | |
parent | 2e229a560955c07d1b66db27913af3284baa64fb (diff) |
Merge branch 'incoming'
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/emscripten.py b/emscripten.py index ab68fcaa..1b1284c7 100755 --- a/emscripten.py +++ b/emscripten.py @@ -11,7 +11,6 @@ headers, for the libc implementation in JS). import os, sys, json, optparse, subprocess, re, time, multiprocessing, string -from tools import shared from tools import jsrun, cache as cache_module, tempfiles from tools.response_file import read_response_file @@ -26,6 +25,7 @@ def get_configuration(): if hasattr(get_configuration, 'configuration'): return get_configuration.configuration + from tools import shared configuration = shared.Configuration(environ=os.environ) get_configuration.configuration = configuration return configuration @@ -423,6 +423,8 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None, math_envs = ['Math.min'] # TODO: move min to maths asm_setup += '\n'.join(['var %s = %s;' % (f.replace('.', '_'), f) for f in math_envs]) + if settings['TO_FLOAT32']: maths += ['Math.toFloat32'] + basic_funcs = ['abort', 'assert', 'asmPrintInt', 'asmPrintFloat'] + [m.replace('.', '_') for m in math_envs] if settings['RESERVED_FUNCTION_POINTERS'] > 0: basic_funcs.append('jsCall') if settings['SAFE_HEAP']: basic_funcs += ['SAFE_HEAP_LOAD', 'SAFE_HEAP_STORE', 'SAFE_HEAP_CLEAR'] @@ -469,6 +471,7 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None, } ''' % (sig, i, args, arg_coercions, jsret)) + from tools import shared asm_setup += '\n' + shared.JS.make_invoke(sig) + '\n' basic_funcs.append('invoke_%s' % sig) @@ -628,9 +631,10 @@ Runtime.stackRestore = function(top) { asm['stackRestore'](top) }; # Create symbol table for self-dlopen if settings.get('DLOPEN_SUPPORT'): - symbol_table = { k:v+forwarded_json['Runtime']['GLOBAL_BASE'] - for k,v in forwarded_json['Variables']['indexedGlobals'].iteritems() - if forwarded_json['Variables']['globals'][k]['named'] } + symbol_table = {} + for k, v in forwarded_json['Variables']['indexedGlobals'].iteritems(): + if forwarded_json['Variables']['globals'][k]['named']: + symbol_table[k] = v + forwarded_json['Runtime']['GLOBAL_BASE'] for raw in last_forwarded_json['Functions']['tables'].itervalues(): if raw == '': continue table = map(string.strip, raw[raw.find('[')+1:raw.find(']')].split(",")) @@ -807,7 +811,7 @@ WARNING: You should normally never use this! Use emcc instead. ''' if len(positional) != 1: - raise RuntimeError('Must provide exactly one positional argument.') + raise RuntimeError('Must provide exactly one positional argument. Got ' + str(len(positional)) + ': "' + '", "'.join(positional) + '"') keywords.infile = os.path.abspath(positional[0]) if isinstance(keywords.outfile, basestring): keywords.outfile = open(keywords.outfile, 'w') |