Debian Codegraph @

extern/btyacc/skel2c

raw
1 BEGIN { havesection = 0;
2 nsec = 0;
3 printf "/*\n** This file generated automatically from %s\n*/\n\n",
4 FILENAME;
5 printf "#include \"defs.h\"\n";
6 }
7 /^%%/ { if (havesection) {
8 printf " 0\n};\n\n";
9 }
10 if (NF >= 2) {
11 havesection = 1;
12 section = $2;
13 seclist[nsec] = section;
14 nsec = nsec + 1;
15 printf "char *%s[] =\n{\n", $2;
16 printf " \"#line %d \\\"%s\\\"\",\n", FNR+1, FILENAME;
17 } else {
18 havesection = 0;
19 }
20 next;
21 }
22 { if (havesection) {
23 gsub(/\\/, "\\\\");
24 gsub(/\t/, "\\t");
25 gsub(/\"/, "\\\"");
26 printf " \"%s\",\n", $0;
27 } else {
28 print $0;
29 }
30 }
31 END { if (havesection) {
32 printf " 0\n};\n\n";
33 }
34 if (nsec > 0) {
35 printf "struct section section_list[] = {\n";
36 for (i=0; i<nsec; i++)
37 printf "\t{ \"%s\", &%s[0] },\n", seclist[i], seclist[i];
38 printf "\t{ 0, 0 } };\n"
39 }
40 }