aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-11 16:12:21 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-11 16:48:57 -0700
commit76e2f101c8cf000583649862dd08d930d0bd6ed3 (patch)
tree95b2c8033d809cb50315d17065e3783fd41cbf79 /emscripten.py
parent74e74ba24278a3e96a9e4dceaaf814e587ea5d0f (diff)
refactor emscripten.py ll splitting
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/emscripten.py b/emscripten.py
index 19c74531..dbc7b551 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -98,19 +98,22 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
if DEBUG: t = time.time()
in_func = False
ll_lines = open(infile).readlines()
+ curr_func = None
for line in ll_lines:
if in_func:
- funcs[-1][1].append(line)
+ curr_func.append(line)
if line.startswith('}'):
in_func = False
- funcs[-1] = (funcs[-1][0], ''.join(funcs[-1][1]))
- pre.append(line) # pre needs it to, so we know about all implemented functions
+ funcs.append((curr_func[0], ''.join(curr_func))) # use the entire line as the identifier
+ # pre needs to know about all implemented functions, even for non-pre func
+ pre.append(curr_func[0])
+ pre.append(line)
+ curr_func = None
else:
if line.startswith(';'): continue
if line.startswith('define '):
in_func = True
- funcs.append((line, [line])) # use the entire line as the identifier
- pre.append(line) # pre needs it to, so we know about all implemented functions
+ curr_func = [line]
elif line.find(' = type { ') > 0:
pre.append(line) # type
elif line.startswith('!'):