Added TODO

This commit is contained in:
Justin Ethier 2017-11-03 14:51:34 +00:00
parent 67398186d0
commit 6910e3e4cb

View file

@ -5944,6 +5944,28 @@ static void _read_add_to_tok_buf(port_type *p, char c)
p->tok_buf[p->tok_end++] = c;
}
/**
* @brief Determine if given string is numeric
*/
int _read_is_numeric(const char *tok)
{
int len = strlen(tok);
return (len &&
((isdigit(tok[0])) ||
((len > 1) && tok[0] == '.' && isdigit(tok[1])) ||
((len > 1) && (tok[1] == '.' || isdigit(tok[1])) && (tok[0] == '-' || tok[0] == '+'))));
}
/**
* @brief Helper function, determine if given number is a hex digit
* @param c Character to check
*/
int _read_is_hex_digit(char c)
{
return (c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F');
}
/**
* @brief Helper function to read a string
* @param data Thread data object
@ -6003,6 +6025,10 @@ void _read_string(void *data, object cont, port_type *p)
p->buf_idx++;
break;
}
// TODO: verify if hex digit is valid
//if (!isdigit(p->buf_idx) && !_read_is_hex_digit(p->buf_idx)) {
// _read_error(data, p, "invalid hex digit in string");
//}
buf[i] = p->mem_buf[p->buf_idx];
p->buf_idx++;
p->col_num++;
@ -6168,28 +6194,6 @@ void _read_character(void *data, port_type *p)
}
}
/**
* @brief Determine if given string is numeric
*/
int _read_is_numeric(const char *tok)
{
int len = strlen(tok);
return (len &&
((isdigit(tok[0])) ||
((len > 1) && tok[0] == '.' && isdigit(tok[1])) ||
((len > 1) && (tok[1] == '.' || isdigit(tok[1])) && (tok[0] == '-' || tok[0] == '+'))));
}
/**
* @brief Helper function, determine if given number is a hex digit
* @param c Character to check
*/
int _read_is_hex_digit(char c)
{
return (c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F');
}
/**
* @brief Helper function, return read number.
* @param data Thread data object