xref: /onnv-gate/usr/src/lib/gss_mechs/mech_krb5/krb5/krb/deltat.c (revision 781:57319a72b15f)
10Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
20Sstevel@tonic-gate 
3*781Sgtb /*  A Bison parser, made from ./x-deltat.y
4*781Sgtb     by GNU Bison version 1.28  */
50Sstevel@tonic-gate 
60Sstevel@tonic-gate #define YYBISON 1  /* Identify Bison output.  */
70Sstevel@tonic-gate 
80Sstevel@tonic-gate #define	NUM	257
90Sstevel@tonic-gate #define	LONGNUM	258
10*781Sgtb #define	OVERFLOW	259
11*781Sgtb #define	WS	260
120Sstevel@tonic-gate 
13*781Sgtb #line 38 "./x-deltat.y"
140Sstevel@tonic-gate 
150Sstevel@tonic-gate 
160Sstevel@tonic-gate #include <ctype.h>
170Sstevel@tonic-gate #include <errno.h>
180Sstevel@tonic-gate #include <k5-int.h>
190Sstevel@tonic-gate 
200Sstevel@tonic-gate struct param {
21*781Sgtb     krb5_int32 delta;
220Sstevel@tonic-gate     char *p;
230Sstevel@tonic-gate };
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #define YYPARSE_PARAM tmv
260Sstevel@tonic-gate 
27*781Sgtb #define MAX_TIME KRB5_INT32_MAX
28*781Sgtb #define MIN_TIME KRB5_INT32_MIN
29*781Sgtb 
30*781Sgtb #define DAY (24 * 3600)
31*781Sgtb #define HOUR 3600
32*781Sgtb 
33*781Sgtb #define MAX_DAY (MAX_TIME / DAY)
34*781Sgtb #define MIN_DAY (MIN_TIME / DAY)
35*781Sgtb #define MAX_HOUR (MAX_TIME / HOUR)
36*781Sgtb #define MIN_HOUR (MIN_TIME / HOUR)
37*781Sgtb #define MAX_MIN (MAX_TIME / 60)
38*781Sgtb #define MIN_MIN (MIN_TIME / 60)
39*781Sgtb 
40*781Sgtb /* An explanation of the tests being performed.
41*781Sgtb    We do not want to overflow a 32 bit integer with out manipulations,
42*781Sgtb    even for testing for overflow. Therefore we rely on the following:
43*781Sgtb 
44*781Sgtb    The lex parser will not return a number > MAX_TIME (which is out 32
45*781Sgtb    bit limit).
46*781Sgtb 
47*781Sgtb    Therefore, seconds (s) will require
48*781Sgtb        MIN_TIME < s < MAX_TIME
49*781Sgtb 
50*781Sgtb    For subsequent tests, the logic is as follows:
51*781Sgtb 
52*781Sgtb       If A < MAX_TIME and  B < MAX_TIME
53*781Sgtb 
54*781Sgtb       If we want to test if A+B < MAX_TIME, there are two cases
55*781Sgtb         if (A > 0)
56*781Sgtb          then A + B < MAX_TIME if B < MAX_TIME - A
57*781Sgtb 	else A + B < MAX_TIME  always.
58*781Sgtb 
59*781Sgtb       if we want to test if MIN_TIME < A + B
60*781Sgtb           if A > 0 - then nothing to test
61*781Sgtb           otherwise, we test if MIN_TIME - A < B.
62*781Sgtb 
63*781Sgtb    We of course are testing for:
64*781Sgtb           MIN_TIME < A + B < MAX_TIME
65*781Sgtb */
66*781Sgtb 
67*781Sgtb 
68*781Sgtb #define DAY_NOT_OK(d) (d) > MAX_DAY || (d) < MIN_DAY
69*781Sgtb #define HOUR_NOT_OK(h) (h) > MAX_HOUR || (h) < MIN_HOUR
70*781Sgtb #define MIN_NOT_OK(m) (m) > MAX_MIN || (m) < MIN_MIN
71*781Sgtb #define SUM_OK(a, b) (((a) > 0) ? ( (b) <= MAX_TIME - (a)) : (MIN_TIME - (a) <= (b)))
72*781Sgtb #define DO_SUM(res, a, b) if (!SUM_OK((a), (b))) YYERROR; \
73*781Sgtb                           res = (a) + (b)
74*781Sgtb 
75*781Sgtb 
76*781Sgtb #define OUT_D ((struct param *)tmv)->delta
770Sstevel@tonic-gate #define DO(D,H,M,S) \
780Sstevel@tonic-gate  { \
79*781Sgtb      /* Overflow testing - this does not handle negative values well.. */ \
80*781Sgtb      if (DAY_NOT_OK(D) || HOUR_NOT_OK(H) || MIN_NOT_OK(M)) YYERROR; \
81*781Sgtb      OUT_D = D * DAY; \
82*781Sgtb      DO_SUM(OUT_D, OUT_D, H * HOUR); \
83*781Sgtb      DO_SUM(OUT_D, OUT_D, M * 60); \
84*781Sgtb      DO_SUM(OUT_D, OUT_D, S); \
850Sstevel@tonic-gate  }
860Sstevel@tonic-gate 
870Sstevel@tonic-gate static int mylex (int *, char **);
880Sstevel@tonic-gate #define YYLEX_PARAM (&((struct param *)tmv)->p)
890Sstevel@tonic-gate #undef yylex
900Sstevel@tonic-gate #define yylex(U, P)    mylex (&(U)->val, (P))
910Sstevel@tonic-gate 
920Sstevel@tonic-gate #undef yyerror
930Sstevel@tonic-gate #define yyerror(MSG)
940Sstevel@tonic-gate 
950Sstevel@tonic-gate static int yyparse (void *);
960Sstevel@tonic-gate 
970Sstevel@tonic-gate 
98*781Sgtb #line 125 "./x-deltat.y"
990Sstevel@tonic-gate typedef union { int val; } YYSTYPE;
1000Sstevel@tonic-gate #include <stdio.h>
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate #ifndef __cplusplus
1030Sstevel@tonic-gate #ifndef __STDC__
1040Sstevel@tonic-gate #define const
1050Sstevel@tonic-gate #endif
1060Sstevel@tonic-gate #endif
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate 
110*781Sgtb #define	YYFINAL		42
1110Sstevel@tonic-gate #define	YYFLAG		-32768
112*781Sgtb #define	YYNTBASE	13
1130Sstevel@tonic-gate 
114*781Sgtb #define YYTRANSLATE(x) ((unsigned)(x) <= 260 ? yytranslate[x] : 22)
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate static const char yytranslate[] = {     0,
1170Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1180Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1190Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1200Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
121*781Sgtb      2,     2,     2,     2,     6,     2,     2,     2,     2,     2,
122*781Sgtb      2,     2,     2,     2,     2,     2,     2,     7,     2,     2,
1230Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1240Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1250Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
126*781Sgtb      2,     2,     2,     2,     2,     2,     2,     2,     2,     8,
127*781Sgtb      2,     2,     2,     9,     2,     2,     2,     2,    10,     2,
128*781Sgtb      2,     2,     2,     2,    11,     2,     2,     2,     2,     2,
1290Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1300Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1310Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1320Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1330Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1340Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1350Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1360Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1370Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1380Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1390Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1400Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1410Sstevel@tonic-gate      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
142*781Sgtb      2,     2,     2,     2,     2,     1,     3,     4,     5,    12
1430Sstevel@tonic-gate };
1440Sstevel@tonic-gate 
1450Sstevel@tonic-gate #if YYDEBUG != 0
1460Sstevel@tonic-gate static const short yyprhs[] = {     0,
147*781Sgtb      0,     2,     4,     6,     8,    11,    12,    14,    17,    20,
148*781Sgtb     24,    28,    32,    35,    43,    49,    53,    55,    57,    61,
149*781Sgtb     63,    67,    69
1500Sstevel@tonic-gate };
1510Sstevel@tonic-gate 
152*781Sgtb static const short yyrhs[] = {    18,
153*781Sgtb      0,     3,     0,     4,     0,    14,     0,     6,    14,     0,
154*781Sgtb      0,    12,     0,    16,    15,     0,    16,     5,     0,    17,
155*781Sgtb      8,    19,     0,    17,     9,    20,     0,    17,    10,    21,
156*781Sgtb      0,    17,    11,     0,    17,     6,     3,     7,     3,     7,
157*781Sgtb      3,     0,    17,     7,     3,     7,     3,     0,    17,     7,
158*781Sgtb      3,     0,    17,     0,    20,     0,    17,     9,    20,     0,
159*781Sgtb     21,     0,    17,    10,    21,     0,    16,     0,    17,    11,
160*781Sgtb      0
1610Sstevel@tonic-gate };
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate #endif
1640Sstevel@tonic-gate 
1650Sstevel@tonic-gate #if YYDEBUG != 0
1660Sstevel@tonic-gate static const short yyrline[] = { 0,
167*781Sgtb    136,   137,   137,   138,   138,   139,   139,   140,   141,   142,
168*781Sgtb    144,   145,   146,   147,   148,   149,   150,   153,   155,   157,
169*781Sgtb    159,   161,   163
1700Sstevel@tonic-gate };
1710Sstevel@tonic-gate #endif
1720Sstevel@tonic-gate 
1730Sstevel@tonic-gate 
1740Sstevel@tonic-gate #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1750Sstevel@tonic-gate 
1760Sstevel@tonic-gate static const char * const yytname[] = {   "$","error","$undefined.","NUM","LONGNUM",
177*781Sgtb "OVERFLOW","'-'","':'","'d'","'h'","'m'","'s'","WS","start","posnum","num","ws",
178*781Sgtb "wsnum","deltat","opt_hms","opt_ms","opt_s", NULL
1790Sstevel@tonic-gate };
1800Sstevel@tonic-gate #endif
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate static const short yyr1[] = {     0,
183*781Sgtb     13,    14,    14,    15,    15,    16,    16,    17,    17,    18,
184*781Sgtb     18,    18,    18,    18,    18,    18,    18,    19,    19,    20,
185*781Sgtb     20,    21,    21
1860Sstevel@tonic-gate };
1870Sstevel@tonic-gate 
1880Sstevel@tonic-gate static const short yyr2[] = {     0,
189*781Sgtb      1,     1,     1,     1,     2,     0,     1,     2,     2,     3,
190*781Sgtb      3,     3,     2,     7,     5,     3,     1,     1,     3,     1,
191*781Sgtb      3,     1,     2
1920Sstevel@tonic-gate };
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate static const short yydefact[] = {     6,
195*781Sgtb      7,     0,    17,     1,     2,     3,     9,     0,     4,     8,
196*781Sgtb      0,     0,     6,     6,     6,    13,     5,     0,    16,    22,
197*781Sgtb      0,    10,    18,    20,     0,    11,     0,    12,     0,     0,
198*781Sgtb      6,     6,    23,     0,    15,    19,    21,     0,    14,     0,
199*781Sgtb      0,     0
2000Sstevel@tonic-gate };
2010Sstevel@tonic-gate 
202*781Sgtb static const short yydefgoto[] = {    40,
203*781Sgtb      9,    10,    20,    25,     4,    22,    23,    24
2040Sstevel@tonic-gate };
2050Sstevel@tonic-gate 
206*781Sgtb static const short yypact[] = {   -10,
207*781Sgtb -32768,    18,    -2,-32768,-32768,-32768,-32768,    13,-32768,-32768,
208*781Sgtb     11,    16,   -10,   -10,   -10,-32768,-32768,    20,    21,    18,
209*781Sgtb      1,-32768,-32768,-32768,    15,-32768,    19,-32768,    26,    28,
210*781Sgtb    -10,   -10,-32768,    27,-32768,-32768,-32768,    30,-32768,    35,
211*781Sgtb     36,-32768
2120Sstevel@tonic-gate };
2130Sstevel@tonic-gate 
2140Sstevel@tonic-gate static const short yypgoto[] = {-32768,
215*781Sgtb     29,-32768,    38,     0,-32768,-32768,   -13,   -12
2160Sstevel@tonic-gate };
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate 
219*781Sgtb #define	YYLAST		38
2200Sstevel@tonic-gate 
2210Sstevel@tonic-gate 
2220Sstevel@tonic-gate static const short yytable[] = {     3,
223*781Sgtb     26,     1,    28,    11,    12,    13,    14,    15,    16,    31,
224*781Sgtb     32,    33,    21,    18,    27,     5,     6,    36,    19,    37,
225*781Sgtb      5,     6,     7,     8,    32,    33,    29,    30,    34,    33,
226*781Sgtb     35,    27,    39,    38,    41,    42,    17,     2
2270Sstevel@tonic-gate };
2280Sstevel@tonic-gate 
2290Sstevel@tonic-gate static const short yycheck[] = {     0,
230*781Sgtb     14,    12,    15,     6,     7,     8,     9,    10,    11,     9,
231*781Sgtb     10,    11,    13,     3,    15,     3,     4,    31,     3,    32,
232*781Sgtb      3,     4,     5,     6,    10,    11,     7,     7,     3,    11,
233*781Sgtb      3,    32,     3,     7,     0,     0,     8,     0
2340Sstevel@tonic-gate };
2350Sstevel@tonic-gate #define YYPURE 1
2360Sstevel@tonic-gate 
2370Sstevel@tonic-gate /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
238*781Sgtb #line 3 "/usr/share/bison.simple"
239*781Sgtb /* This file comes from bison-1.28.  */
2400Sstevel@tonic-gate 
2410Sstevel@tonic-gate /* Skeleton output parser for bison,
2420Sstevel@tonic-gate    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2430Sstevel@tonic-gate 
2440Sstevel@tonic-gate    This program is free software; you can redistribute it and/or modify
2450Sstevel@tonic-gate    it under the terms of the GNU General Public License as published by
2460Sstevel@tonic-gate    the Free Software Foundation; either version 2, or (at your option)
2470Sstevel@tonic-gate    any later version.
2480Sstevel@tonic-gate 
2490Sstevel@tonic-gate    This program is distributed in the hope that it will be useful,
2500Sstevel@tonic-gate    but WITHOUT ANY WARRANTY; without even the implied warranty of
2510Sstevel@tonic-gate    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2520Sstevel@tonic-gate    GNU General Public License for more details.
2530Sstevel@tonic-gate 
2540Sstevel@tonic-gate    You should have received a copy of the GNU General Public License
2550Sstevel@tonic-gate    along with this program; if not, write to the Free Software
2560Sstevel@tonic-gate    Foundation, Inc., 59 Temple Place - Suite 330,
2570Sstevel@tonic-gate    Boston, MA 02111-1307, USA.  */
2580Sstevel@tonic-gate 
2590Sstevel@tonic-gate /* As a special exception, when this file is copied by Bison into a
2600Sstevel@tonic-gate    Bison output file, you may use that output file without restriction.
2610Sstevel@tonic-gate    This special exception was added by the Free Software Foundation
2620Sstevel@tonic-gate    in version 1.24 of Bison.  */
2630Sstevel@tonic-gate 
2640Sstevel@tonic-gate /* This is the parser code that is written into each bison parser
2650Sstevel@tonic-gate   when the %semantic_parser declaration is not specified in the grammar.
2660Sstevel@tonic-gate   It was written by Richard Stallman by simplifying the hairy parser
2670Sstevel@tonic-gate   used when %semantic_parser is specified.  */
2680Sstevel@tonic-gate 
2690Sstevel@tonic-gate #ifndef YYSTACK_USE_ALLOCA
2700Sstevel@tonic-gate #ifdef alloca
2710Sstevel@tonic-gate #define YYSTACK_USE_ALLOCA
2720Sstevel@tonic-gate #else /* alloca not defined */
2730Sstevel@tonic-gate #ifdef __GNUC__
2740Sstevel@tonic-gate #define YYSTACK_USE_ALLOCA
2750Sstevel@tonic-gate #define alloca __builtin_alloca
2760Sstevel@tonic-gate #else /* not GNU C.  */
2770Sstevel@tonic-gate #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2780Sstevel@tonic-gate #define YYSTACK_USE_ALLOCA
2790Sstevel@tonic-gate #include <alloca.h>
2800Sstevel@tonic-gate #else /* not sparc */
2810Sstevel@tonic-gate /* We think this test detects Watcom and Microsoft C.  */
2820Sstevel@tonic-gate /* This used to test MSDOS, but that is a bad idea
2830Sstevel@tonic-gate    since that symbol is in the user namespace.  */
2840Sstevel@tonic-gate #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2850Sstevel@tonic-gate #if 0 /* No need for malloc.h, which pollutes the namespace;
2860Sstevel@tonic-gate 	 instead, just don't use alloca.  */
2870Sstevel@tonic-gate #include <malloc.h>
2880Sstevel@tonic-gate #endif
2890Sstevel@tonic-gate #else /* not MSDOS, or __TURBOC__ */
2900Sstevel@tonic-gate #if defined(_AIX)
2910Sstevel@tonic-gate /* I don't know what this was needed for, but it pollutes the namespace.
2920Sstevel@tonic-gate    So I turned it off.   rms, 2 May 1997.  */
2930Sstevel@tonic-gate /* #include <malloc.h>  */
2940Sstevel@tonic-gate  #pragma alloca
2950Sstevel@tonic-gate #define YYSTACK_USE_ALLOCA
2960Sstevel@tonic-gate #else /* not MSDOS, or __TURBOC__, or _AIX */
2970Sstevel@tonic-gate #if 0
2980Sstevel@tonic-gate #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2990Sstevel@tonic-gate 		 and on HPUX 10.  Eventually we can turn this on.  */
3000Sstevel@tonic-gate #define YYSTACK_USE_ALLOCA
3010Sstevel@tonic-gate #define alloca __builtin_alloca
3020Sstevel@tonic-gate #endif /* __hpux */
3030Sstevel@tonic-gate #endif
3040Sstevel@tonic-gate #endif /* not _AIX */
3050Sstevel@tonic-gate #endif /* not MSDOS, or __TURBOC__ */
3060Sstevel@tonic-gate #endif /* not sparc */
3070Sstevel@tonic-gate #endif /* not GNU C */
3080Sstevel@tonic-gate #endif /* alloca not defined */
3090Sstevel@tonic-gate #endif /* YYSTACK_USE_ALLOCA not defined */
3100Sstevel@tonic-gate 
3110Sstevel@tonic-gate #ifdef YYSTACK_USE_ALLOCA
3120Sstevel@tonic-gate #define YYSTACK_ALLOC alloca
3130Sstevel@tonic-gate #else
3140Sstevel@tonic-gate #define YYSTACK_ALLOC malloc
3150Sstevel@tonic-gate #endif
3160Sstevel@tonic-gate 
3170Sstevel@tonic-gate /* Note: there must be only one dollar sign in this file.
3180Sstevel@tonic-gate    It is replaced by the list of actions, each action
3190Sstevel@tonic-gate    as one case of the switch.  */
3200Sstevel@tonic-gate 
3210Sstevel@tonic-gate #define yyerrok		(yyerrstatus = 0)
3220Sstevel@tonic-gate #define yyclearin	(yychar = YYEMPTY)
3230Sstevel@tonic-gate #define YYEMPTY		-2
3240Sstevel@tonic-gate #define YYEOF		0
3250Sstevel@tonic-gate #define YYACCEPT	goto yyacceptlab
3260Sstevel@tonic-gate #define YYABORT 	goto yyabortlab
3270Sstevel@tonic-gate #define YYERROR		goto yyerrlab1
3280Sstevel@tonic-gate /* Like YYERROR except do call yyerror.
3290Sstevel@tonic-gate    This remains here temporarily to ease the
3300Sstevel@tonic-gate    transition to the new meaning of YYERROR, for GCC.
3310Sstevel@tonic-gate    Once GCC version 2 has supplanted version 1, this can go.  */
3320Sstevel@tonic-gate #define YYFAIL		goto yyerrlab
3330Sstevel@tonic-gate #define YYRECOVERING()  (!!yyerrstatus)
3340Sstevel@tonic-gate #define YYBACKUP(token, value) \
3350Sstevel@tonic-gate do								\
3360Sstevel@tonic-gate   if (yychar == YYEMPTY && yylen == 1)				\
3370Sstevel@tonic-gate     { yychar = (token), yylval = (value);			\
3380Sstevel@tonic-gate       yychar1 = YYTRANSLATE (yychar);				\
3390Sstevel@tonic-gate       YYPOPSTACK;						\
3400Sstevel@tonic-gate       goto yybackup;						\
3410Sstevel@tonic-gate     }								\
3420Sstevel@tonic-gate   else								\
3430Sstevel@tonic-gate     { yyerror ("syntax error: cannot back up"); YYERROR; }	\
3440Sstevel@tonic-gate while (0)
3450Sstevel@tonic-gate 
3460Sstevel@tonic-gate #define YYTERROR	1
3470Sstevel@tonic-gate #define YYERRCODE	256
3480Sstevel@tonic-gate 
3490Sstevel@tonic-gate #ifndef YYPURE
3500Sstevel@tonic-gate #define YYLEX		yylex()
3510Sstevel@tonic-gate #endif
3520Sstevel@tonic-gate 
3530Sstevel@tonic-gate #ifdef YYPURE
3540Sstevel@tonic-gate #ifdef YYLSP_NEEDED
3550Sstevel@tonic-gate #ifdef YYLEX_PARAM
3560Sstevel@tonic-gate #define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
3570Sstevel@tonic-gate #else
3580Sstevel@tonic-gate #define YYLEX		yylex(&yylval, &yylloc)
3590Sstevel@tonic-gate #endif
3600Sstevel@tonic-gate #else /* not YYLSP_NEEDED */
3610Sstevel@tonic-gate #ifdef YYLEX_PARAM
3620Sstevel@tonic-gate #define YYLEX		yylex(&yylval, YYLEX_PARAM)
3630Sstevel@tonic-gate #else
3640Sstevel@tonic-gate #define YYLEX		yylex(&yylval)
3650Sstevel@tonic-gate #endif
3660Sstevel@tonic-gate #endif /* not YYLSP_NEEDED */
3670Sstevel@tonic-gate #endif
3680Sstevel@tonic-gate 
3690Sstevel@tonic-gate /* If nonreentrant, generate the variables here */
3700Sstevel@tonic-gate 
3710Sstevel@tonic-gate #ifndef YYPURE
3720Sstevel@tonic-gate 
3730Sstevel@tonic-gate int	yychar;			/*  the lookahead symbol		*/
3740Sstevel@tonic-gate YYSTYPE	yylval;			/*  the semantic value of the		*/
3750Sstevel@tonic-gate 				/*  lookahead symbol			*/
3760Sstevel@tonic-gate 
3770Sstevel@tonic-gate #ifdef YYLSP_NEEDED
3780Sstevel@tonic-gate YYLTYPE yylloc;			/*  location data for the lookahead	*/
3790Sstevel@tonic-gate 				/*  symbol				*/
3800Sstevel@tonic-gate #endif
3810Sstevel@tonic-gate 
3820Sstevel@tonic-gate int yynerrs;			/*  number of parse errors so far       */
3830Sstevel@tonic-gate #endif  /* not YYPURE */
3840Sstevel@tonic-gate 
3850Sstevel@tonic-gate #if YYDEBUG != 0
3860Sstevel@tonic-gate int yydebug;			/*  nonzero means print parse trace	*/
3870Sstevel@tonic-gate /* Since this is uninitialized, it does not stop multiple parsers
3880Sstevel@tonic-gate    from coexisting.  */
3890Sstevel@tonic-gate #endif
3900Sstevel@tonic-gate 
3910Sstevel@tonic-gate /*  YYINITDEPTH indicates the initial size of the parser's stacks	*/
3920Sstevel@tonic-gate 
3930Sstevel@tonic-gate #ifndef	YYINITDEPTH
3940Sstevel@tonic-gate #define YYINITDEPTH 200
3950Sstevel@tonic-gate #endif
3960Sstevel@tonic-gate 
3970Sstevel@tonic-gate /*  YYMAXDEPTH is the maximum size the stacks can grow to
3980Sstevel@tonic-gate     (effective only if the built-in stack extension method is used).  */
3990Sstevel@tonic-gate 
4000Sstevel@tonic-gate #if YYMAXDEPTH == 0
4010Sstevel@tonic-gate #undef YYMAXDEPTH
4020Sstevel@tonic-gate #endif
4030Sstevel@tonic-gate 
4040Sstevel@tonic-gate #ifndef YYMAXDEPTH
4050Sstevel@tonic-gate #define YYMAXDEPTH 10000
4060Sstevel@tonic-gate #endif
4070Sstevel@tonic-gate 
4080Sstevel@tonic-gate /* Define __yy_memcpy.  Note that the size argument
4090Sstevel@tonic-gate    should be passed with type unsigned int, because that is what the non-GCC
4100Sstevel@tonic-gate    definitions require.  With GCC, __builtin_memcpy takes an arg
4110Sstevel@tonic-gate    of type size_t, but it can handle unsigned int.  */
4120Sstevel@tonic-gate 
4130Sstevel@tonic-gate #if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
4140Sstevel@tonic-gate #define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
4150Sstevel@tonic-gate #else				/* not GNU C or C++ */
4160Sstevel@tonic-gate #ifndef __cplusplus
4170Sstevel@tonic-gate 
4180Sstevel@tonic-gate /* This is the most reliable way to avoid incompatibilities
4190Sstevel@tonic-gate    in available built-in functions on various systems.  */
4200Sstevel@tonic-gate static void
__yy_memcpy(to,from,count)4210Sstevel@tonic-gate __yy_memcpy (to, from, count)
4220Sstevel@tonic-gate      char *to;
4230Sstevel@tonic-gate      char *from;
4240Sstevel@tonic-gate      unsigned int count;
4250Sstevel@tonic-gate {
4260Sstevel@tonic-gate   register char *f = from;
4270Sstevel@tonic-gate   register char *t = to;
4280Sstevel@tonic-gate   register int i = count;
4290Sstevel@tonic-gate 
4300Sstevel@tonic-gate   while (i-- > 0)
4310Sstevel@tonic-gate     *t++ = *f++;
4320Sstevel@tonic-gate }
4330Sstevel@tonic-gate 
4340Sstevel@tonic-gate #else /* __cplusplus */
4350Sstevel@tonic-gate 
4360Sstevel@tonic-gate /* This is the most reliable way to avoid incompatibilities
4370Sstevel@tonic-gate    in available built-in functions on various systems.  */
4380Sstevel@tonic-gate static void
__yy_memcpy(char * to,char * from,unsigned int count)4390Sstevel@tonic-gate __yy_memcpy (char *to, char *from, unsigned int count)
4400Sstevel@tonic-gate {
4410Sstevel@tonic-gate   register char *t = to;
4420Sstevel@tonic-gate   register char *f = from;
4430Sstevel@tonic-gate   register int i = count;
4440Sstevel@tonic-gate 
4450Sstevel@tonic-gate   while (i-- > 0)
4460Sstevel@tonic-gate     *t++ = *f++;
4470Sstevel@tonic-gate }
4480Sstevel@tonic-gate 
4490Sstevel@tonic-gate #endif
4500Sstevel@tonic-gate #endif
4510Sstevel@tonic-gate 
452*781Sgtb #line 217 "/usr/share/bison.simple"
4530Sstevel@tonic-gate 
4540Sstevel@tonic-gate /* The user can define YYPARSE_PARAM as the name of an argument to be passed
4550Sstevel@tonic-gate    into yyparse.  The argument should have type void *.
4560Sstevel@tonic-gate    It should actually point to an object.
4570Sstevel@tonic-gate    Grammar actions can access the variable by casting it
4580Sstevel@tonic-gate    to the proper pointer type.  */
4590Sstevel@tonic-gate 
4600Sstevel@tonic-gate #ifdef YYPARSE_PARAM
4610Sstevel@tonic-gate #ifdef __cplusplus
4620Sstevel@tonic-gate #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
4630Sstevel@tonic-gate #define YYPARSE_PARAM_DECL
4640Sstevel@tonic-gate #else /* not __cplusplus */
4650Sstevel@tonic-gate #define YYPARSE_PARAM_ARG YYPARSE_PARAM
4660Sstevel@tonic-gate #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
4670Sstevel@tonic-gate #endif /* not __cplusplus */
4680Sstevel@tonic-gate #else /* not YYPARSE_PARAM */
4690Sstevel@tonic-gate #define YYPARSE_PARAM_ARG
4700Sstevel@tonic-gate #define YYPARSE_PARAM_DECL
4710Sstevel@tonic-gate #endif /* not YYPARSE_PARAM */
4720Sstevel@tonic-gate 
4730Sstevel@tonic-gate /* Prevent warning if -Wstrict-prototypes.  */
4740Sstevel@tonic-gate #ifdef __GNUC__
4750Sstevel@tonic-gate #ifdef YYPARSE_PARAM
4760Sstevel@tonic-gate int yyparse (void *);
4770Sstevel@tonic-gate #else
4780Sstevel@tonic-gate int yyparse (void);
4790Sstevel@tonic-gate #endif
4800Sstevel@tonic-gate #endif
4810Sstevel@tonic-gate 
4820Sstevel@tonic-gate int
yyparse(YYPARSE_PARAM_ARG)4830Sstevel@tonic-gate yyparse(YYPARSE_PARAM_ARG)
4840Sstevel@tonic-gate      YYPARSE_PARAM_DECL
4850Sstevel@tonic-gate {
4860Sstevel@tonic-gate   register int yystate;
4870Sstevel@tonic-gate   register int yyn;
4880Sstevel@tonic-gate   register short *yyssp;
4890Sstevel@tonic-gate   register YYSTYPE *yyvsp;
4900Sstevel@tonic-gate   int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
4910Sstevel@tonic-gate   int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */
4920Sstevel@tonic-gate 
4930Sstevel@tonic-gate   short	yyssa[YYINITDEPTH];	/*  the state stack			*/
4940Sstevel@tonic-gate   YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/
4950Sstevel@tonic-gate 
4960Sstevel@tonic-gate   short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
4970Sstevel@tonic-gate   YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */
4980Sstevel@tonic-gate 
4990Sstevel@tonic-gate #ifdef YYLSP_NEEDED
5000Sstevel@tonic-gate   YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
5010Sstevel@tonic-gate   YYLTYPE *yyls = yylsa;
5020Sstevel@tonic-gate   YYLTYPE *yylsp;
5030Sstevel@tonic-gate 
5040Sstevel@tonic-gate #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
5050Sstevel@tonic-gate #else
5060Sstevel@tonic-gate #define YYPOPSTACK   (yyvsp--, yyssp--)
5070Sstevel@tonic-gate #endif
5080Sstevel@tonic-gate 
5090Sstevel@tonic-gate   int yystacksize = YYINITDEPTH;
5100Sstevel@tonic-gate   int yyfree_stacks = 0;
5110Sstevel@tonic-gate 
5120Sstevel@tonic-gate #ifdef YYPURE
5130Sstevel@tonic-gate   int yychar;
5140Sstevel@tonic-gate   YYSTYPE yylval;
5150Sstevel@tonic-gate   int yynerrs;
5160Sstevel@tonic-gate #ifdef YYLSP_NEEDED
5170Sstevel@tonic-gate   YYLTYPE yylloc;
5180Sstevel@tonic-gate #endif
5190Sstevel@tonic-gate #endif
5200Sstevel@tonic-gate 
5210Sstevel@tonic-gate   YYSTYPE yyval;		/*  the variable used to return		*/
5220Sstevel@tonic-gate 				/*  semantic values from the action	*/
5230Sstevel@tonic-gate 				/*  routines				*/
5240Sstevel@tonic-gate 
5250Sstevel@tonic-gate   int yylen;
5260Sstevel@tonic-gate 
5270Sstevel@tonic-gate #if YYDEBUG != 0
5280Sstevel@tonic-gate   if (yydebug)
5290Sstevel@tonic-gate     fprintf(stderr, "Starting parse\n");
5300Sstevel@tonic-gate #endif
5310Sstevel@tonic-gate 
5320Sstevel@tonic-gate   yystate = 0;
5330Sstevel@tonic-gate   yyerrstatus = 0;
5340Sstevel@tonic-gate   yynerrs = 0;
5350Sstevel@tonic-gate   yychar = YYEMPTY;		/* Cause a token to be read.  */
5360Sstevel@tonic-gate 
5370Sstevel@tonic-gate   /* Initialize stack pointers.
5380Sstevel@tonic-gate      Waste one element of value and location stack
5390Sstevel@tonic-gate      so that they stay on the same level as the state stack.
5400Sstevel@tonic-gate      The wasted elements are never initialized.  */
5410Sstevel@tonic-gate 
5420Sstevel@tonic-gate   yyssp = yyss - 1;
5430Sstevel@tonic-gate   yyvsp = yyvs;
5440Sstevel@tonic-gate #ifdef YYLSP_NEEDED
5450Sstevel@tonic-gate   yylsp = yyls;
5460Sstevel@tonic-gate #endif
5470Sstevel@tonic-gate 
5480Sstevel@tonic-gate /* Push a new state, which is found in  yystate  .  */
5490Sstevel@tonic-gate /* In all cases, when you get here, the value and location stacks
5500Sstevel@tonic-gate    have just been pushed. so pushing a state here evens the stacks.  */
5510Sstevel@tonic-gate yynewstate:
5520Sstevel@tonic-gate 
5530Sstevel@tonic-gate   *++yyssp = yystate;
5540Sstevel@tonic-gate 
5550Sstevel@tonic-gate   if (yyssp >= yyss + yystacksize - 1)
5560Sstevel@tonic-gate     {
5570Sstevel@tonic-gate       /* Give user a chance to reallocate the stack */
5580Sstevel@tonic-gate       /* Use copies of these so that the &'s don't force the real ones into memory. */
5590Sstevel@tonic-gate       YYSTYPE *yyvs1 = yyvs;
5600Sstevel@tonic-gate       short *yyss1 = yyss;
5610Sstevel@tonic-gate #ifdef YYLSP_NEEDED
5620Sstevel@tonic-gate       YYLTYPE *yyls1 = yyls;
5630Sstevel@tonic-gate #endif
5640Sstevel@tonic-gate 
5650Sstevel@tonic-gate       /* Get the current used size of the three stacks, in elements.  */
5660Sstevel@tonic-gate       int size = yyssp - yyss + 1;
5670Sstevel@tonic-gate 
5680Sstevel@tonic-gate #ifdef yyoverflow
5690Sstevel@tonic-gate       /* Each stack pointer address is followed by the size of
5700Sstevel@tonic-gate 	 the data in use in that stack, in bytes.  */
5710Sstevel@tonic-gate #ifdef YYLSP_NEEDED
5720Sstevel@tonic-gate       /* This used to be a conditional around just the two extra args,
5730Sstevel@tonic-gate 	 but that might be undefined if yyoverflow is a macro.  */
5740Sstevel@tonic-gate       yyoverflow("parser stack overflow",
5750Sstevel@tonic-gate 		 &yyss1, size * sizeof (*yyssp),
5760Sstevel@tonic-gate 		 &yyvs1, size * sizeof (*yyvsp),
5770Sstevel@tonic-gate 		 &yyls1, size * sizeof (*yylsp),
5780Sstevel@tonic-gate 		 &yystacksize);
5790Sstevel@tonic-gate #else
5800Sstevel@tonic-gate       yyoverflow("parser stack overflow",
5810Sstevel@tonic-gate 		 &yyss1, size * sizeof (*yyssp),
5820Sstevel@tonic-gate 		 &yyvs1, size * sizeof (*yyvsp),
5830Sstevel@tonic-gate 		 &yystacksize);
5840Sstevel@tonic-gate #endif
5850Sstevel@tonic-gate 
5860Sstevel@tonic-gate       yyss = yyss1; yyvs = yyvs1;
5870Sstevel@tonic-gate #ifdef YYLSP_NEEDED
5880Sstevel@tonic-gate       yyls = yyls1;
5890Sstevel@tonic-gate #endif
5900Sstevel@tonic-gate #else /* no yyoverflow */
5910Sstevel@tonic-gate       /* Extend the stack our own way.  */
5920Sstevel@tonic-gate       if (yystacksize >= YYMAXDEPTH)
5930Sstevel@tonic-gate 	{
5940Sstevel@tonic-gate 	  yyerror("parser stack overflow");
5950Sstevel@tonic-gate 	  if (yyfree_stacks)
5960Sstevel@tonic-gate 	    {
5970Sstevel@tonic-gate 	      free (yyss);
5980Sstevel@tonic-gate 	      free (yyvs);
5990Sstevel@tonic-gate #ifdef YYLSP_NEEDED
6000Sstevel@tonic-gate 	      free (yyls);
6010Sstevel@tonic-gate #endif
6020Sstevel@tonic-gate 	    }
6030Sstevel@tonic-gate 	  return 2;
6040Sstevel@tonic-gate 	}
6050Sstevel@tonic-gate       yystacksize *= 2;
6060Sstevel@tonic-gate       if (yystacksize > YYMAXDEPTH)
6070Sstevel@tonic-gate 	yystacksize = YYMAXDEPTH;
6080Sstevel@tonic-gate #ifndef YYSTACK_USE_ALLOCA
6090Sstevel@tonic-gate       yyfree_stacks = 1;
6100Sstevel@tonic-gate #endif
6110Sstevel@tonic-gate       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
6120Sstevel@tonic-gate       __yy_memcpy ((char *)yyss, (char *)yyss1,
6130Sstevel@tonic-gate 		   size * (unsigned int) sizeof (*yyssp));
6140Sstevel@tonic-gate       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
6150Sstevel@tonic-gate       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
6160Sstevel@tonic-gate 		   size * (unsigned int) sizeof (*yyvsp));
6170Sstevel@tonic-gate #ifdef YYLSP_NEEDED
6180Sstevel@tonic-gate       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
6190Sstevel@tonic-gate       __yy_memcpy ((char *)yyls, (char *)yyls1,
6200Sstevel@tonic-gate 		   size * (unsigned int) sizeof (*yylsp));
6210Sstevel@tonic-gate #endif
6220Sstevel@tonic-gate #endif /* no yyoverflow */
6230Sstevel@tonic-gate 
6240Sstevel@tonic-gate       yyssp = yyss + size - 1;
6250Sstevel@tonic-gate       yyvsp = yyvs + size - 1;
6260Sstevel@tonic-gate #ifdef YYLSP_NEEDED
6270Sstevel@tonic-gate       yylsp = yyls + size - 1;
6280Sstevel@tonic-gate #endif
6290Sstevel@tonic-gate 
6300Sstevel@tonic-gate #if YYDEBUG != 0
6310Sstevel@tonic-gate       if (yydebug)
6320Sstevel@tonic-gate 	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
6330Sstevel@tonic-gate #endif
6340Sstevel@tonic-gate 
6350Sstevel@tonic-gate       if (yyssp >= yyss + yystacksize - 1)
6360Sstevel@tonic-gate 	YYABORT;
6370Sstevel@tonic-gate     }
6380Sstevel@tonic-gate 
6390Sstevel@tonic-gate #if YYDEBUG != 0
6400Sstevel@tonic-gate   if (yydebug)
6410Sstevel@tonic-gate     fprintf(stderr, "Entering state %d\n", yystate);
6420Sstevel@tonic-gate #endif
6430Sstevel@tonic-gate 
6440Sstevel@tonic-gate   goto yybackup;
6450Sstevel@tonic-gate  yybackup:
6460Sstevel@tonic-gate 
6470Sstevel@tonic-gate /* Do appropriate processing given the current state.  */
6480Sstevel@tonic-gate /* Read a lookahead token if we need one and don't already have one.  */
6490Sstevel@tonic-gate /* yyresume: */
6500Sstevel@tonic-gate 
6510Sstevel@tonic-gate   /* First try to decide what to do without reference to lookahead token.  */
6520Sstevel@tonic-gate 
6530Sstevel@tonic-gate   yyn = yypact[yystate];
6540Sstevel@tonic-gate   if (yyn == YYFLAG)
6550Sstevel@tonic-gate     goto yydefault;
6560Sstevel@tonic-gate 
6570Sstevel@tonic-gate   /* Not known => get a lookahead token if don't already have one.  */
6580Sstevel@tonic-gate 
6590Sstevel@tonic-gate   /* yychar is either YYEMPTY or YYEOF
6600Sstevel@tonic-gate      or a valid token in external form.  */
6610Sstevel@tonic-gate 
6620Sstevel@tonic-gate   if (yychar == YYEMPTY)
6630Sstevel@tonic-gate     {
6640Sstevel@tonic-gate #if YYDEBUG != 0
6650Sstevel@tonic-gate       if (yydebug)
6660Sstevel@tonic-gate 	fprintf(stderr, "Reading a token: ");
6670Sstevel@tonic-gate #endif
6680Sstevel@tonic-gate       yychar = YYLEX;
6690Sstevel@tonic-gate     }
6700Sstevel@tonic-gate 
6710Sstevel@tonic-gate   /* Convert token to internal form (in yychar1) for indexing tables with */
6720Sstevel@tonic-gate 
6730Sstevel@tonic-gate   if (yychar <= 0)		/* This means end of input. */
6740Sstevel@tonic-gate     {
6750Sstevel@tonic-gate       yychar1 = 0;
6760Sstevel@tonic-gate       yychar = YYEOF;		/* Don't call YYLEX any more */
6770Sstevel@tonic-gate 
6780Sstevel@tonic-gate #if YYDEBUG != 0
6790Sstevel@tonic-gate       if (yydebug)
6800Sstevel@tonic-gate 	fprintf(stderr, "Now at end of input.\n");
6810Sstevel@tonic-gate #endif
6820Sstevel@tonic-gate     }
6830Sstevel@tonic-gate   else
6840Sstevel@tonic-gate     {
6850Sstevel@tonic-gate       yychar1 = YYTRANSLATE(yychar);
6860Sstevel@tonic-gate 
6870Sstevel@tonic-gate #if YYDEBUG != 0
6880Sstevel@tonic-gate       if (yydebug)
6890Sstevel@tonic-gate 	{
6900Sstevel@tonic-gate 	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
6910Sstevel@tonic-gate 	  /* Give the individual parser a way to print the precise meaning
6920Sstevel@tonic-gate 	     of a token, for further debugging info.  */
6930Sstevel@tonic-gate #ifdef YYPRINT
6940Sstevel@tonic-gate 	  YYPRINT (stderr, yychar, yylval);
6950Sstevel@tonic-gate #endif
6960Sstevel@tonic-gate 	  fprintf (stderr, ")\n");
6970Sstevel@tonic-gate 	}
6980Sstevel@tonic-gate #endif
6990Sstevel@tonic-gate     }
7000Sstevel@tonic-gate 
7010Sstevel@tonic-gate   yyn += yychar1;
7020Sstevel@tonic-gate   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
7030Sstevel@tonic-gate     goto yydefault;
7040Sstevel@tonic-gate 
7050Sstevel@tonic-gate   yyn = yytable[yyn];
7060Sstevel@tonic-gate 
7070Sstevel@tonic-gate   /* yyn is what to do for this token type in this state.
7080Sstevel@tonic-gate      Negative => reduce, -yyn is rule number.
7090Sstevel@tonic-gate      Positive => shift, yyn is new state.
7100Sstevel@tonic-gate        New state is final state => don't bother to shift,
7110Sstevel@tonic-gate        just return success.
7120Sstevel@tonic-gate      0, or most negative number => error.  */
7130Sstevel@tonic-gate 
7140Sstevel@tonic-gate   if (yyn < 0)
7150Sstevel@tonic-gate     {
7160Sstevel@tonic-gate       if (yyn == YYFLAG)
7170Sstevel@tonic-gate 	goto yyerrlab;
7180Sstevel@tonic-gate       yyn = -yyn;
7190Sstevel@tonic-gate       goto yyreduce;
7200Sstevel@tonic-gate     }
7210Sstevel@tonic-gate   else if (yyn == 0)
7220Sstevel@tonic-gate     goto yyerrlab;
7230Sstevel@tonic-gate 
7240Sstevel@tonic-gate   if (yyn == YYFINAL)
7250Sstevel@tonic-gate     YYACCEPT;
7260Sstevel@tonic-gate 
7270Sstevel@tonic-gate   /* Shift the lookahead token.  */
7280Sstevel@tonic-gate 
7290Sstevel@tonic-gate #if YYDEBUG != 0
7300Sstevel@tonic-gate   if (yydebug)
7310Sstevel@tonic-gate     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
7320Sstevel@tonic-gate #endif
7330Sstevel@tonic-gate 
7340Sstevel@tonic-gate   /* Discard the token being shifted unless it is eof.  */
7350Sstevel@tonic-gate   if (yychar != YYEOF)
7360Sstevel@tonic-gate     yychar = YYEMPTY;
7370Sstevel@tonic-gate 
7380Sstevel@tonic-gate   *++yyvsp = yylval;
7390Sstevel@tonic-gate #ifdef YYLSP_NEEDED
7400Sstevel@tonic-gate   *++yylsp = yylloc;
7410Sstevel@tonic-gate #endif
7420Sstevel@tonic-gate 
7430Sstevel@tonic-gate   /* count tokens shifted since error; after three, turn off error status.  */
7440Sstevel@tonic-gate   if (yyerrstatus) yyerrstatus--;
7450Sstevel@tonic-gate 
7460Sstevel@tonic-gate   yystate = yyn;
7470Sstevel@tonic-gate   goto yynewstate;
7480Sstevel@tonic-gate 
7490Sstevel@tonic-gate /* Do the default action for the current state.  */
7500Sstevel@tonic-gate yydefault:
7510Sstevel@tonic-gate 
7520Sstevel@tonic-gate   yyn = yydefact[yystate];
7530Sstevel@tonic-gate   if (yyn == 0)
7540Sstevel@tonic-gate     goto yyerrlab;
7550Sstevel@tonic-gate 
7560Sstevel@tonic-gate /* Do a reduction.  yyn is the number of a rule to reduce with.  */
7570Sstevel@tonic-gate yyreduce:
7580Sstevel@tonic-gate   yylen = yyr2[yyn];
7590Sstevel@tonic-gate   if (yylen > 0)
7600Sstevel@tonic-gate     yyval = yyvsp[1-yylen]; /* implement default value of the action */
7610Sstevel@tonic-gate 
7620Sstevel@tonic-gate #if YYDEBUG != 0
7630Sstevel@tonic-gate   if (yydebug)
7640Sstevel@tonic-gate     {
7650Sstevel@tonic-gate       int i;
7660Sstevel@tonic-gate 
7670Sstevel@tonic-gate       fprintf (stderr, "Reducing via rule %d (line %d), ",
7680Sstevel@tonic-gate 	       yyn, yyrline[yyn]);
7690Sstevel@tonic-gate 
7700Sstevel@tonic-gate       /* Print the symbols being reduced, and their result.  */
7710Sstevel@tonic-gate       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
7720Sstevel@tonic-gate 	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
7730Sstevel@tonic-gate       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
7740Sstevel@tonic-gate     }
7750Sstevel@tonic-gate #endif
7760Sstevel@tonic-gate 
7770Sstevel@tonic-gate 
7780Sstevel@tonic-gate   switch (yyn) {
7790Sstevel@tonic-gate 
7800Sstevel@tonic-gate case 5:
781*781Sgtb #line 138 "./x-deltat.y"
7820Sstevel@tonic-gate { yyval.val = - yyvsp[0].val; ;
7830Sstevel@tonic-gate     break;}
7840Sstevel@tonic-gate case 8:
785*781Sgtb #line 140 "./x-deltat.y"
7860Sstevel@tonic-gate { yyval.val = yyvsp[0].val; ;
7870Sstevel@tonic-gate     break;}
7880Sstevel@tonic-gate case 9:
789*781Sgtb #line 141 "./x-deltat.y"
790*781Sgtb { YYERROR ;
7910Sstevel@tonic-gate     break;}
7920Sstevel@tonic-gate case 10:
793*781Sgtb #line 143 "./x-deltat.y"
794*781Sgtb { DO (yyvsp[-2].val,  0,  0, yyvsp[0].val); ;
7950Sstevel@tonic-gate     break;}
7960Sstevel@tonic-gate case 11:
797*781Sgtb #line 144 "./x-deltat.y"
798*781Sgtb { DO ( 0, yyvsp[-2].val,  0, yyvsp[0].val); ;
7990Sstevel@tonic-gate     break;}
8000Sstevel@tonic-gate case 12:
801*781Sgtb #line 145 "./x-deltat.y"
802*781Sgtb { DO ( 0,  0, yyvsp[-2].val, yyvsp[0].val); ;
803*781Sgtb     break;}
804*781Sgtb case 13:
805*781Sgtb #line 146 "./x-deltat.y"
8060Sstevel@tonic-gate { DO ( 0,  0,  0, yyvsp[-1].val); ;
8070Sstevel@tonic-gate     break;}
808*781Sgtb case 14:
809*781Sgtb #line 147 "./x-deltat.y"
8100Sstevel@tonic-gate { DO (yyvsp[-6].val, yyvsp[-4].val, yyvsp[-2].val, yyvsp[0].val); ;
8110Sstevel@tonic-gate     break;}
812*781Sgtb case 15:
813*781Sgtb #line 148 "./x-deltat.y"
8140Sstevel@tonic-gate { DO ( 0, yyvsp[-4].val, yyvsp[-2].val, yyvsp[0].val); ;
8150Sstevel@tonic-gate     break;}
816*781Sgtb case 16:
817*781Sgtb #line 149 "./x-deltat.y"
8180Sstevel@tonic-gate { DO ( 0, yyvsp[-2].val, yyvsp[0].val,  0); ;
8190Sstevel@tonic-gate     break;}
8200Sstevel@tonic-gate case 17:
821*781Sgtb #line 150 "./x-deltat.y"
822*781Sgtb { DO ( 0,  0,  0, yyvsp[0].val); ;
8230Sstevel@tonic-gate     break;}
8240Sstevel@tonic-gate case 19:
825*781Sgtb #line 155 "./x-deltat.y"
826*781Sgtb { if (HOUR_NOT_OK(yyvsp[-2].val)) YYERROR;
827*781Sgtb 	                                  DO_SUM(yyval.val, yyvsp[-2].val * 3600, yyvsp[0].val); ;
8280Sstevel@tonic-gate     break;}
829*781Sgtb case 21:
830*781Sgtb #line 159 "./x-deltat.y"
831*781Sgtb { if (MIN_NOT_OK(yyvsp[-2].val)) YYERROR;
832*781Sgtb 	                                  DO_SUM(yyval.val, yyvsp[-2].val * 60, yyvsp[0].val); ;
833*781Sgtb     break;}
834*781Sgtb case 22:
835*781Sgtb #line 162 "./x-deltat.y"
8360Sstevel@tonic-gate { yyval.val = 0; ;
8370Sstevel@tonic-gate     break;}
8380Sstevel@tonic-gate }
8390Sstevel@tonic-gate    /* the action file gets copied in in place of this dollarsign */
840*781Sgtb #line 543 "/usr/share/bison.simple"
8410Sstevel@tonic-gate 
8420Sstevel@tonic-gate   yyvsp -= yylen;
8430Sstevel@tonic-gate   yyssp -= yylen;
8440Sstevel@tonic-gate #ifdef YYLSP_NEEDED
8450Sstevel@tonic-gate   yylsp -= yylen;
8460Sstevel@tonic-gate #endif
8470Sstevel@tonic-gate 
8480Sstevel@tonic-gate #if YYDEBUG != 0
8490Sstevel@tonic-gate   if (yydebug)
8500Sstevel@tonic-gate     {
8510Sstevel@tonic-gate       short *ssp1 = yyss - 1;
8520Sstevel@tonic-gate       fprintf (stderr, "state stack now");
8530Sstevel@tonic-gate       while (ssp1 != yyssp)
8540Sstevel@tonic-gate 	fprintf (stderr, " %d", *++ssp1);
8550Sstevel@tonic-gate       fprintf (stderr, "\n");
8560Sstevel@tonic-gate     }
8570Sstevel@tonic-gate #endif
8580Sstevel@tonic-gate 
8590Sstevel@tonic-gate   *++yyvsp = yyval;
8600Sstevel@tonic-gate 
8610Sstevel@tonic-gate #ifdef YYLSP_NEEDED
8620Sstevel@tonic-gate   yylsp++;
8630Sstevel@tonic-gate   if (yylen == 0)
8640Sstevel@tonic-gate     {
8650Sstevel@tonic-gate       yylsp->first_line = yylloc.first_line;
8660Sstevel@tonic-gate       yylsp->first_column = yylloc.first_column;
8670Sstevel@tonic-gate       yylsp->last_line = (yylsp-1)->last_line;
8680Sstevel@tonic-gate       yylsp->last_column = (yylsp-1)->last_column;
8690Sstevel@tonic-gate       yylsp->text = 0;
8700Sstevel@tonic-gate     }
8710Sstevel@tonic-gate   else
8720Sstevel@tonic-gate     {
8730Sstevel@tonic-gate       yylsp->last_line = (yylsp+yylen-1)->last_line;
8740Sstevel@tonic-gate       yylsp->last_column = (yylsp+yylen-1)->last_column;
8750Sstevel@tonic-gate     }
8760Sstevel@tonic-gate #endif
8770Sstevel@tonic-gate 
8780Sstevel@tonic-gate   /* Now "shift" the result of the reduction.
8790Sstevel@tonic-gate      Determine what state that goes to,
8800Sstevel@tonic-gate      based on the state we popped back to
8810Sstevel@tonic-gate      and the rule number reduced by.  */
8820Sstevel@tonic-gate 
8830Sstevel@tonic-gate   yyn = yyr1[yyn];
8840Sstevel@tonic-gate 
8850Sstevel@tonic-gate   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
8860Sstevel@tonic-gate   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
8870Sstevel@tonic-gate     yystate = yytable[yystate];
8880Sstevel@tonic-gate   else
8890Sstevel@tonic-gate     yystate = yydefgoto[yyn - YYNTBASE];
8900Sstevel@tonic-gate 
8910Sstevel@tonic-gate   goto yynewstate;
8920Sstevel@tonic-gate 
8930Sstevel@tonic-gate yyerrlab:   /* here on detecting error */
8940Sstevel@tonic-gate 
8950Sstevel@tonic-gate   if (! yyerrstatus)
8960Sstevel@tonic-gate     /* If not already recovering from an error, report this error.  */
8970Sstevel@tonic-gate     {
8980Sstevel@tonic-gate       ++yynerrs;
8990Sstevel@tonic-gate 
9000Sstevel@tonic-gate #ifdef YYERROR_VERBOSE
9010Sstevel@tonic-gate       yyn = yypact[yystate];
9020Sstevel@tonic-gate 
9030Sstevel@tonic-gate       if (yyn > YYFLAG && yyn < YYLAST)
9040Sstevel@tonic-gate 	{
9050Sstevel@tonic-gate 	  int size = 0;
9060Sstevel@tonic-gate 	  char *msg;
9070Sstevel@tonic-gate 	  int x, count;
9080Sstevel@tonic-gate 
9090Sstevel@tonic-gate 	  count = 0;
9100Sstevel@tonic-gate 	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
9110Sstevel@tonic-gate 	  for (x = (yyn < 0 ? -yyn : 0);
9120Sstevel@tonic-gate 	       x < (sizeof(yytname) / sizeof(char *)); x++)
9130Sstevel@tonic-gate 	    if (yycheck[x + yyn] == x)
9140Sstevel@tonic-gate 	      size += strlen(yytname[x]) + 15, count++;
9150Sstevel@tonic-gate 	  msg = (char *) malloc(size + 15);
9160Sstevel@tonic-gate 	  if (msg != 0)
9170Sstevel@tonic-gate 	    {
9180Sstevel@tonic-gate 	      strcpy(msg, "parse error");
9190Sstevel@tonic-gate 
9200Sstevel@tonic-gate 	      if (count < 5)
9210Sstevel@tonic-gate 		{
9220Sstevel@tonic-gate 		  count = 0;
9230Sstevel@tonic-gate 		  for (x = (yyn < 0 ? -yyn : 0);
9240Sstevel@tonic-gate 		       x < (sizeof(yytname) / sizeof(char *)); x++)
9250Sstevel@tonic-gate 		    if (yycheck[x + yyn] == x)
9260Sstevel@tonic-gate 		      {
9270Sstevel@tonic-gate 			strcat(msg, count == 0 ? ", expecting `" : " or `");
9280Sstevel@tonic-gate 			strcat(msg, yytname[x]);
9290Sstevel@tonic-gate 			strcat(msg, "'");
9300Sstevel@tonic-gate 			count++;
9310Sstevel@tonic-gate 		      }
9320Sstevel@tonic-gate 		}
9330Sstevel@tonic-gate 	      yyerror(msg);
9340Sstevel@tonic-gate 	      free(msg);
9350Sstevel@tonic-gate 	    }
9360Sstevel@tonic-gate 	  else
9370Sstevel@tonic-gate 	    yyerror ("parse error; also virtual memory exceeded");
9380Sstevel@tonic-gate 	}
9390Sstevel@tonic-gate       else
9400Sstevel@tonic-gate #endif /* YYERROR_VERBOSE */
9410Sstevel@tonic-gate 	yyerror("parse error");
9420Sstevel@tonic-gate     }
9430Sstevel@tonic-gate 
9440Sstevel@tonic-gate   goto yyerrlab1;
9450Sstevel@tonic-gate yyerrlab1:   /* here on error raised explicitly by an action */
9460Sstevel@tonic-gate 
9470Sstevel@tonic-gate   if (yyerrstatus == 3)
9480Sstevel@tonic-gate     {
9490Sstevel@tonic-gate       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
9500Sstevel@tonic-gate 
9510Sstevel@tonic-gate       /* return failure if at end of input */
9520Sstevel@tonic-gate       if (yychar == YYEOF)
9530Sstevel@tonic-gate 	YYABORT;
9540Sstevel@tonic-gate 
9550Sstevel@tonic-gate #if YYDEBUG != 0
9560Sstevel@tonic-gate       if (yydebug)
9570Sstevel@tonic-gate 	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
9580Sstevel@tonic-gate #endif
9590Sstevel@tonic-gate 
9600Sstevel@tonic-gate       yychar = YYEMPTY;
9610Sstevel@tonic-gate     }
9620Sstevel@tonic-gate 
9630Sstevel@tonic-gate   /* Else will try to reuse lookahead token
9640Sstevel@tonic-gate      after shifting the error token.  */
9650Sstevel@tonic-gate 
9660Sstevel@tonic-gate   yyerrstatus = 3;		/* Each real token shifted decrements this */
9670Sstevel@tonic-gate 
9680Sstevel@tonic-gate   goto yyerrhandle;
9690Sstevel@tonic-gate 
9700Sstevel@tonic-gate yyerrdefault:  /* current state does not do anything special for the error token. */
9710Sstevel@tonic-gate 
9720Sstevel@tonic-gate #if 0
9730Sstevel@tonic-gate   /* This is wrong; only states that explicitly want error tokens
9740Sstevel@tonic-gate      should shift them.  */
9750Sstevel@tonic-gate   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
9760Sstevel@tonic-gate   if (yyn) goto yydefault;
9770Sstevel@tonic-gate #endif
9780Sstevel@tonic-gate 
9790Sstevel@tonic-gate yyerrpop:   /* pop the current state because it cannot handle the error token */
9800Sstevel@tonic-gate 
9810Sstevel@tonic-gate   if (yyssp == yyss) YYABORT;
9820Sstevel@tonic-gate   yyvsp--;
9830Sstevel@tonic-gate   yystate = *--yyssp;
9840Sstevel@tonic-gate #ifdef YYLSP_NEEDED
9850Sstevel@tonic-gate   yylsp--;
9860Sstevel@tonic-gate #endif
9870Sstevel@tonic-gate 
9880Sstevel@tonic-gate #if YYDEBUG != 0
9890Sstevel@tonic-gate   if (yydebug)
9900Sstevel@tonic-gate     {
9910Sstevel@tonic-gate       short *ssp1 = yyss - 1;
9920Sstevel@tonic-gate       fprintf (stderr, "Error: state stack now");
9930Sstevel@tonic-gate       while (ssp1 != yyssp)
9940Sstevel@tonic-gate 	fprintf (stderr, " %d", *++ssp1);
9950Sstevel@tonic-gate       fprintf (stderr, "\n");
9960Sstevel@tonic-gate     }
9970Sstevel@tonic-gate #endif
9980Sstevel@tonic-gate 
9990Sstevel@tonic-gate yyerrhandle:
10000Sstevel@tonic-gate 
10010Sstevel@tonic-gate   yyn = yypact[yystate];
10020Sstevel@tonic-gate   if (yyn == YYFLAG)
10030Sstevel@tonic-gate     goto yyerrdefault;
10040Sstevel@tonic-gate 
10050Sstevel@tonic-gate   yyn += YYTERROR;
10060Sstevel@tonic-gate   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
10070Sstevel@tonic-gate     goto yyerrdefault;
10080Sstevel@tonic-gate 
10090Sstevel@tonic-gate   yyn = yytable[yyn];
10100Sstevel@tonic-gate   if (yyn < 0)
10110Sstevel@tonic-gate     {
10120Sstevel@tonic-gate       if (yyn == YYFLAG)
10130Sstevel@tonic-gate 	goto yyerrpop;
10140Sstevel@tonic-gate       yyn = -yyn;
10150Sstevel@tonic-gate       goto yyreduce;
10160Sstevel@tonic-gate     }
10170Sstevel@tonic-gate   else if (yyn == 0)
10180Sstevel@tonic-gate     goto yyerrpop;
10190Sstevel@tonic-gate 
10200Sstevel@tonic-gate   if (yyn == YYFINAL)
10210Sstevel@tonic-gate     YYACCEPT;
10220Sstevel@tonic-gate 
10230Sstevel@tonic-gate #if YYDEBUG != 0
10240Sstevel@tonic-gate   if (yydebug)
10250Sstevel@tonic-gate     fprintf(stderr, "Shifting error token, ");
10260Sstevel@tonic-gate #endif
10270Sstevel@tonic-gate 
10280Sstevel@tonic-gate   *++yyvsp = yylval;
10290Sstevel@tonic-gate #ifdef YYLSP_NEEDED
10300Sstevel@tonic-gate   *++yylsp = yylloc;
10310Sstevel@tonic-gate #endif
10320Sstevel@tonic-gate 
10330Sstevel@tonic-gate   yystate = yyn;
10340Sstevel@tonic-gate   goto yynewstate;
10350Sstevel@tonic-gate 
10360Sstevel@tonic-gate  yyacceptlab:
10370Sstevel@tonic-gate   /* YYACCEPT comes here.  */
10380Sstevel@tonic-gate   if (yyfree_stacks)
10390Sstevel@tonic-gate     {
10400Sstevel@tonic-gate       free (yyss);
10410Sstevel@tonic-gate       free (yyvs);
10420Sstevel@tonic-gate #ifdef YYLSP_NEEDED
10430Sstevel@tonic-gate       free (yyls);
10440Sstevel@tonic-gate #endif
10450Sstevel@tonic-gate     }
10460Sstevel@tonic-gate   return 0;
10470Sstevel@tonic-gate 
10480Sstevel@tonic-gate  yyabortlab:
10490Sstevel@tonic-gate   /* YYABORT comes here.  */
10500Sstevel@tonic-gate   if (yyfree_stacks)
10510Sstevel@tonic-gate     {
10520Sstevel@tonic-gate       free (yyss);
10530Sstevel@tonic-gate       free (yyvs);
10540Sstevel@tonic-gate #ifdef YYLSP_NEEDED
10550Sstevel@tonic-gate       free (yyls);
10560Sstevel@tonic-gate #endif
10570Sstevel@tonic-gate     }
10580Sstevel@tonic-gate   return 1;
10590Sstevel@tonic-gate }
1060*781Sgtb #line 165 "./x-deltat.y"
10610Sstevel@tonic-gate 
10620Sstevel@tonic-gate 
10630Sstevel@tonic-gate static int
mylex(krb5_int32 * intp,char ** pp)1064*781Sgtb mylex (krb5_int32 *intp, char **pp)
10650Sstevel@tonic-gate {
10660Sstevel@tonic-gate     int num, c;
10670Sstevel@tonic-gate #define P (*pp)
10680Sstevel@tonic-gate     char *orig_p = P;
10690Sstevel@tonic-gate 
10700Sstevel@tonic-gate #ifdef isascii
10710Sstevel@tonic-gate     if (!isascii (*P))
10720Sstevel@tonic-gate 	return 0;
10730Sstevel@tonic-gate #endif
10740Sstevel@tonic-gate     switch (c = *P++) {
10750Sstevel@tonic-gate     case '-':
10760Sstevel@tonic-gate     case ':':
10770Sstevel@tonic-gate     case 'd':
10780Sstevel@tonic-gate     case 'h':
10790Sstevel@tonic-gate     case 'm':
10800Sstevel@tonic-gate     case 's':
10810Sstevel@tonic-gate 	return c;
10820Sstevel@tonic-gate     case '0':
10830Sstevel@tonic-gate     case '1':
10840Sstevel@tonic-gate     case '2':
10850Sstevel@tonic-gate     case '3':
10860Sstevel@tonic-gate     case '4':
10870Sstevel@tonic-gate     case '5':
10880Sstevel@tonic-gate     case '6':
10890Sstevel@tonic-gate     case '7':
10900Sstevel@tonic-gate     case '8':
10910Sstevel@tonic-gate     case '9':
10920Sstevel@tonic-gate 	/* XXX assumes ASCII */
10930Sstevel@tonic-gate 	num = c - '0';
1094*781Sgtb 	while (isdigit ((int) *P)) {
1095*781Sgtb 	  if (num > MAX_TIME / 10)
1096*781Sgtb 	    return OVERFLOW;
10970Sstevel@tonic-gate 	    num *= 10;
1098*781Sgtb 	    if (num > MAX_TIME - (*P - '0'))
1099*781Sgtb 	      return OVERFLOW;
11000Sstevel@tonic-gate 	    num += *P++ - '0';
11010Sstevel@tonic-gate 	}
11020Sstevel@tonic-gate 	*intp = num;
11030Sstevel@tonic-gate 	return (P - orig_p > 2) ? LONGNUM : NUM;
11040Sstevel@tonic-gate     case ' ':
11050Sstevel@tonic-gate     case '\t':
11060Sstevel@tonic-gate     case '\n':
1107*781Sgtb 	while (isspace ((int) *P))
11080Sstevel@tonic-gate 	    P++;
11090Sstevel@tonic-gate 	return WS;
11100Sstevel@tonic-gate     default:
11110Sstevel@tonic-gate 	return YYEOF;
11120Sstevel@tonic-gate     }
11130Sstevel@tonic-gate }
11140Sstevel@tonic-gate 
1115*781Sgtb krb5_error_code KRB5_CALLCONV
krb5_string_to_deltat(char * string,krb5_deltat * deltatp)1116*781Sgtb krb5_string_to_deltat(char *string, krb5_deltat *deltatp)
11170Sstevel@tonic-gate {
11180Sstevel@tonic-gate     struct param p;
11190Sstevel@tonic-gate     p.delta = 0;
11200Sstevel@tonic-gate     p.p = string;
11210Sstevel@tonic-gate     if (yyparse (&p))
1122*781Sgtb 	return KRB5_DELTAT_BADFORMAT;
11230Sstevel@tonic-gate     *deltatp = p.delta;
11240Sstevel@tonic-gate     return 0;
11250Sstevel@tonic-gate }
1126