This is Unofficial EPICS BASE Doxygen Site
skeleton.c
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 #include "defs.h"
10 
11 /* If the skeleton is changed, the banner should be changed so that */
12 /* the altered version can be easily distinguished from the original. */
13 /* */
14 /* The #defines included with the banner are there because they are */
15 /* useful in subsequent code. The macros #defined in the header or */
16 /* the body either are not useful outside of semantic actions or */
17 /* are conditional. */
18 
19 char *banner[] =
20 {
21  "#define YYBYACC 1",
22  "#define YYMAJOR 1",
23  "#define YYMINOR 9",
24  "#define yyclearin (yychar=(-1))",
25  "#define yyerrok (yyerrflag=0)",
26  "#define YYRECOVERING (yyerrflag!=0)",
27  "static int yyparse(void);",/* JRW */
28  0
29 };
30 
31 
32 char *tables[] =
33 {
34  "static short yylhs[];", /* JRW */
35  "static short yylen[];", /* JRW */
36  "static short yydefred[];", /* JRW */
37  "static short yydgoto[];", /* JRW */
38  "static short yysindex[];", /* JRW */
39  "static short yyrindex[];", /* JRW */
40  "static short yygindex[];", /* JRW */
41  "static short yytable[];", /* JRW */
42  "static short yycheck[];", /* JRW */
43  "#if YYDEBUG",
44  "static char *yyname[];", /* JRW */
45  "static char *yyrule[];", /* JRW */
46  "#endif",
47  0
48 };
49 
50 
51 char *header[] =
52 {
53  "#ifdef YYSTACKSIZE",
54  "#undef YYMAXDEPTH",
55  "#define YYMAXDEPTH YYSTACKSIZE",
56  "#else",
57  "#ifdef YYMAXDEPTH",
58  "#define YYSTACKSIZE YYMAXDEPTH",
59  "#else",
60  "#define YYSTACKSIZE 500",
61  "#define YYMAXDEPTH 500",
62  "#endif",
63  "#endif",
64  "#if YYDEBUG", /* MRK */
65  "static int yydebug;", /* JRW */
66  "#endif", /* MRK */
67  "static int yynerrs;", /* JRW */
68  "static int yyerrflag;", /* JRW */
69  "static int yychar;", /* JRW */
70  "static short *yyssp;", /* JRW */
71  "static YYSTYPE *yyvsp;", /* JRW */
72  "static YYSTYPE yyval;", /* JRW */
73  "static YYSTYPE yylval;", /* JRW */
74  "static short yyss[YYSTACKSIZE];", /* JRW */
75  "static YYSTYPE yyvs[YYSTACKSIZE];", /* JRW */
76  "#define yystacksize YYSTACKSIZE",
77  0
78 };
79 
80 
81 char *body[] =
82 {
83  "#define YYABORT goto yyabort",
84  "#define YYREJECT goto yyabort",
85  "#define YYACCEPT goto yyaccept",
86  "#define YYERROR goto yyerrlab",
87  "static int", /* JRW */
88  "yyparse(void)", /* JRW */
89  "{",
90  " int yym, yyn, yystate;",
91  "#if YYDEBUG",
92  " char *yys;",
93  " extern char *getenv();",
94  "",
95  " if ((yys = getenv(\"YYDEBUG\")))",
96  " {",
97  " yyn = *yys;",
98  " if (yyn >= '0' && yyn <= '9')",
99  " yydebug = yyn - '0';",
100  " }",
101  "#endif",
102  "",
103  " yynerrs = 0;",
104  " yyerrflag = 0;",
105  " yychar = (-1);",
106  "",
107  " yyssp = yyss;",
108  " yyvsp = yyvs;",
109  " *yyssp = yystate = 0;",
110  "",
111  "yyloop:",
112  " if ((yyn = yydefred[yystate])) goto yyreduce;",
113  " if (yychar < 0)",
114  " {",
115  " if ((yychar = yylex()) < 0) yychar = 0;",
116  "#if YYDEBUG",
117  " if (yydebug)",
118  " {",
119  " yys = 0;",
120  " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
121  " if (!yys) yys = \"illegal-symbol\";",
122  " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
123  " YYPREFIX, yystate, yychar, yys);",
124  " }",
125  "#endif",
126  " }",
127  " if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&",
128  " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
129  " {",
130  "#if YYDEBUG",
131  " if (yydebug)",
132  " printf(\"%sdebug: state %d, shifting to state %d\\n\",",
133  " YYPREFIX, yystate, yytable[yyn]);",
134  "#endif",
135  " if (yyssp >= yyss + yystacksize - 1)",
136  " {",
137  " goto yyoverflow;",
138  " }",
139  " *++yyssp = yystate = yytable[yyn];",
140  " *++yyvsp = yylval;",
141  " yychar = (-1);",
142  " if (yyerrflag > 0) --yyerrflag;",
143  " goto yyloop;",
144  " }",
145  " if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&",
146  " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
147  " {",
148  " yyn = yytable[yyn];",
149  " goto yyreduce;",
150  " }",
151  " if (yyerrflag) goto yyinrecovery;",
152  " yyerror(\"syntax error\");",
153  " ++yynerrs;",
154  "yyinrecovery:",
155  " if (yyerrflag < 3)",
156  " {",
157  " yyerrflag = 3;",
158  " for (;;)",
159  " {",
160  " if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&",
161  " yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)",
162  " {",
163  "#if YYDEBUG",
164  " if (yydebug)",
165  " printf(\"%sdebug: state %d, error recovery shifting\\",
166  " to state %d\\n\", YYPREFIX, *yyssp, yytable[yyn]);",
167  "#endif",
168  " if (yyssp >= yyss + yystacksize - 1)",
169  " {",
170  " goto yyoverflow;",
171  " }",
172  " *++yyssp = yystate = yytable[yyn];",
173  " *++yyvsp = yylval;",
174  " goto yyloop;",
175  " }",
176  " else",
177  " {",
178  "#if YYDEBUG",
179  " if (yydebug)",
180  " printf(\"%sdebug: error recovery discarding state %d\
181 \\n\",",
182  " YYPREFIX, *yyssp);",
183  "#endif",
184  " if (yyssp <= yyss) goto yyabort;",
185  " --yyssp;",
186  " --yyvsp;",
187  " }",
188  " }",
189  " }",
190  " else",
191  " {",
192  " if (yychar == 0) goto yyabort;",
193  "#if YYDEBUG",
194  " if (yydebug)",
195  " {",
196  " yys = 0;",
197  " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
198  " if (!yys) yys = \"illegal-symbol\";",
199  " printf(\"%sdebug: state %d, error recovery discards token %d\
200  (%s)\\n\",",
201  " YYPREFIX, yystate, yychar, yys);",
202  " }",
203  "#endif",
204  " yychar = (-1);",
205  " goto yyloop;",
206  " }",
207  "yyreduce:",
208  "#if YYDEBUG",
209  " if (yydebug)",
210  " printf(\"%sdebug: state %d, reducing by rule %d (%s)\\n\",",
211  " YYPREFIX, yystate, yyn, yyrule[yyn]);",
212  "#endif",
213  " yym = yylen[yyn];",
214  " yyval = yyvsp[1-yym];",
215  " switch (yyn)",
216  " {",
217  0
218 };
219 
220 
221 char *trailer[] =
222 {
223  " }",
224  " yyssp -= yym;",
225  " yystate = *yyssp;",
226  " yyvsp -= yym;",
227  " yym = yylhs[yyn];",
228  " if (yystate == 0 && yym == 0)",
229  " {",
230  "#if YYDEBUG",
231  " if (yydebug)",
232  " printf(\"%sdebug: after reduction, shifting from state 0 to\\",
233  " state %d\\n\", YYPREFIX, YYFINAL);",
234  "#endif",
235  " yystate = YYFINAL;",
236  " *++yyssp = YYFINAL;",
237  " *++yyvsp = yyval;",
238  " if (yychar < 0)",
239  " {",
240  " if ((yychar = yylex()) < 0) yychar = 0;",
241  "#if YYDEBUG",
242  " if (yydebug)",
243  " {",
244  " yys = 0;",
245  " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
246  " if (!yys) yys = \"illegal-symbol\";",
247  " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
248  " YYPREFIX, YYFINAL, yychar, yys);",
249  " }",
250  "#endif",
251  " }",
252  " if (yychar == 0) goto yyaccept;",
253  " goto yyloop;",
254  " }",
255  " if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&",
256  " yyn <= YYTABLESIZE && yycheck[yyn] == yystate)",
257  " yystate = yytable[yyn];",
258  " else",
259  " yystate = yydgoto[yym];",
260  "#if YYDEBUG",
261  " if (yydebug)",
262  " printf(\"%sdebug: after reduction, shifting from state %d \\",
263  "to state %d\\n\", YYPREFIX, *yyssp, yystate);",
264  "#endif",
265  " if (yyssp >= yyss + yystacksize - 1)",
266  " {",
267  " goto yyoverflow;",
268  " }",
269  " *++yyssp = yystate;",
270  " *++yyvsp = yyval;",
271  " goto yyloop;",
272  "yyoverflow:",
273  " yyerror(\"yacc stack overflow\");",
274  "yyabort:",
275  " return (1);",
276  "yyaccept:",
277  " return (0);",
278  "}",
279  0
280 };
281 
282 
283 void
284 write_section(char *section[])
285 {
286  int c;
287  int i;
288  char *s;
289  FILE *f;
290 
291  f = code_file;
292  for (i = 0; (s = section[i]); ++i)
293  {
294  ++outline;
295  while ((c = *s))
296  {
297  putc(c, f);
298  ++s;
299  }
300  putc('\n', f);
301  }
302 }
int i
Definition: scan.c:967
char * tables[]
Definition: skeleton.c:32
void write_section(char *section[])
Definition: skeleton.c:284
char * body[]
Definition: skeleton.c:81
FILE * code_file
Definition: antelope.c:44
char * banner[]
Definition: skeleton.c:19
char * trailer[]
Definition: skeleton.c:221
char * header[]
Definition: skeleton.c:51
int outline
Definition: antelope.c:34