diff options
Diffstat (limited to 'ext/date/lib/parse_date.c')
-rw-r--r-- | ext/date/lib/parse_date.c | 276 |
1 files changed, 141 insertions, 135 deletions
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index 2a10139b43..0230e45ca8 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -1,21 +1,27 @@ -/* Generated by re2c 0.13.5 on Tue Mar 31 16:32:03 2015 */ +/* Generated by re2c 0.13.5 on Tue Sep 22 08:27:53 2015 */ #line 1 "ext/date/lib/parse_date.re" /* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Derick Rethans <derick@derickrethans.nl> | - +----------------------------------------------------------------------+ + * The MIT License (MIT) + * + * Copyright (c) 2015 Derick Rethans + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ /* $Id$ */ @@ -566,11 +572,11 @@ static timelib_sll timelib_get_relative_text(char **ptr, int *behavior) return timelib_lookup_relative_text(ptr, behavior); } -static long timelib_lookup_month(char **ptr) +static timelib_long timelib_lookup_month(char **ptr) { char *word; char *begin = *ptr, *end; - long value = 0; + timelib_long value = 0; const timelib_lookup_table *tp; while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) { @@ -590,7 +596,7 @@ static long timelib_lookup_month(char **ptr) return value; } -static long timelib_get_month(char **ptr) +static timelib_long timelib_get_month(char **ptr) { while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') { ++*ptr; @@ -670,7 +676,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S } } -const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffset, int isdst) +const static timelib_tz_lookup_table* abbr_search(const char *word, timelib_long gmtoffset, int isdst) { int first_found = 0; const timelib_tz_lookup_table *tp, *first_found_elem = NULL; @@ -679,7 +685,7 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs if (strcasecmp("utc", word) == 0 || strcasecmp("gmt", word) == 0) { return timelib_timezone_utc; } - + for (tp = timelib_timezone_lookup; tp->name; tp++) { if (strcasecmp(word, tp->name) == 0) { if (!first_found) { @@ -708,11 +714,11 @@ const static timelib_tz_lookup_table* abbr_search(const char *word, long gmtoffs return NULL; } -static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found) +static timelib_long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found) { char *word; char *begin = *ptr, *end; - long value = 0; + timelib_long value = 0; const timelib_tz_lookup_table *tp; while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') { @@ -735,10 +741,10 @@ static long timelib_lookup_abbr(char **ptr, int *dst, char **tz_abbr, int *found return value; } -long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper) +timelib_long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_wrapper) { timelib_tzinfo *res; - long retval = 0; + timelib_long retval = 0; *tz_not_found = 0; @@ -766,7 +772,7 @@ long timelib_parse_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_found retval = timelib_parse_tz_cor(ptr); } else { int found = 0; - long offset = 0; + timelib_long offset = 0; char *tz_abbr; t->is_localtime = 1; @@ -810,15 +816,15 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper) { uchar *cursor = s->cur; char *str, *ptr = NULL; - + std: s->tok = cursor; s->len = 0; -#line 940 "ext/date/lib/parse_date.re" +#line 946 "ext/date/lib/parse_date.re" -#line 822 "ext/date/lib/parse_date.c" +#line 828 "ext/date/lib/parse_date.c" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -958,7 +964,7 @@ yy2: } yy3: YYDEBUG(3, *YYCURSOR); -#line 1620 "ext/date/lib/parse_date.re" +#line 1626 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("tzcorrection | tz"); @@ -971,7 +977,7 @@ yy3: TIMELIB_DEINIT; return TIMELIB_TIMEZONE; } -#line 975 "ext/date/lib/parse_date.c" +#line 981 "ext/date/lib/parse_date.c" yy4: YYDEBUG(4, *YYCURSOR); yych = *++YYCURSOR; @@ -1282,12 +1288,12 @@ yy11: if (yych <= '9') goto yy1385; yy12: YYDEBUG(12, *YYCURSOR); -#line 1715 "ext/date/lib/parse_date.re" +#line 1721 "ext/date/lib/parse_date.re" { add_error(s, "Unexpected character"); goto std; } -#line 1291 "ext/date/lib/parse_date.c" +#line 1297 "ext/date/lib/parse_date.c" yy13: YYDEBUG(13, *YYCURSOR); yych = *++YYCURSOR; @@ -2344,11 +2350,11 @@ yy48: if (yych <= '9') goto yy54; yy49: YYDEBUG(49, *YYCURSOR); -#line 1704 "ext/date/lib/parse_date.re" +#line 1710 "ext/date/lib/parse_date.re" { goto std; } -#line 2352 "ext/date/lib/parse_date.c" +#line 2358 "ext/date/lib/parse_date.c" yy50: YYDEBUG(50, *YYCURSOR); yych = *++YYCURSOR; @@ -2357,12 +2363,12 @@ yy51: YYDEBUG(51, *YYCURSOR); ++YYCURSOR; YYDEBUG(52, *YYCURSOR); -#line 1709 "ext/date/lib/parse_date.re" +#line 1715 "ext/date/lib/parse_date.re" { s->pos = cursor; s->line++; goto std; } -#line 2366 "ext/date/lib/parse_date.c" +#line 2372 "ext/date/lib/parse_date.c" yy53: YYDEBUG(53, *YYCURSOR); yych = *++YYCURSOR; @@ -2749,7 +2755,7 @@ yy71: if (yych == 's') goto yy73; yy72: YYDEBUG(72, *YYCURSOR); -#line 1688 "ext/date/lib/parse_date.re" +#line 1694 "ext/date/lib/parse_date.re" { timelib_ull i; DEBUG_OUTPUT("relative"); @@ -2764,7 +2770,7 @@ yy72: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 2768 "ext/date/lib/parse_date.c" +#line 2774 "ext/date/lib/parse_date.c" yy73: YYDEBUG(73, *YYCURSOR); yych = *++YYCURSOR; @@ -3526,7 +3532,7 @@ yy165: } yy166: YYDEBUG(166, *YYCURSOR); -#line 1551 "ext/date/lib/parse_date.re" +#line 1557 "ext/date/lib/parse_date.re" { const timelib_relunit* relunit; DEBUG_OUTPUT("daytext"); @@ -3539,11 +3545,11 @@ yy166: if (s->time->relative.weekday_behavior != 2) { s->time->relative.weekday_behavior = 1; } - + TIMELIB_DEINIT; return TIMELIB_WEEKDAY; } -#line 3547 "ext/date/lib/parse_date.c" +#line 3553 "ext/date/lib/parse_date.c" yy167: YYDEBUG(167, *YYCURSOR); yych = *++YYCURSOR; @@ -4063,7 +4069,7 @@ yy192: } yy193: YYDEBUG(193, *YYCURSOR); -#line 1610 "ext/date/lib/parse_date.re" +#line 1616 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("monthtext"); TIMELIB_INIT; @@ -4072,7 +4078,7 @@ yy193: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4076 "ext/date/lib/parse_date.c" +#line 4082 "ext/date/lib/parse_date.c" yy194: YYDEBUG(194, *YYCURSOR); ++YYCURSOR; @@ -4123,7 +4129,7 @@ yy197: } yy198: YYDEBUG(198, *YYCURSOR); -#line 1356 "ext/date/lib/parse_date.re" +#line 1362 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datetextual | datenoyear"); @@ -4136,7 +4142,7 @@ yy198: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 4140 "ext/date/lib/parse_date.c" +#line 4146 "ext/date/lib/parse_date.c" yy199: YYDEBUG(199, *YYCURSOR); yyaccept = 6; @@ -4405,7 +4411,7 @@ yy221: } yy222: YYDEBUG(222, *YYCURSOR); -#line 1658 "ext/date/lib/parse_date.re" +#line 1664 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz"); @@ -4434,7 +4440,7 @@ yy222: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 4438 "ext/date/lib/parse_date.c" +#line 4444 "ext/date/lib/parse_date.c" yy223: YYDEBUG(223, *YYCURSOR); yyaccept = 7; @@ -5132,7 +5138,7 @@ yy277: YYDEBUG(277, *YYCURSOR); ++YYCURSOR; YYDEBUG(278, *YYCURSOR); -#line 1634 "ext/date/lib/parse_date.re" +#line 1640 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12"); TIMELIB_INIT; @@ -5155,7 +5161,7 @@ yy277: TIMELIB_DEINIT; return TIMELIB_SHORTDATE_WITH_TIME; } -#line 5159 "ext/date/lib/parse_date.c" +#line 5165 "ext/date/lib/parse_date.c" yy279: YYDEBUG(279, *YYCURSOR); yych = *++YYCURSOR; @@ -5333,7 +5339,7 @@ yy293: ++YYCURSOR; yy294: YYDEBUG(294, *YYCURSOR); -#line 1328 "ext/date/lib/parse_date.re" +#line 1334 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenoday"); @@ -5346,7 +5352,7 @@ yy294: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 5350 "ext/date/lib/parse_date.c" +#line 5356 "ext/date/lib/parse_date.c" yy295: YYDEBUG(295, *YYCURSOR); yych = *++YYCURSOR; @@ -6566,7 +6572,7 @@ yy361: if (yych <= '9') goto yy364; yy363: YYDEBUG(363, *YYCURSOR); -#line 1472 "ext/date/lib/parse_date.re" +#line 1478 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextshort"); @@ -6579,7 +6585,7 @@ yy363: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 6583 "ext/date/lib/parse_date.c" +#line 6589 "ext/date/lib/parse_date.c" yy364: YYDEBUG(364, *YYCURSOR); yych = *++YYCURSOR; @@ -7217,7 +7223,7 @@ yy391: } yy392: YYDEBUG(392, *YYCURSOR); -#line 1530 "ext/date/lib/parse_date.re" +#line 1536 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("ago"); TIMELIB_INIT; @@ -7237,7 +7243,7 @@ yy392: TIMELIB_DEINIT; return TIMELIB_AGO; } -#line 7241 "ext/date/lib/parse_date.c" +#line 7247 "ext/date/lib/parse_date.c" yy393: YYDEBUG(393, *YYCURSOR); yyaccept = 5; @@ -8987,7 +8993,7 @@ yy453: ++YYCURSOR; yy454: YYDEBUG(454, *YYCURSOR); -#line 1233 "ext/date/lib/parse_date.re" +#line 1239 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash"); TIMELIB_INIT; @@ -8998,7 +9004,7 @@ yy454: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 9002 "ext/date/lib/parse_date.c" +#line 9008 "ext/date/lib/parse_date.c" yy455: YYDEBUG(455, *YYCURSOR); yyaccept = 0; @@ -9558,7 +9564,7 @@ yy474: } yy475: YYDEBUG(475, *YYCURSOR); -#line 1370 "ext/date/lib/parse_date.re" +#line 1376 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenoyearrev"); TIMELIB_INIT; @@ -9569,7 +9575,7 @@ yy475: TIMELIB_DEINIT; return TIMELIB_DATE_TEXT; } -#line 9573 "ext/date/lib/parse_date.c" +#line 9579 "ext/date/lib/parse_date.c" yy476: YYDEBUG(476, *YYCURSOR); yyaccept = 10; @@ -9710,7 +9716,7 @@ yy487: YYDEBUG(487, *YYCURSOR); ++YYCURSOR; YYDEBUG(488, *YYCURSOR); -#line 1088 "ext/date/lib/parse_date.re" +#line 1094 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12"); TIMELIB_INIT; @@ -9726,7 +9732,7 @@ yy487: TIMELIB_DEINIT; return TIMELIB_TIME12; } -#line 9730 "ext/date/lib/parse_date.c" +#line 9736 "ext/date/lib/parse_date.c" yy489: YYDEBUG(489, *YYCURSOR); yyaccept = 11; @@ -9739,7 +9745,7 @@ yy489: } yy490: YYDEBUG(490, *YYCURSOR); -#line 1125 "ext/date/lib/parse_date.re" +#line 1131 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long"); @@ -9764,7 +9770,7 @@ yy490: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 9768 "ext/date/lib/parse_date.c" +#line 9774 "ext/date/lib/parse_date.c" yy491: YYDEBUG(491, *YYCURSOR); yyaccept = 11; @@ -10074,7 +10080,7 @@ yy522: YYDEBUG(522, *YYCURSOR); ++YYCURSOR; YYDEBUG(523, *YYCURSOR); -#line 1105 "ext/date/lib/parse_date.re" +#line 1111 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("mssqltime"); TIMELIB_INIT; @@ -10093,7 +10099,7 @@ yy522: TIMELIB_DEINIT; return TIMELIB_TIME24_WITH_ZONE; } -#line 10097 "ext/date/lib/parse_date.c" +#line 10103 "ext/date/lib/parse_date.c" yy524: YYDEBUG(524, *YYCURSOR); yyaccept = 11; @@ -10199,7 +10205,7 @@ yy533: if (yych <= '9') goto yy540; yy534: YYDEBUG(534, *YYCURSOR); -#line 1287 "ext/date/lib/parse_date.re" +#line 1293 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datefull"); @@ -10213,7 +10219,7 @@ yy534: TIMELIB_DEINIT; return TIMELIB_DATE_FULL; } -#line 10217 "ext/date/lib/parse_date.c" +#line 10223 "ext/date/lib/parse_date.c" yy535: YYDEBUG(535, *YYCURSOR); yych = *++YYCURSOR; @@ -10950,7 +10956,7 @@ yy604: YYDEBUG(605, *YYCURSOR); ++YYCURSOR; YYDEBUG(606, *YYCURSOR); -#line 1302 "ext/date/lib/parse_date.re" +#line 1308 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("pointed date YYYY"); TIMELIB_INIT; @@ -10961,7 +10967,7 @@ yy604: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 10965 "ext/date/lib/parse_date.c" +#line 10971 "ext/date/lib/parse_date.c" yy607: YYDEBUG(607, *YYCURSOR); yyaccept = 11; @@ -10997,7 +11003,7 @@ yy610: if (yych <= '9') goto yy604; yy611: YYDEBUG(611, *YYCURSOR); -#line 1314 "ext/date/lib/parse_date.re" +#line 1320 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pointed date YY"); @@ -11010,7 +11016,7 @@ yy611: TIMELIB_DEINIT; return TIMELIB_DATE_FULL_POINTED; } -#line 11014 "ext/date/lib/parse_date.c" +#line 11020 "ext/date/lib/parse_date.c" yy612: YYDEBUG(612, *YYCURSOR); yyaccept = 11; @@ -11651,7 +11657,7 @@ yy655: } yy656: YYDEBUG(656, *YYCURSOR); -#line 1273 "ext/date/lib/parse_date.re" +#line 1279 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshort"); @@ -11664,7 +11670,7 @@ yy656: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 11668 "ext/date/lib/parse_date.c" +#line 11674 "ext/date/lib/parse_date.c" yy657: YYDEBUG(657, *YYCURSOR); yyaccept = 13; @@ -11770,7 +11776,7 @@ yy665: } yy666: YYDEBUG(666, *YYCURSOR); -#line 1217 "ext/date/lib/parse_date.re" +#line 1223 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("americanshort | american"); @@ -11785,7 +11791,7 @@ yy666: TIMELIB_DEINIT; return TIMELIB_AMERICAN; } -#line 11789 "ext/date/lib/parse_date.c" +#line 11795 "ext/date/lib/parse_date.c" yy667: YYDEBUG(667, *YYCURSOR); yyaccept = 14; @@ -12018,7 +12024,7 @@ yy699: if (yych <= ':') goto yy703; yy700: YYDEBUG(700, *YYCURSOR); -#line 1500 "ext/date/lib/parse_date.re" +#line 1506 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("clf"); @@ -12038,7 +12044,7 @@ yy700: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12042 "ext/date/lib/parse_date.c" +#line 12048 "ext/date/lib/parse_date.c" yy701: YYDEBUG(701, *YYCURSOR); yych = *++YYCURSOR; @@ -12590,7 +12596,7 @@ yy762: } yy763: YYDEBUG(763, *YYCURSOR); -#line 1245 "ext/date/lib/parse_date.re" +#line 1251 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("iso8601date2"); @@ -12603,7 +12609,7 @@ yy763: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 12607 "ext/date/lib/parse_date.c" +#line 12613 "ext/date/lib/parse_date.c" yy764: YYDEBUG(764, *YYCURSOR); yych = *++YYCURSOR; @@ -12642,7 +12648,7 @@ yy770: YYDEBUG(770, *YYCURSOR); ++YYCURSOR; YYDEBUG(771, *YYCURSOR); -#line 1486 "ext/date/lib/parse_date.re" +#line 1492 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgtextreverse"); @@ -12655,7 +12661,7 @@ yy770: TIMELIB_DEINIT; return TIMELIB_PG_TEXT; } -#line 12659 "ext/date/lib/parse_date.c" +#line 12665 "ext/date/lib/parse_date.c" yy772: YYDEBUG(772, *YYCURSOR); yych = *++YYCURSOR; @@ -12793,7 +12799,7 @@ yy782: } yy783: YYDEBUG(783, *YYCURSOR); -#line 1521 "ext/date/lib/parse_date.re" +#line 1527 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("year4"); TIMELIB_INIT; @@ -12801,7 +12807,7 @@ yy783: TIMELIB_DEINIT; return TIMELIB_CLF; } -#line 12805 "ext/date/lib/parse_date.c" +#line 12811 "ext/date/lib/parse_date.c" yy784: YYDEBUG(784, *YYCURSOR); yych = *++YYCURSOR; @@ -12952,7 +12958,7 @@ yy792: } yy793: YYDEBUG(793, *YYCURSOR); -#line 1342 "ext/date/lib/parse_date.re" +#line 1348 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("datenodayrev"); @@ -12965,7 +12971,7 @@ yy793: TIMELIB_DEINIT; return TIMELIB_DATE_NO_DAY; } -#line 12969 "ext/date/lib/parse_date.c" +#line 12975 "ext/date/lib/parse_date.c" yy794: YYDEBUG(794, *YYCURSOR); yych = *++YYCURSOR; @@ -13180,14 +13186,14 @@ yy813: if (yych <= '7') goto yy816; yy814: YYDEBUG(814, *YYCURSOR); -#line 1453 "ext/date/lib/parse_date.re" +#line 1459 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweek"); TIMELIB_INIT; TIMELIB_HAVE_DATE(); TIMELIB_HAVE_RELATIVE(); - + s->time->y = timelib_get_nr((char **) &ptr, 4); w = timelib_get_nr((char **) &ptr, 2); d = 1; @@ -13198,7 +13204,7 @@ yy814: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13202 "ext/date/lib/parse_date.c" +#line 13208 "ext/date/lib/parse_date.c" yy815: YYDEBUG(815, *YYCURSOR); yych = *++YYCURSOR; @@ -13208,14 +13214,14 @@ yy816: YYDEBUG(816, *YYCURSOR); ++YYCURSOR; YYDEBUG(817, *YYCURSOR); -#line 1434 "ext/date/lib/parse_date.re" +#line 1440 "ext/date/lib/parse_date.re" { timelib_sll w, d; DEBUG_OUTPUT("isoweekday"); TIMELIB_INIT; TIMELIB_HAVE_DATE(); TIMELIB_HAVE_RELATIVE(); - + s->time->y = timelib_get_nr((char **) &ptr, 4); w = timelib_get_nr((char **) &ptr, 2); d = timelib_get_nr((char **) &ptr, 1); @@ -13226,7 +13232,7 @@ yy816: TIMELIB_DEINIT; return TIMELIB_ISO_WEEK; } -#line 13230 "ext/date/lib/parse_date.c" +#line 13236 "ext/date/lib/parse_date.c" yy818: YYDEBUG(818, *YYCURSOR); yych = *++YYCURSOR; @@ -13290,7 +13296,7 @@ yy820: } yy821: YYDEBUG(821, *YYCURSOR); -#line 1420 "ext/date/lib/parse_date.re" +#line 1426 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("pgydotd"); @@ -13303,7 +13309,7 @@ yy821: TIMELIB_DEINIT; return TIMELIB_PG_YEARDAY; } -#line 13307 "ext/date/lib/parse_date.c" +#line 13313 "ext/date/lib/parse_date.c" yy822: YYDEBUG(822, *YYCURSOR); yych = *++YYCURSOR; @@ -13406,7 +13412,7 @@ yy841: ++YYCURSOR; yy842: YYDEBUG(842, *YYCURSOR); -#line 1394 "ext/date/lib/parse_date.re" +#line 1400 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif"); @@ -13431,7 +13437,7 @@ yy842: TIMELIB_DEINIT; return TIMELIB_XMLRPC_SOAP; } -#line 13435 "ext/date/lib/parse_date.c" +#line 13441 "ext/date/lib/parse_date.c" yy843: YYDEBUG(843, *YYCURSOR); yych = *++YYCURSOR; @@ -13693,7 +13699,7 @@ yy847: } yy848: YYDEBUG(848, *YYCURSOR); -#line 1382 "ext/date/lib/parse_date.re" +#line 1388 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("datenocolon"); TIMELIB_INIT; @@ -13704,7 +13710,7 @@ yy848: TIMELIB_DEINIT; return TIMELIB_DATE_NOCOLON; } -#line 13708 "ext/date/lib/parse_date.c" +#line 13714 "ext/date/lib/parse_date.c" yy849: YYDEBUG(849, *YYCURSOR); yych = *++YYCURSOR; @@ -14624,7 +14630,7 @@ yy972: if (yych <= '9') goto yy995; yy973: YYDEBUG(973, *YYCURSOR); -#line 1259 "ext/date/lib/parse_date.re" +#line 1265 "ext/date/lib/parse_date.re" { int length = 0; DEBUG_OUTPUT("gnudateshorter"); @@ -14637,7 +14643,7 @@ yy973: TIMELIB_DEINIT; return TIMELIB_ISO_DATE; } -#line 14641 "ext/date/lib/parse_date.c" +#line 14647 "ext/date/lib/parse_date.c" yy974: YYDEBUG(974, *YYCURSOR); yyaccept = 22; @@ -15646,7 +15652,7 @@ yy1065: } yy1067: YYDEBUG(1067, *YYCURSOR); -#line 1151 "ext/date/lib/parse_date.re" +#line 1157 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("gnunocolon"); TIMELIB_INIT; @@ -15668,7 +15674,7 @@ yy1067: TIMELIB_DEINIT; return TIMELIB_GNU_NOCOLON; } -#line 15672 "ext/date/lib/parse_date.c" +#line 15678 "ext/date/lib/parse_date.c" yy1068: YYDEBUG(1068, *YYCURSOR); yych = *++YYCURSOR; @@ -15760,7 +15766,7 @@ yy1074: } yy1075: YYDEBUG(1075, *YYCURSOR); -#line 1197 "ext/date/lib/parse_date.re" +#line 1203 "ext/date/lib/parse_date.re" { int tz_not_found; DEBUG_OUTPUT("iso8601nocolon"); @@ -15779,7 +15785,7 @@ yy1075: TIMELIB_DEINIT; return TIMELIB_ISO_NOCOLON; } -#line 15783 "ext/date/lib/parse_date.c" +#line 15789 "ext/date/lib/parse_date.c" yy1076: YYDEBUG(1076, *YYCURSOR); yyaccept = 25; @@ -16677,7 +16683,7 @@ yy1116: } yy1117: YYDEBUG(1117, *YYCURSOR); -#line 1593 "ext/date/lib/parse_date.re" +#line 1599 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16693,7 +16699,7 @@ yy1117: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16697 "ext/date/lib/parse_date.c" +#line 16703 "ext/date/lib/parse_date.c" yy1118: YYDEBUG(1118, *YYCURSOR); ++YYCURSOR; @@ -16744,7 +16750,7 @@ yy1125: YYDEBUG(1125, *YYCURSOR); ++YYCURSOR; YYDEBUG(1126, *YYCURSOR); -#line 1066 "ext/date/lib/parse_date.re" +#line 1072 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16765,7 +16771,7 @@ yy1125: TIMELIB_DEINIT; return TIMELIB_WEEK_DAY_OF_MONTH; } -#line 16769 "ext/date/lib/parse_date.c" +#line 16775 "ext/date/lib/parse_date.c" yy1127: YYDEBUG(1127, *YYCURSOR); yyaccept = 26; @@ -16873,7 +16879,7 @@ yy1140: } yy1141: YYDEBUG(1141, *YYCURSOR); -#line 1569 "ext/date/lib/parse_date.re" +#line 1575 "ext/date/lib/parse_date.re" { timelib_sll i; int behavior = 0; @@ -16896,7 +16902,7 @@ yy1141: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 16900 "ext/date/lib/parse_date.c" +#line 16906 "ext/date/lib/parse_date.c" yy1142: YYDEBUG(1142, *YYCURSOR); yych = *++YYCURSOR; @@ -19573,7 +19579,7 @@ yy1293: goto yy1297; yy1294: YYDEBUG(1294, *YYCURSOR); -#line 1043 "ext/date/lib/parse_date.re" +#line 1049 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("backof | frontof"); TIMELIB_INIT; @@ -19595,7 +19601,7 @@ yy1294: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 19599 "ext/date/lib/parse_date.c" +#line 19605 "ext/date/lib/parse_date.c" yy1295: YYDEBUG(1295, *YYCURSOR); yyaccept = 28; @@ -19856,7 +19862,7 @@ yy1315: YYDEBUG(1315, *YYCURSOR); ++YYCURSOR; YYDEBUG(1316, *YYCURSOR); -#line 1026 "ext/date/lib/parse_date.re" +#line 1032 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("firstdayof | lastdayof"); TIMELIB_INIT; @@ -19872,7 +19878,7 @@ yy1315: TIMELIB_DEINIT; return TIMELIB_LF_DAY_OF_MONTH; } -#line 19876 "ext/date/lib/parse_date.c" +#line 19882 "ext/date/lib/parse_date.c" yy1317: YYDEBUG(1317, *YYCURSOR); yyaccept = 0; @@ -21303,7 +21309,7 @@ yy1385: if (yych <= '9') goto yy1385; yy1387: YYDEBUG(1387, *YYCURSOR); -#line 1000 "ext/date/lib/parse_date.re" +#line 1006 "ext/date/lib/parse_date.re" { timelib_ull i; @@ -21328,7 +21334,7 @@ yy1387: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21332 "ext/date/lib/parse_date.c" +#line 21338 "ext/date/lib/parse_date.c" yy1388: YYDEBUG(1388, *YYCURSOR); yych = *++YYCURSOR; @@ -21764,7 +21770,7 @@ yy1416: ++YYCURSOR; yy1417: YYDEBUG(1417, *YYCURSOR); -#line 988 "ext/date/lib/parse_date.re" +#line 994 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("tomorrow"); TIMELIB_INIT; @@ -21775,7 +21781,7 @@ yy1417: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21779 "ext/date/lib/parse_date.c" +#line 21785 "ext/date/lib/parse_date.c" yy1418: YYDEBUG(1418, *YYCURSOR); yych = *++YYCURSOR; @@ -21810,7 +21816,7 @@ yy1419: } yy1420: YYDEBUG(1420, *YYCURSOR); -#line 978 "ext/date/lib/parse_date.re" +#line 984 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("midnight | today"); TIMELIB_INIT; @@ -21819,7 +21825,7 @@ yy1420: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 21823 "ext/date/lib/parse_date.c" +#line 21829 "ext/date/lib/parse_date.c" yy1421: YYDEBUG(1421, *YYCURSOR); yych = *++YYCURSOR; @@ -23831,7 +23837,7 @@ yy1499: } yy1500: YYDEBUG(1500, *YYCURSOR); -#line 957 "ext/date/lib/parse_date.re" +#line 963 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("now"); TIMELIB_INIT; @@ -23839,7 +23845,7 @@ yy1500: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 23843 "ext/date/lib/parse_date.c" +#line 23849 "ext/date/lib/parse_date.c" yy1501: YYDEBUG(1501, *YYCURSOR); yych = *++YYCURSOR; @@ -23978,7 +23984,7 @@ yy1507: } yy1508: YYDEBUG(1508, *YYCURSOR); -#line 966 "ext/date/lib/parse_date.re" +#line 972 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("noon"); TIMELIB_INIT; @@ -23989,7 +23995,7 @@ yy1508: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 23993 "ext/date/lib/parse_date.c" +#line 23999 "ext/date/lib/parse_date.c" yy1509: YYDEBUG(1509, *YYCURSOR); yyaccept = 0; @@ -24522,7 +24528,7 @@ yy1530: ++YYCURSOR; yy1531: YYDEBUG(1531, *YYCURSOR); -#line 945 "ext/date/lib/parse_date.re" +#line 951 "ext/date/lib/parse_date.re" { DEBUG_OUTPUT("yesterday"); TIMELIB_INIT; @@ -24533,7 +24539,7 @@ yy1531: TIMELIB_DEINIT; return TIMELIB_RELATIVE; } -#line 24537 "ext/date/lib/parse_date.c" +#line 24543 "ext/date/lib/parse_date.c" yy1532: YYDEBUG(1532, *YYCURSOR); yyaccept = 0; @@ -24706,13 +24712,13 @@ yy1537: goto yy1531; } } -#line 1719 "ext/date/lib/parse_date.re" +#line 1725 "ext/date/lib/parse_date.re" } #define YYMAXFILL 31 -timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper) +timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper) { Scanner in; int t; @@ -24823,7 +24829,7 @@ static void timelib_time_reset_unset_fields(timelib_time *time) if (time->f == TIMELIB_UNSET ) time->f = 0.0; } -timelib_time *timelib_parse_from_format(char *format, char *string, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper) +timelib_time *timelib_parse_from_format(char *format, char *string, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper) { char *fptr = format; char *ptr = string; @@ -24868,7 +24874,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim add_pbf_error(s, "A textual day could not be found", string, begin); break; } else { - in.time->have_relative = 1; + in.time->have_relative = 1; in.time->relative.have_weekday_relative = 1; in.time->relative.weekday = tmprel->multiplier; in.time->relative.weekday_behavior = 1; @@ -25139,13 +25145,13 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim /* do funky checking whether the parsed time was valid time */ if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET && - s->time->s != TIMELIB_UNSET && + s->time->s != TIMELIB_UNSET && !timelib_valid_time( s->time->h, s->time->i, s->time->s)) { add_pbf_warning(s, "The parsed time was invalid", string, ptr); } /* do funky checking whether the parsed date was valid date */ if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET && - s->time->d != TIMELIB_UNSET && + s->time->d != TIMELIB_UNSET && !timelib_valid_date( s->time->y, s->time->m, s->time->d)) { add_pbf_warning(s, "The parsed date was invalid", string, ptr); } @@ -25193,7 +25199,7 @@ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options) */ } -char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst) +char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst) { const timelib_tz_lookup_table *tp; @@ -25218,7 +25224,7 @@ int main(void) printf ("%04d-%02d-%02d %02d:%02d:%02d.%-5d %+04d %1d", time.y, time.m, time.d, time.h, time.i, time.s, time.f, time.z, time.dst); if (time.have_relative) { - printf ("%3dY %3dM %3dD / %3dH %3dM %3dS", + printf ("%3dY %3dM %3dD / %3dH %3dM %3dS", time.relative.y, time.relative.m, time.relative.d, time.relative.h, time.relative.i, time.relative.s); } if (time.have_weekday_relative) { @@ -25227,7 +25233,7 @@ int main(void) if (time.have_weeknr_day) { printf(" / %dW%d", time.relative.weeknr_day.weeknr, time.relative.weeknr_day.dayofweek); } - return 0; + return 0; } #endif |