2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 # pylint: disable=unbalanced-tuple-unpacking,consider-using-f-string,consider-using-with
6 Generate %-from-name.gperf from %-list.txt
11 if __name__
== '__main__':
12 if len(sys
.argv
) != 4:
13 sys
.exit(f
'Usage: {sys.argv[0]} name prefix file')
15 name
, prefix
, file = sys
.argv
[1:]
20 _Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
24 struct {name}_name {{ const char* name; int id; }};
28 for line
in open(file):
29 print("{0}, {1}{0}".format(line
.rstrip(), prefix
))