add read function support
This commit is contained in:
parent
6b8903bd83
commit
bc2a684961
|
@ -29,6 +29,7 @@ void pic_init_macro(pic_state *);
|
||||||
void pic_init_var(pic_state *);
|
void pic_init_var(pic_state *);
|
||||||
void pic_init_load(pic_state *);
|
void pic_init_load(pic_state *);
|
||||||
void pic_init_write(pic_state *);
|
void pic_init_write(pic_state *);
|
||||||
|
void pic_init_read(pic_state *);
|
||||||
void pic_init_dict(pic_state *);
|
void pic_init_dict(pic_state *);
|
||||||
|
|
||||||
void pic_load_piclib(pic_state *);
|
void pic_load_piclib(pic_state *);
|
||||||
|
@ -94,6 +95,7 @@ pic_init_core(pic_state *pic)
|
||||||
pic_init_var(pic); DONE;
|
pic_init_var(pic); DONE;
|
||||||
pic_init_load(pic); DONE;
|
pic_init_load(pic); DONE;
|
||||||
pic_init_write(pic); DONE;
|
pic_init_write(pic); DONE;
|
||||||
|
pic_init_read(pic); DONE;
|
||||||
pic_init_dict(pic); DONE;
|
pic_init_dict(pic); DONE;
|
||||||
|
|
||||||
pic_load_piclib(pic); DONE;
|
pic_load_piclib(pic); DONE;
|
||||||
|
|
18
src/read.c
18
src/read.c
|
@ -616,3 +616,21 @@ pic_parse_cstr(pic_state *pic, const char *str)
|
||||||
|
|
||||||
return pic_parse(pic, port);
|
return pic_parse(pic, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pic_value
|
||||||
|
pic_read_read(pic_state *pic)
|
||||||
|
{
|
||||||
|
struct pic_port *port = pic_stdin(pic);
|
||||||
|
|
||||||
|
pic_get_args(pic, "|p", &port);
|
||||||
|
|
||||||
|
return pic_read(pic, port);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pic_init_read(pic_state *pic)
|
||||||
|
{
|
||||||
|
pic_deflibrary ("(scheme read)") {
|
||||||
|
pic_defun(pic, "read", pic_read_read);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue