ref: 0fa7b553bddeb4ba70b216c93eb09226b2674beb
parent: 8583cc4724144e255d61a2c7ed7dd70036bcdb6e
author: yenatch <[email protected]>
date: Mon Jan 19 19:05:16 EST 2015
Get rid of the preprocessor. extras is no longer required to build.
--- a/preprocessor.py
+++ /dev/null
@@ -1,76 +1,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-import sys
-
-import extras.pokemontools.configuration as configuration
-import extras.pokemontools.preprocessor as preprocessor
-
-from extras.pokemontools.crystal import (
- command_classes,
- Warp,
- XYTrigger,
- Signpost,
- PeopleEvent,
- DataByteWordMacro,
- text_command_classes,
- movement_command_classes,
- music_classes,
- effect_classes,
- ChannelCommand,
- OctaveCommand,
-)
-
-from extras.pokemontools.audio import (
- Note,
- Noise,
- SoundCommand,
-)
-
-from extras.pokemontools.battle_animations import (
- BattleAnimWait,
- battle_animation_classes,
-)
-
-def load_pokecrystal_macros():
- """
- Construct a list of macros that are needed for pokecrystal preprocessing.
- """
- ourmacros = []
-
- even_more_macros = [
- Warp,
- XYTrigger,
- Signpost,
- PeopleEvent,
- DataByteWordMacro,
- ChannelCommand,
- OctaveCommand,
- Note,
- Noise,
- SoundCommand,
- ]
-
- ourmacros += command_classes
- ourmacros += even_more_macros
- ourmacros += [each[1] for each in text_command_classes]
- ourmacros += movement_command_classes
- ourmacros += music_classes
- ourmacros += effect_classes
- ourmacros += battle_animation_classes + [BattleAnimWait]
-
- return ourmacros
-
-def setup_processor():
- config = configuration.Config()
- macros = load_pokecrystal_macros()
- processor = preprocessor.Preprocessor(config, macros)
- return processor
-
-def main():
- processor = setup_processor()
- processor.preprocess()
-
-# only run against stdin when not included as a module
-if __name__ == "__main__":
- main()
--- a/prequeue.py
+++ /dev/null
@@ -1,38 +1,0 @@
-# coding: utf-8
-"""
-Starting a new python process to preprocess each source file creates too much
-overhead. Instead, a list of files to preprocess is fed into a script run from
-a single process.
-"""
-
-import os
-import sys
-
-import preprocessor
-
-def preprocess_queue(filenames=sys.argv[1:]):
-
- stdin = sys.stdin
- stdout = sys.stdout
-
- processor = preprocessor.setup_processor()
-
- for source in filenames:
- dest = os.path.splitext(source)[0] + '.tx'
- sys.stdin = open(source, 'r')
- sys.stdout = open(dest, 'w')
- processor.preprocess()
-
- sys.stdin = stdin
- sys.stdout = stdout
-
-def main():
- filenames = list(set(sys.argv[1:]))
- if filenames:
- num_files = len(filenames)
- s = '' if num_files == 1 else 's'
- sys.stdout.write('Preprocessing {0} file{1}...\n'.format(num_files, s))
- preprocess_queue(filenames)
-
-if __name__ == '__main__':
- main()