pic_funcall should take a module for its argument

This commit is contained in:
Yuichi Nishiwaki 2014-09-16 00:29:19 +09:00
parent e698621ca7
commit ec0e5439af
3 changed files with 9 additions and 9 deletions

View File

@ -170,7 +170,7 @@ pic_value pic_read_cstr(pic_state *, const char *);
void pic_load(pic_state *, const char *); void pic_load(pic_state *, const char *);
void pic_load_cstr(pic_state *, const char *); void pic_load_cstr(pic_state *, const char *);
pic_value pic_funcall(pic_state *pic, const char *, pic_list); pic_value pic_funcall(pic_state *pic, struct pic_lib *, const char *, pic_list);
pic_value pic_ref(pic_state *, struct pic_lib *, const char *); pic_value pic_ref(pic_state *, struct pic_lib *, const char *);
void pic_set(pic_state *, struct pic_lib *, const char *, pic_value); void pic_set(pic_state *, struct pic_lib *, const char *, pic_value);

12
port.c
View File

@ -25,21 +25,21 @@ pic_eof_object()
struct pic_port * struct pic_port *
pic_stdin(pic_state *pic) pic_stdin(pic_state *pic)
{ {
struct pic_proc *proc; pic_value obj;
proc = pic_proc_ptr(pic_ref(pic, pic->PICRIN_BASE, "current-input-port")); obj = pic_funcall(pic, pic->PICRIN_BASE, "current-input-port", pic_nil_value());
return pic_port_ptr(pic_apply(pic, proc, pic_nil_value())); return pic_port_ptr(obj);
} }
struct pic_port * struct pic_port *
pic_stdout(pic_state *pic) pic_stdout(pic_state *pic)
{ {
struct pic_proc *proc; pic_value obj;
proc = pic_proc_ptr(pic_ref(pic, pic->PICRIN_BASE, "current-output-port")); obj = pic_funcall(pic, pic->PICRIN_BASE, "current-output-port", pic_nil_value());
return pic_port_ptr(pic_apply(pic, proc, pic_nil_value())); return pic_port_ptr(obj);
} }
struct pic_port * struct pic_port *

4
vm.c
View File

@ -457,11 +457,11 @@ pic_set(pic_state *pic, struct pic_lib *lib, const char *name, pic_value val)
} }
pic_value pic_value
pic_funcall(pic_state *pic, const char *name, pic_list args) pic_funcall(pic_state *pic, struct pic_lib *lib, const char *name, pic_list args)
{ {
pic_value proc; pic_value proc;
proc = pic_ref(pic, pic->lib, name); proc = pic_ref(pic, lib, name);
pic_assert_type(pic, proc, proc); pic_assert_type(pic, proc, proc);