mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Added TODO
This commit is contained in:
parent
67398186d0
commit
6910e3e4cb
1 changed files with 26 additions and 22 deletions
48
runtime.c
48
runtime.c
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue