summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cvs/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/cvs/lib')
-rw-r--r--gnu/usr.bin/cvs/lib/getdate.c1977
1 files changed, 1152 insertions, 825 deletions
diff --git a/gnu/usr.bin/cvs/lib/getdate.c b/gnu/usr.bin/cvs/lib/getdate.c
index b0f9411cabb..20f442f1ceb 100644
--- a/gnu/usr.bin/cvs/lib/getdate.c
+++ b/gnu/usr.bin/cvs/lib/getdate.c
@@ -1,3 +1,26 @@
+
+/* A Bison parser, made from ./getdate.y
+ by Bison version A2.5 (Andrew Consortium)
+ */
+
+#define YYBISON 1 /* Identify Bison output. */
+
+#define tAGO 258
+#define tDAY 259
+#define tDAYZONE 260
+#define tID 261
+#define tMERIDIAN 262
+#define tMINUTE_UNIT 263
+#define tMONTH 264
+#define tMONTH_UNIT 265
+#define tSEC_UNIT 266
+#define tSNUMBER 267
+#define tUNUMBER 268
+#define tZONE 269
+#define tDST 270
+
+#line 1 "./getdate.y"
+
/*
** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
@@ -20,12 +43,6 @@
#endif
#endif
-#if STDC_HEADERS
-#include <stdlib.h>
-#else
-char *malloc (), *realloc ();
-#endif
-
/* Since the code of getdate.y is not included in the Emacs executable
itself, there is no need to #define static in this file. Even if
the code were included in the Emacs executable, it probably
@@ -176,33 +193,1140 @@ static time_t yyRelMonth;
static time_t yyRelSeconds;
-typedef union {
+#line 175 "./getdate.y"
+typedef union {
time_t Number;
enum _MERIDIAN Meridian;
} YYSTYPE;
-# define tAGO 257
-# define tDAY 258
-# define tDAYZONE 259
-# define tID 260
-# define tMERIDIAN 261
-# define tMINUTE_UNIT 262
-# define tMONTH 263
-# define tMONTH_UNIT 264
-# define tSEC_UNIT 265
-# define tSNUMBER 266
-# define tUNUMBER 267
-# define tZONE 268
-# define tDST 269
-#define yyclearin yychar = -1
-#define yyerrok yyerrflag = 0
-extern int yychar;
-extern int yyerrflag;
+#include <stdio.h>
+
+#ifndef __cplusplus
+#ifndef __STDC__
+#define const
+#endif
+#endif
+
+
+
+#define YYFINAL 52
+#define YYFLAG -32768
+#define YYNTBASE 19
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 29)
+
+static const char yytranslate[] = { 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 17, 2, 2, 18, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 16, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+};
+
+#if YYDEBUG != 0
+static const short yyprhs[] = { 0,
+ 0, 1, 4, 6, 8, 10, 12, 14, 16, 19,
+ 24, 29, 36, 43, 45, 47, 50, 52, 55, 58,
+ 62, 68, 72, 76, 79, 84, 87, 91, 94, 96,
+ 99, 102, 104, 107, 110, 112, 115, 118, 120, 122,
+ 123
+};
+
+static const short yyrhs[] = { -1,
+ 19, 20, 0, 21, 0, 22, 0, 24, 0, 23,
+ 0, 25, 0, 27, 0, 13, 7, 0, 13, 16,
+ 13, 28, 0, 13, 16, 13, 12, 0, 13, 16,
+ 13, 16, 13, 28, 0, 13, 16, 13, 16, 13,
+ 12, 0, 14, 0, 5, 0, 14, 15, 0, 4,
+ 0, 4, 17, 0, 13, 4, 0, 13, 18, 13,
+ 0, 13, 18, 13, 18, 13, 0, 13, 12, 12,
+ 0, 13, 9, 12, 0, 9, 13, 0, 9, 13,
+ 17, 13, 0, 13, 9, 0, 13, 9, 13, 0,
+ 26, 3, 0, 26, 0, 13, 8, 0, 12, 8,
+ 0, 8, 0, 12, 11, 0, 13, 11, 0, 11,
+ 0, 12, 10, 0, 13, 10, 0, 10, 0, 13,
+ 0, 0, 7, 0
+};
+
+#endif
+
+#if YYDEBUG != 0
+static const short yyrline[] = { 0,
+ 189, 190, 193, 196, 199, 202, 205, 208, 211, 217,
+ 223, 230, 236, 246, 250, 254, 261, 265, 269, 275,
+ 279, 284, 290, 296, 300, 305, 309, 316, 320, 323,
+ 326, 329, 332, 335, 338, 341, 344, 347, 352, 379,
+ 382
+};
+#endif
+
+
+#if YYDEBUG != 0
+
+static const char * const yytname[] = { "$","error","$undefined.","tAGO","tDAY",
+"tDAYZONE","tID","tMERIDIAN","tMINUTE_UNIT","tMONTH","tMONTH_UNIT","tSEC_UNIT",
+"tSNUMBER","tUNUMBER","tZONE","tDST","':'","','","'/'","spec","item","time",
+"zone","day","date","rel","relunit","number","o_merid", NULL
+};
+#endif
+
+static const short yyr1[] = { 0,
+ 19, 19, 20, 20, 20, 20, 20, 20, 21, 21,
+ 21, 21, 21, 22, 22, 22, 23, 23, 23, 24,
+ 24, 24, 24, 24, 24, 24, 24, 25, 25, 26,
+ 26, 26, 26, 26, 26, 26, 26, 26, 27, 28,
+ 28
+};
+
+static const short yyr2[] = { 0,
+ 0, 2, 1, 1, 1, 1, 1, 1, 2, 4,
+ 4, 6, 6, 1, 1, 2, 1, 2, 2, 3,
+ 5, 3, 3, 2, 4, 2, 3, 2, 1, 2,
+ 2, 1, 2, 2, 1, 2, 2, 1, 1, 0,
+ 1
+};
+
+static const short yydefact[] = { 1,
+ 0, 17, 15, 32, 0, 38, 35, 0, 39, 14,
+ 2, 3, 4, 6, 5, 7, 29, 8, 18, 24,
+ 31, 36, 33, 19, 9, 30, 26, 37, 34, 0,
+ 0, 0, 16, 28, 0, 23, 27, 22, 40, 20,
+ 25, 41, 11, 0, 10, 0, 40, 21, 13, 12,
+ 0, 0
+};
+
+static const short yydefgoto[] = { 1,
+ 11, 12, 13, 14, 15, 16, 17, 18, 45
+};
+
+static const short yypact[] = {-32768,
+ 0, -1,-32768,-32768, 4,-32768,-32768, 25, 11, -8,
+-32768,-32768,-32768,-32768,-32768,-32768, 21,-32768,-32768, 9,
+-32768,-32768,-32768,-32768,-32768,-32768, -10,-32768,-32768, 16,
+ 19, 24,-32768,-32768, 26,-32768,-32768,-32768, 18, 13,
+-32768,-32768,-32768, 27,-32768, 28, -6,-32768,-32768,-32768,
+ 38,-32768
+};
+
+static const short yypgoto[] = {-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -5
+};
+
+
+#define YYLAST 42
+
+
+static const short yytable[] = { 51,
+ 42, 36, 37, 2, 3, 49, 33, 4, 5, 6,
+ 7, 8, 9, 10, 24, 19, 20, 25, 26, 27,
+ 28, 29, 30, 34, 42, 35, 31, 38, 32, 43,
+ 46, 39, 21, 44, 22, 23, 40, 52, 41, 47,
+ 48, 50
+};
+
+static const short yycheck[] = { 0,
+ 7, 12, 13, 4, 5, 12, 15, 8, 9, 10,
+ 11, 12, 13, 14, 4, 17, 13, 7, 8, 9,
+ 10, 11, 12, 3, 7, 17, 16, 12, 18, 12,
+ 18, 13, 8, 16, 10, 11, 13, 0, 13, 13,
+ 13, 47
+};
+/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
+#line 3 "/usr/share/bison.simple"
+
+/* Skeleton output parser for bison,
+ Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+#ifndef alloca
+#ifdef __GNUC__
+#define alloca __builtin_alloca
+#else /* not GNU C. */
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
+#include <alloca.h>
+#else /* not sparc */
+#if defined (MSDOS) && !defined (__TURBOC__)
+#include <malloc.h>
+#else /* not MSDOS, or __TURBOC__ */
+#if defined(_AIX)
+#include <malloc.h>
+ #pragma alloca
+#else /* not MSDOS, __TURBOC__, or _AIX */
+#ifdef __hpux
+#ifdef __cplusplus
+extern "C" {
+void *alloca (unsigned int);
+};
+#else /* not __cplusplus */
+void *alloca ();
+#endif /* not __cplusplus */
+#endif /* __hpux */
+#endif /* not _AIX */
+#endif /* not MSDOS, or __TURBOC__ */
+#endif /* not sparc. */
+#endif /* not GNU C. */
+#endif /* alloca not defined. */
+
+/* This is the parser code that is written into each bison parser
+ when the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
+
+/* Note: there must be only one dollar sign in this file.
+ It is replaced by the list of actions, each action
+ as one case of the switch. */
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYACCEPT return(0)
+#define YYABORT return(1)
+#define YYERROR goto yyerrlab1
+/* Like YYERROR except do call yyerror.
+ This remains here temporarily to ease the
+ transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+#define YYFAIL goto yyerrlab
+#define YYRECOVERING() (!!yyerrstatus)
+#define YYBACKUP(token, value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { yychar = (token), yylval = (value); \
+ yychar1 = YYTRANSLATE (yychar); \
+ YYPOPSTACK; \
+ goto yybackup; \
+ } \
+ else \
+ { yyerror ("syntax error: cannot back up"); YYERROR; } \
+while (0)
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+#ifndef YYPURE
+#define YYLEX yylex()
+#endif
+
+#ifdef YYPURE
+#ifdef YYLSP_NEEDED
+#ifdef YYLEX_PARAM
+#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
+#else
+#define YYLEX yylex(&yylval, &yylloc)
+#endif
+#else /* not YYLSP_NEEDED */
+#ifdef YYLEX_PARAM
+#define YYLEX yylex(&yylval, YYLEX_PARAM)
+#else
+#define YYLEX yylex(&yylval)
+#endif
+#endif /* not YYLSP_NEEDED */
+#endif
+
+/* If nonreentrant, generate the variables here */
+
+#ifndef YYPURE
+
+int yychar; /* the lookahead symbol */
+YYSTYPE yylval; /* the semantic value of the */
+ /* lookahead symbol */
+
+#ifdef YYLSP_NEEDED
+YYLTYPE yylloc; /* location data for the lookahead */
+ /* symbol */
+#endif
+
+int yynerrs; /* number of parse errors so far */
+#endif /* not YYPURE */
+
+#if YYDEBUG != 0
+int yydebug; /* nonzero means print parse trace */
+/* Since this is uninitialized, it does not stop multiple parsers
+ from coexisting. */
+#endif
+
+/* YYINITDEPTH indicates the initial size of the parser's stacks */
+
+#ifndef YYINITDEPTH
+#define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH is the maximum size the stacks can grow to
+ (effective only if the built-in stack extension method is used). */
+
+#if YYMAXDEPTH == 0
+#undef YYMAXDEPTH
+#endif
+
#ifndef YYMAXDEPTH
-#define YYMAXDEPTH 150
+#define YYMAXDEPTH 10000
+#endif
+
+/* Prevent warning if -Wstrict-prototypes. */
+#ifdef __GNUC__
+int yyparse (void);
+#endif
+
+#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
+#else /* not GNU C or C++ */
+#ifndef __cplusplus
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__yy_memcpy (from, to, count)
+ char *from;
+ char *to;
+ int count;
+{
+ register char *f = from;
+ register char *t = to;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#else /* __cplusplus */
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__yy_memcpy (char *from, char *to, int count)
+{
+ register char *f = from;
+ register char *t = to;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#endif
+#endif
+
+#line 192 "/usr/share/bison.simple"
+
+/* The user can define YYPARSE_PARAM as the name of an argument to be passed
+ into yyparse. The argument should have type void *.
+ It should actually point to an object.
+ Grammar actions can access the variable by casting it
+ to the proper pointer type. */
+
+#ifdef YYPARSE_PARAM
+#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
+#else
+#define YYPARSE_PARAM
+#define YYPARSE_PARAM_DECL
+#endif
+
+int
+yyparse(YYPARSE_PARAM)
+ YYPARSE_PARAM_DECL
+{
+ register int yystate;
+ register int yyn;
+ register short *yyssp;
+ register YYSTYPE *yyvsp;
+ int yyerrstatus; /* number of tokens to shift before error messages enabled */
+ int yychar1 = 0; /* lookahead token as an internal (translated) token number */
+
+ short yyssa[YYINITDEPTH]; /* the state stack */
+ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
+
+ short *yyss = yyssa; /* refer to the stacks thru separate pointers */
+ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
+
+#ifdef YYLSP_NEEDED
+ YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
+ YYLTYPE *yyls = yylsa;
+ YYLTYPE *yylsp;
+
+#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
+#else
+#define YYPOPSTACK (yyvsp--, yyssp--)
+#endif
+
+ int yystacksize = YYINITDEPTH;
+
+#ifdef YYPURE
+ int yychar;
+ YYSTYPE yylval;
+ int yynerrs;
+#ifdef YYLSP_NEEDED
+ YYLTYPE yylloc;
+#endif
+#endif
+
+ YYSTYPE yyval; /* the variable used to return */
+ /* semantic values from the action */
+ /* routines */
+
+ int yylen;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Starting parse\n");
+#endif
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss - 1;
+ yyvsp = yyvs;
+#ifdef YYLSP_NEEDED
+ yylsp = yyls;
+#endif
+
+/* Push a new state, which is found in yystate . */
+/* In all cases, when you get here, the value and location stacks
+ have just been pushed. so pushing a state here evens the stacks. */
+yynewstate:
+
+ *++yyssp = yystate;
+
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ /* Give user a chance to reallocate the stack */
+ /* Use copies of these so that the &'s don't force the real ones into memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ short *yyss1 = yyss;
+#ifdef YYLSP_NEEDED
+ YYLTYPE *yyls1 = yyls;
+#endif
+
+ /* Get the current used size of the three stacks, in elements. */
+ int size = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ /* Each stack pointer address is followed by the size of
+ the data in use in that stack, in bytes. */
+#ifdef YYLSP_NEEDED
+ /* This used to be a conditional around just the two extra args,
+ but that might be undefined if yyoverflow is a macro. */
+ yyoverflow("parser stack overflow",
+ &yyss1, size * sizeof (*yyssp),
+ &yyvs1, size * sizeof (*yyvsp),
+ &yyls1, size * sizeof (*yylsp),
+ &yystacksize);
+#else
+ yyoverflow("parser stack overflow",
+ &yyss1, size * sizeof (*yyssp),
+ &yyvs1, size * sizeof (*yyvsp),
+ &yystacksize);
+#endif
+
+ yyss = yyss1; yyvs = yyvs1;
+#ifdef YYLSP_NEEDED
+ yyls = yyls1;
+#endif
+#else /* no yyoverflow */
+ /* Extend the stack our own way. */
+ if (yystacksize >= YYMAXDEPTH)
+ {
+ yyerror("parser stack overflow");
+ return 2;
+ }
+ yystacksize *= 2;
+ if (yystacksize > YYMAXDEPTH)
+ yystacksize = YYMAXDEPTH;
+ yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
+ __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
+ yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
+ __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
+#ifdef YYLSP_NEEDED
+ yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
+ __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
+#endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + size - 1;
+ yyvsp = yyvs + size - 1;
+#ifdef YYLSP_NEEDED
+ yylsp = yyls + size - 1;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Stack size increased to %d\n", yystacksize);
+#endif
+
+ if (yyssp >= yyss + yystacksize - 1)
+ YYABORT;
+ }
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Entering state %d\n", yystate);
+#endif
+
+ goto yybackup;
+ yybackup:
+
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* yyresume: */
+
+ /* First try to decide what to do without reference to lookahead token. */
+
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* yychar is either YYEMPTY or YYEOF
+ or a valid token in external form. */
+
+ if (yychar == YYEMPTY)
+ {
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Reading a token: ");
+#endif
+ yychar = YYLEX;
+ }
+
+ /* Convert token to internal form (in yychar1) for indexing tables with */
+
+ if (yychar <= 0) /* This means end of input. */
+ {
+ yychar1 = 0;
+ yychar = YYEOF; /* Don't call YYLEX any more */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Now at end of input.\n");
#endif
-YYSTYPE yylval, yyval;
-# define YYERRCODE 256
+ }
+ else
+ {
+ yychar1 = YYTRANSLATE(yychar);
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
+ /* Give the individual parser a way to print the precise meaning
+ of a token, for further debugging info. */
+#ifdef YYPRINT
+ YYPRINT (stderr, yychar, yylval);
+#endif
+ fprintf (stderr, ")\n");
+ }
+#endif
+ }
+
+ yyn += yychar1;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+ goto yydefault;
+ yyn = yytable[yyn];
+
+ /* yyn is what to do for this token type in this state.
+ Negative => reduce, -yyn is rule number.
+ Positive => shift, yyn is new state.
+ New state is final state => don't bother to shift,
+ just return success.
+ 0, or most negative number => error. */
+
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrlab;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Shift the lookahead token. */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
+#endif
+
+ /* Discard the token being shifted unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ /* count tokens shifted since error; after three, turn off error status. */
+ if (yyerrstatus) yyerrstatus--;
+
+ yystate = yyn;
+ goto yynewstate;
+
+/* Do the default action for the current state. */
+yydefault:
+
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+
+/* Do a reduction. yyn is the number of a rule to reduce with. */
+yyreduce:
+ yylen = yyr2[yyn];
+ if (yylen > 0)
+ yyval = yyvsp[1-yylen]; /* implement default value of the action */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ int i;
+
+ fprintf (stderr, "Reducing via rule %d (line %d), ",
+ yyn, yyrline[yyn]);
+
+ /* Print the symbols being reduced, and their result. */
+ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
+ fprintf (stderr, "%s ", yytname[yyrhs[i]]);
+ fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+ }
+#endif
+
+
+ switch (yyn) {
+
+case 3:
+#line 193 "./getdate.y"
+{
+ yyHaveTime++;
+ ;
+ break;}
+case 4:
+#line 196 "./getdate.y"
+{
+ yyHaveZone++;
+ ;
+ break;}
+case 5:
+#line 199 "./getdate.y"
+{
+ yyHaveDate++;
+ ;
+ break;}
+case 6:
+#line 202 "./getdate.y"
+{
+ yyHaveDay++;
+ ;
+ break;}
+case 7:
+#line 205 "./getdate.y"
+{
+ yyHaveRel++;
+ ;
+ break;}
+case 9:
+#line 211 "./getdate.y"
+{
+ yyHour = yyvsp[-1].Number;
+ yyMinutes = 0;
+ yySeconds = 0;
+ yyMeridian = yyvsp[0].Meridian;
+ ;
+ break;}
+case 10:
+#line 217 "./getdate.y"
+{
+ yyHour = yyvsp[-3].Number;
+ yyMinutes = yyvsp[-1].Number;
+ yySeconds = 0;
+ yyMeridian = yyvsp[0].Meridian;
+ ;
+ break;}
+case 11:
+#line 223 "./getdate.y"
+{
+ yyHour = yyvsp[-3].Number;
+ yyMinutes = yyvsp[-1].Number;
+ yyMeridian = MER24;
+ yyDSTmode = DSToff;
+ yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60);
+ ;
+ break;}
+case 12:
+#line 230 "./getdate.y"
+{
+ yyHour = yyvsp[-5].Number;
+ yyMinutes = yyvsp[-3].Number;
+ yySeconds = yyvsp[-1].Number;
+ yyMeridian = yyvsp[0].Meridian;
+ ;
+ break;}
+case 13:
+#line 236 "./getdate.y"
+{
+ yyHour = yyvsp[-5].Number;
+ yyMinutes = yyvsp[-3].Number;
+ yySeconds = yyvsp[-1].Number;
+ yyMeridian = MER24;
+ yyDSTmode = DSToff;
+ yyTimezone = - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60);
+ ;
+ break;}
+case 14:
+#line 246 "./getdate.y"
+{
+ yyTimezone = yyvsp[0].Number;
+ yyDSTmode = DSToff;
+ ;
+ break;}
+case 15:
+#line 250 "./getdate.y"
+{
+ yyTimezone = yyvsp[0].Number;
+ yyDSTmode = DSTon;
+ ;
+ break;}
+case 16:
+#line 255 "./getdate.y"
+{
+ yyTimezone = yyvsp[-1].Number;
+ yyDSTmode = DSTon;
+ ;
+ break;}
+case 17:
+#line 261 "./getdate.y"
+{
+ yyDayOrdinal = 1;
+ yyDayNumber = yyvsp[0].Number;
+ ;
+ break;}
+case 18:
+#line 265 "./getdate.y"
+{
+ yyDayOrdinal = 1;
+ yyDayNumber = yyvsp[-1].Number;
+ ;
+ break;}
+case 19:
+#line 269 "./getdate.y"
+{
+ yyDayOrdinal = yyvsp[-1].Number;
+ yyDayNumber = yyvsp[0].Number;
+ ;
+ break;}
+case 20:
+#line 275 "./getdate.y"
+{
+ yyMonth = yyvsp[-2].Number;
+ yyDay = yyvsp[0].Number;
+ ;
+ break;}
+case 21:
+#line 279 "./getdate.y"
+{
+ yyMonth = yyvsp[-4].Number;
+ yyDay = yyvsp[-2].Number;
+ yyYear = yyvsp[0].Number;
+ ;
+ break;}
+case 22:
+#line 284 "./getdate.y"
+{
+ /* ISO 8601 format. yyyy-mm-dd. */
+ yyYear = yyvsp[-2].Number;
+ yyMonth = -yyvsp[-1].Number;
+ yyDay = -yyvsp[0].Number;
+ ;
+ break;}
+case 23:
+#line 290 "./getdate.y"
+{
+ /* e.g. 17-JUN-1992. */
+ yyDay = yyvsp[-2].Number;
+ yyMonth = yyvsp[-1].Number;
+ yyYear = -yyvsp[0].Number;
+ ;
+ break;}
+case 24:
+#line 296 "./getdate.y"
+{
+ yyMonth = yyvsp[-1].Number;
+ yyDay = yyvsp[0].Number;
+ ;
+ break;}
+case 25:
+#line 300 "./getdate.y"
+{
+ yyMonth = yyvsp[-3].Number;
+ yyDay = yyvsp[-2].Number;
+ yyYear = yyvsp[0].Number;
+ ;
+ break;}
+case 26:
+#line 305 "./getdate.y"
+{
+ yyMonth = yyvsp[0].Number;
+ yyDay = yyvsp[-1].Number;
+ ;
+ break;}
+case 27:
+#line 309 "./getdate.y"
+{
+ yyMonth = yyvsp[-1].Number;
+ yyDay = yyvsp[-2].Number;
+ yyYear = yyvsp[0].Number;
+ ;
+ break;}
+case 28:
+#line 316 "./getdate.y"
+{
+ yyRelSeconds = -yyRelSeconds;
+ yyRelMonth = -yyRelMonth;
+ ;
+ break;}
+case 30:
+#line 323 "./getdate.y"
+{
+ yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
+ ;
+ break;}
+case 31:
+#line 326 "./getdate.y"
+{
+ yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
+ ;
+ break;}
+case 32:
+#line 329 "./getdate.y"
+{
+ yyRelSeconds += yyvsp[0].Number * 60L;
+ ;
+ break;}
+case 33:
+#line 332 "./getdate.y"
+{
+ yyRelSeconds += yyvsp[-1].Number;
+ ;
+ break;}
+case 34:
+#line 335 "./getdate.y"
+{
+ yyRelSeconds += yyvsp[-1].Number;
+ ;
+ break;}
+case 35:
+#line 338 "./getdate.y"
+{
+ yyRelSeconds++;
+ ;
+ break;}
+case 36:
+#line 341 "./getdate.y"
+{
+ yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 37:
+#line 344 "./getdate.y"
+{
+ yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 38:
+#line 347 "./getdate.y"
+{
+ yyRelMonth += yyvsp[0].Number;
+ ;
+ break;}
+case 39:
+#line 352 "./getdate.y"
+{
+ if (yyHaveTime && yyHaveDate && !yyHaveRel)
+ yyYear = yyvsp[0].Number;
+ else {
+ if(yyvsp[0].Number>10000) {
+ yyHaveDate++;
+ yyDay= (yyvsp[0].Number)%100;
+ yyMonth= (yyvsp[0].Number/100)%100;
+ yyYear = yyvsp[0].Number/10000;
+ }
+ else {
+ yyHaveTime++;
+ if (yyvsp[0].Number < 100) {
+ yyHour = yyvsp[0].Number;
+ yyMinutes = 0;
+ }
+ else {
+ yyHour = yyvsp[0].Number / 100;
+ yyMinutes = yyvsp[0].Number % 100;
+ }
+ yySeconds = 0;
+ yyMeridian = MER24;
+ }
+ }
+ ;
+ break;}
+case 40:
+#line 379 "./getdate.y"
+{
+ yyval.Meridian = MER24;
+ ;
+ break;}
+case 41:
+#line 382 "./getdate.y"
+{
+ yyval.Meridian = yyvsp[0].Meridian;
+ ;
+ break;}
+}
+ /* the action file gets copied in in place of this dollarsign */
+#line 487 "/usr/share/bison.simple"
+
+ yyvsp -= yylen;
+ yyssp -= yylen;
+#ifdef YYLSP_NEEDED
+ yylsp -= yylen;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ short *ssp1 = yyss - 1;
+ fprintf (stderr, "state stack now");
+ while (ssp1 != yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+ *++yyvsp = yyval;
+
+#ifdef YYLSP_NEEDED
+ yylsp++;
+ if (yylen == 0)
+ {
+ yylsp->first_line = yylloc.first_line;
+ yylsp->first_column = yylloc.first_column;
+ yylsp->last_line = (yylsp-1)->last_line;
+ yylsp->last_column = (yylsp-1)->last_column;
+ yylsp->text = 0;
+ }
+ else
+ {
+ yylsp->last_line = (yylsp+yylen-1)->last_line;
+ yylsp->last_column = (yylsp+yylen-1)->last_column;
+ }
+#endif
+
+ /* Now "shift" the result of the reduction.
+ Determine what state that goes to,
+ based on the state we popped back to
+ and the rule number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+ if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTBASE];
+
+ goto yynewstate;
+
+yyerrlab: /* here on detecting error */
+
+ if (! yyerrstatus)
+ /* If not already recovering from an error, report this error. */
+ {
+ ++yynerrs;
+
+#ifdef YYERROR_VERBOSE
+ yyn = yypact[yystate];
+
+ if (yyn > YYFLAG && yyn < YYLAST)
+ {
+ int size = 0;
+ char *msg;
+ int x, count;
+
+ count = 0;
+ /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
+ for (x = (yyn < 0 ? -yyn : 0);
+ x < (sizeof(yytname) / sizeof(char *)); x++)
+ if (yycheck[x + yyn] == x)
+ size += strlen(yytname[x]) + 15, count++;
+ msg = (char *) malloc(size + 15);
+ if (msg != 0)
+ {
+ strcpy(msg, "parse error");
+
+ if (count < 5)
+ {
+ count = 0;
+ for (x = (yyn < 0 ? -yyn : 0);
+ x < (sizeof(yytname) / sizeof(char *)); x++)
+ if (yycheck[x + yyn] == x)
+ {
+ strcat(msg, count == 0 ? ", expecting `" : " or `");
+ strcat(msg, yytname[x]);
+ strcat(msg, "'");
+ count++;
+ }
+ }
+ yyerror(msg);
+ free(msg);
+ }
+ else
+ yyerror ("parse error; also virtual memory exceeded");
+ }
+ else
+#endif /* YYERROR_VERBOSE */
+ yyerror("parse error");
+ }
+
+ goto yyerrlab1;
+yyerrlab1: /* here on error raised explicitly by an action */
+
+ if (yyerrstatus == 3)
+ {
+ /* if just tried and failed to reuse lookahead token after an error, discard it. */
+
+ /* return failure if at end of input */
+ if (yychar == YYEOF)
+ YYABORT;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
+#endif
+
+ yychar = YYEMPTY;
+ }
+
+ /* Else will try to reuse lookahead token
+ after shifting the error token. */
+
+ yyerrstatus = 3; /* Each real token shifted decrements this */
+
+ goto yyerrhandle;
+
+yyerrdefault: /* current state does not do anything special for the error token. */
+
+#if 0
+ /* This is wrong; only states that explicitly want error tokens
+ should shift them. */
+ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
+ if (yyn) goto yydefault;
+#endif
+
+yyerrpop: /* pop the current state because it cannot handle the error token */
+
+ if (yyssp == yyss) YYABORT;
+ yyvsp--;
+ yystate = *--yyssp;
+#ifdef YYLSP_NEEDED
+ yylsp--;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ short *ssp1 = yyss - 1;
+ fprintf (stderr, "Error: state stack now");
+ while (ssp1 != yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+yyerrhandle:
+
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yyerrdefault;
+
+ yyn += YYTERROR;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+ goto yyerrdefault;
+
+ yyn = yytable[yyn];
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrpop;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrpop;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Shifting error token, ");
+#endif
+
+ *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ yystate = yyn;
+ goto yynewstate;
+}
+#line 387 "./getdate.y"
/* Month and day table. */
@@ -726,7 +1850,7 @@ get_date(p, now)
yyInput = p;
if (now == NULL) {
now = &ftz;
- (void)time(&nowtime);
+ (void)time (&nowtime);
if (! (tm = gmtime (&nowtime)))
return -1;
@@ -818,800 +1942,3 @@ main(ac, av)
/* NOTREACHED */
}
#endif /* defined(TEST) */
-int yyexca[] ={
--1, 1,
- 0, -1,
- -2, 0,
- };
-# define YYNPROD 42
-# define YYLAST 228
-int yyact[]={
-
- 13, 11, 22, 28, 16, 12, 18, 17, 15, 9,
- 10, 38, 39, 20, 48, 44, 47, 46, 36, 43,
- 50, 32, 35, 34, 33, 29, 37, 31, 41, 45,
- 40, 30, 14, 8, 7, 6, 5, 4, 3, 2,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 49, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 21, 0, 0, 19, 25, 24, 27,
- 26, 23, 44, 0, 0, 0, 0, 42 };
-int yypact[]={
-
- -1000, -258, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -45,
- -266, -1000, -242, -13, -230, -241, -1000, -1000, -1000, -1000,
- -245, -1000, -249, -240, -255, -1000, -1000, -1000, -1000, -14,
- -1000, -1000, -1000, -1000, -1000, -39, -18, -1000, -1000, -1000,
- -250, -1000, -1000, -251, -1000, -253, -1000, -246, -1000, -1000,
- -1000 };
-int yypgo[]={
-
- 0, 28, 40, 39, 38, 37, 36, 35, 34, 33,
- 32 };
-int yyr1[]={
-
- 0, 2, 2, 3, 3, 3, 3, 3, 3, 4,
- 4, 4, 4, 4, 5, 5, 5, 7, 7, 7,
- 6, 6, 6, 6, 6, 6, 6, 6, 8, 8,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 9,
- 1, 1 };
-int yyr2[]={
-
- 0, 0, 4, 3, 3, 3, 3, 3, 2, 5,
- 9, 9, 13, 13, 3, 3, 5, 3, 5, 5,
- 7, 11, 7, 7, 5, 9, 5, 7, 5, 2,
- 5, 5, 3, 5, 5, 3, 5, 5, 3, 3,
- 1, 3 };
-int yychk[]={
-
- -1000, -2, -3, -4, -5, -6, -7, -8, -9, 267,
- 268, 259, 263, 258, -10, 266, 262, 265, 264, 261,
- 58, 258, 47, 266, 263, 262, 265, 264, 269, 267,
- 44, 257, 262, 265, 264, 267, 267, 266, 266, 267,
- 44, -1, 266, 58, 261, 47, 267, 267, 267, -1,
- 266 };
-int yydef[]={
-
- 1, -2, 2, 3, 4, 5, 6, 7, 8, 39,
- 14, 15, 0, 17, 29, 0, 32, 35, 38, 9,
- 0, 19, 0, 0, 26, 30, 34, 37, 16, 24,
- 18, 28, 31, 33, 36, 40, 20, 22, 23, 27,
- 0, 10, 11, 0, 41, 0, 25, 40, 21, 12,
- 13 };
-typedef struct { char *t_name; int t_val; } yytoktype;
-#ifndef YYDEBUG
-# define YYDEBUG 0 /* don't allow debugging */
-#endif
-
-#if YYDEBUG
-
-yytoktype yytoks[] =
-{
- "tAGO", 257,
- "tDAY", 258,
- "tDAYZONE", 259,
- "tID", 260,
- "tMERIDIAN", 261,
- "tMINUTE_UNIT", 262,
- "tMONTH", 263,
- "tMONTH_UNIT", 264,
- "tSEC_UNIT", 265,
- "tSNUMBER", 266,
- "tUNUMBER", 267,
- "tZONE", 268,
- "tDST", 269,
- "-unknown-", -1 /* ends search */
-};
-
-char * yyreds[] =
-{
- "-no such reduction-",
- "spec : /* empty */",
- "spec : spec item",
- "item : time",
- "item : zone",
- "item : date",
- "item : day",
- "item : rel",
- "item : number",
- "time : tUNUMBER tMERIDIAN",
- "time : tUNUMBER ':' tUNUMBER o_merid",
- "time : tUNUMBER ':' tUNUMBER tSNUMBER",
- "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid",
- "time : tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER",
- "zone : tZONE",
- "zone : tDAYZONE",
- "zone : tZONE tDST",
- "day : tDAY",
- "day : tDAY ','",
- "day : tUNUMBER tDAY",
- "date : tUNUMBER '/' tUNUMBER",
- "date : tUNUMBER '/' tUNUMBER '/' tUNUMBER",
- "date : tUNUMBER tSNUMBER tSNUMBER",
- "date : tUNUMBER tMONTH tSNUMBER",
- "date : tMONTH tUNUMBER",
- "date : tMONTH tUNUMBER ',' tUNUMBER",
- "date : tUNUMBER tMONTH",
- "date : tUNUMBER tMONTH tUNUMBER",
- "rel : relunit tAGO",
- "rel : relunit",
- "relunit : tUNUMBER tMINUTE_UNIT",
- "relunit : tSNUMBER tMINUTE_UNIT",
- "relunit : tMINUTE_UNIT",
- "relunit : tSNUMBER tSEC_UNIT",
- "relunit : tUNUMBER tSEC_UNIT",
- "relunit : tSEC_UNIT",
- "relunit : tSNUMBER tMONTH_UNIT",
- "relunit : tUNUMBER tMONTH_UNIT",
- "relunit : tMONTH_UNIT",
- "number : tUNUMBER",
- "o_merid : /* empty */",
- "o_merid : tMERIDIAN",
-};
-#endif /* YYDEBUG */
-/* @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10 */
-
-/*
-** Skeleton parser driver for yacc output
-*/
-
-/*
-** yacc user known macros and defines
-*/
-#define YYERROR goto yyerrlab
-#define YYACCEPT { free(yys); free(yyv); return(0); }
-#define YYABORT { free(yys); free(yyv); return(1); }
-#define YYBACKUP( newtoken, newvalue )\
-{\
- if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
- {\
- yyerror( "syntax error - cannot backup" );\
- goto yyerrlab;\
- }\
- yychar = newtoken;\
- yystate = *yyps;\
- yylval = newvalue;\
- goto yynewstate;\
-}
-#define YYRECOVERING() (!!yyerrflag)
-#ifndef YYDEBUG
-# define YYDEBUG 1 /* make debugging available */
-#endif
-
-/*
-** user known globals
-*/
-int yydebug; /* set to 1 to get debugging */
-
-/*
-** driver internal defines
-*/
-#define YYFLAG (-1000)
-
-/*
-** static variables used by the parser
-*/
-static YYSTYPE *yyv; /* value stack */
-static int *yys; /* state stack */
-
-static YYSTYPE *yypv; /* top of value stack */
-static int *yyps; /* top of state stack */
-
-static int yystate; /* current state */
-static int yytmp; /* extra var (lasts between blocks) */
-
-int yynerrs; /* number of errors */
-
-int yyerrflag; /* error recovery flag */
-int yychar; /* current input token number */
-
-
-/*
-** yyparse - return 0 if worked, 1 if syntax error not recovered from
-*/
-int
-yyparse()
-{
- register YYSTYPE *yypvt; /* top of value stack for $vars */
- unsigned yymaxdepth = YYMAXDEPTH;
-
- /*
- ** Initialize externals - yyparse may be called more than once
- */
- yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
- yys = (int*)malloc(yymaxdepth*sizeof(int));
- if (!yyv || !yys)
- {
- yyerror( "out of memory" );
- return(1);
- }
- yypv = &yyv[-1];
- yyps = &yys[-1];
- yystate = 0;
- yytmp = 0;
- yynerrs = 0;
- yyerrflag = 0;
- yychar = -1;
-
- goto yystack;
- {
- register YYSTYPE *yy_pv; /* top of value stack */
- register int *yy_ps; /* top of state stack */
- register int yy_state; /* current state */
- register int yy_n; /* internal state number info */
-
- /*
- ** get globals into registers.
- ** branch to here only if YYBACKUP was called.
- */
- yynewstate:
- yy_pv = yypv;
- yy_ps = yyps;
- yy_state = yystate;
- goto yy_newstate;
-
- /*
- ** get globals into registers.
- ** either we just started, or we just finished a reduction
- */
- yystack:
- yy_pv = yypv;
- yy_ps = yyps;
- yy_state = yystate;
-
- /*
- ** top of for (;;) loop while no reductions done
- */
- yy_stack:
- /*
- ** put a state and value onto the stacks
- */
-#if YYDEBUG
- /*
- ** if debugging, look up token value in list of value vs.
- ** name pairs. 0 and negative (-1) are special values.
- ** Note: linear search is used since time is not a real
- ** consideration while debugging.
- */
- if ( yydebug )
- {
- register int yy_i;
-
- (void)printf( "State %d, token ", yy_state );
- if ( yychar == 0 )
- (void)printf( "end-of-file\n" );
- else if ( yychar < 0 )
- (void)printf( "-none-\n" );
- else
- {
- for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
- yy_i++ )
- {
- if ( yytoks[yy_i].t_val == yychar )
- break;
- }
- (void)printf( "%s\n", yytoks[yy_i].t_name );
- }
- }
-#endif /* YYDEBUG */
- if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */
- {
- /*
- ** reallocate and recover. Note that pointers
- ** have to be reset, or bad things will happen
- */
- int yyps_index = (yy_ps - yys);
- int yypv_index = (yy_pv - yyv);
- int yypvt_index = (yypvt - yyv);
- yymaxdepth += YYMAXDEPTH;
- yyv = (YYSTYPE*)realloc((char*)yyv,
- yymaxdepth * sizeof(YYSTYPE));
- yys = (int*)realloc((char*)yys,
- yymaxdepth * sizeof(int));
- if (!yyv || !yys)
- {
- yyerror( "yacc stack overflow" );
- return(1);
- }
- yy_ps = yys + yyps_index;
- yy_pv = yyv + yypv_index;
- yypvt = yyv + yypvt_index;
- }
- *yy_ps = yy_state;
- *++yy_pv = yyval;
-
- /*
- ** we have a new state - find out what to do
- */
- yy_newstate:
- if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
- goto yydefault; /* simple state */
-#if YYDEBUG
- /*
- ** if debugging, need to mark whether new token grabbed
- */
- yytmp = yychar < 0;
-#endif
- if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
- yychar = 0; /* reached EOF */
-#if YYDEBUG
- if ( yydebug && yytmp )
- {
- register int yy_i;
-
- (void)printf( "Received token " );
- if ( yychar == 0 )
- (void)printf( "end-of-file\n" );
- else if ( yychar < 0 )
- (void)printf( "-none-\n" );
- else
- {
- for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
- yy_i++ )
- {
- if ( yytoks[yy_i].t_val == yychar )
- break;
- }
- (void)printf( "%s\n", yytoks[yy_i].t_name );
- }
- }
-#endif /* YYDEBUG */
- if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
- goto yydefault;
- if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/
- {
- yychar = -1;
- yyval = yylval;
- yy_state = yy_n;
- if ( yyerrflag > 0 )
- yyerrflag--;
- goto yy_stack;
- }
-
- yydefault:
- if ( ( yy_n = yydef[ yy_state ] ) == -2 )
- {
-#if YYDEBUG
- yytmp = yychar < 0;
-#endif
- if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
- yychar = 0; /* reached EOF */
-#if YYDEBUG
- if ( yydebug && yytmp )
- {
- register int yy_i;
-
- (void)printf( "Received token " );
- if ( yychar == 0 )
- (void)printf( "end-of-file\n" );
- else if ( yychar < 0 )
- (void)printf( "-none-\n" );
- else
- {
- for ( yy_i = 0;
- yytoks[yy_i].t_val >= 0;
- yy_i++ )
- {
- if ( yytoks[yy_i].t_val
- == yychar )
- {
- break;
- }
- }
- (void)printf( "%s\n", yytoks[yy_i].t_name );
- }
- }
-#endif /* YYDEBUG */
- /*
- ** look through exception table
- */
- {
- register int *yyxi = yyexca;
-
- while ( ( *yyxi != -1 ) ||
- ( yyxi[1] != yy_state ) )
- {
- yyxi += 2;
- }
- while ( ( *(yyxi += 2) >= 0 ) &&
- ( *yyxi != yychar ) )
- ;
- if ( ( yy_n = yyxi[1] ) < 0 )
- YYACCEPT;
- }
- }
-
- /*
- ** check for syntax error
- */
- if ( yy_n == 0 ) /* have an error */
- {
- /* no worry about speed here! */
- switch ( yyerrflag )
- {
- case 0: /* new error */
- yyerror( "syntax error" );
- goto skip_init;
- yyerrlab:
- /*
- ** get globals into registers.
- ** we have a user generated syntax type error
- */
- yy_pv = yypv;
- yy_ps = yyps;
- yy_state = yystate;
- yynerrs++;
- skip_init:
- case 1:
- case 2: /* incompletely recovered error */
- /* try again... */
- yyerrflag = 3;
- /*
- ** find state where "error" is a legal
- ** shift action
- */
- while ( yy_ps >= yys )
- {
- yy_n = yypact[ *yy_ps ] + YYERRCODE;
- if ( yy_n >= 0 && yy_n < YYLAST &&
- yychk[yyact[yy_n]] == YYERRCODE) {
- /*
- ** simulate shift of "error"
- */
- yy_state = yyact[ yy_n ];
- goto yy_stack;
- }
- /*
- ** current state has no shift on
- ** "error", pop stack
- */
-#if YYDEBUG
-# define _POP_ "Error recovery pops state %d, uncovers state %d\n"
- if ( yydebug )
- (void)printf( _POP_, *yy_ps,
- yy_ps[-1] );
-# undef _POP_
-#endif
- yy_ps--;
- yy_pv--;
- }
- /*
- ** there is no state on stack with "error" as
- ** a valid shift. give up.
- */
- YYABORT;
- case 3: /* no shift yet; eat a token */
-#if YYDEBUG
- /*
- ** if debugging, look up token in list of
- ** pairs. 0 and negative shouldn't occur,
- ** but since timing doesn't matter when
- ** debugging, it doesn't hurt to leave the
- ** tests here.
- */
- if ( yydebug )
- {
- register int yy_i;
-
- (void)printf( "Error recovery discards " );
- if ( yychar == 0 )
- (void)printf( "token end-of-file\n" );
- else if ( yychar < 0 )
- (void)printf( "token -none-\n" );
- else
- {
- for ( yy_i = 0;
- yytoks[yy_i].t_val >= 0;
- yy_i++ )
- {
- if ( yytoks[yy_i].t_val
- == yychar )
- {
- break;
- }
- }
- (void)printf( "token %s\n",
- yytoks[yy_i].t_name );
- }
- }
-#endif /* YYDEBUG */
- if ( yychar == 0 ) /* reached EOF. quit */
- YYABORT;
- yychar = -1;
- goto yy_newstate;
- }
- }/* end if ( yy_n == 0 ) */
- /*
- ** reduction by production yy_n
- ** put stack tops, etc. so things right after switch
- */
-#if YYDEBUG
- /*
- ** if debugging, print the string that is the user's
- ** specification of the reduction which is just about
- ** to be done.
- */
- if ( yydebug )
- (void)printf( "Reduce by (%d) \"%s\"\n",
- yy_n, yyreds[ yy_n ] );
-#endif
- yytmp = yy_n; /* value to switch over */
- yypvt = yy_pv; /* $vars top of value stack */
- /*
- ** Look in goto table for next state
- ** Sorry about using yy_state here as temporary
- ** register variable, but why not, if it works...
- ** If yyr2[ yy_n ] doesn't have the low order bit
- ** set, then there is no action to be done for
- ** this reduction. So, no saving & unsaving of
- ** registers done. The only difference between the
- ** code just after the if and the body of the if is
- ** the goto yy_stack in the body. This way the test
- ** can be made before the choice of what to do is needed.
- */
- {
- /* length of production doubled with extra bit */
- register int yy_len = yyr2[ yy_n ];
-
- if ( !( yy_len & 01 ) )
- {
- yy_len >>= 1;
- yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
- yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
- *( yy_ps -= yy_len ) + 1;
- if ( yy_state >= YYLAST ||
- yychk[ yy_state =
- yyact[ yy_state ] ] != -yy_n )
- {
- yy_state = yyact[ yypgo[ yy_n ] ];
- }
- goto yy_stack;
- }
- yy_len >>= 1;
- yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
- yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
- *( yy_ps -= yy_len ) + 1;
- if ( yy_state >= YYLAST ||
- yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
- {
- yy_state = yyact[ yypgo[ yy_n ] ];
- }
- }
- /* save until reenter driver code */
- yystate = yy_state;
- yyps = yy_ps;
- yypv = yy_pv;
- }
- /*
- ** code supplied by user is placed in this switch
- */
- switch( yytmp )
- {
-
-case 3:
-{
- yyHaveTime++;
- } break;
-case 4:
-{
- yyHaveZone++;
- } break;
-case 5:
-{
- yyHaveDate++;
- } break;
-case 6:
-{
- yyHaveDay++;
- } break;
-case 7:
-{
- yyHaveRel++;
- } break;
-case 9:
-{
- yyHour = yypvt[-1].Number;
- yyMinutes = 0;
- yySeconds = 0;
- yyMeridian = yypvt[-0].Meridian;
- } break;
-case 10:
-{
- yyHour = yypvt[-3].Number;
- yyMinutes = yypvt[-1].Number;
- yySeconds = 0;
- yyMeridian = yypvt[-0].Meridian;
- } break;
-case 11:
-{
- yyHour = yypvt[-3].Number;
- yyMinutes = yypvt[-1].Number;
- yyMeridian = MER24;
- yyDSTmode = DSToff;
- yyTimezone = - (yypvt[-0].Number % 100 + (yypvt[-0].Number / 100) * 60);
- } break;
-case 12:
-{
- yyHour = yypvt[-5].Number;
- yyMinutes = yypvt[-3].Number;
- yySeconds = yypvt[-1].Number;
- yyMeridian = yypvt[-0].Meridian;
- } break;
-case 13:
-{
- yyHour = yypvt[-5].Number;
- yyMinutes = yypvt[-3].Number;
- yySeconds = yypvt[-1].Number;
- yyMeridian = MER24;
- yyDSTmode = DSToff;
- yyTimezone = - (yypvt[-0].Number % 100 + (yypvt[-0].Number / 100) * 60);
- } break;
-case 14:
-{
- yyTimezone = yypvt[-0].Number;
- yyDSTmode = DSToff;
- } break;
-case 15:
-{
- yyTimezone = yypvt[-0].Number;
- yyDSTmode = DSTon;
- } break;
-case 16:
-{
- yyTimezone = yypvt[-1].Number;
- yyDSTmode = DSTon;
- } break;
-case 17:
-{
- yyDayOrdinal = 1;
- yyDayNumber = yypvt[-0].Number;
- } break;
-case 18:
-{
- yyDayOrdinal = 1;
- yyDayNumber = yypvt[-1].Number;
- } break;
-case 19:
-{
- yyDayOrdinal = yypvt[-1].Number;
- yyDayNumber = yypvt[-0].Number;
- } break;
-case 20:
-{
- yyMonth = yypvt[-2].Number;
- yyDay = yypvt[-0].Number;
- } break;
-case 21:
-{
- yyMonth = yypvt[-4].Number;
- yyDay = yypvt[-2].Number;
- yyYear = yypvt[-0].Number;
- } break;
-case 22:
-{
- /* ISO 8601 format. yyyy-mm-dd. */
- yyYear = yypvt[-2].Number;
- yyMonth = -yypvt[-1].Number;
- yyDay = -yypvt[-0].Number;
- } break;
-case 23:
-{
- /* e.g. 17-JUN-1992. */
- yyDay = yypvt[-2].Number;
- yyMonth = yypvt[-1].Number;
- yyYear = -yypvt[-0].Number;
- } break;
-case 24:
-{
- yyMonth = yypvt[-1].Number;
- yyDay = yypvt[-0].Number;
- } break;
-case 25:
-{
- yyMonth = yypvt[-3].Number;
- yyDay = yypvt[-2].Number;
- yyYear = yypvt[-0].Number;
- } break;
-case 26:
-{
- yyMonth = yypvt[-0].Number;
- yyDay = yypvt[-1].Number;
- } break;
-case 27:
-{
- yyMonth = yypvt[-1].Number;
- yyDay = yypvt[-2].Number;
- yyYear = yypvt[-0].Number;
- } break;
-case 28:
-{
- yyRelSeconds = -yyRelSeconds;
- yyRelMonth = -yyRelMonth;
- } break;
-case 30:
-{
- yyRelSeconds += yypvt[-1].Number * yypvt[-0].Number * 60L;
- } break;
-case 31:
-{
- yyRelSeconds += yypvt[-1].Number * yypvt[-0].Number * 60L;
- } break;
-case 32:
-{
- yyRelSeconds += yypvt[-0].Number * 60L;
- } break;
-case 33:
-{
- yyRelSeconds += yypvt[-1].Number;
- } break;
-case 34:
-{
- yyRelSeconds += yypvt[-1].Number;
- } break;
-case 35:
-{
- yyRelSeconds++;
- } break;
-case 36:
-{
- yyRelMonth += yypvt[-1].Number * yypvt[-0].Number;
- } break;
-case 37:
-{
- yyRelMonth += yypvt[-1].Number * yypvt[-0].Number;
- } break;
-case 38:
-{
- yyRelMonth += yypvt[-0].Number;
- } break;
-case 39:
-{
- if (yyHaveTime && yyHaveDate && !yyHaveRel)
- yyYear = yypvt[-0].Number;
- else {
- if(yypvt[-0].Number>10000) {
- yyHaveDate++;
- yyDay= (yypvt[-0].Number)%100;
- yyMonth= (yypvt[-0].Number/100)%100;
- yyYear = yypvt[-0].Number/10000;
- }
- else {
- yyHaveTime++;
- if (yypvt[-0].Number < 100) {
- yyHour = yypvt[-0].Number;
- yyMinutes = 0;
- }
- else {
- yyHour = yypvt[-0].Number / 100;
- yyMinutes = yypvt[-0].Number % 100;
- }
- yySeconds = 0;
- yyMeridian = MER24;
- }
- }
- } break;
-case 40:
-{
- yyval.Meridian = MER24;
- } break;
-case 41:
-{
- yyval.Meridian = yypvt[-0].Meridian;
- } break;
- }
- goto yystack; /* reset registers in driver code */
-}