2
Copyright (C) 1994 M. Hagiya, W. Schelter, T. Yuasa
4
This file is part of GNU Common Lisp, herein referred to as GCL
6
GCL is free software; you can redistribute it and/or modify it under
7
the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
GCL is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14
License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with GCL; see the file COPYING. If not, write to the Free Software
18
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27
#include "sfun_argd.h"
30
call_applyhook(object);
33
struct nil3 { object nil3_self[3]; } three_nils;
37
unsigned long avma,bot;
38
#define DEBUG_AVMA unsigned long saved_avma = avma;
41
print(list(2,make_simple_string("avma changed"),ihs_top_function_name(ihs_top)),
42
sLAstandard_outputA->s.s_dbind);
44
#define CHECK_AVMA if(avma!= saved_avma) warn_avma();
45
#define DEBUGGING_AVMA
53
/* object c_apply_n(long int (*fn)(), int n, object *x); */
55
object sSAbreak_pointsA;
56
object sSAbreak_stepA;
59
/* This is a temporary workaround. m68k cannot find the result
60
of a function returning long when invoked via a function pointer
61
declared as a function returning a pointer, in this case, an
62
object. A proper fix will require rewriting sections of the lisp
63
compiler to separate the calling procedures for functions returning
64
an object from functions returning a long. CM 20020801 */
65
/* #if defined(__mc68020__) */
66
/* #define LCAST(a) (object)(*(long(*)())a) */
71
#define SET_TO_APPLY(res,f,n,x) \
73
case 0: res=LCAST(f)(); break;\
74
case 1: res=LCAST(f)(x[0]); break; \
75
case 2: res=LCAST(f)(x[0],x[1]);break; \
76
case 3: res=LCAST(f)(x[0],x[1],x[2]);break; \
77
case 4: res=LCAST(f)(x[0],x[1],x[2],x[3]);break; \
78
case 5: res=LCAST(f)(x[0],x[1],x[2],x[3],x[4]);break; \
79
case 6: res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5]); break;\
80
case 7: res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5], x[6]); break;\
81
case 8: res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5], x[6],x[7]); break;\
82
case 9: res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8]);break;\
83
case 10: res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9]);break;\
84
default: res=c_apply_n(*f,n,x); break;}
88
#define SET_TO_APPLY(res,f,n,x) res=c_apply_n(f,n,x);
91
/* for t_sfun,t_gfun with args on vs stack */
94
quick_call_sfun(object fun)
96
int i=fun->sfn.sfn_argd,n=SFUN_NARGS(i);
99
object *temp_ar=alloca(n*sizeof(object));
100
/* i=fun->sfn.sfn_argd; */
101
/* n=SFUN_NARGS(i); */
103
if (n != vs_top - base)
104
{check_arg_failed(n);}
105
restype = SFUN_RETURN_TYPE(i);
106
SFUN_START_ARG_TYPES(i);
107
/* for moment just support object and int */
108
#define COERCE_ARG(a,type) (type==f_object ? a : (object)(fix(a)))
115
{enum ftype typ=SFUN_NEXT_TYPE(i);
116
x[j]=COERCE_ARG(vs_base[j],typ);}}
117
SET_TO_APPLY(res,fun->sfn.sfn_self,n,x);
119
(restype==f_object ? res :
120
restype==f_fixnum ? make_fixnum((long)res)
121
:(object) (FEerror("Bad result type",0),Cnil));
127
/* only for sfun not gfun !! Does not check number of args */
129
call_sfun_no_check(object fun)
132
object *base=vs_base;
134
SET_TO_APPLY(base[0],fun->sfn.sfn_self,n,base);
135
vs_top=(vs_base=base)+1;
140
call_vfun(object fun)
143
object *base=vs_base;
145
if (n < fun->vfn.vfn_minargs)
146
{FEtoo_few_arguments(base,vs_top); return;}
147
if (n > fun->vfn.vfn_maxargs)
148
{FEtoo_many_arguments(base,vs_top); return;}
150
SET_TO_APPLY(base[0],fun->sfn.sfn_self,n,base);
151
vs_top=(vs_base=base)+1;
170
FEerror("Undefined function.", 0);
171
switch (type_of(fun)) {
177
ihs_check;ihs_push(fun);
178
quick_call_sfun(fun);
182
ihs_check;ihs_push(fun);
188
{ object res,*b = vs_base;
190
res = (object)IapplyVector(fun,n,b);
194
while (--n> 0 ) b[n] = fcall.values[n];
200
object *top, *base, l;
202
if (fun->cc.cc_turbo != NULL) {
203
MMccall(fun, fun->cc.cc_turbo);
208
for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr)
218
{object x = fun->s.s_gfdef;
219
if (x) { fun = x; goto TOP;}
221
FEundefined_function(fun);
228
FEinvalid_function(fun);
232
This part is the same as that of funcall_no_event.
235
/* we may have pushed the calling form if this is called invoked from
236
eval. A lambda call requires vs_push's, so we can tell
237
if we pushed by vs_base being the same.
239
{ VOL int not_pushed = 0;
240
if (vs_base != ihs_top->ihs_base){
247
ihs_top->ihs_base = lex_env;
251
old_bds_top = bds_top;
253
/* maybe digest this lambda expression
254
(lambda-block-expand name ..) has already been
255
expanded. The value of lambda-block-expand may
256
be a compiled function in which case we say expand
260
if (x == sSlambda_block_expanded) {
266
}else if (x == sLlambda_block) {
269
if(sSlambda_block_expanded->s.s_dbind)
270
fun = ifuncall1(sSlambda_block_expanded->s.s_dbind,fun);
276
} else if (x == sLlambda_closure) {
280
} else if (x == sLlambda) {
283
} else if (x == sLlambda_block_closure) {
296
*(struct nil3 *)vs_top = three_nils;
300
x = kar(fun); /* block name */
306
ihs_top->ihs_base = lex_env;
308
fun = temporary = alloc_frame_id();
309
/* lex_block_bind(x, temporary); */
310
temporary = MMcons(temporary, Cnil);
311
temporary = MMcons(sLblock, temporary);
312
temporary = MMcons(x, temporary);
313
lex_env[2] = MMcons(temporary, lex_env[2]);
314
frs_push(FRS_CATCH, fun);
320
x = top[3]; /* body */
337
bds_unwind(old_bds_top);
339
if (not_pushed == 0) {ihs_pop();}
344
funcall_no_event(object fun)
348
FEerror("Undefined function.", 0);
349
switch (type_of(fun)) {
351
(*fun->cf.cf_self)();
356
object *top, *base, l;
358
if (fun->cc.cc_turbo != NULL) {
359
(*fun->cc.cc_self)(fun->cc.cc_turbo);
364
for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr)
369
(*fun->cc.cc_self)(top);
374
/* call_sfun_no_check(fun); return; */
376
quick_call_sfun(fun); return;
378
call_vfun(fun); return;
387
lispcall(object *funp, int narg)
393
vs_top = vs_base + narg;
396
FEerror("Undefined function.", 0);
397
switch (type_of(fun)) {
404
object *top, *base, l;
406
if (fun->cc.cc_turbo != NULL) {
407
MMccall(fun, fun->cc.cc_turbo);
412
for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr)
429
lispcall_no_event(object *funp, int narg)
435
vs_top = vs_base + narg;
438
FEerror("Undefined function.", 0);
439
switch (type_of(fun)) {
441
(*fun->cf.cf_self)();
446
object *top, *base, l;
448
if (fun->cc.cc_turbo != NULL) {
449
(*fun->cc.cc_self)(fun->cc.cc_turbo);
454
for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr)
459
(*fun->cc.cc_self)(top);
472
symlispcall(object sym, object *base, int narg)
475
object fun = symbol_function(sym);
478
vs_top = vs_base + narg;
481
FEerror("Undefined function.", 0);
482
switch (type_of(fun)) {
489
object *top, *base, l;
491
if (fun->cc.cc_turbo != NULL) {
492
MMccall(fun, fun->cc.cc_turbo);
497
for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr)
513
symlispcall_no_event(object sym, object *base, int narg)
516
object fun = symbol_function(sym);
519
vs_top = vs_base + narg;
522
FEerror("Undefined function.", 0);
523
switch (type_of(fun)) {
525
(*fun->cf.cf_self)();
530
object *top, *base, l;
532
if (fun->cc.cc_turbo != NULL) {
533
(*fun->cc.cc_self)(fun->cc.cc_turbo);
538
for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr)
543
(*fun->cc.cc_self)(top);
555
simple_lispcall(object *funp, int narg)
559
object *sup = vs_top;
562
vs_top = vs_base + narg;
565
FEerror("Undefined function.", 0);
566
switch (type_of(fun)) {
573
object *top, *base, l;
575
if (fun->cc.cc_turbo != NULL) {
576
MMccall(fun, fun->cc.cc_turbo);
581
for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr)
600
/* simple_lispcall_no_event(object *funp, int narg) */
603
/* object fun = *funp; */
604
/* object *sup = vs_top; */
606
/* vs_base = funp + 1; */
607
/* vs_top = vs_base + narg; */
609
/* if (fun == OBJNULL) */
610
/* FEerror("Undefined function.", 0); */
611
/* switch (type_of(fun)) { */
613
/* (*fun->cf.cf_self)(); */
616
/* case t_cclosure: */
618
/* object *top, *base, l; */
620
/* if (fun->cc.cc_turbo != NULL) { */
621
/* (*fun->cc.cc_self)(fun->cc.cc_turbo); */
625
/* base = vs_base; */
626
/* for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr) */
628
/* vs_base = vs_top; */
629
/* while (base < top) */
630
/* vs_push(*base++); */
631
/* (*fun->cc.cc_self)(top); */
641
/* return(vs_base[0]); */
645
simple_symlispcall(object sym, object *base, int narg)
648
object fun = symbol_function(sym);
649
object *sup = vs_top;
652
vs_top = vs_base + narg;
655
FEerror("Undefined function.", 0);
656
switch (type_of(fun)) {
663
object *top, *base, l;
665
if (fun->cc.cc_turbo != NULL) {
666
MMccall(fun, fun->cc.cc_turbo);
671
for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr)
690
/* simple_symlispcall_no_event(object sym, object *base, int narg) */
693
/* object fun = symbol_function(sym); */
694
/* object *sup = vs_top; */
696
/* vs_base = base; */
697
/* vs_top = vs_base + narg; */
699
/* if (fun == OBJNULL) */
700
/* FEerror("Undefined function.", 0); */
701
/* switch (type_of(fun)) { */
703
/* (*fun->cf.cf_self)(); */
706
/* case t_cclosure: */
708
/* object *top, *base, l; */
710
/* if (fun->cc.cc_turbo != NULL) { */
711
/* (*fun->cc.cc_self)(fun->cc.cc_turbo); */
715
/* base = vs_base; */
716
/* for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr) */
718
/* vs_base = vs_top; */
719
/* while (base < top) */
720
/* vs_push(*base++); */
721
/* (*fun->cc.cc_self)(top); */
730
/* return(vs_base[0]); */
734
super_funcall(object fun)
736
if (type_of(fun) == t_symbol) {
737
if (fun->s.s_sfdef != NOT_SPECIAL || fun->s.s_mflag)
738
FEinvalid_function(fun);
739
if (fun->s.s_gfdef == OBJNULL)
740
FEundefined_function(fun);
741
fun = fun->s.s_gfdef;
747
super_funcall_no_event(object fun)
749
#ifdef DEBUGGING_AVMA
750
funcall_no_event(fun); return;
752
if (type_of(fun)==t_cfun){(*fun->cf.cf_self)();return;}
753
if (type_of(fun)==t_sfun){call_sfun_no_check(fun); return;}
754
if (type_of(fun)==t_gfun)
755
{quick_call_sfun(fun); return;}
756
if (type_of(fun)==t_vfun)
757
{call_vfun(fun); return;}
758
if (type_of(fun) == t_symbol) {
759
if (fun->s.s_sfdef != NOT_SPECIAL || fun->s.s_mflag)
760
FEinvalid_function(fun);
761
if (fun->s.s_gfdef == OBJNULL)
762
FEundefined_function(fun);
763
fun = fun->s.s_gfdef;
764
if (type_of(fun)==t_cfun){(*fun->cf.cf_self)();
767
funcall_no_event(fun);
770
#ifdef USE_BROKEN_IEVAL
787
if (Vevalhook->s.s_dbind != Cnil && eval1 == 0)
789
bds_ptr old_bds_top = bds_top;
790
object hookfun = symbol_value(Vevalhook);
791
/* check if Vevalhook is unbound */
793
bds_bind(Vevalhook, Cnil);
794
form = Ifuncall_n(hookfun,2,form,list(3,lex_env[0],lex_env[1],lex_env[2]));
795
bds_unwind(old_bds_top);
800
if (type_of(form) == t_cons)
803
if (type_of(form) != t_symbol) RETURN1(form);
805
switch (form->s.s_stype) {
807
RETURN1((form->s.s_dbind));
810
if(form->s.s_dbind == OBJNULL)
811
FEunbound_variable(form);
812
RETURN1((form->s.s_dbind));
815
/* x = lex_var_sch(form); */
816
for (x = lex_env[0]; type_of(x) == t_cons; x = x->c.c_cdr)
817
if (x->c.c_car->c.c_car == form) {
818
x = x->c.c_car->c.c_cdr;
821
RETURN1((x->c.c_car));
823
if(form->s.s_dbind == OBJNULL)
824
FEunbound_variable(form);
825
RETURN1((form->s.s_dbind));
829
/* Hook for possibly stopping at forms in the break point
830
list. Also for stepping. We only want to check
831
one form each time round, so we do *breakpoints*
833
if (sSAbreak_pointsA->s.s_dbind != Cnil)
834
{ if (sSAbreak_stepA->s.s_dbind == Cnil ||
835
ifuncall2(sSAbreak_stepA->s.s_dbind,form,
836
list(3,lex_env[0],lex_env[1],lex_env[2])) == Cnil)
837
{object* bpts = sSAbreak_pointsA->s.s_dbind->v.v_self;
838
int i = sSAbreak_pointsA->s.s_dbind->v.v_fillp;
840
{ if((*bpts)->c.c_car == form)
841
{ifuncall2(sSAbreak_pointsA->s.s_gfdef,form,
842
list(3,lex_env[0],lex_env[1],lex_env[2]));
849
if (type_of(fun) != t_symbol)
851
if (fun->s.s_sfdef != NOT_SPECIAL) {
854
ihs_top->ihs_base = lex_env;
855
(*fun->s.s_sfdef)(MMcdr(form));
860
/* x = lex_fd_sch(fun); */
861
for (x = lex_env[1]; type_of(x) == t_cons; x = x->c.c_cdr)
862
if (x->c.c_car->c.c_car == fun) {
864
if (MMcadr(x) == sLmacro) {
872
if ((x = fun->s.s_gfdef) == OBJNULL)
873
FEundefined_function(fun);
875
if (fun->s.s_mflag) {
878
form = Imacro_expand1(x, form);
888
ihs_top->ihs_base = lex_env;
889
form = form->c.c_cdr;
893
object ans = Ieval(MMcar(form));
897
n =top - base; /* number of args */
898
if (Vapplyhook->s.s_dbind != Cnil) {
900
base[0] = c_apply_n(list,n+1,base);
901
x = Ifuncall_n(Vapplyhook->s.s_dbind,3,
902
x, /* the function */
903
base[0], /* the arg list */
904
list(3,lex_env[0],lex_env[1],lex_env[2]));
905
vs_top = base; return x;
907
ihs_top->ihs_function = x;
908
ihs_top->ihs_base = vs_base;
909
x=IapplyVector(x,n,base+1);
917
if (type_of(fun) == t_cons && MMcar(fun) == sLlambda) {
918
x = listA(4,sLlambda_closure,lex_env[0],lex_env[1],lex_env[2],Mcdr(fun));
921
FEinvalid_function(fun);
948
if (Vevalhook->s.s_dbind != Cnil && eval1 == 0)
950
bds_ptr old_bds_top = bds_top;
951
object hookfun = symbol_value(Vevalhook);
952
/* check if Vevalhook is unbound */
954
bds_bind(Vevalhook, Cnil);
964
super_funcall(hookfun);
965
bds_unwind(old_bds_top);
970
if (type_of(form) == t_cons)
973
if (type_of(form) != t_symbol) {
979
switch (form->s.s_stype) {
982
vs_push(form->s.s_dbind);
986
if(form->s.s_dbind == OBJNULL)
987
FEunbound_variable(form);
989
vs_push(form->s.s_dbind);
993
/* x = lex_var_sch(form); */
994
for (x = lex_env[0]; type_of(x) == t_cons; x = x->c.c_cdr)
995
if (x->c.c_car->c.c_car == form) {
996
x = x->c.c_car->c.c_cdr;
1000
vs_push(x->c.c_car);
1003
if(form->s.s_dbind == OBJNULL)
1004
FEunbound_variable(form);
1006
vs_push(form->s.s_dbind);
1011
/* Hook for possibly stopping at forms in the break point
1012
list. Also for stepping. We only want to check
1013
one form each time round, so we do *breakpoints*
1015
if (sSAbreak_pointsA->s.s_dbind != Cnil)
1016
{ if (sSAbreak_stepA->s.s_dbind == Cnil ||
1017
ifuncall2(sSAbreak_stepA->s.s_dbind,form,
1018
list(3,lex_env[0],lex_env[1],lex_env[2])) == Cnil)
1019
{object* bpts = sSAbreak_pointsA->s.s_dbind->v.v_self;
1020
int i = sSAbreak_pointsA->s.s_dbind->v.v_fillp;
1022
{ if((*bpts)->c.c_car == form)
1023
{ifuncall2(sSAbreak_pointsA->s.s_gfdef,form,
1024
list(3,lex_env[0],lex_env[1],lex_env[2]));
1031
if (type_of(fun) != t_symbol)
1033
if (fun->s.s_sfdef != NOT_SPECIAL) {
1036
ihs_top->ihs_base = lex_env;
1037
(*fun->s.s_sfdef)(MMcdr(form));
1042
/* x = lex_fd_sch(fun); */
1043
for (x = lex_env[1]; type_of(x) == t_cons; x = x->c.c_cdr)
1044
if (x->c.c_car->c.c_car == fun) {
1046
if (MMcadr(x) == sLmacro) {
1054
if ((x = fun->s.s_gfdef) == OBJNULL)
1055
FEundefined_function(fun);
1057
if (fun->s.s_mflag) {
1060
form=Imacro_expand1(x, form);
1072
ihs_top->ihs_base = lex_env;
1073
form = form->c.c_cdr;
1076
while(!endp(form)) {
1078
top[0] = vs_base[0];
1083
if (Vapplyhook->s.s_dbind != Cnil) {
1084
call_applyhook(fun);
1087
ihs_top->ihs_function = x;
1088
ihs_top->ihs_base = vs_base;
1089
if (type_of(x) == t_cfun)
1090
(*(x)->cf.cf_self)();
1092
funcall_no_event(x);
1098
if (type_of(fun) == t_cons && MMcar(fun) == sLlambda) {
1099
temporary = make_cons(lex_env[2], fun->c.c_cdr);
1100
temporary = make_cons(lex_env[1], temporary);
1101
temporary = make_cons(lex_env[0], temporary);
1102
x = make_cons(sLlambda_closure, temporary);
1106
FEinvalid_function(fun);
1110
call_applyhook(object fun)
1115
ah = symbol_value(Vapplyhook);
1120
vs_push(vs_base[0]);
1122
vs_push(lex_env[0]);
1123
vs_push(lex_env[1]);
1124
vs_push(lex_env[2]);
1133
DEFUNO_NEW("FUNCALL",object,fLfuncall,LISP
1134
,1,MAX_ARGS,NONE,OO,OO,OO,OO,void,Lfuncall,(object fun,...),"")
1139
{COERCE_VA_LIST(new,ap,n);
1140
return IapplyVector(fun,n-1,new);
1146
DEFUNO_NEW("APPLY",object,fLapply,LISP
1147
,2,MAX_ARGS,NONE,OO,OO,OO,OO,void,Lapply,(object fun,...),"")
1148
{ int m,n=VFUN_NARGS;
1150
object buf[MAX_ARGS];
1156
{*base++ = va_arg(ap,object);
1159
list = va_arg(ap,object);
1162
{ if (m >= MAX_ARGS) FEerror(" Lisps arglist maximum surpassed",0);
1163
*base++ = Mcar(list);
1166
return IapplyVector(fun,m,buf);
1170
DEFUNO_NEW("EVAL",object,fLeval,LISP
1171
,1,1,NONE,OO,OO,OO,OO,void,Leval,(object x0),"")
1173
object *lex = lex_env;
1177
/* eval(vs_base[0]); */
1180
return Ivs_values();
1183
LFD(Levalhook)(void)
1186
bds_ptr old_bds_top = bds_top;
1187
object *lex = lex_env;
1188
int n = vs_top - vs_base;
1192
too_few_arguments();
1194
*(struct nil3 *)vs_top = three_nils;
1196
} else if (n == 4) {
1204
too_many_arguments();
1205
bds_bind(Vevalhook, vs_base[1]);
1206
bds_bind(Vapplyhook, vs_base[2]);
1210
bds_unwind(old_bds_top);
1213
LFD(Lapplyhook)(void)
1217
bds_ptr old_bds_top = bds_top;
1218
object *lex = lex_env;
1219
int n = vs_top - vs_base;
1224
too_few_arguments();
1226
*(struct nil3 *)vs_top = three_nils;
1228
} else if (n == 5) {
1236
too_many_arguments();
1237
bds_bind(Vevalhook, vs_base[2]);
1238
bds_bind(Vapplyhook, vs_base[3]);
1240
for (l = vs_base[1]; !endp(l); l = l->c.c_cdr)
1241
vs_push(l->c.c_car);
1246
bds_unwind(old_bds_top);
1249
DEFUNO_NEW("CONSTANTP",object,fLconstantp,LISP
1250
,1,1,NONE,OO,OO,OO,OO,void,Lconstantp,(object x0),"")
1257
if(x0->c.c_car == sLquote)
1260
else if(x == t_symbol)
1261
if((enum stype)x0->s.s_stype == stp_constant)
1273
object *old_vs_base;
1276
old_vs_base = vs_base;
1277
old_vs_top = vs_top;
1280
vs_base = old_vs_base;
1281
vs_top = old_vs_top;
1286
ifuncall1(object fun, object arg1)
1288
object *old_vs_base;
1292
old_vs_base = vs_base;
1293
old_vs_top = vs_top;
1298
vs_top = old_vs_top;
1299
vs_base = old_vs_base;
1304
ifuncall2(object fun, object arg1, object arg2)
1306
object *old_vs_base;
1310
old_vs_base = vs_base;
1311
old_vs_top = vs_top;
1317
vs_top = old_vs_top;
1318
vs_base = old_vs_base;
1323
ifuncall3(object fun, object arg1, object arg2, object arg3)
1325
object *old_vs_base;
1329
old_vs_base = vs_base;
1330
old_vs_top = vs_top;
1337
vs_top = old_vs_top;
1338
vs_base = old_vs_base;
1343
funcall_with_catcher(object fname, object fun)
1345
int n = vs_top - vs_base;
1347
frs_push(FRS_CATCH, make_cons(fname, make_fixnum(n)));
1356
fcalln_cclosure(object first,va_list ap)
1359
{object *base=vs_top;
1367
case 10: *(base++)=va_arg(ap,object);
1368
case 9: *(base++)=va_arg(ap,object);
1369
case 8: *(base++)=va_arg(ap,object);
1370
case 7: *(base++)=va_arg(ap,object);
1371
case 6: *(base++)=va_arg(ap,object);
1372
case 5: *(base++)=va_arg(ap,object);
1373
case 4: *(base++)=va_arg(ap,object);
1374
case 3: *(base++)=va_arg(ap,object);
1375
case 2: *(base++)=va_arg(ap,object);
1376
case 1: *(base++)=va_arg(ap,object);
1379
FEerror("bad args",0);
1382
do{object fun=fcall.fun;
1383
object *top, *base, l;
1385
if (fun->cc.cc_turbo != NULL) {
1386
(*fun->cc.cc_self)(fun->cc.cc_turbo);
1391
for (l = fun->cc.cc_env; !endp(l); l = l->c.c_cdr)
1396
(*fcall.fun->cc.cc_self)(top);
1405
fcalln_general(object first,va_list ap) {
1409
int n= SFUN_NARGS(i);
1410
/* object *old_vs_base=vs_base; */
1411
object *old_vs_top=vs_top;
1413
enum ftype typ,restype=SFUN_RETURN_TYPE(i);
1414
vs_top = vs_base = old_vs_top;
1415
SFUN_START_ARG_TYPES(i);
1419
typ= SFUN_NEXT_TYPE(i);
1421
(typ==f_object ? (jj ? va_arg(ap,object) : first):
1422
typ==f_fixnum ? make_fixnum((jj ? va_arg(ap,fixnum) : (fixnum)first)):
1423
(object) (FEerror("bad type",0),Cnil));
1428
object *base=vs_top;
1432
*(base++) = va_arg(ap,object);
1438
/* vs_base=old_vs_base; */
1439
return (restype== f_object ? x :
1440
restype== f_fixnum ? (object) (fix(x)):
1441
(object) (FEerror("bad type",0),Cnil));
1446
fcalln_vfun(object first,va_list vl)
1449
COERCE_VA_LIST_NEW(new,first,vl,fcall.argd);
1450
res = c_apply_n(fcall.fun->vfn.vfn_self,fcall.argd,new);
1456
fcalln1(object first,...)
1458
object fun=fcall.fun;
1461
if(type_of(fun)==t_cfun)
1462
{object *base=vs_top;
1470
case 10: *(base++)=va_arg(ap,object);
1471
case 9: *(base++)=va_arg(ap,object);
1472
case 8: *(base++)=va_arg(ap,object);
1473
case 7: *(base++)=va_arg(ap,object);
1474
case 6: *(base++)=va_arg(ap,object);
1475
case 5: *(base++)=va_arg(ap,object);
1476
case 4: *(base++)=va_arg(ap,object);
1477
case 3: *(base++)=va_arg(ap,object);
1478
case 2: *(base++)=va_arg(ap,object);
1479
case 1: *(base++)=va_arg(ap,object);
1482
FEerror("bad args",0);
1485
(*fcall.fun->cf.cf_self)();
1490
if(type_of(fun)==t_cclosure)
1491
return(fcalln_cclosure(first,ap));
1492
if(type_of(fun)==t_vfun)
1493
return(fcalln_vfun(first,ap));
1494
return(fcalln_general(first,ap));
1498
/* call a cfun eg funcall_cfun(Lmake_hash_table,2,sKtest,sLeq) */
1499
/* typedef void (*funcvoid)(); */
1502
funcall_cfun(funcvoid fn,int n,...)
1503
{object *old_top = vs_top;
1504
object *old_base= vs_base;
1510
while(n-->0) vs_push(va_arg(ap,object));
1513
if(vs_top>vs_base) result=vs_base[0];
1520
DEF_ORDINARY("LAMBDA-BLOCK-EXPANDED",sSlambda_block_expanded,SI,"");
1521
DEFVAR("*BREAK-POINTS*",sSAbreak_pointsA,SI,Cnil,"");
1522
DEFVAR("*BREAK-STEP*",sSAbreak_stepA,SI,Cnil,"");
1531
make_constant("CALL-ARGUMENTS-LIMIT", make_fixnum(64));
1534
Vevalhook = make_special("*EVALHOOK*", Cnil);
1535
Vapplyhook = make_special("*APPLYHOOK*", Cnil);
1538
three_nils.nil3_self[0] = Cnil;
1539
three_nils.nil3_self[1] = Cnil;
1540
three_nils.nil3_self[2] = Cnil;
1542
make_function("EVALHOOK", Levalhook);
1543
make_function("APPLYHOOK", Lapplyhook);