Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
rev: v2.14
hooks:
- id: vulture
name: run vulture
args: ["."]
description: find dead Python code
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.9.0
Expand Down
10 changes: 1 addition & 9 deletions generate_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,15 @@ def clean_and_regenerate_guard(h_file_path, root):
with open(h_file_path, "r", encoding="utf-8") as file:
lines = file.readlines()

guard_define_line = None
guard_ifndef_line = None
endif_line = None
inside_guard = False

new_lines = []
for i, line in enumerate(lines):
for line in lines:
if re.match(r"#\s*ifndef\s+_[A-Z0-9_]+", line):
guard_ifndef_line = i
inside_guard = True
continue
elif inside_guard and re.match(r"#\s*define\s+_[A-Z0-9_]+", line):
guard_define_line = i
continue
elif inside_guard and re.match(r"#\s*endif\s*(//.*)?", line):
endif_line = i
inside_guard = False
continue
elif not inside_guard:
Expand All @@ -53,7 +46,6 @@ def clean_and_regenerate_guard(h_file_path, root):

print(f"[REGENERATE] Header guard: {h_file_path}")


def create_header_file(c_file_path, root):
base_name = os.path.splitext(os.path.basename(c_file_path))[0]
h_file_path = os.path.join(os.path.dirname(c_file_path), base_name + ".h")
Expand Down
Loading