/* sccs id @(#)global.h 34.4 10/22/80 */
/**********************************************************************/
/* GLOBAL STUFF *******************************************************/
#define peekc(p) (p->_cnt>0? *(p)->_ptr&0377:_filbuf(p)==-1?-1:((p)->_cnt++,*--(p)->_ptr&0377))
#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 ********************************/
#define HUNK2 11 /* The hunks */
/* the numbers per page of the different data objects *******************/
#define HUNK2SPP 64 /* hunk page sizes */
extern char typetable
[]; /* the table with types for each page */
#define TYPL(a1) ((typetable+1)[(int)(a1) >> 9])
#define SETTYPE(a1,b) {if((itemp = ((int)a1) >> 9) >= TTSIZE) badmem();\
(typetable + 1)[itemp] = (b); }
#define TYPE(a1) ((typetable+1)[(int)(a1) >> 9])
#define HUNKP(a1) ((TYPE(a1)+5) & 16)
#define HUNKSIZE(a1) ((TYPE(a1)+5) & 15)
#define VALID(a) (a >= CNIL && a < datalim)
/* some types ***********************************************************/
#define MAX10LNG 200000000 /* max long divided by 10 */
typedef union lispobj
*lispval
;
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 ***********************************************************/
/* the name stack limit is raised by NAMINC every namestack overflow to allow
a user function to handle the error
} *bnp
, /* first free bind entry*/
*bnplim
; /* limit of bindstack */
extern struct argent
*lbot
, *np
, *namptr
;
extern struct nament
*bnp
; /* first free bind entry*/
extern struct argent
*nplim
; /* don't have this = np */
extern struct argent
*orgnp
; /* used by top level to reset to start */
extern struct nament
*orgbnp
; /* used by top level to reset to start */
extern struct nament
*bnplim
; /* limit of bindstack */
extern struct argent
*np
, /* top entry on stack */
*lbot
, /* bottom of cur frame */
*namptr
; /* temporary pointer */
extern lispval sigacts
[16];
extern lispval hunk_pages
[7], hunk_items
[7], hunk_name
[7];
#define TNP if(np >= nplim) namerr();
#define TNP if(np >= nplim) namerr();
#define INRNP if (np++ >= nplim) namerr();
#define protect(p) (np++->val = (p))
#define chkarg(p,x); if((p)!=np-lbot) argerr(x);
/** status codes **********************************************/
/* these define how status and sstatus should service probes */
/* into the lisp data base */
/* common status codes */
/* number of counters for fasl to use in a profiling lisp */
/* hashing things *******************************************************/
#define HASHTOP 1024 /* 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 */
/** exception handling ***********************************************/
extern int exception
; /* if TRUE then an exception is pending, one of */
extern int sigintcnt
; /* if > 0 then there is a SIGINT pending */
/* big string buffer for whomever needs it ******************************/
extern char strbuf
[STRBLEN
];
/* break and error declarations *****************************************/
#define SAVSIZE 44 /* 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 int rsetsw
; /* used by *rset mode */
/* other stuff **********************************************************/
extern lispval ftemp
,vtemp
,argptr
,ttemp
; /* temporaries: use briefly */
/* for pointer type conversion */
handler(); 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)->a.clb;(atom)->a.clb=value;\
if(bnp>bnplim) binderr();}
{--bnp;bnp->atm->a.clb=bnp->val;}
/** macro for evaluating atoms in eval and interpreter ***********/
#define EVALATOM(x) vtemp = x->a.clb;\
printf("%s: ",(x)->a.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)))
#define PN(p) ((int) ((p)-_iob))
#define okport(arg,default) (vtemp = arg,((TYPE((vtemp))!=PORT)?default:(vtemp)->p))
extern lispval ioname
[]; /* names of open files */
/* interpreter globals */
/* register lisp macros for registers */
#define saveonly(n) asm("#save n")
#define snpand(n) asm("#protect n")