diff options
Diffstat (limited to 'scripts/clean_c_api_trace.py')
-rwxr-xr-x | scripts/clean_c_api_trace.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/clean_c_api_trace.py b/scripts/clean_c_api_trace.py new file mode 100755 index 000000000..efe8baa43 --- /dev/null +++ b/scripts/clean_c_api_trace.py @@ -0,0 +1,23 @@ +#! /usr/bin/env python + +''' +Cleans up output from the C api, makes a runnable C file +''' + +import sys + +trace = open(sys.argv[1]).read() + +start = trace.find('// beginning a Binaryen API trace') +if start >= 0: + trace = trace[start:] + + while 1: + start = trace.find('\n(') + if start < 0: + break + end = trace.find('\n)', start + 1) + assert end > 0 + trace = trace[:start] + trace[end + 2:] + + print trace |