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 
restorecatch
pointer restorecatch(context *ctx)
Definition: compsub.c:78
catchframe::bf
struct bindframe * bf
Definition: eus.h:498
NIL
pointer NIL
Definition: eus.c:110
context
Definition: eus.h:524
s
short s
Definition: structsize.c:2
intval
#define intval(p)
Definition: sfttest.c:1
E_MISMATCHARG
@ E_MISMATCHARG
Definition: eus.h:942
eus.h
minilist
pointer minilist(context *ctx, pointer *p, int n)
Definition: compsub.c:70
cell::c
union cell::cellunion c
cons::cdr
pointer cdr
Definition: eus.h:197
xcar
pointer xcar(pointer p)
Definition: compsub.c:49
catchframe::cf
struct callframe * cf
Definition: eus.h:499
loadglobal
pointer loadglobal(pointer s)
Definition: compsub.c:17
rcsid
static char * rcsid
Definition: compsub.c:10
euscontexts
context * euscontexts[MAXTHREAD]
Definition: eus.c:105
maerror
int maerror()
Definition: compsub.c:14
E_SETCONST
@ E_SETCONST
Definition: eus.h:939
cell::cellunion::cons
struct cons cons
Definition: eus.h:400
xcadr
pointer xcadr(pointer p)
Definition: compsub.c:61
catchframe::nextcatch
struct catchframe * nextcatch
Definition: eus.h:496
cons
pointer cons(context *, pointer, pointer)
Definition: makes.c:97
E_UNBOUND
@ E_UNBOUND
Definition: eus.h:940
E_NOLIST
@ E_NOLIST
Definition: eus.h:949
error
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
Definition: eus.c:297
cell
Definition: eus.h:381
n
GLfloat n[6][3]
Definition: cube.c:15
storeglobal
pointer storeglobal(pointer s, pointer v)
Definition: compsub.c:35
catchframe
Definition: eus.h:495
v
GLfloat v[8][3]
Definition: cube.c:21
xcdr
pointer xcdr(pointer p)
Definition: compsub.c:55
thr_self
unsigned int thr_self()
Definition: eus.c:25


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43