Update check.py to work with symbol involving multiple template arguments

This commit is contained in:
Headpenguin 2023-08-17 17:51:41 -04:00
parent edccaefe18
commit d061d32d5f

View File

@ -31,34 +31,17 @@ class FunctionLibrary:
with open(pathlib.Path(f"csv/{file}"), "r") as input:
is_first_line = True
for line in input:
print(line)
if is_first_line:
is_first_line = False
continue
bracketCounter = 0
replacements = []
for i, c in enumerate(line):
if c == '<':
bracketCounter += 1
elif c == '>':
bracketCounter -= 1
elif bracketCounter > 0 and c == ',':
replacements += [i]
offset = 0
for i in replacements:
line = line[:i + offset] + '&#44;' + line[i + offset + 1:]
offset += 4
if len(replacements) > 0:
print(line)
line_split = line.rstrip().split(",")
symbol = line_split[0]
# We need to substitute any escaped commas in the symbol name
symbol = line_split[0].replace("&#44;", ",")
obj_file = line_split[1]
library_name = line_split[2]
print(line)
matches = line_split[3] == "true"
if (symbol, obj_file) in symbols:
@ -88,6 +71,9 @@ class FunctionLibrary:
output.write("Symbol Name, Object File, Library Archive, Matching\n")
for (symbol, obj_file), values in symbols.items():
# Because the symbols are stored in a csv file, we need to escape any commas in the symbol name
# so that the commas do not confuse the parser script
symbol = symbol.replace(",", "&#44;");
output.write(f"{symbol},{obj_file},{values[0]},{str(values[1]).lower()}\n")
def get_obj_names_from_symbol(self, symbol_lookup):