]>
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(''' | |
8dd8a286 | 9 | const void* symbols[] = {''') |
37ab1a25 ZJS |
10 | |
11 | for line in open(sys.argv[1]): | |
12 | match = re.search('^ +([a-zA-Z0-9_]+);', line) | |
13 | if match: | |
8dd8a286 ZJS |
14 | s = match.group(1) |
15 | if s == 'sd_bus_object_vtable_format': | |
155dc161 | 16 | print(' &{},'.format(s)) |
8dd8a286 | 17 | else: |
155dc161 | 18 | print(' {},'.format(s)) |
37ab1a25 ZJS |
19 | |
20 | print('''}; | |
21 | ||
22 | int main(void) { | |
23 | unsigned i; | |
8dd8a286 ZJS |
24 | for (i = 0; i < sizeof(symbols)/sizeof(void*); i++) |
25 | printf("%p\\n", symbols[i]); | |
37ab1a25 ZJS |
26 | return 0; |
27 | }''') |