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