remove pic_applyk
This commit is contained in:
parent
69b660e9a3
commit
e8a6f64dd5
|
@ -254,7 +254,7 @@ pic_callcc_full(pic_state *pic, struct pic_proc *proc)
|
|||
/* save the continuation object in proc */
|
||||
pic_proc_env_set(pic, c, "cont", pic_obj_value(dat));
|
||||
|
||||
return pic_apply1(pic, proc, pic_obj_value(c));
|
||||
return pic_call(pic, proc, 1, pic_obj_value(c));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -389,7 +389,7 @@ pic_socket_call_with_socket(pic_state *pic)
|
|||
sock = pic_socket_data_ptr(obj);
|
||||
ensure_socket_is_open(pic, sock);
|
||||
|
||||
result = pic_apply1(pic, proc, obj);
|
||||
result = pic_call(pic, proc, 1, obj);
|
||||
|
||||
socket_close(sock);
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ pic_wind(pic_state *pic, pic_checkpoint *here, pic_checkpoint *there)
|
|||
|
||||
if (here->depth < there->depth) {
|
||||
pic_wind(pic, here, there->prev);
|
||||
pic_apply0(pic, there->in);
|
||||
pic_call(pic, there->in, 0);
|
||||
}
|
||||
else {
|
||||
pic_apply0(pic, there->out);
|
||||
pic_call(pic, there->out, 0);
|
||||
pic_wind(pic, here->prev, there);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ pic_dynamic_wind(pic_state *pic, struct pic_proc *in, struct pic_proc *thunk, st
|
|||
pic_value val;
|
||||
|
||||
if (in != NULL) {
|
||||
pic_apply0(pic, in); /* enter */
|
||||
pic_call(pic, in, 0); /* enter */
|
||||
}
|
||||
|
||||
here = pic->cp;
|
||||
|
@ -37,12 +37,12 @@ pic_dynamic_wind(pic_state *pic, struct pic_proc *in, struct pic_proc *thunk, st
|
|||
pic->cp->in = in;
|
||||
pic->cp->out = out;
|
||||
|
||||
val = pic_apply0(pic, thunk);
|
||||
val = pic_call(pic, thunk, 0);
|
||||
|
||||
pic->cp = here;
|
||||
|
||||
if (out != NULL) {
|
||||
pic_apply0(pic, out); /* exit */
|
||||
pic_call(pic, out, 0); /* exit */
|
||||
}
|
||||
|
||||
return val;
|
||||
|
@ -146,7 +146,7 @@ pic_callcc(pic_state *pic, struct pic_proc *proc)
|
|||
else {
|
||||
pic_value val;
|
||||
|
||||
val = pic_apply1(pic, proc, pic_obj_value(pic_make_cont(pic, &cont)));
|
||||
val = pic_call(pic, proc, 1, pic_obj_value(pic_make_cont(pic, &cont)));
|
||||
|
||||
pic->cc = pic->cc->prev;
|
||||
|
||||
|
@ -293,7 +293,7 @@ pic_cont_call_with_values(pic_state *pic)
|
|||
|
||||
pic_get_args(pic, "ll", &producer, &consumer);
|
||||
|
||||
pic_apply0(pic, producer);
|
||||
pic_call(pic, producer, 0);
|
||||
|
||||
argc = pic_receive(pic, 0, NULL);
|
||||
args = pic_make_vec(pic, argc);
|
||||
|
|
|
@ -166,7 +166,7 @@ pic_dict_dictionary_map(pic_state *pic)
|
|||
|
||||
for (it = kh_begin(kh); it != kh_end(kh); ++it) {
|
||||
if (kh_exist(kh, it)) {
|
||||
pic_push(pic, pic_apply1(pic, proc, pic_obj_value(kh_key(kh, it))), ret);
|
||||
pic_push(pic, pic_call(pic, proc, 1, pic_obj_value(kh_key(kh, it))), ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ pic_dict_dictionary_for_each(pic_state *pic)
|
|||
|
||||
for (it = kh_begin(kh); it != kh_end(kh); ++it) {
|
||||
if (kh_exist(kh, it)) {
|
||||
pic_apply1(pic, proc, pic_obj_value(kh_key(kh, it)));
|
||||
pic_call(pic, proc, 1, pic_obj_value(kh_key(kh, it)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ pic_native_exception_handler(pic_state *pic)
|
|||
|
||||
cont = pic_proc_ptr(pic_proc_env_ref(pic, self, "cont"));
|
||||
|
||||
pic_apply1(pic, cont, pic_false_value());
|
||||
pic_call(pic, cont, 1, pic_false_value());
|
||||
|
||||
PIC_UNREACHABLE();
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ pic_raise_continuable(pic_state *pic, pic_value err)
|
|||
|
||||
pic_gc_protect(pic, pic_obj_value(handler));
|
||||
|
||||
v = pic_apply1(pic, handler, err);
|
||||
v = pic_call(pic, handler, 1, err);
|
||||
|
||||
pic_push_handler(pic, handler);
|
||||
|
||||
|
@ -156,7 +156,7 @@ pic_error_with_exception_handler(pic_state *pic)
|
|||
|
||||
pic_push_handler(pic, handler);
|
||||
|
||||
val = pic_apply0(pic, thunk);
|
||||
val = pic_call(pic, thunk, 0);
|
||||
|
||||
pic_pop_handler(pic);
|
||||
|
||||
|
|
|
@ -892,7 +892,7 @@ pic_eval(pic_state *pic, pic_value program, struct pic_lib *lib)
|
|||
|
||||
pic->lib = lib;
|
||||
pic_try {
|
||||
r = pic_apply0(pic, pic_compile(pic, pic_expand(pic, program, lib->env)));
|
||||
r = pic_call(pic, pic_compile(pic, pic_expand(pic, program, lib->env)), 0);
|
||||
}
|
||||
pic_catch {
|
||||
pic->lib = prev_lib;
|
||||
|
|
|
@ -164,15 +164,10 @@ PIC_NORETURN void pic_errorf(pic_state *, const char *, ...);
|
|||
pic_value pic_call(pic_state *, struct pic_proc *, int, ...);
|
||||
pic_value pic_vcall(pic_state *, struct pic_proc *, int, va_list);
|
||||
pic_value pic_apply(pic_state *, struct pic_proc *, int, pic_value *);
|
||||
pic_value pic_apply0(pic_state *, struct pic_proc *);
|
||||
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_apply3(pic_state *, struct pic_proc *, pic_value, pic_value, pic_value);
|
||||
pic_value pic_apply4(pic_state *, struct pic_proc *, pic_value, pic_value, pic_value, pic_value);
|
||||
pic_value pic_apply5(pic_state *, struct pic_proc *, pic_value, pic_value, pic_value, pic_value, pic_value);
|
||||
pic_value pic_apply_list(pic_state *, struct pic_proc *, pic_value);
|
||||
pic_value pic_apply_trampoline(pic_state *, struct pic_proc *, int, pic_value *);
|
||||
pic_value pic_apply_trampoline_list(pic_state *, struct pic_proc *, pic_value);
|
||||
|
||||
pic_value pic_eval(pic_state *, pic_value, struct pic_lib *);
|
||||
|
||||
bool pic_eq_p(pic_value, pic_value);
|
||||
|
|
|
@ -155,7 +155,7 @@ expand_var(pic_state *pic, pic_id *id, struct pic_env *env, pic_value deferred)
|
|||
functor = pic_lookup_identifier(pic, id, env);
|
||||
|
||||
if ((mac = find_macro(pic, functor)) != NULL) {
|
||||
return expand(pic, pic_apply2(pic, mac, pic_obj_value(id), pic_obj_value(env)), env, deferred);
|
||||
return expand(pic, pic_call(pic, mac, 2, pic_obj_value(id), pic_obj_value(env)), env, deferred);
|
||||
}
|
||||
return pic_obj_value(functor);
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ expand_defmacro(pic_state *pic, pic_value expr, struct pic_env *env)
|
|||
uid = pic_add_identifier(pic, id, env);
|
||||
}
|
||||
|
||||
val = pic_apply0(pic, pic_compile(pic, pic_expand(pic, pic_list_ref(pic, expr, 2), env)));
|
||||
val = pic_call(pic, pic_compile(pic, pic_expand(pic, pic_list_ref(pic, expr, 2), env)), 0);
|
||||
if (! pic_proc_p(val)) {
|
||||
pic_errorf(pic, "macro definition \"~s\" evaluates to non-procedure object", pic_identifier_name(pic, id));
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ expand_node(pic_state *pic, pic_value expr, struct pic_env *env, pic_value defer
|
|||
}
|
||||
|
||||
if ((mac = find_macro(pic, functor)) != NULL) {
|
||||
return expand(pic, pic_apply2(pic, mac, expr, pic_obj_value(env)), env, deferred);
|
||||
return expand(pic, pic_call(pic, mac, 2, expr, pic_obj_value(env)), env, deferred);
|
||||
}
|
||||
}
|
||||
return expand_list(pic, expr, env, deferred);
|
||||
|
|
|
@ -274,7 +274,7 @@ pic_member(pic_state *pic, pic_value key, pic_value list, struct pic_proc *compa
|
|||
if (pic_equal_p(pic, key, pic_car(pic, list)))
|
||||
return list;
|
||||
} else {
|
||||
if (pic_test(pic_apply2(pic, compar, key, pic_car(pic, list))))
|
||||
if (pic_test(pic_call(pic, compar, 2, key, pic_car(pic, list))))
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ pic_assoc(pic_state *pic, pic_value key, pic_value assoc, struct pic_proc *compa
|
|||
if (pic_equal_p(pic, key, pic_car(pic, cell)))
|
||||
return cell;
|
||||
} else {
|
||||
if (pic_test(pic_apply2(pic, compar, key, pic_car(pic, cell))))
|
||||
if (pic_test(pic_call(pic, compar, 2, key, pic_car(pic, cell))))
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ pic_port_call_with_port(pic_state *pic)
|
|||
|
||||
pic_get_args(pic, "pl", &port, &proc);
|
||||
|
||||
value = pic_apply1(pic, proc, pic_obj_value(port));
|
||||
value = pic_call(pic, proc, 1, pic_obj_value(port));
|
||||
|
||||
pic_close_port(pic, port);
|
||||
|
||||
|
|
|
@ -869,60 +869,6 @@ pic_apply_trampoline_list(pic_state *pic, struct pic_proc *proc, pic_value args)
|
|||
return pic_apply_trampoline(pic, proc, argc, argv->data);
|
||||
}
|
||||
|
||||
static pic_value
|
||||
pic_va_apply(pic_state *pic, struct pic_proc *proc, int n, ...)
|
||||
{
|
||||
pic_vec *args = pic_make_vec(pic, n);
|
||||
va_list ap;
|
||||
int i = 0;
|
||||
|
||||
va_start(ap, n);
|
||||
|
||||
while (i < n) {
|
||||
args->data[i++] = va_arg(ap, pic_value);
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
|
||||
return pic_apply(pic, proc, n, args->data);
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply0(pic_state *pic, struct pic_proc *proc)
|
||||
{
|
||||
return pic_va_apply(pic, proc, 0);
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply1(pic_state *pic, struct pic_proc *proc, pic_value arg1)
|
||||
{
|
||||
return pic_va_apply(pic, proc, 1, arg1);
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply2(pic_state *pic, struct pic_proc *proc, pic_value arg1, pic_value arg2)
|
||||
{
|
||||
return pic_va_apply(pic, proc, 2, arg1, arg2);
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply3(pic_state *pic, struct pic_proc *proc, pic_value arg1, pic_value arg2, pic_value arg3)
|
||||
{
|
||||
return pic_va_apply(pic, proc, 3, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply4(pic_state *pic, struct pic_proc *proc, pic_value arg1, pic_value arg2, pic_value arg3, pic_value arg4)
|
||||
{
|
||||
return pic_va_apply(pic, proc, 4, arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply5(pic_state *pic, struct pic_proc *proc, pic_value arg1, pic_value arg2, pic_value arg3, pic_value arg4, pic_value arg5)
|
||||
{
|
||||
return pic_va_apply(pic, proc, 5, arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
|
||||
void
|
||||
pic_define(pic_state *pic, struct pic_lib *lib, const char *name, pic_value val)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ static pic_value
|
|||
var_conv(pic_state *pic, struct pic_proc *var, pic_value val)
|
||||
{
|
||||
if (pic_proc_env_has(pic, var, "conv") != 0) {
|
||||
return pic_apply1(pic, pic_proc_ptr(pic_proc_env_ref(pic, var, "conv")), val);
|
||||
return pic_call(pic, pic_proc_ptr(pic_proc_env_ref(pic, var, "conv")), 1, val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ pic_make_var(pic_state *pic, pic_value init, struct pic_proc *conv)
|
|||
pic_proc_env_set(pic, var, "conv", pic_obj_value(conv));
|
||||
}
|
||||
|
||||
pic_apply1(pic, var, init);
|
||||
pic_call(pic, var, 1, init);
|
||||
|
||||
return var;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ pic_var_with_parameter(pic_state *pic)
|
|||
|
||||
pic->ptable = pic_cons(pic, pic_obj_value(pic_make_weak(pic)), pic->ptable);
|
||||
|
||||
val = pic_apply0(pic, body);
|
||||
val = pic_call(pic, body, 0);
|
||||
|
||||
pic->ptable = pic_cdr(pic, pic->ptable);
|
||||
|
||||
|
|
Loading…
Reference in New Issue