add arity-fixed apply functions
This commit is contained in:
parent
4b13848cbc
commit
e51f0d6dc3
|
@ -158,6 +158,12 @@ pic_value pic_load(pic_state *, const char *);
|
|||
|
||||
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_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_trampoline(pic_state *, struct pic_proc *, pic_value);
|
||||
pic_value pic_eval(pic_state *, pic_value);
|
||||
struct pic_proc *pic_compile(pic_state *, pic_value);
|
||||
|
|
36
src/vm.c
36
src/vm.c
|
@ -448,6 +448,42 @@ vm_tear_off(pic_state *pic)
|
|||
env->regs = env->storage;
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply0(pic_state *pic, struct pic_proc *proc)
|
||||
{
|
||||
return pic_apply(pic, proc, pic_nil_value());
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply1(pic_state *pic, struct pic_proc *proc, pic_value arg1)
|
||||
{
|
||||
return pic_apply(pic, proc, pic_list1(pic, arg1));
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply2(pic_state *pic, struct pic_proc *proc, pic_value arg1, pic_value arg2)
|
||||
{
|
||||
return pic_apply(pic, proc, pic_list2(pic, arg1, arg2));
|
||||
}
|
||||
|
||||
pic_value
|
||||
pic_apply3(pic_state *pic, struct pic_proc *proc, pic_value arg1, pic_value arg2, pic_value arg3)
|
||||
{
|
||||
return pic_apply(pic, proc, pic_list3(pic, 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_apply(pic, proc, pic_list4(pic, 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_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, ...)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue