5
5
import sys
6
6
from math import ceil
7
7
8
+ """
9
+ Generates src/dynarec/arm_printer.c
10
+ ===
11
+
12
+ See src/dynarec/arm_instructions.txt (the input file) for the syntax documentation.
13
+ """
14
+
8
15
# Helper class to avoid displaying '\x1b[' on errors
9
16
class string (str ):
10
17
def __repr__ (self ):
@@ -172,13 +179,6 @@ def generate_bin_test(positions=[], specifics=[]):
172
179
- specifics is an array of arrays the same length as positions that contains a tuple (mask, correctBit)
173
180
that is at position positions[current_pos]
174
181
"""
175
- if len (positions ) != len (specifics ):
176
- fail (
177
- AssertionError ,
178
- "generate_bin_tests requires the same length for positions ({}) and specifics ({})!" .format (
179
- len (positions ), len (specifics )
180
- )
181
- )
182
182
183
183
if specifics == []:
184
184
append ("if ((opcode & " + arr2hex (mask ) + ") == " + arr2hex (correctBits ) + ") {\n " )
@@ -194,8 +194,9 @@ def generate_bin_test(positions=[], specifics=[]):
194
194
if any (map (lambda s : len (s ) != l , specifics )):
195
195
fail (
196
196
AssertionError ,
197
- "generate_bin_tests requires the same length for positions ({}) and specifics ({})!" .format (
198
- len (positions ), len (specifics )
197
+ "generate_bin_tests requires the same length for positions ({}) and each element "
198
+ "of the specifics array ({})!" .format (
199
+ len (positions ), [len (s ) for s in specifics ]
199
200
)
200
201
)
201
202
@@ -290,7 +291,7 @@ def add_custom_variables():
290
291
# Custom ifs
291
292
# Also, requires only a single '='
292
293
if eq != "=" :
293
- fail (ValueError , "Too many '=' switches (! @ modifier)" )
294
+ fail (ValueError , "Too many '=' switches (@ @ modifier)" )
294
295
295
296
# Extract the statements
296
297
statements = []
@@ -1653,7 +1654,7 @@ def add_custom_variables():
1653
1654
1654
1655
# No C variable since we're invalidating!
1655
1656
1656
- # Now print the invalidation, numerote if debugging
1657
+ # Now print the invalidation, number if debugging
1657
1658
if numberInvalids :
1658
1659
append ("strcpy(ret, \" ??? #" + str (invalidationCount ) + "\" );\n } else " )
1659
1660
invalidationCount = invalidationCount + 1
@@ -1963,12 +1964,12 @@ def add_custom_variables():
1963
1964
""" }
1964
1965
1965
1966
for f in files_header :
1966
- # Save the string for the next iteration, writing was successful
1967
1967
with open (os .path .join (root , "src" , "dynarec" , f ), 'w' ) as file :
1968
1968
file .write (header .format (version = ver ))
1969
1969
file .write (files_header [f ])
1970
1970
file .write (output )
1971
1971
file .write (files_guard [f ])
1972
+ # Save the string for the next iteration, writing was successful
1972
1973
with open (os .path .join (root , "src" , "dynarec" , "last_run.txt" ), 'w' ) as file :
1973
1974
file .write ('\n ' .join (insts ))
1974
1975
0 commit comments