Merge branch 'master' into rgbasm-objects

This commit is contained in:
yenatch 2013-09-10 00:57:02 -04:00
commit 3f9f5953e4
3 changed files with 12 additions and 7 deletions

2
extras

@ -1 +1 @@
Subproject commit 276111f04dcc3e937f1a16f4b7066934409f8ad4 Subproject commit 6735813a177cecde2a9aa5e961241d8c2419fc2e

View File

@ -3,6 +3,7 @@
import sys import sys
import extras.pokemontools.config as conf
import extras.pokemontools.preprocessor as preprocessor import extras.pokemontools.preprocessor as preprocessor
from extras.pokemontools.crystal import ( from extras.pokemontools.crystal import (
@ -41,16 +42,17 @@ def load_pokecrystal_macros():
return ourmacros return ourmacros
def preprocess(macro_table, lines=None): def preprocess(config, macros, lines=None):
""" """
Entry point for the preprocessor. Entry point for the preprocessor.
""" """
return preprocessor.preprocess(macro_table, lines=lines) processor = preprocessor.Preprocessor(config, macros)
return processor.preprocess(lines=lines)
def main(): def main():
config = conf.Config()
macros = load_pokecrystal_macros() macros = load_pokecrystal_macros()
macro_table = preprocessor.make_macro_table(macros) return preprocess(config, macros)
preprocess(macro_table)
# only run against stdin when not included as a module # only run against stdin when not included as a module
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -7,11 +7,14 @@ a single process.
import os import os
import sys import sys
import extras.pokemontools.config as conf
import preprocessor import preprocessor
def main(): def main():
config = conf.Config()
macros = preprocessor.load_pokecrystal_macros() macros = preprocessor.load_pokecrystal_macros()
macro_table = preprocessor.preprocessor.make_macro_table(macros)
stdout = sys.stdout stdout = sys.stdout
@ -19,7 +22,7 @@ def main():
dest = os.path.splitext(source)[0] + '.tx' dest = os.path.splitext(source)[0] + '.tx'
sys.stdin = open(source, 'r') sys.stdin = open(source, 'r')
sys.stdout = open(dest, 'w') sys.stdout = open(dest, 'w')
preprocessor.preprocess(macro_table) preprocessor.preprocess(config, macros)
# reset stdout # reset stdout
sys.stdout = stdout sys.stdout = stdout