ptlib-2.10.11-bison_fixes-2.patch 86 KB

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