From 83244da18a7f7f902f2eefbfd501c7c17b745e85 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Mon, 28 Oct 2024 22:15:19 -0400 Subject: [PATCH] Fix extract_function including numbers in includes --- tools/extract_function/extract_function.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/extract_function/extract_function.py b/tools/extract_function/extract_function.py index f6cb665d..64cef3f8 100644 --- a/tools/extract_function/extract_function.py +++ b/tools/extract_function/extract_function.py @@ -126,7 +126,7 @@ BRANCH_INSTRUCTION = '\tb ' WORD_KEY = '.word ' WORD_PLUS_OFFSET = ' + 0x' """ -Searches through an ASM file's contents for all external symbosl, then populates a .inc file with all the necessary .public definitions. +Searches through an ASM file's contents for all external symbols, then populates a .inc file with all the necessary .public definitions. """ def write_inc_file(lines: List[str], file_path: str): defined_functions = set() @@ -152,9 +152,12 @@ def write_inc_file(lines: List[str], file_path: str): if word_index >= 0 and f'{WORD_KEY}0x' not in line: word_plus_offset_index = line.find(WORD_PLUS_OFFSET) if word_plus_offset_index >= 0: - used_functions.add(line[word_index + len(WORD_KEY) : word_plus_offset_index]) + new_word = line[word_index + len(WORD_KEY) : word_plus_offset_index] else: - used_functions.add(line[word_index + len(WORD_KEY) : -1]) + new_word = line[word_index + len(WORD_KEY) : -1] + + if new_word[0] < '0' or new_word > '9': + used_functions.add(new_word) for function in defined_functions: if function in used_functions: