11 /^%}$/ && state == 1 {
15 state == 1 { print; next; }
16 /^struct/ && state == 0 {
21 /^%%$/ && state == 0 {
23 if (struct_seen !~ /^$/) {
24 print "static const struct", struct_seen, "wordlist[] = {";
26 print "static const struct map {";
27 print "\tconst char *name;";
30 print "} wordlist[] = {";
35 /^%%$/ && state == 2 {
37 print "\t{ NULL, 0, 0 }";
39 print "#include <sys/param.h>";
40 print "#define\tNWORDS\t(nitems(wordlist) - 1)";
41 print "static const struct map *";
42 print "in_word_set(const char *word)";
44 print "\tconst struct", struct_seen, "*mp;";
46 print "\tfor (mp = wordlist; mp < &wordlist[NWORDS]; mp++) {";
47 print "\t\tif (strcmp(word, mp->name) == 0)";
48 print "\t\t\treturn (mp);";
50 print "\treturn (NULL);";
55 state == 2 && NF == 2 {
56 name = substr($1, 1, length($1) - 1);
57 printf "#ifdef %s\n", $2;
58 printf "\t{ \"%s\", %s, 1 },\n", name, $2;
60 printf "\t{ \"%s\", 0, 0 },\n", name, $2;
64 state == 3 { print; next; }
66 # eat anything not matched.