source: trunk/gsdl/src/recpt/zparse.tab.c@ 1870

Last change on this file since 1870 was 1450, checked in by jrm21, 24 years ago

re-added a mistakenly deleted initialiser to zserver in zparse.y for next (!?!)

  • Property svn:keywords set to Author Date Id Revision
File size: 30.9 KB
Line 
1
2/* A Bison parser, made from zparse.y
3 by GNU Bison version 1.27
4 */
5
6#define YYBISON 1 /* Identify Bison output. */
7
8#define GSDLVERSION 257
9#define GENERAL_SECTION 258
10#define SEARCH_SECTION 259
11#define BROWSE_SECTION 260
12#define MACROS_SECTION 261
13#define MAINTAINER 262
14#define PUBLIC 263
15#define TRUE 264
16#define FALSE 265
17#define LANGUAGES 266
18#define EN 267
19#define FR 268
20#define MI 269
21#define ZH 270
22#define DE 271
23#define NAME 272
24#define STRING 273
25#define ICON 274
26#define SMALLICON 275
27#define ABOUT 276
28#define SEARCHTEXT 277
29#define DOCUMENT 278
30#define SECTION 279
31#define BROWSE 280
32#define TYPE 281
33#define FORMAT 282
34#define LIST 283
35#define SORTEDLIST 284
36#define SECTIONLIST 285
37#define SORTEDSECTIONLIST 286
38#define DATELIST 287
39#define ICONLINK 288
40#define TEXTLINK 289
41#define DOCUMENTIMAGES 290
42#define DOCUMENTHEADER 291
43#define DOCUMENTTEXT 292
44#define DOCUMENTBUTTONS 293
45#define DOCUMENTARROWSBOTTOM 294
46#define DATA 295
47
48#line 27 "zparse.y"
49
50 /* verbatim C code - functions, etc */
51#include <stdlib.h>
52#include <stdio.h>
53#include <string.h>
54#include <ctype.h>
55#include "z3950cfg.h"
56
57#define YYDEBUG 1
58#define YYERROR_VERBOSE 1
59/* can't use default yyparse(), as this name is used elsewhere (eg mg)*/
60#define yyin zconfigin
61#define yyparse zconfigparse
62char defLanguage=0;
63
64/* defined in parse.fl */
65extern int lineno;
66
67#ifndef YYRECOVERING
68int YYRECOVERING=0; /* this is supposed to already be defined as a macro */
69#endif
70
71/* defined in z3950proto.cpp */
72struct z3950cfg *zserver_list=NULL;
73
74/* this is set in z3950proto.cpp */
75FILE *errfile;
76
77int yylex(void);
78
79int yyerror(char *string);
80
81void errormsg(char *str);
82
83
84#line 64 "zparse.y"
85typedef union {
86 char *string;
87 struct z3950cfg *cfg;
88 struct z3950aboutlist *about;
89 int number;
90} YYSTYPE;
91#include <stdio.h>
92
93#ifndef __cplusplus
94#ifndef __STDC__
95#define const
96#endif
97#endif
98
99
100
101#define YYFINAL 37
102#define YYFLAG -32768
103#define YYNTBASE 44
104
105#define YYTRANSLATE(x) ((unsigned)(x) <= 295 ? yytranslate[x] : 56)
106
107static const char yytranslate[] = { 0,
108 2, 2, 2, 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, 42, 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, 43, 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, 2, 2, 2, 2, 2,
122 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
123 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
124 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
125 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
126 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
127 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
128 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
129 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
130 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
131 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
132 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
133 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
134 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
135 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
136 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
137 37, 38, 39, 40, 41
138};
139
140#if YYDEBUG != 0
141static const short yyprhs[] = { 0,
142 0, 3, 5, 7, 8, 11, 13, 22, 24, 26,
143 27, 30, 31, 34, 37, 38, 41, 44, 45, 47,
144 48, 50, 53, 57, 60, 64, 66
145};
146
147static const short yyrhs[] = { 45,
148 46, 0, 45, 0, 3, 0, 0, 46, 47, 0,
149 47, 0, 41, 41, 49, 41, 48, 50, 51, 52,
150 0, 1, 0, 19, 0, 0, 42, 41, 0, 0,
151 20, 19, 0, 20, 41, 0, 0, 21, 19, 0,
152 21, 41, 0, 0, 53, 0, 0, 54, 0, 53,
153 54, 0, 22, 55, 19, 0, 22, 19, 0, 41,
154 43, 41, 0, 41, 0, 1, 0
155};
156
157#endif
158
159#if YYDEBUG != 0
160static const short yyrline[] = { 0,
161 109, 110, 113, 114, 116, 117, 119, 140, 144, 145,
162 150, 151, 154, 155, 158, 159, 160, 165, 167, 168,
163 170, 172, 175, 186, 208, 216, 224
164};
165#endif
166
167
168#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
169
170static const char * const yytname[] = { "$","error","$undefined.","GSDLVERSION",
171"GENERAL_SECTION","SEARCH_SECTION","BROWSE_SECTION","MACROS_SECTION","MAINTAINER",
172"PUBLIC","TRUE","FALSE","LANGUAGES","EN","FR","MI","ZH","DE","NAME","STRING",
173"ICON","SMALLICON","ABOUT","SEARCHTEXT","DOCUMENT","SECTION","BROWSE","TYPE",
174"FORMAT","LIST","SORTEDLIST","SECTIONLIST","SORTEDSECTIONLIST","DATELIST","ICONLINK",
175"TEXTLINK","DOCUMENTIMAGES","DOCUMENTHEADER","DOCUMENTTEXT","DOCUMENTBUTTONS",
176"DOCUMENTARROWSBOTTOM","DATA","':'","'_'","z3950","version","zserverlist","zserver",
177"name","port","icon","smallicon","about","aboutList","aboutLang","lang", NULL
178};
179#endif
180
181static const short yyr1[] = { 0,
182 44, 44, 45, 45, 46, 46, 47, 47, 48, 48,
183 49, 49, 50, 50, 50, 51, 51, 51, 52, 52,
184 53, 53, 54, 54, 55, 55, 55
185};
186
187static const short yyr2[] = { 0,
188 2, 1, 1, 0, 2, 1, 8, 1, 1, 0,
189 2, 0, 2, 2, 0, 2, 2, 0, 1, 0,
190 1, 2, 3, 2, 3, 1, 1
191};
192
193static const short yydefact[] = { 4,
194 3, 0, 8, 0, 0, 6, 12, 5, 0, 0,
195 11, 10, 9, 15, 0, 18, 13, 14, 0, 20,
196 16, 17, 0, 7, 19, 21, 27, 24, 26, 0,
197 22, 0, 23, 25, 0, 0, 0
198};
199
200static const short yydefgoto[] = { 35,
201 2, 5, 6, 14, 10, 16, 20, 24, 25, 26,
202 30
203};
204
205static const short yypact[] = { 4,
206-32768, 0,-32768, -33, 2,-32768, -32,-32768, -30, -29,
207-32768, -10,-32768, -7, -14, -6,-32768,-32768, -13, -8,
208-32768,-32768, 3,-32768, -8,-32768,-32768,-32768, -27, -2,
209-32768, -23,-32768,-32768, 19, 20,-32768
210};
211
212static const short yypgoto[] = {-32768,
213-32768,-32768, 16,-32768,-32768,-32768,-32768,-32768,-32768, -1,
214-32768
215};
216
217
218#define YYLAST 44
219
220
221static const short yytable[] = { -2,
222 3, -1, 3, 27, 17, 21, 1, 7, 13, 9,
223 11, 12, 15, 23, 19, 32, 33, 34, 36, 37,
224 8, 28, 0, 31, 0, 0, 18, 22, 0, 0,
225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
226 4, 0, 4, 29
227};
228
229static const short yycheck[] = { 0,
230 1, 0, 1, 1, 19, 19, 3, 41, 19, 42,
231 41, 41, 20, 22, 21, 43, 19, 41, 0, 0,
232 5, 19, -1, 25, -1, -1, 41, 41, -1, -1,
233 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
234 41, -1, 41, 41
235};
236/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
237#line 3 "/usr/share/bison.simple"
238/* This file comes from bison-1.27. */
239
240/* Skeleton output parser for bison,
241 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
242
243 This program is free software; you can redistribute it and/or modify
244 it under the terms of the GNU General Public License as published by
245 the Free Software Foundation; either version 2, or (at your option)
246 any later version.
247
248 This program is distributed in the hope that it will be useful,
249 but WITHOUT ANY WARRANTY; without even the implied warranty of
250 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
251 GNU General Public License for more details.
252
253 You should have received a copy of the GNU General Public License
254 along with this program; if not, write to the Free Software
255 Foundation, Inc., 59 Temple Place - Suite 330,
256 Boston, MA 02111-1307, USA. */
257
258/* As a special exception, when this file is copied by Bison into a
259 Bison output file, you may use that output file without restriction.
260 This special exception was added by the Free Software Foundation
261 in version 1.24 of Bison. */
262
263/* This is the parser code that is written into each bison parser
264 when the %semantic_parser declaration is not specified in the grammar.
265 It was written by Richard Stallman by simplifying the hairy parser
266 used when %semantic_parser is specified. */
267
268#ifndef YYSTACK_USE_ALLOCA
269#ifdef alloca
270#define YYSTACK_USE_ALLOCA
271#else /* alloca not defined */
272#ifdef __GNUC__
273#define YYSTACK_USE_ALLOCA
274#define alloca __builtin_alloca
275#else /* not GNU C. */
276#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
277#define YYSTACK_USE_ALLOCA
278#include <alloca.h>
279#else /* not sparc */
280/* We think this test detects Watcom and Microsoft C. */
281/* This used to test MSDOS, but that is a bad idea
282 since that symbol is in the user namespace. */
283#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
284#if 0 /* No need for malloc.h, which pollutes the namespace;
285 instead, just don't use alloca. */
286#include <malloc.h>
287#endif
288#else /* not MSDOS, or __TURBOC__ */
289#if defined(_AIX)
290/* I don't know what this was needed for, but it pollutes the namespace.
291 So I turned it off. rms, 2 May 1997. */
292/* #include <malloc.h> */
293 #pragma alloca
294#define YYSTACK_USE_ALLOCA
295#else /* not MSDOS, or __TURBOC__, or _AIX */
296#if 0
297#ifdef __hpux /* [email protected] says this works for HPUX 9.05 and up,
298 and on HPUX 10. Eventually we can turn this on. */
299#define YYSTACK_USE_ALLOCA
300#define alloca __builtin_alloca
301#endif /* __hpux */
302#endif
303#endif /* not _AIX */
304#endif /* not MSDOS, or __TURBOC__ */
305#endif /* not sparc */
306#endif /* not GNU C */
307#endif /* alloca not defined */
308#endif /* YYSTACK_USE_ALLOCA not defined */
309
310#ifdef YYSTACK_USE_ALLOCA
311#define YYSTACK_ALLOC alloca
312#else
313#define YYSTACK_ALLOC malloc
314#endif
315
316/* Note: there must be only one dollar sign in this file.
317 It is replaced by the list of actions, each action
318 as one case of the switch. */
319
320#define yyerrok (yyerrstatus = 0)
321#define yyclearin (yychar = YYEMPTY)
322#define YYEMPTY -2
323#define YYEOF 0
324#define YYACCEPT goto yyacceptlab
325#define YYABORT goto yyabortlab
326#define YYERROR goto yyerrlab1
327/* Like YYERROR except do call yyerror.
328 This remains here temporarily to ease the
329 transition to the new meaning of YYERROR, for GCC.
330 Once GCC version 2 has supplanted version 1, this can go. */
331#define YYFAIL goto yyerrlab
332#define YYRECOVERING() (!!yyerrstatus)
333#define YYBACKUP(token, value) \
334do \
335 if (yychar == YYEMPTY && yylen == 1) \
336 { yychar = (token), yylval = (value); \
337 yychar1 = YYTRANSLATE (yychar); \
338 YYPOPSTACK; \
339 goto yybackup; \
340 } \
341 else \
342 { yyerror ("syntax error: cannot back up"); YYERROR; } \
343while (0)
344
345#define YYTERROR 1
346#define YYERRCODE 256
347
348#ifndef YYPURE
349#define YYLEX yylex()
350#endif
351
352#ifdef YYPURE
353#ifdef YYLSP_NEEDED
354#ifdef YYLEX_PARAM
355#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
356#else
357#define YYLEX yylex(&yylval, &yylloc)
358#endif
359#else /* not YYLSP_NEEDED */
360#ifdef YYLEX_PARAM
361#define YYLEX yylex(&yylval, YYLEX_PARAM)
362#else
363#define YYLEX yylex(&yylval)
364#endif
365#endif /* not YYLSP_NEEDED */
366#endif
367
368/* If nonreentrant, generate the variables here */
369
370#ifndef YYPURE
371
372int yychar; /* the lookahead symbol */
373YYSTYPE yylval; /* the semantic value of the */
374 /* lookahead symbol */
375
376#ifdef YYLSP_NEEDED
377YYLTYPE yylloc; /* location data for the lookahead */
378 /* symbol */
379#endif
380
381int yynerrs; /* number of parse errors so far */
382#endif /* not YYPURE */
383
384#if YYDEBUG != 0
385int yydebug; /* nonzero means print parse trace */
386/* Since this is uninitialized, it does not stop multiple parsers
387 from coexisting. */
388#endif
389
390/* YYINITDEPTH indicates the initial size of the parser's stacks */
391
392#ifndef YYINITDEPTH
393#define YYINITDEPTH 200
394#endif
395
396/* YYMAXDEPTH is the maximum size the stacks can grow to
397 (effective only if the built-in stack extension method is used). */
398
399#if YYMAXDEPTH == 0
400#undef YYMAXDEPTH
401#endif
402
403#ifndef YYMAXDEPTH
404#define YYMAXDEPTH 10000
405#endif
406
407
408/* Define __yy_memcpy. Note that the size argument
409 should be passed with type unsigned int, because that is what the non-GCC
410 definitions require. With GCC, __builtin_memcpy takes an arg
411 of type size_t, but it can handle unsigned int. */
412
413#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
414#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
415#else /* not GNU C or C++ */
416#ifndef __cplusplus
417
418/* This is the most reliable way to avoid incompatibilities
419 in available built-in functions on various systems. */
420static void
421__yy_memcpy (to, from, count)
422 char *to;
423 char *from;
424 unsigned int count;
425{
426 register char *f = from;
427 register char *t = to;
428 register int i = count;
429
430 while (i-- > 0)
431 *t++ = *f++;
432}
433
434#else /* __cplusplus */
435
436/* This is the most reliable way to avoid incompatibilities
437 in available built-in functions on various systems. */
438static void
439__yy_memcpy (char *to, char *from, unsigned int count)
440{
441 register char *t = to;
442 register char *f = from;
443 register int i = count;
444
445 while (i-- > 0)
446 *t++ = *f++;
447}
448
449#endif
450#endif
451
452
453#line 216 "/usr/share/bison.simple"
454
455/* The user can define YYPARSE_PARAM as the name of an argument to be passed
456 into yyparse. The argument should have type void *.
457 It should actually point to an object.
458 Grammar actions can access the variable by casting it
459 to the proper pointer type. */
460
461#ifdef YYPARSE_PARAM
462#ifdef __cplusplus
463#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
464#define YYPARSE_PARAM_DECL
465#else /* not __cplusplus */
466#define YYPARSE_PARAM_ARG YYPARSE_PARAM
467#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
468#endif /* not __cplusplus */
469#else /* not YYPARSE_PARAM */
470#define YYPARSE_PARAM_ARG
471#define YYPARSE_PARAM_DECL
472#endif /* not YYPARSE_PARAM */
473
474/* Prevent warning if -Wstrict-prototypes. */
475#ifdef __GNUC__
476#ifdef YYPARSE_PARAM
477int yyparse (void *);
478#else
479int yyparse (void);
480#endif
481#endif
482
483int
484yyparse(YYPARSE_PARAM_ARG)
485 YYPARSE_PARAM_DECL
486{
487 register int yystate;
488 register int yyn;
489 register short *yyssp;
490 register YYSTYPE *yyvsp;
491 int yyerrstatus; /* number of tokens to shift before error messages enabled */
492 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
493
494 short yyssa[YYINITDEPTH]; /* the state stack */
495 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
496
497 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
498 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
499
500#ifdef YYLSP_NEEDED
501 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
502 YYLTYPE *yyls = yylsa;
503 YYLTYPE *yylsp;
504
505#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
506#else
507#define YYPOPSTACK (yyvsp--, yyssp--)
508#endif
509
510 int yystacksize = YYINITDEPTH;
511 int yyfree_stacks = 0;
512
513#ifdef YYPURE
514 int yychar;
515 YYSTYPE yylval;
516 int yynerrs;
517#ifdef YYLSP_NEEDED
518 YYLTYPE yylloc;
519#endif
520#endif
521
522 YYSTYPE yyval; /* the variable used to return */
523 /* semantic values from the action */
524 /* routines */
525
526 int yylen;
527
528#if YYDEBUG != 0
529 if (yydebug)
530 fprintf(stderr, "Starting parse\n");
531#endif
532
533 yystate = 0;
534 yyerrstatus = 0;
535 yynerrs = 0;
536 yychar = YYEMPTY; /* Cause a token to be read. */
537
538 /* Initialize stack pointers.
539 Waste one element of value and location stack
540 so that they stay on the same level as the state stack.
541 The wasted elements are never initialized. */
542
543 yyssp = yyss - 1;
544 yyvsp = yyvs;
545#ifdef YYLSP_NEEDED
546 yylsp = yyls;
547#endif
548
549/* Push a new state, which is found in yystate . */
550/* In all cases, when you get here, the value and location stacks
551 have just been pushed. so pushing a state here evens the stacks. */
552yynewstate:
553
554 *++yyssp = yystate;
555
556 if (yyssp >= yyss + yystacksize - 1)
557 {
558 /* Give user a chance to reallocate the stack */
559 /* Use copies of these so that the &'s don't force the real ones into memory. */
560 YYSTYPE *yyvs1 = yyvs;
561 short *yyss1 = yyss;
562#ifdef YYLSP_NEEDED
563 YYLTYPE *yyls1 = yyls;
564#endif
565
566 /* Get the current used size of the three stacks, in elements. */
567 int size = yyssp - yyss + 1;
568
569#ifdef yyoverflow
570 /* Each stack pointer address is followed by the size of
571 the data in use in that stack, in bytes. */
572#ifdef YYLSP_NEEDED
573 /* This used to be a conditional around just the two extra args,
574 but that might be undefined if yyoverflow is a macro. */
575 yyoverflow("parser stack overflow",
576 &yyss1, size * sizeof (*yyssp),
577 &yyvs1, size * sizeof (*yyvsp),
578 &yyls1, size * sizeof (*yylsp),
579 &yystacksize);
580#else
581 yyoverflow("parser stack overflow",
582 &yyss1, size * sizeof (*yyssp),
583 &yyvs1, size * sizeof (*yyvsp),
584 &yystacksize);
585#endif
586
587 yyss = yyss1; yyvs = yyvs1;
588#ifdef YYLSP_NEEDED
589 yyls = yyls1;
590#endif
591#else /* no yyoverflow */
592 /* Extend the stack our own way. */
593 if (yystacksize >= YYMAXDEPTH)
594 {
595 yyerror("parser stack overflow");
596 if (yyfree_stacks)
597 {
598 free (yyss);
599 free (yyvs);
600#ifdef YYLSP_NEEDED
601 free (yyls);
602#endif
603 }
604 return 2;
605 }
606 yystacksize *= 2;
607 if (yystacksize > YYMAXDEPTH)
608 yystacksize = YYMAXDEPTH;
609#ifndef YYSTACK_USE_ALLOCA
610 yyfree_stacks = 1;
611#endif
612 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
613 __yy_memcpy ((char *)yyss, (char *)yyss1,
614 size * (unsigned int) sizeof (*yyssp));
615 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
616 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
617 size * (unsigned int) sizeof (*yyvsp));
618#ifdef YYLSP_NEEDED
619 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
620 __yy_memcpy ((char *)yyls, (char *)yyls1,
621 size * (unsigned int) sizeof (*yylsp));
622#endif
623#endif /* no yyoverflow */
624
625 yyssp = yyss + size - 1;
626 yyvsp = yyvs + size - 1;
627#ifdef YYLSP_NEEDED
628 yylsp = yyls + size - 1;
629#endif
630
631#if YYDEBUG != 0
632 if (yydebug)
633 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
634#endif
635
636 if (yyssp >= yyss + yystacksize - 1)
637 YYABORT;
638 }
639
640#if YYDEBUG != 0
641 if (yydebug)
642 fprintf(stderr, "Entering state %d\n", yystate);
643#endif
644
645 goto yybackup;
646 yybackup:
647
648/* Do appropriate processing given the current state. */
649/* Read a lookahead token if we need one and don't already have one. */
650/* yyresume: */
651
652 /* First try to decide what to do without reference to lookahead token. */
653
654 yyn = yypact[yystate];
655 if (yyn == YYFLAG)
656 goto yydefault;
657
658 /* Not known => get a lookahead token if don't already have one. */
659
660 /* yychar is either YYEMPTY or YYEOF
661 or a valid token in external form. */
662
663 if (yychar == YYEMPTY)
664 {
665#if YYDEBUG != 0
666 if (yydebug)
667 fprintf(stderr, "Reading a token: ");
668#endif
669 yychar = YYLEX;
670 }
671
672 /* Convert token to internal form (in yychar1) for indexing tables with */
673
674 if (yychar <= 0) /* This means end of input. */
675 {
676 yychar1 = 0;
677 yychar = YYEOF; /* Don't call YYLEX any more */
678
679#if YYDEBUG != 0
680 if (yydebug)
681 fprintf(stderr, "Now at end of input.\n");
682#endif
683 }
684 else
685 {
686 yychar1 = YYTRANSLATE(yychar);
687
688#if YYDEBUG != 0
689 if (yydebug)
690 {
691 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
692 /* Give the individual parser a way to print the precise meaning
693 of a token, for further debugging info. */
694#ifdef YYPRINT
695 YYPRINT (stderr, yychar, yylval);
696#endif
697 fprintf (stderr, ")\n");
698 }
699#endif
700 }
701
702 yyn += yychar1;
703 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
704 goto yydefault;
705
706 yyn = yytable[yyn];
707
708 /* yyn is what to do for this token type in this state.
709 Negative => reduce, -yyn is rule number.
710 Positive => shift, yyn is new state.
711 New state is final state => don't bother to shift,
712 just return success.
713 0, or most negative number => error. */
714
715 if (yyn < 0)
716 {
717 if (yyn == YYFLAG)
718 goto yyerrlab;
719 yyn = -yyn;
720 goto yyreduce;
721 }
722 else if (yyn == 0)
723 goto yyerrlab;
724
725 if (yyn == YYFINAL)
726 YYACCEPT;
727
728 /* Shift the lookahead token. */
729
730#if YYDEBUG != 0
731 if (yydebug)
732 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
733#endif
734
735 /* Discard the token being shifted unless it is eof. */
736 if (yychar != YYEOF)
737 yychar = YYEMPTY;
738
739 *++yyvsp = yylval;
740#ifdef YYLSP_NEEDED
741 *++yylsp = yylloc;
742#endif
743
744 /* count tokens shifted since error; after three, turn off error status. */
745 if (yyerrstatus) yyerrstatus--;
746
747 yystate = yyn;
748 goto yynewstate;
749
750/* Do the default action for the current state. */
751yydefault:
752
753 yyn = yydefact[yystate];
754 if (yyn == 0)
755 goto yyerrlab;
756
757/* Do a reduction. yyn is the number of a rule to reduce with. */
758yyreduce:
759 yylen = yyr2[yyn];
760 if (yylen > 0)
761 yyval = yyvsp[1-yylen]; /* implement default value of the action */
762
763#if YYDEBUG != 0
764 if (yydebug)
765 {
766 int i;
767
768 fprintf (stderr, "Reducing via rule %d (line %d), ",
769 yyn, yyrline[yyn]);
770
771 /* Print the symbols being reduced, and their result. */
772 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
773 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
774 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
775 }
776#endif
777
778
779 switch (yyn) {
780
781case 1:
782#line 109 "zparse.y"
783{zserver_list=yyvsp[0].cfg;;
784 break;}
785case 2:
786#line 110 "zparse.y"
787{zserver_list=NULL;;
788 break;}
789case 3:
790#line 113 "zparse.y"
791{;;
792 break;}
793case 4:
794#line 114 "zparse.y"
795{fprintf(errfile,"No version - not GSDL config file?\n");return(1);;
796 break;}
797case 5:
798#line 116 "zparse.y"
799{if (yyvsp[0].cfg!=NULL) {yyvsp[0].cfg->next=yyvsp[-1].cfg;yyval.cfg=yyvsp[0].cfg;};
800 break;}
801case 7:
802#line 120 "zparse.y"
803{
804 if (YYRECOVERING)
805 {yyval.cfg=NULL;YYRECOVERING=0;}
806 else {
807 if((yyval.cfg=malloc(sizeof(struct z3950cfg)))==NULL)
808 {
809 fprintf(errfile,"malloc failed\n");
810 return(1);
811 }
812 yyval.cfg->shortname=yyvsp[-7].string;
813 yyval.cfg->hostname=yyvsp[-6].string;
814 yyval.cfg->port=yyvsp[-5].number;
815 yyval.cfg->dbname=yyvsp[-4].string;
816 yyval.cfg->longname=yyvsp[-3].string;
817 yyval.cfg->icon=yyvsp[-2].string;
818 yyval.cfg->smallicon=yyvsp[-1].string;
819 yyval.cfg->about=yyvsp[0].about;
820 yyval.cfg->next=NULL;
821 }
822 ;
823 break;}
824case 8:
825#line 140 "zparse.y"
826{yyval.cfg=NULL;
827 fprintf(errfile,"discarding zserver (line %d)\n",lineno);;
828 break;}
829case 9:
830#line 144 "zparse.y"
831{;;
832 break;}
833case 10:
834#line 145 "zparse.y"
835{errormsg("Database name needs to be followed by a short "
836 "descriptive name (enclosed in \" marks)");
837 yyval.string=NULL;
838 YYRECOVERING=1;;
839 break;}
840case 11:
841#line 150 "zparse.y"
842{yyval.number=atoi(yyvsp[0].string);;
843 break;}
844case 12:
845#line 151 "zparse.y"
846{yyval.number=210;;
847 break;}
848case 13:
849#line 154 "zparse.y"
850{yyval.string=yyvsp[0].string;;
851 break;}
852case 14:
853#line 155 "zparse.y"
854{yyval.string=yyvsp[0].string;
855 errormsg("Icon must be enclosed in quotes");
856 yylex();yylex();;
857 break;}
858case 15:
859#line 158 "zparse.y"
860{yyval.string=NULL;;
861 break;}
862case 16:
863#line 159 "zparse.y"
864{yyval.string=yyvsp[0].string;;
865 break;}
866case 17:
867#line 160 "zparse.y"
868{yyval.string=yyvsp[0].string;
869 /* this is because of the ':' */
870 errormsg("Smallicon must be enclosed in quotes.\n");
871 yylex();yylex();
872 ;
873 break;}
874case 18:
875#line 165 "zparse.y"
876{yyval.string=NULL;;
877 break;}
878case 19:
879#line 167 "zparse.y"
880{defLanguage=0;;
881 break;}
882case 20:
883#line 168 "zparse.y"
884{yyval.about=NULL;;
885 break;}
886case 21:
887#line 170 "zparse.y"
888{;;
889 break;}
890case 22:
891#line 172 "zparse.y"
892{yyval.about=yyvsp[0].about;yyvsp[0].about->next=yyvsp[-1].about;;
893 break;}
894case 23:
895#line 176 "zparse.y"
896{
897 if((yyval.about=malloc(sizeof(struct z3950aboutlist)))
898 ==NULL) {
899 fprintf(errfile,"Malloc failed\n");
900 return(1);
901 }
902 yyval.about->lang=yyvsp[-1].string;
903 yyval.about->text=yyvsp[0].string;
904 yyval.about->next=NULL;
905 ;
906 break;}
907case 24:
908#line 187 "zparse.y"
909{
910 if (defLanguage)
911 {
912 fprintf(errfile,"warning: (line %d): already have a default language in config file\n",lineno);
913 }
914 else defLanguage=1;
915
916 if((yyval.about=malloc(sizeof(struct z3950aboutlist)))
917 ==NULL) {
918 fprintf(errfile,"Malloc failed\n");
919 return(1);
920 }
921 yyval.about->lang=NULL; /* default lang... */
922 yyval.about->text=yyvsp[0].string;
923 yyval.about->next=NULL;
924 ;
925 break;}
926case 25:
927#line 209 "zparse.y"
928{
929 yyval.string=malloc(strlen(yyvsp[-2].string)+strlen(yyvsp[0].string)+1);
930 strncpy(yyval.string,yyvsp[-2].string,strlen(yyvsp[-2].string));
931 yyval.string[strlen(yyvsp[-2].string)]='_';
932 strncpy(yyval.string+strlen(yyvsp[-2].string)+1,yyvsp[0].string,strlen(yyvsp[0].string));
933 free(yyvsp[-2].string);free(yyvsp[0].string);
934 ;
935 break;}
936case 26:
937#line 216 "zparse.y"
938{;;
939 break;}
940case 27:
941#line 224 "zparse.y"
942{errormsg("missing language");;
943 break;}
944}
945 /* the action file gets copied in in place of this dollarsign */
946#line 542 "/usr/share/bison.simple"
947
948
949 yyvsp -= yylen;
950 yyssp -= yylen;
951#ifdef YYLSP_NEEDED
952 yylsp -= yylen;
953#endif
954
955#if YYDEBUG != 0
956 if (yydebug)
957 {
958 short *ssp1 = yyss - 1;
959 fprintf (stderr, "state stack now");
960 while (ssp1 != yyssp)
961 fprintf (stderr, " %d", *++ssp1);
962 fprintf (stderr, "\n");
963 }
964#endif
965
966 *++yyvsp = yyval;
967
968#ifdef YYLSP_NEEDED
969 yylsp++;
970 if (yylen == 0)
971 {
972 yylsp->first_line = yylloc.first_line;
973 yylsp->first_column = yylloc.first_column;
974 yylsp->last_line = (yylsp-1)->last_line;
975 yylsp->last_column = (yylsp-1)->last_column;
976 yylsp->text = 0;
977 }
978 else
979 {
980 yylsp->last_line = (yylsp+yylen-1)->last_line;
981 yylsp->last_column = (yylsp+yylen-1)->last_column;
982 }
983#endif
984
985 /* Now "shift" the result of the reduction.
986 Determine what state that goes to,
987 based on the state we popped back to
988 and the rule number reduced by. */
989
990 yyn = yyr1[yyn];
991
992 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
993 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
994 yystate = yytable[yystate];
995 else
996 yystate = yydefgoto[yyn - YYNTBASE];
997
998 goto yynewstate;
999
1000yyerrlab: /* here on detecting error */
1001
1002 if (! yyerrstatus)
1003 /* If not already recovering from an error, report this error. */
1004 {
1005 ++yynerrs;
1006
1007#ifdef YYERROR_VERBOSE
1008 yyn = yypact[yystate];
1009
1010 if (yyn > YYFLAG && yyn < YYLAST)
1011 {
1012 int size = 0;
1013 char *msg;
1014 int x, count;
1015
1016 count = 0;
1017 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1018 for (x = (yyn < 0 ? -yyn : 0);
1019 x < (sizeof(yytname) / sizeof(char *)); x++)
1020 if (yycheck[x + yyn] == x)
1021 size += strlen(yytname[x]) + 15, count++;
1022 msg = (char *) malloc(size + 15);
1023 if (msg != 0)
1024 {
1025 strcpy(msg, "parse error");
1026
1027 if (count < 5)
1028 {
1029 count = 0;
1030 for (x = (yyn < 0 ? -yyn : 0);
1031 x < (sizeof(yytname) / sizeof(char *)); x++)
1032 if (yycheck[x + yyn] == x)
1033 {
1034 strcat(msg, count == 0 ? ", expecting `" : " or `");
1035 strcat(msg, yytname[x]);
1036 strcat(msg, "'");
1037 count++;
1038 }
1039 }
1040 yyerror(msg);
1041 free(msg);
1042 }
1043 else
1044 yyerror ("parse error; also virtual memory exceeded");
1045 }
1046 else
1047#endif /* YYERROR_VERBOSE */
1048 yyerror("parse error");
1049 }
1050
1051 goto yyerrlab1;
1052yyerrlab1: /* here on error raised explicitly by an action */
1053
1054 if (yyerrstatus == 3)
1055 {
1056 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1057
1058 /* return failure if at end of input */
1059 if (yychar == YYEOF)
1060 YYABORT;
1061
1062#if YYDEBUG != 0
1063 if (yydebug)
1064 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1065#endif
1066
1067 yychar = YYEMPTY;
1068 }
1069
1070 /* Else will try to reuse lookahead token
1071 after shifting the error token. */
1072
1073 yyerrstatus = 3; /* Each real token shifted decrements this */
1074
1075 goto yyerrhandle;
1076
1077yyerrdefault: /* current state does not do anything special for the error token. */
1078
1079#if 0
1080 /* This is wrong; only states that explicitly want error tokens
1081 should shift them. */
1082 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1083 if (yyn) goto yydefault;
1084#endif
1085
1086yyerrpop: /* pop the current state because it cannot handle the error token */
1087
1088 if (yyssp == yyss) YYABORT;
1089 yyvsp--;
1090 yystate = *--yyssp;
1091#ifdef YYLSP_NEEDED
1092 yylsp--;
1093#endif
1094
1095#if YYDEBUG != 0
1096 if (yydebug)
1097 {
1098 short *ssp1 = yyss - 1;
1099 fprintf (stderr, "Error: state stack now");
1100 while (ssp1 != yyssp)
1101 fprintf (stderr, " %d", *++ssp1);
1102 fprintf (stderr, "\n");
1103 }
1104#endif
1105
1106yyerrhandle:
1107
1108 yyn = yypact[yystate];
1109 if (yyn == YYFLAG)
1110 goto yyerrdefault;
1111
1112 yyn += YYTERROR;
1113 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1114 goto yyerrdefault;
1115
1116 yyn = yytable[yyn];
1117 if (yyn < 0)
1118 {
1119 if (yyn == YYFLAG)
1120 goto yyerrpop;
1121 yyn = -yyn;
1122 goto yyreduce;
1123 }
1124 else if (yyn == 0)
1125 goto yyerrpop;
1126
1127 if (yyn == YYFINAL)
1128 YYACCEPT;
1129
1130#if YYDEBUG != 0
1131 if (yydebug)
1132 fprintf(stderr, "Shifting error token, ");
1133#endif
1134
1135 *++yyvsp = yylval;
1136#ifdef YYLSP_NEEDED
1137 *++yylsp = yylloc;
1138#endif
1139
1140 yystate = yyn;
1141 goto yynewstate;
1142
1143 yyacceptlab:
1144 /* YYACCEPT comes here. */
1145 if (yyfree_stacks)
1146 {
1147 free (yyss);
1148 free (yyvs);
1149#ifdef YYLSP_NEEDED
1150 free (yyls);
1151#endif
1152 }
1153 return 0;
1154
1155 yyabortlab:
1156 /* YYABORT comes here. */
1157 if (yyfree_stacks)
1158 {
1159 free (yyss);
1160 free (yyvs);
1161#ifdef YYLSP_NEEDED
1162 free (yyls);
1163#endif
1164 }
1165 return 1;
1166}
1167#line 233 "zparse.y"
1168
1169/*int strncasecmp (const char *, const char *,size_t);*/
1170int yyerror(char *string) {
1171 fprintf(errfile,"Parse error (line %d) near \n\"%s\"<---:%s\n",lineno,
1172 yylval.string,string);
1173 return(1);
1174}
1175
1176void errormsg(char *str) {
1177 fprintf(errfile,"Err (line %d, near \"%s\"): %s.\n",lineno,
1178 yylval.string,str);
1179}
1180
1181/* *
1182int main (int argc, char *argv[]) {
1183 if (argc==2)
1184 if (argv[1][0]=='-'&&argv[1][1]=='d')
1185 yydebug=1;
1186
1187 yyparse();
1188 return(0);
1189}
1190* */
Note: See TracBrowser for help on using the repository browser.