mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
WIP
This commit is contained in:
parent
e99bc4c044
commit
35cb42fb99
1 changed files with 25 additions and 2 deletions
27
runtime.c
27
runtime.c
|
@ -5795,9 +5795,32 @@ void _read_string(void *data, object cont, port_type *p)
|
|||
case 't':
|
||||
_read_add_to_tok_buf(p, '\t');
|
||||
break;
|
||||
case 'x':
|
||||
// TODO: read hex scalar value
|
||||
case 'x': {
|
||||
char buf[128];
|
||||
int i = 0;
|
||||
while (i < 127){
|
||||
if (p->mem_buf_len == 0 || p->mem_buf_len == p->buf_idx) {
|
||||
int rv = read_from_port(p);
|
||||
if (!rv) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (p->mem_buf[p->buf_idx] == ';') break;
|
||||
buf[i] = p->mem_buf[p->buf_idx];
|
||||
p->buf_idx++;
|
||||
p->col_num++;
|
||||
i++;
|
||||
}
|
||||
buf[i] = '\0';
|
||||
// TODO: convert hex and return_closcall1(data, cont,
|
||||
{
|
||||
make_string(str, buf);
|
||||
// TODO: (integer->char (string->number (list->string buf) 16)))))
|
||||
// Cyc_string2number2_(data, cont, 2, buf, obj_int2obj(16));
|
||||
return_closcall1(data, cont, boolean_f); // TODO: just a placeholder!
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
_read_error(data, p, "invalid escape character in string"); // TODO: char
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue