]>
Commit | Line | Data |
---|---|---|
3e67e5c9 | 1 | #!/usr/bin/env python3 |
db9ecf05 | 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
5c23128d | 3 | |
87421ff5 YW |
4 | """ |
5 | Generate %-from-name.gperf from %-list.txt | |
5c23128d ZJS |
6 | """ |
7 | ||
8 | import sys | |
9 | ||
10 | name, prefix, input = sys.argv[1:] | |
11 | ||
4831981d SL |
12 | print("""\ |
13 | %{ | |
14 | #if __GNUC__ >= 7 | |
15 | _Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"") | |
16 | #endif | |
17 | %}""") | |
5c23128d ZJS |
18 | print("""\ |
19 | struct {}_name {{ const char* name; int id; }}; | |
20 | %null-strings | |
21 | %%""".format(name)) | |
22 | ||
23 | for line in open(input): | |
24 | print("{0}, {1}{0}".format(line.rstrip(), prefix)) |