aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/emscripten.py b/emscripten.py
index d41aaa2c..8f68ee77 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -20,6 +20,15 @@ def path_from_root(*pathelems):
"""
return os.path.join(__rootpath__, *pathelems)
+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
+
def scan(ll, settings):
# blockaddress(@main, %23)
blockaddrs = []
@@ -299,7 +308,12 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
indexing = forwarded_json['Functions']['indexedFunctions']
def indexize(js):
- return re.sub(r"'{{ FI_([\w\d_$]+) }}'", lambda m: str(indexing.get(m.groups(0)[0]) or 0), js)
+ # In the global initial allocation, we need to split up into Uint8 format
+ def split_32(x):
+ x = int(x)
+ return '%d,%d,%d,%d' % (x&255, (x >> 8)&255, (x >> 16)&255, (x >> 24)&255)
+ ret = re.sub(r"\"?'?{{ FI_([\w\d_$]+) }}'?\"?,0,0,0", lambda m: split_32(indexing.get(m.groups(0)[0]) or 0), js)
+ return re.sub(r"'{{ FI_([\w\d_$]+) }}'", lambda m: str(indexing.get(m.groups(0)[0]) or 0), ret)
blockaddrs = forwarded_json['Functions']['blockAddresses']
def blockaddrsize(js):
@@ -683,15 +697,6 @@ WARNING: You should normally never use this! Use emcc instead.
else:
relooper = None # use the cache
- 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
-
if keywords.temp_dir is None:
temp_files = get_configuration().get_temp_files()
else: