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

Last change on this file since 1941 was 1941, checked in by jmt14, 23 years ago

Modified files:

browsetools.cpp documentaction.cpp formattools.cpp
formattools.h

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