aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/emscripten.py b/emscripten.py
index c6a08e6a..a42fe116 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -308,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):