add accessors of stdio ports
This commit is contained in:
parent
3fb407329f
commit
1c14feffa4
|
@ -27,4 +27,8 @@ struct pic_port {
|
|||
|
||||
pic_value pic_eof_object();
|
||||
|
||||
struct pic_port *pic_stdin(pic_state *);
|
||||
struct pic_port *pic_stdout(pic_state *);
|
||||
struct pic_port *pic_stderr(pic_state *);
|
||||
|
||||
#endif
|
||||
|
|
10
src/port.c
10
src/port.c
|
@ -17,6 +17,16 @@ pic_eof_object()
|
|||
return v;
|
||||
}
|
||||
|
||||
struct pic_port *
|
||||
pic_stdin(pic_state *pic)
|
||||
{
|
||||
struct pic_proc *proc;
|
||||
|
||||
proc = pic_proc_ptr(pic_ref(pic, "current-input-port"));
|
||||
|
||||
return pic_port_ptr(pic_apply(pic, proc, pic_nil_value()));
|
||||
}
|
||||
|
||||
static void write_pair(pic_state *pic, struct pic_pair *pair);
|
||||
static void write_str(pic_state *pic, struct pic_string *str);
|
||||
|
||||
|
|
Loading…
Reference in New Issue