diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 2001-09-28 23:26:35 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 2001-09-28 23:26:35 +0000 |
commit | 257b9a3b99db7b3c79cdafe49da86e76e8fcc4ed (patch) | |
tree | 906d81699e697bc1cc7fc3f44194e5131f47346d /gnu/usr.bin/cvs/lib | |
parent | 9894d5f1308eb568c700ab3424cc50396c5b4a3f (diff) |
Merge local changes; work in progress
Diffstat (limited to 'gnu/usr.bin/cvs/lib')
-rw-r--r-- | gnu/usr.bin/cvs/lib/Makefile.in | 490 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/lib/getdate.c | 2023 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/lib/getdate.y | 46 |
3 files changed, 1605 insertions, 954 deletions
diff --git a/gnu/usr.bin/cvs/lib/Makefile.in b/gnu/usr.bin/cvs/lib/Makefile.in index 736f1319e3f..f53c852ea32 100644 --- a/gnu/usr.bin/cvs/lib/Makefile.in +++ b/gnu/usr.bin/cvs/lib/Makefile.in @@ -1,6 +1,20 @@ +# Makefile.in generated automatically by automake 1.4e from Makefile.am. + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + # Makefile for library files used by GNU CVS. -# Do not use this makefile directly, but only from `../Makefile'. -# Copyright (C) 1986, 1988-1994 Free Software Foundation, Inc. +# Copyright (C) 1986, 1988-1994, 2000 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 @@ -12,157 +26,403 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -cvs_srcdir = @top_srcdir@/src -VPATH = @srcdir@ +# For now we need to include $(top_srcdir)/src because some systems +# (at least 'AIX rioscpu2 3 4 000030498200', +# 'HP-UX hp60 B.10.20 A 9000/770 hp60 two-user license', & +# 'IRIX64 sgiop110 6.5 07151433 IP30') have trouble finding error.h +# when compiling savecwd.c +# +# FIXME - the fact that compiling on my Linux 2.2.16 system finds +# /usr/include/error.h instead of $(top_srcdir)/src/error.h but +# everything compiles and tests anyhow implies that src/error.h may +# be unecessary now. Should look more deeply into this +# +# $(includeopt) is CVS specific and set by configure + -SHELL = /bin/sh +SHELL = @SHELL@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ -SOURCES = \ +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +AMTAR = @AMTAR@ +AWK = @AWK@ +CC = @CC@ +CSH = @CSH@ +DEPDIR = @DEPDIR@ +ETAGS = @ETAGS@ +ETAGS_INCLUDE_OPTION = @ETAGS_INCLUDE_OPTION@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ +KRB4 = @KRB4@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +PERL = @PERL@ +PR = @PR@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +ROFF = @ROFF@ +STRIP = @STRIP@ +TEXI2DVI = @TEXI2DVI@ +VERSION = @VERSION@ +YACC = @YACC@ +_am_include = @_am_include@ +_am_quote = @_am_quote@ +includeopt = @includeopt@ +install_sh = @install_sh@ + +INCLUDES = -I$(top_srcdir)/src $(includeopt) + +noinst_LIBRARIES = libcvs.a + +# Always use CVS's regular expression matcher regex.o, because of +# variations in regular expression syntax - we want to be the same +# across systems and (probably) compared with old versions of CVS too. +# +# On a more mundane/detail level, having regex.h match regex.c can be +# an issue if we aren't careful. +# +# Also should look into unifying regular expression matching in CVS +# with the diff library (perhaps to have the caller, CVS, do the +# matching?) +libcvs_a_SOURCES = \ argmatch.c \ - dup2.c \ - fncase.c \ - fnmatch.c \ ftruncate.c \ - getdate.c \ getdate.y \ getline.c \ getopt.c \ getopt1.c \ - hostname.c \ md5.c \ - memmove.c \ - mkdir.c \ regex.c \ - rename.c \ savecwd.c \ sighandle.c \ - strstr.c \ - strerror.c \ stripslash.c \ - strtoul.c \ - valloc.c \ - waitpid.c \ xgetwd.c \ - yesno.c + yesno.c \ + getline.h \ + getopt.h \ + fnmatch.h \ + md5.h \ + regex.h \ + savecwd.h \ + system.h \ + wait.h \ + xselect.h \ + xtime.h -HEADERS = getline.h getopt.h fnmatch.h regex.h system.h wait.h md5.h savecwd.h +libcvs_a_LIBADD = @LIBOBJS@ -# Always use CVS's regular expression matcher regex.o, because of -# variations in regular expression syntax - we want to be the same -# across systems and (probably) compared with old versions of CVS too. -# -# On a more mundane/detail level, having regex.h match regex.c can be -# an issue if we aren't careful. -# -# Also should look into unifying regular expression matching in CVS -# with the diff library (perhaps to have the caller, CVS, do the -# matching?) -OBJECTS = \ - @LIBOBJS@ \ - argmatch.o \ - getline.o \ - getopt.o \ - getopt1.o \ - md5.o \ - regex.o \ - savecwd.o \ - sighandle.o \ - stripslash.o \ - xgetwd.o \ - yesno.o \ - getdate.o - -DISTFILES = \ - .cvsignore ChangeLog ChangeLog.fsf Makefile.in \ - ${SOURCES} ${HEADERS} build_lib.com +EXTRA_DIST = \ + .cvsignore \ + ChangeLog.fsf \ + build_lib.com \ + xgssapi.h -DEFS = @DEFS@ -RANLIB = @RANLIB@ +EXEEXT = +OBJEXT = o +subdir = lib +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/src/options.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) -CC = @CC@ +libcvs_a_AR = $(AR) cru +libcvs_a_DEPENDENCIES = @LIBOBJS@ +am_libcvs_a_OBJECTS = argmatch.$(OBJEXT) ftruncate.$(OBJEXT) \ + getdate.$(OBJEXT) getline.$(OBJEXT) getopt.$(OBJEXT) \ + getopt1.$(OBJEXT) md5.$(OBJEXT) regex.$(OBJEXT) \ + savecwd.$(OBJEXT) sighandle.$(OBJEXT) stripslash.$(OBJEXT) \ + xgetwd.$(OBJEXT) yesno.$(OBJEXT) +libcvs_a_OBJECTS = $(am_libcvs_a_OBJECTS) +AR = ar +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CFLAGS = @CFLAGS@ -CPPFLAGS= +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -YACC = @YACC@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/src +DEFS = @DEFS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +DIST_SOURCES = $(libcvs_a_SOURCES) +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/argmatch.Po $(DEPDIR)/dup2.Po \ +@AMDEP_TRUE@ $(DEPDIR)/fncase.Po $(DEPDIR)/fnmatch.Po \ +@AMDEP_TRUE@ $(DEPDIR)/ftruncate.Po $(DEPDIR)/getdate.Po \ +@AMDEP_TRUE@ $(DEPDIR)/getline.Po $(DEPDIR)/getopt.Po \ +@AMDEP_TRUE@ $(DEPDIR)/getopt1.Po $(DEPDIR)/hostname.Po \ +@AMDEP_TRUE@ $(DEPDIR)/md5.Po $(DEPDIR)/memmove.Po \ +@AMDEP_TRUE@ $(DEPDIR)/mkdir.Po $(DEPDIR)/regex.Po \ +@AMDEP_TRUE@ $(DEPDIR)/rename.Po $(DEPDIR)/savecwd.Po \ +@AMDEP_TRUE@ $(DEPDIR)/sighandle.Po $(DEPDIR)/strerror.Po \ +@AMDEP_TRUE@ $(DEPDIR)/stripslash.Po $(DEPDIR)/strstr.Po \ +@AMDEP_TRUE@ $(DEPDIR)/strtoul.Po $(DEPDIR)/valloc.Po \ +@AMDEP_TRUE@ $(DEPDIR)/waitpid.Po $(DEPDIR)/xgetwd.Po \ +@AMDEP_TRUE@ $(DEPDIR)/yesno.Po +DIST_COMMON = ChangeLog Makefile.am Makefile.in dup2.c fncase.c \ + fnmatch.c getdate.c hostname.c memmove.c mkdir.c rename.c \ + strerror.c strstr.c strtoul.c valloc.c waitpid.c +SOURCES = $(libcvs_a_SOURCES) +OBJECTS = $(am_libcvs_a_OBJECTS) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj .y + +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lib/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +libcvs.a: $(libcvs_a_OBJECTS) $(libcvs_a_DEPENDENCIES) + -rm -f libcvs.a + $(libcvs_a_AR) libcvs.a $(libcvs_a_OBJECTS) $(libcvs_a_LIBADD) + $(RANLIB) libcvs.a + +.y.c: + $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c + if test -f y.tab.h; then \ + if cmp -s y.tab.h $*.h; then \ + rm -f y.tab.h; \ + else \ + mv y.tab.h $*.h; \ + fi; \ + fi + + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list @CONFIG@; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || $(ETAGS) $(ETAGS_ARGS) $$tags $$unique $(LISP) + +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here + +distclean-tags: + -rm -f TAGS ID + +@_am_include@ @_am_quote@$(DEPDIR)/argmatch.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/dup2.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/fncase.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/fnmatch.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/ftruncate.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/getdate.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/getline.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/getopt.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/getopt1.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/hostname.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/md5.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/memmove.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/mkdir.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/regex.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/rename.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/savecwd.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/sighandle.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/strerror.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/stripslash.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/strstr.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/strtoul.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/valloc.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/waitpid.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/xgetwd.Po@_am_quote@ +@_am_include@ @_am_quote@$(DEPDIR)/yesno.Po@_am_quote@ + +distclean-depend: + -rm -rf $(DEPDIR) + +CCDEPMODE = @CCDEPMODE@ .c.o: - $(CC) $(CPPFLAGS) -I.. -I$(srcdir) -I$(cvs_srcdir) \ - $(DEFS) $(CFLAGS) -c $< + source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ + $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< + +.c.obj: + source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ + $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -all: libcvs.a -.PHONY: all +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) -install: all -.PHONY: install +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) installdirs: -.PHONY: installdirs -tags: $(DISTFILES) - ctags `for i in $(DISTFILES); do echo $(srcdir)/$$i; done` +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am -TAGS: $(DISTFILES) - etags `for i in $(DISTFILES); do echo $(srcdir)/$$i; done` +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -ls: - @echo $(DISTFILES) -.PHONY: ls +installcheck: installcheck-am -clean: - rm -f *.a *.o -.PHONY: clean +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install -distclean: clean - rm -f tags TAGS Makefile -.PHONY: distclean +mostlyclean-generic: -realclean: distclean - rm -f *.tab.c getdate.c -.PHONY: realclean +clean-generic: -dist-dir: - mkdir ${DISTDIR} - for i in ${DISTFILES}; do \ - ln $(srcdir)/$${i} ${DISTDIR}; \ - done -.PHONY: dist-dir - -libcvs.a: $(OBJECTS) - $(AR) cr $@ $(OBJECTS) - -$(RANLIB) $@ - -getdate.c: getdate.y - @echo expect 10 shift/reduce conflicts - $(YACC) $(srcdir)/getdate.y - -@if test -f y.tab.c; then \ - mv y.tab.c getdate.c ;\ - else \ - if test -f getdate.tab.c ; then \ - mv getdate.tab.c getdate.c ; \ - else \ - echo '*** Unable to create getdate.c' ;\ - fi ;\ - fi +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* -fnmatch.o: fnmatch.h -getopt1.o: getopt.h -regex.o: regex.h -md5.o: md5.h +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -rm -f Makefile.in + -test -z "getdate.c" || rm -f getdate.c +clean: clean-am -xlint: - @echo xlint does nothing +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am -subdir = lib -Makefile: ../config.status Makefile.in - cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags + +dvi: + +dvi-am: + +info: + +info-am: + +install-data-am: -#../config.status: ../configure -# cd .. ; $(SHELL) config.status --recheck +install-exec-am: + +install-info: + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +.PHONY: all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic tags \ + uninstall uninstall-am + + +# for backwards compatibility with the old makefiles +realclean: maintainer-clean +.PHONY: realclean -#../configure: ../configure.in -# cd $(top_srcdir) ; autoconf +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/gnu/usr.bin/cvs/lib/getdate.c b/gnu/usr.bin/cvs/lib/getdate.c index aed844da9c9..a94d7ed3def 100644 --- a/gnu/usr.bin/cvs/lib/getdate.c +++ b/gnu/usr.bin/cvs/lib/getdate.c @@ -1,17 +1,25 @@ -#ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93 (BSDI)"; -#endif -#include <stdlib.h> -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 -#define YYEMPTY (-1) -#define YYLEX yylex() -#define yyclearin (yychar=YYEMPTY) -#define yyerrok (yyerrflag=0) -#define YYRECOVERING (yyerrflag!=0) -#define YYPREFIX "yy" -#line 2 "/u/scjones/cvs-nightly/lib/getdate.y" + +/* A Bison parser, made from getdate.y + by GNU Bison version 1.28 */ + +#define YYBISON 1 /* Identify Bison output. */ + +#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 + +#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 @@ -52,46 +60,11 @@ static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93 (BSDI)"; Include <sys/time.h> if that will be used. */ #if defined(vms) - -#include <types.h> -#include <time.h> - -#else - -#include <sys/types.h> - -#ifdef TIME_WITH_SYS_TIME -#include <sys/time.h> -#include <time.h> -#else -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#else -#include <time.h> -#endif -#endif - -#ifdef timezone -#undef timezone /* needed for sgi */ -#endif - -#if defined(HAVE_SYS_TIMEB_H) -#include <sys/timeb.h> -#else -/* -** We use the obsolete `struct timeb' as part of our interface! -** Since the system doesn't have it, we define it here; -** our callers must do likewise. -*/ -struct timeb { - time_t time; /* Seconds since the epoch */ - unsigned short millitm; /* Field not used */ - short timezone; /* Minutes west of GMT */ - short dstflag; /* Field not used */ -}; -#endif /* defined(HAVE_SYS_TIMEB_H) */ - -#endif /* defined(vms) */ +# include <types.h> +#else /* defined(vms) */ +# include <sys/types.h> +# include "xtime.h" +#endif /* !defined(vms) */ #if defined (STDC_HEADERS) || defined (USG) #include <string.h> @@ -128,6 +101,7 @@ extern struct tm *localtime(); #define yylex getdate_yylex #define yyerror getdate_yyerror +static int yyparse (); static int yylex (); static int yyerror (); @@ -187,228 +161,1223 @@ static MERIDIAN yyMeridian; static time_t yyRelMonth; static time_t yyRelSeconds; -#line 179 "/u/scjones/cvs-nightly/lib/getdate.y" + +#line 145 "getdate.y" typedef union { time_t Number; enum _MERIDIAN Meridian; } YYSTYPE; -#line 196 "y.tab.c" -#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 YYERRCODE 256 -short yylhs[] = { -1, - 0, 0, 2, 2, 2, 2, 2, 2, 3, 3, - 3, 3, 3, 4, 4, 4, 6, 6, 6, 5, - 5, 5, 5, 5, 5, 5, 5, 7, 7, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 8, 1, - 1, +#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) <= 269 ? 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, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15 }; -short yylen[] = { 2, - 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, + +#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 }; -short yydefred[] = { 1, - 0, 0, 15, 32, 0, 38, 35, 0, 0, 0, - 2, 3, 4, 5, 6, 7, 8, 0, 18, 0, - 31, 36, 33, 19, 9, 30, 0, 37, 34, 0, - 0, 0, 16, 28, 0, 23, 27, 22, 0, 0, - 25, 41, 11, 0, 10, 0, 0, 21, 13, 12, + +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 }; -short yydgoto[] = { 1, - 45, 11, 12, 13, 14, 15, 16, 17, 18, + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 159, 160, 163, 166, 169, 172, 175, 178, 181, 187, + 193, 200, 206, 216, 220, 224, 231, 235, 239, 245, + 249, 260, 266, 272, 276, 281, 285, 292, 296, 299, + 302, 305, 308, 311, 314, 317, 320, 323, 328, 355, + 358 }; -short yysindex[] = { 0, - -249, -38, 0, 0, -260, 0, 0, -240, -47, -248, - 0, 0, 0, 0, 0, 0, 0, -237, 0, -18, - 0, 0, 0, 0, 0, 0, -262, 0, 0, -239, - -238, -236, 0, 0, -235, 0, 0, 0, -56, -19, - 0, 0, 0, -234, 0, -232, -258, 0, 0, 0, +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +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 }; -short yyrindex[] = { 0, - 0, 1, 0, 0, 0, 0, 0, 0, 69, 12, - 0, 0, 0, 0, 0, 0, 0, 23, 0, 34, - 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 56, 45, - 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, +#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 }; -short yygindex[] = { 0, - -17, 0, 0, 0, 0, 0, 0, 0, 0, + +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 }; -#define YYTABLESIZE 337 -short yytable[] = { 32, - 17, 44, 42, 36, 37, 19, 20, 49, 2, 3, - 31, 14, 4, 5, 6, 7, 8, 9, 10, 34, - 33, 21, 29, 22, 23, 35, 38, 46, 39, 50, - 40, 41, 47, 24, 48, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 26, 0, 39, 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, 42, 0, 0, 0, 0, 43, - 24, 0, 0, 25, 26, 27, 28, 29, 30, 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, 17, 17, - 0, 0, 17, 17, 17, 17, 17, 17, 17, 14, - 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, - 29, 29, 0, 0, 29, 29, 29, 29, 29, 29, - 29, 24, 24, 0, 0, 24, 24, 24, 24, 24, - 24, 24, 20, 20, 0, 0, 20, 20, 20, 20, - 20, 20, 20, 40, 40, 0, 0, 40, 40, 40, - 40, 0, 40, 40, 26, 26, 0, 39, 26, 26, - 26, 26, 0, 0, 26, 39, 39, + +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 }; -short yycheck[] = { 47, - 0, 58, 261, 266, 267, 44, 267, 266, 258, 259, - 58, 0, 262, 263, 264, 265, 266, 267, 268, 257, - 269, 262, 0, 264, 265, 44, 266, 47, 267, 47, - 267, 267, 267, 0, 267, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 261, -1, -1, -1, -1, 266, - 258, -1, -1, 261, 262, 263, 264, 265, 266, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 258, 259, - -1, -1, 262, 263, 264, 265, 266, 267, 268, 258, - 259, -1, -1, 262, 263, 264, 265, 266, 267, 268, - 258, 259, -1, -1, 262, 263, 264, 265, 266, 267, - 268, 258, 259, -1, -1, 262, 263, 264, 265, 266, - 267, 268, 258, 259, -1, -1, 262, 263, 264, 265, - 266, 267, 268, 258, 259, -1, -1, 262, 263, 264, - 265, -1, 267, 268, 258, 259, -1, 259, 262, 263, - 264, 265, -1, -1, 268, 267, 268, + +static const short yydefgoto[] = { 1, + 11, 12, 13, 14, 15, 16, 17, 18, 45 }; -#define YYFINAL 1 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 269 -#if YYDEBUG -char *yyname[] = { -"end-of-file",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,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,"tAGO","tDAY", -"tDAYZONE","tID","tMERIDIAN","tMINUTE_UNIT","tMONTH","tMONTH_UNIT","tSEC_UNIT", -"tSNUMBER","tUNUMBER","tZONE","tDST", + +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 }; -char *yyrule[] = { -"$accept : spec", -"spec :", -"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 :", -"o_merid : tMERIDIAN", + +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/lib/bison.simple" +/* This file comes from bison-1.28. */ + +/* 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, 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. */ + +/* 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. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include <alloca.h> +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include <malloc.h> #endif -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include <malloc.h> */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca #else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH +#define YYSTACK_ALLOC malloc +#endif + +/* 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 goto yyacceptlab +#define YYABORT goto yyabortlab +#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 YYSTACKSIZE 10000 +#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 10000 #endif + +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,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 (to, from, count) + char *to; + char *from; + unsigned 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 *to, char *from, unsigned int count) +{ + register char *t = to; + register char *f = from; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + #endif -#define YYINITSTACKSIZE 200 -int yydebug; -int yynerrs; -struct yystack { - short *ssp; - YYSTYPE *vsp; - short *ss; - YYSTYPE *vs; - int stacksize; - short *sslim; -}; -int yychar; /* some people use this, so we copy it in & out */ -int yyerrflag; /* must be global for yyerrok & YYRECOVERING */ -YYSTYPE yylval; -#line 398 "/u/scjones/cvs-nightly/lib/getdate.y" +#endif + +#line 217 "/usr/lib/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 +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + +int +yyparse(YYPARSE_PARAM_ARG) + 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; + int yyfree_stacks = 0; + +#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"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) 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 + } + 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 163 "getdate.y" +{ + yyHaveTime++; + ; + break;} +case 4: +#line 166 "getdate.y" +{ + yyHaveZone++; + ; + break;} +case 5: +#line 169 "getdate.y" +{ + yyHaveDate++; + ; + break;} +case 6: +#line 172 "getdate.y" +{ + yyHaveDay++; + ; + break;} +case 7: +#line 175 "getdate.y" +{ + yyHaveRel++; + ; + break;} +case 9: +#line 181 "getdate.y" +{ + yyHour = yyvsp[-1].Number; + yyMinutes = 0; + yySeconds = 0; + yyMeridian = yyvsp[0].Meridian; + ; + break;} +case 10: +#line 187 "getdate.y" +{ + yyHour = yyvsp[-3].Number; + yyMinutes = yyvsp[-1].Number; + yySeconds = 0; + yyMeridian = yyvsp[0].Meridian; + ; + break;} +case 11: +#line 193 "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 200 "getdate.y" +{ + yyHour = yyvsp[-5].Number; + yyMinutes = yyvsp[-3].Number; + yySeconds = yyvsp[-1].Number; + yyMeridian = yyvsp[0].Meridian; + ; + break;} +case 13: +#line 206 "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 216 "getdate.y" +{ + yyTimezone = yyvsp[0].Number; + yyDSTmode = DSToff; + ; + break;} +case 15: +#line 220 "getdate.y" +{ + yyTimezone = yyvsp[0].Number; + yyDSTmode = DSTon; + ; + break;} +case 16: +#line 225 "getdate.y" +{ + yyTimezone = yyvsp[-1].Number; + yyDSTmode = DSTon; + ; + break;} +case 17: +#line 231 "getdate.y" +{ + yyDayOrdinal = 1; + yyDayNumber = yyvsp[0].Number; + ; + break;} +case 18: +#line 235 "getdate.y" +{ + yyDayOrdinal = 1; + yyDayNumber = yyvsp[-1].Number; + ; + break;} +case 19: +#line 239 "getdate.y" +{ + yyDayOrdinal = yyvsp[-1].Number; + yyDayNumber = yyvsp[0].Number; + ; + break;} +case 20: +#line 245 "getdate.y" +{ + yyMonth = yyvsp[-2].Number; + yyDay = yyvsp[0].Number; + ; + break;} +case 21: +#line 249 "getdate.y" +{ + if (yyvsp[-4].Number >= 100) { + yyYear = yyvsp[-4].Number; + yyMonth = yyvsp[-2].Number; + yyDay = yyvsp[0].Number; + } else { + yyMonth = yyvsp[-4].Number; + yyDay = yyvsp[-2].Number; + yyYear = yyvsp[0].Number; + } + ; + break;} +case 22: +#line 260 "getdate.y" +{ + /* ISO 8601 format. yyyy-mm-dd. */ + yyYear = yyvsp[-2].Number; + yyMonth = -yyvsp[-1].Number; + yyDay = -yyvsp[0].Number; + ; + break;} +case 23: +#line 266 "getdate.y" +{ + /* e.g. 17-JUN-1992. */ + yyDay = yyvsp[-2].Number; + yyMonth = yyvsp[-1].Number; + yyYear = -yyvsp[0].Number; + ; + break;} +case 24: +#line 272 "getdate.y" +{ + yyMonth = yyvsp[-1].Number; + yyDay = yyvsp[0].Number; + ; + break;} +case 25: +#line 276 "getdate.y" +{ + yyMonth = yyvsp[-3].Number; + yyDay = yyvsp[-2].Number; + yyYear = yyvsp[0].Number; + ; + break;} +case 26: +#line 281 "getdate.y" +{ + yyMonth = yyvsp[0].Number; + yyDay = yyvsp[-1].Number; + ; + break;} +case 27: +#line 285 "getdate.y" +{ + yyMonth = yyvsp[-1].Number; + yyDay = yyvsp[-2].Number; + yyYear = yyvsp[0].Number; + ; + break;} +case 28: +#line 292 "getdate.y" +{ + yyRelSeconds = -yyRelSeconds; + yyRelMonth = -yyRelMonth; + ; + break;} +case 30: +#line 299 "getdate.y" +{ + yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; + ; + break;} +case 31: +#line 302 "getdate.y" +{ + yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; + ; + break;} +case 32: +#line 305 "getdate.y" +{ + yyRelSeconds += yyvsp[0].Number * 60L; + ; + break;} +case 33: +#line 308 "getdate.y" +{ + yyRelSeconds += yyvsp[-1].Number; + ; + break;} +case 34: +#line 311 "getdate.y" +{ + yyRelSeconds += yyvsp[-1].Number; + ; + break;} +case 35: +#line 314 "getdate.y" +{ + yyRelSeconds++; + ; + break;} +case 36: +#line 317 "getdate.y" +{ + yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; + ; + break;} +case 37: +#line 320 "getdate.y" +{ + yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; + ; + break;} +case 38: +#line 323 "getdate.y" +{ + yyRelMonth += yyvsp[0].Number; + ; + break;} +case 39: +#line 328 "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 355 "getdate.y" +{ + yyval.Meridian = MER24; + ; + break;} +case 41: +#line 358 "getdate.y" +{ + yyval.Meridian = yyvsp[0].Meridian; + ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 543 "/usr/lib/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; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 1; +} +#line 363 "getdate.y" + /* Month and day table. */ static TABLE const MonthDayTable[] = { @@ -1052,547 +2021,3 @@ main(ac, av) /* NOTREACHED */ } #endif /* defined(TEST) */ -#line 1056 "y.tab.c" -/* allocate initial stack */ -#if defined(__STDC__) || defined(__cplusplus) -static int yyinitstack(struct yystack *sp) -#else -static int yyinitstack(sp) - struct yystack *sp; -#endif -{ - int newsize; - short *newss; - YYSTYPE *newvs; - - newsize = YYINITSTACKSIZE; - newss = (short *)malloc(newsize * sizeof *newss); - newvs = (YYSTYPE *)malloc(newsize * sizeof *newvs); - sp->ss = sp->ssp = newss; - sp->vs = sp->vsp = newvs; - if (newss == NULL || newvs == NULL) return -1; - sp->stacksize = newsize; - sp->sslim = newss + newsize - 1; - return 0; -} - -/* double stack size, up to YYMAXDEPTH */ -#if defined(__STDC__) || defined(__cplusplus) -static int yygrowstack(struct yystack *sp) -#else -static int yygrowstack(sp) - struct yystack *sp; -#endif -{ - int newsize, i; - short *newss; - YYSTYPE *newvs; - - if ((newsize = sp->stacksize) >= YYMAXDEPTH) return -1; - if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; - i = sp->ssp - sp->ss; - if ((newss = (short *)realloc(sp->ss, newsize * sizeof *newss)) == NULL) - return -1; - sp->ss = newss; - sp->ssp = newss + i; - if ((newvs = (YYSTYPE *)realloc(sp->vs, newsize * sizeof *newvs)) == NULL) - return -1; - sp->vs = newvs; - sp->vsp = newvs + i; - sp->stacksize = newsize; - sp->sslim = newss + newsize - 1; - return 0; -} - -#define YYFREESTACK(sp) { free((sp)->ss); free((sp)->vs); } - -#define YYABORT goto yyabort -#define YYREJECT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab -int -yyparse() -{ - register int yym, yyn, yystate, yych; - register YYSTYPE *yyvsp; - YYSTYPE yyval; - struct yystack yystk; -#if YYDEBUG - register char *yys; - extern char *getenv(); - - if (yys = getenv("YYDEBUG")) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = yych = YYEMPTY; - - if (yyinitstack(&yystk)) goto yyoverflow; - *yystk.ssp = yystate = 0; - -yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; - if (yych < 0) - { - if ((yych = YYLEX) < 0) yych = 0; - yychar = yych; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yych <= YYMAXTOKEN) yys = yyname[yych]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yych, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yych) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yych) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, yystate, yytable[yyn]); -#endif - if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) - goto yyoverflow; - *++yystk.ssp = yystate = yytable[yyn]; - *++yystk.vsp = yylval; - yychar = yych = YYEMPTY; - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yych) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yych) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; -#endif -yynewerror: - yyerror("syntax error"); -#ifdef lint - goto yyerrlab; -#endif -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yystk.ssp]) && - (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yystk.ssp, yytable[yyn]); -#endif - if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) - goto yyoverflow; - *++yystk.ssp = yystate = yytable[yyn]; - *++yystk.vsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yystk.ssp); -#endif - if (yystk.ssp <= yystk.ss) goto yyabort; - --yystk.ssp; - --yystk.vsp; - } - } - } - else - { - if (yych == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yych <= YYMAXTOKEN) yys = yyname[yych]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yych, yys); - } -#endif - yychar = yych = YYEMPTY; - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyvsp = yystk.vsp; /* for speed in code under switch() */ - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 3: -#line 197 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyHaveTime++; - } -break; -case 4: -#line 200 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyHaveZone++; - } -break; -case 5: -#line 203 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyHaveDate++; - } -break; -case 6: -#line 206 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyHaveDay++; - } -break; -case 7: -#line 209 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyHaveRel++; - } -break; -case 9: -#line 215 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyHour = yyvsp[-1].Number; - yyMinutes = 0; - yySeconds = 0; - yyMeridian = yyvsp[0].Meridian; - } -break; -case 10: -#line 221 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyHour = yyvsp[-3].Number; - yyMinutes = yyvsp[-1].Number; - yySeconds = 0; - yyMeridian = yyvsp[0].Meridian; - } -break; -case 11: -#line 227 "/u/scjones/cvs-nightly/lib/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 234 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyHour = yyvsp[-5].Number; - yyMinutes = yyvsp[-3].Number; - yySeconds = yyvsp[-1].Number; - yyMeridian = yyvsp[0].Meridian; - } -break; -case 13: -#line 240 "/u/scjones/cvs-nightly/lib/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 250 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyTimezone = yyvsp[0].Number; - yyDSTmode = DSToff; - } -break; -case 15: -#line 254 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyTimezone = yyvsp[0].Number; - yyDSTmode = DSTon; - } -break; -case 16: -#line 259 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyTimezone = yyvsp[-1].Number; - yyDSTmode = DSTon; - } -break; -case 17: -#line 265 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyDayOrdinal = 1; - yyDayNumber = yyvsp[0].Number; - } -break; -case 18: -#line 269 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyDayOrdinal = 1; - yyDayNumber = yyvsp[-1].Number; - } -break; -case 19: -#line 273 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyDayOrdinal = yyvsp[-1].Number; - yyDayNumber = yyvsp[0].Number; - } -break; -case 20: -#line 279 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyMonth = yyvsp[-2].Number; - yyDay = yyvsp[0].Number; - } -break; -case 21: -#line 283 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - if (yyvsp[-4].Number >= 100) { - yyYear = yyvsp[-4].Number; - yyMonth = yyvsp[-2].Number; - yyDay = yyvsp[0].Number; - } else { - yyMonth = yyvsp[-4].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; - } - } -break; -case 22: -#line 294 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - /* ISO 8601 format. yyyy-mm-dd. */ - yyYear = yyvsp[-2].Number; - yyMonth = -yyvsp[-1].Number; - yyDay = -yyvsp[0].Number; - } -break; -case 23: -#line 300 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - /* e.g. 17-JUN-1992. */ - yyDay = yyvsp[-2].Number; - yyMonth = yyvsp[-1].Number; - yyYear = -yyvsp[0].Number; - } -break; -case 24: -#line 306 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyMonth = yyvsp[-1].Number; - yyDay = yyvsp[0].Number; - } -break; -case 25: -#line 310 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyMonth = yyvsp[-3].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; - } -break; -case 26: -#line 315 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyMonth = yyvsp[0].Number; - yyDay = yyvsp[-1].Number; - } -break; -case 27: -#line 319 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyMonth = yyvsp[-1].Number; - yyDay = yyvsp[-2].Number; - yyYear = yyvsp[0].Number; - } -break; -case 28: -#line 326 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelSeconds = -yyRelSeconds; - yyRelMonth = -yyRelMonth; - } -break; -case 30: -#line 333 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; - } -break; -case 31: -#line 336 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L; - } -break; -case 32: -#line 339 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelSeconds += yyvsp[0].Number * 60L; - } -break; -case 33: -#line 342 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelSeconds += yyvsp[-1].Number; - } -break; -case 34: -#line 345 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelSeconds += yyvsp[-1].Number; - } -break; -case 35: -#line 348 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelSeconds++; - } -break; -case 36: -#line 351 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; - } -break; -case 37: -#line 354 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; - } -break; -case 38: -#line 357 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyRelMonth += yyvsp[0].Number; - } -break; -case 39: -#line 362 "/u/scjones/cvs-nightly/lib/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 389 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyval.Meridian = MER24; - } -break; -case 41: -#line 392 "/u/scjones/cvs-nightly/lib/getdate.y" -{ - yyval.Meridian = yyvsp[0].Meridian; - } -break; -#line 1541 "y.tab.c" - } - yystk.ssp -= yym; - yystate = *yystk.ssp; - yystk.vsp -= yym; - yym = yylhs[yyn]; - yych = yychar; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - yystate = YYFINAL; - *++yystk.ssp = YYFINAL; - *++yystk.vsp = yyval; - if (yych < 0) - { - if ((yych = YYLEX) < 0) yych = 0; - yychar = yych; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yych <= YYMAXTOKEN) yys = yyname[yych]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yych, yys); - } -#endif - } - if (yych == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yystk.ssp, yystate); -#endif - if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) - goto yyoverflow; - *++yystk.ssp = yystate; - *++yystk.vsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - YYFREESTACK(&yystk); - return (1); -yyaccept: - YYFREESTACK(&yystk); - return (0); -} diff --git a/gnu/usr.bin/cvs/lib/getdate.y b/gnu/usr.bin/cvs/lib/getdate.y index 9caaa367881..d090ff5359e 100644 --- a/gnu/usr.bin/cvs/lib/getdate.y +++ b/gnu/usr.bin/cvs/lib/getdate.y @@ -39,46 +39,11 @@ Include <sys/time.h> if that will be used. */ #if defined(vms) - -#include <types.h> -#include <time.h> - -#else - -#include <sys/types.h> - -#ifdef TIME_WITH_SYS_TIME -#include <sys/time.h> -#include <time.h> -#else -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#else -#include <time.h> -#endif -#endif - -#ifdef timezone -#undef timezone /* needed for sgi */ -#endif - -#if defined(HAVE_SYS_TIMEB_H) -#include <sys/timeb.h> -#else -/* -** We use the obsolete `struct timeb' as part of our interface! -** Since the system doesn't have it, we define it here; -** our callers must do likewise. -*/ -struct timeb { - time_t time; /* Seconds since the epoch */ - unsigned short millitm; /* Field not used */ - short timezone; /* Minutes west of GMT */ - short dstflag; /* Field not used */ -}; -#endif /* defined(HAVE_SYS_TIMEB_H) */ - -#endif /* defined(vms) */ +# include <types.h> +#else /* defined(vms) */ +# include <sys/types.h> +# include "xtime.h" +#endif /* !defined(vms) */ #if defined (STDC_HEADERS) || defined (USG) #include <string.h> @@ -115,6 +80,7 @@ extern struct tm *localtime(); #define yylex getdate_yylex #define yyerror getdate_yyerror +static int yyparse (); static int yylex (); static int yyerror (); |