Lines Matching refs:ptr

87 #define   YYMARKER     s->ptr
103 #define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
134 uchar *lim, *str, *ptr, *cur, *tok, *pos;
293 char *ptr = s;
294 while (ptr[0] == ' ' || ptr[0] == '\t') {
295 ptr++;
297 return ptr;
308 s->ptr -= cnt;
317 s->ptr = &buf[s->ptr - s->bot];
374 static timelib_sll timelib_meridian(const char **ptr, timelib_sll h)
378 while (!strchr("AaPp", **ptr)) {
379 ++*ptr;
381 if (**ptr == 'a' || **ptr == 'A') {
388 ++*ptr;
389 if (**ptr == '.') {
390 ++*ptr;
392 if (**ptr == 'M' || **ptr == 'm') {
393 ++*ptr;
395 if (**ptr == '.') {
396 ++*ptr;
401 static timelib_sll timelib_meridian_with_check(const char **ptr, timelib_sll h)
405 while (**ptr && !strchr("AaPp", **ptr)) {
406 ++*ptr;
408 if(!**ptr) {
411 if (**ptr == 'a' || **ptr == 'A') {
418 ++*ptr;
419 if (**ptr == '.') {
420 ++*ptr;
421 if (**ptr != 'm' && **ptr != 'M') {
424 ++*ptr;
425 if (**ptr != '.' ) {
428 ++*ptr;
429 } else if (**ptr == 'm' || **ptr == 'M') {
430 ++*ptr;
445 static timelib_sll timelib_get_nr_ex(const char **ptr, int max_length, int *scanned_length)
452 while ((**ptr < '0') || (**ptr > '9')) {
453 if (**ptr == '\0') {
456 ++*ptr;
458 begin = *ptr;
459 while ((**ptr >= '0') && (**ptr <= '9') && len < max_length) {
460 ++*ptr;
463 end = *ptr;
474 static timelib_sll timelib_get_nr(const char **ptr, int max_length)
476 return timelib_get_nr_ex(ptr, max_length, NULL);
479 static void timelib_skip_day_suffix(const char **ptr)
481 if (isspace(**ptr)) {
484 …lib_strncasecmp(*ptr, "nd", 2) || !timelib_strncasecmp(*ptr, "rd", 2) ||!timelib_strncasecmp(*ptr,…
485 *ptr += 2;
489 static timelib_sll timelib_get_frac_nr(const char **ptr)
496 while ((**ptr != '.') && (**ptr != ':') && ((**ptr < '0') || (**ptr > '9'))) {
497 if (**ptr == '\0') {
500 ++*ptr;
502 begin = *ptr;
503 while ((**ptr == '.') || (**ptr == ':') || ((**ptr >= '0') && (**ptr <= '9'))) {
504 ++*ptr;
507 end = *ptr;
515 static timelib_ull timelib_get_signed_nr(Scanner *s, const char **ptr, int max_length)
519 while (((**ptr < '0') || (**ptr > '9')) && (**ptr != '+') && (**ptr != '-')) {
520 if (**ptr == '\0') {
524 ++*ptr;
527 while (**ptr == '+' || **ptr == '-')
529 if (**ptr == '-') {
532 ++*ptr;
534 return dir * timelib_get_nr(ptr, max_length);
537 static timelib_sll timelib_lookup_relative_text(const char **ptr, int *behavior)
540 const char *begin = *ptr, *end;
544 while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
545 ++*ptr;
547 end = *ptr;
562 static timelib_sll timelib_get_relative_text(const char **ptr, int *behavior)
564 while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '/') {
565 ++*ptr;
567 return timelib_lookup_relative_text(ptr, behavior);
570 static timelib_long timelib_lookup_month(const char **ptr)
573 const char *begin = *ptr, *end;
577 while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
578 ++*ptr;
580 end = *ptr;
594 static timelib_long timelib_get_month(const char **ptr)
596 while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
597 ++*ptr;
599 return timelib_lookup_month(ptr);
602 static void timelib_eat_spaces(const char **ptr)
604 while (**ptr == ' ' || **ptr == '\t') {
605 ++*ptr;
609 static void timelib_eat_until_separator(const char **ptr)
611 ++*ptr;
612 while (strchr(" \t.,:;/-0123456789", **ptr) == NULL) {
613 ++*ptr;
617 static const timelib_relunit* timelib_lookup_relunit(const char **ptr)
620 const char *begin = *ptr, *end;
623 …while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != …
624 **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
625 ++*ptr;
627 end = *ptr;
648 static void timelib_set_relative(const char **ptr, timelib_sll amount, int behavior, Scanner *s, in…
652 if (!(relunit = timelib_lookup_relunit(ptr))) {
723 static timelib_long timelib_lookup_abbr(const char **ptr, int *dst, char **tz_abbr, int *found)
726 const char *begin = *ptr, *end;
730 while (**ptr != '\0' && **ptr != ')' && **ptr != ' ') {
731 ++*ptr;
733 end = *ptr;
753 static timelib_long timelib_parse_tz_cor(const char **ptr, int *tz_not_found)
755 const char *begin = *ptr, *end;
760 while (isdigit(**ptr) || **ptr == ':') {
761 ++*ptr;
763 end = *ptr;
798 static timelib_long timelib_parse_tz_minutes(const char **ptr, timelib_time *t)
801 const char *begin = *ptr;
804 if (**ptr != '+' && **ptr != '-') {
808 ++*ptr;
809 while (isdigit(**ptr)) {
810 ++*ptr;
829 timelib_long timelib_parse_zone(const char **ptr, int *dst, timelib_time *t, int *tz_not_found, con…
836 while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
837 ++*ptr;
839 …if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' && ((*ptr)[3] == '+' || (*ptr)[3] == …
840 *ptr += 3;
842 if (**ptr == '+') {
843 ++*ptr;
848 retval = timelib_parse_tz_cor(ptr, tz_not_found);
849 } else if (**ptr == '-') {
850 ++*ptr;
855 retval = -1 * timelib_parse_tz_cor(ptr, tz_not_found);
864 offset = timelib_lookup_abbr(ptr, dst, &tz_abbr, &found);
884 while (**ptr == ')') {
885 ++*ptr;
904 const char *ptr = NULL;
1106 i = timelib_get_signed_nr(s, &ptr, 24);
1133 i = timelib_get_signed_nr(s, &ptr, 24);
1135 ptr_before = ptr;
1136 us = timelib_get_signed_nr(s, &ptr, 6);
1137 us = us * pow(10, 7 - (ptr - ptr_before));
1162 if (*ptr == 'l' || *ptr == 'L') {
1179 if (*ptr == 'b') {
1180 s->time->h = timelib_get_nr(&ptr, 2);
1183 s->time->h = timelib_get_nr(&ptr, 2) - 1;
1186 if (*ptr != '\0' ) {
1187 timelib_eat_spaces(&ptr);
1188 s->time->h += timelib_meridian(&ptr, s->time->h);
1204 i = timelib_get_relative_text(&ptr, &behavior);
1205 timelib_eat_spaces(&ptr);
1208 timelib_set_relative(&ptr, i, 1, s, TIMELIB_TIME_PART_DONT_KEEP);
1211 timelib_set_relative(&ptr, i, behavior, s, TIMELIB_TIME_PART_DONT_KEEP);
1222 s->time->h = timelib_get_nr(&ptr, 2);
1223 if (*ptr == ':' || *ptr == '.') {
1224 s->time->i = timelib_get_nr(&ptr, 2);
1225 if (*ptr == ':' || *ptr == '.') {
1226 s->time->s = timelib_get_nr(&ptr, 2);
1229 s->time->h += timelib_meridian(&ptr, s->time->h);
1239 s->time->h = timelib_get_nr(&ptr, 2);
1240 s->time->i = timelib_get_nr(&ptr, 2);
1241 if (*ptr == ':' || *ptr == '.') {
1242 s->time->s = timelib_get_nr(&ptr, 2);
1244 if (*ptr == ':' || *ptr == '.') {
1245 s->time->us = timelib_get_frac_nr(&ptr);
1248 timelib_eat_spaces(&ptr);
1249 s->time->h += timelib_meridian(&ptr, s->time->h);
1260 s->time->h = timelib_get_nr(&ptr, 2);
1261 s->time->i = timelib_get_nr(&ptr, 2);
1262 if (*ptr == ':' || *ptr == '.') {
1263 s->time->s = timelib_get_nr(&ptr, 2);
1265 if (*ptr == '.') {
1266 s->time->us = timelib_get_frac_nr(&ptr);
1270 if (*ptr != '\0') {
1271 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1286 s->time->h = timelib_get_nr(&ptr, 2);
1287 s->time->i = timelib_get_nr(&ptr, 2);
1291 s->time->y = timelib_get_nr(&ptr, 4);
1309 s->time->h = timelib_get_nr(&ptr, 2);
1310 s->time->i = timelib_get_nr(&ptr, 2);
1312 s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
1315 s->time->y = timelib_get_nr(&ptr, 4);
1332 s->time->h = timelib_get_nr(&ptr, 2);
1333 s->time->i = timelib_get_nr(&ptr, 2);
1334 s->time->s = timelib_get_nr(&ptr, 2);
1336 if (*ptr != '\0') {
1337 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1352 s->time->m = timelib_get_nr(&ptr, 2);
1353 s->time->d = timelib_get_nr(&ptr, 2);
1354 if (*ptr == '/') {
1355 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1367 s->time->y = timelib_get_signed_nr(s, &ptr, 4);
1368 s->time->m = timelib_get_nr(&ptr, 2);
1369 s->time->d = timelib_get_nr(&ptr, 2);
1380 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1381 s->time->m = timelib_get_nr(&ptr, 2);
1382 s->time->d = timelib_get_nr(&ptr, 2);
1393 s->time->y = timelib_get_signed_nr(s, &ptr, 19);
1394 s->time->m = timelib_get_nr(&ptr, 2);
1395 s->time->d = timelib_get_nr(&ptr, 2);
1406 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1407 s->time->m = timelib_get_nr(&ptr, 2);
1420 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1421 s->time->m = timelib_get_nr(&ptr, 2);
1422 s->time->d = timelib_get_nr(&ptr, 2);
1434 s->time->d = timelib_get_nr(&ptr, 2);
1435 timelib_skip_day_suffix(&ptr);
1436 s->time->m = timelib_get_month(&ptr);
1437 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1448 s->time->d = timelib_get_nr(&ptr, 2);
1449 s->time->m = timelib_get_nr(&ptr, 2);
1450 s->time->y = timelib_get_nr(&ptr, 4);
1461 s->time->d = timelib_get_nr(&ptr, 2);
1462 s->time->m = timelib_get_nr(&ptr, 2);
1463 s->time->y = timelib_get_nr_ex(&ptr, 2, &length);
1475 s->time->m = timelib_get_month(&ptr);
1476 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1489 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1490 s->time->m = timelib_get_month(&ptr);
1503 s->time->m = timelib_get_month(&ptr);
1504 s->time->d = timelib_get_nr(&ptr, 2);
1505 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1516 s->time->d = timelib_get_nr(&ptr, 2);
1517 timelib_skip_day_suffix(&ptr);
1518 s->time->m = timelib_get_month(&ptr);
1528 s->time->y = timelib_get_nr(&ptr, 4);
1529 s->time->m = timelib_get_nr(&ptr, 2);
1530 s->time->d = timelib_get_nr(&ptr, 2);
1542 s->time->y = timelib_get_nr(&ptr, 4);
1543 s->time->m = timelib_get_nr(&ptr, 2);
1544 s->time->d = timelib_get_nr(&ptr, 2);
1545 s->time->h = timelib_get_nr(&ptr, 2);
1546 s->time->i = timelib_get_nr(&ptr, 2);
1547 s->time->s = timelib_get_nr(&ptr, 2);
1548 if (*ptr == '.') {
1549 s->time->us = timelib_get_frac_nr(&ptr);
1550 if (*ptr) { /* timezone is optional */
1551 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1567 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1568 s->time->d = timelib_get_nr(&ptr, 3);
1583 s->time->y = timelib_get_nr(&ptr, 4);
1584 w = timelib_get_nr(&ptr, 2);
1585 d = timelib_get_nr(&ptr, 1);
1602 s->time->y = timelib_get_nr(&ptr, 4);
1603 w = timelib_get_nr(&ptr, 2);
1619 s->time->m = timelib_get_month(&ptr);
1620 s->time->d = timelib_get_nr(&ptr, 2);
1621 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1633 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1634 s->time->m = timelib_get_month(&ptr);
1635 s->time->d = timelib_get_nr(&ptr, 2);
1648 s->time->d = timelib_get_nr(&ptr, 2);
1649 s->time->m = timelib_get_month(&ptr);
1650 s->time->y = timelib_get_nr(&ptr, 4);
1651 s->time->h = timelib_get_nr(&ptr, 2);
1652 s->time->i = timelib_get_nr(&ptr, 2);
1653 s->time->s = timelib_get_nr(&ptr, 2);
1654 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1666 s->time->y = timelib_get_nr(&ptr, 4);
1700 relunit = timelib_lookup_relunit(&ptr);
1718 while(*ptr) {
1719 i = timelib_get_relative_text(&ptr, &behavior);
1720 timelib_eat_spaces(&ptr);
1721 timelib_set_relative(&ptr, i, behavior, s, TIMELIB_TIME_PART_DONT_KEEP);
1742 while(*ptr) {
1743 i = timelib_get_relative_text(&ptr, &behavior);
1744 timelib_eat_spaces(&ptr);
1745 timelib_set_relative(&ptr, i, behavior, s, TIMELIB_TIME_PART_DONT_KEEP);
1756 s->time->m = timelib_lookup_month(&ptr);
1767 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1780 s->time->m = timelib_get_month(&ptr);
1781 s->time->d = timelib_get_nr(&ptr, 2);
1784 s->time->h = timelib_get_nr(&ptr, 2);
1785 s->time->i = timelib_get_nr(&ptr, 2);
1786 if (*ptr == ':' || *ptr == '.') {
1787 s->time->s = timelib_get_nr(&ptr, 2);
1789 if (*ptr == '.') {
1790 s->time->us = timelib_get_frac_nr(&ptr);
1794 s->time->h += timelib_meridian(&ptr, s->time->h);
1805 s->time->m = timelib_get_month(&ptr);
1806 s->time->d = timelib_get_nr(&ptr, 2);
1809 s->time->h = timelib_get_nr(&ptr, 2);
1810 s->time->i = timelib_get_nr(&ptr, 2);
1811 if (*ptr == ':') {
1812 s->time->s = timelib_get_nr(&ptr, 2);
1814 if (*ptr == '.') {
1815 s->time->us = timelib_get_frac_nr(&ptr);
1819 if (*ptr != '\0') {
1820 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1836 while(*ptr) {
1837 i = timelib_get_signed_nr(s, &ptr, 24);
1838 timelib_eat_spaces(&ptr);
1839 timelib_set_relative(&ptr, i, 1, s, TIMELIB_TIME_PART_KEEP);
1947 if (strchr("0123456789", *ptr) == NULL) \
1952 if (strchr("-0123456789", *ptr) == NULL) \
2055 const char *ptr = string;
2090 while (*fptr && *ptr) {
2091 begin = ptr;
2104 if (*fptr != *ptr) {
2107 ptr++;
2130 tmprel = timelib_lookup_relunit(&ptr);
2145 if ((s->time->d = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2153 timelib_skip_day_suffix(&ptr);
2160 if ((tmp = timelib_get_nr(&ptr, 3)) == TIMELIB_UNSET) {
2176 if ((s->time->m = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2184 tmp = timelib_lookup_month(&ptr);
2197 if ((s->time->y = timelib_get_nr_ex(&ptr, 2, &length)) == TIMELIB_UNSET) {
2208 if ((s->time->y = timelib_get_nr(&ptr, 4)) == TIMELIB_UNSET) {
2218 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2232 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2243 if ((tmp = timelib_meridian_with_check(&ptr, s->time->h)) == TIMELIB_UNSET) {
2259 min = timelib_get_nr_ex(&ptr, 2, &length);
2275 sec = timelib_get_nr_ex(&ptr, 2, &length);
2291 tptr = ptr;
2292 if ((f = timelib_get_nr(&ptr, 6)) == TIMELIB_UNSET || (ptr - tptr < 1)) {
2297 s->time->us = (f * pow(10, 6 - (ptr - tptr)));
2306 tptr = ptr;
2307 if ((f = timelib_get_nr(&ptr, 3)) == TIMELIB_UNSET || (ptr - tptr < 1)) {
2312 s->time->us = (f * pow(10, 3 - (ptr - tptr)) * 1000);
2316 timelib_eat_spaces(&ptr);
2320 tmp = timelib_get_signed_nr(s, &ptr, 24);
2331 if (timelib_lookup_format(*ptr, format_map) != TIMELIB_FORMAT_SEPARATOR) {
2336 ++ptr;
2340 if (*ptr != *fptr) {
2345 ++ptr;
2357 ++ptr;
2366 if (*ptr != *fptr) {
2371 ++ptr;
2375 timelib_eat_until_separator(&ptr);
2382 if ((iso_year = timelib_get_nr(&ptr, 4)) == TIMELIB_UNSET) {
2390 if ((iso_week_of_year = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2403 if ((iso_day_of_week = timelib_get_nr(&ptr, 1)) == TIMELIB_UNSET) {
2418 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
2428 s->time->z = timelib_parse_tz_minutes(&ptr, s->time);
2438 if (*fptr != *ptr) {
2441 ptr++;
2445 if (*ptr) {
2447 add_pbf_warning(s, TIMELIB_WARN_TRAILING_DATA, "Trailing data", string, ptr);
2449 add_pbf_error(s, TIMELIB_ERR_TRAILING_DATA, "Trailing data", string, ptr);
2469 add_pbf_error(s, TIMELIB_ERR_DATA_MISSING, "Data missing", string, ptr);
2494 …IB_ERR_MIX_ISO_WITH_NATURAL, "Mixing of ISO dates with natural dates is not allowed", string, ptr);
2497 …IB_ERR_MIX_ISO_WITH_NATURAL, "Mixing of ISO dates with natural dates is not allowed", string, ptr);
2511 add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);
2518 add_pbf_warning(s, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid", string, ptr);
2524 add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);