summaryrefslogtreecommitdiffstats
path: root/src/basic/generate-gperfs.py
blob: 2e7d8931ddbbc40fbc493b1cb6ea269fe7916e3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python3

"""Generate %-from-name.gperf from %-list.txt
"""

import sys

name, prefix, input = sys.argv[1:]

print("""\
struct {}_name {{ const char* name; int id; }};
%null-strings
%%""".format(name))

for line in open(input):
    print("{0}, {1}{0}".format(line.rstrip(), prefix))