Make the joiner script comment out includes.

This commit is contained in:
Relintai 2023-12-17 17:34:45 +01:00
parent 25274b2c8d
commit 19f5e62d46

View File

@ -29,6 +29,25 @@ import os
template_args = {} template_args = {}
input_path = "" input_path = ""
print_includes_dict = dict()
def print_includes(f):
s = f.split("\n")
for l in s:
if l.startswith("#include <"):
l = l.strip()
if not l in print_includes_dict:
print(l)
print_includes_dict[l] = 1
def process_file(f):
#print_includes(f)
return f.replace('#include ', '//#include ')
def process_command(name, value): def process_command(name, value):
if name == "ARG": if name == "ARG":
print("Appending arg: " + value) print("Appending arg: " + value)
@ -38,7 +57,7 @@ def process_command(name, value):
print("Appending file: " + value) print("Appending file: " + value)
with open(file_path, "r") as file: with open(file_path, "r") as file:
res = "#line 1 \"" + value + "\"\n" res = "#line 1 \"" + value + "\"\n"
res += file.read() res += process_file(file.read())
res += "#line 0" res += "#line 0"
return res return res