Commit Graph

83 Commits

Author SHA1 Message Date
yenatch
dd7989cef8 preprocessor: battle animation macros 2013-12-19 04:49:20 -05:00
yenatch
94052ab5b9 prequeue: dont initialize a new preprocessor for each file 2013-12-09 01:40:04 -05:00
yenatch
2143b5479e import some new sound classes from pokemontools 2013-11-07 01:15:20 -05:00
Bryan Bishop
2917a28242 fix a typo related to configuration 2013-09-26 17:26:00 -05:00
Bryan Bishop
fc90df9895 bump pokemontools to v1.4.1
Note that gbz8disasm doesn't work at the moment.
2013-09-24 10:46:53 -05:00
Bryan Bishop
5c46972ebe update preprocessor to use a class 2013-09-02 10:41:50 -05:00
Bryan Bishop
12c1d874b9 Merge branch 'master' into refactor-preprocessor
Conflicts:
	preprocessor.py

Also bump the extras submodule to a version of pokemontools with a
suitable version of the preprocessor. The changes from 'master' for
preprocessor.py have been inserted into pokemontools prior to the
submodule bump.
2013-08-31 12:47:23 -05:00
Bryan Bishop
c0a01c9982 Merge pull request #185 from kanzure/preprocessor-performance
Preprocessor performance improvements.

This recliams 0.4 seconds.
2013-08-31 10:19:17 -07:00
Bryan Bishop
6191559c53 give preprocessor.py a main() 2013-08-31 12:12:09 -05:00
Bryan Bishop
a74462bc52 even better performance for read_line 2013-08-31 12:03:48 -05:00
Bryan Bishop
473bd192d9 better read_line performance in preprocessor
Jump out of read_line early if the line is an empty string or a newline.
2013-08-31 11:57:01 -05:00
Bryan Bishop
70be18427b 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.
2013-08-31 11:04:27 -05:00
Bryan Bishop
2fd792bbda move macro sanity check into separate function
This moves out from macro_translator the macro/param length sanity check
into a function called check_macro_sanity.
2013-08-31 10:39:49 -05:00
Bryan Bishop
a429bce189 Merge branch 'master' into preprocessor-macro-function 2013-08-31 10:22:35 -05:00
Bryan Bishop
ba67d3ba46 Merge branch 'master' into preprocessor-asserts 2013-08-31 10:17:25 -05:00
Bryan Bishop
5815edf382 refactor preprocessor macros into a function
Remove the "macros" global and instead use a function to construct a
list of macros.
2013-08-31 10:13:17 -05:00
Bryan Bishop
ebb591a7ec make a MacroException more verbose in preprocessor 2013-08-31 09:56:24 -05:00
Bryan Bishop
93514b1862 convert a macro_translator assert in preprocessor
AssertionError -> PreprocessorException
2013-08-31 09:54:03 -05:00
Bryan Bishop
95f7270141 raise MacroException instead of Exception
A more specific exception means that error handling can actually work in
the future.
2013-08-31 09:51:31 -05:00
Bryan Bishop
2c22d9220c fix "raise Exception" formatting in preprocessor 2013-08-31 09:50:17 -05:00
Bryan Bishop
ecedde1993 replace an assert in macro_translator
Use a MacroException instead of an AssertionError.
2013-08-31 09:46:11 -05:00
Bryan Bishop
1ce2bccd37 generic preprocessor-specific exception classes
These are basic python Exception subclasses that can be used to throw
more specific errors and exceptions from within the preprocessor.

AssertionError is not a good idea.
2013-08-31 09:45:12 -05:00
Bryan Bishop
998fa0b198 remove the do_macro_sanity_check global 2013-08-31 09:37:55 -05:00
Bryan Bishop
0f28e96e4d remove the show_original_lines global 2013-08-31 09:37:02 -05:00
Bryan Bishop
a6237d6825 remove an Exception from preprocessor
It wasn't meant to be left in there anyway.
2013-08-31 09:29:54 -05:00
Bryan Bishop
5e70ac56ea remove ItemFragment from preprocessor
It's not required.

see #178
2013-08-30 18:36:14 -05:00
Bryan Bishop
69adf48a54 remove "skippable_macros" from preprocessor
The preprocessor no longer has the concept of skippable_macros and now
always skips any line that starts with "db" or "dw" because neither of
these should be treated as macros.

fixes #178
2013-08-30 18:27:03 -05:00
Bryan Bishop
8fe7f4c3a5 HACK: re-instate the ItemFragment macro hack
This is to fix the preprocessor temporarily. Maybe ItemFragment can be
removed completely.
2013-08-30 17:23:43 -05:00
Bryan Bishop
c32cc3dcb8 move main preprocessor into pokemontools
Only pokecrystal-specific preprocessor stuff lives in preprocessor.py
now. The other stuff lives in pokemontools.
2013-08-28 22:48:44 -05:00
Bryan Bishop
3fb03e9981 two more unused imports from preprocessor 2013-08-28 20:31:17 -05:00
Bryan Bishop
e4d3ea7256 don't use globals in the preprocessor
Macros are now passed around as lists and dicts.
2013-08-28 17:53:26 -05:00
Bryan Bishop
16bfc01124 use generic skippable macros in preprocessor
This removes TextEndingCommand from the preprocessor. Instead, there is
a generic concept of a skippable type of macro like "db".

This adds SkippableMacro to the preprocessor.
2013-08-28 17:18:29 -05:00
Bryan Bishop
b602cc9bd6 don't directly reference two macro classes
Ideally the macro classes will be removed from the preprocessor core
soon, there's no reason they should be infecting these functions.
2013-08-28 16:48:29 -05:00
Bryan Bishop
6d612c8828 remove MoneyByteParam from preprocessor
It didn't belong in there. All of the references were removed.
2013-08-28 16:33:27 -05:00
Bryan Bishop
a4782d9b5a Merge branch 'master' into remove-another-moneybyteparam-special-case 2013-08-28 16:32:15 -05:00
Bryan Bishop
0236b59360 remove another MoneyByteParam special case
This updates the preprocessor to just look for a from_asm method on the
class for the parameter it's processing. If there's a from_asm method,
then it uses it to spit out the right asm.
2013-08-28 16:30:47 -05:00
Bryan Bishop
00b36922d2 remove a special case for MoneyByteParam
The preprocessor should ideally have no special cases for macros at all
in the first place. But it does. This one doesn't seem to be necessary.
2013-08-28 16:14:23 -05:00
Bryan Bishop
3453879756 Merge branch 'master' into remove-extras 2013-08-27 10:51:30 -05:00
Bryan Bishop
2a421c54b6 fix preprocessor imports for the latest submodule
I am surprised this worked. Maybe it's not actually working, and I just
have cached files everywhere.
2013-08-03 16:25:14 -05:00
yenatch
d4e6ccca3b jp char ァ 2013-07-31 18:02:08 -04:00
yenatch
d3872d1aa9 chars: ▷ 2013-07-10 19:17:02 -04:00
Bryan Bishop
b710b8721e don't mix tabs/whitespace 2013-06-25 22:25:50 -05:00
yenatch
8d2df72cb8 pre: restore separate_comment's behavior 2013-06-25 21:24:09 -04:00
yenatch
e733c4234c preprocess asm files individually
this fixes a lot of previous hacks

first off, rgbds requires that labels from includes be marked as globals.
instead, 3626ddeb stuffed includes into the parent file in the preprocessor.
this meant one huge file got preprocessed every time, adding an additional
ten seconds to compile time.

running the preprocessor once for each file would create too much overhead,
so a list is fed into prequeue.py, which then makes calls to preprocessor.py.

this paves the way for compiling source files separately some day.

next, compiling previously required `make clean` to be executed first.
f3340de6 touched main.asm to force a fresh compile instead. this behavior
has been reverted. now, `make all` will only attempt to recompile if a
source file has changed.

preprocessor.py has some marginal changes. prequeue.py is created to keep
the original functionality of preprocessor.py intact. so many files are
preprocessed on first compile (1951 as of this commit) that the prequeue
call has been hidden.

compile time is reduced to 15-30 seconds on first compile, and 5-10 seconds
subsequently. the majority of this time is spent in rgbasm.
2013-06-21 16:12:40 -04:00
yenatch
ffd562351b preprocessor: minor optimization in separate_comment 2013-05-15 14:39:43 -04:00
yenatch
ac391b7b8e preprocessor: print macro automatically inserts newlines 2013-05-11 13:51:30 -04:00
Bryan Bishop
2a44711fa7 Merge pull request #126 from yenatch/master
map scripts + ai + disabled line ending correction
2013-05-06 22:15:41 -07:00
yenatch
2acb46f6b5 downward triangle character 0xee 2013-05-01 23:18:38 -04:00
Bryan Bishop
0e47273378 Merge yenatch/master. 2013-04-27 17:29:29 -05:00
yenatch
dc81d0cfcf dump move effects 2013-03-29 18:54:42 -04:00