don't call load_pokecrystal_macros 2000 times

Also, don't call make_macro_table 2000 times by only calling it once and
passing the result.
This commit is contained in:
Bryan Bishop
2013-08-31 11:04:27 -05:00
parent ca0981eb36
commit 70be18427b
2 changed files with 12 additions and 5 deletions

View File

@@ -9,9 +9,15 @@ import os
import sys
import preprocessor
if __name__ == '__main__':
def main():
macros = preprocessor.load_pokecrystal_macros()
macro_table = preprocessor.make_macro_table(macros)
for source in sys.argv[1:]:
dest = os.path.splitext(source)[0] + '.tx'
sys.stdin = open(source, 'r')
sys.stdout = open(dest, 'w')
preprocessor.preprocess(preprocessor.load_pokecrystal_macros())
preprocessor.preprocess(macro_table)
if __name__ == '__main__':
main()