diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-01-10 16:30:49 -0600 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-01-10 16:33:14 -0600 |
commit | 01f48a54e88bc42ad47a3b33752c80fb19be4774 (patch) | |
tree | 072d825db40fd3a9e04bd979701d3ca67dcf8011 | |
parent | 458709fc77519585aea4c9865d7325e17d6506fe (diff) |
speed up text conversion in preprocessor
-rw-r--r-- | preprocessor.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/preprocessor.py b/preprocessor.py index d340382fe..9b748dbd6 100644 --- a/preprocessor.py +++ b/preprocessor.py @@ -344,6 +344,7 @@ def quote_translator(asm): sys.stdout.write(asm) return + output = "" even = False i = 0 for token in asms: @@ -384,15 +385,18 @@ def quote_translator(asm): char = char + token[0] token = token[1:] - sys.stdout.write("${0:02X}".format(chars[char])) + output += ("${0:02X}".format(chars[char])) if len(token): - sys.stdout.write(", ") + output += (", ") # if not even else: - sys.stdout.write(token) + output += (token) even = not even + + sys.stdout.write(output) + return def extract_token(asm): |