Lines Matching refs:ptr

88 #define   YYMARKER     s->ptr
104 #define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
135 uchar *lim, *str, *ptr, *cur, *tok, *pos;
309 char *ptr = s;
310 while (ptr[0] == ' ' || ptr[0] == '\t') {
311 ptr++;
313 return ptr;
324 s->ptr -= cnt;
333 s->ptr = &buf[s->ptr - s->bot];
403 static timelib_sll timelib_meridian(const char **ptr, timelib_sll h)
407 while (!strchr("AaPp", **ptr)) {
408 ++*ptr;
410 if (**ptr == 'a' || **ptr == 'A') {
417 ++*ptr;
418 if (**ptr == '.') {
419 ++*ptr;
421 if (**ptr == 'M' || **ptr == 'm') {
422 ++*ptr;
424 if (**ptr == '.') {
425 ++*ptr;
430 static timelib_sll timelib_meridian_with_check(const char **ptr, timelib_sll h)
434 while (**ptr && !strchr("AaPp", **ptr)) {
435 ++*ptr;
437 if(!**ptr) {
440 if (**ptr == 'a' || **ptr == 'A') {
447 ++*ptr;
448 if (**ptr == '.') {
449 ++*ptr;
450 if (**ptr != 'm' && **ptr != 'M') {
453 ++*ptr;
454 if (**ptr != '.' ) {
457 ++*ptr;
458 } else if (**ptr == 'm' || **ptr == 'M') {
459 ++*ptr;
474 static timelib_sll timelib_get_nr_ex(const char **ptr, int max_length, int *scanned_length)
481 while ((**ptr < '0') || (**ptr > '9')) {
482 if (**ptr == '\0') {
485 ++*ptr;
487 begin = *ptr;
488 while ((**ptr >= '0') && (**ptr <= '9') && len < max_length) {
489 ++*ptr;
492 end = *ptr;
503 static timelib_sll timelib_get_nr(const char **ptr, int max_length)
505 return timelib_get_nr_ex(ptr, max_length, NULL);
508 static void timelib_skip_day_suffix(const char **ptr)
510 if (isspace(**ptr)) {
513 …lib_strncasecmp(*ptr, "nd", 2) || !timelib_strncasecmp(*ptr, "rd", 2) ||!timelib_strncasecmp(*ptr,…
514 *ptr += 2;
518 static timelib_sll timelib_get_frac_nr(const char **ptr)
524 while ((**ptr != '.') && (**ptr != ':') && ((**ptr < '0') || (**ptr > '9'))) {
525 if (**ptr == '\0') {
528 ++*ptr;
530 begin = *ptr;
531 while ((**ptr == '.') || (**ptr == ':') || ((**ptr >= '0') && (**ptr <= '9'))) {
532 ++*ptr;
534 end = *ptr;
542 static timelib_ull timelib_get_signed_nr(Scanner *s, const char **ptr, int max_length)
546 while (((**ptr < '0') || (**ptr > '9')) && (**ptr != '+') && (**ptr != '-')) {
547 if (**ptr == '\0') {
551 ++*ptr;
554 while (**ptr == '+' || **ptr == '-')
556 if (**ptr == '-') {
559 ++*ptr;
561 return dir * timelib_get_nr(ptr, max_length);
564 static timelib_sll timelib_lookup_relative_text(const char **ptr, int *behavior)
567 const char *begin = *ptr, *end;
571 while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
572 ++*ptr;
574 end = *ptr;
589 static timelib_sll timelib_get_relative_text(const char **ptr, int *behavior)
591 while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '/') {
592 ++*ptr;
594 return timelib_lookup_relative_text(ptr, behavior);
597 static timelib_long timelib_lookup_month(const char **ptr)
600 const char *begin = *ptr, *end;
604 while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
605 ++*ptr;
607 end = *ptr;
621 static timelib_long timelib_get_month(const char **ptr)
623 while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
624 ++*ptr;
626 return timelib_lookup_month(ptr);
629 static void timelib_eat_spaces(const char **ptr)
631 while (**ptr == ' ' || **ptr == '\t') {
632 ++*ptr;
636 static void timelib_eat_until_separator(const char **ptr)
638 ++*ptr;
639 while (strchr(" \t.,:;/-0123456789", **ptr) == NULL) {
640 ++*ptr;
644 static const timelib_relunit* timelib_lookup_relunit(const char **ptr)
647 const char *begin = *ptr, *end;
650 …while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != …
651 **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
652 ++*ptr;
654 end = *ptr;
675 static void timelib_set_relative(const char **ptr, timelib_sll amount, int behavior, Scanner *s, in…
679 if (!(relunit = timelib_lookup_relunit(ptr))) {
750 static timelib_long timelib_lookup_abbr(const char **ptr, int *dst, char **tz_abbr, int *found)
753 const char *begin = *ptr, *end;
759 (**ptr >= 'A' && **ptr <= 'Z') ||
760 (**ptr >= 'a' && **ptr <= 'z') ||
761 (**ptr >= '0' && **ptr <= '9') ||
762 **ptr == '/' || **ptr == '_' || **ptr == '-' || **ptr == '+'
764 ++*ptr;
766 end = *ptr;
786 static timelib_long timelib_parse_tz_cor(const char **ptr, int *tz_not_found)
788 const char *begin = *ptr, *end;
793 while (isdigit(**ptr) || **ptr == ':') {
794 ++*ptr;
796 end = *ptr;
847 static timelib_long timelib_parse_tz_minutes(const char **ptr, timelib_time *t)
850 const char *begin = *ptr;
853 if (**ptr != '+' && **ptr != '-') {
857 ++*ptr;
858 while (isdigit(**ptr)) {
859 ++*ptr;
878 timelib_long timelib_parse_zone(const char **ptr, int *dst, timelib_time *t, int *tz_not_found, con…
885 while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
886 ++*ptr;
888 …if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' && ((*ptr)[3] == '+' || (*ptr)[3] == …
889 *ptr += 3;
891 if (**ptr == '+') {
892 ++*ptr;
897 retval = timelib_parse_tz_cor(ptr, tz_not_found);
898 } else if (**ptr == '-') {
899 ++*ptr;
904 retval = -1 * timelib_parse_tz_cor(ptr, tz_not_found);
913 offset = timelib_lookup_abbr(ptr, dst, &tz_abbr, &found);
934 while (**ptr == ')') {
935 ++*ptr;
954 const char *ptr = NULL;
1158 i = timelib_get_signed_nr(s, &ptr, 24);
1187 is_negative = *(ptr + 1) == '-';
1189 i = timelib_get_signed_nr(s, &ptr, 24);
1191 ptr_before = ptr;
1192 us = timelib_get_signed_nr(s, &ptr, 6);
1193 us = us * pow(10, 7 - (ptr - ptr_before));
1221 if (*ptr == 'l' || *ptr == 'L') {
1238 if (*ptr == 'b') {
1239 s->time->h = timelib_get_nr(&ptr, 2);
1242 s->time->h = timelib_get_nr(&ptr, 2) - 1;
1245 if (*ptr != '\0' ) {
1246 timelib_eat_spaces(&ptr);
1247 s->time->h += timelib_meridian(&ptr, s->time->h);
1263 i = timelib_get_relative_text(&ptr, &behavior);
1264 timelib_eat_spaces(&ptr);
1267 timelib_set_relative(&ptr, i, 1, s, TIMELIB_TIME_PART_DONT_KEEP);
1270 timelib_set_relative(&ptr, i, behavior, s, TIMELIB_TIME_PART_DONT_KEEP);
1281 s->time->h = timelib_get_nr(&ptr, 2);
1282 if (*ptr == ':' || *ptr == '.') {
1283 s->time->i = timelib_get_nr(&ptr, 2);
1284 if (*ptr == ':' || *ptr == '.') {
1285 s->time->s = timelib_get_nr(&ptr, 2);
1288 s->time->h += timelib_meridian(&ptr, s->time->h);
1298 s->time->h = timelib_get_nr(&ptr, 2);
1299 s->time->i = timelib_get_nr(&ptr, 2);
1300 if (*ptr == ':' || *ptr == '.') {
1301 s->time->s = timelib_get_nr(&ptr, 2);
1303 if (*ptr == ':' || *ptr == '.') {
1304 s->time->us = timelib_get_frac_nr(&ptr);
1307 timelib_eat_spaces(&ptr);
1308 s->time->h += timelib_meridian(&ptr, s->time->h);
1319 s->time->h = timelib_get_nr(&ptr, 2);
1320 if (*ptr == ':' || *ptr == '.') {
1321 s->time->i = timelib_get_nr(&ptr, 2);
1322 if (*ptr == ':' || *ptr == '.') {
1323 s->time->s = timelib_get_nr(&ptr, 2);
1325 if (*ptr == '.') {
1326 s->time->us = timelib_get_frac_nr(&ptr);
1331 if (*ptr != '\0') {
1332 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1347 s->time->h = timelib_get_nr(&ptr, 2);
1348 s->time->i = timelib_get_nr(&ptr, 2);
1352 s->time->y = timelib_get_nr(&ptr, 4);
1370 s->time->h = timelib_get_nr(&ptr, 2);
1371 s->time->i = timelib_get_nr(&ptr, 2);
1373 s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
1376 s->time->y = timelib_get_nr(&ptr, 4);
1393 s->time->h = timelib_get_nr(&ptr, 2);
1394 s->time->i = timelib_get_nr(&ptr, 2);
1395 s->time->s = timelib_get_nr(&ptr, 2);
1397 if (*ptr != '\0') {
1398 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1413 s->time->m = timelib_get_nr(&ptr, 2);
1414 s->time->d = timelib_get_nr(&ptr, 2);
1415 if (*ptr == '/') {
1416 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1428 s->time->y = timelib_get_signed_nr(s, &ptr, 4);
1429 s->time->m = timelib_get_nr(&ptr, 2);
1430 s->time->d = timelib_get_nr(&ptr, 2);
1441 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1442 s->time->m = timelib_get_nr(&ptr, 2);
1443 s->time->d = timelib_get_nr(&ptr, 2);
1454 s->time->y = timelib_get_signed_nr(s, &ptr, 19);
1455 s->time->m = timelib_get_nr(&ptr, 2);
1456 s->time->d = timelib_get_nr(&ptr, 2);
1467 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1468 s->time->m = timelib_get_nr(&ptr, 2);
1481 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1482 s->time->m = timelib_get_nr(&ptr, 2);
1483 s->time->d = timelib_get_nr(&ptr, 2);
1495 s->time->d = timelib_get_nr(&ptr, 2);
1496 timelib_skip_day_suffix(&ptr);
1497 s->time->m = timelib_get_month(&ptr);
1498 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1509 s->time->d = timelib_get_nr(&ptr, 2);
1510 s->time->m = timelib_get_nr(&ptr, 2);
1511 s->time->y = timelib_get_nr(&ptr, 4);
1522 s->time->d = timelib_get_nr(&ptr, 2);
1523 s->time->m = timelib_get_nr(&ptr, 2);
1524 s->time->y = timelib_get_nr_ex(&ptr, 2, &length);
1536 s->time->m = timelib_get_month(&ptr);
1537 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1550 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1551 s->time->m = timelib_get_month(&ptr);
1564 s->time->m = timelib_get_month(&ptr);
1565 s->time->d = timelib_get_nr(&ptr, 2);
1566 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1577 s->time->d = timelib_get_nr(&ptr, 2);
1578 timelib_skip_day_suffix(&ptr);
1579 s->time->m = timelib_get_month(&ptr);
1589 s->time->y = timelib_get_nr(&ptr, 4);
1590 s->time->m = timelib_get_nr(&ptr, 2);
1591 s->time->d = timelib_get_nr(&ptr, 2);
1603 s->time->y = timelib_get_nr(&ptr, 4);
1604 s->time->m = timelib_get_nr(&ptr, 2);
1605 s->time->d = timelib_get_nr(&ptr, 2);
1606 s->time->h = timelib_get_nr(&ptr, 2);
1607 s->time->i = timelib_get_nr(&ptr, 2);
1608 s->time->s = timelib_get_nr(&ptr, 2);
1609 if (*ptr == '.') {
1610 s->time->us = timelib_get_frac_nr(&ptr);
1611 if (*ptr) { /* timezone is optional */
1612 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1628 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1629 s->time->d = timelib_get_nr(&ptr, 3);
1644 s->time->y = timelib_get_nr(&ptr, 4);
1645 w = timelib_get_nr(&ptr, 2);
1646 d = timelib_get_nr(&ptr, 1);
1663 s->time->y = timelib_get_nr(&ptr, 4);
1664 w = timelib_get_nr(&ptr, 2);
1680 s->time->m = timelib_get_month(&ptr);
1681 s->time->d = timelib_get_nr(&ptr, 2);
1682 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1694 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1695 s->time->m = timelib_get_month(&ptr);
1696 s->time->d = timelib_get_nr(&ptr, 2);
1709 s->time->d = timelib_get_nr(&ptr, 2);
1710 s->time->m = timelib_get_month(&ptr);
1711 s->time->y = timelib_get_nr(&ptr, 4);
1712 s->time->h = timelib_get_nr(&ptr, 2);
1713 s->time->i = timelib_get_nr(&ptr, 2);
1714 s->time->s = timelib_get_nr(&ptr, 2);
1715 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1727 s->time->y = timelib_get_nr(&ptr, 4);
1761 relunit = timelib_lookup_relunit(&ptr);
1779 while(*ptr) {
1780 i = timelib_get_relative_text(&ptr, &behavior);
1781 timelib_eat_spaces(&ptr);
1782 timelib_set_relative(&ptr, i, behavior, s, TIMELIB_TIME_PART_DONT_KEEP);
1803 while(*ptr) {
1804 i = timelib_get_relative_text(&ptr, &behavior);
1805 timelib_eat_spaces(&ptr);
1806 timelib_set_relative(&ptr, i, behavior, s, TIMELIB_TIME_PART_DONT_KEEP);
1817 s->time->m = timelib_lookup_month(&ptr);
1828 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1841 s->time->m = timelib_get_month(&ptr);
1842 s->time->d = timelib_get_nr(&ptr, 2);
1845 s->time->h = timelib_get_nr(&ptr, 2);
1846 s->time->i = timelib_get_nr(&ptr, 2);
1847 if (*ptr == ':' || *ptr == '.') {
1848 s->time->s = timelib_get_nr(&ptr, 2);
1850 if (*ptr == '.') {
1851 s->time->us = timelib_get_frac_nr(&ptr);
1855 s->time->h += timelib_meridian(&ptr, s->time->h);
1866 s->time->m = timelib_get_month(&ptr);
1867 s->time->d = timelib_get_nr(&ptr, 2);
1870 s->time->h = timelib_get_nr(&ptr, 2);
1871 s->time->i = timelib_get_nr(&ptr, 2);
1872 if (*ptr == ':') {
1873 s->time->s = timelib_get_nr(&ptr, 2);
1875 if (*ptr == '.') {
1876 s->time->us = timelib_get_frac_nr(&ptr);
1880 if (*ptr != '\0') {
1881 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1897 while(*ptr) {
1898 i = timelib_get_signed_nr(s, &ptr, 24);
1899 timelib_eat_spaces(&ptr);
1900 timelib_set_relative(&ptr, i, 1, s, TIMELIB_TIME_PART_KEEP);
2008 if (strchr("0123456789", *ptr) == NULL) \
2013 if (strchr("-0123456789", *ptr) == NULL) \
2116 const char *ptr = string;
2151 while (*fptr && *ptr) {
2152 begin = ptr;
2165 if (*fptr != *ptr) {
2168 ptr++;
2191 tmprel = timelib_lookup_relunit(&ptr);
2206 if ((s->time->d = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2214 timelib_skip_day_suffix(&ptr);
2221 if ((tmp = timelib_get_nr(&ptr, 3)) == TIMELIB_UNSET) {
2237 if ((s->time->m = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2245 tmp = timelib_lookup_month(&ptr);
2258 if ((s->time->y = timelib_get_nr_ex(&ptr, 2, &length)) == TIMELIB_UNSET) {
2269 if ((s->time->y = timelib_get_nr(&ptr, 4)) == TIMELIB_UNSET) {
2279 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2293 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2304 if ((tmp = timelib_meridian_with_check(&ptr, s->time->h)) == TIMELIB_UNSET) {
2320 min = timelib_get_nr_ex(&ptr, 2, &length);
2336 sec = timelib_get_nr_ex(&ptr, 2, &length);
2352 tptr = ptr;
2353 if ((f = timelib_get_nr(&ptr, 6)) == TIMELIB_UNSET || (ptr - tptr < 1)) {
2358 s->time->us = (f * pow(10, 6 - (ptr - tptr)));
2367 tptr = ptr;
2368 if ((f = timelib_get_nr(&ptr, 3)) == TIMELIB_UNSET || (ptr - tptr < 1)) {
2373 s->time->us = (f * pow(10, 3 - (ptr - tptr)) * 1000);
2377 timelib_eat_spaces(&ptr);
2381 tmp = timelib_get_signed_nr(s, &ptr, 24);
2392 if (timelib_lookup_format(*ptr, format_map) != TIMELIB_FORMAT_SEPARATOR) {
2397 ++ptr;
2401 if (*ptr != *fptr) {
2406 ++ptr;
2418 ++ptr;
2427 if (*ptr != *fptr) {
2432 ++ptr;
2436 timelib_eat_until_separator(&ptr);
2443 if ((iso_year = timelib_get_nr(&ptr, 4)) == TIMELIB_UNSET) {
2451 if ((iso_week_of_year = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2464 if ((iso_day_of_week = timelib_get_nr(&ptr, 1)) == TIMELIB_UNSET) {
2479 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
2489 s->time->z = timelib_parse_tz_minutes(&ptr, s->time);
2499 if (*fptr != *ptr) {
2502 ptr++;
2506 if (*ptr) {
2508 add_pbf_warning(s, TIMELIB_WARN_TRAILING_DATA, "Trailing data", string, ptr);
2510 add_pbf_error(s, TIMELIB_ERR_TRAILING_DATA, "Trailing data", string, ptr);
2530 …pbf_error(s, TIMELIB_ERR_DATA_MISSING, "Not enough data available to satisfy format", string, ptr);
2555 …IB_ERR_MIX_ISO_WITH_NATURAL, "Mixing of ISO dates with natural dates is not allowed", string, ptr);
2558 …IB_ERR_MIX_ISO_WITH_NATURAL, "Mixing of ISO dates with natural dates is not allowed", string, ptr);
2572 add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);
2579 add_pbf_warning(s, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid", string, ptr);
2585 add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);