diff options
Diffstat (limited to 'src/basic/generate-gperfs.py')
-rw-r--r-- | src/basic/generate-gperfs.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/basic/generate-gperfs.py b/src/basic/generate-gperfs.py new file mode 100644 index 0000000000..2e7d8931dd --- /dev/null +++ b/src/basic/generate-gperfs.py @@ -0,0 +1,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)) |