Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

ptlib: missing bison.patch

+2887
+2887
pkgs/development/libraries/ptlib/bison.patch
··· 1 + --- a/src/ptlib/common/getdate.tab.c (revision 0) 2 + +++ b/src/ptlib/common/getdate.tab.c (revision 31087) 3 + @@ -0,0 +1,2884 @@ 4 + +/* A Bison parser, made by GNU Bison 2.7.12-4996. */ 5 + + 6 + +/* Bison implementation for Yacc-like parsers in C 7 + + 8 + + Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 9 + + 10 + + This program is free software: you can redistribute it and/or modify 11 + + it under the terms of the GNU General Public License as published by 12 + + the Free Software Foundation, either version 3 of the License, or 13 + + (at your option) any later version. 14 + + 15 + + This program is distributed in the hope that it will be useful, 16 + + but WITHOUT ANY WARRANTY; without even the implied warranty of 17 + + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 + + GNU General Public License for more details. 19 + + 20 + + You should have received a copy of the GNU General Public License 21 + + along with this program. If not, see <http://www.gnu.org/licenses/>. */ 22 + + 23 + +/* As a special exception, you may create a larger work that contains 24 + + part or all of the Bison parser skeleton and distribute that work 25 + + under terms of your choice, so long as that work isn't itself a 26 + + parser generator using the skeleton or a modified version thereof 27 + + as a parser skeleton. Alternatively, if you modify or redistribute 28 + + the parser skeleton itself, you may (at your option) remove this 29 + + special exception, which will cause the skeleton and the resulting 30 + + Bison output files to be licensed under the GNU General Public 31 + + License without this special exception. 32 + + 33 + + This special exception was added by the Free Software Foundation in 34 + + version 2.2 of Bison. */ 35 + + 36 + +/* C LALR(1) parser skeleton written by Richard Stallman, by 37 + + simplifying the original so-called "semantic" parser. */ 38 + + 39 + +/* All symbols defined below should begin with yy or YY, to avoid 40 + + infringing on user name space. This should be done even for local 41 + + variables, as they might otherwise be expanded by user macros. 42 + + There are some unavoidable exceptions within include files to 43 + + define necessary library symbols; they are noted "INFRINGES ON 44 + + USER NAME SPACE" below. */ 45 + + 46 + +/* Identify Bison output. */ 47 + +#define YYBISON 1 48 + + 49 + +/* Bison version. */ 50 + +#define YYBISON_VERSION "2.7.12-4996" 51 + + 52 + +/* Skeleton name. */ 53 + +#define YYSKELETON_NAME "yacc.c" 54 + + 55 + +/* Pure parsers. */ 56 + +#define YYPURE 1 57 + + 58 + +/* Push parsers. */ 59 + +#define YYPUSH 0 60 + + 61 + +/* Pull parsers. */ 62 + +#define YYPULL 1 63 + + 64 + + 65 + + 66 + + 67 + +/* Copy the first part of user declarations. */ 68 + +/* Line 371 of yacc.c */ 69 + +#line 1 "ptlib/common/getdate.y" 70 + + 71 + +/* 72 + +** Originally written by Steven M. Bellovin <smb@research.att.com> while 73 + +** at the University of North Carolina at Chapel Hill. Later tweaked by 74 + +** a couple of people on Usenet. Completely overhauled by Rich $alz 75 + +** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990; 76 + +** 77 + +** Major hack to coerce it into use with the Equivalence Portable 78 + +** Windows Library. 79 + +** 80 + +** This grammar has 10 shift/reduce conflicts. 81 + +** 82 + +** This code is in the public domain and has no copyright. 83 + +*/ 84 + +/* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */ 85 + +/* SUPPRESS 288 on yyerrlab *//* Label unused */ 86 + + 87 + + 88 + +#include <time.h> 89 + +#include <string.h> 90 + +#include <ctype.h> 91 + +#include <stdlib.h> 92 + + 93 + +#ifndef EOF 94 + +#include <stdio.h> 95 + +#endif 96 + + 97 + + 98 + +#ifdef _WIN32 99 + +#ifdef _MSC_VER 100 + +#pragma warning(disable:4131 4701 4996) 101 + +#endif 102 + +#define STDAPICALLTYPE __stdcall 103 + +#define MSDOS 104 + +#else 105 + +#define STDAPICALLTYPE 106 + +#endif 107 + + 108 + + 109 + +extern int STDAPICALLTYPE PTimeGetChar(void * stream); 110 + +extern void STDAPICALLTYPE PTimeUngetChar(void * stream, int c); 111 + +int STDAPICALLTYPE PTimeGetDateOrder(); 112 + +int STDAPICALLTYPE PTimeIsMonthName(const char *, int, int); 113 + +int STDAPICALLTYPE PTimeIsDayName(const char *, int, int); 114 + + 115 + + 116 + +#define EPOCH 1970 117 + +#define HOUR(x) ((time_t)(x) * 60) 118 + +#define SECSPERDAY (24L * 60L * 60L) 119 + + 120 + + 121 + +/* 122 + +** An entry in the lexical lookup table. 123 + +*/ 124 + +typedef struct _TABLE { 125 + + char *name; 126 + + int type; 127 + + time_t value; 128 + +} TABLE; 129 + + 130 + + 131 + +/* 132 + +** Daylight-savings mode: on, off, or not yet known. 133 + +*/ 134 + +typedef enum _DSTMODE { 135 + + DSTon, DSToff, DSTmaybe 136 + +} DSTMODE; 137 + + 138 + +/* 139 + +** Meridian: am, pm, or 24-hour style. 140 + +*/ 141 + +typedef enum _MERIDIAN { 142 + + MERam, MERpm, MER24 143 + +} MERIDIAN; 144 + + 145 + + 146 + +/* 147 + +** Global variables. We could get rid of most of these by using a good 148 + +** union as the yacc stack. (This routine was originally written before 149 + +** yacc had the %union construct.) Maybe someday; right now we only use 150 + +** the %union very rarely. 151 + +*/ 152 + +struct Variables { 153 + + void *yyInput; 154 + + DSTMODE yyDSTmode; 155 + + time_t yyDayOrdinal; 156 + + time_t yyDayNumber; 157 + + int yyHaveDate; 158 + + int yyHaveDay; 159 + + int yyHaveRel; 160 + + int yyHaveTime; 161 + + int yyHaveZone; 162 + + time_t yyTimezone; 163 + + time_t yyDay; 164 + + time_t yyHour; 165 + + time_t yyMinutes; 166 + + time_t yyMonth; 167 + + time_t yySeconds; 168 + + time_t yyYear; 169 + + MERIDIAN yyMeridian; 170 + + time_t yyRelMonth; 171 + + time_t yyRelSeconds; 172 + +}; 173 + + 174 + +#define VARIABLE ((struct Variables*)parseParam) 175 + + 176 + + 177 + +#define YYPURE 1 178 + +#define YYLEX_PARAM VARIABLE 179 + +#define YYPARSE_PARAM parseParam 180 + + 181 + +#define yyparse PTime_yyparse 182 + +#define yylex PTime_yylex 183 + +#define yyerror PTime_yyerror 184 + + 185 + +#define GCC_VERSION (__GNUC__ * 10000 \ 186 + + + __GNUC_MINOR__ * 100 \ 187 + + + __GNUC_PATCHLEVEL__) 188 + + 189 + +static int yyparse(void *); 190 + +static int yylex(); 191 + + 192 + +#ifdef __GNUC__ 193 + +static int yyerror(char const *msg); 194 + +#else 195 + +static void yyerror(char const *msg); 196 + +#endif 197 + + 198 + + 199 + +static void SetPossibleDate(struct Variables*, time_t, time_t, time_t); 200 + + 201 + + 202 + + 203 + +/* Line 371 of yacc.c */ 204 + +#line 202 "ptlib/common/getdate.tab.c" 205 + + 206 + +# ifndef YY_NULL 207 + +# if defined __cplusplus && 201103L <= __cplusplus 208 + +# define YY_NULL nullptr 209 + +# else 210 + +# define YY_NULL 0 211 + +# endif 212 + +# endif 213 + + 214 + +/* Enabling verbose error messages. */ 215 + +#ifdef YYERROR_VERBOSE 216 + +# undef YYERROR_VERBOSE 217 + +# define YYERROR_VERBOSE 1 218 + +#else 219 + +# define YYERROR_VERBOSE 0 220 + +#endif 221 + + 222 + + 223 + +/* Enabling traces. */ 224 + +#ifndef YYDEBUG 225 + +# define YYDEBUG 0 226 + +#endif 227 + +#if YYDEBUG 228 + +extern int yydebug; 229 + +#endif 230 + + 231 + +/* Tokens. */ 232 + +#ifndef YYTOKENTYPE 233 + +# define YYTOKENTYPE 234 + + /* Put the tokens into the symbol table, so that GDB and other debuggers 235 + + know about them. */ 236 + + enum yytokentype { 237 + + tAGO = 258, 238 + + tDAY = 259, 239 + + tDAYZONE = 260, 240 + + tID = 261, 241 + + tMERIDIAN = 262, 242 + + tMINUTE_UNIT = 263, 243 + + tMONTH = 264, 244 + + tMONTH_UNIT = 265, 245 + + tSNUMBER = 266, 246 + + tS4DIGITNUMBER = 267, 247 + + tUNUMBER = 268, 248 + + t4DIGITNUMBER = 269, 249 + + t6DIGITNUMBER = 270, 250 + + t8DIGITNUMBER = 271, 251 + + tSEC_UNIT = 272, 252 + + tZONE = 273, 253 + + tMILZONE = 274, 254 + + tRFC3339 = 275, 255 + + tDST = 276 256 + + }; 257 + +#endif 258 + + 259 + + 260 + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 261 + +typedef union YYSTYPE 262 + +{ 263 + +/* Line 387 of yacc.c */ 264 + +#line 137 "ptlib/common/getdate.y" 265 + + 266 + + time_t Number; 267 + + enum _MERIDIAN Meridian; 268 + + 269 + + 270 + +/* Line 387 of yacc.c */ 271 + +#line 269 "ptlib/common/getdate.tab.c" 272 + +} YYSTYPE; 273 + +# define YYSTYPE_IS_TRIVIAL 1 274 + +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 275 + +# define YYSTYPE_IS_DECLARED 1 276 + +#endif 277 + + 278 + + 279 + +#ifdef YYPARSE_PARAM 280 + +#if defined __STDC__ || defined __cplusplus 281 + +int yyparse (void *YYPARSE_PARAM); 282 + +#else 283 + +int yyparse (); 284 + +#endif 285 + +#else /* ! YYPARSE_PARAM */ 286 + +#if defined __STDC__ || defined __cplusplus 287 + +int yyparse (void); 288 + +#else 289 + +int yyparse (); 290 + +#endif 291 + +#endif /* ! YYPARSE_PARAM */ 292 + + 293 + + 294 + + 295 + +/* Copy the second part of user declarations. */ 296 + + 297 + +/* Line 390 of yacc.c */ 298 + +#line 296 "ptlib/common/getdate.tab.c" 299 + + 300 + +#ifdef short 301 + +# undef short 302 + +#endif 303 + + 304 + +#ifdef YYTYPE_UINT8 305 + +typedef YYTYPE_UINT8 yytype_uint8; 306 + +#else 307 + +typedef unsigned char yytype_uint8; 308 + +#endif 309 + + 310 + +#ifdef YYTYPE_INT8 311 + +typedef YYTYPE_INT8 yytype_int8; 312 + +#elif (defined __STDC__ || defined __C99__FUNC__ \ 313 + + || defined __cplusplus || defined _MSC_VER) 314 + +typedef signed char yytype_int8; 315 + +#else 316 + +typedef short int yytype_int8; 317 + +#endif 318 + + 319 + +#ifdef YYTYPE_UINT16 320 + +typedef YYTYPE_UINT16 yytype_uint16; 321 + +#else 322 + +typedef unsigned short int yytype_uint16; 323 + +#endif 324 + + 325 + +#ifdef YYTYPE_INT16 326 + +typedef YYTYPE_INT16 yytype_int16; 327 + +#else 328 + +typedef short int yytype_int16; 329 + +#endif 330 + + 331 + +#ifndef YYSIZE_T 332 + +# ifdef __SIZE_TYPE__ 333 + +# define YYSIZE_T __SIZE_TYPE__ 334 + +# elif defined size_t 335 + +# define YYSIZE_T size_t 336 + +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 337 + + || defined __cplusplus || defined _MSC_VER) 338 + +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 339 + +# define YYSIZE_T size_t 340 + +# else 341 + +# define YYSIZE_T unsigned int 342 + +# endif 343 + +#endif 344 + + 345 + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 346 + + 347 + +#ifndef YY_ 348 + +# if defined YYENABLE_NLS && YYENABLE_NLS 349 + +# if ENABLE_NLS 350 + +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 351 + +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) 352 + +# endif 353 + +# endif 354 + +# ifndef YY_ 355 + +# define YY_(Msgid) Msgid 356 + +# endif 357 + +#endif 358 + + 359 + +#ifndef __attribute__ 360 + +/* This feature is available in gcc versions 2.5 and later. */ 361 + +# if (! defined __GNUC__ || __GNUC__ < 2 \ 362 + + || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) 363 + +# define __attribute__(Spec) /* empty */ 364 + +# endif 365 + +#endif 366 + + 367 + +/* Suppress unused-variable warnings by "using" E. */ 368 + +#if ! defined lint || defined __GNUC__ 369 + +# define YYUSE(E) ((void) (E)) 370 + +#else 371 + +# define YYUSE(E) /* empty */ 372 + +#endif 373 + + 374 + + 375 + +/* Identity function, used to suppress warnings about constant conditions. */ 376 + +#ifndef lint 377 + +# define YYID(N) (N) 378 + +#else 379 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 380 + + || defined __cplusplus || defined _MSC_VER) 381 + +static int 382 + +YYID (int yyi) 383 + +#else 384 + +static int 385 + +YYID (yyi) 386 + + int yyi; 387 + +#endif 388 + +{ 389 + + return yyi; 390 + +} 391 + +#endif 392 + + 393 + +#if ! defined yyoverflow || YYERROR_VERBOSE 394 + + 395 + +/* The parser invokes alloca or malloc; define the necessary symbols. */ 396 + + 397 + +# ifdef YYSTACK_USE_ALLOCA 398 + +# if YYSTACK_USE_ALLOCA 399 + +# ifdef __GNUC__ 400 + +# define YYSTACK_ALLOC __builtin_alloca 401 + +# elif defined __BUILTIN_VA_ARG_INCR 402 + +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 403 + +# elif defined _AIX 404 + +# define YYSTACK_ALLOC __alloca 405 + +# elif defined _MSC_VER 406 + +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 407 + +# define alloca _alloca 408 + +# else 409 + +# define YYSTACK_ALLOC alloca 410 + +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 411 + + || defined __cplusplus || defined _MSC_VER) 412 + +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 413 + + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 414 + +# ifndef EXIT_SUCCESS 415 + +# define EXIT_SUCCESS 0 416 + +# endif 417 + +# endif 418 + +# endif 419 + +# endif 420 + +# endif 421 + + 422 + +# ifdef YYSTACK_ALLOC 423 + + /* Pacify GCC's `empty if-body' warning. */ 424 + +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 425 + +# ifndef YYSTACK_ALLOC_MAXIMUM 426 + + /* The OS might guarantee only one guard page at the bottom of the stack, 427 + + and a page size can be as small as 4096 bytes. So we cannot safely 428 + + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 429 + + to allow for a few compiler-allocated temporary stack slots. */ 430 + +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 431 + +# endif 432 + +# else 433 + +# define YYSTACK_ALLOC YYMALLOC 434 + +# define YYSTACK_FREE YYFREE 435 + +# ifndef YYSTACK_ALLOC_MAXIMUM 436 + +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 437 + +# endif 438 + +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ 439 + + && ! ((defined YYMALLOC || defined malloc) \ 440 + + && (defined YYFREE || defined free))) 441 + +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 442 + +# ifndef EXIT_SUCCESS 443 + +# define EXIT_SUCCESS 0 444 + +# endif 445 + +# endif 446 + +# ifndef YYMALLOC 447 + +# define YYMALLOC malloc 448 + +# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 449 + + || defined __cplusplus || defined _MSC_VER) 450 + +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 451 + +# endif 452 + +# endif 453 + +# ifndef YYFREE 454 + +# define YYFREE free 455 + +# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 456 + + || defined __cplusplus || defined _MSC_VER) 457 + +void free (void *); /* INFRINGES ON USER NAME SPACE */ 458 + +# endif 459 + +# endif 460 + +# endif 461 + +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 462 + + 463 + + 464 + +#if (! defined yyoverflow \ 465 + + && (! defined __cplusplus \ 466 + + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 467 + + 468 + +/* A type that is properly aligned for any stack member. */ 469 + +union yyalloc 470 + +{ 471 + + yytype_int16 yyss_alloc; 472 + + YYSTYPE yyvs_alloc; 473 + +}; 474 + + 475 + +/* The size of the maximum gap between one aligned stack and the next. */ 476 + +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 477 + + 478 + +/* The size of an array large to enough to hold all stacks, each with 479 + + N elements. */ 480 + +# define YYSTACK_BYTES(N) \ 481 + + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 482 + + + YYSTACK_GAP_MAXIMUM) 483 + + 484 + +# define YYCOPY_NEEDED 1 485 + + 486 + +/* Relocate STACK from its old location to the new one. The 487 + + local variables YYSIZE and YYSTACKSIZE give the old and new number of 488 + + elements in the stack, and YYPTR gives the new location of the 489 + + stack. Advance YYPTR to a properly aligned location for the next 490 + + stack. */ 491 + +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 492 + + do \ 493 + + { \ 494 + + YYSIZE_T yynewbytes; \ 495 + + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 496 + + Stack = &yyptr->Stack_alloc; \ 497 + + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 498 + + yyptr += yynewbytes / sizeof (*yyptr); \ 499 + + } \ 500 + + while (YYID (0)) 501 + + 502 + +#endif 503 + + 504 + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED 505 + +/* Copy COUNT objects from SRC to DST. The source and destination do 506 + + not overlap. */ 507 + +# ifndef YYCOPY 508 + +# if defined __GNUC__ && 1 < __GNUC__ 509 + +# define YYCOPY(Dst, Src, Count) \ 510 + + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 511 + +# else 512 + +# define YYCOPY(Dst, Src, Count) \ 513 + + do \ 514 + + { \ 515 + + YYSIZE_T yyi; \ 516 + + for (yyi = 0; yyi < (Count); yyi++) \ 517 + + (Dst)[yyi] = (Src)[yyi]; \ 518 + + } \ 519 + + while (YYID (0)) 520 + +# endif 521 + +# endif 522 + +#endif /* !YYCOPY_NEEDED */ 523 + + 524 + +/* YYFINAL -- State number of the termination state. */ 525 + +#define YYFINAL 2 526 + +/* YYLAST -- Last index in YYTABLE. */ 527 + +#define YYLAST 105 528 + + 529 + +/* YYNTOKENS -- Number of terminals. */ 530 + +#define YYNTOKENS 25 531 + +/* YYNNTS -- Number of nonterminals. */ 532 + +#define YYNNTS 12 533 + +/* YYNRULES -- Number of rules. */ 534 + +#define YYNRULES 51 535 + +/* YYNRULES -- Number of states. */ 536 + +#define YYNSTATES 63 537 + + 538 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 539 + +#define YYUNDEFTOK 2 540 + +#define YYMAXUTOK 276 541 + + 542 + +#define YYTRANSLATE(YYX) \ 543 + + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 544 + + 545 + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 546 + +static const yytype_uint8 yytranslate[] = 547 + +{ 548 + + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 549 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 550 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 551 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 552 + + 2, 2, 2, 2, 23, 2, 2, 24, 2, 2, 553 + + 2, 2, 2, 2, 2, 2, 2, 2, 22, 2, 554 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 555 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 556 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 557 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 558 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 559 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 560 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 561 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 562 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 563 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 564 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 565 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 566 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 567 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 568 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 569 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 570 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 571 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 572 + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 573 + + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 574 + + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 575 + + 15, 16, 17, 18, 19, 20, 21 576 + +}; 577 + + 578 + +#if YYDEBUG 579 + +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 580 + + YYRHS. */ 581 + +static const yytype_uint8 yyprhs[] = 582 + +{ 583 + + 0, 0, 3, 4, 7, 9, 11, 13, 15, 17, 584 + + 19, 22, 25, 28, 33, 38, 45, 52, 54, 56, 585 + + 59, 61, 63, 66, 69, 73, 79, 84, 86, 90, 586 + + 93, 98, 101, 105, 108, 110, 113, 116, 118, 121, 587 + + 124, 126, 129, 132, 134, 136, 138, 140, 142, 144, 588 + + 146, 147 589 + +}; 590 + + 591 + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 592 + +static const yytype_int8 yyrhs[] = 593 + +{ 594 + + 26, 0, -1, -1, 26, 27, -1, 28, -1, 29, 595 + + -1, 31, -1, 30, -1, 32, -1, 35, -1, 13, 596 + + 7, -1, 14, 12, -1, 15, 12, -1, 34, 22, 597 + + 34, 36, -1, 34, 22, 34, 12, -1, 34, 22, 598 + + 34, 22, 34, 36, -1, 34, 22, 34, 22, 34, 599 + + 12, -1, 18, -1, 5, -1, 18, 21, -1, 19, 600 + + -1, 4, -1, 4, 23, -1, 34, 4, -1, 34, 601 + + 24, 34, -1, 34, 24, 34, 24, 34, -1, 34, 602 + + 11, 11, 20, -1, 16, -1, 34, 9, 11, -1, 603 + + 9, 34, -1, 9, 34, 23, 34, -1, 34, 9, 604 + + -1, 34, 9, 34, -1, 33, 3, -1, 33, -1, 605 + + 34, 8, -1, 11, 8, -1, 8, -1, 11, 17, 606 + + -1, 34, 17, -1, 17, -1, 11, 10, -1, 34, 607 + + 10, -1, 10, -1, 13, -1, 14, -1, 15, -1, 608 + + 13, -1, 14, -1, 15, -1, -1, 7, -1 609 + +}; 610 + + 611 + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 612 + +static const yytype_uint16 yyrline[] = 613 + +{ 614 + + 0, 153, 153, 154, 157, 160, 163, 166, 169, 172, 615 + + 175, 181, 189, 197, 203, 210, 216, 226, 230, 235, 616 + + 239, 249, 253, 257, 263, 266, 269, 273, 278, 282, 617 + + 289, 294, 301, 306, 310, 313, 316, 319, 322, 325, 618 + + 328, 331, 334, 337, 342, 345, 348, 353, 379, 390, 619 + + 407, 410 620 + +}; 621 + +#endif 622 + + 623 + +#if YYDEBUG || YYERROR_VERBOSE || 0 624 + +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 625 + + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 626 + +static const char *const yytname[] = 627 + +{ 628 + + "$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID", 629 + + "tMERIDIAN", "tMINUTE_UNIT", "tMONTH", "tMONTH_UNIT", "tSNUMBER", 630 + + "tS4DIGITNUMBER", "tUNUMBER", "t4DIGITNUMBER", "t6DIGITNUMBER", 631 + + "t8DIGITNUMBER", "tSEC_UNIT", "tZONE", "tMILZONE", "tRFC3339", "tDST", 632 + + "':'", "','", "'/'", "$accept", "spec", "item", "time", "zone", "day", 633 + + "date", "rel", "relunit", "unumber", "number", "o_merid", YY_NULL 634 + +}; 635 + +#endif 636 + + 637 + +# ifdef YYPRINT 638 + +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 639 + + token YYLEX-NUM. */ 640 + +static const yytype_uint16 yytoknum[] = 641 + +{ 642 + + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 643 + + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 644 + + 275, 276, 58, 44, 47 645 + +}; 646 + +# endif 647 + + 648 + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 649 + +static const yytype_uint8 yyr1[] = 650 + +{ 651 + + 0, 25, 26, 26, 27, 27, 27, 27, 27, 27, 652 + + 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 653 + + 29, 30, 30, 30, 31, 31, 31, 31, 31, 31, 654 + + 31, 31, 31, 32, 32, 33, 33, 33, 33, 33, 655 + + 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 656 + + 36, 36 657 + +}; 658 + + 659 + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 660 + +static const yytype_uint8 yyr2[] = 661 + +{ 662 + + 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, 663 + + 2, 2, 2, 4, 4, 6, 6, 1, 1, 2, 664 + + 1, 1, 2, 2, 3, 5, 4, 1, 3, 2, 665 + + 4, 2, 3, 2, 1, 2, 2, 1, 2, 2, 666 + + 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 667 + + 0, 1 668 + +}; 669 + + 670 + +/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. 671 + + Performed when YYTABLE doesn't specify something else to do. Zero 672 + + means the default is an error. */ 673 + +static const yytype_uint8 yydefact[] = 674 + +{ 675 + + 2, 0, 1, 21, 18, 37, 0, 43, 0, 44, 676 + + 45, 46, 27, 40, 17, 20, 3, 4, 5, 7, 677 + + 6, 8, 34, 0, 9, 22, 44, 45, 46, 29, 678 + + 36, 41, 38, 10, 11, 12, 19, 33, 23, 35, 679 + + 31, 42, 0, 39, 0, 0, 0, 28, 32, 0, 680 + + 50, 24, 30, 26, 51, 14, 0, 13, 0, 50, 681 + + 25, 16, 15 682 + +}; 683 + + 684 + +/* YYDEFGOTO[NTERM-NUM]. */ 685 + +static const yytype_int8 yydefgoto[] = 686 + +{ 687 + + -1, 1, 16, 17, 18, 19, 20, 21, 22, 23, 688 + + 24, 57 689 + +}; 690 + + 691 + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 692 + + STATE-NUM. */ 693 + +#define YYPACT_NINF -27 694 + +static const yytype_int8 yypact[] = 695 + +{ 696 + + -27, 49, -27, -10, -27, -27, -11, -27, 1, 10, 697 + + 69, 86, -27, -27, -9, -27, -27, -27, -27, -27, 698 + + -27, -27, 13, -3, -27, -27, -27, -27, -27, 8, 699 + + -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, 700 + + 30, -27, 9, -27, -11, -11, -11, -27, -27, 12, 701 + + 15, 18, -27, -27, -27, -27, -11, -27, -11, 23, 702 + + -27, -27, -27 703 + +}; 704 + + 705 + +/* YYPGOTO[NTERM-NUM]. */ 706 + +static const yytype_int8 yypgoto[] = 707 + +{ 708 + + -27, -27, -27, -27, -27, -27, -27, -27, -27, -6, 709 + + -27, -26 710 + +}; 711 + + 712 + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 713 + + positive, shift that token. If negative, reduce the rule which 714 + + number is the opposite. If YYTABLE_NINF, syntax error. */ 715 + +#define YYTABLE_NINF -50 716 + +static const yytype_int8 yytable[] = 717 + +{ 718 + + 29, 38, 26, 27, 28, 39, 40, 41, 42, 30, 719 + + -47, 31, 36, 25, 43, -47, 37, 33, 32, 44, 720 + + 49, 45, 54, -47, -47, -47, -47, 55, -47, -47, 721 + + 54, 46, 53, 62, 48, 61, 0, 56, 50, 51, 722 + + 52, 47, 58, 26, 27, 28, 0, 0, 0, 2, 723 + + 59, 0, 60, 3, 4, 0, 0, 5, 6, 7, 724 + + 8, 0, 9, 10, 11, 12, 13, 14, 15, -48, 725 + + 0, 0, 0, 0, -48, 0, 0, 0, 0, 0, 726 + + 0, 34, -48, -48, -48, -48, -49, -48, -48, 0, 727 + + 0, -49, 0, 0, 0, 0, 0, 0, 35, -49, 728 + + -49, -49, -49, 0, -49, -49 729 + +}; 730 + + 731 + +#define yypact_value_is_default(Yystate) \ 732 + + (!!((Yystate) == (-27))) 733 + + 734 + +#define yytable_value_is_error(Yytable_value) \ 735 + + YYID (0) 736 + + 737 + +static const yytype_int8 yycheck[] = 738 + +{ 739 + + 6, 4, 13, 14, 15, 8, 9, 10, 11, 8, 740 + + 0, 10, 21, 23, 17, 5, 3, 7, 17, 22, 741 + + 11, 24, 7, 13, 14, 15, 16, 12, 18, 19, 742 + + 7, 23, 20, 59, 40, 12, -1, 22, 44, 45, 743 + + 46, 11, 24, 13, 14, 15, -1, -1, -1, 0, 744 + + 56, -1, 58, 4, 5, -1, -1, 8, 9, 10, 745 + + 11, -1, 13, 14, 15, 16, 17, 18, 19, 0, 746 + + -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, 747 + + -1, 12, 13, 14, 15, 16, 0, 18, 19, -1, 748 + + -1, 5, -1, -1, -1, -1, -1, -1, 12, 13, 749 + + 14, 15, 16, -1, 18, 19 750 + +}; 751 + + 752 + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 753 + + symbol of state STATE-NUM. */ 754 + +static const yytype_uint8 yystos[] = 755 + +{ 756 + + 0, 26, 0, 4, 5, 8, 9, 10, 11, 13, 757 + + 14, 15, 16, 17, 18, 19, 27, 28, 29, 30, 758 + + 31, 32, 33, 34, 35, 23, 13, 14, 15, 34, 759 + + 8, 10, 17, 7, 12, 12, 21, 3, 4, 8, 760 + + 9, 10, 11, 17, 22, 24, 23, 11, 34, 11, 761 + + 34, 34, 34, 20, 7, 12, 22, 36, 24, 34, 762 + + 34, 12, 36 763 + +}; 764 + + 765 + +#define yyerrok (yyerrstatus = 0) 766 + +#define yyclearin (yychar = YYEMPTY) 767 + +#define YYEMPTY (-2) 768 + +#define YYEOF 0 769 + + 770 + +#define YYACCEPT goto yyacceptlab 771 + +#define YYABORT goto yyabortlab 772 + +#define YYERROR goto yyerrorlab 773 + + 774 + + 775 + +/* Like YYERROR except do call yyerror. This remains here temporarily 776 + + to ease the transition to the new meaning of YYERROR, for GCC. 777 + + Once GCC version 2 has supplanted version 1, this can go. However, 778 + + YYFAIL appears to be in use. Nevertheless, it is formally deprecated 779 + + in Bison 2.4.2's NEWS entry, where a plan to phase it out is 780 + + discussed. */ 781 + + 782 + +#define YYFAIL goto yyerrlab 783 + +#if defined YYFAIL 784 + + /* This is here to suppress warnings from the GCC cpp's 785 + + -Wunused-macros. Normally we don't worry about that warning, but 786 + + some users do, and we want to make it easy for users to remove 787 + + YYFAIL uses, which will produce warnings from Bison 2.5. */ 788 + +#endif 789 + + 790 + +#define YYRECOVERING() (!!yyerrstatus) 791 + + 792 + +#define YYBACKUP(Token, Value) \ 793 + +do \ 794 + + if (yychar == YYEMPTY) \ 795 + + { \ 796 + + yychar = (Token); \ 797 + + yylval = (Value); \ 798 + + YYPOPSTACK (yylen); \ 799 + + yystate = *yyssp; \ 800 + + goto yybackup; \ 801 + + } \ 802 + + else \ 803 + + { \ 804 + + yyerror (YY_("syntax error: cannot back up")); \ 805 + + YYERROR; \ 806 + + } \ 807 + +while (YYID (0)) 808 + + 809 + +/* Error token number */ 810 + +#define YYTERROR 1 811 + +#define YYERRCODE 256 812 + + 813 + + 814 + +/* This macro is provided for backward compatibility. */ 815 + +#ifndef YY_LOCATION_PRINT 816 + +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) 817 + +#endif 818 + + 819 + + 820 + +/* YYLEX -- calling `yylex' with the right arguments. */ 821 + +#ifdef YYLEX_PARAM 822 + +# define YYLEX yylex (&yylval, YYLEX_PARAM) 823 + +#else 824 + +# define YYLEX yylex (&yylval) 825 + +#endif 826 + + 827 + +/* Enable debugging if requested. */ 828 + +#if YYDEBUG 829 + + 830 + +# ifndef YYFPRINTF 831 + +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 832 + +# define YYFPRINTF fprintf 833 + +# endif 834 + + 835 + +# define YYDPRINTF(Args) \ 836 + +do { \ 837 + + if (yydebug) \ 838 + + YYFPRINTF Args; \ 839 + +} while (YYID (0)) 840 + + 841 + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 842 + +do { \ 843 + + if (yydebug) \ 844 + + { \ 845 + + YYFPRINTF (stderr, "%s ", Title); \ 846 + + yy_symbol_print (stderr, \ 847 + + Type, Value); \ 848 + + YYFPRINTF (stderr, "\n"); \ 849 + + } \ 850 + +} while (YYID (0)) 851 + + 852 + + 853 + +/*--------------------------------. 854 + +| Print this symbol on YYOUTPUT. | 855 + +`--------------------------------*/ 856 + + 857 + +/*ARGSUSED*/ 858 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 859 + + || defined __cplusplus || defined _MSC_VER) 860 + +static void 861 + +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 862 + +#else 863 + +static void 864 + +yy_symbol_value_print (yyoutput, yytype, yyvaluep) 865 + + FILE *yyoutput; 866 + + int yytype; 867 + + YYSTYPE const * const yyvaluep; 868 + +#endif 869 + +{ 870 + + FILE *yyo = yyoutput; 871 + + YYUSE (yyo); 872 + + if (!yyvaluep) 873 + + return; 874 + +# ifdef YYPRINT 875 + + if (yytype < YYNTOKENS) 876 + + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 877 + +# else 878 + + YYUSE (yyoutput); 879 + +# endif 880 + + YYUSE (yytype); 881 + +} 882 + + 883 + + 884 + +/*--------------------------------. 885 + +| Print this symbol on YYOUTPUT. | 886 + +`--------------------------------*/ 887 + + 888 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 889 + + || defined __cplusplus || defined _MSC_VER) 890 + +static void 891 + +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 892 + +#else 893 + +static void 894 + +yy_symbol_print (yyoutput, yytype, yyvaluep) 895 + + FILE *yyoutput; 896 + + int yytype; 897 + + YYSTYPE const * const yyvaluep; 898 + +#endif 899 + +{ 900 + + if (yytype < YYNTOKENS) 901 + + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 902 + + else 903 + + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 904 + + 905 + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); 906 + + YYFPRINTF (yyoutput, ")"); 907 + +} 908 + + 909 + +/*------------------------------------------------------------------. 910 + +| yy_stack_print -- Print the state stack from its BOTTOM up to its | 911 + +| TOP (included). | 912 + +`------------------------------------------------------------------*/ 913 + + 914 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 915 + + || defined __cplusplus || defined _MSC_VER) 916 + +static void 917 + +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 918 + +#else 919 + +static void 920 + +yy_stack_print (yybottom, yytop) 921 + + yytype_int16 *yybottom; 922 + + yytype_int16 *yytop; 923 + +#endif 924 + +{ 925 + + YYFPRINTF (stderr, "Stack now"); 926 + + for (; yybottom <= yytop; yybottom++) 927 + + { 928 + + int yybot = *yybottom; 929 + + YYFPRINTF (stderr, " %d", yybot); 930 + + } 931 + + YYFPRINTF (stderr, "\n"); 932 + +} 933 + + 934 + +# define YY_STACK_PRINT(Bottom, Top) \ 935 + +do { \ 936 + + if (yydebug) \ 937 + + yy_stack_print ((Bottom), (Top)); \ 938 + +} while (YYID (0)) 939 + + 940 + + 941 + +/*------------------------------------------------. 942 + +| Report that the YYRULE is going to be reduced. | 943 + +`------------------------------------------------*/ 944 + + 945 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 946 + + || defined __cplusplus || defined _MSC_VER) 947 + +static void 948 + +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 949 + +#else 950 + +static void 951 + +yy_reduce_print (yyvsp, yyrule) 952 + + YYSTYPE *yyvsp; 953 + + int yyrule; 954 + +#endif 955 + +{ 956 + + int yynrhs = yyr2[yyrule]; 957 + + int yyi; 958 + + unsigned long int yylno = yyrline[yyrule]; 959 + + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 960 + + yyrule - 1, yylno); 961 + + /* The symbols being reduced. */ 962 + + for (yyi = 0; yyi < yynrhs; yyi++) 963 + + { 964 + + YYFPRINTF (stderr, " $%d = ", yyi + 1); 965 + + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 966 + + &(yyvsp[(yyi + 1) - (yynrhs)]) 967 + + ); 968 + + YYFPRINTF (stderr, "\n"); 969 + + } 970 + +} 971 + + 972 + +# define YY_REDUCE_PRINT(Rule) \ 973 + +do { \ 974 + + if (yydebug) \ 975 + + yy_reduce_print (yyvsp, Rule); \ 976 + +} while (YYID (0)) 977 + + 978 + +/* Nonzero means print parse trace. It is left uninitialized so that 979 + + multiple parsers can coexist. */ 980 + +int yydebug; 981 + +#else /* !YYDEBUG */ 982 + +# define YYDPRINTF(Args) 983 + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) 984 + +# define YY_STACK_PRINT(Bottom, Top) 985 + +# define YY_REDUCE_PRINT(Rule) 986 + +#endif /* !YYDEBUG */ 987 + + 988 + + 989 + +/* YYINITDEPTH -- initial size of the parser's stacks. */ 990 + +#ifndef YYINITDEPTH 991 + +# define YYINITDEPTH 200 992 + +#endif 993 + + 994 + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 995 + + if the built-in stack extension method is used). 996 + + 997 + + Do not make this value too large; the results are undefined if 998 + + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 999 + + evaluated with infinite-precision integer arithmetic. */ 1000 + + 1001 + +#ifndef YYMAXDEPTH 1002 + +# define YYMAXDEPTH 10000 1003 + +#endif 1004 + + 1005 + + 1006 + +#if YYERROR_VERBOSE 1007 + + 1008 + +# ifndef yystrlen 1009 + +# if defined __GLIBC__ && defined _STRING_H 1010 + +# define yystrlen strlen 1011 + +# else 1012 + +/* Return the length of YYSTR. */ 1013 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 1014 + + || defined __cplusplus || defined _MSC_VER) 1015 + +static YYSIZE_T 1016 + +yystrlen (const char *yystr) 1017 + +#else 1018 + +static YYSIZE_T 1019 + +yystrlen (yystr) 1020 + + const char *yystr; 1021 + +#endif 1022 + +{ 1023 + + YYSIZE_T yylen; 1024 + + for (yylen = 0; yystr[yylen]; yylen++) 1025 + + continue; 1026 + + return yylen; 1027 + +} 1028 + +# endif 1029 + +# endif 1030 + + 1031 + +# ifndef yystpcpy 1032 + +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1033 + +# define yystpcpy stpcpy 1034 + +# else 1035 + +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1036 + + YYDEST. */ 1037 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 1038 + + || defined __cplusplus || defined _MSC_VER) 1039 + +static char * 1040 + +yystpcpy (char *yydest, const char *yysrc) 1041 + +#else 1042 + +static char * 1043 + +yystpcpy (yydest, yysrc) 1044 + + char *yydest; 1045 + + const char *yysrc; 1046 + +#endif 1047 + +{ 1048 + + char *yyd = yydest; 1049 + + const char *yys = yysrc; 1050 + + 1051 + + while ((*yyd++ = *yys++) != '\0') 1052 + + continue; 1053 + + 1054 + + return yyd - 1; 1055 + +} 1056 + +# endif 1057 + +# endif 1058 + + 1059 + +# ifndef yytnamerr 1060 + +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1061 + + quotes and backslashes, so that it's suitable for yyerror. The 1062 + + heuristic is that double-quoting is unnecessary unless the string 1063 + + contains an apostrophe, a comma, or backslash (other than 1064 + + backslash-backslash). YYSTR is taken from yytname. If YYRES is 1065 + + null, do not copy; instead, return the length of what the result 1066 + + would have been. */ 1067 + +static YYSIZE_T 1068 + +yytnamerr (char *yyres, const char *yystr) 1069 + +{ 1070 + + if (*yystr == '"') 1071 + + { 1072 + + YYSIZE_T yyn = 0; 1073 + + char const *yyp = yystr; 1074 + + 1075 + + for (;;) 1076 + + switch (*++yyp) 1077 + + { 1078 + + case '\'': 1079 + + case ',': 1080 + + goto do_not_strip_quotes; 1081 + + 1082 + + case '\\': 1083 + + if (*++yyp != '\\') 1084 + + goto do_not_strip_quotes; 1085 + + /* Fall through. */ 1086 + + default: 1087 + + if (yyres) 1088 + + yyres[yyn] = *yyp; 1089 + + yyn++; 1090 + + break; 1091 + + 1092 + + case '"': 1093 + + if (yyres) 1094 + + yyres[yyn] = '\0'; 1095 + + return yyn; 1096 + + } 1097 + + do_not_strip_quotes: ; 1098 + + } 1099 + + 1100 + + if (! yyres) 1101 + + return yystrlen (yystr); 1102 + + 1103 + + return yystpcpy (yyres, yystr) - yyres; 1104 + +} 1105 + +# endif 1106 + + 1107 + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 1108 + + about the unexpected token YYTOKEN for the state stack whose top is 1109 + + YYSSP. 1110 + + 1111 + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 1112 + + not large enough to hold the message. In that case, also set 1113 + + *YYMSG_ALLOC to the required number of bytes. Return 2 if the 1114 + + required number of bytes is too large to store. */ 1115 + +static int 1116 + +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 1117 + + yytype_int16 *yyssp, int yytoken) 1118 + +{ 1119 + + YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); 1120 + + YYSIZE_T yysize = yysize0; 1121 + + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1122 + + /* Internationalized format string. */ 1123 + + const char *yyformat = YY_NULL; 1124 + + /* Arguments of yyformat. */ 1125 + + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1126 + + /* Number of reported tokens (one for the "unexpected", one per 1127 + + "expected"). */ 1128 + + int yycount = 0; 1129 + + 1130 + + /* There are many possibilities here to consider: 1131 + + - Assume YYFAIL is not used. It's too flawed to consider. See 1132 + + <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> 1133 + + for details. YYERROR is fine as it does not invoke this 1134 + + function. 1135 + + - If this state is a consistent state with a default action, then 1136 + + the only way this function was invoked is if the default action 1137 + + is an error action. In that case, don't check for expected 1138 + + tokens because there are none. 1139 + + - The only way there can be no lookahead present (in yychar) is if 1140 + + this state is a consistent state with a default action. Thus, 1141 + + detecting the absence of a lookahead is sufficient to determine 1142 + + that there is no unexpected or expected token to report. In that 1143 + + case, just report a simple "syntax error". 1144 + + - Don't assume there isn't a lookahead just because this state is a 1145 + + consistent state with a default action. There might have been a 1146 + + previous inconsistent state, consistent state with a non-default 1147 + + action, or user semantic action that manipulated yychar. 1148 + + - Of course, the expected token list depends on states to have 1149 + + correct lookahead information, and it depends on the parser not 1150 + + to perform extra reductions after fetching a lookahead from the 1151 + + scanner and before detecting a syntax error. Thus, state merging 1152 + + (from LALR or IELR) and default reductions corrupt the expected 1153 + + token list. However, the list is correct for canonical LR with 1154 + + one exception: it will still contain any token that will not be 1155 + + accepted due to an error action in a later state. 1156 + + */ 1157 + + if (yytoken != YYEMPTY) 1158 + + { 1159 + + int yyn = yypact[*yyssp]; 1160 + + yyarg[yycount++] = yytname[yytoken]; 1161 + + if (!yypact_value_is_default (yyn)) 1162 + + { 1163 + + /* Start YYX at -YYN if negative to avoid negative indexes in 1164 + + YYCHECK. In other words, skip the first -YYN actions for 1165 + + this state because they are default actions. */ 1166 + + int yyxbegin = yyn < 0 ? -yyn : 0; 1167 + + /* Stay within bounds of both yycheck and yytname. */ 1168 + + int yychecklim = YYLAST - yyn + 1; 1169 + + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1170 + + int yyx; 1171 + + 1172 + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1173 + + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 1174 + + && !yytable_value_is_error (yytable[yyx + yyn])) 1175 + + { 1176 + + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1177 + + { 1178 + + yycount = 1; 1179 + + yysize = yysize0; 1180 + + break; 1181 + + } 1182 + + yyarg[yycount++] = yytname[yyx]; 1183 + + { 1184 + + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); 1185 + + if (! (yysize <= yysize1 1186 + + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1187 + + return 2; 1188 + + yysize = yysize1; 1189 + + } 1190 + + } 1191 + + } 1192 + + } 1193 + + 1194 + + switch (yycount) 1195 + + { 1196 + +# define YYCASE_(N, S) \ 1197 + + case N: \ 1198 + + yyformat = S; \ 1199 + + break 1200 + + YYCASE_(0, YY_("syntax error")); 1201 + + YYCASE_(1, YY_("syntax error, unexpected %s")); 1202 + + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1203 + + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1204 + + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1205 + + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1206 + +# undef YYCASE_ 1207 + + } 1208 + + 1209 + + { 1210 + + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1211 + + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1212 + + return 2; 1213 + + yysize = yysize1; 1214 + + } 1215 + + 1216 + + if (*yymsg_alloc < yysize) 1217 + + { 1218 + + *yymsg_alloc = 2 * yysize; 1219 + + if (! (yysize <= *yymsg_alloc 1220 + + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1221 + + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1222 + + return 1; 1223 + + } 1224 + + 1225 + + /* Avoid sprintf, as that infringes on the user's name space. 1226 + + Don't have undefined behavior even if the translation 1227 + + produced a string with the wrong number of "%s"s. */ 1228 + + { 1229 + + char *yyp = *yymsg; 1230 + + int yyi = 0; 1231 + + while ((*yyp = *yyformat) != '\0') 1232 + + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1233 + + { 1234 + + yyp += yytnamerr (yyp, yyarg[yyi++]); 1235 + + yyformat += 2; 1236 + + } 1237 + + else 1238 + + { 1239 + + yyp++; 1240 + + yyformat++; 1241 + + } 1242 + + } 1243 + + return 0; 1244 + +} 1245 + +#endif /* YYERROR_VERBOSE */ 1246 + + 1247 + +/*-----------------------------------------------. 1248 + +| Release the memory associated to this symbol. | 1249 + +`-----------------------------------------------*/ 1250 + + 1251 + +/*ARGSUSED*/ 1252 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 1253 + + || defined __cplusplus || defined _MSC_VER) 1254 + +static void 1255 + +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1256 + +#else 1257 + +static void 1258 + +yydestruct (yymsg, yytype, yyvaluep) 1259 + + const char *yymsg; 1260 + + int yytype; 1261 + + YYSTYPE *yyvaluep; 1262 + +#endif 1263 + +{ 1264 + + YYUSE (yyvaluep); 1265 + + 1266 + + if (!yymsg) 1267 + + yymsg = "Deleting"; 1268 + + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1269 + + 1270 + + YYUSE (yytype); 1271 + +} 1272 + + 1273 + + 1274 + + 1275 + + 1276 + +/*----------. 1277 + +| yyparse. | 1278 + +`----------*/ 1279 + + 1280 + +#ifdef YYPARSE_PARAM 1281 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 1282 + + || defined __cplusplus || defined _MSC_VER) 1283 + +int 1284 + +yyparse (void *YYPARSE_PARAM) 1285 + +#else 1286 + +int 1287 + +yyparse (YYPARSE_PARAM) 1288 + + void *YYPARSE_PARAM; 1289 + +#endif 1290 + +#else /* ! YYPARSE_PARAM */ 1291 + +#if (defined __STDC__ || defined __C99__FUNC__ \ 1292 + + || defined __cplusplus || defined _MSC_VER) 1293 + +int 1294 + +yyparse (void) 1295 + +#else 1296 + +int 1297 + +yyparse () 1298 + + 1299 + +#endif 1300 + +#endif 1301 + +{ 1302 + +/* The lookahead symbol. */ 1303 + +int yychar; 1304 + + 1305 + + 1306 + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 1307 + +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ 1308 + +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 1309 + + _Pragma ("GCC diagnostic push") \ 1310 + + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 1311 + + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 1312 + +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 1313 + + _Pragma ("GCC diagnostic pop") 1314 + +#else 1315 + +/* Default value used for initialization, for pacifying older GCCs 1316 + + or non-GCC compilers. */ 1317 + +static YYSTYPE yyval_default; 1318 + +# define YY_INITIAL_VALUE(Value) = Value 1319 + +#endif 1320 + +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1321 + +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1322 + +# define YY_IGNORE_MAYBE_UNINITIALIZED_END 1323 + +#endif 1324 + +#ifndef YY_INITIAL_VALUE 1325 + +# define YY_INITIAL_VALUE(Value) /* Nothing. */ 1326 + +#endif 1327 + + 1328 + +/* The semantic value of the lookahead symbol. */ 1329 + +YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); 1330 + + 1331 + + /* Number of syntax errors so far. */ 1332 + + int yynerrs; 1333 + + 1334 + + int yystate; 1335 + + /* Number of tokens to shift before error messages enabled. */ 1336 + + int yyerrstatus; 1337 + + 1338 + + /* The stacks and their tools: 1339 + + `yyss': related to states. 1340 + + `yyvs': related to semantic values. 1341 + + 1342 + + Refer to the stacks through separate pointers, to allow yyoverflow 1343 + + to reallocate them elsewhere. */ 1344 + + 1345 + + /* The state stack. */ 1346 + + yytype_int16 yyssa[YYINITDEPTH]; 1347 + + yytype_int16 *yyss; 1348 + + yytype_int16 *yyssp; 1349 + + 1350 + + /* The semantic value stack. */ 1351 + + YYSTYPE yyvsa[YYINITDEPTH]; 1352 + + YYSTYPE *yyvs; 1353 + + YYSTYPE *yyvsp; 1354 + + 1355 + + YYSIZE_T yystacksize; 1356 + + 1357 + + int yyn; 1358 + + int yyresult; 1359 + + /* Lookahead token as an internal (translated) token number. */ 1360 + + int yytoken = 0; 1361 + + /* The variables used to return semantic value and location from the 1362 + + action routines. */ 1363 + + YYSTYPE yyval; 1364 + + 1365 + +#if YYERROR_VERBOSE 1366 + + /* Buffer for error messages, and its allocated size. */ 1367 + + char yymsgbuf[128]; 1368 + + char *yymsg = yymsgbuf; 1369 + + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1370 + +#endif 1371 + + 1372 + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1373 + + 1374 + + /* The number of symbols on the RHS of the reduced rule. 1375 + + Keep to zero when no symbol should be popped. */ 1376 + + int yylen = 0; 1377 + + 1378 + + yyssp = yyss = yyssa; 1379 + + yyvsp = yyvs = yyvsa; 1380 + + yystacksize = YYINITDEPTH; 1381 + + 1382 + + YYDPRINTF ((stderr, "Starting parse\n")); 1383 + + 1384 + + yystate = 0; 1385 + + yyerrstatus = 0; 1386 + + yynerrs = 0; 1387 + + yychar = YYEMPTY; /* Cause a token to be read. */ 1388 + + goto yysetstate; 1389 + + 1390 + +/*------------------------------------------------------------. 1391 + +| yynewstate -- Push a new state, which is found in yystate. | 1392 + +`------------------------------------------------------------*/ 1393 + + yynewstate: 1394 + + /* In all cases, when you get here, the value and location stacks 1395 + + have just been pushed. So pushing a state here evens the stacks. */ 1396 + + yyssp++; 1397 + + 1398 + + yysetstate: 1399 + + *yyssp = yystate; 1400 + + 1401 + + if (yyss + yystacksize - 1 <= yyssp) 1402 + + { 1403 + + /* Get the current used size of the three stacks, in elements. */ 1404 + + YYSIZE_T yysize = yyssp - yyss + 1; 1405 + + 1406 + +#ifdef yyoverflow 1407 + + { 1408 + + /* Give user a chance to reallocate the stack. Use copies of 1409 + + these so that the &'s don't force the real ones into 1410 + + memory. */ 1411 + + YYSTYPE *yyvs1 = yyvs; 1412 + + yytype_int16 *yyss1 = yyss; 1413 + + 1414 + + /* Each stack pointer address is followed by the size of the 1415 + + data in use in that stack, in bytes. This used to be a 1416 + + conditional around just the two extra args, but that might 1417 + + be undefined if yyoverflow is a macro. */ 1418 + + yyoverflow (YY_("memory exhausted"), 1419 + + &yyss1, yysize * sizeof (*yyssp), 1420 + + &yyvs1, yysize * sizeof (*yyvsp), 1421 + + &yystacksize); 1422 + + 1423 + + yyss = yyss1; 1424 + + yyvs = yyvs1; 1425 + + } 1426 + +#else /* no yyoverflow */ 1427 + +# ifndef YYSTACK_RELOCATE 1428 + + goto yyexhaustedlab; 1429 + +# else 1430 + + /* Extend the stack our own way. */ 1431 + + if (YYMAXDEPTH <= yystacksize) 1432 + + goto yyexhaustedlab; 1433 + + yystacksize *= 2; 1434 + + if (YYMAXDEPTH < yystacksize) 1435 + + yystacksize = YYMAXDEPTH; 1436 + + 1437 + + { 1438 + + yytype_int16 *yyss1 = yyss; 1439 + + union yyalloc *yyptr = 1440 + + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1441 + + if (! yyptr) 1442 + + goto yyexhaustedlab; 1443 + + YYSTACK_RELOCATE (yyss_alloc, yyss); 1444 + + YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1445 + +# undef YYSTACK_RELOCATE 1446 + + if (yyss1 != yyssa) 1447 + + YYSTACK_FREE (yyss1); 1448 + + } 1449 + +# endif 1450 + +#endif /* no yyoverflow */ 1451 + + 1452 + + yyssp = yyss + yysize - 1; 1453 + + yyvsp = yyvs + yysize - 1; 1454 + + 1455 + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1456 + + (unsigned long int) yystacksize)); 1457 + + 1458 + + if (yyss + yystacksize - 1 <= yyssp) 1459 + + YYABORT; 1460 + + } 1461 + + 1462 + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1463 + + 1464 + + if (yystate == YYFINAL) 1465 + + YYACCEPT; 1466 + + 1467 + + goto yybackup; 1468 + + 1469 + +/*-----------. 1470 + +| yybackup. | 1471 + +`-----------*/ 1472 + +yybackup: 1473 + + 1474 + + /* Do appropriate processing given the current state. Read a 1475 + + lookahead token if we need one and don't already have one. */ 1476 + + 1477 + + /* First try to decide what to do without reference to lookahead token. */ 1478 + + yyn = yypact[yystate]; 1479 + + if (yypact_value_is_default (yyn)) 1480 + + goto yydefault; 1481 + + 1482 + + /* Not known => get a lookahead token if don't already have one. */ 1483 + + 1484 + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1485 + + if (yychar == YYEMPTY) 1486 + + { 1487 + + YYDPRINTF ((stderr, "Reading a token: ")); 1488 + + yychar = YYLEX; 1489 + + } 1490 + + 1491 + + if (yychar <= YYEOF) 1492 + + { 1493 + + yychar = yytoken = YYEOF; 1494 + + YYDPRINTF ((stderr, "Now at end of input.\n")); 1495 + + } 1496 + + else 1497 + + { 1498 + + yytoken = YYTRANSLATE (yychar); 1499 + + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1500 + + } 1501 + + 1502 + + /* If the proper action on seeing token YYTOKEN is to reduce or to 1503 + + detect an error, take that action. */ 1504 + + yyn += yytoken; 1505 + + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1506 + + goto yydefault; 1507 + + yyn = yytable[yyn]; 1508 + + if (yyn <= 0) 1509 + + { 1510 + + if (yytable_value_is_error (yyn)) 1511 + + goto yyerrlab; 1512 + + yyn = -yyn; 1513 + + goto yyreduce; 1514 + + } 1515 + + 1516 + + /* Count tokens shifted since error; after three, turn off error 1517 + + status. */ 1518 + + if (yyerrstatus) 1519 + + yyerrstatus--; 1520 + + 1521 + + /* Shift the lookahead token. */ 1522 + + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1523 + + 1524 + + /* Discard the shifted token. */ 1525 + + yychar = YYEMPTY; 1526 + + 1527 + + yystate = yyn; 1528 + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1529 + + *++yyvsp = yylval; 1530 + + YY_IGNORE_MAYBE_UNINITIALIZED_END 1531 + + 1532 + + goto yynewstate; 1533 + + 1534 + + 1535 + +/*-----------------------------------------------------------. 1536 + +| yydefault -- do the default action for the current state. | 1537 + +`-----------------------------------------------------------*/ 1538 + +yydefault: 1539 + + yyn = yydefact[yystate]; 1540 + + if (yyn == 0) 1541 + + goto yyerrlab; 1542 + + goto yyreduce; 1543 + + 1544 + + 1545 + +/*-----------------------------. 1546 + +| yyreduce -- Do a reduction. | 1547 + +`-----------------------------*/ 1548 + +yyreduce: 1549 + + /* yyn is the number of a rule to reduce with. */ 1550 + + yylen = yyr2[yyn]; 1551 + + 1552 + + /* If YYLEN is nonzero, implement the default value of the action: 1553 + + `$$ = $1'. 1554 + + 1555 + + Otherwise, the following line sets YYVAL to garbage. 1556 + + This behavior is undocumented and Bison 1557 + + users should not rely upon it. Assigning to YYVAL 1558 + + unconditionally makes the parser a bit smaller, and it avoids a 1559 + + GCC warning that YYVAL may be used uninitialized. */ 1560 + + yyval = yyvsp[1-yylen]; 1561 + + 1562 + + 1563 + + YY_REDUCE_PRINT (yyn); 1564 + + switch (yyn) 1565 + + { 1566 + + case 4: 1567 + +/* Line 1787 of yacc.c */ 1568 + +#line 157 "ptlib/common/getdate.y" 1569 + + { 1570 + + VARIABLE->yyHaveTime++; 1571 + + } 1572 + + break; 1573 + + 1574 + + case 5: 1575 + +/* Line 1787 of yacc.c */ 1576 + +#line 160 "ptlib/common/getdate.y" 1577 + + { 1578 + + VARIABLE->yyHaveZone++; 1579 + + } 1580 + + break; 1581 + + 1582 + + case 6: 1583 + +/* Line 1787 of yacc.c */ 1584 + +#line 163 "ptlib/common/getdate.y" 1585 + + { 1586 + + VARIABLE->yyHaveDate++; 1587 + + } 1588 + + break; 1589 + + 1590 + + case 7: 1591 + +/* Line 1787 of yacc.c */ 1592 + +#line 166 "ptlib/common/getdate.y" 1593 + + { 1594 + + VARIABLE->yyHaveDay++; 1595 + + } 1596 + + break; 1597 + + 1598 + + case 8: 1599 + +/* Line 1787 of yacc.c */ 1600 + +#line 169 "ptlib/common/getdate.y" 1601 + + { 1602 + + VARIABLE->yyHaveRel++; 1603 + + } 1604 + + break; 1605 + + 1606 + + case 10: 1607 + +/* Line 1787 of yacc.c */ 1608 + +#line 175 "ptlib/common/getdate.y" 1609 + + { 1610 + + VARIABLE->yyHour = (yyvsp[(1) - (2)].Number); 1611 + + VARIABLE->yyMinutes = 0; 1612 + + VARIABLE->yySeconds = 0; 1613 + + VARIABLE->yyMeridian = (yyvsp[(2) - (2)].Meridian); 1614 + + } 1615 + + break; 1616 + + 1617 + + case 11: 1618 + +/* Line 1787 of yacc.c */ 1619 + +#line 181 "ptlib/common/getdate.y" 1620 + + { 1621 + + VARIABLE->yyHour = (yyvsp[(1) - (2)].Number)/100; 1622 + + VARIABLE->yyMinutes = (yyvsp[(1) - (2)].Number)%100; 1623 + + VARIABLE->yySeconds = 0; 1624 + + VARIABLE->yyMeridian = MER24; 1625 + + VARIABLE->yyDSTmode = DSToff; 1626 + + VARIABLE->yyTimezone = - ((yyvsp[(2) - (2)].Number) % 100 + ((yyvsp[(2) - (2)].Number) / 100) * 60); 1627 + + } 1628 + + break; 1629 + + 1630 + + case 12: 1631 + +/* Line 1787 of yacc.c */ 1632 + +#line 189 "ptlib/common/getdate.y" 1633 + + { 1634 + + VARIABLE->yyHour = (yyvsp[(1) - (2)].Number)/10000; 1635 + + VARIABLE->yyMinutes = ((yyvsp[(1) - (2)].Number)/100)%100; 1636 + + VARIABLE->yySeconds = (yyvsp[(1) - (2)].Number) % 100; 1637 + + VARIABLE->yyMeridian = MER24; 1638 + + VARIABLE->yyDSTmode = DSToff; 1639 + + VARIABLE->yyTimezone = - ((yyvsp[(2) - (2)].Number) % 100 + ((yyvsp[(2) - (2)].Number) / 100) * 60); 1640 + + } 1641 + + break; 1642 + + 1643 + + case 13: 1644 + +/* Line 1787 of yacc.c */ 1645 + +#line 197 "ptlib/common/getdate.y" 1646 + + { 1647 + + VARIABLE->yyHour = (yyvsp[(1) - (4)].Number); 1648 + + VARIABLE->yyMinutes = (yyvsp[(3) - (4)].Number); 1649 + + VARIABLE->yySeconds = 0; 1650 + + VARIABLE->yyMeridian = (yyvsp[(4) - (4)].Meridian); 1651 + + } 1652 + + break; 1653 + + 1654 + + case 14: 1655 + +/* Line 1787 of yacc.c */ 1656 + +#line 203 "ptlib/common/getdate.y" 1657 + + { 1658 + + VARIABLE->yyHour = (yyvsp[(1) - (4)].Number); 1659 + + VARIABLE->yyMinutes = (yyvsp[(3) - (4)].Number); 1660 + + VARIABLE->yyMeridian = MER24; 1661 + + VARIABLE->yyDSTmode = DSToff; 1662 + + VARIABLE->yyTimezone = - ((yyvsp[(4) - (4)].Number) % 100 + ((yyvsp[(4) - (4)].Number) / 100) * 60); 1663 + + } 1664 + + break; 1665 + + 1666 + + case 15: 1667 + +/* Line 1787 of yacc.c */ 1668 + +#line 210 "ptlib/common/getdate.y" 1669 + + { 1670 + + VARIABLE->yyHour = (yyvsp[(1) - (6)].Number); 1671 + + VARIABLE->yyMinutes = (yyvsp[(3) - (6)].Number); 1672 + + VARIABLE->yySeconds = (yyvsp[(5) - (6)].Number); 1673 + + VARIABLE->yyMeridian = (yyvsp[(6) - (6)].Meridian); 1674 + + } 1675 + + break; 1676 + + 1677 + + case 16: 1678 + +/* Line 1787 of yacc.c */ 1679 + +#line 216 "ptlib/common/getdate.y" 1680 + + { 1681 + + VARIABLE->yyHour = (yyvsp[(1) - (6)].Number); 1682 + + VARIABLE->yyMinutes = (yyvsp[(3) - (6)].Number); 1683 + + VARIABLE->yySeconds = (yyvsp[(5) - (6)].Number); 1684 + + VARIABLE->yyMeridian = MER24; 1685 + + VARIABLE->yyDSTmode = DSToff; 1686 + + VARIABLE->yyTimezone = - ((yyvsp[(6) - (6)].Number) % 100 + ((yyvsp[(6) - (6)].Number) / 100) * 60); 1687 + + } 1688 + + break; 1689 + + 1690 + + case 17: 1691 + +/* Line 1787 of yacc.c */ 1692 + +#line 226 "ptlib/common/getdate.y" 1693 + + { 1694 + + VARIABLE->yyTimezone = (yyvsp[(1) - (1)].Number); 1695 + + VARIABLE->yyDSTmode = DSToff; 1696 + + } 1697 + + break; 1698 + + 1699 + + case 18: 1700 + +/* Line 1787 of yacc.c */ 1701 + +#line 230 "ptlib/common/getdate.y" 1702 + + { 1703 + + VARIABLE->yyTimezone = (yyvsp[(1) - (1)].Number); 1704 + + VARIABLE->yyDSTmode = DSTon; 1705 + + } 1706 + + break; 1707 + + 1708 + + case 19: 1709 + +/* Line 1787 of yacc.c */ 1710 + +#line 235 "ptlib/common/getdate.y" 1711 + + { 1712 + + VARIABLE->yyTimezone = (yyvsp[(1) - (2)].Number); 1713 + + VARIABLE->yyDSTmode = DSTon; 1714 + + } 1715 + + break; 1716 + + 1717 + + case 20: 1718 + +/* Line 1787 of yacc.c */ 1719 + +#line 239 "ptlib/common/getdate.y" 1720 + + { 1721 + + if (VARIABLE->yyHaveTime > 0) { 1722 + + VARIABLE->yyTimezone = (yyvsp[(1) - (1)].Number); 1723 + + VARIABLE->yyDSTmode = DSToff; 1724 + + } 1725 + + else 1726 + + VARIABLE->yyHaveZone--; 1727 + + } 1728 + + break; 1729 + + 1730 + + case 21: 1731 + +/* Line 1787 of yacc.c */ 1732 + +#line 249 "ptlib/common/getdate.y" 1733 + + { 1734 + + VARIABLE->yyDayOrdinal = 1; 1735 + + VARIABLE->yyDayNumber = (yyvsp[(1) - (1)].Number); 1736 + + } 1737 + + break; 1738 + + 1739 + + case 22: 1740 + +/* Line 1787 of yacc.c */ 1741 + +#line 253 "ptlib/common/getdate.y" 1742 + + { 1743 + + VARIABLE->yyDayOrdinal = 1; 1744 + + VARIABLE->yyDayNumber = (yyvsp[(1) - (2)].Number); 1745 + + } 1746 + + break; 1747 + + 1748 + + case 23: 1749 + +/* Line 1787 of yacc.c */ 1750 + +#line 257 "ptlib/common/getdate.y" 1751 + + { 1752 + + VARIABLE->yyDayOrdinal = (yyvsp[(1) - (2)].Number); 1753 + + VARIABLE->yyDayNumber = (yyvsp[(2) - (2)].Number); 1754 + + } 1755 + + break; 1756 + + 1757 + + case 24: 1758 + +/* Line 1787 of yacc.c */ 1759 + +#line 263 "ptlib/common/getdate.y" 1760 + + { 1761 + + SetPossibleDate(VARIABLE, (yyvsp[(1) - (3)].Number), (yyvsp[(3) - (3)].Number), VARIABLE->yyYear); 1762 + + } 1763 + + break; 1764 + + 1765 + + case 25: 1766 + +/* Line 1787 of yacc.c */ 1767 + +#line 266 "ptlib/common/getdate.y" 1768 + + { 1769 + + SetPossibleDate(VARIABLE, (yyvsp[(1) - (5)].Number), (yyvsp[(3) - (5)].Number), (yyvsp[(5) - (5)].Number)); 1770 + + } 1771 + + break; 1772 + + 1773 + + case 26: 1774 + +/* Line 1787 of yacc.c */ 1775 + +#line 269 "ptlib/common/getdate.y" 1776 + + { 1777 + + /* ISO 8601 format. yyyy-mm-dd. */ 1778 + + SetPossibleDate(VARIABLE, (yyvsp[(1) - (4)].Number), -(yyvsp[(2) - (4)].Number), -(yyvsp[(3) - (4)].Number)); 1779 + + } 1780 + + break; 1781 + + 1782 + + case 27: 1783 + +/* Line 1787 of yacc.c */ 1784 + +#line 273 "ptlib/common/getdate.y" 1785 + + { 1786 + + VARIABLE->yyDay= ((yyvsp[(1) - (1)].Number))%100; 1787 + + VARIABLE->yyMonth= ((yyvsp[(1) - (1)].Number)/100)%100; 1788 + + VARIABLE->yyYear = (yyvsp[(1) - (1)].Number)/10000; 1789 + + } 1790 + + break; 1791 + + 1792 + + case 28: 1793 + +/* Line 1787 of yacc.c */ 1794 + +#line 278 "ptlib/common/getdate.y" 1795 + + { 1796 + + /* e.g. 17-JUN-1992. */ 1797 + + SetPossibleDate(VARIABLE, (yyvsp[(1) - (3)].Number), (yyvsp[(2) - (3)].Number), -(yyvsp[(3) - (3)].Number)); 1798 + + } 1799 + + break; 1800 + + 1801 + + case 29: 1802 + +/* Line 1787 of yacc.c */ 1803 + +#line 282 "ptlib/common/getdate.y" 1804 + + { 1805 + + VARIABLE->yyMonth = (yyvsp[(1) - (2)].Number); 1806 + + if ((yyvsp[(2) - (2)].Number) > 31) 1807 + + VARIABLE->yyYear = (yyvsp[(2) - (2)].Number); 1808 + + else 1809 + + VARIABLE->yyDay = (yyvsp[(2) - (2)].Number); 1810 + + } 1811 + + break; 1812 + + 1813 + + case 30: 1814 + +/* Line 1787 of yacc.c */ 1815 + +#line 289 "ptlib/common/getdate.y" 1816 + + { 1817 + + VARIABLE->yyMonth = (yyvsp[(1) - (4)].Number); 1818 + + VARIABLE->yyDay = (yyvsp[(2) - (4)].Number); 1819 + + VARIABLE->yyYear = (yyvsp[(4) - (4)].Number); 1820 + + } 1821 + + break; 1822 + + 1823 + + case 31: 1824 + +/* Line 1787 of yacc.c */ 1825 + +#line 294 "ptlib/common/getdate.y" 1826 + + { 1827 + + if ((yyvsp[(1) - (2)].Number) > 31) 1828 + + VARIABLE->yyYear = (yyvsp[(1) - (2)].Number); 1829 + + else 1830 + + VARIABLE->yyDay = (yyvsp[(1) - (2)].Number); 1831 + + VARIABLE->yyMonth = (yyvsp[(2) - (2)].Number); 1832 + + } 1833 + + break; 1834 + + 1835 + + case 32: 1836 + +/* Line 1787 of yacc.c */ 1837 + +#line 301 "ptlib/common/getdate.y" 1838 + + { 1839 + + SetPossibleDate(VARIABLE, (yyvsp[(1) - (3)].Number), (yyvsp[(2) - (3)].Number), (yyvsp[(3) - (3)].Number)); 1840 + + } 1841 + + break; 1842 + + 1843 + + case 33: 1844 + +/* Line 1787 of yacc.c */ 1845 + +#line 306 "ptlib/common/getdate.y" 1846 + + { 1847 + + VARIABLE->yyRelSeconds = -VARIABLE->yyRelSeconds; 1848 + + VARIABLE->yyRelMonth = -VARIABLE->yyRelMonth; 1849 + + } 1850 + + break; 1851 + + 1852 + + case 35: 1853 + +/* Line 1787 of yacc.c */ 1854 + +#line 313 "ptlib/common/getdate.y" 1855 + + { 1856 + + VARIABLE->yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number) * 60L; 1857 + + } 1858 + + break; 1859 + + 1860 + + case 36: 1861 + +/* Line 1787 of yacc.c */ 1862 + +#line 316 "ptlib/common/getdate.y" 1863 + + { 1864 + + VARIABLE->yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number) * 60L; 1865 + + } 1866 + + break; 1867 + + 1868 + + case 37: 1869 + +/* Line 1787 of yacc.c */ 1870 + +#line 319 "ptlib/common/getdate.y" 1871 + + { 1872 + + VARIABLE->yyRelSeconds += (yyvsp[(1) - (1)].Number) * 60L; 1873 + + } 1874 + + break; 1875 + + 1876 + + case 38: 1877 + +/* Line 1787 of yacc.c */ 1878 + +#line 322 "ptlib/common/getdate.y" 1879 + + { 1880 + + VARIABLE->yyRelSeconds += (yyvsp[(1) - (2)].Number); 1881 + + } 1882 + + break; 1883 + + 1884 + + case 39: 1885 + +/* Line 1787 of yacc.c */ 1886 + +#line 325 "ptlib/common/getdate.y" 1887 + + { 1888 + + VARIABLE->yyRelSeconds += (yyvsp[(1) - (2)].Number); 1889 + + } 1890 + + break; 1891 + + 1892 + + case 40: 1893 + +/* Line 1787 of yacc.c */ 1894 + +#line 328 "ptlib/common/getdate.y" 1895 + + { 1896 + + VARIABLE->yyRelSeconds++; 1897 + + } 1898 + + break; 1899 + + 1900 + + case 41: 1901 + +/* Line 1787 of yacc.c */ 1902 + +#line 331 "ptlib/common/getdate.y" 1903 + + { 1904 + + VARIABLE->yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number); 1905 + + } 1906 + + break; 1907 + + 1908 + + case 42: 1909 + +/* Line 1787 of yacc.c */ 1910 + +#line 334 "ptlib/common/getdate.y" 1911 + + { 1912 + + VARIABLE->yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number); 1913 + + } 1914 + + break; 1915 + + 1916 + + case 43: 1917 + +/* Line 1787 of yacc.c */ 1918 + +#line 337 "ptlib/common/getdate.y" 1919 + + { 1920 + + VARIABLE->yyRelMonth += (yyvsp[(1) - (1)].Number); 1921 + + } 1922 + + break; 1923 + + 1924 + + case 44: 1925 + +/* Line 1787 of yacc.c */ 1926 + +#line 342 "ptlib/common/getdate.y" 1927 + + { 1928 + + (yyval.Number) = (yyvsp[(1) - (1)].Number); 1929 + + } 1930 + + break; 1931 + + 1932 + + case 45: 1933 + +/* Line 1787 of yacc.c */ 1934 + +#line 345 "ptlib/common/getdate.y" 1935 + + { 1936 + + (yyval.Number) = (yyvsp[(1) - (1)].Number); 1937 + + } 1938 + + break; 1939 + + 1940 + + case 46: 1941 + +/* Line 1787 of yacc.c */ 1942 + +#line 348 "ptlib/common/getdate.y" 1943 + + { 1944 + + (yyval.Number) = (yyvsp[(1) - (1)].Number); 1945 + + } 1946 + + break; 1947 + + 1948 + + case 47: 1949 + +/* Line 1787 of yacc.c */ 1950 + +#line 353 "ptlib/common/getdate.y" 1951 + + { 1952 + + if (VARIABLE->yyHaveTime && VARIABLE->yyHaveDate && !VARIABLE->yyHaveRel) 1953 + + VARIABLE->yyYear = (yyvsp[(1) - (1)].Number); 1954 + + else { 1955 + + if((yyvsp[(1) - (1)].Number)>240000) { 1956 + + VARIABLE->yyHaveDate++; 1957 + + VARIABLE->yyDay= ((yyvsp[(1) - (1)].Number))%100; 1958 + + VARIABLE->yyMonth= ((yyvsp[(1) - (1)].Number)/100)%100; 1959 + + VARIABLE->yyYear = (yyvsp[(1) - (1)].Number)/10000; 1960 + + } 1961 + + else { 1962 + + VARIABLE->yyHaveTime++; 1963 + + if ((yyvsp[(1) - (1)].Number) < 10000) { 1964 + + VARIABLE->yyHour = (yyvsp[(1) - (1)].Number) / 100; 1965 + + VARIABLE->yyMinutes = (yyvsp[(1) - (1)].Number) % 100; 1966 + + VARIABLE->yySeconds = 0; 1967 + + } 1968 + + else { 1969 + + VARIABLE->yyHour = (yyvsp[(1) - (1)].Number)/10000; 1970 + + VARIABLE->yyMinutes = ((yyvsp[(1) - (1)].Number)/100)%100; 1971 + + VARIABLE->yySeconds = (yyvsp[(1) - (1)].Number) % 100; 1972 + + } 1973 + + VARIABLE->yyMeridian = MER24; 1974 + + } 1975 + + } 1976 + + } 1977 + + break; 1978 + + 1979 + + case 48: 1980 + +/* Line 1787 of yacc.c */ 1981 + +#line 379 "ptlib/common/getdate.y" 1982 + + { 1983 + + if (VARIABLE->yyHaveTime && VARIABLE->yyHaveDate && !VARIABLE->yyHaveRel) 1984 + + VARIABLE->yyYear = (yyvsp[(1) - (1)].Number); 1985 + + else { 1986 + + VARIABLE->yyHaveTime++; 1987 + + VARIABLE->yyHour = (yyvsp[(1) - (1)].Number)/100; 1988 + + VARIABLE->yyMinutes = (yyvsp[(1) - (1)].Number)%100; 1989 + + VARIABLE->yySeconds = 0; 1990 + + VARIABLE->yyMeridian = MER24; 1991 + + } 1992 + + } 1993 + + break; 1994 + + 1995 + + case 49: 1996 + +/* Line 1787 of yacc.c */ 1997 + +#line 390 "ptlib/common/getdate.y" 1998 + + { 1999 + + if (!VARIABLE->yyHaveDate && (yyvsp[(1) - (1)].Number)>240000) { 2000 + + VARIABLE->yyHaveDate++; 2001 + + VARIABLE->yyDay= ((yyvsp[(1) - (1)].Number))%100; 2002 + + VARIABLE->yyMonth= ((yyvsp[(1) - (1)].Number)/100)%100; 2003 + + VARIABLE->yyYear = (yyvsp[(1) - (1)].Number)/10000; 2004 + + } 2005 + + else if (!VARIABLE->yyHaveTime) { 2006 + + VARIABLE->yyHaveTime++; 2007 + + VARIABLE->yyHour = (yyvsp[(1) - (1)].Number)/10000; 2008 + + VARIABLE->yyMinutes = ((yyvsp[(1) - (1)].Number)/100)%100; 2009 + + VARIABLE->yySeconds = (yyvsp[(1) - (1)].Number) % 100; 2010 + + VARIABLE->yyMeridian = MER24; 2011 + + } 2012 + + } 2013 + + break; 2014 + + 2015 + + case 50: 2016 + +/* Line 1787 of yacc.c */ 2017 + +#line 407 "ptlib/common/getdate.y" 2018 + + { 2019 + + (yyval.Meridian) = MER24; 2020 + + } 2021 + + break; 2022 + + 2023 + + case 51: 2024 + +/* Line 1787 of yacc.c */ 2025 + +#line 410 "ptlib/common/getdate.y" 2026 + + { 2027 + + (yyval.Meridian) = (yyvsp[(1) - (1)].Meridian); 2028 + + } 2029 + + break; 2030 + + 2031 + + 2032 + +/* Line 1787 of yacc.c */ 2033 + +#line 2031 "ptlib/common/getdate.tab.c" 2034 + + default: break; 2035 + + } 2036 + + /* User semantic actions sometimes alter yychar, and that requires 2037 + + that yytoken be updated with the new translation. We take the 2038 + + approach of translating immediately before every use of yytoken. 2039 + + One alternative is translating here after every semantic action, 2040 + + but that translation would be missed if the semantic action invokes 2041 + + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 2042 + + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 2043 + + incorrect destructor might then be invoked immediately. In the 2044 + + case of YYERROR or YYBACKUP, subsequent parser actions might lead 2045 + + to an incorrect destructor call or verbose syntax error message 2046 + + before the lookahead is translated. */ 2047 + + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2048 + + 2049 + + YYPOPSTACK (yylen); 2050 + + yylen = 0; 2051 + + YY_STACK_PRINT (yyss, yyssp); 2052 + + 2053 + + *++yyvsp = yyval; 2054 + + 2055 + + /* Now `shift' the result of the reduction. Determine what state 2056 + + that goes to, based on the state we popped back to and the rule 2057 + + number reduced by. */ 2058 + + 2059 + + yyn = yyr1[yyn]; 2060 + + 2061 + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2062 + + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2063 + + yystate = yytable[yystate]; 2064 + + else 2065 + + yystate = yydefgoto[yyn - YYNTOKENS]; 2066 + + 2067 + + goto yynewstate; 2068 + + 2069 + + 2070 + +/*------------------------------------. 2071 + +| yyerrlab -- here on detecting error | 2072 + +`------------------------------------*/ 2073 + +yyerrlab: 2074 + + /* Make sure we have latest lookahead translation. See comments at 2075 + + user semantic actions for why this is necessary. */ 2076 + + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 2077 + + 2078 + + /* If not already recovering from an error, report this error. */ 2079 + + if (!yyerrstatus) 2080 + + { 2081 + + ++yynerrs; 2082 + +#if ! YYERROR_VERBOSE 2083 + + yyerror (YY_("syntax error")); 2084 + +#else 2085 + +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 2086 + + yyssp, yytoken) 2087 + + { 2088 + + char const *yymsgp = YY_("syntax error"); 2089 + + int yysyntax_error_status; 2090 + + yysyntax_error_status = YYSYNTAX_ERROR; 2091 + + if (yysyntax_error_status == 0) 2092 + + yymsgp = yymsg; 2093 + + else if (yysyntax_error_status == 1) 2094 + + { 2095 + + if (yymsg != yymsgbuf) 2096 + + YYSTACK_FREE (yymsg); 2097 + + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 2098 + + if (!yymsg) 2099 + + { 2100 + + yymsg = yymsgbuf; 2101 + + yymsg_alloc = sizeof yymsgbuf; 2102 + + yysyntax_error_status = 2; 2103 + + } 2104 + + else 2105 + + { 2106 + + yysyntax_error_status = YYSYNTAX_ERROR; 2107 + + yymsgp = yymsg; 2108 + + } 2109 + + } 2110 + + yyerror (yymsgp); 2111 + + if (yysyntax_error_status == 2) 2112 + + goto yyexhaustedlab; 2113 + + } 2114 + +# undef YYSYNTAX_ERROR 2115 + +#endif 2116 + + } 2117 + + 2118 + + 2119 + + 2120 + + if (yyerrstatus == 3) 2121 + + { 2122 + + /* If just tried and failed to reuse lookahead token after an 2123 + + error, discard it. */ 2124 + + 2125 + + if (yychar <= YYEOF) 2126 + + { 2127 + + /* Return failure if at end of input. */ 2128 + + if (yychar == YYEOF) 2129 + + YYABORT; 2130 + + } 2131 + + else 2132 + + { 2133 + + yydestruct ("Error: discarding", 2134 + + yytoken, &yylval); 2135 + + yychar = YYEMPTY; 2136 + + } 2137 + + } 2138 + + 2139 + + /* Else will try to reuse lookahead token after shifting the error 2140 + + token. */ 2141 + + goto yyerrlab1; 2142 + + 2143 + + 2144 + +/*---------------------------------------------------. 2145 + +| yyerrorlab -- error raised explicitly by YYERROR. | 2146 + +`---------------------------------------------------*/ 2147 + +yyerrorlab: 2148 + + 2149 + + /* Pacify compilers like GCC when the user code never invokes 2150 + + YYERROR and the label yyerrorlab therefore never appears in user 2151 + + code. */ 2152 + + if (/*CONSTCOND*/ 0) 2153 + + goto yyerrorlab; 2154 + + 2155 + + /* Do not reclaim the symbols of the rule which action triggered 2156 + + this YYERROR. */ 2157 + + YYPOPSTACK (yylen); 2158 + + yylen = 0; 2159 + + YY_STACK_PRINT (yyss, yyssp); 2160 + + yystate = *yyssp; 2161 + + goto yyerrlab1; 2162 + + 2163 + + 2164 + +/*-------------------------------------------------------------. 2165 + +| yyerrlab1 -- common code for both syntax error and YYERROR. | 2166 + +`-------------------------------------------------------------*/ 2167 + +yyerrlab1: 2168 + + yyerrstatus = 3; /* Each real token shifted decrements this. */ 2169 + + 2170 + + for (;;) 2171 + + { 2172 + + yyn = yypact[yystate]; 2173 + + if (!yypact_value_is_default (yyn)) 2174 + + { 2175 + + yyn += YYTERROR; 2176 + + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2177 + + { 2178 + + yyn = yytable[yyn]; 2179 + + if (0 < yyn) 2180 + + break; 2181 + + } 2182 + + } 2183 + + 2184 + + /* Pop the current state because it cannot handle the error token. */ 2185 + + if (yyssp == yyss) 2186 + + YYABORT; 2187 + + 2188 + + 2189 + + yydestruct ("Error: popping", 2190 + + yystos[yystate], yyvsp); 2191 + + YYPOPSTACK (1); 2192 + + yystate = *yyssp; 2193 + + YY_STACK_PRINT (yyss, yyssp); 2194 + + } 2195 + + 2196 + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 2197 + + *++yyvsp = yylval; 2198 + + YY_IGNORE_MAYBE_UNINITIALIZED_END 2199 + + 2200 + + 2201 + + /* Shift the error token. */ 2202 + + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2203 + + 2204 + + yystate = yyn; 2205 + + goto yynewstate; 2206 + + 2207 + + 2208 + +/*-------------------------------------. 2209 + +| yyacceptlab -- YYACCEPT comes here. | 2210 + +`-------------------------------------*/ 2211 + +yyacceptlab: 2212 + + yyresult = 0; 2213 + + goto yyreturn; 2214 + + 2215 + +/*-----------------------------------. 2216 + +| yyabortlab -- YYABORT comes here. | 2217 + +`-----------------------------------*/ 2218 + +yyabortlab: 2219 + + yyresult = 1; 2220 + + goto yyreturn; 2221 + + 2222 + +#if !defined yyoverflow || YYERROR_VERBOSE 2223 + +/*-------------------------------------------------. 2224 + +| yyexhaustedlab -- memory exhaustion comes here. | 2225 + +`-------------------------------------------------*/ 2226 + +yyexhaustedlab: 2227 + + yyerror (YY_("memory exhausted")); 2228 + + yyresult = 2; 2229 + + /* Fall through. */ 2230 + +#endif 2231 + + 2232 + +yyreturn: 2233 + + if (yychar != YYEMPTY) 2234 + + { 2235 + + /* Make sure we have latest lookahead translation. See comments at 2236 + + user semantic actions for why this is necessary. */ 2237 + + yytoken = YYTRANSLATE (yychar); 2238 + + yydestruct ("Cleanup: discarding lookahead", 2239 + + yytoken, &yylval); 2240 + + } 2241 + + /* Do not reclaim the symbols of the rule which action triggered 2242 + + this YYABORT or YYACCEPT. */ 2243 + + YYPOPSTACK (yylen); 2244 + + YY_STACK_PRINT (yyss, yyssp); 2245 + + while (yyssp != yyss) 2246 + + { 2247 + + yydestruct ("Cleanup: popping", 2248 + + yystos[*yyssp], yyvsp); 2249 + + YYPOPSTACK (1); 2250 + + } 2251 + +#ifndef yyoverflow 2252 + + if (yyss != yyssa) 2253 + + YYSTACK_FREE (yyss); 2254 + +#endif 2255 + +#if YYERROR_VERBOSE 2256 + + if (yymsg != yymsgbuf) 2257 + + YYSTACK_FREE (yymsg); 2258 + +#endif 2259 + + /* Make sure YYID is used. */ 2260 + + return YYID (yyresult); 2261 + +} 2262 + + 2263 + + 2264 + +/* Line 2050 of yacc.c */ 2265 + +#line 415 "ptlib/common/getdate.y" 2266 + + 2267 + + 2268 + +/* Month and day table. */ 2269 + +static TABLE const MonthDayTable[] = { 2270 + + { "january", tMONTH, 1 }, 2271 + + { "february", tMONTH, 2 }, 2272 + + { "march", tMONTH, 3 }, 2273 + + { "april", tMONTH, 4 }, 2274 + + { "may", tMONTH, 5 }, 2275 + + { "june", tMONTH, 6 }, 2276 + + { "july", tMONTH, 7 }, 2277 + + { "august", tMONTH, 8 }, 2278 + + { "september", tMONTH, 9 }, 2279 + + { "sept", tMONTH, 9 }, 2280 + + { "october", tMONTH, 10 }, 2281 + + { "november", tMONTH, 11 }, 2282 + + { "december", tMONTH, 12 }, 2283 + + { "sunday", tDAY, 0 }, 2284 + + { "monday", tDAY, 1 }, 2285 + + { "tuesday", tDAY, 2 }, 2286 + + { "tues", tDAY, 2 }, 2287 + + { "wednesday", tDAY, 3 }, 2288 + + { "wednes", tDAY, 3 }, 2289 + + { "thursday", tDAY, 4 }, 2290 + + { "thur", tDAY, 4 }, 2291 + + { "thurs", tDAY, 4 }, 2292 + + { "friday", tDAY, 5 }, 2293 + + { "saturday", tDAY, 6 }, 2294 + + { NULL } 2295 + +}; 2296 + + 2297 + +/* Time units table. */ 2298 + +static TABLE const UnitsTable[] = { 2299 + + { "year", tMONTH_UNIT, 12 }, 2300 + + { "month", tMONTH_UNIT, 1 }, 2301 + + { "fortnight", tMINUTE_UNIT, 14 * 24 * 60 }, 2302 + + { "week", tMINUTE_UNIT, 7 * 24 * 60 }, 2303 + + { "day", tMINUTE_UNIT, 1 * 24 * 60 }, 2304 + + { "hour", tMINUTE_UNIT, 60 }, 2305 + + { "minute", tMINUTE_UNIT, 1 }, 2306 + + { "min", tMINUTE_UNIT, 1 }, 2307 + + { "second", tSEC_UNIT, 1 }, 2308 + + { "sec", tSEC_UNIT, 1 }, 2309 + + { NULL } 2310 + +}; 2311 + + 2312 + +/* Assorted relative-time words. */ 2313 + +static TABLE const OtherTable[] = { 2314 + + { "tomorrow", tMINUTE_UNIT, 1 * 24 * 60 }, 2315 + + { "yesterday", tMINUTE_UNIT, -1 * 24 * 60 }, 2316 + + { "today", tMINUTE_UNIT, 0 }, 2317 + + { "now", tMINUTE_UNIT, 0 }, 2318 + + { "last", tUNUMBER, -1 }, 2319 + + { "this", tMINUTE_UNIT, 0 }, 2320 + + { "next", tUNUMBER, 2 }, 2321 + + { "first", tUNUMBER, 1 }, 2322 + +/* { "second", tUNUMBER, 2 }, */ 2323 + + { "third", tUNUMBER, 3 }, 2324 + + { "fourth", tUNUMBER, 4 }, 2325 + + { "fifth", tUNUMBER, 5 }, 2326 + + { "sixth", tUNUMBER, 6 }, 2327 + + { "seventh", tUNUMBER, 7 }, 2328 + + { "eighth", tUNUMBER, 8 }, 2329 + + { "ninth", tUNUMBER, 9 }, 2330 + + { "tenth", tUNUMBER, 10 }, 2331 + + { "eleventh", tUNUMBER, 11 }, 2332 + + { "twelfth", tUNUMBER, 12 }, 2333 + + { "ago", tAGO, 1 }, 2334 + + { NULL } 2335 + +}; 2336 + + 2337 + +/* The timezone table. */ 2338 + +/* Some of these are commented out because a time_t can't store a float. */ 2339 + +static TABLE const TimezoneTable[] = { 2340 + + { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */ 2341 + + { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */ 2342 + + { "utc", tZONE, HOUR( 0) }, 2343 + + { "wet", tZONE, HOUR( 0) }, /* Western European */ 2344 + + { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */ 2345 + + { "wat", tZONE, HOUR( 1) }, /* West Africa */ 2346 + + { "at", tZONE, HOUR( 2) }, /* Azores */ 2347 + +#if 0 2348 + + /* For completeness. BST is also British Summer, and GST is 2349 + + * also Guam Standard. */ 2350 + + { "bst", tZONE, HOUR( 3) }, /* Brazil Standard */ 2351 + + { "gst", tZONE, HOUR( 3) }, /* Greenland Standard */ 2352 + +#endif 2353 + +#if 0 2354 + + { "nft", tZONE, HOUR(3.5) }, /* Newfoundland */ 2355 + + { "nst", tZONE, HOUR(3.5) }, /* Newfoundland Standard */ 2356 + + { "ndt", tDAYZONE, HOUR(3.5) }, /* Newfoundland Daylight */ 2357 + +#endif 2358 + + { "ast", tZONE, HOUR( 4) }, /* Atlantic Standard */ 2359 + + { "adt", tDAYZONE, HOUR( 4) }, /* Atlantic Daylight */ 2360 + + { "est", tZONE, HOUR( 5) }, /* Eastern Standard */ 2361 + + { "edt", tDAYZONE, HOUR( 5) }, /* Eastern Daylight */ 2362 + + { "cst", tZONE, HOUR( 6) }, /* Central Standard */ 2363 + + { "cdt", tDAYZONE, HOUR( 6) }, /* Central Daylight */ 2364 + + { "mst", tZONE, HOUR( 7) }, /* Mountain Standard */ 2365 + + { "mdt", tDAYZONE, HOUR( 7) }, /* Mountain Daylight */ 2366 + + { "pst", tZONE, HOUR( 8) }, /* Pacific Standard */ 2367 + + { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */ 2368 + + { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */ 2369 + + { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */ 2370 + + { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */ 2371 + + { "hdt", tDAYZONE, HOUR(10) }, /* Hawaii Daylight */ 2372 + + { "cat", tZONE, HOUR(10) }, /* Central Alaska */ 2373 + + { "ahst", tZONE, HOUR(10) }, /* Alaska-Hawaii Standard */ 2374 + + { "nt", tZONE, HOUR(11) }, /* Nome */ 2375 + + { "idlw", tZONE, HOUR(12) }, /* International Date Line West */ 2376 + + { "cet", tZONE, -HOUR(1) }, /* Central European */ 2377 + + { "met", tZONE, -HOUR(1) }, /* Middle European */ 2378 + + { "mewt", tZONE, -HOUR(1) }, /* Middle European Winter */ 2379 + + { "mest", tDAYZONE, -HOUR(1) }, /* Middle European Summer */ 2380 + + { "swt", tZONE, -HOUR(1) }, /* Swedish Winter */ 2381 + + { "sst", tDAYZONE, -HOUR(1) }, /* Swedish Summer */ 2382 + + { "fwt", tZONE, -HOUR(1) }, /* French Winter */ 2383 + + { "fst", tDAYZONE, -HOUR(1) }, /* French Summer */ 2384 + + { "eet", tZONE, -HOUR(2) }, /* Eastern Europe, USSR Zone 1 */ 2385 + + { "bt", tZONE, -HOUR(3) }, /* Baghdad, USSR Zone 2 */ 2386 + +#if 0 2387 + + { "it", tZONE, -HOUR(3.5) },/* Iran */ 2388 + +#endif 2389 + + { "zp4", tZONE, -HOUR(4) }, /* USSR Zone 3 */ 2390 + + { "zp5", tZONE, -HOUR(5) }, /* USSR Zone 4 */ 2391 + +#if 0 2392 + + { "ist", tZONE, -HOUR(5.5) },/* Indian Standard */ 2393 + +#endif 2394 + + { "zp6", tZONE, -HOUR(6) }, /* USSR Zone 5 */ 2395 + +#if 0 2396 + + /* For completeness. NST is also Newfoundland Stanard, and SST is 2397 + + * also Swedish Summer. */ 2398 + + { "nst", tZONE, -HOUR(6.5) },/* North Sumatra */ 2399 + + { "sst", tZONE, -HOUR(7) }, /* South Sumatra, USSR Zone 6 */ 2400 + +#endif /* 0 */ 2401 + + { "wast", tZONE, -HOUR(7) }, /* West Australian Standard */ 2402 + + { "wadt", tDAYZONE, -HOUR(7) }, /* West Australian Daylight */ 2403 + +#if 0 2404 + + { "jt", tZONE, -HOUR(7.5) },/* Java (3pm in Cronusland!) */ 2405 + +#endif 2406 + + { "cct", tZONE, -HOUR(8) }, /* China Coast, USSR Zone 7 */ 2407 + + { "jst", tZONE, -HOUR(9) }, /* Japan Standard, USSR Zone 8 */ 2408 + +#if 0 2409 + + { "cast", tZONE, -HOUR(9.5) },/* Central Australian Standard */ 2410 + + { "cadt", tDAYZONE, -HOUR(9.5) },/* Central Australian Daylight */ 2411 + +#endif 2412 + + { "east", tZONE, -HOUR(10) }, /* Eastern Australian Standard */ 2413 + + { "eadt", tDAYZONE, -HOUR(10) }, /* Eastern Australian Daylight */ 2414 + + { "gst", tZONE, -HOUR(10) }, /* Guam Standard, USSR Zone 9 */ 2415 + + { "nzt", tZONE, -HOUR(12) }, /* New Zealand */ 2416 + + { "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */ 2417 + + { "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */ 2418 + + { "idle", tZONE, -HOUR(12) }, /* International Date Line East */ 2419 + + { NULL } 2420 + +}; 2421 + + 2422 + +/* Military timezone table. */ 2423 + +static TABLE const MilitaryTable[] = { 2424 + + { "a", tMILZONE, HOUR( 1) }, 2425 + + { "b", tMILZONE, HOUR( 2) }, 2426 + + { "c", tMILZONE, HOUR( 3) }, 2427 + + { "d", tMILZONE, HOUR( 4) }, 2428 + + { "e", tMILZONE, HOUR( 5) }, 2429 + + { "f", tMILZONE, HOUR( 6) }, 2430 + + { "g", tMILZONE, HOUR( 7) }, 2431 + + { "h", tMILZONE, HOUR( 8) }, 2432 + + { "i", tMILZONE, HOUR( 9) }, 2433 + + { "k", tMILZONE, HOUR( 10) }, 2434 + + { "l", tMILZONE, HOUR( 11) }, 2435 + + { "m", tMILZONE, HOUR( 12) }, 2436 + + { "n", tMILZONE, HOUR(- 1) }, 2437 + + { "o", tMILZONE, HOUR(- 2) }, 2438 + + { "p", tMILZONE, HOUR(- 3) }, 2439 + + { "q", tMILZONE, HOUR(- 4) }, 2440 + + { "r", tMILZONE, HOUR(- 5) }, 2441 + + { "s", tMILZONE, HOUR(- 6) }, 2442 + + { "t", tMILZONE, HOUR(- 7) }, 2443 + + { "u", tMILZONE, HOUR(- 8) }, 2444 + + { "v", tMILZONE, HOUR(- 9) }, 2445 + + { "w", tMILZONE, HOUR(-10) }, 2446 + + { "x", tMILZONE, HOUR(-11) }, 2447 + + { "y", tMILZONE, HOUR(-12) }, 2448 + + { "z", tZONE, HOUR( 0) }, /* Deliberately tZONE */ 2449 + + { NULL } 2450 + +}; 2451 + + 2452 + +static int LookupWord(char * buff, YYSTYPE * yylval, struct Variables * vars) 2453 + +{ 2454 + + register char *p; 2455 + + register char *q; 2456 + + register const TABLE *tp; 2457 + + int i; 2458 + + int abbrev; 2459 + + 2460 + + /* Make it lowercase. */ 2461 + + for (p = buff; *p != '\0'; p++) 2462 + + *p = (char)tolower(*p); 2463 + + 2464 + + if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) { 2465 + + yylval->Meridian = MERam; 2466 + + return tMERIDIAN; 2467 + + } 2468 + + if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) { 2469 + + yylval->Meridian = MERpm; 2470 + + return tMERIDIAN; 2471 + + } 2472 + + 2473 + + /* See if we have an abbreviation for a month. */ 2474 + + if (strlen(buff) == 3) 2475 + + abbrev = 1; 2476 + + else if (strlen(buff) == 4 && buff[3] == '.') { 2477 + + abbrev = 1; 2478 + + buff[3] = '\0'; 2479 + + } 2480 + + else 2481 + + abbrev = 0; 2482 + + 2483 + + for (tp = MonthDayTable; tp->name; tp++) { 2484 + + if (abbrev) { 2485 + + if (strncmp(buff, tp->name, 3) == 0) { 2486 + + yylval->Number = tp->value; 2487 + + return tp->type; 2488 + + } 2489 + + } 2490 + + else if (strcmp(buff, tp->name) == 0) { 2491 + + yylval->Number = tp->value; 2492 + + return tp->type; 2493 + + } 2494 + + } 2495 + + 2496 + + for (tp = TimezoneTable; tp->name; tp++) 2497 + + if (strcmp(buff, tp->name) == 0) { 2498 + + yylval->Number = tp->value; 2499 + + return tp->type; 2500 + + } 2501 + + 2502 + + if (strcmp(buff, "dst") == 0) 2503 + + return tDST; 2504 + + 2505 + + for (tp = UnitsTable; tp->name; tp++) 2506 + + if (strcmp(buff, tp->name) == 0) { 2507 + + yylval->Number = tp->value; 2508 + + return tp->type; 2509 + + } 2510 + + 2511 + + /* Strip off any plural and try the units table again. */ 2512 + + i = strlen(buff) - 1; 2513 + + if (buff[i] == 's') { 2514 + + buff[i] = '\0'; 2515 + + for (tp = UnitsTable; tp->name; tp++) 2516 + + if (strcmp(buff, tp->name) == 0) { 2517 + + yylval->Number = tp->value; 2518 + + return tp->type; 2519 + + } 2520 + + buff[i] = 's'; /* Put back for "this" in OtherTable. */ 2521 + + } 2522 + + 2523 + + for (tp = OtherTable; tp->name; tp++) 2524 + + if (strcmp(buff, tp->name) == 0) { 2525 + + yylval->Number = tp->value; 2526 + + return tp->type; 2527 + + } 2528 + + 2529 + + /* Avoid confusion with 'T' in RFC3339 and 't' in Military timezones */ 2530 + + if (!vars->yyHaveTime && strcmp(buff, "t") == 0) 2531 + + return tRFC3339; 2532 + + 2533 + + /* Military timezones. */ 2534 + + if (buff[1] == '\0' && isalpha(*buff)) { 2535 + + for (tp = MilitaryTable; tp->name; tp++) 2536 + + if (strcmp(buff, tp->name) == 0) { 2537 + + yylval->Number = tp->value; 2538 + + return tp->type; 2539 + + } 2540 + + } 2541 + + 2542 + + /* Drop out any periods and try the timezone table again. */ 2543 + + for (i = 0, p = q = buff; *q; q++) 2544 + + if (*q != '.') 2545 + + *p++ = *q; 2546 + + else 2547 + + i++; 2548 + + *p = '\0'; 2549 + + if (i) 2550 + + for (tp = TimezoneTable; tp->name; tp++) 2551 + + if (strcmp(buff, tp->name) == 0) { 2552 + + yylval->Number = tp->value; 2553 + + return tp->type; 2554 + + } 2555 + + 2556 + + for (i = 1; i <= 12; i++) 2557 + + for (abbrev = 0; abbrev < 2; abbrev++) 2558 + + if (PTimeIsMonthName(buff, i, abbrev)) { 2559 + + yylval->Number = i; 2560 + + return tMONTH; 2561 + + } 2562 + + 2563 + + for (i = 1; i <= 7; i++) 2564 + + for (abbrev = 0; abbrev < 2; abbrev++) 2565 + + if (PTimeIsDayName(buff, i, abbrev)) { 2566 + + yylval->Number = i; 2567 + + return tDAY; 2568 + + } 2569 + + 2570 + + return tID; 2571 + +} 2572 + + 2573 + + 2574 + +#ifdef _MSC_VER 2575 + +#pragma warning(disable:4211) 2576 + +#endif 2577 + + 2578 + +#ifndef __GNUC__ 2579 + +static 2580 + +#endif 2581 + +int yylex(YYSTYPE * yylval, struct Variables * vars) 2582 + +{ 2583 + + register char *p; 2584 + + char buff[20]; 2585 + + int Count; 2586 + + int sign; 2587 + + register int c = PTimeGetChar(vars->yyInput); 2588 + + 2589 + + while (c != EOF && c != '\0' && c != '\n') { 2590 + + while (isspace(c)) 2591 + + c = PTimeGetChar(vars->yyInput); 2592 + + 2593 + + if (isdigit(c) || c == '-' || c == '+') { 2594 + + if (c == '-' || c == '+') { 2595 + + sign = c == '-' ? -1 : 1; 2596 + + if (!isdigit(c = PTimeGetChar(vars->yyInput))) 2597 + + /* skip the '-' sign */ 2598 + + continue; 2599 + + } 2600 + + else 2601 + + sign = 0; 2602 + + yylval->Number = 0; 2603 + + Count = 0; /* Count number of digits */ 2604 + + while (isdigit(c)) { 2605 + + yylval->Number = 10 * yylval->Number + c - '0'; 2606 + + c = PTimeGetChar(vars->yyInput); 2607 + + Count++; 2608 + + } 2609 + + PTimeUngetChar(vars->yyInput, c); 2610 + + if (sign < 0) 2611 + + yylval->Number = -yylval->Number; 2612 + + if (Count == 4) 2613 + + return sign ? tS4DIGITNUMBER : t4DIGITNUMBER; 2614 + + if (sign) 2615 + + return tSNUMBER; 2616 + + if (Count == 6) 2617 + + return t6DIGITNUMBER; 2618 + + if (Count == 8) 2619 + + return t8DIGITNUMBER; 2620 + + return tUNUMBER; 2621 + + } 2622 + + 2623 + + if (isalpha(c)) { 2624 + + for (p = buff; isalpha(c) || c == '.'; c = PTimeGetChar(vars->yyInput)) { 2625 + + if (p < &buff[sizeof(buff)-1]) 2626 + + *p++ = (char)c; 2627 + + } 2628 + + *p = '\0'; 2629 + + PTimeUngetChar(vars->yyInput, c); 2630 + + return LookupWord(buff, yylval, vars); 2631 + + } 2632 + + 2633 + + if (c != '(') 2634 + + return c; 2635 + + 2636 + + Count = 0; 2637 + + do { 2638 + + c = PTimeGetChar(vars->yyInput); 2639 + + if (c == '\0' || c == EOF) 2640 + + return c; 2641 + + if (c == '(') 2642 + + Count++; 2643 + + else if (c == ')') 2644 + + Count--; 2645 + + } while (Count > 0); 2646 + + } 2647 + + 2648 + + if (c == '\n') 2649 + + PTimeUngetChar(vars->yyInput, c); 2650 + + 2651 + + return EOF; 2652 + +} 2653 + + 2654 + +#ifdef _MSC_VER 2655 + +#pragma warning(default:4211) 2656 + +#endif 2657 + + 2658 + + 2659 + +static time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, 2660 + + MERIDIAN Meridian) 2661 + +{ 2662 + + if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59) 2663 + + return -1; 2664 + + switch (Meridian) { 2665 + + case MER24: 2666 + + if (Hours < 0 || Hours > 23) 2667 + + return -1; 2668 + + return (Hours * 60L + Minutes) * 60L + Seconds; 2669 + + case MERam: 2670 + + if (Hours < 1 || Hours > 12) 2671 + + return -1; 2672 + + if (Hours == 12) 2673 + + Hours = 0; 2674 + + return (Hours * 60L + Minutes) * 60L + Seconds; 2675 + + case MERpm: 2676 + + if (Hours < 1 || Hours > 12) 2677 + + return -1; 2678 + + if (Hours == 12) 2679 + + Hours = 0; 2680 + + return ((Hours + 12) * 60L + Minutes) * 60L + Seconds; 2681 + + } 2682 + + 2683 + + return -1; 2684 + +} 2685 + + 2686 + + 2687 + +static time_t Convert(time_t Month, time_t Day, time_t Year, 2688 + + time_t Hours, time_t Minutes, time_t Seconds, 2689 + + MERIDIAN Meridian, DSTMODE DSTmode, time_t yyTimezone) 2690 + +{ 2691 + + static int DaysInMonth[12] = { 2692 + + 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 2693 + + }; 2694 + + time_t tod; 2695 + + time_t Julian; 2696 + + int i; 2697 + + 2698 + + if (Year < 0) 2699 + + Year = -Year; 2700 + + if (Year < 70) 2701 + + Year += 2000; 2702 + + else if (Year < 100) 2703 + + Year += 1900; 2704 + + DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) 2705 + + ? 29 : 28; 2706 + + /* Checking for 2038 bogusly assumes that time_t is 32 bits. But 2707 + + I'm too lazy to try to check for time_t overflow in another way. */ 2708 + + if (Year < EPOCH || Year > 2038 2709 + + || Month < 1 || Month > 12 2710 + + /* Lint fluff: "conversion from long may lose accuracy" */ 2711 + + || Day < 1 || Day > DaysInMonth[(int)--Month]) 2712 + + return -1; 2713 + + 2714 + + for (Julian = Day - 1, i = 0; i < Month; i++) 2715 + + Julian += DaysInMonth[i]; 2716 + + for (i = EPOCH; i < Year; i++) 2717 + + Julian += 365 + (i % 4 == 0); 2718 + + Julian *= SECSPERDAY; 2719 + + Julian += yyTimezone * 60L; 2720 + + if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0) 2721 + + return -1; 2722 + + Julian += tod; 2723 + + if (DSTmode == DSTon 2724 + + || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst)) 2725 + + Julian -= 60 * 60; 2726 + + return Julian; 2727 + +} 2728 + + 2729 + + 2730 + +static time_t DSTcorrect(time_t Start, time_t Future) 2731 + +{ 2732 + + time_t StartDay; 2733 + + time_t FutureDay; 2734 + + 2735 + + StartDay = (localtime(&Start)->tm_hour + 1) % 24; 2736 + + FutureDay = (localtime(&Future)->tm_hour + 1) % 24; 2737 + + return (Future - Start) + (StartDay - FutureDay) * 60L * 60L; 2738 + +} 2739 + + 2740 + + 2741 + +static time_t RelativeDate(time_t Start, time_t DayOrdinal, time_t DayNumber) 2742 + +{ 2743 + + struct tm *tm; 2744 + + time_t now; 2745 + + 2746 + + now = Start; 2747 + + tm = localtime(&now); 2748 + + now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7); 2749 + + now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1); 2750 + + return DSTcorrect(Start, now); 2751 + +} 2752 + + 2753 + + 2754 + +static time_t RelativeMonth(time_t Start, time_t RelMonth, time_t yyTimezone) 2755 + +{ 2756 + + struct tm *tm; 2757 + + time_t Month; 2758 + + time_t Year; 2759 + + 2760 + + if (RelMonth == 0) 2761 + + return 0; 2762 + + tm = localtime(&Start); 2763 + + Month = 12 * tm->tm_year + tm->tm_mon + RelMonth; 2764 + + Year = Month / 12 + 1900; 2765 + + Month = Month % 12 + 1; 2766 + + return DSTcorrect(Start, 2767 + + Convert(Month, (time_t)tm->tm_mday, Year, 2768 + + (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec, 2769 + + MER24, DSTmaybe, yyTimezone)); 2770 + +} 2771 + + 2772 + + 2773 + +static void SetPossibleDate(struct Variables * var, 2774 + + time_t possible_day, 2775 + + time_t possible_month, 2776 + + time_t possible_year) 2777 + +{ 2778 + + int date_order; 2779 + + 2780 + + if (possible_day > 31) /* test for ymd */ 2781 + + date_order = 2; 2782 + + else if (possible_day > 12) /* test for dmy */ 2783 + + date_order = 1; 2784 + + else if (possible_month > 12) /* test for mdy */ 2785 + + date_order = 0; 2786 + + else 2787 + + date_order = PTimeGetDateOrder(); 2788 + + 2789 + + switch (date_order) { 2790 + + case 0 : 2791 + + var->yyDay = possible_month; 2792 + + var->yyMonth = possible_day; 2793 + + var->yyYear = possible_year; 2794 + + break; 2795 + + case 1 : 2796 + + var->yyDay = possible_day; 2797 + + var->yyMonth = possible_month; 2798 + + var->yyYear = possible_year; 2799 + + break; 2800 + + default : 2801 + + var->yyDay = possible_year; 2802 + + var->yyMonth = possible_month; 2803 + + var->yyYear = possible_day; 2804 + + } 2805 + +} 2806 + + 2807 + + 2808 + +time_t STDAPICALLTYPE PTimeParse(void * inputStream, struct tm * now, int timezone) 2809 + +{ 2810 + + time_t Start; 2811 + + struct Variables var; 2812 + + 2813 + + 2814 + + var.yyInput = inputStream; 2815 + + var.yyYear = now->tm_year + 1900; 2816 + + var.yyMonth = now->tm_mon + 1; 2817 + + var.yyDay = now->tm_mday; 2818 + + var.yyTimezone = -timezone; 2819 + + var.yyDSTmode = DSTmaybe; 2820 + + var.yyHour = 0; 2821 + + var.yyMinutes = 0; 2822 + + var.yySeconds = 0; 2823 + + var.yyMeridian = MER24; 2824 + + var.yyRelSeconds = 0; 2825 + + var.yyRelMonth = 0; 2826 + + var.yyHaveDate = 0; 2827 + + var.yyHaveDay = 0; 2828 + + var.yyHaveRel = 0; 2829 + + var.yyHaveTime = 0; 2830 + + var.yyHaveZone = 0; 2831 + + 2832 + + yyparse(&var); 2833 + + 2834 + + if (var.yyHaveTime > 1 || var.yyHaveZone > 1 || 2835 + + var.yyHaveDate > 1 || var.yyHaveDay > 1) 2836 + + return -1; 2837 + + 2838 + + if (var.yyHaveTime == 0 && var.yyHaveZone == 0 && 2839 + + var.yyHaveDate == 0 && var.yyHaveDay == 0 && var.yyHaveRel == 0) 2840 + + return -1; 2841 + + 2842 + + if (var.yyHaveDate || var.yyHaveTime || var.yyHaveDay) { 2843 + + Start = Convert(var.yyMonth, var.yyDay, var.yyYear, 2844 + + var.yyHour, var.yyMinutes, var.yySeconds, 2845 + + var.yyMeridian, var.yyDSTmode, var.yyTimezone); 2846 + + if (Start < 0) 2847 + + return -1; 2848 + + } 2849 + + else { 2850 + + time(&Start); 2851 + + if (!var.yyHaveRel) 2852 + + Start -= ((now->tm_hour * 60L + now->tm_min) * 60L) + now->tm_sec; 2853 + + } 2854 + + 2855 + + Start += var.yyRelSeconds; 2856 + + Start += RelativeMonth(Start, var.yyRelMonth, var.yyTimezone); 2857 + + 2858 + + if (var.yyHaveDay && !var.yyHaveDate) 2859 + + Start += RelativeDate(Start, var.yyDayOrdinal, var.yyDayNumber); 2860 + + 2861 + + /* Have to do *something* with a legitimate -1 so it's distinguishable 2862 + + * from the error return value. (Alternately could set errno on error.) */ 2863 + + return Start == -1 ? 0 : Start; 2864 + +} 2865 + + 2866 + + 2867 + +#ifdef _MSC_VER 2868 + +#pragma warning(disable:4028 4100 4211) 2869 + +#endif 2870 + + 2871 + +#ifdef __GNUC__ 2872 + +int yyerror(const char * s) 2873 + +{ 2874 + + return 0; 2875 + +} 2876 + +#else 2877 + +static void yyerror(const char * s) 2878 + +{ 2879 + +} 2880 + +#endif 2881 + + 2882 + +#ifdef _MSC_VER 2883 + +#pragma warning(default:4028 4100 4211) 2884 + +#endif 2885 + + 2886 + + 2887 + +/* End of file ***************************************************************/