]>
Commit | Line | Data |
---|---|---|
3e67e5c9 | 1 | #!/usr/bin/env python3 |
37ab1a25 ZJS |
2 | import sys, re |
3 | ||
4 | print('#include <stdio.h>') | |
5 | for header in sys.argv[2:]: | |
6 | print('#include "{}"'.format(header.split('/')[-1])) | |
7 | ||
8 | print(''' | |
9 | void* functions[] = {''') | |
10 | ||
11 | for line in open(sys.argv[1]): | |
12 | match = re.search('^ +([a-zA-Z0-9_]+);', line) | |
13 | if match: | |
14 | print(' {},'.format(match.group(1))) | |
15 | ||
16 | print('''}; | |
17 | ||
18 | int main(void) { | |
19 | unsigned i; | |
20 | for (i = 0; i < sizeof(functions)/sizeof(void*); i++) | |
21 | printf("%p\\n", functions[i]); | |
22 | return 0; | |
23 | }''') |