Lines Matching refs:ptr

89 #define   YYMARKER     s->ptr
105 #define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
136 uchar *lim, *str, *ptr, *cur, *tok, *pos;
310 char *ptr = s;
311 while (ptr[0] == ' ' || ptr[0] == '\t') {
312 ptr++;
314 return ptr;
325 s->ptr -= cnt;
334 s->ptr = &buf[s->ptr - s->bot];
404 static timelib_sll timelib_meridian(const char **ptr, timelib_sll h)
408 while (!strchr("AaPp", **ptr)) {
409 ++*ptr;
411 if (**ptr == 'a' || **ptr == 'A') {
418 ++*ptr;
419 if (**ptr == '.') {
420 ++*ptr;
422 if (**ptr == 'M' || **ptr == 'm') {
423 ++*ptr;
425 if (**ptr == '.') {
426 ++*ptr;
431 static timelib_sll timelib_meridian_with_check(const char **ptr, timelib_sll h)
435 while (**ptr && !strchr("AaPp", **ptr)) {
436 ++*ptr;
438 if(!**ptr) {
441 if (**ptr == 'a' || **ptr == 'A') {
448 ++*ptr;
449 if (**ptr == '.') {
450 ++*ptr;
451 if (**ptr != 'm' && **ptr != 'M') {
454 ++*ptr;
455 if (**ptr != '.' ) {
458 ++*ptr;
459 } else if (**ptr == 'm' || **ptr == 'M') {
460 ++*ptr;
475 static timelib_sll timelib_get_nr_ex(const char **ptr, int max_length, int *scanned_length)
482 while ((**ptr < '0') || (**ptr > '9')) {
483 if (**ptr == '\0') {
486 ++*ptr;
489 begin = *ptr;
490 while ((**ptr >= '0') && (**ptr <= '9') && len < max_length) {
491 ++*ptr;
494 end = *ptr;
505 static timelib_sll timelib_get_nr(const char **ptr, int max_length)
507 return timelib_get_nr_ex(ptr, max_length, NULL);
510 static void timelib_skip_day_suffix(const char **ptr)
512 if (isspace(**ptr)) {
515 …lib_strncasecmp(*ptr, "nd", 2) || !timelib_strncasecmp(*ptr, "rd", 2) ||!timelib_strncasecmp(*ptr,…
516 *ptr += 2;
520 static timelib_sll timelib_get_frac_nr(const char **ptr)
526 while ((**ptr != '.') && (**ptr != ':') && ((**ptr < '0') || (**ptr > '9'))) {
527 if (**ptr == '\0') {
530 ++*ptr;
532 begin = *ptr;
533 while ((**ptr == '.') || (**ptr == ':') || ((**ptr >= '0') && (**ptr <= '9'))) {
534 ++*ptr;
536 end = *ptr;
544 static timelib_ull timelib_get_signed_nr(Scanner *s, const char **ptr, int max_length)
553 while (((**ptr < '0') || (**ptr > '9')) && (**ptr != '+') && (**ptr != '-')) {
554 if (**ptr == '\0') {
559 ++*ptr;
562 if ((**ptr == '+') || (**ptr == '-')) {
563 *str_ptr = **ptr;
564 ++*ptr;
568 while (((**ptr < '0') || (**ptr > '9'))) {
569 if (**ptr == '\0') {
574 ++*ptr;
577 while ((**ptr >= '0') && (**ptr <= '9') && len < max_length) {
578 *str_ptr = **ptr;
579 ++*ptr;
597 static timelib_sll timelib_lookup_relative_text(const char **ptr, int *behavior)
600 const char *begin = *ptr, *end;
604 while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
605 ++*ptr;
607 end = *ptr;
622 static timelib_sll timelib_get_relative_text(const char **ptr, int *behavior)
624 while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '/') {
625 ++*ptr;
627 return timelib_lookup_relative_text(ptr, behavior);
630 static timelib_long timelib_lookup_month(const char **ptr)
633 const char *begin = *ptr, *end;
637 while ((**ptr >= 'A' && **ptr <= 'Z') || (**ptr >= 'a' && **ptr <= 'z')) {
638 ++*ptr;
640 end = *ptr;
654 static timelib_long timelib_get_month(const char **ptr)
656 while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
657 ++*ptr;
659 return timelib_lookup_month(ptr);
662 static void timelib_eat_spaces(const char **ptr)
665 if (**ptr == ' ' || **ptr == '\t') {
666 ++*ptr;
669 if ((*ptr)[0] == '\xe2' && (*ptr)[1] == '\x80' && (*ptr)[2] == '\xaf') { // NNBSP
670 *ptr += 3;
673 if ((*ptr)[0] == '\xc2' && (*ptr)[1] == '\xa0') { // NBSP
674 *ptr += 2;
681 static void timelib_eat_until_separator(const char **ptr)
683 ++*ptr;
684 while (strchr(" \t.,:;/-0123456789", **ptr) == NULL) {
685 ++*ptr;
689 static const timelib_relunit* timelib_lookup_relunit(const char **ptr)
692 const char *begin = *ptr, *end;
695 …while (**ptr != '\0' && **ptr != ' ' && **ptr != ',' && **ptr != '\t' && **ptr != ';' && **ptr != …
696 **ptr != '/' && **ptr != '.' && **ptr != '-' && **ptr != '(' && **ptr != ')' ) {
697 ++*ptr;
699 end = *ptr;
731 static void timelib_set_relative(const char **ptr, timelib_sll amount, int behavior, Scanner *s, in…
735 if (!(relunit = timelib_lookup_relunit(ptr))) {
806 static timelib_long timelib_lookup_abbr(const char **ptr, int *dst, char **tz_abbr, int *found)
809 const char *begin = *ptr, *end;
815 (**ptr >= 'A' && **ptr <= 'Z') ||
816 (**ptr >= 'a' && **ptr <= 'z') ||
817 (**ptr >= '0' && **ptr <= '9') ||
818 **ptr == '/' || **ptr == '_' || **ptr == '-' || **ptr == '+'
820 ++*ptr;
822 end = *ptr;
842 static timelib_long timelib_parse_tz_cor(const char **ptr, int *tz_not_found)
844 const char *begin = *ptr, *end;
849 while (isdigit(**ptr) || **ptr == ':') {
850 ++*ptr;
852 end = *ptr;
903 static timelib_long timelib_parse_tz_minutes(const char **ptr, timelib_time *t)
906 const char *begin = *ptr;
909 if (**ptr != '+' && **ptr != '-') {
913 ++*ptr;
914 while (isdigit(**ptr)) {
915 ++*ptr;
934 timelib_long timelib_parse_zone(const char **ptr, int *dst, timelib_time *t, int *tz_not_found, con…
941 while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
942 ++*ptr;
944 …if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' && ((*ptr)[3] == '+' || (*ptr)[3] == …
945 *ptr += 3;
947 if (**ptr == '+') {
948 ++*ptr;
953 retval = timelib_parse_tz_cor(ptr, tz_not_found);
954 } else if (**ptr == '-') {
955 ++*ptr;
960 retval = -1 * timelib_parse_tz_cor(ptr, tz_not_found);
969 offset = timelib_lookup_abbr(ptr, dst, &tz_abbr, &found);
990 while (**ptr == ')') {
991 ++*ptr;
1010 const char *ptr = NULL;
1216 i = timelib_get_signed_nr(s, &ptr, 24);
1245 is_negative = *(ptr + 1) == '-';
1247 i = timelib_get_signed_nr(s, &ptr, 24);
1249 ptr_before = ptr;
1250 us = timelib_get_signed_nr(s, &ptr, 6);
1251 us = us * pow(10, 7 - (ptr - ptr_before));
1279 if (*ptr == 'l' || *ptr == 'L') {
1296 if (*ptr == 'b') {
1297 s->time->h = timelib_get_nr(&ptr, 2);
1300 s->time->h = timelib_get_nr(&ptr, 2) - 1;
1303 if (*ptr != '\0' ) {
1304 timelib_eat_spaces(&ptr);
1305 s->time->h += timelib_meridian(&ptr, s->time->h);
1321 i = timelib_get_relative_text(&ptr, &behavior);
1322 timelib_eat_spaces(&ptr);
1325 timelib_set_relative(&ptr, i, 1, s, TIMELIB_TIME_PART_DONT_KEEP);
1328 timelib_set_relative(&ptr, i, behavior, s, TIMELIB_TIME_PART_DONT_KEEP);
1339 s->time->h = timelib_get_nr(&ptr, 2);
1340 if (*ptr == ':' || *ptr == '.') {
1341 s->time->i = timelib_get_nr(&ptr, 2);
1342 if (*ptr == ':' || *ptr == '.') {
1343 s->time->s = timelib_get_nr(&ptr, 2);
1346 timelib_eat_spaces(&ptr);
1347 s->time->h += timelib_meridian(&ptr, s->time->h);
1357 s->time->h = timelib_get_nr(&ptr, 2);
1358 s->time->i = timelib_get_nr(&ptr, 2);
1359 if (*ptr == ':' || *ptr == '.') {
1360 s->time->s = timelib_get_nr(&ptr, 2);
1362 if (*ptr == ':' || *ptr == '.') {
1363 s->time->us = timelib_get_frac_nr(&ptr);
1366 timelib_eat_spaces(&ptr);
1367 s->time->h += timelib_meridian(&ptr, s->time->h);
1378 s->time->h = timelib_get_nr(&ptr, 2);
1379 if (*ptr == ':' || *ptr == '.') {
1380 s->time->i = timelib_get_nr(&ptr, 2);
1381 if (*ptr == ':' || *ptr == '.') {
1382 s->time->s = timelib_get_nr(&ptr, 2);
1384 if (*ptr == '.') {
1385 s->time->us = timelib_get_frac_nr(&ptr);
1390 if (*ptr != '\0') {
1391 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1406 s->time->h = timelib_get_nr(&ptr, 2);
1407 s->time->i = timelib_get_nr(&ptr, 2);
1411 s->time->y = timelib_get_nr(&ptr, 4);
1429 s->time->h = timelib_get_nr(&ptr, 2);
1430 s->time->i = timelib_get_nr(&ptr, 2);
1432 s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, s->tzdb, tz_get_wrapper);
1435 s->time->y = timelib_get_nr(&ptr, 4);
1452 s->time->h = timelib_get_nr(&ptr, 2);
1453 s->time->i = timelib_get_nr(&ptr, 2);
1454 s->time->s = timelib_get_nr(&ptr, 2);
1456 if (*ptr != '\0') {
1457 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1472 s->time->m = timelib_get_nr(&ptr, 2);
1473 s->time->d = timelib_get_nr(&ptr, 2);
1474 if (*ptr == '/') {
1475 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1487 s->time->y = timelib_get_signed_nr(s, &ptr, 4);
1488 s->time->m = timelib_get_nr(&ptr, 2);
1489 s->time->d = timelib_get_nr(&ptr, 2);
1500 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1501 s->time->m = timelib_get_nr(&ptr, 2);
1502 s->time->d = timelib_get_nr(&ptr, 2);
1513 s->time->y = timelib_get_signed_nr(s, &ptr, 19);
1514 s->time->m = timelib_get_nr(&ptr, 2);
1515 s->time->d = timelib_get_nr(&ptr, 2);
1526 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1527 s->time->m = timelib_get_nr(&ptr, 2);
1540 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1541 s->time->m = timelib_get_nr(&ptr, 2);
1542 s->time->d = timelib_get_nr(&ptr, 2);
1554 s->time->d = timelib_get_nr(&ptr, 2);
1555 timelib_skip_day_suffix(&ptr);
1556 s->time->m = timelib_get_month(&ptr);
1557 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1568 s->time->d = timelib_get_nr(&ptr, 2);
1569 s->time->m = timelib_get_nr(&ptr, 2);
1570 s->time->y = timelib_get_nr(&ptr, 4);
1581 s->time->d = timelib_get_nr(&ptr, 2);
1582 s->time->m = timelib_get_nr(&ptr, 2);
1583 s->time->y = timelib_get_nr_ex(&ptr, 2, &length);
1595 s->time->m = timelib_get_month(&ptr);
1596 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1609 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1610 s->time->m = timelib_get_month(&ptr);
1623 s->time->m = timelib_get_month(&ptr);
1624 s->time->d = timelib_get_nr(&ptr, 2);
1625 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1636 s->time->d = timelib_get_nr(&ptr, 2);
1637 timelib_skip_day_suffix(&ptr);
1638 s->time->m = timelib_get_month(&ptr);
1648 s->time->y = timelib_get_nr(&ptr, 4);
1649 s->time->m = timelib_get_nr(&ptr, 2);
1650 s->time->d = timelib_get_nr(&ptr, 2);
1662 s->time->y = timelib_get_nr(&ptr, 4);
1663 s->time->m = timelib_get_nr(&ptr, 2);
1664 s->time->d = timelib_get_nr(&ptr, 2);
1665 s->time->h = timelib_get_nr(&ptr, 2);
1666 s->time->i = timelib_get_nr(&ptr, 2);
1667 s->time->s = timelib_get_nr(&ptr, 2);
1668 if (*ptr == '.') {
1669 s->time->us = timelib_get_frac_nr(&ptr);
1670 if (*ptr) { /* timezone is optional */
1671 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1687 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1688 s->time->d = timelib_get_nr(&ptr, 3);
1703 s->time->y = timelib_get_nr(&ptr, 4);
1704 w = timelib_get_nr(&ptr, 2);
1705 d = timelib_get_nr(&ptr, 1);
1722 s->time->y = timelib_get_nr(&ptr, 4);
1723 w = timelib_get_nr(&ptr, 2);
1739 s->time->m = timelib_get_month(&ptr);
1740 s->time->d = timelib_get_nr(&ptr, 2);
1741 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1753 s->time->y = timelib_get_nr_ex(&ptr, 4, &length);
1754 s->time->m = timelib_get_month(&ptr);
1755 s->time->d = timelib_get_nr(&ptr, 2);
1768 s->time->d = timelib_get_nr(&ptr, 2);
1769 s->time->m = timelib_get_month(&ptr);
1770 s->time->y = timelib_get_nr(&ptr, 4);
1771 s->time->h = timelib_get_nr(&ptr, 2);
1772 s->time->i = timelib_get_nr(&ptr, 2);
1773 s->time->s = timelib_get_nr(&ptr, 2);
1775 timelib_eat_spaces(&ptr);
1777 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1789 s->time->y = timelib_get_nr(&ptr, 4);
1823 relunit = timelib_lookup_relunit(&ptr);
1841 while(*ptr) {
1842 i = timelib_get_relative_text(&ptr, &behavior);
1843 timelib_eat_spaces(&ptr);
1844 timelib_set_relative(&ptr, i, behavior, s, TIMELIB_TIME_PART_DONT_KEEP);
1865 while(*ptr) {
1866 i = timelib_get_relative_text(&ptr, &behavior);
1867 timelib_eat_spaces(&ptr);
1868 timelib_set_relative(&ptr, i, behavior, s, TIMELIB_TIME_PART_DONT_KEEP);
1879 s->time->m = timelib_lookup_month(&ptr);
1890 timelib_eat_spaces(&ptr);
1891 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1904 s->time->m = timelib_get_month(&ptr);
1905 s->time->d = timelib_get_nr(&ptr, 2);
1908 s->time->h = timelib_get_nr(&ptr, 2);
1909 s->time->i = timelib_get_nr(&ptr, 2);
1910 if (*ptr == ':' || *ptr == '.') {
1911 s->time->s = timelib_get_nr(&ptr, 2);
1913 if (*ptr == '.') {
1914 s->time->us = timelib_get_frac_nr(&ptr);
1918 s->time->h += timelib_meridian(&ptr, s->time->h);
1929 s->time->m = timelib_get_month(&ptr);
1930 s->time->d = timelib_get_nr(&ptr, 2);
1933 s->time->h = timelib_get_nr(&ptr, 2);
1934 s->time->i = timelib_get_nr(&ptr, 2);
1935 if (*ptr == ':') {
1936 s->time->s = timelib_get_nr(&ptr, 2);
1938 if (*ptr == '.') {
1939 s->time->us = timelib_get_frac_nr(&ptr);
1943 if (*ptr != '\0') {
1944 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
1960 while(*ptr) {
1961 i = timelib_get_signed_nr(s, &ptr, 24);
1962 timelib_eat_spaces(&ptr);
1963 timelib_set_relative(&ptr, i, 1, s, TIMELIB_TIME_PART_KEEP);
2076 if (strchr("0123456789", *ptr) == NULL) \
2081 if (strchr("+-0123456789", *ptr) == NULL) \
2186 const char *ptr = string;
2221 while (*fptr && *ptr) {
2222 begin = ptr;
2235 if (*fptr != *ptr) {
2238 ptr++;
2261 tmprel = timelib_lookup_relunit(&ptr);
2276 if ((s->time->d = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2284 timelib_skip_day_suffix(&ptr);
2291 if ((tmp = timelib_get_nr(&ptr, 3)) == TIMELIB_UNSET) {
2307 if ((s->time->m = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2315 tmp = timelib_lookup_month(&ptr);
2328 if ((s->time->y = timelib_get_nr_ex(&ptr, 2, &length)) == TIMELIB_UNSET) {
2339 if ((s->time->y = timelib_get_nr(&ptr, 4)) == TIMELIB_UNSET) {
2348 if ((s->time->y = timelib_get_signed_nr(s, &ptr, 19)) == TIMELIB_UNSET) {
2358 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2372 if ((s->time->h = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2383 if ((tmp = timelib_meridian_with_check(&ptr, s->time->h)) == TIMELIB_UNSET) {
2399 min = timelib_get_nr_ex(&ptr, 2, &length);
2415 sec = timelib_get_nr_ex(&ptr, 2, &length);
2431 tptr = ptr;
2432 if ((f = timelib_get_nr(&ptr, 6)) == TIMELIB_UNSET || (ptr - tptr < 1)) {
2437 s->time->us = (f * pow(10, 6 - (ptr - tptr)));
2446 tptr = ptr;
2447 if ((f = timelib_get_nr(&ptr, 3)) == TIMELIB_UNSET || (ptr - tptr < 1)) {
2452 s->time->us = (f * pow(10, 3 - (ptr - tptr)) * 1000);
2456 timelib_eat_spaces(&ptr);
2460 tmp = timelib_get_signed_nr(s, &ptr, 24);
2471 if (timelib_lookup_format(*ptr, format_map) != TIMELIB_FORMAT_SEPARATOR) {
2476 ++ptr;
2480 if (*ptr != *fptr) {
2485 ++ptr;
2497 ++ptr;
2506 if (*ptr != *fptr) {
2511 ++ptr;
2515 timelib_eat_until_separator(&ptr);
2522 if ((iso_year = timelib_get_nr(&ptr, 4)) == TIMELIB_UNSET) {
2530 if ((iso_week_of_year = timelib_get_nr(&ptr, 2)) == TIMELIB_UNSET) {
2543 if ((iso_day_of_week = timelib_get_nr(&ptr, 1)) == TIMELIB_UNSET) {
2558 …s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapp…
2568 s->time->z = timelib_parse_tz_minutes(&ptr, s->time);
2578 if (*fptr != *ptr) {
2581 ptr++;
2585 if (*ptr) {
2587 add_pbf_warning(s, TIMELIB_WARN_TRAILING_DATA, "Trailing data", string, ptr);
2589 add_pbf_error(s, TIMELIB_ERR_TRAILING_DATA, "Trailing data", string, ptr);
2609 …pbf_error(s, TIMELIB_ERR_DATA_MISSING, "Not enough data available to satisfy format", string, ptr);
2634 …IB_ERR_MIX_ISO_WITH_NATURAL, "Mixing of ISO dates with natural dates is not allowed", string, ptr);
2637 …IB_ERR_MIX_ISO_WITH_NATURAL, "Mixing of ISO dates with natural dates is not allowed", string, ptr);
2651 add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);
2658 add_pbf_warning(s, TIMELIB_WARN_INVALID_TIME, "The parsed time was invalid", string, ptr);
2664 add_pbf_warning(s, TIMELIB_WARN_INVALID_DATE, "The parsed date was invalid", string, ptr);