diff options
author | omnisci3nce <omniscient.oce@gmail.com> | 2024-07-14 21:47:25 +1000 |
---|---|---|
committer | omnisci3nce <omniscient.oce@gmail.com> | 2024-07-14 21:47:25 +1000 |
commit | 529a603128d5e9dc4701322f44961f165e2183e1 (patch) | |
tree | 3e5d65ac503b971412ae35bfc5fb67a438a3c364 /scripts/gen_amalgamation.py | |
parent | 5b001d39d42314085164724d3a417fb8ebd54f98 (diff) |
generate api docs python
Diffstat (limited to 'scripts/gen_amalgamation.py')
-rw-r--r-- | scripts/gen_amalgamation.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/gen_amalgamation.py b/scripts/gen_amalgamation.py new file mode 100644 index 0000000..45a1c21 --- /dev/null +++ b/scripts/gen_amalgamation.py @@ -0,0 +1,24 @@ +# Generates a single amalgamation C header file that includes all public types and functions. +# +# This makes including and linking Celeritas very easy. +import re +import sys + +def find_pub_functions(filepath): + pattern = r'PUB\s+(\w+\s+)*(\w+)\s+(\w+)\s*\((.*?)\)' + + with open(filepath, 'r') as file: + content = file.read() + + matches = re.finditer(pattern, content, re.MULTILINE) + + for match in matches: + print(match.group(0)) + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Usage: python script.py <path_to_c_file>") + sys.exit(1) + + file_path = sys.argv[1] + find_pub_functions(file_path) |