Lines Matching defs:cp

305 static int	field_init	(nmea_data * data, char * cp, int len);
646 char * cp;
694 cp = field_parse(&rdata, 0);
695 if (strncmp(cp + 2, "RMC,", 4) == 0)
697 else if (strncmp(cp + 2, "GGA,", 4) == 0)
699 else if (strncmp(cp + 2, "GLL,", 4) == 0)
701 else if (strncmp(cp + 2, "ZDA,", 4) == 0)
703 else if (strncmp(cp + 2, "ZDG,", 4) == 0)
705 else if (strncmp(cp, "PGRMF,", 6) == 0)
707 else if (strncmp(cp, "PUBX,04,", 8) == 0)
1381 char * cp; /* overwrite destination */
1384 cp = NULL;
1389 cp = field_parse(data, fidx);
1391 cp = data->base + data->blen;
1392 if (data->blen >= 3 && cp[-3] == '*')
1393 cp -= 2;
1395 for ( ; '\0' != *cp && '*' != *cp && ',' != *cp; cp++)
1396 if ('.' != *cp)
1397 *cp = '_';
1412 static int field_length(UCC *cp, unsigned int nfields)
1414 char const * ep = (char const*)cp;
1420 ? (int)((UCC*)ep - cp)
1421 : (int)strlen((char const*)cp);
1426 static int _parse_eof(UCC *cp, UCC ** ep)
1428 int rc = (strchr(s_eof_chars, *(char const*)cp) != NULL);
1429 *ep = cp + rc;
1434 static int _parse_sep(UCC *cp, UCC ** ep)
1436 int rc = (*cp == ',');
1437 *ep = cp + rc;
1442 static int _parse_num2d(UCC *cp, UCC ** ep, uint16_t *into)
1446 if (isdigit(cp[0]) && isdigit(cp[1])) {
1447 *into = (cp[0] - '0') * 10 + (cp[1] - '0');
1448 cp += 2;
1451 *ep = cp;
1456 static int _parse_u16(UCC *cp, UCC **ep, uint16_t *into, unsigned int ndig)
1460 if (isdigit(*cp) && ndig) {
1463 num = (num * 10) + (*cp - '0');
1464 while (isdigit(*++cp) && --ndig);
1467 *ep = cp;
1472 static int _parse_u32(UCC *cp, UCC **ep, uint32_t *into, unsigned int ndig)
1476 if (isdigit(*cp) && ndig) {
1479 num = (num * 10) + (*cp - '0');
1480 while (isdigit(*++cp) && --ndig);
1483 *ep = cp;
1493 static int _parse_frac(UCC *cp, UCC **ep, l_fp *into)
1504 if (*cp == '.') {
1506 UCC * sp = cp + 1;
1507 if (_parse_u32(sp, &cp, &fval, 9))
1508 ts.tv_nsec = fval * powtab[(size_t)(cp - sp)];
1509 while (isdigit(*cp))
1510 ++cp;
1513 *ep = cp;
1521 static int _parse_time(UCC *cp, UCC ** ep, TCivilDate *into)
1525 UCC * xp = cp;
1527 rc = _parse_num2d(cp, &cp, &h) && (h < 24)
1528 && _parse_num2d(cp, &cp, &m) && (m < 60)
1529 && _parse_num2d(cp, &cp, &s) && (s < 61); /* leap seconds! */
1535 *ep = cp;
1547 static int _parse_date1(UCC *cp, UCC **ep, TCivilDate *into)
1551 UCC * xp = cp;
1553 rc = _parse_num2d(cp, &cp, &d) && (d - 1 < 31)
1554 && _parse_num2d(cp, &cp, &m) && (m - 1 < 12)
1555 && _parse_num2d(cp, &cp, &y)
1556 && _parse_eof(cp, ep);
1561 *ep = cp;
1573 static int _parse_date3(UCC *cp, UCC **ep, TCivilDate *into)
1577 UCC * xp = cp;
1579 rc = _parse_u16(cp, &cp, &d, 2) && (d - 1 < 31)
1580 && _parse_sep(cp, &cp)
1581 && _parse_u16(cp, &cp, &m, 2) && (m - 1 < 12)
1582 && _parse_sep(cp, &cp)
1583 && _parse_u16(cp, &cp, &y, 4) && (y > 1980)
1584 && _parse_eof(cp, ep);
1589 *ep = cp;
1605 * data field (*cp points to the NUL byte) the result is LEAP_NOTINSYNC.