small fixes

This commit is contained in:
Harrison Lambeth 2025-01-26 18:30:26 -07:00
parent f4933c6669
commit 38bb241ced
3 changed files with 3 additions and 2 deletions

View File

@ -57,7 +57,7 @@ def main() -> None:
logger.info(f'Generator: {args.generator}')
logger.info('Parsing headers')
extracted_symbols = parse_headers(input_files, output_dir, tmp_dir)
extracted_symbols = parse_headers(input_files, tmp_dir)
with open(tmp_dir / 'extracted_symbols.json', 'w') as f:
f.write(json.dumps({
'structs': extracted_symbols.structs,

View File

@ -37,6 +37,7 @@ class BaseGenerator:
def write_outputs(self, output_dir: Path) -> None:
for file_name, content in self.output_content.items():
(output_dir / file_name).parent.mkdir(parents=True, exist_ok=True)
with open(output_dir / file_name, 'w') as f:
f.write("\n".join(content))

View File

@ -132,7 +132,7 @@ class Visitor(c_ast.NodeVisitor):
self.generic_visit(node)
def parse_headers(input_files: list[Path], output_dir: Path, tmp_dir: Path) -> ExtractedSymbols:
def parse_headers(input_files: list[Path], tmp_dir: Path) -> ExtractedSymbols:
cpp_args = ["-nostdinc", "-D__attribute__(x)=", "-E"]
# Make a new clay.h that combines the provided input files, so that we can add bindings for customized structs