summaryrefslogtreecommitdiff
path: root/addr_to_sym.py
blob: 13737b628b8c8682f3a122a816167faef5082432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import re

# Define the regex query to match the hex values
regex_query = r'0x07[0-9a-fA-F]{6}'

# Define a function to process each match
def process_match(match):
    offset = int(match.group(0)[4:], 16)
    return f"d_course_big_donut_packed_dl_{hex(offset)[2:].upper()}"

# Open the input file
with open("courses/big_donut/packed.inc.c", "r") as f:
    # Read the file contents
    file_content = f.read()

    # Use re.sub() to find and replace all matches in the file content
    modified_content = re.sub(regex_query, process_match, file_content)

    # Print the modified content to console
    print(modified_content)