Skip to content

Commit

Permalink
Remove searching in /src for header files in genctx.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JaceCear committed Dec 12, 2024
1 parent d4fd416 commit cf83fc3
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions genctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,32 @@
def search_directories(*patterns):
return it.chain.from_iterable(glob.iglob(pattern,recursive=True) for pattern in patterns)

for filename in search_directories('./src/**/*.h', './include/**/*.h'):
for filename in search_directories('./include/**/*.h'):
with open(filename) as header:
header_name = "/".join(filename.split('/')[2:])

# not needed for decomp work
if header_name.startswith("platform"):
continue

if not header_name in depends_on:
depends_on[header_name] = set()
if not header_name.startswith("gba/") and header_name != "global.h" and header_name != "functions.h":
if not header_name.startswith("gba/") \
and header_name != "global.h" \
and header_name != "functions.h":
depends_on[header_name].add("global.h")

if header_name.startswith("gba/") and not header_name.endswith("types.h") and not header_name.endswith("defines.h"):
if header_name.startswith("gba/") \
and not header_name.endswith("types.h") \
and not header_name.endswith("defines.h"):
depends_on[header_name].add("gba/types.h")

if header_name.startswith("gba/") and not header_name.endswith("multiboot.h") and not header_name.endswith("types.h"):
if header_name.startswith("gba/") \
and not header_name.endswith("multiboot.h") \
and not header_name.endswith("types.h"):
depends_on[header_name].add("gba/multiboot.h")

data[header_name] = ""
for line in header.readlines():
if "#include" in line and not line.startswith("//") and '<' not in line:
if "#include" in line \
and not line.startswith("//") \
and '<' not in line:
requires = line.split('"')[1]
depends_on[header_name].add(requires)
continue
Expand All @@ -58,7 +62,6 @@ def search_directories(*patterns):
print_order = tuple(ts.static_order())

with open('ctx.c', 'w') as context:
context.write("#define PLATFORM_GBA 1\n")
for header in print_order:
exclude = False
for e in excluded:
Expand Down

0 comments on commit cf83fc3

Please sign in to comment.