rename pic_proc_cv_ref to pic_attr_ref

This commit is contained in:
Yuichi Nishiwaki 2014-07-17 16:31:26 +09:00
parent 4714df48f0
commit c601dbf27e
3 changed files with 9 additions and 11 deletions

View File

@ -52,10 +52,8 @@ struct pic_proc *pic_proc_new_irep(pic_state *, struct pic_irep *, struct pic_en
pic_sym pic_proc_name(struct pic_proc *); pic_sym pic_proc_name(struct pic_proc *);
struct pic_dict *pic_attr(pic_state *, struct pic_proc *); struct pic_dict *pic_attr(pic_state *, struct pic_proc *);
pic_value pic_attr_ref(pic_state *, struct pic_proc *, const char *);
/* closed variables accessor */ void pic_attr_set(pic_state *, struct pic_proc *, const char *, pic_value);
pic_value pic_proc_cv_ref(pic_state *, struct pic_proc *, size_t);
void pic_proc_cv_set(pic_state *, struct pic_proc *, size_t, pic_value);
#if defined(__cplusplus) #if defined(__cplusplus)
} }

View File

@ -221,7 +221,7 @@ cont_call(pic_state *pic)
proc = pic_get_proc(pic); proc = pic_get_proc(pic);
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);
cont = (struct pic_cont *)pic_ptr(pic_proc_cv_ref(pic, proc, 0)); cont = (struct pic_cont *)pic_ptr(pic_attr_ref(pic, proc, "@@cont"));
cont->results = pic_list_by_array(pic, argc, argv); cont->results = pic_list_by_array(pic, argc, argv);
/* execute guard handlers */ /* execute guard handlers */
@ -245,7 +245,7 @@ pic_callcc(pic_state *pic, struct pic_proc *proc)
c = pic_proc_new(pic, cont_call, "<continuation-procedure>"); c = pic_proc_new(pic, cont_call, "<continuation-procedure>");
/* save the continuation object in proc */ /* save the continuation object in proc */
pic_proc_cv_set(pic, c, 0, pic_obj_value(cont)); pic_attr_set(pic, c, "@@cont", pic_obj_value(cont));
return pic_apply1(pic, proc, pic_obj_value(c)); return pic_apply1(pic, proc, pic_obj_value(c));
} }
@ -266,7 +266,7 @@ pic_callcc_trampoline(pic_state *pic, struct pic_proc *proc)
c = pic_proc_new(pic, cont_call, "<continuation-procedure>"); c = pic_proc_new(pic, cont_call, "<continuation-procedure>");
/* save the continuation object in proc */ /* save the continuation object in proc */
pic_proc_cv_set(pic, c, 0, pic_obj_value(cont)); pic_attr_set(pic, c, "@@cont", pic_obj_value(cont));
return pic_apply_trampoline(pic, proc, pic_list1(pic, pic_obj_value(c))); return pic_apply_trampoline(pic, proc, pic_list1(pic, pic_obj_value(c)));
} }

View File

@ -59,15 +59,15 @@ pic_attr(pic_state *pic, struct pic_proc *proc)
} }
pic_value pic_value
pic_proc_cv_ref(pic_state *pic, struct pic_proc *proc, size_t i) pic_attr_ref(pic_state *pic, struct pic_proc *proc, const char *key)
{ {
return pic_dict_ref(pic, pic_attr(pic, proc), i); /* FIXME */ return pic_dict_ref(pic, pic_attr(pic, proc), pic_intern_cstr(pic, key));
} }
void void
pic_proc_cv_set(pic_state *pic, struct pic_proc *proc, size_t i, pic_value v) pic_attr_set(pic_state *pic, struct pic_proc *proc, const char *key, pic_value v)
{ {
pic_dict_set(pic, pic_attr(pic, proc), i, v); /* FIXME */ pic_dict_set(pic, pic_attr(pic, proc), pic_intern_cstr(pic, key), v);
} }
static pic_value static pic_value