compsub.c
Go to the documentation of this file.
1 /****************************************************************/
2 /* fast code for compiled execution:
3 /* common error routines
4 /* global variable access
5 /* car/cdr's
6 /* catch/throw
7 /* minilist to list up rest arguments
8 /* Copyright(c) Toshihiro MATSUI, Electrotechnical Laboratory,1988.
9 /****************************************************************/
10 static char *rcsid="@(#)$Id$";
11 
12 #include "eus.h"
13 
14 int maerror()
16 
18 register pointer s;
19 { register pointer v;
20  context *ctx;
21  int vt;
22  vt=intval(s->c.sym.vtype);
23  if (vt>=3) { /*thread special*/
24  ctx=euscontexts[thr_self()];
25  v=spevalof(s,vt);
26  if (v==UNBOUND) {
27  v=s->c.sym.speval;
28  if (v==UNBOUND) error(E_UNBOUND,s);
29  else return(v);}
30  return(v);}
31  v=s->c.sym.speval;
32  if (v==UNBOUND) error(E_UNBOUND,s);
33  else return(v);}
34 
36 register pointer s,v;
37 { pointer vt;
38  int x;
39  context *ctx;
40  vt=s->c.sym.vtype;
41  if (vt==V_CONSTANT) error(E_SETCONST);
42  else if (vt>=V_SPECIAL) {
43  ctx=euscontexts[thr_self()];
44  x=intval(vt);
45  pointer_update(spevalof(s,x), v);}
46  else pointer_update(s->c.sym.speval, v);
47  return(v);}
48 
50 register pointer p;
51 { if (iscons(p)) return(p->c.cons.car);
52  if (p==NIL) return(NIL);
53  else error(E_NOLIST);}
54 
56 register pointer p;
57 { if (islist(p)) return(p->c.cons.cdr);
58  if (p==NIL) return(NIL);
59  else error(E_NOLIST);}
60 
62 register pointer p;
63 { if (islist(p)) p=p->c.cons.cdr;
64  else if (p==NIL) return(NIL);
65  else error(E_NOLIST);
66  if (islist(p)) return(p->c.cons.car);
67  else if (p==NIL) return(NIL);
68  else error(E_NOLIST);}
69 
71 register context *ctx;
72 register pointer *p;
73 register int n;
74 { register pointer r=NIL;
75  while (n-->0) r=cons(ctx,*--p,r);
76  return(r);}
77 
79 register context *ctx;
80 { register struct catchframe *cfp=ctx->catchfp;
81  ctx->vsp = (pointer *)cfp;
82  ctx->callfp = cfp->cf;
83  ctx->bindfp = cfp->bf;
84  ctx->catchfp= cfp->nextcatch;}
85 
context * euscontexts[MAXTHREAD]
Definition: eus.c:105
pointer speval
Definition: eus.h:201
Definition: eus.h:522
pointer cons(context *, pointer, pointer)
Definition: makes.c:97
pointer restorecatch(context *ctx)
Definition: compsub.c:78
GLfloat n[6][3]
Definition: cube.c:15
Definition: eus.h:945
#define intval(p)
Definition: sfttest.c:1
pointer xcar(pointer p)
Definition: compsub.c:49
struct symbol sym
Definition: eus.h:399
static char * rcsid
Definition: compsub.c:10
pointer cdr
Definition: eus.h:194
int maerror()
Definition: compsub.c:14
struct cons cons
Definition: eus.h:398
pointer xcadr(pointer p)
Definition: compsub.c:61
struct callframe * cf
Definition: eus.h:497
union cell::cellunion c
pointer loadglobal(pointer s)
Definition: compsub.c:17
Definition: eus.h:379
pointer minilist(context *ctx, pointer *p, int n)
Definition: compsub.c:70
short s
Definition: structsize.c:2
pointer vtype
Definition: eus.h:201
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
Definition: eus.c:297
struct catchframe * nextcatch
Definition: eus.h:494
GLfloat v[8][3]
Definition: cube.c:21
pointer xcdr(pointer p)
Definition: compsub.c:55
unsigned int thr_self()
Definition: eus.c:25
Definition: eus.h:936
struct bindframe * bf
Definition: eus.h:496
pointer NIL
Definition: eus.c:110
pointer storeglobal(pointer s, pointer v)
Definition: compsub.c:35


euslisp
Author(s): Toshihiro Matsui
autogenerated on Fri Feb 21 2020 03:20:54