blob: aca9ab1fe91e3123ac3a99355efb699d715283de [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("""\
Shawn Landden48319812017-11-19 10:06:10 -080011%{
12#if __GNUC__ >= 7
13_Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
14#endif
15%}""")
16print("""\
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040017struct {}_name {{ const char* name; int id; }};
18%null-strings
19%%""".format(name))
20
21for line in open(input):
22 print("{0}, {1}{0}".format(line.rstrip(), prefix))