blob: 45a1c213f52542f0895ee14ea27776550c135f23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
|