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