Jörg Thalheim | 3e67e5c | 2017-05-01 02:26:56 +0200 | [diff] [blame^] | 1 | #!/usr/bin/env python3 |
Zbigniew Jędrzejewski-Szmek | 5c23128 | 2017-04-04 23:03:47 -0400 | [diff] [blame] | 2 | |
3 | """Generate %-from-name.gperf from %-list.txt | ||||
4 | """ | ||||
5 | |||||
6 | import sys | ||||
7 | |||||
8 | name, prefix, input = sys.argv[1:] | ||||
9 | |||||
10 | print("""\ | ||||
11 | struct {}_name {{ const char* name; int id; }}; | ||||
12 | %null-strings | ||||
13 | %%""".format(name)) | ||||
14 | |||||
15 | for line in open(input): | ||||
16 | print("{0}, {1}{0}".format(line.rstrip(), prefix)) |