10 /^%}$/ && state == 1 {
14 state == 1 { print; next; }
15 /^struct/ && state == 0 {
20 /^%%$/ && state == 0 {
22 if (struct_seen !~ /^$/) {
23 print "static const struct", struct_seen, "wordlist[] = {";
25 print "static const struct map {";
26 print "\tconst char *name;";
29 print "} wordlist[] = {";
34 /^%%$/ && state == 2 {
36 print "\t{ NULL, 0, 0 }";
38 print "#include <sys/param.h>";
39 print "#define\tNWORDS\t(nitems(wordlist) - 1)";
40 print "static const struct map *";
41 print "in_word_set(const char *word)";
43 print "\tconst struct", struct_seen, "*mp;";
45 print "\tfor (mp = wordlist; mp < &wordlist[NWORDS]; mp++) {";
46 print "\t\tif (strcmp(word, mp->name) == 0)";
47 print "\t\t\treturn (mp);";
49 print "\treturn (NULL);";
54 state == 2 && NF == 2 {
55 name = substr($1, 1, length($1) - 1);
56 printf "#ifdef %s\n", $2;
57 printf "\t{ \"%s\", %s, 1 },\n", name, $2;
59 printf "\t{ \"%s\", 0, 0 },\n", name, $2;
63 state == 3 { print; next; }
65 # eat anything not matched.