1 | |
---|
2 | /* A Bison parser, made from mod_grammar.y |
---|
3 | by GNU Bison version 1.28 */ |
---|
4 | |
---|
5 | #define YYBISON 1 /* Identify Bison output. */ |
---|
6 | |
---|
7 | #define MCOLONCOLON 257 |
---|
8 | #define MEQUAL 258 |
---|
9 | #define MMODULE_CMD 259 |
---|
10 | #define MVERSION_CMD 260 |
---|
11 | #define MINFO_CMD 261 |
---|
12 | #define MINFOFILE_CMD 262 |
---|
13 | #define MHELP_CMD 263 |
---|
14 | #define MHELPFILE_CMD 264 |
---|
15 | #define MCXXSRC_CMD 265 |
---|
16 | #define MPROC_CMD 266 |
---|
17 | #define SECTEND 267 |
---|
18 | #define SECT2START 268 |
---|
19 | #define SECT2END 269 |
---|
20 | #define SECT3START 270 |
---|
21 | #define SECT3END 271 |
---|
22 | #define SECT4START 272 |
---|
23 | #define SECT4END 273 |
---|
24 | #define PROCDECLTOK 274 |
---|
25 | #define EXAMPLETOK 275 |
---|
26 | #define STATICTOK 276 |
---|
27 | #define VARNAMETOK 277 |
---|
28 | #define MSTRINGTOK 278 |
---|
29 | #define NAME 279 |
---|
30 | #define FILENAME 280 |
---|
31 | #define MCCODETOK 281 |
---|
32 | #define MCODETOK 282 |
---|
33 | #define CODEPART 283 |
---|
34 | #define CMTPART 284 |
---|
35 | #define PROCCMD 285 |
---|
36 | #define ANYTOK 286 |
---|
37 | #define VARTYPETOK 287 |
---|
38 | #define NUMTOK 288 |
---|
39 | #define BOOLTOK 289 |
---|
40 | |
---|
41 | #line 5 "mod_grammar.y" |
---|
42 | |
---|
43 | |
---|
44 | #include <stdio.h> |
---|
45 | #include <stddef.h> |
---|
46 | #include <stdlib.h> |
---|
47 | #include <stdarg.h> |
---|
48 | #include <string.h> |
---|
49 | |
---|
50 | #include "typmap.h" |
---|
51 | #include "stype.h" |
---|
52 | |
---|
53 | VAR int sectnum = 1; |
---|
54 | VAR int iseof = 0; |
---|
55 | VAR int initdone = 0; |
---|
56 | EXTERN_INST_VAR moddef module_def; |
---|
57 | EXTERN_VAR int yylineno; |
---|
58 | EXTERN_VAR int do_create_makefile; |
---|
59 | EXTERN_VAR char *sectname[]; |
---|
60 | |
---|
61 | extern int init_modgen(moddef *module_def, char *filename); |
---|
62 | extern int write_intro(moddefv module); |
---|
63 | extern void write_mod_init(moddefv module, FILE *fp); |
---|
64 | extern void enter_id(FILE *fp, char *name, char *value, |
---|
65 | int lineno, char *file); |
---|
66 | |
---|
67 | INST_VAR procdef procedure_decl; |
---|
68 | |
---|
69 | |
---|
70 | void yyerror(char * fmt) |
---|
71 | { |
---|
72 | if(!iseof) printf("%s at line %d\n", fmt, yylineno); |
---|
73 | } |
---|
74 | |
---|
75 | #ifndef YYDEBUG |
---|
76 | #define YYDEBUG 1 |
---|
77 | #endif |
---|
78 | |
---|
79 | #include <stdio.h> |
---|
80 | |
---|
81 | #ifndef __cplusplus |
---|
82 | #ifndef __STDC__ |
---|
83 | #define const |
---|
84 | #endif |
---|
85 | #endif |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | #define YYFINAL 138 |
---|
90 | #define YYFLAG -32768 |
---|
91 | #define YYNTBASE 44 |
---|
92 | |
---|
93 | #define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 79) |
---|
94 | |
---|
95 | static const char yytranslate[] = { 0, |
---|
96 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
97 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
98 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
99 | 2, 2, 2, 2, 43, 2, 42, 2, 2, 40, |
---|
100 | 41, 2, 2, 38, 2, 2, 2, 2, 2, 2, |
---|
101 | 2, 2, 2, 2, 2, 2, 2, 2, 37, 2, |
---|
102 | 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
103 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
104 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
105 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
106 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
107 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
108 | 2, 2, 39, 2, 2, 2, 2, 2, 2, 2, |
---|
109 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
110 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
111 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
112 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
113 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
114 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
115 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
116 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
117 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
118 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
119 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
120 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
121 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, |
---|
122 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
---|
123 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, |
---|
124 | 27, 28, 29, 30, 31, 32, 33, 34, 35 |
---|
125 | }; |
---|
126 | |
---|
127 | #if YYDEBUG != 0 |
---|
128 | static const short yyprhs[] = { 0, |
---|
129 | 0, 5, 9, 14, 19, 23, 26, 28, 30, 33, |
---|
130 | 37, 40, 42, 44, 47, 51, 55, 59, 63, 67, |
---|
131 | 71, 75, 77, 80, 82, 86, 88, 91, 93, 96, |
---|
132 | 100, 103, 107, 112, 114, 118, 121, 125, 128, 132, |
---|
133 | 135, 139, 141, 145, 150, 153, 157, 159, 162, 164, |
---|
134 | 167, 170, 173, 178, 180, 182, 185, 189, 195, 202, |
---|
135 | 212, 217, 219, 223, 225, 229, 232, 235, 240, 245, |
---|
136 | 247, 250, 254, 259, 263, 265 |
---|
137 | }; |
---|
138 | |
---|
139 | static const short yyrhs[] = { 45, |
---|
140 | 56, 57, 77, 0, 45, 55, 77, 0, 45, 52, |
---|
141 | 55, 77, 0, 45, 55, 52, 77, 0, 46, 47, |
---|
142 | 48, 0, 47, 48, 0, 48, 0, 27, 0, 50, |
---|
143 | 37, 0, 47, 50, 37, 0, 49, 13, 0, 13, |
---|
144 | 0, 29, 0, 49, 29, 0, 25, 36, 24, 0, |
---|
145 | 25, 36, 26, 0, 25, 36, 51, 0, 25, 36, |
---|
146 | 34, 0, 25, 36, 35, 0, 26, 38, 26, 0, |
---|
147 | 14, 53, 54, 0, 58, 0, 53, 58, 0, 15, |
---|
148 | 0, 16, 56, 57, 0, 62, 0, 56, 62, 0, |
---|
149 | 17, 0, 59, 67, 0, 59, 67, 69, 0, 60, |
---|
150 | 39, 0, 60, 66, 39, 0, 61, 40, 75, 41, |
---|
151 | 0, 61, 0, 61, 40, 41, 0, 20, 25, 0, |
---|
152 | 22, 20, 25, 0, 63, 67, 0, 63, 67, 69, |
---|
153 | 0, 64, 39, 0, 64, 66, 39, 0, 65, 0, |
---|
154 | 65, 40, 41, 0, 65, 40, 76, 41, 0, 33, |
---|
155 | 25, 0, 22, 33, 25, 0, 24, 0, 68, 28, |
---|
156 | 0, 29, 0, 68, 29, 0, 68, 30, 0, 68, |
---|
157 | 72, 0, 70, 39, 71, 28, 0, 21, 0, 29, |
---|
158 | 0, 71, 29, 0, 42, 25, 37, 0, 42, 25, |
---|
159 | 40, 41, 37, 0, 42, 25, 40, 25, 41, 37, |
---|
160 | 0, 42, 25, 40, 73, 40, 74, 41, 41, 37, |
---|
161 | 0, 42, 25, 4, 32, 0, 25, 0, 73, 3, |
---|
162 | 25, 0, 25, 0, 74, 38, 25, 0, 33, 25, |
---|
163 | 0, 33, 43, 0, 75, 38, 33, 25, 0, 75, |
---|
164 | 38, 33, 43, 0, 33, 0, 33, 25, 0, 76, |
---|
165 | 38, 33, 0, 76, 38, 33, 25, 0, 18, 78, |
---|
166 | 19, 0, 29, 0, 78, 29, 0 |
---|
167 | }; |
---|
168 | |
---|
169 | #endif |
---|
170 | |
---|
171 | #if YYDEBUG != 0 |
---|
172 | static const short yyrline[] = { 0, |
---|
173 | 98, 103, 108, 113, 120, 127, 134, 142, 153, 154, |
---|
174 | 158, 164, 171, 181, 187, 225, 244, 262, 279, 312, |
---|
175 | 322, 324, 325, 328, 335, 337, 338, 341, 351, 358, |
---|
176 | 368, 371, 376, 380, 384, 390, 397, 406, 411, 419, |
---|
177 | 423, 429, 430, 431, 433, 439, 448, 457, 463, 468, |
---|
178 | 473, 478, 482, 488, 498, 506, 520, 547, 569, 591, |
---|
179 | 613, 637, 642, 651, 655, 660, 667, 673, 680, 688, |
---|
180 | 693, 701, 706, 716, 720, 726 |
---|
181 | }; |
---|
182 | #endif |
---|
183 | |
---|
184 | |
---|
185 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) |
---|
186 | |
---|
187 | static const char * const yytname[] = { "$","error","$undefined.","MCOLONCOLON", |
---|
188 | "MEQUAL","MMODULE_CMD","MVERSION_CMD","MINFO_CMD","MINFOFILE_CMD","MHELP_CMD", |
---|
189 | "MHELPFILE_CMD","MCXXSRC_CMD","MPROC_CMD","SECTEND","SECT2START","SECT2END", |
---|
190 | "SECT3START","SECT3END","SECT4START","SECT4END","PROCDECLTOK","EXAMPLETOK","STATICTOK", |
---|
191 | "VARNAMETOK","MSTRINGTOK","NAME","FILENAME","MCCODETOK","MCODETOK","CODEPART", |
---|
192 | "CMTPART","PROCCMD","ANYTOK","VARTYPETOK","NUMTOK","BOOLTOK","'='","';'","','", |
---|
193 | "'{'","'('","')'","'%'","'#'","goal","part1","initmod","sect1","sect1end","codeline2", |
---|
194 | "expr","files","sect2full","sect2","sect2end","sect3full","sect3","sect3end", |
---|
195 | "procdefsg","procdeclsg","procdeclsg2","procdecl1","procdef","procdecl","procdecl2", |
---|
196 | "funcdecl1","procdeclhelp","proccode","proccodeline","procdeclexample","examplestart", |
---|
197 | "examplecodeline","proccmd","identifier","arglist","sgtypelist","typelist","sect4", |
---|
198 | "codeline", NULL |
---|
199 | }; |
---|
200 | #endif |
---|
201 | |
---|
202 | static const short yyr1[] = { 0, |
---|
203 | 44, 44, 44, 44, 45, 45, 45, 46, 47, 47, |
---|
204 | 48, 48, 49, 49, 50, 50, 50, 50, 50, 51, |
---|
205 | 52, 53, 53, 54, 55, 56, 56, 57, 58, 58, |
---|
206 | 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, |
---|
207 | 63, 64, 64, 64, 65, 65, 66, 67, 68, 68, |
---|
208 | 68, 68, 69, 70, 71, 71, 72, 72, 72, 72, |
---|
209 | 72, 73, 73, 74, 74, 75, 75, 75, 75, 76, |
---|
210 | 76, 76, 76, 77, 78, 78 |
---|
211 | }; |
---|
212 | |
---|
213 | static const short yyr2[] = { 0, |
---|
214 | 4, 3, 4, 4, 3, 2, 1, 1, 2, 3, |
---|
215 | 2, 1, 1, 2, 3, 3, 3, 3, 3, 3, |
---|
216 | 3, 1, 2, 1, 3, 1, 2, 1, 2, 3, |
---|
217 | 2, 3, 4, 1, 3, 2, 3, 2, 3, 2, |
---|
218 | 3, 1, 3, 4, 2, 3, 1, 2, 1, 2, |
---|
219 | 2, 2, 4, 1, 1, 2, 3, 5, 6, 9, |
---|
220 | 4, 1, 3, 1, 3, 2, 2, 4, 4, 1, |
---|
221 | 2, 3, 4, 3, 1, 2 |
---|
222 | }; |
---|
223 | |
---|
224 | static const short yydefact[] = { 0, |
---|
225 | 12, 0, 8, 13, 0, 0, 0, 7, 0, 0, |
---|
226 | 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, |
---|
227 | 0, 42, 0, 6, 0, 11, 14, 9, 15, 16, |
---|
228 | 18, 19, 17, 0, 0, 0, 22, 0, 0, 34, |
---|
229 | 0, 0, 45, 0, 0, 0, 2, 28, 0, 27, |
---|
230 | 49, 38, 0, 47, 40, 0, 0, 5, 10, 0, |
---|
231 | 36, 0, 24, 21, 23, 29, 31, 0, 0, 25, |
---|
232 | 46, 3, 75, 0, 4, 1, 54, 39, 0, 48, |
---|
233 | 50, 51, 0, 52, 41, 70, 43, 0, 20, 37, |
---|
234 | 30, 32, 0, 35, 0, 74, 76, 0, 0, 71, |
---|
235 | 0, 44, 66, 67, 0, 33, 55, 0, 0, 57, |
---|
236 | 0, 72, 0, 53, 56, 61, 62, 0, 0, 73, |
---|
237 | 68, 69, 0, 58, 0, 0, 59, 63, 64, 0, |
---|
238 | 0, 0, 65, 0, 60, 0, 0, 0 |
---|
239 | }; |
---|
240 | |
---|
241 | static const short yydefgoto[] = { 136, |
---|
242 | 5, 6, 7, 8, 9, 10, 33, 16, 36, 64, |
---|
243 | 17, 18, 49, 37, 38, 39, 40, 19, 20, 21, |
---|
244 | 22, 56, 52, 53, 78, 79, 108, 84, 119, 130, |
---|
245 | 95, 88, 47, 74 |
---|
246 | }; |
---|
247 | |
---|
248 | static const short yypact[] = { -9, |
---|
249 | -32768, -15,-32768,-32768, -11, 8, 1,-32768, 0, 3, |
---|
250 | 26, 54, -14, 20, 33, 29, -8, -5,-32768, 34, |
---|
251 | 10, 35, 1,-32768, 42,-32768,-32768,-32768,-32768, 43, |
---|
252 | -32768,-32768,-32768, 55, 62, 44,-32768, 34, 12, 45, |
---|
253 | -5, 58,-32768, 66, 57, 66,-32768,-32768, 66,-32768, |
---|
254 | -32768, 67, 13,-32768,-32768, 48, 21,-32768,-32768, 63, |
---|
255 | -32768, 65,-32768,-32768,-32768, 67,-32768, 52, 24,-32768, |
---|
256 | -32768,-32768,-32768, 27,-32768,-32768,-32768,-32768, 53,-32768, |
---|
257 | -32768,-32768, 68,-32768,-32768, 69,-32768, 6,-32768,-32768, |
---|
258 | -32768,-32768, -18,-32768, 30,-32768,-32768, 70, -2,-32768, |
---|
259 | 64,-32768,-32768,-32768, 71,-32768,-32768, 49, 73,-32768, |
---|
260 | -10, 75, -16,-32768,-32768,-32768, 60, 59, -3,-32768, |
---|
261 | -32768,-32768, 61,-32768, 77, 78,-32768,-32768,-32768, 32, |
---|
262 | 81, 72,-32768, 74,-32768, 95, 107,-32768 |
---|
263 | }; |
---|
264 | |
---|
265 | static const short yypgoto[] = {-32768, |
---|
266 | -32768,-32768, 102, 16,-32768, 25,-32768, 92,-32768,-32768, |
---|
267 | 94, 99, 76, 79,-32768,-32768,-32768, -17,-32768,-32768, |
---|
268 | -32768, 80, 82,-32768, 50,-32768,-32768,-32768,-32768,-32768, |
---|
269 | -32768,-32768, 23,-32768 |
---|
270 | }; |
---|
271 | |
---|
272 | |
---|
273 | #define YYLAST 120 |
---|
274 | |
---|
275 | |
---|
276 | static const short yytable[] = { 125, |
---|
277 | 50, 109, 12, 1, 13, 12, 103, 14, 121, 45, |
---|
278 | 14, 48, 26, 1, 117, 2, 14, 3, 15, 4, |
---|
279 | 11, 15, 24, 50, 104, 2, 122, 15, 27, 4, |
---|
280 | 118, 25, 2, 54, 110, 54, 126, 111, 58, 28, |
---|
281 | 80, 81, 82, 101, 13, 96, 102, 25, 55, 29, |
---|
282 | 67, 30, 42, 86, 83, 97, 93, 43, 63, 31, |
---|
283 | 32, 87, 51, 34, 94, 35, 72, 105, 75, 131, |
---|
284 | 106, 76, 132, 34, 57, 35, 114, 115, 59, 61, |
---|
285 | 60, 62, 71, 45, 69, 73, 85, 77, 89, 90, |
---|
286 | 92, 98, 99, 100, 137, 124, 112, 127, 107, 120, |
---|
287 | 123, 128, 129, 113, 116, 133, 138, 23, 46, 44, |
---|
288 | 135, 41, 134, 0, 65, 91, 70, 0, 68, 66 |
---|
289 | }; |
---|
290 | |
---|
291 | static const short yycheck[] = { 3, |
---|
292 | 18, 4, 14, 13, 16, 14, 25, 22, 25, 18, |
---|
293 | 22, 17, 13, 13, 25, 25, 22, 27, 33, 29, |
---|
294 | 36, 33, 7, 41, 43, 25, 43, 33, 29, 29, |
---|
295 | 41, 7, 25, 24, 37, 24, 40, 40, 23, 37, |
---|
296 | 28, 29, 30, 38, 16, 19, 41, 23, 39, 24, |
---|
297 | 39, 26, 33, 33, 42, 29, 33, 25, 15, 34, |
---|
298 | 35, 41, 29, 20, 41, 22, 44, 38, 46, 38, |
---|
299 | 41, 49, 41, 20, 40, 22, 28, 29, 37, 25, |
---|
300 | 38, 20, 25, 18, 40, 29, 39, 21, 26, 25, |
---|
301 | 39, 39, 25, 25, 0, 37, 33, 37, 29, 25, |
---|
302 | 41, 25, 25, 33, 32, 25, 0, 6, 17, 16, |
---|
303 | 37, 13, 41, -1, 36, 66, 41, -1, 39, 38 |
---|
304 | }; |
---|
305 | #define YYPURE 1 |
---|
306 | |
---|
307 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ |
---|
308 | #line 3 "/usr/lib/bison.simple" |
---|
309 | /* This file comes from bison-1.28. */ |
---|
310 | |
---|
311 | /* Skeleton output parser for bison, |
---|
312 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. |
---|
313 | |
---|
314 | This program is free software; you can redistribute it and/or modify |
---|
315 | it under the terms of the GNU General Public License as published by |
---|
316 | the Free Software Foundation; either version 2, or (at your option) |
---|
317 | any later version. |
---|
318 | |
---|
319 | This program is distributed in the hope that it will be useful, |
---|
320 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
321 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
322 | GNU General Public License for more details. |
---|
323 | |
---|
324 | You should have received a copy of the GNU General Public License |
---|
325 | along with this program; if not, write to the Free Software |
---|
326 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
327 | Boston, MA 02111-1307, USA. */ |
---|
328 | |
---|
329 | /* As a special exception, when this file is copied by Bison into a |
---|
330 | Bison output file, you may use that output file without restriction. |
---|
331 | This special exception was added by the Free Software Foundation |
---|
332 | in version 1.24 of Bison. */ |
---|
333 | |
---|
334 | /* This is the parser code that is written into each bison parser |
---|
335 | when the %semantic_parser declaration is not specified in the grammar. |
---|
336 | It was written by Richard Stallman by simplifying the hairy parser |
---|
337 | used when %semantic_parser is specified. */ |
---|
338 | |
---|
339 | #ifndef YYSTACK_USE_ALLOCA |
---|
340 | #ifdef alloca |
---|
341 | #define YYSTACK_USE_ALLOCA |
---|
342 | #else /* alloca not defined */ |
---|
343 | #ifdef __GNUC__ |
---|
344 | #define YYSTACK_USE_ALLOCA |
---|
345 | #define alloca __builtin_alloca |
---|
346 | #else /* not GNU C. */ |
---|
347 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) |
---|
348 | #define YYSTACK_USE_ALLOCA |
---|
349 | #include <alloca.h> |
---|
350 | #else /* not sparc */ |
---|
351 | /* We think this test detects Watcom and Microsoft C. */ |
---|
352 | /* This used to test MSDOS, but that is a bad idea |
---|
353 | since that symbol is in the user namespace. */ |
---|
354 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) |
---|
355 | #if 0 /* No need for malloc.h, which pollutes the namespace; |
---|
356 | instead, just don't use alloca. */ |
---|
357 | #include <malloc.h> |
---|
358 | #endif |
---|
359 | #else /* not MSDOS, or __TURBOC__ */ |
---|
360 | #if defined(_AIX) |
---|
361 | /* I don't know what this was needed for, but it pollutes the namespace. |
---|
362 | So I turned it off. rms, 2 May 1997. */ |
---|
363 | /* #include <malloc.h> */ |
---|
364 | #pragma alloca |
---|
365 | #define YYSTACK_USE_ALLOCA |
---|
366 | #else /* not MSDOS, or __TURBOC__, or _AIX */ |
---|
367 | #if 0 |
---|
368 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, |
---|
369 | and on HPUX 10. Eventually we can turn this on. */ |
---|
370 | #define YYSTACK_USE_ALLOCA |
---|
371 | #define alloca __builtin_alloca |
---|
372 | #endif /* __hpux */ |
---|
373 | #endif |
---|
374 | #endif /* not _AIX */ |
---|
375 | #endif /* not MSDOS, or __TURBOC__ */ |
---|
376 | #endif /* not sparc */ |
---|
377 | #endif /* not GNU C */ |
---|
378 | #endif /* alloca not defined */ |
---|
379 | #endif /* YYSTACK_USE_ALLOCA not defined */ |
---|
380 | |
---|
381 | #ifdef YYSTACK_USE_ALLOCA |
---|
382 | #define YYSTACK_ALLOC alloca |
---|
383 | #else |
---|
384 | #define YYSTACK_ALLOC malloc |
---|
385 | #endif |
---|
386 | |
---|
387 | /* Note: there must be only one dollar sign in this file. |
---|
388 | It is replaced by the list of actions, each action |
---|
389 | as one case of the switch. */ |
---|
390 | |
---|
391 | #define yyerrok (yyerrstatus = 0) |
---|
392 | #define yyclearin (yychar = YYEMPTY) |
---|
393 | #define YYEMPTY -2 |
---|
394 | #define YYEOF 0 |
---|
395 | #define YYACCEPT goto yyacceptlab |
---|
396 | #define YYABORT goto yyabortlab |
---|
397 | #define YYERROR goto yyerrlab1 |
---|
398 | /* Like YYERROR except do call yyerror. |
---|
399 | This remains here temporarily to ease the |
---|
400 | transition to the new meaning of YYERROR, for GCC. |
---|
401 | Once GCC version 2 has supplanted version 1, this can go. */ |
---|
402 | #define YYFAIL goto yyerrlab |
---|
403 | #define YYRECOVERING() (!!yyerrstatus) |
---|
404 | #define YYBACKUP(token, value) \ |
---|
405 | do \ |
---|
406 | if (yychar == YYEMPTY && yylen == 1) \ |
---|
407 | { yychar = (token), yylval = (value); \ |
---|
408 | yychar1 = YYTRANSLATE (yychar); \ |
---|
409 | YYPOPSTACK; \ |
---|
410 | goto yybackup; \ |
---|
411 | } \ |
---|
412 | else \ |
---|
413 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ |
---|
414 | while (0) |
---|
415 | |
---|
416 | #define YYTERROR 1 |
---|
417 | #define YYERRCODE 256 |
---|
418 | |
---|
419 | #ifndef YYPURE |
---|
420 | #define YYLEX yylex() |
---|
421 | #endif |
---|
422 | |
---|
423 | #ifdef YYPURE |
---|
424 | #ifdef YYLSP_NEEDED |
---|
425 | #ifdef YYLEX_PARAM |
---|
426 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) |
---|
427 | #else |
---|
428 | #define YYLEX yylex(&yylval, &yylloc) |
---|
429 | #endif |
---|
430 | #else /* not YYLSP_NEEDED */ |
---|
431 | #ifdef YYLEX_PARAM |
---|
432 | #define YYLEX yylex(&yylval, YYLEX_PARAM) |
---|
433 | #else |
---|
434 | #define YYLEX yylex(&yylval) |
---|
435 | #endif |
---|
436 | #endif /* not YYLSP_NEEDED */ |
---|
437 | #endif |
---|
438 | |
---|
439 | /* If nonreentrant, generate the variables here */ |
---|
440 | |
---|
441 | #ifndef YYPURE |
---|
442 | |
---|
443 | VAR int yychar; /* the lookahead symbol */ |
---|
444 | VAR YYSTYPE yylval; /* the semantic value of the */ |
---|
445 | /* lookahead symbol */ |
---|
446 | |
---|
447 | #ifdef YYLSP_NEEDED |
---|
448 | VAR YYLTYPE yylloc; /* location data for the lookahead */ |
---|
449 | /* symbol */ |
---|
450 | #endif |
---|
451 | |
---|
452 | VAR int yynerrs; /* number of parse errors so far */ |
---|
453 | #endif /* not YYPURE */ |
---|
454 | |
---|
455 | #if YYDEBUG != 0 |
---|
456 | VAR int yydebug; /* nonzero means print parse trace */ |
---|
457 | /* Since this is uninitialized, it does not stop multiple parsers |
---|
458 | from coexisting. */ |
---|
459 | #endif |
---|
460 | |
---|
461 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ |
---|
462 | |
---|
463 | #ifndef YYINITDEPTH |
---|
464 | #define YYINITDEPTH 200 |
---|
465 | #endif |
---|
466 | |
---|
467 | /* YYMAXDEPTH is the maximum size the stacks can grow to |
---|
468 | (effective only if the built-in stack extension method is used). */ |
---|
469 | |
---|
470 | #if YYMAXDEPTH == 0 |
---|
471 | #undef YYMAXDEPTH |
---|
472 | #endif |
---|
473 | |
---|
474 | #ifndef YYMAXDEPTH |
---|
475 | #define YYMAXDEPTH 10000 |
---|
476 | #endif |
---|
477 | |
---|
478 | /* Define __yy_memcpy. Note that the size argument |
---|
479 | should be passed with type unsigned int, because that is what the non-GCC |
---|
480 | definitions require. With GCC, __builtin_memcpy takes an arg |
---|
481 | of type size_t, but it can handle unsigned int. */ |
---|
482 | |
---|
483 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
---|
484 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) |
---|
485 | #else /* not GNU C or C++ */ |
---|
486 | #ifndef __cplusplus |
---|
487 | |
---|
488 | /* This is the most reliable way to avoid incompatibilities |
---|
489 | in available built-in functions on various systems. */ |
---|
490 | static void |
---|
491 | __yy_memcpy (to, from, count) |
---|
492 | char *to; |
---|
493 | VAR char *from; |
---|
494 | VAR unsigned int count; |
---|
495 | { |
---|
496 | register char *f = from; |
---|
497 | register char *t = to; |
---|
498 | register int i = count; |
---|
499 | |
---|
500 | while (i-- > 0) |
---|
501 | *t++ = *f++; |
---|
502 | } |
---|
503 | |
---|
504 | #else /* __cplusplus */ |
---|
505 | |
---|
506 | /* This is the most reliable way to avoid incompatibilities |
---|
507 | in available built-in functions on various systems. */ |
---|
508 | static void |
---|
509 | __yy_memcpy (char *to, char *from, unsigned int count) |
---|
510 | { |
---|
511 | register char *t = to; |
---|
512 | register char *f = from; |
---|
513 | register int i = count; |
---|
514 | |
---|
515 | while (i-- > 0) |
---|
516 | *t++ = *f++; |
---|
517 | } |
---|
518 | |
---|
519 | #endif |
---|
520 | #endif |
---|
521 | |
---|
522 | #line 217 "/usr/lib/bison.simple" |
---|
523 | |
---|
524 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed |
---|
525 | into yyparse. The argument should have type void *. |
---|
526 | It should actually point to an object. |
---|
527 | Grammar actions can access the variable by casting it |
---|
528 | to the proper pointer type. */ |
---|
529 | |
---|
530 | #ifdef YYPARSE_PARAM |
---|
531 | #ifdef __cplusplus |
---|
532 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
---|
533 | #define YYPARSE_PARAM_DECL |
---|
534 | #else /* not __cplusplus */ |
---|
535 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM |
---|
536 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
---|
537 | #endif /* not __cplusplus */ |
---|
538 | #else /* not YYPARSE_PARAM */ |
---|
539 | #define YYPARSE_PARAM_ARG |
---|
540 | #define YYPARSE_PARAM_DECL |
---|
541 | #endif /* not YYPARSE_PARAM */ |
---|
542 | |
---|
543 | /* Prevent warning if -Wstrict-prototypes. */ |
---|
544 | #ifdef __GNUC__ |
---|
545 | #ifdef YYPARSE_PARAM |
---|
546 | int yyparse (void *); |
---|
547 | #else |
---|
548 | int yyparse (void); |
---|
549 | #endif |
---|
550 | #endif |
---|
551 | |
---|
552 | int |
---|
553 | yyparse(YYPARSE_PARAM_ARG) |
---|
554 | YYPARSE_PARAM_DECL |
---|
555 | { |
---|
556 | register int yystate; |
---|
557 | register int yyn; |
---|
558 | register short *yyssp; |
---|
559 | register YYSTYPE *yyvsp; |
---|
560 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ |
---|
561 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ |
---|
562 | |
---|
563 | short yyssa[YYINITDEPTH]; /* the state stack */ |
---|
564 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ |
---|
565 | |
---|
566 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ |
---|
567 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ |
---|
568 | |
---|
569 | #ifdef YYLSP_NEEDED |
---|
570 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ |
---|
571 | YYLTYPE *yyls = yylsa; |
---|
572 | YYLTYPE *yylsp; |
---|
573 | |
---|
574 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
---|
575 | #else |
---|
576 | #define YYPOPSTACK (yyvsp--, yyssp--) |
---|
577 | #endif |
---|
578 | |
---|
579 | int yystacksize = YYINITDEPTH; |
---|
580 | int yyfree_stacks = 0; |
---|
581 | |
---|
582 | #ifdef YYPURE |
---|
583 | int yychar; |
---|
584 | YYSTYPE yylval; |
---|
585 | int yynerrs; |
---|
586 | #ifdef YYLSP_NEEDED |
---|
587 | YYLTYPE yylloc; |
---|
588 | #endif |
---|
589 | #endif |
---|
590 | |
---|
591 | YYSTYPE yyval; /* the variable used to return */ |
---|
592 | /* semantic values from the action */ |
---|
593 | /* routines */ |
---|
594 | |
---|
595 | int yylen; |
---|
596 | |
---|
597 | #if YYDEBUG != 0 |
---|
598 | if (yydebug) |
---|
599 | fprintf(stderr, "Starting parse\n"); |
---|
600 | #endif |
---|
601 | |
---|
602 | yystate = 0; |
---|
603 | yyerrstatus = 0; |
---|
604 | yynerrs = 0; |
---|
605 | yychar = YYEMPTY; /* Cause a token to be read. */ |
---|
606 | |
---|
607 | /* Initialize stack pointers. |
---|
608 | Waste one element of value and location stack |
---|
609 | so that they stay on the same level as the state stack. |
---|
610 | The wasted elements are never initialized. */ |
---|
611 | |
---|
612 | yyssp = yyss - 1; |
---|
613 | yyvsp = yyvs; |
---|
614 | #ifdef YYLSP_NEEDED |
---|
615 | yylsp = yyls; |
---|
616 | #endif |
---|
617 | |
---|
618 | /* Push a new state, which is found in yystate . */ |
---|
619 | /* In all cases, when you get here, the value and location stacks |
---|
620 | have just been pushed. so pushing a state here evens the stacks. */ |
---|
621 | yynewstate: |
---|
622 | |
---|
623 | *++yyssp = yystate; |
---|
624 | |
---|
625 | if (yyssp >= yyss + yystacksize - 1) |
---|
626 | { |
---|
627 | /* Give user a chance to reallocate the stack */ |
---|
628 | /* Use copies of these so that the &'s don't force the real ones into memory. */ |
---|
629 | YYSTYPE *yyvs1 = yyvs; |
---|
630 | short *yyss1 = yyss; |
---|
631 | #ifdef YYLSP_NEEDED |
---|
632 | YYLTYPE *yyls1 = yyls; |
---|
633 | #endif |
---|
634 | |
---|
635 | /* Get the current used size of the three stacks, in elements. */ |
---|
636 | int size = yyssp - yyss + 1; |
---|
637 | |
---|
638 | #ifdef yyoverflow |
---|
639 | /* Each stack pointer address is followed by the size of |
---|
640 | the data in use in that stack, in bytes. */ |
---|
641 | #ifdef YYLSP_NEEDED |
---|
642 | /* This used to be a conditional around just the two extra args, |
---|
643 | but that might be undefined if yyoverflow is a macro. */ |
---|
644 | yyoverflow("parser stack overflow", |
---|
645 | &yyss1, size * sizeof (*yyssp), |
---|
646 | &yyvs1, size * sizeof (*yyvsp), |
---|
647 | &yyls1, size * sizeof (*yylsp), |
---|
648 | &yystacksize); |
---|
649 | #else |
---|
650 | yyoverflow("parser stack overflow", |
---|
651 | &yyss1, size * sizeof (*yyssp), |
---|
652 | &yyvs1, size * sizeof (*yyvsp), |
---|
653 | &yystacksize); |
---|
654 | #endif |
---|
655 | |
---|
656 | yyss = yyss1; yyvs = yyvs1; |
---|
657 | #ifdef YYLSP_NEEDED |
---|
658 | yyls = yyls1; |
---|
659 | #endif |
---|
660 | #else /* no yyoverflow */ |
---|
661 | /* Extend the stack our own way. */ |
---|
662 | if (yystacksize >= YYMAXDEPTH) |
---|
663 | { |
---|
664 | yyerror("parser stack overflow"); |
---|
665 | if (yyfree_stacks) |
---|
666 | { |
---|
667 | free (yyss); |
---|
668 | free (yyvs); |
---|
669 | #ifdef YYLSP_NEEDED |
---|
670 | free (yyls); |
---|
671 | #endif |
---|
672 | } |
---|
673 | return 2; |
---|
674 | } |
---|
675 | yystacksize *= 2; |
---|
676 | if (yystacksize > YYMAXDEPTH) |
---|
677 | yystacksize = YYMAXDEPTH; |
---|
678 | #ifndef YYSTACK_USE_ALLOCA |
---|
679 | yyfree_stacks = 1; |
---|
680 | #endif |
---|
681 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); |
---|
682 | __yy_memcpy ((char *)yyss, (char *)yyss1, |
---|
683 | size * (unsigned int) sizeof (*yyssp)); |
---|
684 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); |
---|
685 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, |
---|
686 | size * (unsigned int) sizeof (*yyvsp)); |
---|
687 | #ifdef YYLSP_NEEDED |
---|
688 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); |
---|
689 | __yy_memcpy ((char *)yyls, (char *)yyls1, |
---|
690 | size * (unsigned int) sizeof (*yylsp)); |
---|
691 | #endif |
---|
692 | #endif /* no yyoverflow */ |
---|
693 | |
---|
694 | yyssp = yyss + size - 1; |
---|
695 | yyvsp = yyvs + size - 1; |
---|
696 | #ifdef YYLSP_NEEDED |
---|
697 | yylsp = yyls + size - 1; |
---|
698 | #endif |
---|
699 | |
---|
700 | #if YYDEBUG != 0 |
---|
701 | if (yydebug) |
---|
702 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); |
---|
703 | #endif |
---|
704 | |
---|
705 | if (yyssp >= yyss + yystacksize - 1) |
---|
706 | YYABORT; |
---|
707 | } |
---|
708 | |
---|
709 | #if YYDEBUG != 0 |
---|
710 | if (yydebug) |
---|
711 | fprintf(stderr, "Entering state %d\n", yystate); |
---|
712 | #endif |
---|
713 | |
---|
714 | goto yybackup; |
---|
715 | yybackup: |
---|
716 | |
---|
717 | /* Do appropriate processing given the current state. */ |
---|
718 | /* Read a lookahead token if we need one and don't already have one. */ |
---|
719 | /* yyresume: */ |
---|
720 | |
---|
721 | /* First try to decide what to do without reference to lookahead token. */ |
---|
722 | |
---|
723 | yyn = yypact[yystate]; |
---|
724 | if (yyn == YYFLAG) |
---|
725 | goto yydefault; |
---|
726 | |
---|
727 | /* Not known => get a lookahead token if don't already have one. */ |
---|
728 | |
---|
729 | /* yychar is either YYEMPTY or YYEOF |
---|
730 | or a valid token in external form. */ |
---|
731 | |
---|
732 | if (yychar == YYEMPTY) |
---|
733 | { |
---|
734 | #if YYDEBUG != 0 |
---|
735 | if (yydebug) |
---|
736 | fprintf(stderr, "Reading a token: "); |
---|
737 | #endif |
---|
738 | yychar = YYLEX; |
---|
739 | } |
---|
740 | |
---|
741 | /* Convert token to internal form (in yychar1) for indexing tables with */ |
---|
742 | |
---|
743 | if (yychar <= 0) /* This means end of input. */ |
---|
744 | { |
---|
745 | yychar1 = 0; |
---|
746 | yychar = YYEOF; /* Don't call YYLEX any more */ |
---|
747 | |
---|
748 | #if YYDEBUG != 0 |
---|
749 | if (yydebug) |
---|
750 | fprintf(stderr, "Now at end of input.\n"); |
---|
751 | #endif |
---|
752 | } |
---|
753 | else |
---|
754 | { |
---|
755 | yychar1 = YYTRANSLATE(yychar); |
---|
756 | |
---|
757 | #if YYDEBUG != 0 |
---|
758 | if (yydebug) |
---|
759 | { |
---|
760 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); |
---|
761 | /* Give the individual parser a way to print the precise meaning |
---|
762 | of a token, for further debugging info. */ |
---|
763 | #ifdef YYPRINT |
---|
764 | YYPRINT (stderr, yychar, yylval); |
---|
765 | #endif |
---|
766 | fprintf (stderr, ")\n"); |
---|
767 | } |
---|
768 | #endif |
---|
769 | } |
---|
770 | |
---|
771 | yyn += yychar1; |
---|
772 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) |
---|
773 | goto yydefault; |
---|
774 | |
---|
775 | yyn = yytable[yyn]; |
---|
776 | |
---|
777 | /* yyn is what to do for this token type in this state. |
---|
778 | Negative => reduce, -yyn is rule number. |
---|
779 | Positive => shift, yyn is new state. |
---|
780 | New state is final state => don't bother to shift, |
---|
781 | just return success. |
---|
782 | 0, or most negative number => error. */ |
---|
783 | |
---|
784 | if (yyn < 0) |
---|
785 | { |
---|
786 | if (yyn == YYFLAG) |
---|
787 | goto yyerrlab; |
---|
788 | yyn = -yyn; |
---|
789 | goto yyreduce; |
---|
790 | } |
---|
791 | else if (yyn == 0) |
---|
792 | goto yyerrlab; |
---|
793 | |
---|
794 | if (yyn == YYFINAL) |
---|
795 | YYACCEPT; |
---|
796 | |
---|
797 | /* Shift the lookahead token. */ |
---|
798 | |
---|
799 | #if YYDEBUG != 0 |
---|
800 | if (yydebug) |
---|
801 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); |
---|
802 | #endif |
---|
803 | |
---|
804 | /* Discard the token being shifted unless it is eof. */ |
---|
805 | if (yychar != YYEOF) |
---|
806 | yychar = YYEMPTY; |
---|
807 | |
---|
808 | *++yyvsp = yylval; |
---|
809 | #ifdef YYLSP_NEEDED |
---|
810 | *++yylsp = yylloc; |
---|
811 | #endif |
---|
812 | |
---|
813 | /* count tokens shifted since error; after three, turn off error status. */ |
---|
814 | if (yyerrstatus) yyerrstatus--; |
---|
815 | |
---|
816 | yystate = yyn; |
---|
817 | goto yynewstate; |
---|
818 | |
---|
819 | /* Do the default action for the current state. */ |
---|
820 | yydefault: |
---|
821 | |
---|
822 | yyn = yydefact[yystate]; |
---|
823 | if (yyn == 0) |
---|
824 | goto yyerrlab; |
---|
825 | |
---|
826 | /* Do a reduction. yyn is the number of a rule to reduce with. */ |
---|
827 | yyreduce: |
---|
828 | yylen = yyr2[yyn]; |
---|
829 | if (yylen > 0) |
---|
830 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ |
---|
831 | |
---|
832 | #if YYDEBUG != 0 |
---|
833 | if (yydebug) |
---|
834 | { |
---|
835 | int i; |
---|
836 | |
---|
837 | fprintf (stderr, "Reducing via rule %d (line %d), ", |
---|
838 | yyn, yyrline[yyn]); |
---|
839 | |
---|
840 | /* Print the symbols being reduced, and their result. */ |
---|
841 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) |
---|
842 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); |
---|
843 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
---|
844 | } |
---|
845 | #endif |
---|
846 | |
---|
847 | |
---|
848 | switch (yyn) { |
---|
849 | |
---|
850 | case 1: |
---|
851 | #line 99 "mod_grammar.y" |
---|
852 | { |
---|
853 | if(trace)printf("Finish modules 1\n"); |
---|
854 | return 0; |
---|
855 | ; |
---|
856 | break;} |
---|
857 | case 2: |
---|
858 | #line 104 "mod_grammar.y" |
---|
859 | { |
---|
860 | if(trace)printf("Finish modules 2\n"); |
---|
861 | return 0; |
---|
862 | ; |
---|
863 | break;} |
---|
864 | case 3: |
---|
865 | #line 109 "mod_grammar.y" |
---|
866 | { |
---|
867 | if(trace)printf("Finish modules 3\n"); |
---|
868 | return 0; |
---|
869 | ; |
---|
870 | break;} |
---|
871 | case 4: |
---|
872 | #line 114 "mod_grammar.y" |
---|
873 | { |
---|
874 | if(trace)printf("Finish modules 4\n"); |
---|
875 | return 0; |
---|
876 | ; |
---|
877 | break;} |
---|
878 | case 5: |
---|
879 | #line 121 "mod_grammar.y" |
---|
880 | { |
---|
881 | if(do_create_makefile)mod_create_makefile(&module_def); |
---|
882 | if(write_intro(&module_def)) { |
---|
883 | return(myyyerror("Error while creating files\n")); |
---|
884 | } |
---|
885 | ; |
---|
886 | break;} |
---|
887 | case 6: |
---|
888 | #line 128 "mod_grammar.y" |
---|
889 | { |
---|
890 | if(do_create_makefile)mod_create_makefile(&module_def); |
---|
891 | if(write_intro(&module_def)) { |
---|
892 | return(myyyerror("Error while creating files\n")); |
---|
893 | } |
---|
894 | ; |
---|
895 | break;} |
---|
896 | case 7: |
---|
897 | #line 135 "mod_grammar.y" |
---|
898 | { |
---|
899 | if(do_create_makefile)mod_create_makefile(&module_def); |
---|
900 | if(write_intro(&module_def)) { |
---|
901 | return(myyyerror("Error while creating files\n")); |
---|
902 | } |
---|
903 | ; |
---|
904 | break;} |
---|
905 | case 8: |
---|
906 | #line 144 "mod_grammar.y" |
---|
907 | { |
---|
908 | fprintf(module_def.fmtfp, "%s", yyvsp[0].name); |
---|
909 | fprintf(module_def.fmtfp, "#line %d \"%s\"\n", |
---|
910 | yylineno, module_def.filename); |
---|
911 | free(yyvsp[0].name); |
---|
912 | write_mod_init(&module_def, module_def.fmtfp); |
---|
913 | initdone = 1; |
---|
914 | ; |
---|
915 | break;} |
---|
916 | case 11: |
---|
917 | #line 160 "mod_grammar.y" |
---|
918 | { |
---|
919 | memset(&procedure_decl, 0, sizeof(procdef)); |
---|
920 | if(debug>2)printf("End of section 1 (new=%d)\n", sectnum); |
---|
921 | ; |
---|
922 | break;} |
---|
923 | case 12: |
---|
924 | #line 165 "mod_grammar.y" |
---|
925 | { |
---|
926 | memset(&procedure_decl, 0, sizeof(procdef)); |
---|
927 | if(debug>2)printf("End of section 1 (new=%d)\n", sectnum); |
---|
928 | ; |
---|
929 | break;} |
---|
930 | case 13: |
---|
931 | #line 172 "mod_grammar.y" |
---|
932 | { |
---|
933 | if(initdone == 0) { |
---|
934 | write_mod_init(&module_def, module_def.fmtfp); |
---|
935 | initdone = 1; |
---|
936 | } |
---|
937 | fprintf(module_def.fmtfp, "#line %d \"%s\"\n", |
---|
938 | yylineno, module_def.filename); |
---|
939 | fprintf(module_def.fmtfp, "%s", yyvsp[0].name); |
---|
940 | ; |
---|
941 | break;} |
---|
942 | case 14: |
---|
943 | #line 182 "mod_grammar.y" |
---|
944 | { |
---|
945 | fprintf(module_def.fmtfp, "%s", yyvsp[0].name); |
---|
946 | ; |
---|
947 | break;} |
---|
948 | case 15: |
---|
949 | #line 188 "mod_grammar.y" |
---|
950 | { |
---|
951 | var_token vt; |
---|
952 | int rc = 0; |
---|
953 | void (*write_cmd)(moddefv module, var_token type, |
---|
954 | idtyp t, void *arg1, void *arg2); |
---|
955 | |
---|
956 | switch(sectnum) { |
---|
957 | case 1: /* pass 1: */ |
---|
958 | if( (vt=checkvar(yyvsp[-2].name, VAR_STRING, &write_cmd)) ) { |
---|
959 | if(write_cmd!=0) |
---|
960 | write_cmd(&module_def, vt, STRING_CMD, yyvsp[-2].name, yyvsp[0].sv.string); |
---|
961 | if(vt==VAR_VERSION) |
---|
962 | make_version(yyvsp[0].sv.string, &module_def); |
---|
963 | if(vt==VAR_MODULE) |
---|
964 | make_module_name(yyvsp[0].sv.string, &module_def); |
---|
965 | } |
---|
966 | else { |
---|
967 | rc=myyyerror("Line %d: Unknown variable '%s' in section %d\n", |
---|
968 | yylineno, yyvsp[-2].name, sectnum); |
---|
969 | } |
---|
970 | break; |
---|
971 | case 3: /* pass 3: procedure declaration */ |
---|
972 | if( (vt=checkvar(yyvsp[-2].name, VAR_STRING, &write_cmd)) ) { |
---|
973 | proc_set_var(&procedure_decl, VAR_STRING, vt, yyvsp[-2].name, yyvsp[0].sv.string); |
---|
974 | } |
---|
975 | else { |
---|
976 | rc=myyyerror("Line %d: Unknown variable '%s' in section %d\n", |
---|
977 | yylineno, yyvsp[-2].name, sectnum); |
---|
978 | } |
---|
979 | break; |
---|
980 | default: break; |
---|
981 | |
---|
982 | } |
---|
983 | free(yyvsp[-2].name); |
---|
984 | free(yyvsp[0].sv.string); |
---|
985 | if(rc)return(rc); |
---|
986 | ; |
---|
987 | break;} |
---|
988 | case 16: |
---|
989 | #line 226 "mod_grammar.y" |
---|
990 | { var_token vt; |
---|
991 | void (*write_cmd)(moddefv module, var_token type, |
---|
992 | idtyp t, void *arg1, void *arg2); |
---|
993 | switch(sectnum) { |
---|
994 | case 1: /* pass 1: */ |
---|
995 | Add2files(&module_def, yyvsp[0].name); |
---|
996 | break; |
---|
997 | case 3: /* pass 3: procedure declaration */ |
---|
998 | if( (vt=checkvar(yyvsp[-2].name, VAR_FILE, &write_cmd)) ) { |
---|
999 | proc_set_var(&procedure_decl, VAR_FILE, vt, yyvsp[-2].name, yyvsp[0].name); |
---|
1000 | } |
---|
1001 | break; |
---|
1002 | default: break; |
---|
1003 | |
---|
1004 | } |
---|
1005 | free(yyvsp[-2].name); |
---|
1006 | free(yyvsp[0].name); |
---|
1007 | ; |
---|
1008 | break;} |
---|
1009 | case 17: |
---|
1010 | #line 245 "mod_grammar.y" |
---|
1011 | { var_token vt; |
---|
1012 | void (*write_cmd)(moddefv module, var_token type, |
---|
1013 | idtyp t, void *arg1, void *arg2); |
---|
1014 | switch(sectnum) { |
---|
1015 | case 1: /* pass 1: */ |
---|
1016 | break; |
---|
1017 | case 3: /* pass 3: procedure declaration */ |
---|
1018 | if( (vt=checkvar(yyvsp[-2].name, VAR_FILES, &write_cmd)) ) { |
---|
1019 | proc_set_var(&procedure_decl, VAR_FILES, vt, yyvsp[-2].name, &yyvsp[0]); |
---|
1020 | } |
---|
1021 | break; |
---|
1022 | default: break; |
---|
1023 | |
---|
1024 | } |
---|
1025 | free(yyvsp[-2].name); |
---|
1026 | //free($3); |
---|
1027 | ; |
---|
1028 | break;} |
---|
1029 | case 18: |
---|
1030 | #line 263 "mod_grammar.y" |
---|
1031 | { var_token vt; |
---|
1032 | void (*write_cmd)(moddefv module, var_token type, |
---|
1033 | idtyp t, void *arg1, void *arg2); |
---|
1034 | switch(sectnum) { |
---|
1035 | case 1: /* pass 1: */ |
---|
1036 | break; |
---|
1037 | case 3: /* pass 3: procedure declaration */ |
---|
1038 | if( (vt=checkvar(yyvsp[-2].name, VAR_NUM, &write_cmd)) ) { |
---|
1039 | proc_set_var(&procedure_decl, VAR_NUM, vt, yyvsp[-2].name, &yyvsp[0].i); |
---|
1040 | } |
---|
1041 | break; |
---|
1042 | default: break; |
---|
1043 | |
---|
1044 | } |
---|
1045 | free(yyvsp[-2].name); |
---|
1046 | ; |
---|
1047 | break;} |
---|
1048 | case 19: |
---|
1049 | #line 280 "mod_grammar.y" |
---|
1050 | { |
---|
1051 | var_token vt; |
---|
1052 | int rc = 0; |
---|
1053 | void (*write_cmd)(moddefv module, var_token type, |
---|
1054 | idtyp t, void *arg1, void *arg2); |
---|
1055 | switch(sectnum) { |
---|
1056 | case 1: /* pass 1: */ |
---|
1057 | if( (vt=checkvar(yyvsp[-2].name, VAR_BOOL, &write_cmd)) ) { |
---|
1058 | proc_set_default_var(VAR_BOOL, vt, yyvsp[-2].name, &yyvsp[0].i); |
---|
1059 | } |
---|
1060 | else { |
---|
1061 | rc=myyyerror("Line %d: Unknown variable '%s' in section %d\n", |
---|
1062 | yylineno, yyvsp[-2].name, sectnum); |
---|
1063 | } |
---|
1064 | break; |
---|
1065 | case 3: /* pass 3: procedure declaration */ |
---|
1066 | if( (vt=checkvar(yyvsp[-2].name, VAR_BOOL, &write_cmd)) ) { |
---|
1067 | proc_set_var(&procedure_decl, VAR_BOOL, vt, yyvsp[-2].name, &yyvsp[0].i); |
---|
1068 | } |
---|
1069 | else { |
---|
1070 | rc=myyyerror("Line %d: Unknown variable '%s' in section %d\n", |
---|
1071 | yylineno, yyvsp[-2].name, sectnum); |
---|
1072 | } |
---|
1073 | break; |
---|
1074 | default: break; |
---|
1075 | |
---|
1076 | } |
---|
1077 | free(yyvsp[-2].name); |
---|
1078 | if(rc)return(rc); |
---|
1079 | ; |
---|
1080 | break;} |
---|
1081 | case 20: |
---|
1082 | #line 313 "mod_grammar.y" |
---|
1083 | { |
---|
1084 | if(debug>2)printf(">>>>>>>>files '%s' , '%s'\n", yyvsp[-2].name, yyvsp[0].name); |
---|
1085 | Add2files(&module_def, yyvsp[-2].name); |
---|
1086 | Add2files(&module_def, yyvsp[0].name); |
---|
1087 | free(yyvsp[-2].name); |
---|
1088 | free(yyvsp[0].name); |
---|
1089 | ; |
---|
1090 | break;} |
---|
1091 | case 24: |
---|
1092 | #line 329 "mod_grammar.y" |
---|
1093 | { |
---|
1094 | if(debug>2)printf("End of section 'Singular' 2 (%d)\n", |
---|
1095 | sectnum); |
---|
1096 | ; |
---|
1097 | break;} |
---|
1098 | case 28: |
---|
1099 | #line 342 "mod_grammar.y" |
---|
1100 | { |
---|
1101 | write_finish_functions(&module_def, &procedure_decl); |
---|
1102 | if(debug>2)printf("End of section 'procedures' 3 (%d)\n", |
---|
1103 | sectnum); |
---|
1104 | ; |
---|
1105 | break;} |
---|
1106 | case 29: |
---|
1107 | #line 352 "mod_grammar.y" |
---|
1108 | { |
---|
1109 | if(debug>2)printf("SG-PROCDEF:\n"); |
---|
1110 | write_singular_end(&module_def, &procedure_decl, yylineno); |
---|
1111 | setup_proc(&module_def, &procedure_decl); |
---|
1112 | write_helpfile_help(&module_def, &procedure_decl); |
---|
1113 | ; |
---|
1114 | break;} |
---|
1115 | case 30: |
---|
1116 | #line 359 "mod_grammar.y" |
---|
1117 | { |
---|
1118 | if(debug>2)printf("SG-PROCDEF mit example:\n"); |
---|
1119 | fflush(module_def.fmtfp); |
---|
1120 | write_singular_end(&module_def, &procedure_decl, yylineno); |
---|
1121 | setup_proc(&module_def, &procedure_decl); |
---|
1122 | write_helpfile_help(&module_def, &procedure_decl); |
---|
1123 | ; |
---|
1124 | break;} |
---|
1125 | case 31: |
---|
1126 | #line 369 "mod_grammar.y" |
---|
1127 | { |
---|
1128 | ; |
---|
1129 | break;} |
---|
1130 | case 32: |
---|
1131 | #line 372 "mod_grammar.y" |
---|
1132 | { |
---|
1133 | ; |
---|
1134 | break;} |
---|
1135 | case 33: |
---|
1136 | #line 377 "mod_grammar.y" |
---|
1137 | { |
---|
1138 | procedure_decl.lineno_other = yylineno; |
---|
1139 | ; |
---|
1140 | break;} |
---|
1141 | case 34: |
---|
1142 | #line 381 "mod_grammar.y" |
---|
1143 | { |
---|
1144 | procedure_decl.lineno_other = yylineno; |
---|
1145 | ; |
---|
1146 | break;} |
---|
1147 | case 35: |
---|
1148 | #line 385 "mod_grammar.y" |
---|
1149 | { |
---|
1150 | procedure_decl.lineno_other = yylineno; |
---|
1151 | ; |
---|
1152 | break;} |
---|
1153 | case 36: |
---|
1154 | #line 391 "mod_grammar.y" |
---|
1155 | { |
---|
1156 | init_proc(&procedure_decl, yyvsp[0].name, NULL, yylineno, LANG_SINGULAR); |
---|
1157 | free(yyvsp[0].name); |
---|
1158 | if(write_singular_procedures(&module_def, &procedure_decl)) |
---|
1159 | return(myyyerror("Error while creating bin-file\n")); |
---|
1160 | ; |
---|
1161 | break;} |
---|
1162 | case 37: |
---|
1163 | #line 398 "mod_grammar.y" |
---|
1164 | { |
---|
1165 | init_proc(&procedure_decl, yyvsp[0].name, NULL, yylineno, LANG_SINGULAR); |
---|
1166 | procedure_decl.is_static = TRUE; |
---|
1167 | free(yyvsp[0].name); |
---|
1168 | if(write_singular_procedures(&module_def, &procedure_decl)) |
---|
1169 | return(myyyerror("Error while creating bin-file\n")); |
---|
1170 | ; |
---|
1171 | break;} |
---|
1172 | case 38: |
---|
1173 | #line 407 "mod_grammar.y" |
---|
1174 | { |
---|
1175 | if(debug>2)printf("PROCDEF:\n"); |
---|
1176 | write_helpfile_help(&module_def, &procedure_decl); |
---|
1177 | ; |
---|
1178 | break;} |
---|
1179 | case 39: |
---|
1180 | #line 412 "mod_grammar.y" |
---|
1181 | { |
---|
1182 | if(debug>2)printf("PROCDEF mit example:\n"); |
---|
1183 | write_helpfile_help(&module_def, &procedure_decl); |
---|
1184 | fflush(module_def.fmtfp); |
---|
1185 | ; |
---|
1186 | break;} |
---|
1187 | case 40: |
---|
1188 | #line 420 "mod_grammar.y" |
---|
1189 | { |
---|
1190 | setup_proc(&module_def, &procedure_decl); |
---|
1191 | ; |
---|
1192 | break;} |
---|
1193 | case 41: |
---|
1194 | #line 424 "mod_grammar.y" |
---|
1195 | { |
---|
1196 | setup_proc(&module_def, &procedure_decl); |
---|
1197 | ; |
---|
1198 | break;} |
---|
1199 | case 45: |
---|
1200 | #line 434 "mod_grammar.y" |
---|
1201 | { |
---|
1202 | if(debug>2)printf("funcdecl1-2\n"); |
---|
1203 | init_proc(&procedure_decl, yyvsp[0].name, &yyvsp[-1].tp, yylineno); |
---|
1204 | free(yyvsp[0].name); |
---|
1205 | ; |
---|
1206 | break;} |
---|
1207 | case 46: |
---|
1208 | #line 440 "mod_grammar.y" |
---|
1209 | { |
---|
1210 | if(debug>2)printf("funcdecl1-4\n"); |
---|
1211 | init_proc(&procedure_decl, yyvsp[0].name, &yyvsp[-1].tp, yylineno); |
---|
1212 | free(yyvsp[0].name); |
---|
1213 | procedure_decl.is_static = TRUE; |
---|
1214 | ; |
---|
1215 | break;} |
---|
1216 | case 47: |
---|
1217 | #line 449 "mod_grammar.y" |
---|
1218 | { |
---|
1219 | procedure_decl.help_string = yyvsp[0].sv.string; |
---|
1220 | procedure_decl.lineno_other = yyvsp[0].sv.lineno; |
---|
1221 | if(debug>2)printf("\t\thelp at %d\n", yylineno); |
---|
1222 | write_help(&module_def, &procedure_decl); |
---|
1223 | ; |
---|
1224 | break;} |
---|
1225 | case 48: |
---|
1226 | #line 458 "mod_grammar.y" |
---|
1227 | { |
---|
1228 | write_function_errorhandling(&module_def, &procedure_decl); |
---|
1229 | ; |
---|
1230 | break;} |
---|
1231 | case 49: |
---|
1232 | #line 464 "mod_grammar.y" |
---|
1233 | { |
---|
1234 | printf(">>>>(%d) %s<<<<\n", procedure_decl.flags.start_of_code, yyvsp[0].name); |
---|
1235 | write_codeline(&module_def, &procedure_decl, yyvsp[0].name, yylineno-1); |
---|
1236 | ; |
---|
1237 | break;} |
---|
1238 | case 50: |
---|
1239 | #line 469 "mod_grammar.y" |
---|
1240 | { |
---|
1241 | printf(">>>>(%d) %s<<<<\n", procedure_decl.flags.start_of_code, yyvsp[0].name); |
---|
1242 | write_codeline(&module_def, &procedure_decl, yyvsp[0].name); |
---|
1243 | ; |
---|
1244 | break;} |
---|
1245 | case 51: |
---|
1246 | #line 474 "mod_grammar.y" |
---|
1247 | { |
---|
1248 | printf(">>>>(%d) %s<<<<\n", procedure_decl.flags.start_of_code, yyvsp[0].name); |
---|
1249 | write_codeline(&module_def, &procedure_decl, yyvsp[0].name); |
---|
1250 | ; |
---|
1251 | break;} |
---|
1252 | case 52: |
---|
1253 | #line 479 "mod_grammar.y" |
---|
1254 | { |
---|
1255 | ; |
---|
1256 | break;} |
---|
1257 | case 53: |
---|
1258 | #line 483 "mod_grammar.y" |
---|
1259 | { |
---|
1260 | write_example(&module_def, &procedure_decl); |
---|
1261 | ; |
---|
1262 | break;} |
---|
1263 | case 54: |
---|
1264 | #line 489 "mod_grammar.y" |
---|
1265 | { |
---|
1266 | if(procedure_decl.procname == NULL) { |
---|
1267 | return(myyyerror("example without proc-declaration at line %d\n", |
---|
1268 | yylineno)); |
---|
1269 | } |
---|
1270 | if(debug>2)printf("Example at %d\n", yylineno); |
---|
1271 | procedure_decl.lineno_other = yylineno; |
---|
1272 | ; |
---|
1273 | break;} |
---|
1274 | case 55: |
---|
1275 | #line 499 "mod_grammar.y" |
---|
1276 | { |
---|
1277 | int len = strlen(yyvsp[0].name); |
---|
1278 | procedure_decl.example_len = len; |
---|
1279 | procedure_decl.example_string = (char *)malloc(len+1); |
---|
1280 | memset(procedure_decl.example_string, 0, len+1); |
---|
1281 | memcpy(procedure_decl.example_string, yyvsp[0].name, len); |
---|
1282 | ; |
---|
1283 | break;} |
---|
1284 | case 56: |
---|
1285 | #line 507 "mod_grammar.y" |
---|
1286 | { |
---|
1287 | long len = strlen(yyvsp[0].name); |
---|
1288 | long newlen = procedure_decl.example_len + len; |
---|
1289 | |
---|
1290 | procedure_decl.example_string = |
---|
1291 | (char *)realloc((void *)procedure_decl.example_string, newlen+1); |
---|
1292 | memset(procedure_decl.example_string+procedure_decl.example_len, |
---|
1293 | 0, len+1); |
---|
1294 | memcpy(procedure_decl.example_string+procedure_decl.example_len, |
---|
1295 | yyvsp[0].name, len); |
---|
1296 | procedure_decl.example_len = newlen; |
---|
1297 | ; |
---|
1298 | break;} |
---|
1299 | case 57: |
---|
1300 | #line 521 "mod_grammar.y" |
---|
1301 | { cmd_token vt; |
---|
1302 | void (*write_cmd)(moddefv module, procdefv pi, void *arg); |
---|
1303 | |
---|
1304 | switch(vt=checkcmd(yyvsp[-1].name, &write_cmd, CMDT_SINGLE, 0)) { |
---|
1305 | case CMD_NONE: |
---|
1306 | return(myyyerror("Line %d: Unknown command '%s' in section %d\n", |
---|
1307 | yylineno, yyvsp[-1].name, sectnum)); |
---|
1308 | break; |
---|
1309 | case CMD_BADSYNTAX: |
---|
1310 | return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n", |
---|
1311 | yylineno, yyvsp[-1].name, sectnum)); |
---|
1312 | break; |
---|
1313 | |
---|
1314 | case CMD_DECL: |
---|
1315 | case CMD_CHECK: |
---|
1316 | procedure_decl.flags.auto_header = 0; |
---|
1317 | case CMD_NODECL: |
---|
1318 | write_cmd(&module_def, &procedure_decl,NULL); |
---|
1319 | break; |
---|
1320 | |
---|
1321 | default: |
---|
1322 | write_function_header(&module_def, &procedure_decl); |
---|
1323 | write_cmd(&module_def, &procedure_decl,NULL); |
---|
1324 | } |
---|
1325 | free(yyvsp[-1].name); |
---|
1326 | ; |
---|
1327 | break;} |
---|
1328 | case 58: |
---|
1329 | #line 548 "mod_grammar.y" |
---|
1330 | { |
---|
1331 | cmd_token vt; |
---|
1332 | void (*write_cmd)(moddefv module, procdefv pi, void *arg); |
---|
1333 | |
---|
1334 | switch(vt=checkcmd(yyvsp[-3].name, &write_cmd, CMDT_0, 1)) { |
---|
1335 | case CMD_NONE: |
---|
1336 | return(myyyerror("Line %d: Unknown command '%s' in section %d\n", |
---|
1337 | yylineno, yyvsp[-3].name, sectnum)); |
---|
1338 | break; |
---|
1339 | case CMD_BADSYNTAX: |
---|
1340 | return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n", |
---|
1341 | yylineno, yyvsp[-3].name, sectnum)); |
---|
1342 | break; |
---|
1343 | default: |
---|
1344 | write_function_header(&module_def, &procedure_decl); |
---|
1345 | case CMD_DECL: |
---|
1346 | case CMD_CHECK: |
---|
1347 | write_cmd(&module_def, &procedure_decl,NULL); |
---|
1348 | } |
---|
1349 | free(yyvsp[-3].name); |
---|
1350 | ; |
---|
1351 | break;} |
---|
1352 | case 59: |
---|
1353 | #line 570 "mod_grammar.y" |
---|
1354 | { |
---|
1355 | cmd_token vt; |
---|
1356 | void (*write_cmd)(moddefv module, procdefv pi, void *arg); |
---|
1357 | |
---|
1358 | switch(vt=checkcmd(yyvsp[-4].name, &write_cmd, CMDT_ANY, 1)) { |
---|
1359 | case CMD_NONE: |
---|
1360 | return(myyyerror("Line %d: Unknown command '%s' in section %d\n", |
---|
1361 | yylineno, yyvsp[-4].name, sectnum)); |
---|
1362 | break; |
---|
1363 | case CMD_BADSYNTAX: |
---|
1364 | return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n", |
---|
1365 | yylineno, yyvsp[-4].name, sectnum)); |
---|
1366 | break; |
---|
1367 | default: |
---|
1368 | write_function_header(&module_def, &procedure_decl); |
---|
1369 | case CMD_DECL: |
---|
1370 | case CMD_CHECK: |
---|
1371 | write_cmd(&module_def, &procedure_decl, yyvsp[-2].name); |
---|
1372 | } |
---|
1373 | free(yyvsp[-4].name); free(yyvsp[-2].name); |
---|
1374 | ; |
---|
1375 | break;} |
---|
1376 | case 60: |
---|
1377 | #line 592 "mod_grammar.y" |
---|
1378 | { |
---|
1379 | cmd_token vt; |
---|
1380 | void (*write_cmd)(moddefv module, procdefv pi, void *arg); |
---|
1381 | |
---|
1382 | switch(vt=checkcmd(yyvsp[-7].name, &write_cmd, CMDT_ANY, 1)) { |
---|
1383 | case CMD_NONE: |
---|
1384 | return(myyyerror("Line %d: Unknown command '%s' in section %d\n", |
---|
1385 | yylineno, yyvsp[-7].name, sectnum)); |
---|
1386 | break; |
---|
1387 | case CMD_BADSYNTAX: |
---|
1388 | return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n", |
---|
1389 | yylineno, yyvsp[-7].name, sectnum)); |
---|
1390 | break; |
---|
1391 | default: |
---|
1392 | write_function_header(&module_def, &procedure_decl); |
---|
1393 | case CMD_DECL: |
---|
1394 | case CMD_CHECK: |
---|
1395 | write_cmd(&module_def, &procedure_decl, yyvsp[-5].name); |
---|
1396 | } |
---|
1397 | free(yyvsp[-7].name); |
---|
1398 | ; |
---|
1399 | break;} |
---|
1400 | case 61: |
---|
1401 | #line 614 "mod_grammar.y" |
---|
1402 | { |
---|
1403 | cmd_token vt; |
---|
1404 | void (*write_cmd)(moddefv module, procdefv pi, void *arg); |
---|
1405 | |
---|
1406 | switch(vt=checkcmd(yyvsp[-2].name, &write_cmd, CMDT_EQ, 0)) { |
---|
1407 | case CMD_NONE: |
---|
1408 | return(myyyerror("Line %d: Unknown command '%s' in section %d\n", |
---|
1409 | yylineno, yyvsp[-2].name, sectnum)); |
---|
1410 | break; |
---|
1411 | case CMD_BADSYNTAX: |
---|
1412 | return(myyyerror("Line %d: bad syntax of command '%s' in section %d\n", |
---|
1413 | yylineno, yyvsp[-2].name, sectnum)); |
---|
1414 | break; |
---|
1415 | default: |
---|
1416 | write_function_header(&module_def, &procedure_decl); |
---|
1417 | case CMD_DECL: |
---|
1418 | case CMD_CHECK: |
---|
1419 | write_cmd(&module_def, &procedure_decl, yyvsp[0].name); |
---|
1420 | } |
---|
1421 | free(yyvsp[-2].name); |
---|
1422 | ; |
---|
1423 | break;} |
---|
1424 | case 62: |
---|
1425 | #line 638 "mod_grammar.y" |
---|
1426 | { |
---|
1427 | if(debug>2)printf("### ID ### Name %s\n", yyvsp[0].name); |
---|
1428 | yyval.name = yyvsp[0].name; |
---|
1429 | ; |
---|
1430 | break;} |
---|
1431 | case 63: |
---|
1432 | #line 643 "mod_grammar.y" |
---|
1433 | { |
---|
1434 | int len = strlen(yyval.name) + strlen(yyvsp[0].name) + 2; |
---|
1435 | if(debug>2)printf("### ID ### Name %s\n", yyvsp[0].name); |
---|
1436 | yyval.name = (char *)realloc(yyval.name, len); |
---|
1437 | strcat(yyval.name, "::"); |
---|
1438 | strcat(yyval.name, yyvsp[0].name); |
---|
1439 | ; |
---|
1440 | break;} |
---|
1441 | case 64: |
---|
1442 | #line 652 "mod_grammar.y" |
---|
1443 | { |
---|
1444 | if(debug>2)printf("### ARGS %s\n", yyvsp[0].name); |
---|
1445 | ; |
---|
1446 | break;} |
---|
1447 | case 65: |
---|
1448 | #line 656 "mod_grammar.y" |
---|
1449 | { |
---|
1450 | if(debug>2)printf("### ARGS %s\n", yyvsp[0].name); |
---|
1451 | ; |
---|
1452 | break;} |
---|
1453 | case 66: |
---|
1454 | #line 661 "mod_grammar.y" |
---|
1455 | { |
---|
1456 | if(debug>2)printf("\tsgtypelist %s %s\n", yyvsp[-1].tp.name, yyvsp[0].name); |
---|
1457 | write_singular_parameter(&module_def, yylineno, yyvsp[-1].tp.name, yyvsp[0].name); |
---|
1458 | free(yyvsp[-1].tp.name); |
---|
1459 | free(yyvsp[0].name); |
---|
1460 | ; |
---|
1461 | break;} |
---|
1462 | case 67: |
---|
1463 | #line 668 "mod_grammar.y" |
---|
1464 | { |
---|
1465 | if(debug>2)printf("\tsgtypelist %s %s\n", yyvsp[-1].tp.name, yyvsp[0]); |
---|
1466 | write_singular_parameter(&module_def, yylineno, yyvsp[-1].tp.name, "#"); |
---|
1467 | free(yyvsp[-1].tp.name); |
---|
1468 | ; |
---|
1469 | break;} |
---|
1470 | case 68: |
---|
1471 | #line 674 "mod_grammar.y" |
---|
1472 | { |
---|
1473 | if(debug>2)printf("\tsgtypelist next %s %s\n", yyvsp[-1].tp.name, yyvsp[0].name); |
---|
1474 | write_singular_parameter(&module_def, yylineno, yyvsp[-1].tp.name, yyvsp[0].name); |
---|
1475 | free(yyvsp[-1].tp.name); |
---|
1476 | free(yyvsp[0].name); |
---|
1477 | ; |
---|
1478 | break;} |
---|
1479 | case 69: |
---|
1480 | #line 681 "mod_grammar.y" |
---|
1481 | { |
---|
1482 | if(debug>2)printf("\tsgtypelist next %s %s\n", yyvsp[-1].tp.name, yyvsp[0]); |
---|
1483 | write_singular_parameter(&module_def, yylineno, yyvsp[-1].tp.name, "#"); |
---|
1484 | free(yyvsp[-1].tp.name); |
---|
1485 | ; |
---|
1486 | break;} |
---|
1487 | case 70: |
---|
1488 | #line 689 "mod_grammar.y" |
---|
1489 | { |
---|
1490 | AddParam(&procedure_decl, &yyvsp[0].tp); |
---|
1491 | free(yyvsp[0].tp.name); |
---|
1492 | ; |
---|
1493 | break;} |
---|
1494 | case 71: |
---|
1495 | #line 694 "mod_grammar.y" |
---|
1496 | { |
---|
1497 | if(check_reseverd(yyvsp[0].name)) |
---|
1498 | return(myyyerror("Line %d: variablename '%s' is reserved\n", |
---|
1499 | yylineno, yyvsp[0].name)); |
---|
1500 | AddParam(&procedure_decl, &yyvsp[-1].tp, yyvsp[0].name); |
---|
1501 | free(yyvsp[-1].tp.name); free(yyvsp[0].name); |
---|
1502 | ; |
---|
1503 | break;} |
---|
1504 | case 72: |
---|
1505 | #line 702 "mod_grammar.y" |
---|
1506 | { |
---|
1507 | AddParam(&procedure_decl, &yyvsp[0].tp); |
---|
1508 | free(yyvsp[0].tp.name); |
---|
1509 | ; |
---|
1510 | break;} |
---|
1511 | case 73: |
---|
1512 | #line 707 "mod_grammar.y" |
---|
1513 | { |
---|
1514 | if(check_reseverd(yyvsp[0].name)) |
---|
1515 | return(myyyerror("Line %d: variablename '%s' is reserved\n", |
---|
1516 | yylineno, yyvsp[0].name)); |
---|
1517 | AddParam(&procedure_decl, &yyvsp[-1].tp, yyvsp[0].name); |
---|
1518 | free(yyvsp[-1].tp.name); free(yyvsp[0].name); |
---|
1519 | ; |
---|
1520 | break;} |
---|
1521 | case 74: |
---|
1522 | #line 717 "mod_grammar.y" |
---|
1523 | { |
---|
1524 | ; |
---|
1525 | break;} |
---|
1526 | case 75: |
---|
1527 | #line 721 "mod_grammar.y" |
---|
1528 | { |
---|
1529 | fprintf(module_def.modfp, "#line %d \"%s\"\n", |
---|
1530 | yylineno, module_def.filename); |
---|
1531 | fprintf(module_def.modfp, "%s", yyvsp[0].name); |
---|
1532 | ; |
---|
1533 | break;} |
---|
1534 | case 76: |
---|
1535 | #line 727 "mod_grammar.y" |
---|
1536 | { |
---|
1537 | fprintf(module_def.modfp, "%s", yyvsp[0].name); |
---|
1538 | ; |
---|
1539 | break;} |
---|
1540 | } |
---|
1541 | /* the action file gets copied in in place of this dollarsign */ |
---|
1542 | #line 543 "/usr/lib/bison.simple" |
---|
1543 | |
---|
1544 | yyvsp -= yylen; |
---|
1545 | yyssp -= yylen; |
---|
1546 | #ifdef YYLSP_NEEDED |
---|
1547 | yylsp -= yylen; |
---|
1548 | #endif |
---|
1549 | |
---|
1550 | #if YYDEBUG != 0 |
---|
1551 | if (yydebug) |
---|
1552 | { |
---|
1553 | short *ssp1 = yyss - 1; |
---|
1554 | fprintf (stderr, "state stack now"); |
---|
1555 | while (ssp1 != yyssp) |
---|
1556 | fprintf (stderr, " %d", *++ssp1); |
---|
1557 | fprintf (stderr, "\n"); |
---|
1558 | } |
---|
1559 | #endif |
---|
1560 | |
---|
1561 | *++yyvsp = yyval; |
---|
1562 | |
---|
1563 | #ifdef YYLSP_NEEDED |
---|
1564 | yylsp++; |
---|
1565 | if (yylen == 0) |
---|
1566 | { |
---|
1567 | yylsp->first_line = yylloc.first_line; |
---|
1568 | yylsp->first_column = yylloc.first_column; |
---|
1569 | yylsp->last_line = (yylsp-1)->last_line; |
---|
1570 | yylsp->last_column = (yylsp-1)->last_column; |
---|
1571 | yylsp->text = 0; |
---|
1572 | } |
---|
1573 | else |
---|
1574 | { |
---|
1575 | yylsp->last_line = (yylsp+yylen-1)->last_line; |
---|
1576 | yylsp->last_column = (yylsp+yylen-1)->last_column; |
---|
1577 | } |
---|
1578 | #endif |
---|
1579 | |
---|
1580 | /* Now "shift" the result of the reduction. |
---|
1581 | Determine what state that goes to, |
---|
1582 | based on the state we popped back to |
---|
1583 | and the rule number reduced by. */ |
---|
1584 | |
---|
1585 | yyn = yyr1[yyn]; |
---|
1586 | |
---|
1587 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; |
---|
1588 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
---|
1589 | yystate = yytable[yystate]; |
---|
1590 | else |
---|
1591 | yystate = yydefgoto[yyn - YYNTBASE]; |
---|
1592 | |
---|
1593 | goto yynewstate; |
---|
1594 | |
---|
1595 | yyerrlab: /* here on detecting error */ |
---|
1596 | |
---|
1597 | if (! yyerrstatus) |
---|
1598 | /* If not already recovering from an error, report this error. */ |
---|
1599 | { |
---|
1600 | ++yynerrs; |
---|
1601 | |
---|
1602 | #ifdef YYERROR_VERBOSE |
---|
1603 | yyn = yypact[yystate]; |
---|
1604 | |
---|
1605 | if (yyn > YYFLAG && yyn < YYLAST) |
---|
1606 | { |
---|
1607 | int size = 0; |
---|
1608 | char *msg; |
---|
1609 | int x, count; |
---|
1610 | |
---|
1611 | count = 0; |
---|
1612 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ |
---|
1613 | for (x = (yyn < 0 ? -yyn : 0); |
---|
1614 | x < (sizeof(yytname) / sizeof(char *)); x++) |
---|
1615 | if (yycheck[x + yyn] == x) |
---|
1616 | size += strlen(yytname[x]) + 15, count++; |
---|
1617 | msg = (char *) malloc(size + 15); |
---|
1618 | if (msg != 0) |
---|
1619 | { |
---|
1620 | strcpy(msg, "parse error"); |
---|
1621 | |
---|
1622 | if (count < 5) |
---|
1623 | { |
---|
1624 | count = 0; |
---|
1625 | for (x = (yyn < 0 ? -yyn : 0); |
---|
1626 | x < (sizeof(yytname) / sizeof(char *)); x++) |
---|
1627 | if (yycheck[x + yyn] == x) |
---|
1628 | { |
---|
1629 | strcat(msg, count == 0 ? ", expecting `" : " or `"); |
---|
1630 | strcat(msg, yytname[x]); |
---|
1631 | strcat(msg, "'"); |
---|
1632 | count++; |
---|
1633 | } |
---|
1634 | } |
---|
1635 | yyerror(msg); |
---|
1636 | free(msg); |
---|
1637 | } |
---|
1638 | else |
---|
1639 | yyerror ("parse error; also virtual memory exceeded"); |
---|
1640 | } |
---|
1641 | else |
---|
1642 | #endif /* YYERROR_VERBOSE */ |
---|
1643 | yyerror("parse error"); |
---|
1644 | } |
---|
1645 | |
---|
1646 | goto yyerrlab1; |
---|
1647 | yyerrlab1: /* here on error raised explicitly by an action */ |
---|
1648 | |
---|
1649 | if (yyerrstatus == 3) |
---|
1650 | { |
---|
1651 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ |
---|
1652 | |
---|
1653 | /* return failure if at end of input */ |
---|
1654 | if (yychar == YYEOF) |
---|
1655 | YYABORT; |
---|
1656 | |
---|
1657 | #if YYDEBUG != 0 |
---|
1658 | if (yydebug) |
---|
1659 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); |
---|
1660 | #endif |
---|
1661 | |
---|
1662 | yychar = YYEMPTY; |
---|
1663 | } |
---|
1664 | |
---|
1665 | /* Else will try to reuse lookahead token |
---|
1666 | after shifting the error token. */ |
---|
1667 | |
---|
1668 | yyerrstatus = 3; /* Each real token shifted decrements this */ |
---|
1669 | |
---|
1670 | goto yyerrhandle; |
---|
1671 | |
---|
1672 | yyerrdefault: /* current state does not do anything special for the error token. */ |
---|
1673 | |
---|
1674 | #if 0 |
---|
1675 | /* This is wrong; only states that explicitly want error tokens |
---|
1676 | should shift them. */ |
---|
1677 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ |
---|
1678 | if (yyn) goto yydefault; |
---|
1679 | #endif |
---|
1680 | |
---|
1681 | yyerrpop: /* pop the current state because it cannot handle the error token */ |
---|
1682 | |
---|
1683 | if (yyssp == yyss) YYABORT; |
---|
1684 | yyvsp--; |
---|
1685 | yystate = *--yyssp; |
---|
1686 | #ifdef YYLSP_NEEDED |
---|
1687 | yylsp--; |
---|
1688 | #endif |
---|
1689 | |
---|
1690 | #if YYDEBUG != 0 |
---|
1691 | if (yydebug) |
---|
1692 | { |
---|
1693 | short *ssp1 = yyss - 1; |
---|
1694 | fprintf (stderr, "Error: state stack now"); |
---|
1695 | while (ssp1 != yyssp) |
---|
1696 | fprintf (stderr, " %d", *++ssp1); |
---|
1697 | fprintf (stderr, "\n"); |
---|
1698 | } |
---|
1699 | #endif |
---|
1700 | |
---|
1701 | yyerrhandle: |
---|
1702 | |
---|
1703 | yyn = yypact[yystate]; |
---|
1704 | if (yyn == YYFLAG) |
---|
1705 | goto yyerrdefault; |
---|
1706 | |
---|
1707 | yyn += YYTERROR; |
---|
1708 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) |
---|
1709 | goto yyerrdefault; |
---|
1710 | |
---|
1711 | yyn = yytable[yyn]; |
---|
1712 | if (yyn < 0) |
---|
1713 | { |
---|
1714 | if (yyn == YYFLAG) |
---|
1715 | goto yyerrpop; |
---|
1716 | yyn = -yyn; |
---|
1717 | goto yyreduce; |
---|
1718 | } |
---|
1719 | else if (yyn == 0) |
---|
1720 | goto yyerrpop; |
---|
1721 | |
---|
1722 | if (yyn == YYFINAL) |
---|
1723 | YYACCEPT; |
---|
1724 | |
---|
1725 | #if YYDEBUG != 0 |
---|
1726 | if (yydebug) |
---|
1727 | fprintf(stderr, "Shifting error token, "); |
---|
1728 | #endif |
---|
1729 | |
---|
1730 | *++yyvsp = yylval; |
---|
1731 | #ifdef YYLSP_NEEDED |
---|
1732 | *++yylsp = yylloc; |
---|
1733 | #endif |
---|
1734 | |
---|
1735 | yystate = yyn; |
---|
1736 | goto yynewstate; |
---|
1737 | |
---|
1738 | yyacceptlab: |
---|
1739 | /* YYACCEPT comes here. */ |
---|
1740 | if (yyfree_stacks) |
---|
1741 | { |
---|
1742 | free (yyss); |
---|
1743 | free (yyvs); |
---|
1744 | #ifdef YYLSP_NEEDED |
---|
1745 | free (yyls); |
---|
1746 | #endif |
---|
1747 | } |
---|
1748 | return 0; |
---|
1749 | |
---|
1750 | yyabortlab: |
---|
1751 | /* YYABORT comes here. */ |
---|
1752 | if (yyfree_stacks) |
---|
1753 | { |
---|
1754 | free (yyss); |
---|
1755 | free (yyvs); |
---|
1756 | #ifdef YYLSP_NEEDED |
---|
1757 | free (yyls); |
---|
1758 | #endif |
---|
1759 | } |
---|
1760 | return 1; |
---|
1761 | } |
---|
1762 | #line 733 "mod_grammar.y" |
---|
1763 | |
---|
1764 | |
---|