MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / process_file

Function process_file

tools/decompctx.py:58–82  ·  view source on GitHub ↗
(in_file: str, lines: List[str])

Source from the content-addressed store, hash-verified

56
57
58def process_file(in_file: str, lines: List[str]) -> str:
59 out_text = ""
60 for idx, line in enumerate(lines):
61 if idx == 0:
62 guard_match = guard_pattern.match(line.strip())
63 if guard_match:
64 if guard_match[1] in defines:
65 break
66 defines.add(guard_match[1])
67 else:
68 once_match = once_pattern.match(line.strip())
69 if once_match:
70 if in_file in defines:
71 break
72 defines.add(in_file)
73 print("Processing file", in_file)
74 include_match = include_pattern.match(line.strip())
75 if include_match and not include_match[1].endswith(".s"):
76 out_text += f'/* "{in_file}" line {idx} "{include_match[1]}" */\n'
77 out_text += import_h_file(include_match[1], os.path.dirname(in_file))
78 out_text += f'/* end "{include_match[1]}" */\n'
79 else:
80 out_text += line
81
82 return out_text
83
84
85def sanitize_path(path: str) -> str:

Callers 1

import_c_fileFunction · 0.85

Calls 2

import_h_fileFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected