#define peekc(p) (p->_cnt>0? *(p)->_ptr&0377:_filbuf(p)==-1?-1:((p)->_cnt++,*--(p)->_ptr&0377))
/**********************************************************************/
/* GLOBAL STUFF *******************************************************/
#define CNIL ((lispval) -4)
#define nil ((lispval) 0)
#define eofa ((lispval) 20)
#define NOTNIL(a) ((int)a)
#define ISNIL(a) (!(int)a)
/* type flags and the macros to get them ********************************/
/* the numbers per page of the different data objects *******************/
extern char typetab
[]; /* the table with types for each page */
/* Absolute limit, in pages of the
size to which the lisp system may grow.
If you change this, you must recompile
#define TYPL(a1) ((typetab+1)[(int)(a1) >> 9])
#define SETTYPE(a1,b) {if((itemp = ((int)a1) >> 9) > TTSIZE) badmem();\
(typetab + 1)[itemp] = (b); }
#define TYPE(a1) ((typetab+1)[(int)(a1) >> 9])
#define VALID(a) (a >= CNIL && a < datalim)
/* some types ***********************************************************/
#define MAX10LNG 200000000 /* max long divided by 10 */
typedef union lispobj
*lispval
;
struct dtpr
{lispval cdr
,
lispval clb
; /* current level binding*/
lispval plist
; /* pointer to prop list */
lispval fnbnd
; /* function binding */
struct atom
*hshlnk
; /* hash link to next */
char *pname
; /* print name */
lispval accfun
, /* access function--may be anything */
aux
; /* slot for dimensions or auxilliary data */
char *data
; /* pointer to first byte of array */
lispval length
, delta
; /* length in items and length of one item */
lispval (*entry
)(); /* entry point to routine */
lispval discipline
, /* argument-passing discipline */
language
, /* language coded in */
params
, /* parameter list if relevant */
loctab
; /* local table */
#include "sigtab.h" /* table of all pointers to lisp data */
/* Port definitions *****************************************************/
extern FILE *piport
, /* standard input port */
*poport
, /* standard output port */
*errport
, /* port for error messages */
*rdrport
; /* temporary port for readr */
extern FILE *xports
[]; /* page of file *'s for lisp */
extern int lineleng
; /* line length desired */
extern char rbktf
; /* logical flag: ] mode */
extern char *ctable
; /* Character table in current use */
/* name stack ***********************************************************/
} *bnp
, /* first free bind entry*/
*bnplim
; /* limit of bindstack */
} *np
, /* top entry on stack */
*lbot
, /* bottom of cur frame */
*namptr
, /* temporary pointer */
*nplim
; /* don't have this = np */
#define TNP if(np >= nplim) namerr();
#define INRNP if (np++ >= nplim) namerr();
#define INCNP(x,y) {np[1].atm = (lispval)(x); np[1].val = (lispval)(y);\
if(np++ >= nplim) namerr();}
/** status codes **********************************************/
/* these define how status and sstatus should service probes */
/* into the lisp data base */
/* common status codes */
/* hashing things *******************************************************/
#define HASHTOP 128 /* we handle 8-bit characters by dropping top bit */
extern struct atom
*hasht
[HASHTOP
];
extern int hash
; /* set by ratom */
extern int atmlen
; /* length of atom including final null */
/* big string buffer for whomever needs it ******************************/
extern char strbuf
[STRBLEN
];
/* break and error declarations *****************************************/
#define SAVSIZE 40 /* number of bytes saved by setexit */
extern int depth
; /* depth of nested breaks */
extern lispval contval
; /* the value being returned up */
extern int retval
; /* used by each error/prog call */
extern struct argent
*orgnp
; /* used by top level to reset to start */
extern struct nament
*orgbnp
; /* used by top level to reset to start */
/* other stuff **********************************************************/
extern lispval ftemp
,vtemp
,argptr
,ttemp
; /* temporaries: use briefly */
/* for pointer type conversion */
handler(); extern lispval sigacts
[16]; extern sigdelay
, sigstruck
;
/* limit of valid data area **************************************/
/** macros to push and pop the value of an atom on the stack ******/
#define PUSHDOWN(atom,value)\
{bnp->atm=atom;bnp++->val=atom->clb;atom->clb=value;if(bnp>bnplim) binderr();}
{--bnp;bnp->atm->clb=bnp->val;}
/** macro for evaluating atoms in eval and interpreter ***********/
#define EVALATOM(x) vtemp = x->clb;\
printf("%s: ",(x)->pname);\
vtemp = error("UNBOUND VARIABLE",TRUE);}
/* having to do with small integers */
#define SMALL(i) ((lispval)(1024 + (i<<2)))
#define P(p) ((lispval) (xports +((p)-_iob)))
/* interpreter globals */
/* register lisp macros for registers */
#define saveonly(n) asm("#save n");
#define snpand(n) asm("#protect n");