modules/er/er.yacc.tab.c
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- er_yyerror
- adderr
- myfree
- YYTRANSLATE
- YYRECOVERING
- YYBACKUP
- __yy_memcpy
- __yy_memcpy
- __yy_memcpy
- yyparse
1
2 /* A Bison parser, made from er.yacc
3 by GNU Bison version 1.28 */
4
5 #define YYBISON 1 /* Identify Bison output. */
6
7 #define yyparse er_yyparse
8 #define yylex er_yylex
9 #define yyerror er_yyerror
10 #define yylval er_yylval
11 #define yychar er_yychar
12 #define yydebug er_yydebug
13 #define yynerrs er_yynerrs
14 #define EOL 257
15 #define K_SOCK 258
16 #define K_NAME 259
17 #define K_FAC 260
18 #define K_ADD 261
19 #define K_RM 262
20 #define K_CREATE 263
21 #define K_DELETE 264
22 #define K_MODIFY 265
23 #define K_AUTO 266
24 #define K_ASP 267
25 #define K_SEV 268
26 #define K_THR 269
27 #define K_FORMAT 270
28 #define K_SELF 271
29 #define K_DATE 272
30 #define K_ALL 273
31 #define K_EXEC 274
32 #define K_PATH 275
33 #define STRING 276
34 #define NUMBER 277
35 #define HEXNUM 278
36
37
38 #include "erroutines.h"
39 #include <stdlib.h>
40 #include <string.h>
41 #include "bitmask.h"
42 #include "er_yacc_helper.h"
43 #include "er_paths.h"
44 #include "er_arrays.h"
45
46 #define YYPARSE_PARAM ypar
47 #define YYLEX_PARAM ypar
48 #define YYDEBUG 0
49 /* #define YYERROR_VERBOSE */
50
51 #define er_yyerror(a) myerror(ypar,a)
/* [<][>][^][v][top][bottom][index][help] */
52
53 #define adderr(a,b) {strcat(a->errtxt,b);}
/* [<][>][^][v][top][bottom][index][help] */
54
55 #define myfree(mem) {lexerr_t *erst = ypar; free(mem); erst->token = NULL}
/* [<][>][^][v][top][bottom][index][help] */
56
57 #define MYABORT { mycleanup(ypar); YYABORT; }
58
59
60 typedef union {
61 int inum;
62 char *text;
63 } YYSTYPE;
64 #include <stdio.h>
65
66 #ifndef __cplusplus
67 #ifndef __STDC__
68 #define const
69 #endif
70 #endif
71
72
73
74 #define YYFINAL 86
75 #define YYFLAG -32768
76 #define YYNTBASE 31
77
78 #define YYTRANSLATE(x) ((unsigned)(x) <= 278 ? yytranslate[x] : 62)
/* [<][>][^][v][top][bottom][index][help] */
79
80 static const char yytranslate[] = { 0,
81 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
82 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
83 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
84 2, 2, 2, 2, 2, 2, 2, 2, 2, 28,
85 29, 2, 2, 2, 30, 2, 2, 2, 2, 2,
86 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
87 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
88 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
89 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
90 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
91 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
92 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
93 2, 2, 25, 27, 26, 2, 2, 2, 2, 2,
94 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
95 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
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, 2, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
102 2, 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, 1, 3, 4, 5, 6,
107 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
108 17, 18, 19, 20, 21, 22, 23, 24
109 };
110
111 #if YYDEBUG != 0
112 static const short yyprhs[] = { 0,
113 0, 2, 5, 7, 8, 14, 17, 21, 26, 31,
114 33, 35, 40, 42, 44, 46, 48, 51, 53, 55,
115 59, 61, 64, 68, 71, 72, 74, 78, 79, 81,
116 83, 86, 88, 90, 93, 97, 102, 104, 107, 110,
117 111, 114, 115, 118, 121, 123, 127, 129, 131, 135,
118 137, 138, 140, 141, 143, 145, 147, 151, 153
119 };
120
121 static const short yyrhs[] = { 32,
122 0, 32, 3, 0, 1, 0, 0, 9, 34, 33,
123 35, 47, 0, 10, 34, 0, 11, 34, 35, 0,
124 11, 34, 8, 46, 0, 11, 34, 7, 47, 0,
125 22, 0, 12, 0, 25, 37, 36, 26, 0, 40,
126 0, 41, 0, 43, 0, 1, 0, 16, 38, 0,
127 1, 0, 39, 0, 38, 27, 39, 0, 22, 0,
128 4, 23, 0, 5, 22, 42, 0, 5, 1, 0,
129 0, 18, 0, 20, 44, 45, 0, 0, 21, 0,
130 22, 0, 45, 22, 0, 23, 0, 48, 0, 47,
131 48, 0, 28, 49, 29, 0, 50, 52, 51, 53,
132 0, 1, 0, 6, 54, 0, 14, 56, 0, 0,
133 13, 60, 0, 0, 15, 17, 0, 15, 23, 0,
134 55, 0, 54, 27, 55, 0, 19, 0, 22, 0,
135 57, 30, 58, 0, 59, 0, 0, 22, 0, 0,
136 22, 0, 22, 0, 61, 0, 60, 27, 61, 0,
137 22, 0, 24, 0
138 };
139
140 #endif
141
142 #if YYDEBUG != 0
143 static const short yyrline[] = { 0,
144 74, 75, 76, 81, 86, 112, 125, 140, 156, 172,
145 173, 178, 183, 184, 185, 186, 191, 192, 197, 198,
146 201, 218, 226, 233, 238, 238, 244, 250, 250, 256,
147 261, 269, 272, 273, 276, 285, 286, 293, 295, 297,
148 298, 300, 301, 305, 313, 314, 319, 323, 340, 341,
149 344, 347, 353, 356, 362, 375, 376, 381, 396
150 };
151 #endif
152
153
154 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
155
156 static const char * const yytname[] = { "$","error","$undefined.","EOL","K_SOCK",
157 "K_NAME","K_FAC","K_ADD","K_RM","K_CREATE","K_DELETE","K_MODIFY","K_AUTO","K_ASP",
158 "K_SEV","K_THR","K_FORMAT","K_SELF","K_DATE","K_ALL","K_EXEC","K_PATH","STRING",
159 "NUMBER","HEXNUM","'{'","'}'","'|'","'('","')'","'-'","fullline","stmt","@1",
160 "pathid","path","pathspec","formatspec","formlist","oneform","sockspec","namespec",
161 "nameoptions","execspec","opt_path","execwords","filterid","filters","filter",
162 "filtspec","mand_fac","mand_sev","opt_asp","opt_thr","facspec","onefac","sevspec",
163 "sevmin","sevmax","seveql","aspspec","oneasp", NULL
164 };
165 #endif
166
167 static const short yyr1[] = { 0,
168 31, 31, 31, 33, 32, 32, 32, 32, 32, 34,
169 34, 35, 36, 36, 36, 36, 37, 37, 38, 38,
170 39, 40, 41, 41, 42, 42, 43, 44, 44, 45,
171 45, 46, 47, 47, 48, 49, 49, 50, 51, 52,
172 52, 53, 53, 53, 54, 54, 55, 55, 56, 56,
173 57, 57, 58, 58, 59, 60, 60, 61, 61
174 };
175
176 static const short yyr2[] = { 0,
177 1, 2, 1, 0, 5, 2, 3, 4, 4, 1,
178 1, 4, 1, 1, 1, 1, 2, 1, 1, 3,
179 1, 2, 3, 2, 0, 1, 3, 0, 1, 1,
180 2, 1, 1, 2, 3, 4, 1, 2, 2, 0,
181 2, 0, 2, 2, 1, 3, 1, 1, 3, 1,
182 0, 1, 0, 1, 1, 1, 3, 1, 1
183 };
184
185 static const short yydefact[] = { 0,
186 3, 0, 0, 0, 1, 11, 10, 4, 6, 0,
187 2, 0, 0, 0, 0, 7, 0, 0, 9, 33,
188 32, 8, 18, 0, 0, 5, 37, 0, 0, 40,
189 34, 21, 17, 19, 16, 0, 0, 28, 0, 13,
190 14, 15, 47, 48, 38, 45, 35, 0, 0, 0,
191 22, 24, 25, 29, 0, 12, 0, 58, 59, 41,
192 56, 51, 42, 20, 26, 23, 30, 27, 46, 0,
193 55, 39, 0, 50, 0, 36, 31, 57, 53, 43,
194 44, 54, 49, 0, 0, 0
195 };
196
197 static const short yydefgoto[] = { 84,
198 5, 12, 8, 16, 39, 25, 33, 34, 40, 41,
199 66, 42, 55, 68, 22, 19, 20, 29, 30, 63,
200 49, 76, 45, 46, 72, 73, 83, 74, 60, 61
201 };
202
203 static const short yypact[] = { 5,
204 -32768, -10, -10, -10, 4,-32768,-32768,-32768,-32768, 1,
205 -32768, -14, 8, 9, 2,-32768, 8, 21, 8,-32768,
206 -32768,-32768,-32768, 11, 0, 8,-32768, 6, 10, 17,
207 -32768,-32768, 13,-32768,-32768, 12, -1, 16, 15,-32768,
208 -32768,-32768,-32768,-32768, 18,-32768,-32768, 7, 24, 11,
209 -32768,-32768, 25,-32768, 22,-32768, 6,-32768,-32768, 19,
210 -32768, 26, 27,-32768,-32768,-32768,-32768, 28,-32768, 7,
211 23,-32768, 29,-32768, -4,-32768,-32768,-32768, 30,-32768,
212 -32768,-32768,-32768, 34, 47,-32768
213 };
214
215 static const short yypgoto[] = {-32768,
216 -32768,-32768, 20, 37,-32768,-32768,-32768, 14,-32768,-32768,
217 -32768,-32768,-32768,-32768,-32768, 38, -9,-32768,-32768,-32768,
218 -32768,-32768,-32768, -6,-32768,-32768,-32768,-32768,-32768, -16
219 };
220
221
222 #define YYLAST 64
223
224
225 static const short yytable[] = { 52,
226 35, 6, 23, 36, 37, 1, 11, 13, 14, 31,
227 15, 7, 80, 2, 3, 4, 31, 24, 81, 38,
228 53, 27, 9, 10, 43, 15, 28, 44, 58, 48,
229 59, 21, 32, 85, 51, 18, 54, 62, 47, 50,
230 56, 75, 65, 67, 57, 70, 86, 71, 17, 77,
231 69, 82, -52, 78, 26, 0, 0, 0, 79, 0,
232 0, 0, 0, 64
233 };
234
235 static const short yycheck[] = { 1,
236 1, 12, 1, 4, 5, 1, 3, 7, 8, 19,
237 25, 22, 17, 9, 10, 11, 26, 16, 23, 20,
238 22, 1, 3, 4, 19, 25, 6, 22, 22, 13,
239 24, 23, 22, 0, 23, 28, 21, 14, 29, 27,
240 26, 15, 18, 22, 27, 27, 0, 22, 12, 22,
241 57, 22, 30, 70, 17, -1, -1, -1, 30, -1,
242 -1, -1, -1, 50
243 };
244 #define YYPURE 1
245
246 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
247
248 /* This file comes from bison-1.28. */
249
250 /* Skeleton output parser for bison,
251 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
252
253 This program is free software; you can redistribute it and/or modify
254 it under the terms of the GNU General Public License as published by
255 the Free Software Foundation; either version 2, or (at your option)
256 any later version.
257
258 This program is distributed in the hope that it will be useful,
259 but WITHOUT ANY WARRANTY; without even the implied warranty of
260 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
261 GNU General Public License for more details.
262
263 You should have received a copy of the GNU General Public License
264 along with this program; if not, write to the Free Software
265 Foundation, Inc., 59 Temple Place - Suite 330,
266 Boston, MA 02111-1307, USA. */
267
268 /* As a special exception, when this file is copied by Bison into a
269 Bison output file, you may use that output file without restriction.
270 This special exception was added by the Free Software Foundation
271 in version 1.24 of Bison. */
272
273 /* This is the parser code that is written into each bison parser
274 when the %semantic_parser declaration is not specified in the grammar.
275 It was written by Richard Stallman by simplifying the hairy parser
276 used when %semantic_parser is specified. */
277
278 #ifndef YYSTACK_USE_ALLOCA
279 #ifdef alloca
280 #define YYSTACK_USE_ALLOCA
281 #else /* alloca not defined */
282 #ifdef __GNUC__
283 #define YYSTACK_USE_ALLOCA
284 #define alloca __builtin_alloca
285 #else /* not GNU C. */
286 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
287 #define YYSTACK_USE_ALLOCA
288 #include <alloca.h>
289 #else /* not sparc */
290 /* We think this test detects Watcom and Microsoft C. */
291 /* This used to test MSDOS, but that is a bad idea
292 since that symbol is in the user namespace. */
293 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
294 #if 0 /* No need for malloc.h, which pollutes the namespace;
295 instead, just don't use alloca. */
296 #include <malloc.h>
297 #endif
298 #else /* not MSDOS, or __TURBOC__ */
299 #if defined(_AIX)
300 /* I don't know what this was needed for, but it pollutes the namespace.
301 So I turned it off. rms, 2 May 1997. */
302 /* #include <malloc.h> */
303 #pragma alloca
304 #define YYSTACK_USE_ALLOCA
305 #else /* not MSDOS, or __TURBOC__, or _AIX */
306 #if 0
307 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
308 and on HPUX 10. Eventually we can turn this on. */
309 #define YYSTACK_USE_ALLOCA
310 #define alloca __builtin_alloca
311 #endif /* __hpux */
312 #endif
313 #endif /* not _AIX */
314 #endif /* not MSDOS, or __TURBOC__ */
315 #endif /* not sparc */
316 #endif /* not GNU C */
317 #endif /* alloca not defined */
318 #endif /* YYSTACK_USE_ALLOCA not defined */
319
320 #ifdef YYSTACK_USE_ALLOCA
321 #define YYSTACK_ALLOC alloca
322 #else
323 #define YYSTACK_ALLOC malloc
324 #endif
325
326 /* Note: there must be only one dollar sign in this file.
327 It is replaced by the list of actions, each action
328 as one case of the switch. */
329
330 #define yyerrok (yyerrstatus = 0)
331 #define yyclearin (yychar = YYEMPTY)
332 #define YYEMPTY -2
333 #define YYEOF 0
334 #define YYACCEPT goto yyacceptlab
335 #define YYABORT goto yyabortlab
336 #define YYERROR goto yyerrlab1
337 /* Like YYERROR except do call yyerror.
338 This remains here temporarily to ease the
339 transition to the new meaning of YYERROR, for GCC.
340 Once GCC version 2 has supplanted version 1, this can go. */
341 #define YYFAIL goto yyerrlab
342 #define YYRECOVERING() (!!yyerrstatus)
/* [<][>][^][v][top][bottom][index][help] */
343 #define YYBACKUP(token, value) \
/* [<][>][^][v][top][bottom][index][help] */
344 do \
345 if (yychar == YYEMPTY && yylen == 1) \
346 { yychar = (token), yylval = (value); \
347 yychar1 = YYTRANSLATE (yychar); \
348 YYPOPSTACK; \
349 goto yybackup; \
350 } \
351 else \
352 { yyerror ("syntax error: cannot back up"); YYERROR; } \
353 while (0)
354
355 #define YYTERROR 1
356 #define YYERRCODE 256
357
358 #ifndef YYPURE
359 #define YYLEX yylex()
360 #endif
361
362 #ifdef YYPURE
363 #ifdef YYLSP_NEEDED
364 #ifdef YYLEX_PARAM
365 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
366 #else
367 #define YYLEX yylex(&yylval, &yylloc)
368 #endif
369 #else /* not YYLSP_NEEDED */
370 #ifdef YYLEX_PARAM
371 #define YYLEX yylex(&yylval, YYLEX_PARAM)
372 #else
373 #define YYLEX yylex(&yylval)
374 #endif
375 #endif /* not YYLSP_NEEDED */
376 #endif
377
378 /* If nonreentrant, generate the variables here */
379
380 #ifndef YYPURE
381
382 int yychar; /* the lookahead symbol */
383 YYSTYPE yylval; /* the semantic value of the */
384 /* lookahead symbol */
385
386 #ifdef YYLSP_NEEDED
387 YYLTYPE yylloc; /* location data for the lookahead */
388 /* symbol */
389 #endif
390
391 int yynerrs; /* number of parse errors so far */
392 #endif /* not YYPURE */
393
394 #if YYDEBUG != 0
395 int yydebug; /* nonzero means print parse trace */
396 /* Since this is uninitialized, it does not stop multiple parsers
397 from coexisting. */
398 #endif
399
400 /* YYINITDEPTH indicates the initial size of the parser's stacks */
401
402 #ifndef YYINITDEPTH
403 #define YYINITDEPTH 200
404 #endif
405
406 /* YYMAXDEPTH is the maximum size the stacks can grow to
407 (effective only if the built-in stack extension method is used). */
408
409 #if YYMAXDEPTH == 0
410 #undef YYMAXDEPTH
411 #endif
412
413 #ifndef YYMAXDEPTH
414 #define YYMAXDEPTH 10000
415 #endif
416
417 /* Define __yy_memcpy. Note that the size argument
418 should be passed with type unsigned int, because that is what the non-GCC
419 definitions require. With GCC, __builtin_memcpy takes an arg
420 of type size_t, but it can handle unsigned int. */
421
422 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
423 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
/* [<][>][^][v][top][bottom][index][help] */
424 #else /* not GNU C or C++ */
425 #ifndef __cplusplus
426
427 /* This is the most reliable way to avoid incompatibilities
428 in available built-in functions on various systems. */
429 static void
430 __yy_memcpy (to, from, count)
/* [<][>][^][v][top][bottom][index][help] */
431 char *to;
432 char *from;
433 unsigned int count;
434 {
435 register char *f = from;
436 register char *t = to;
437 register int i = count;
438
439 while (i-- > 0)
440 *t++ = *f++;
441 }
442
443 #else /* __cplusplus */
444
445 /* This is the most reliable way to avoid incompatibilities
446 in available built-in functions on various systems. */
447 static void
448 __yy_memcpy (char *to, char *from, unsigned int count)
/* [<][>][^][v][top][bottom][index][help] */
449 {
450 register char *t = to;
451 register char *f = from;
452 register int i = count;
453
454 while (i-- > 0)
455 *t++ = *f++;
456 }
457
458 #endif
459 #endif
460
461
462
463 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
464 into yyparse. The argument should have type void *.
465 It should actually point to an object.
466 Grammar actions can access the variable by casting it
467 to the proper pointer type. */
468
469 #ifdef YYPARSE_PARAM
470 #ifdef __cplusplus
471 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
472 #define YYPARSE_PARAM_DECL
473 #else /* not __cplusplus */
474 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
475 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
476 #endif /* not __cplusplus */
477 #else /* not YYPARSE_PARAM */
478 #define YYPARSE_PARAM_ARG
479 #define YYPARSE_PARAM_DECL
480 #endif /* not YYPARSE_PARAM */
481
482 /* Prevent warning if -Wstrict-prototypes. */
483 #ifdef __GNUC__
484 #ifdef YYPARSE_PARAM
485 int yyparse (void *);
486 #else
487 int yyparse (void);
488 #endif
489 #endif
490
491 int
492 yyparse(YYPARSE_PARAM_ARG)
/* [<][>][^][v][top][bottom][index][help] */
493 YYPARSE_PARAM_DECL
494 {
495 register int yystate;
496 register int yyn;
497 register short *yyssp;
498 register YYSTYPE *yyvsp;
499 int yyerrstatus; /* number of tokens to shift before error messages enabled */
500 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
501
502 short yyssa[YYINITDEPTH]; /* the state stack */
503 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
504
505 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
506 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
507
508 #ifdef YYLSP_NEEDED
509 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
510 YYLTYPE *yyls = yylsa;
511 YYLTYPE *yylsp;
512
513 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
514 #else
515 #define YYPOPSTACK (yyvsp--, yyssp--)
516 #endif
517
518 int yystacksize = YYINITDEPTH;
519 int yyfree_stacks = 0;
520
521 #ifdef YYPURE
522 int yychar;
523 YYSTYPE yylval;
524 int yynerrs;
525 #ifdef YYLSP_NEEDED
526 YYLTYPE yylloc;
527 #endif
528 #endif
529
530 YYSTYPE yyval; /* the variable used to return */
531 /* semantic values from the action */
532 /* routines */
533
534 int yylen;
535
536 #if YYDEBUG != 0
537 if (yydebug)
538 fprintf(stderr, "Starting parse\n");
539 #endif
540
541 yystate = 0;
542 yyerrstatus = 0;
543 yynerrs = 0;
544 yychar = YYEMPTY; /* Cause a token to be read. */
545
546 /* Initialize stack pointers.
547 Waste one element of value and location stack
548 so that they stay on the same level as the state stack.
549 The wasted elements are never initialized. */
550
551 yyssp = yyss - 1;
552 yyvsp = yyvs;
553 #ifdef YYLSP_NEEDED
554 yylsp = yyls;
555 #endif
556
557 /* Push a new state, which is found in yystate . */
558 /* In all cases, when you get here, the value and location stacks
559 have just been pushed. so pushing a state here evens the stacks. */
560 yynewstate:
561
562 *++yyssp = yystate;
563
564 if (yyssp >= yyss + yystacksize - 1)
565 {
566 /* Give user a chance to reallocate the stack */
567 /* Use copies of these so that the &'s don't force the real ones into memory. */
568 YYSTYPE *yyvs1 = yyvs;
569 short *yyss1 = yyss;
570 #ifdef YYLSP_NEEDED
571 YYLTYPE *yyls1 = yyls;
572 #endif
573
574 /* Get the current used size of the three stacks, in elements. */
575 int size = yyssp - yyss + 1;
576
577 #ifdef yyoverflow
578 /* Each stack pointer address is followed by the size of
579 the data in use in that stack, in bytes. */
580 #ifdef YYLSP_NEEDED
581 /* This used to be a conditional around just the two extra args,
582 but that might be undefined if yyoverflow is a macro. */
583 yyoverflow("parser stack overflow",
584 &yyss1, size * sizeof (*yyssp),
585 &yyvs1, size * sizeof (*yyvsp),
586 &yyls1, size * sizeof (*yylsp),
587 &yystacksize);
588 #else
589 yyoverflow("parser stack overflow",
590 &yyss1, size * sizeof (*yyssp),
591 &yyvs1, size * sizeof (*yyvsp),
592 &yystacksize);
593 #endif
594
595 yyss = yyss1; yyvs = yyvs1;
596 #ifdef YYLSP_NEEDED
597 yyls = yyls1;
598 #endif
599 #else /* no yyoverflow */
600 /* Extend the stack our own way. */
601 if (yystacksize >= YYMAXDEPTH)
602 {
603 yyerror("parser stack overflow");
604 if (yyfree_stacks)
605 {
606 free (yyss);
607 free (yyvs);
608 #ifdef YYLSP_NEEDED
609 free (yyls);
610 #endif
611 }
612 return 2;
613 }
614 yystacksize *= 2;
615 if (yystacksize > YYMAXDEPTH)
616 yystacksize = YYMAXDEPTH;
617 #ifndef YYSTACK_USE_ALLOCA
618 yyfree_stacks = 1;
619 #endif
620 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
621 __yy_memcpy ((char *)yyss, (char *)yyss1,
622 size * (unsigned int) sizeof (*yyssp));
623 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
624 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
625 size * (unsigned int) sizeof (*yyvsp));
626 #ifdef YYLSP_NEEDED
627 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
628 __yy_memcpy ((char *)yyls, (char *)yyls1,
629 size * (unsigned int) sizeof (*yylsp));
630 #endif
631 #endif /* no yyoverflow */
632
633 yyssp = yyss + size - 1;
634 yyvsp = yyvs + size - 1;
635 #ifdef YYLSP_NEEDED
636 yylsp = yyls + size - 1;
637 #endif
638
639 #if YYDEBUG != 0
640 if (yydebug)
641 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
642 #endif
643
644 if (yyssp >= yyss + yystacksize - 1)
645 YYABORT;
646 }
647
648 #if YYDEBUG != 0
649 if (yydebug)
650 fprintf(stderr, "Entering state %d\n", yystate);
651 #endif
652
653 goto yybackup;
654 yybackup:
655
656 /* Do appropriate processing given the current state. */
657 /* Read a lookahead token if we need one and don't already have one. */
658 /* yyresume: */
659
660 /* First try to decide what to do without reference to lookahead token. */
661
662 yyn = yypact[yystate];
663 if (yyn == YYFLAG)
664 goto yydefault;
665
666 /* Not known => get a lookahead token if don't already have one. */
667
668 /* yychar is either YYEMPTY or YYEOF
669 or a valid token in external form. */
670
671 if (yychar == YYEMPTY)
672 {
673 #if YYDEBUG != 0
674 if (yydebug)
675 fprintf(stderr, "Reading a token: ");
676 #endif
677 yychar = YYLEX;
678 }
679
680 /* Convert token to internal form (in yychar1) for indexing tables with */
681
682 if (yychar <= 0) /* This means end of input. */
683 {
684 yychar1 = 0;
685 yychar = YYEOF; /* Don't call YYLEX any more */
686
687 #if YYDEBUG != 0
688 if (yydebug)
689 fprintf(stderr, "Now at end of input.\n");
690 #endif
691 }
692 else
693 {
694 yychar1 = YYTRANSLATE(yychar);
695
696 #if YYDEBUG != 0
697 if (yydebug)
698 {
699 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
700 /* Give the individual parser a way to print the precise meaning
701 of a token, for further debugging info. */
702 #ifdef YYPRINT
703 YYPRINT (stderr, yychar, yylval);
704 #endif
705 fprintf (stderr, ")\n");
706 }
707 #endif
708 }
709
710 yyn += yychar1;
711 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
712 goto yydefault;
713
714 yyn = yytable[yyn];
715
716 /* yyn is what to do for this token type in this state.
717 Negative => reduce, -yyn is rule number.
718 Positive => shift, yyn is new state.
719 New state is final state => don't bother to shift,
720 just return success.
721 0, or most negative number => error. */
722
723 if (yyn < 0)
724 {
725 if (yyn == YYFLAG)
726 goto yyerrlab;
727 yyn = -yyn;
728 goto yyreduce;
729 }
730 else if (yyn == 0)
731 goto yyerrlab;
732
733 if (yyn == YYFINAL)
734 YYACCEPT;
735
736 /* Shift the lookahead token. */
737
738 #if YYDEBUG != 0
739 if (yydebug)
740 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
741 #endif
742
743 /* Discard the token being shifted unless it is eof. */
744 if (yychar != YYEOF)
745 yychar = YYEMPTY;
746
747 *++yyvsp = yylval;
748 #ifdef YYLSP_NEEDED
749 *++yylsp = yylloc;
750 #endif
751
752 /* count tokens shifted since error; after three, turn off error status. */
753 if (yyerrstatus) yyerrstatus--;
754
755 yystate = yyn;
756 goto yynewstate;
757
758 /* Do the default action for the current state. */
759 yydefault:
760
761 yyn = yydefact[yystate];
762 if (yyn == 0)
763 goto yyerrlab;
764
765 /* Do a reduction. yyn is the number of a rule to reduce with. */
766 yyreduce:
767 yylen = yyr2[yyn];
768 if (yylen > 0)
769 yyval = yyvsp[1-yylen]; /* implement default value of the action */
770
771 #if YYDEBUG != 0
772 if (yydebug)
773 {
774 int i;
775
776 fprintf (stderr, "Reducing via rule %d (line %d), ",
777 yyn, yyrline[yyn]);
778
779 /* Print the symbols being reduced, and their result. */
780 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
781 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
782 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
783 }
784 #endif
785
786
787 switch (yyn) {
788
789 case 2:
790 { er_yy_tracelog("parsed something\n"); ;
791 break;}
792 case 3:
793 {
794 MYABORT;
795 ;
796 break;}
797 case 4:
798 {
799 lexerr_t *erst = ypar;
800 strncpy(erst->path.name, yyvsp[0].text, 31);
801 mycleanup(ypar);
802 ;
803 break;}
804 case 5:
805 {
806 lexerr_t *erst = ypar;
807 er_ret_t err;
808
809 erst->path.active = 1;
810 err=er_register_path(&(erst->path), erst->path.name);
811 mycleanup(ypar);
812
813 if( NOERR(err)) {
814 adderr(erst, "created path ");
815 adderr(erst, erst->path.name);
816
817 }
818 else {
819 adderr(erst, "COULD NOT create path ");
820 adderr(erst, erst->path.name);
821 switch( err ) {
822 case ER_DUPENT:
823 adderr(erst, " - duplicate entry");
824 break;
825 }
826 mycleanup(ypar);
827 MYABORT;
828 }
829 ;
830 break;}
831 case 6:
832 {
833 lexerr_t *erst = ypar;
834
835 if( NOERR(er_delete_path(yyvsp[0].text)) ) {
836 adderr(erst, " path removed");
837 mycleanup(ypar);
838 }
839 else {
840 adderr(erst, " COULD NOT remove path ");
841 MYABORT;
842 }
843
844 ;
845 break;}
846 case 7:
847 {
848 lexerr_t *erst = ypar;
849
850 erst->path.active = 1;
851 if( NOERR(er_modify_path(&(erst->path), yyvsp[-1].text))) {
852 adderr(erst, "modified path ");
853 adderr(erst, yyvsp[-1].text);
854 mycleanup(ypar);
855 }
856 else {
857 adderr(erst, " COULD NOT modify path ");
858 adderr(erst, yyvsp[-1].text);
859 MYABORT;
860 }
861 ;
862 break;}
863 case 8:
864 {
865 lexerr_t *erst = ypar;
866
867 if( NOERR(er_delete_filter(yyvsp[-2].text, yyvsp[0].inum))) {
868 adderr(erst, "modified path ");
869 adderr(erst, yyvsp[-2].text);
870 mycleanup(ypar);
871 }
872 else {
873 adderr(erst, " COULD NOT remove filter ");
874 adderr(erst, "from path ");
875 adderr(erst, yyvsp[-2].text);
876 MYABORT;
877 }
878
879 ;
880 break;}
881 case 9:
882 {
883 lexerr_t *erst = ypar;
884
885 if( NOERR(er_attach_filter_chain(yyvsp[-2].text, erst->path.filters ))) {
886 adderr(erst, "modified path ");
887 adderr(erst, yyvsp[-2].text);
888 mycleanup(ypar);
889 }
890 else {
891 adderr(erst, " COULD NOT attach filters to path ");
892 adderr(erst, yyvsp[-2].text);
893 MYABORT;
894 }
895 ;
896 break;}
897 case 10:
898 { yyval.text = yyvsp[0].text; ;
899 break;}
900 case 11:
901 { yyval.text = "AUTO"/* if AUTO then generate a new one */ ;
902 break;}
903 case 12:
904 {
905 er_yy_tracelog("set path");
906 ;
907 break;}
908 case 13:
909 { ;
910 break;}
911 case 14:
912 { ;
913 break;}
914 case 15:
915 { ;
916 break;}
917 case 16:
918 { lexerr_t *erst = ypar;
919 adderr(erst, " - wrong PATH keyword");
920 MYABORT; ;
921 break;}
922 case 18:
923 { lexerr_t *erst = ypar;
924 adderr(erst, " - format spec missing");
925 MYABORT; ;
926 break;}
927 case 21:
928 {
929 lexerr_t *erst = ypar;
930 int mod = er_getformatval(yyvsp[0].text);
931
932 if( mod ) {
933 erst->path.format |= mod;
934 er_yy_tracelog("mode %s = 0x%x\n", yyvsp[0].text, mod);
935 mycleanup(ypar);
936 } else {
937 adderr(erst, " incorrect mode specification: ");
938 adderr(erst, yyvsp[0].text);
939 mycleanup(ypar);
940 MYABORT;
941 }
942 ;
943 break;}
944 case 22:
945 {
946 lexerr_t *erst = ypar;
947 erst->path.type = ER_PATH_SOCK;
948 erst->path.descr.sock.fd = yyvsp[0].inum;
949 er_yy_tracelog("socket. Now check the associated socket\n");
950 ;
951 break;}
952 case 23:
953 {
954 lexerr_t *erst = ypar;
955 erst->path.type = ER_PATH_NAME;
956 er_yy_tracelog("namespec is %s\n", yyvsp[-1].text);
957 strcpy(erst->path.descr.name.filename, yyvsp[-1].text);
958 mycleanup(ypar);
959 ;
960 break;}
961 case 24:
962 { lexerr_t *erst = ypar;
963 adderr(erst, " - filename missing");
964 MYABORT; ;
965 break;}
966 case 26:
967 {
968 lexerr_t *erst = ypar;
969 erst->path.descr.name.date = 1;
970 ;
971 break;}
972 case 27:
973 {
974 lexerr_t *erst = ypar;
975 erst->path.type = ER_PATH_EXEC;
976 ;
977 break;}
978 case 29:
979 {
980 lexerr_t *erst = ypar;
981 erst->path.descr.exec.usepath = 1;
982 ;
983 break;}
984 case 30:
985 { /* first element */
986 lexerr_t *erst = ypar;
987 er_add_exec_arg( &(erst->path), erst->token);
988 mycleanup(ypar);
989 ;
990 break;}
991 case 31:
992 { /* next elements */
993 lexerr_t *erst = ypar;
994 er_add_exec_arg( &(erst->path), erst->token);
995 mycleanup(ypar);
996 ;
997 break;}
998 case 34:
999 { er_yy_tracelog("one more filter done\n"); ;
1000 break;}
1001 case 35:
1002 {
1003 lexerr_t *erst = ypar;
1004 /* add to list */
1005 er_add_filter( &erst->path, &(erst->curfilt));
1006 er_yy_tracelog("added a filter\n");
1007 memset( &(erst->curfilt), 0, sizeof(er_filter_t) );
1008 ;
1009 break;}
1010 case 36:
1011 {;
1012 break;}
1013 case 37:
1014 { lexerr_t *erst = ypar;
1015 adderr(erst, " - bad filter spec");
1016 MYABORT;
1017 ;
1018 break;}
1019 case 38:
1020 {;
1021 break;}
1022 case 39:
1023 {;
1024 break;}
1025 case 41:
1026 {;
1027 break;}
1028 case 43:
1029 {
1030 lexerr_t *erst = ypar;
1031 erst->curfilt.thr_id = pthread_self();
1032 ;
1033 break;}
1034 case 44:
1035 {
1036 lexerr_t *erst = ypar;
1037 erst->curfilt.thr_id = yyvsp[0].inum;
1038 mycleanup(ypar);
1039 ;
1040 break;}
1041 case 46:
1042 {
1043 er_yy_tracelog("added fac to mask\n");
1044 ;
1045 break;}
1046 case 47:
1047 {
1048 lexerr_t *erst = ypar;
1049 erst->curfilt.fac_mask = er_getfacallmask();
1050 ;
1051 break;}
1052 case 48:
1053 {
1054 lexerr_t *erst = ypar;
1055 er_ret_t ef = er_getfacval(yyvsp[0].text);
1056
1057 if( ef ) {
1058 MA_set( &(erst->curfilt.fac_mask), ef, 1);
1059 er_yy_tracelog("fac %s = %x\n", yyvsp[0].text, ef);
1060 mycleanup(ypar);
1061 } else {
1062 adderr(erst, " incorrect fac specification: ");
1063 adderr(erst, yyvsp[0].text);
1064 mycleanup(ypar);
1065 MYABORT;
1066 }
1067 ;
1068 break;}
1069 case 51:
1070 {
1071 mysetsev(ypar, 0, "D")
1072 ;
1073 break;}
1074 case 52:
1075 { if( mysetsev(ypar, 0, yyvsp[0].text) == 0 ) {
1076 MYABORT;
1077 }
1078 ;
1079 break;}
1080 case 53:
1081 {
1082 mysetsev(ypar, 1, "F")
1083 ;
1084 break;}
1085 case 54:
1086 { if( mysetsev(ypar, 1, yyvsp[0].text) == 0 ) {
1087 MYABORT;
1088 }
1089 ;
1090 break;}
1091 case 55:
1092 {
1093 char *cp = strdup(yyvsp[0].text);
1094 if( mysetsev(ypar, 0, yyvsp[0].text) != 0 ) {
1095 mysetsev(ypar, 1, cp);
1096 mycleanup(ypar);
1097 }
1098 else {
1099 free(cp);
1100 MYABORT;
1101 }
1102 ;
1103 break;}
1104 case 57:
1105 {
1106 er_yy_tracelog("added onefac\n");
1107 ;
1108 break;}
1109 case 58:
1110 { lexerr_t *erst = ypar;
1111 er_mask_t em = er_getaspval(yyvsp[0].text);
1112
1113 if(em != 0) {
1114 erst->curfilt.asp_mask |= em;
1115 er_yy_tracelog("asp %s = %x\n", yyvsp[0].text, em);
1116 mycleanup(ypar);
1117 }
1118 else {
1119 adderr(erst, " incorrect asp specification: ");
1120 adderr(erst, yyvsp[0].text);
1121 mycleanup(ypar);
1122 MYABORT;
1123 }
1124 ;
1125 break;}
1126 case 59:
1127 {
1128 lexerr_t *erst = ypar;
1129 erst->curfilt.asp_mask |= yyvsp[0].inum;
1130 mycleanup(ypar);
1131 ;
1132 break;}
1133 }
1134 /* the action file gets copied in in place of this dollarsign */
1135
1136
1137 yyvsp -= yylen;
1138 yyssp -= yylen;
1139 #ifdef YYLSP_NEEDED
1140 yylsp -= yylen;
1141 #endif
1142
1143 #if YYDEBUG != 0
1144 if (yydebug)
1145 {
1146 short *ssp1 = yyss - 1;
1147 fprintf (stderr, "state stack now");
1148 while (ssp1 != yyssp)
1149 fprintf (stderr, " %d", *++ssp1);
1150 fprintf (stderr, "\n");
1151 }
1152 #endif
1153
1154 *++yyvsp = yyval;
1155
1156 #ifdef YYLSP_NEEDED
1157 yylsp++;
1158 if (yylen == 0)
1159 {
1160 yylsp->first_line = yylloc.first_line;
1161 yylsp->first_column = yylloc.first_column;
1162 yylsp->last_line = (yylsp-1)->last_line;
1163 yylsp->last_column = (yylsp-1)->last_column;
1164 yylsp->text = 0;
1165 }
1166 else
1167 {
1168 yylsp->last_line = (yylsp+yylen-1)->last_line;
1169 yylsp->last_column = (yylsp+yylen-1)->last_column;
1170 }
1171 #endif
1172
1173 /* Now "shift" the result of the reduction.
1174 Determine what state that goes to,
1175 based on the state we popped back to
1176 and the rule number reduced by. */
1177
1178 yyn = yyr1[yyn];
1179
1180 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1181 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1182 yystate = yytable[yystate];
1183 else
1184 yystate = yydefgoto[yyn - YYNTBASE];
1185
1186 goto yynewstate;
1187
1188 yyerrlab: /* here on detecting error */
1189
1190 if (! yyerrstatus)
1191 /* If not already recovering from an error, report this error. */
1192 {
1193 ++yynerrs;
1194
1195 #ifdef YYERROR_VERBOSE
1196 yyn = yypact[yystate];
1197
1198 if (yyn > YYFLAG && yyn < YYLAST)
1199 {
1200 int size = 0;
1201 char *msg;
1202 int x, count;
1203
1204 count = 0;
1205 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1206 for (x = (yyn < 0 ? -yyn : 0);
1207 x < (sizeof(yytname) / sizeof(char *)); x++)
1208 if (yycheck[x + yyn] == x)
1209 size += strlen(yytname[x]) + 15, count++;
1210 msg = (char *) malloc(size + 15);
1211 if (msg != 0)
1212 {
1213 strcpy(msg, "parse error");
1214
1215 if (count < 5)
1216 {
1217 count = 0;
1218 for (x = (yyn < 0 ? -yyn : 0);
1219 x < (sizeof(yytname) / sizeof(char *)); x++)
1220 if (yycheck[x + yyn] == x)
1221 {
1222 strcat(msg, count == 0 ? ", expecting `" : " or `");
1223 strcat(msg, yytname[x]);
1224 strcat(msg, "'");
1225 count++;
1226 }
1227 }
1228 yyerror(msg);
1229 free(msg);
1230 }
1231 else
1232 yyerror ("parse error; also virtual memory exceeded");
1233 }
1234 else
1235 #endif /* YYERROR_VERBOSE */
1236 yyerror("parse error");
1237 }
1238
1239 goto yyerrlab1;
1240 yyerrlab1: /* here on error raised explicitly by an action */
1241
1242 if (yyerrstatus == 3)
1243 {
1244 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1245
1246 /* return failure if at end of input */
1247 if (yychar == YYEOF)
1248 YYABORT;
1249
1250 #if YYDEBUG != 0
1251 if (yydebug)
1252 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1253 #endif
1254
1255 yychar = YYEMPTY;
1256 }
1257
1258 /* Else will try to reuse lookahead token
1259 after shifting the error token. */
1260
1261 yyerrstatus = 3; /* Each real token shifted decrements this */
1262
1263 goto yyerrhandle;
1264
1265 yyerrdefault: /* current state does not do anything special for the error token. */
1266
1267 #if 0
1268 /* This is wrong; only states that explicitly want error tokens
1269 should shift them. */
1270 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1271 if (yyn) goto yydefault;
1272 #endif
1273
1274 yyerrpop: /* pop the current state because it cannot handle the error token */
1275
1276 if (yyssp == yyss) YYABORT;
1277 yyvsp--;
1278 yystate = *--yyssp;
1279 #ifdef YYLSP_NEEDED
1280 yylsp--;
1281 #endif
1282
1283 #if YYDEBUG != 0
1284 if (yydebug)
1285 {
1286 short *ssp1 = yyss - 1;
1287 fprintf (stderr, "Error: state stack now");
1288 while (ssp1 != yyssp)
1289 fprintf (stderr, " %d", *++ssp1);
1290 fprintf (stderr, "\n");
1291 }
1292 #endif
1293
1294 yyerrhandle:
1295
1296 yyn = yypact[yystate];
1297 if (yyn == YYFLAG)
1298 goto yyerrdefault;
1299
1300 yyn += YYTERROR;
1301 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1302 goto yyerrdefault;
1303
1304 yyn = yytable[yyn];
1305 if (yyn < 0)
1306 {
1307 if (yyn == YYFLAG)
1308 goto yyerrpop;
1309 yyn = -yyn;
1310 goto yyreduce;
1311 }
1312 else if (yyn == 0)
1313 goto yyerrpop;
1314
1315 if (yyn == YYFINAL)
1316 YYACCEPT;
1317
1318 #if YYDEBUG != 0
1319 if (yydebug)
1320 fprintf(stderr, "Shifting error token, ");
1321 #endif
1322
1323 *++yyvsp = yylval;
1324 #ifdef YYLSP_NEEDED
1325 *++yylsp = yylloc;
1326 #endif
1327
1328 yystate = yyn;
1329 goto yynewstate;
1330
1331 yyacceptlab:
1332 /* YYACCEPT comes here. */
1333 if (yyfree_stacks)
1334 {
1335 free (yyss);
1336 free (yyvs);
1337 #ifdef YYLSP_NEEDED
1338 free (yyls);
1339 #endif
1340 }
1341 return 0;
1342
1343 yyabortlab:
1344 /* YYABORT comes here. */
1345 if (yyfree_stacks)
1346 {
1347 free (yyss);
1348 free (yyvs);
1349 #ifdef YYLSP_NEEDED
1350 free (yyls);
1351 #endif
1352 }
1353 return 1;
1354 }
1355
1356
1357 #include "er_yacc_helper.inc"