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