⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getdate.c

📁 netflow,抓包
💻 C
📖 第 1 页 / 共 4 页
字号:
/*  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	tDAY_UNIT	259#define	tDAYZONE	260#define	tDST	261#define	tHOUR_UNIT	262#define	tID	263#define	tMERIDIAN	264#define	tMINUTE_UNIT	265#define	tMONTH	266#define	tMONTH_UNIT	267#define	tSEC_UNIT	268#define	tSNUMBER	269#define	tUNUMBER	270#define	tYEAR_UNIT	271#define	tZONE	272#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**  a couple of people on Usenet.  Completely overhauled by Rich $alz**  <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;****  This grammar has 13 shift/reduce conflicts.****  This code is in the public domain and has no copyright.*/#ifdef HAVE_CONFIG_H# ifdef FORCE_ALLOCA_H#  include <alloca.h># endif#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   wouldn't do any harm to #undef it here; this will only cause   problems if we try to write to a static variable, which I don't   think this code needs to do.  */#ifdef emacs# undef static#endif#include "ftconfig.h"#include "ftlib.h"#include <stdlib.h>#include <ctype.h>#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))# define IN_CTYPE_DOMAIN(c) 1#else# define IN_CTYPE_DOMAIN(c) isascii(c)#endif#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:   - Its arg may be any int or unsigned int; it need not be an unsigned char.   - It's guaranteed to evaluate its argument exactly once.   - It's typically faster.   Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that   only '0' through '9' are digits.  Prefer ISDIGIT to ISDIGIT_LOCALE unless   it's important to use the locale's definition of `digit' even when the   host does not conform to Posix.  */#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)#include <time.h>#if defined (STDC_HEADERS) || defined (USG)# include <string.h>#endif/* Some old versions of bison generate parsers that use bcopy.   That loses on systems that don't provide the function, so we have   to redefine it here.  */#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)# define bcopy(from, to, len) memcpy ((to), (from), (len))#endif/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),   as well as gratuitiously global symbol names, so we can have multiple   yacc generated parsers in the same program.  Note that these are only   the variables produced by yacc.  If other parser generators (bison,   byacc, etc) produce additional global names that conflict at link time,   then those parser generators need to be fixed instead of adding those   names to this list. */#define yymaxdepth gd_maxdepth#define yyparse gd_parse#define yylex   gd_lex#define yyerror gd_error#define yylval  gd_lval#define yychar  gd_char#define yydebug gd_debug#define yypact  gd_pact#define yyr1    gd_r1#define yyr2    gd_r2#define yydef   gd_def#define yychk   gd_chk#define yypgo   gd_pgo#define yyact   gd_act#define yyexca  gd_exca#define yyerrflag gd_errflag#define yynerrs gd_nerrs#define yyps    gd_ps#define yypv    gd_pv#define yys     gd_s#define yy_yys  gd_yys#define yystate gd_state#define yytmp   gd_tmp#define yyv     gd_v#define yy_yyv  gd_yyv#define yyval   gd_val#define yylloc  gd_lloc#define yyreds  gd_reds          /* With YYDEBUG defined */#define yytoks  gd_toks          /* With YYDEBUG defined */#define yylhs   gd_yylhs#define yylen   gd_yylen#define yydefred gd_yydefred#define yydgoto gd_yydgoto#define yysindex gd_yysindex#define yyrindex gd_yyrindex#define yygindex gd_yygindex#define yytable  gd_yytable#define yycheck  gd_yycheckstatic int yylex (void);static int yyerror (char *s);extern int yyparse (void);#define EPOCH		1970#define HOUR(x)		((x) * 60)#define MAX_BUFF_LEN    128   /* size of buffer to read the date into *//***  An entry in the lexical lookup table.*/typedef struct _TABLE {    const char	*name;    int		type;    int		value;} TABLE;/***  Meridian:  am, pm, or 24-hour style.*/typedef enum _MERIDIAN {    MERam, MERpm, MER24} MERIDIAN;/***  Global variables.  We could get rid of most of these by using a good**  union as the yacc stack.  (This routine was originally written before**  yacc had the %union construct.)  Maybe someday; right now we only use**  the %union very rarely.*/static const char	*yyInput;static int	yyDayOrdinal;static int	yyDayNumber;static int	yyHaveDate;static int	yyHaveDay;static int	yyHaveRel;static int	yyHaveTime;static int	yyHaveZone;static int	yyTimezone;static int	yyDay;static int	yyHour;static int	yyMinutes;static int	yyMonth;static int	yySeconds;static int	yyYear;static MERIDIAN	yyMeridian;static int	yyRelDay;static int	yyRelHour;static int	yyRelMinutes;static int	yyRelMonth;static int	yyRelSeconds;static int	yyRelYear;#line 182 "getdate.y"typedef union {    int			Number;    enum _MERIDIAN	Meridian;} YYSTYPE;#include <stdio.h>#ifndef __cplusplus#ifndef __STDC__#define const#endif#endif#define	YYFINAL		61#define	YYFLAG		-32768#define	YYNTBASE	22#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 32)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,    20,     2,     2,    21,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,    19,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,     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,    16,    17,    18};#if YYDEBUG != 0static 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,   123,   126,   128,   131,   134,   136,   139,   142,   144,   146,   147};static const short yyrhs[] = {    -1,    22,    23,     0,    24,     0,    25,     0,    27,     0,    26,     0,    28,     0,    30,     0,    16,    10,     0,    16,    19,    16,    31,     0,    16,    19,    16,    15,     0,    16,    19,    16,    19,    16,    31,     0,    16,    19,    16,    19,    16,    15,     0,    18,     0,     6,     0,    18,     7,     0,     4,     0,     4,    20,     0,    16,     4,     0,    16,    21,    16,     0,    16,    21,    16,    21,    16,     0,    16,    15,    15,     0,    16,    12,    15,     0,    12,    16,     0,    12,    16,    20,    16,     0,    16,    12,     0,    16,    12,    16,     0,    29,     3,     0,    29,     0,    16,    17,     0,    15,    17,     0,    17,     0,    16,    13,     0,    15,    13,     0,    13,     0,    16,     5,     0,    15,     5,     0,     5,     0,    16,     8,     0,    15,     8,     0,     8,     0,    16,    11,     0,    15,    11,     0,    11,     0,    16,    14,     0,    15,    14,     0,    14,     0,    16,     0,     0,    10,     0};#endif#if YYDEBUG != 0static const short yyrline[] = { 0,   198,   199,   202,   205,   208,   211,   214,   217,   220,   226,   232,   241,   247,   259,   262,   265,   271,   275,   279,   285,   289,   307,   313,   319,   323,   328,   332,   339,   347,   350,   353,   356,   359,   362,   365,   368,   371,   374,   377,   380,   383,   386,   389,   392,   395,   398,   401,   406,   439,   443};#endif#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)static const char * const yytname[] = {   "$","error","$undefined.","tAGO","tDAY","tDAY_UNIT","tDAYZONE","tDST","tHOUR_UNIT","tID","tMERIDIAN","tMINUTE_UNIT","tMONTH","tMONTH_UNIT","tSEC_UNIT","tSNUMBER","tUNUMBER","tYEAR_UNIT","tZONE","':'","','","'/'","spec","item","time","zone","day","date","rel","relunit","number","o_merid", NULL};#endifstatic const short yyr1[] = {     0,    22,    22,    23,    23,    23,    23,    23,    23,    24,    24,    24,    24,    24,    25,    25,    25,    26,    26,    26,    27,    27,    27,    27,    27,    27,    27,    27,    28,    28,    29,    29,    29,    29,    29,    29,    29,    29,    29,    29,    29,    29,    29,    29,    29,    29,    29,    29,    30,    31,    31};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,     2,     2,     1,     2,     2,     1,     2,     2,     1,     1,     0,     1};static const short yydefact[] = {     1,     0,    17,    38,    15,    41,    44,     0,    35,    47,     0,    48,    32,    14,     2,     3,     4,     6,     5,     7,    29,     8,    18,    24,    37,    40,    43,    34,    46,    31,    19,    36,    39,     9,    42,    26,    33,    45,     0,    30,     0,     0,    16,    28,     0,    23,    27,    22,    49,    20,    25,    50,    11,     0,    10,     0,    49,    21,    13,    12,     0,     0};static const short yydefgoto[] = {     1,    14,    15,    16,    17,    18,    19,    20,    21,    54};static const short yypact[] = {-32768,     0,   -19,-32768,-32768,-32768,-32768,   -13,-32768,-32768,    30,    15,-32768,    14,-32768,-32768,-32768,-32768,-32768,-32768,    19,-32768,-32768,     4,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    -6,-32768,-32768,    16,-32768,    17,    23,-32768,-32768,    24,-32768,-32768,-32768,    27,    28,-32768,-32768,-32768,    29,-32768,    32,    -8,-32768,-32768,-32768,    50,-32768};static const short yypgoto[] = {-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    -5};#define	YYLAST		51static const short yytable[] = {    60,    22,    51,    23,     2,     3,     4,    58,     5,    45,    46,     6,     7,     8,     9,    10,    11,    12,    13,    30,    31,    42,    43,    32,    44,    33,    34,    35,    36,    37,    38,    47,    39,    48,    40,    24,    41,    51,    25,    49,    50,    26,    52,    27,    28,    56,    53,    29,    57,    55,    61,    59};static const short yycheck[] = {     0,    20,    10,    16,     4,     5,     6,    15,     8,    15,    16,    11,    12,    13,    14,    15,    16,    17,    18,     4,     5,     7,     3,     8,    20,    10,    11,    12,    13,    14,    15,    15,    17,    16,    19,     5,    21,    10,     8,    16,    16,    11,    15,    13,    14,    16,    19,    17,    16,    21,     0,    56};/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */#line 3 "/usr/share/misc/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#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#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 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 YYPUREint	yychar;			/*  the lookahead symbol		*/YYSTYPE	yylval;			/*  the semantic value of the		*/				/*  lookahead symbol			*/#ifdef YYLSP_NEEDEDYYLTYPE yylloc;			/*  location data for the lookahead	*/				/*  symbol				*/#endifint yynerrs;			/*  number of parse errors so far       */#endif  /* not YYPURE */#if YYDEBUG != 0int yydebug;			/*  nonzero means print parse trace	*//* Since this is uninitialized, it does not stop multiple parsers   from coexisting.  */#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -