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

📄 getdate.c

📁 Linux下文件工具。
💻 C
📖 第 1 页 / 共 5 页
字号:
/* A Bison parser, made from getdate.y   by GNU bison 1.35.  */#define YYBISON 1  /* Identify Bison output.  */# define	tAGO	257# define	tDST	258# define	tDAY	259# define	tDAY_UNIT	260# define	tDAYZONE	261# define	tHOUR_UNIT	262# define	tLOCAL_ZONE	263# define	tMERIDIAN	264# define	tMINUTE_UNIT	265# define	tMONTH	266# define	tMONTH_UNIT	267# define	tSEC_UNIT	268# define	tYEAR_UNIT	269# define	tZONE	270# define	tSNUMBER	271# define	tUNUMBER	272#line 1 "getdate.y"/* Parse a string into an internal time stamp.   Copyright (C) 1999, 2000, 2002 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.  *//* 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.   Modified by Paul Eggert <eggert@twinsun.com> in August 1999 to do   the right thing about local DST.  Unlike previous versions, this   version is reentrant.  */#ifdef HAVE_CONFIG_H# include <config.h># ifdef HAVE_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 <ctype.h>#if HAVE_STDLIB_H# include <stdlib.h> /* for `free'; used by Bison 1.27 */#endif#if STDC_HEADERS || (! defined isascii && ! 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 ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (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 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)#if STDC_HEADERS || HAVE_STRING_H# include <string.h>#endif#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__# define __attribute__(x)#endif#ifndef ATTRIBUTE_UNUSED# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))#endif#define EPOCH_YEAR 1970#define TM_YEAR_BASE 1900#define HOUR(x) ((x) * 60)/* An integer value, and the number of digits in its textual   representation.  */typedef struct{  int value;  int digits;} textint;/* An entry in the lexical lookup table.  */typedef struct{  char const *name;  int type;  int value;} table;/* Meridian: am, pm, or 24-hour style.  */enum { MERam, MERpm, MER24 };/* Information passed to and from the parser.  */typedef struct{  /* The input string remaining to be parsed. */  const char *input;  /* N, if this is the Nth Tuesday.  */  int day_ordinal;  /* Day of week; Sunday is 0.  */  int day_number;  /* tm_isdst flag for the local zone.  */  int local_isdst;  /* Time zone, in minutes east of UTC.  */  int time_zone;  /* Style used for time.  */  int meridian;  /* Gregorian year, month, day, hour, minutes, and seconds.  */  textint year;  int month;  int day;  int hour;  int minutes;  int seconds;  /* Relative year, month, day, hour, minutes, and seconds.  */  int rel_year;  int rel_month;  int rel_day;  int rel_hour;  int rel_minutes;  int rel_seconds;  /* Counts of nonterminals of various flavors parsed so far.  */  int dates_seen;  int days_seen;  int local_zones_seen;  int rels_seen;  int times_seen;  int zones_seen;  /* Table of local time zone abbrevations, terminated by a null entry.  */  table local_time_zone_table[3];} parser_control;#define PC (* (parser_control *) parm)#define YYLEX_PARAM parm#define YYPARSE_PARAM parmstatic int yyerror ();static int yylex ();#line 171 "getdate.y"#ifndef YYSTYPEtypedef union{  int intval;  textint textintval;} yystype;# define YYSTYPE yystype# define YYSTYPE_IS_TRIVIAL 1#endif#ifndef YYDEBUG# define YYDEBUG 0#endif#define	YYFINAL		64#define	YYFLAG		-32768#define	YYNTBASE	22/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 33)/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */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 YYDEBUGstatic const short yyprhs[] ={       0,     0,     1,     4,     6,     8,    10,    12,    14,    16,      18,    21,    26,    31,    38,    45,    47,    50,    52,    54,      57,    59,    62,    65,    69,    75,    79,    83,    86,    91,      94,    98,   101,   103,   106,   109,   111,   114,   117,   119,     122,   125,   127,   130,   133,   135,   138,   141,   143,   146,     149,   151,   153,   154};static const short yyrhs[] ={      -1,    22,    23,     0,    24,     0,    25,     0,    26,     0,      28,     0,    27,     0,    29,     0,    31,     0,    18,    10,       0,    18,    19,    18,    32,     0,    18,    19,    18,    17,       0,    18,    19,    18,    19,    18,    32,     0,    18,    19,      18,    19,    18,    17,     0,     9,     0,     9,     4,     0,      16,     0,     7,     0,    16,     4,     0,     5,     0,     5,      20,     0,    18,     5,     0,    18,    21,    18,     0,    18,      21,    18,    21,    18,     0,    18,    17,    17,     0,    18,      12,    17,     0,    12,    18,     0,    12,    18,    20,    18,       0,    18,    12,     0,    18,    12,    18,     0,    30,     3,       0,    30,     0,    18,    15,     0,    17,    15,     0,    15,       0,    18,    13,     0,    17,    13,     0,    13,     0,    18,       6,     0,    17,     6,     0,     6,     0,    18,     8,     0,      17,     8,     0,     8,     0,    18,    11,     0,    17,    11,       0,    11,     0,    18,    14,     0,    17,    14,     0,    14,       0,    18,     0,     0,    10,     0};#endif#if YYDEBUG/* YYRLINE[YYN] -- source line where rule number YYN was defined. */static const short yyrline[] ={       0,   188,   190,   193,   196,   198,   200,   202,   204,   206,     209,   217,   224,   232,   239,   250,   253,   257,   260,   262,     266,   272,   277,   284,   290,   310,   317,   325,   330,   336,     341,   349,   359,   362,   365,   367,   369,   371,   373,   375,     377,   379,   381,   383,   385,   387,   389,   391,   393,   395,     397,   401,   437,   440};#endif#if (YYDEBUG) || defined YYERROR_VERBOSE/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */static const char *const yytname[] ={  "$", "error", "$undefined.", "tAGO", "tDST", "tDAY", "tDAY_UNIT",   "tDAYZONE", "tHOUR_UNIT", "tLOCAL_ZONE", "tMERIDIAN", "tMINUTE_UNIT",   "tMONTH", "tMONTH_UNIT", "tSEC_UNIT", "tYEAR_UNIT", "tZONE", "tSNUMBER",   "tUNUMBER", "':'", "','", "'/'", "spec", "item", "time", "local_zone",   "zone", "day", "date", "rel", "relunit", "number", "o_merid", 0};#endif/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */static const short yyr1[] ={       0,    22,    22,    23,    23,    23,    23,    23,    23,    23,      24,    24,    24,    24,    24,    25,    25,    26,    26,    26,      27,    27,    27,    28,    28,    28,    28,    28,    28,    28,      28,    29,    29,    30,    30,    30,    30,    30,    30,    30,      30,    30,    30,    30,    30,    30,    30,    30,    30,    30,      30,    31,    32,    32};/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */static const short yyr2[] ={       0,     0,     2,     1,     1,     1,     1,     1,     1,     1,       2,     4,     4,     6,     6,     1,     2,     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};/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE   doesn't specify something else to do.  Zero means the default is an   error. */static const short yydefact[] ={       1,     0,    20,    41,    18,    44,    15,    47,     0,    38,      50,    35,    17,     0,    51,     2,     3,     4,     5,     7,       6,     8,    32,     9,    21,    16,    27,    19,    40,    43,      46,    37,    49,    34,    22,    39,    42,    10,    45,    29,      36,    48,    33,     0,     0,     0,    31,     0,    26,    30,      25,    52,    23,    28,    53,    12,     0,    11,     0,    52,      24,    14,    13,     0,     0};static const short yydefgoto[] ={       1,    15,    16,    17,    18,    19,    20,    21,    22,    23,      57};static const short yypact[] ={  -32768,     0,     1,-32768,-32768,-32768,    19,-32768,   -14,-32768,  -32768,-32768,    32,    26,    14,-32768,-32768,-32768,-32768,-32768,  -32768,-32768,    27,-32768,-32768,-32768,    22,-32768,-32768,-32768,  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   -16,  -32768,-32768,-32768,    29,    25,    30,-32768,    31,-32768,-32768,  -32768,    28,    23,-32768,-32768,-32768,    33,-32768,    34,    -7,  -32768,-32768,-32768,    50,-32768};static const short yypgoto[] ={  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,      -6};#define	YYLAST		53static const short yytable[] ={      63,    48,    49,    54,    26,     2,     3,     4,     5,     6,      61,     7,     8,     9,    10,    11,    12,    13,    14,    34,      35,    24,    36,    25,    37,    38,    39,    40,    41,    42,      46,    43,    28,    44,    29,    45,    27,    30,    54,    31,      32,    33,    47,    51,    58,    55,    50,    56,    52,    53,      64,    59,    60,    62};static const short yycheck[] ={       0,    17,    18,    10,    18,     5,     6,     7,     8,     9,      17,    11,    12,    13,    14,    15,    16,    17,    18,     5,       6,    20,     8,     4,    10,    11,    12,    13,    14,    15,       3,    17,     6,    19,     8,    21,     4,    11,    10,    13,      14,    15,    20,    18,    21,    17,    17,    19,    18,    18,       0,    18,    18,    59};#define YYPURE 1/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */#line 3 "/p/share/bison/bison.simple"/* Skeleton output parser for bison,   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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.  *//* All symbols defined below should begin with yy or YY, to avoid   infringing on user name space.  This should be done even for local   variables, as they might otherwise be expanded by user macros.   There are some unavoidable exceptions within include files to   define necessary library symbols; they are noted "INFRINGES ON   USER NAME SPACE" below.  */#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)/* The parser invokes alloca or malloc; define the necessary symbols.  */# if YYSTACK_USE_ALLOCA#  define YYSTACK_ALLOC alloca# else#  ifndef YYSTACK_USE_ALLOCA#   if defined (alloca) || defined (_ALLOCA_H)#    define YYSTACK_ALLOC alloca#   else#    ifdef __GNUC__#     define YYSTACK_ALLOC __builtin_alloca#    endif#   endif#  endif# endif# ifdef YYSTACK_ALLOC   /* Pacify GCC's `empty if-body' warning. */#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)# else#  if defined (__STDC__) || defined (__cplusplus)#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */#   define YYSIZE_T size_t#  endif#  define YYSTACK_ALLOC malloc#  define YYSTACK_FREE free# endif#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */#if (! defined (yyoverflow) \     && (! defined (__cplusplus) \	 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))/* A type that is properly aligned for any stack member.  */union yyalloc{

⌨️ 快捷键说明

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