7 static char *
rcsid=
"@(#)$Id$";
23 if (iscons(a))
return(ccar(a));
33 if (iscons(a))
return(ccdr(a));
43 if (iscons(p)) p=ccdr(p);
44 else if (p==
NIL)
return(
NIL);
46 if (iscons(p))
return(ccar(p));
47 else if (p==
NIL)
return(
NIL);
56 if (iscons(p)) p=ccdr(p);
57 else if (p==
NIL)
return(
NIL);
59 if (iscons(p))
return(ccdr(p));
60 else if (p==
NIL)
return(
NIL);
69 if (iscons(p)) p=ccar(p);
70 else if (p==
NIL)
return(
NIL);
72 if (iscons(p))
return(ccdr(p));
73 else if (p==
NIL)
return(
NIL);
82 if (iscons(p)) p=ccar(p);
83 else if (p==
NIL)
return(
NIL);
85 if (iscons(p))
return(ccar(p));
86 else if (p==
NIL)
return(
NIL);
95 if (iscons(p)) p=ccdr(p);
96 else if (p==
NIL)
return(
NIL);
98 if (iscons(p)) p=ccdr(p);
99 else if (p==
NIL)
return(
NIL);
101 if (iscons(p))
return(ccar(p));
102 else if (p==
NIL)
return(
NIL);
114 while (i-->0 && islist(a)) a=ccdr(a);
115 if (islist(a))
return(ccar(a));
116 else if (a==
NIL)
return(
NIL);
131 while (i-->0 && islist(a)) a=ccdr(a);
139 return(
cons(ctx,argv[0],argv[1]));}
147 if (islist(a)) {pointer_update(ccar(a),argv[1]);}
157 if (islist(a)) {pointer_update(ccar(a),argv[1]);}
167 if (islist(a)) {pointer_update(ccdr(a),argv[1]);}
177 if (islist(a)) {pointer_update(ccdr(a),argv[1]);}
186 while (
n>0) result=
cons(ctx,argv[--
n],result);
193 {
register pointer result=argv[--
n];
194 while (
n>0) result=
cons(ctx,argv[--
n],result);
203 if (
n==0)
return(
NIL);
209 while (islist(a)) { ckpush(ccar(a)); a=ccdr(a); i++;}
210 while (i-->0) r=
cons(ctx,vpop(),r);}
218 while (--
n>=0)
if (islist(argv[
n]))
goto nconc1;
225 while (islist(ccdr(c))) { breakck; c=ccdr(c);}
226 pointer_update(ccdr(c),a);
235 if (
equal(y,z)==
T)
return(x);
236 if (!islist(z))
return(z);
237 temp=
subst(ctx,x,y,ccar(z));
239 temp =
subst(ctx,x,y,ccdr(z));
240 return (
cons(ctx,vpop(),temp));}
249 return(
subst(ctx,argv[0],argv[1],argv[2]));}
254 if (y==zz) pointer_update(*z,x);
264 nsubst(argv[0],argv[1],&argv[2]);
269 {
while (iscons(list))
270 if (ccar(list)==item)
return(list);
271 else list=ccdr(list);
279 return(
memq(argv[0],argv[1]));}
285 {
pointer item=argv[0],list=argv[1],result;
287 while (islist(list)) {
288 result=
equal(ccar(list),item);
289 if (result==
T)
return(list);
291 else list=ccdr(list);}
298 {
register pointer item=argv[0],list=argv[1];
299 pointer key=argv[2],test=argv[3],testnot=argv[4];
303 while (islist(list)) {
305 if (key!=
NIL) target=
call1(ctx,key,target);
306 if (testnot!=
NIL) result=(
call2(ctx,testnot,item,target)==
NIL);
308 target=
equal(item,target);
310 else result=(target!=
NIL);}
311 else if (test!=
NIL) result=(
call2(ctx,test,item,target)!=
NIL);
312 else result=(item==target);
313 if (result)
return(list);
314 else list=ccdr(list);}
320 while (iscons(alist)) {
323 if (ccar(temp)==item)
return(temp);
324 else alist=ccdr(alist);}
333 return(
assq(argv[0],argv[1])); }
339 {
register pointer item=argv[0],alist=argv[1],temp,compare;
341 while (islist(alist)) {
344 compare=
equal(item,ccar(temp));
345 if (compare==
T)
return(temp);
347 else alist=ccdr(alist);}
355 {
register pointer item=argv[0],alist=argv[1];
356 pointer key=argv[2],test=argv[3],testnot=argv[4];
360 while (islist(alist)) {
362 if (islist(target)) {
363 if (key==
NIL) temp=ccar(target);
364 else temp=
call1(ctx,key,target);
365 if (testnot!=
NIL) compare=(
call2(ctx,testnot,item,temp)==
NIL);
366 else if (test==
NIL || test==
QEQ) compare=(item==temp);
368 else compare=(
call2(ctx,test,item,temp)!=
NIL);
369 if (compare)
return(target);}
378 register int count=0;
379 if (
n==2)
n=ckintval(argv[1]);
385 while (iscons(a)) { ckpush(ccar(a)); a=ccdr(a); count++;}
395 register int count=0;
396 register pointer *vspsave=ctx->vsp;
397 if (
n==2)
n=ckintval(argv[1]);
403 while (iscons(a)) { ckpush(a); a=ccdr(a); count++;}
405 b= *(ctx->vsp -
n - 1);
406 pointer_update(ccdr(b),
NIL);
pointer BUTLAST(context *ctx, int n, argv)
pointer ASSOC(context *ctx, int n, argv)
pointer cons(context *, pointer, pointer)
pointer RPLACA(context *ctx, int n, argv)
pointer NCONC(context *ctx, int n, argv)
pointer subst(context *ctx, pointer x, pointer y, pointer z)
pointer RPLACD(context *ctx, int n, argv)
pointer CDDR(context *ctx, int n, argv)
pointer CONS(context *ctx, int n, pointer *argv)
pointer SUPERASSOC(context *ctx, int n, argv)
pointer CDR(context *ctx, int n, pointer *argv)
defun("ADR_TO_STRING", mod, ADR_TO_STRING)
pointer SUBST(context *ctx, int n, argv)
void lists(context *ctx, pointer mod)
pointer ASSQ(context *ctx, int n, argv)
pointer NBUTLAST(context *ctx, int n, argv)
pointer assq(pointer item, pointer alist)
static void key(unsigned char c, int x, int y)
pointer RPLACD2(context *ctx, int n, argv)
pointer call2(context *, pointer, pointer, pointer)
pointer RPLACA2(context *ctx, int n, argv)
pointer NSUBST(context *ctx, int n, argv)
pointer MEMBER(context *ctx, int n, argv)
pointer nsubst(pointer x, pointer y, pointer *z)
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
pointer call1(context *, pointer, pointer)
pointer CAR(context *ctx, int n, pointer *argv)
pointer CAAR(context *ctx, int n, argv)
pointer LIST(context *ctx, int n, argv)
pointer stacknlist(context *, int)
pointer CADDR(context *ctx, int n, argv)
pointer SUPERMEMBER(context *ctx, int n, argv)
pointer NTH(context *ctx, int n, pointer *argv)
pointer CADR(context *ctx, int n, argv)
pointer LIST_STAR(context *ctx, int n, argv)
pointer NTHCDR(context *ctx, int n, pointer *argv)
pointer CDAR(context *ctx, int n, argv)
pointer MEMQ(context *ctx, int n, argv)
pointer APPEND(context *ctx, int n, argv)
pointer memq(pointer item, pointer list)