diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-05-16 12:44:55 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-05-16 12:44:55 -0500 |
commit | 079afeea4626d21a179f3c836e3f1d1c9a1f6d83 (patch) | |
tree | b64f056ba5a6190b1e3ce0bb66b401cfe37ad728 /preprocessor.py | |
parent | 2d763b53a6071b232794795c510363b280f45a89 (diff) |
fix preprocessor/givepoke for variable-number-of-parameter macros
Diffstat (limited to 'preprocessor.py')
-rw-r--r-- | preprocessor.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/preprocessor.py b/preprocessor.py index f350971af..0a0c8a0d6 100644 --- a/preprocessor.py +++ b/preprocessor.py @@ -481,14 +481,20 @@ def macro_translator(macro, token, line): raise Exception, "dunno what to do with this non db/dw macro param: " + \ str(param_klass) + " in line: " + original_line - assert len(params) == allowed_length, \ + # sometimes the allowed length can vary + if hasattr(macro, "allowed_lengths"): + allowed_lengths = macro.allowed_lengths + [allowed_length] + else: + allowed_lengths = [allowed_length] + + assert len(params) in allowed_lengths, \ "mismatched number of parameters on this line: " + \ original_line # --- end of ridiculously long sanity check --- index = 0 - while index < len(macro.param_types): + while index < len(params): param_type = macro.param_types[index] description = param_type["name"] param_klass = param_type["class"] |