delete pic_apply_argv
This commit is contained in:
parent
e51f0d6dc3
commit
6ea78fbf27
|
@ -157,7 +157,6 @@ pic_list pic_parse_cstr(pic_state *, const char *);
|
||||||
pic_value pic_load(pic_state *, const char *);
|
pic_value pic_load(pic_state *, const char *);
|
||||||
|
|
||||||
pic_value pic_apply(pic_state *, struct pic_proc *, pic_value);
|
pic_value pic_apply(pic_state *, struct pic_proc *, pic_value);
|
||||||
pic_value pic_apply_argv(pic_state *, struct pic_proc *, size_t, ...);
|
|
||||||
pic_value pic_apply0(pic_state *, struct pic_proc *);
|
pic_value pic_apply0(pic_state *, struct pic_proc *);
|
||||||
pic_value pic_apply1(pic_state *, struct pic_proc *, pic_value);
|
pic_value pic_apply1(pic_state *, struct pic_proc *, pic_value);
|
||||||
pic_value pic_apply2(pic_state *, struct pic_proc *, pic_value, pic_value);
|
pic_value pic_apply2(pic_state *, struct pic_proc *, pic_value, pic_value);
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct pic_cont {
|
||||||
pic_block *_a; \
|
pic_block *_a; \
|
||||||
while (pic->blk) { \
|
while (pic->blk) { \
|
||||||
if (pic->blk->out) \
|
if (pic->blk->out) \
|
||||||
pic_apply_argv(pic, pic->blk->out, 0); \
|
pic_apply0(pic, pic->blk->out); \
|
||||||
_a = pic->blk->prev; \
|
_a = pic->blk->prev; \
|
||||||
PIC_BLK_DECREF(pic, pic->blk); \
|
PIC_BLK_DECREF(pic, pic->blk); \
|
||||||
pic->blk = _a; \
|
pic->blk = _a; \
|
||||||
|
|
12
src/cont.c
12
src/cont.c
|
@ -179,10 +179,10 @@ walk_to_block(pic_state *pic, pic_block *here, pic_block *there)
|
||||||
|
|
||||||
if (here->depth < there->depth) {
|
if (here->depth < there->depth) {
|
||||||
walk_to_block(pic, here, there->prev);
|
walk_to_block(pic, here, there->prev);
|
||||||
pic_apply_argv(pic, there->in, 0);
|
pic_apply0(pic, there->in);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pic_apply_argv(pic, there->out, 0);
|
pic_apply0(pic, there->out);
|
||||||
walk_to_block(pic, here->prev, there);
|
walk_to_block(pic, here->prev, there);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ pic_callcc(pic_state *pic, struct pic_proc *proc)
|
||||||
pic_proc_cv_init(pic, c, 1);
|
pic_proc_cv_init(pic, c, 1);
|
||||||
pic_proc_cv_set(pic, c, 0, pic_obj_value(cont));
|
pic_proc_cv_set(pic, c, 0, pic_obj_value(cont));
|
||||||
|
|
||||||
return pic_apply_argv(pic, proc, 1, pic_obj_value(c));
|
return pic_apply1(pic, proc, pic_obj_value(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ pic_cont_dynamic_wind(pic_state *pic)
|
||||||
pic_get_args(pic, "lll", &in, &thunk, &out);
|
pic_get_args(pic, "lll", &in, &thunk, &out);
|
||||||
|
|
||||||
/* enter */
|
/* enter */
|
||||||
pic_apply_argv(pic, in, 0);
|
pic_apply0(pic, in);
|
||||||
{
|
{
|
||||||
pic_block *here;
|
pic_block *here;
|
||||||
|
|
||||||
|
@ -283,13 +283,13 @@ pic_cont_dynamic_wind(pic_state *pic)
|
||||||
pic->blk->refcnt = 1;
|
pic->blk->refcnt = 1;
|
||||||
PIC_BLK_INCREF(pic, here);
|
PIC_BLK_INCREF(pic, here);
|
||||||
|
|
||||||
v = pic_apply_argv(pic, thunk, 0);
|
v = pic_apply0(pic, thunk);
|
||||||
|
|
||||||
PIC_BLK_DECREF(pic, pic->blk);
|
PIC_BLK_DECREF(pic, pic->blk);
|
||||||
pic->blk = here;
|
pic->blk = here;
|
||||||
}
|
}
|
||||||
/* exit */
|
/* exit */
|
||||||
pic_apply_argv(pic, out, 0);
|
pic_apply0(pic, out);
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,13 +109,13 @@ pic_error_with_exception_handler(pic_state *pic)
|
||||||
pic_get_args(pic, "ll", &handler, &thunk);
|
pic_get_args(pic, "ll", &handler, &thunk);
|
||||||
|
|
||||||
pic_try {
|
pic_try {
|
||||||
v = pic_apply_argv(pic, thunk, 0);
|
v = pic_apply0(pic, thunk);
|
||||||
}
|
}
|
||||||
pic_catch {
|
pic_catch {
|
||||||
struct pic_error *e = pic->err;
|
struct pic_error *e = pic->err;
|
||||||
|
|
||||||
pic->err = NULL;
|
pic->err = NULL;
|
||||||
v = pic_apply_argv(pic, handler, 1, pic_obj_value(e));
|
v = pic_apply1(pic, handler, pic_obj_value(e));
|
||||||
pic_errorf(pic, "error handler returned ~s, by error ~s", v, pic_obj_value(e));
|
pic_errorf(pic, "error handler returned ~s, by error ~s", v, pic_obj_value(e));
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
|
|
|
@ -774,7 +774,7 @@ er_macro_call(pic_state *pic)
|
||||||
|
|
||||||
cb = pic_proc_ptr(pic_proc_cv_ref(pic, pic_get_proc(pic), 0));
|
cb = pic_proc_ptr(pic_proc_cv_ref(pic, pic_get_proc(pic), 0));
|
||||||
|
|
||||||
return pic_apply_argv(pic, cb, 3, expr, pic_obj_value(rename), pic_obj_value(compare));
|
return pic_apply3(pic, cb, expr, pic_obj_value(rename), pic_obj_value(compare));
|
||||||
}
|
}
|
||||||
|
|
||||||
static pic_value
|
static pic_value
|
||||||
|
@ -898,7 +898,7 @@ ir_macro_call(pic_state *pic)
|
||||||
cb = pic_proc_ptr(pic_proc_cv_ref(pic, pic_get_proc(pic), 0));
|
cb = pic_proc_ptr(pic_proc_cv_ref(pic, pic_get_proc(pic), 0));
|
||||||
|
|
||||||
expr = ir_macro_wrap(pic, expr, pic_senv_ptr(use_env), &assoc);
|
expr = ir_macro_wrap(pic, expr, pic_senv_ptr(use_env), &assoc);
|
||||||
expr = pic_apply_argv(pic, cb, 3, expr, pic_obj_value(inject), pic_obj_value(compare));
|
expr = pic_apply3(pic, cb, expr, pic_obj_value(inject), pic_obj_value(compare));
|
||||||
expr = ir_macro_unwrap(pic, expr, pic_senv_ptr(mac_env), &assoc);
|
expr = ir_macro_unwrap(pic, expr, pic_senv_ptr(mac_env), &assoc);
|
||||||
return expr;
|
return expr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ void
|
||||||
pic_var_set(pic_state *pic, struct pic_var *var, pic_value value)
|
pic_var_set(pic_state *pic, struct pic_var *var, pic_value value)
|
||||||
{
|
{
|
||||||
if (var->conv) {
|
if (var->conv) {
|
||||||
value = pic_apply_argv(pic, var->conv, 1, value);
|
value = pic_apply1(pic, var->conv, value);
|
||||||
}
|
}
|
||||||
pic_var_set_force(pic, var, value);
|
pic_var_set_force(pic, var, value);
|
||||||
}
|
}
|
||||||
|
|
18
src/vm.c
18
src/vm.c
|
@ -484,24 +484,6 @@ pic_apply5(pic_state *pic, struct pic_proc *proc, pic_value arg1, pic_value arg2
|
||||||
return pic_apply(pic, proc, pic_list5(pic, arg1, arg2, arg3, arg4, arg5));
|
return pic_apply(pic, proc, pic_list5(pic, arg1, arg2, arg3, arg4, arg5));
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
|
||||||
pic_apply_argv(pic_state *pic, struct pic_proc *proc, size_t argc, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
pic_value v;
|
|
||||||
|
|
||||||
va_start(ap, argc);
|
|
||||||
|
|
||||||
v = pic_nil_value();
|
|
||||||
while (argc--) {
|
|
||||||
v = pic_cons(pic, va_arg(ap, pic_value), v);
|
|
||||||
}
|
|
||||||
v = pic_reverse(pic, v);
|
|
||||||
|
|
||||||
va_end(ap);
|
|
||||||
return pic_apply(pic, proc, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if VM_DEBUG
|
#if VM_DEBUG
|
||||||
# define OPCODE_EXEC_HOOK pic_dump_code(c)
|
# define OPCODE_EXEC_HOOK pic_dump_code(c)
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue