1: /*					-[Sun Jun 19 14:42:59 1983 by jkf]-
   2:  * 	global.h			$Locker:  $
   3:  * main include file
   4:  *
   5:  * $Header: global.h,v 1.11 85/03/24 11:06:11 sklower Exp $
   6:  *
   7:  * (c) copyright 1982, Regents of the University of California
   8:  */
   9: 
  10: 
  11: #include <stdio.h>
  12: #include "config.h"
  13: #include "ltypes.h"
  14: #ifdef UNIXTS
  15: #include "tsfix.h"
  16: #endif
  17: 
  18: #define AD 0
  19: 
  20: #define peekc(p)    (p->_cnt>0? *(p)->_ptr&0377:_filbuf(p)==-1?-1:((p)->_cnt++,*--(p)->_ptr&0377))
  21: 
  22: #define FALSE   0
  23: #define TRUE    1
  24: #define EVER    ;;
  25: #define STRBLEN 512
  26: #define LBPG    512
  27: 
  28: 
  29: #define NULL_CHAR   0
  30: #define LF  '\n'
  31: #define WILDCHR '\0177'
  32: 
  33: 
  34: /* the numbers per page of the different data objects *******************/
  35: 
  36: #define NUMSPACES (VECTORI+1)
  37: 
  38: #define ATOMSPP 25
  39: #define STRSPP 1
  40: #define INTSPP 128
  41: #define DTPRSPP 64
  42: #define DOUBSPP 64
  43: #define ARRAYSPP 25
  44: #define SDOTSPP 64
  45: #define VALSPP 128
  46: #define BCDSPP 64
  47: 
  48: 
  49: #define HUNK2SPP 64      /* hunk page sizes */
  50: #define HUNK4SPP 32
  51: #define HUNK8SPP 16
  52: #define HUNK16SPP 8
  53: #define HUNK32SPP 4
  54: #define HUNK64SPP 2
  55: #define HUNK128SPP 1
  56: #define VECTORSPP 512
  57: 
  58: /* offset of size info from beginning of vector,  in longwords */
  59: /* these values are not valid when a vector is stored in the free */
  60: /* list, in which case the chaining is done through the propery field */
  61: #define VSizeOff -2
  62: #define VPropOff -1
  63: 
  64: /* VecTotSize: the total number of longwords for the data segment of
  65:  * the vector. Takes a byte count and rounds up to nearest long.
  66:  */
  67: 
  68: #define VecTotSize(x)  (((x)+3) >> 2)
  69: #define VecTotToByte(x) ((x) * sizeof(long))
  70: 
  71: /* these vector size macros determine the number of complete objects
  72:    in the vector
  73:  */
  74: #define VecSize(x)  ((x) >> 2)
  75: #define VecWordSize(x)  ((x) >> 1)
  76: #define VecByteSize(x)  (x)
  77: 
  78: /* maximum and minimum fixnums */
  79: #define MaxINT 0x3fffffff
  80: #define MinINT (- 0x4000000)
  81: /*
  82:  * macros for saving state and restoring state
  83:  *
  84:  * Savestack and Restorestack are required at the beginning and end of
  85:  * functions which modify the stack pointers np and lbot.
  86:  * The Savestack(n) should appear at the end of the variable declarations
  87:  * The n refers to the number of register variables declared in this routine.
  88:  * The information is required for the Vax version only.
  89:  */
  90: #ifdef PORTABLE
  91: extern struct atom nilatom, eofatom;
  92: #define nil ((lispval) &nilatom)
  93: #define eofa    ((lispval) &eofatom)
  94: #define Savestack(n) struct argent *OLDlbot = lbot, *OLDnp = np
  95: #define Restorestack() (lbot = OLDlbot), np = OLDnp
  96: #else
  97: #define nil ((lispval) 0)
  98: #define eofa    ((lispval) 20)
  99: #define Savestack(n) snpand(n)
 100: #define Restorestack()
 101: #endif
 102: 
 103: #ifdef SIXONLY
 104: #define errorh1 errh1
 105: #define errorh2 errh2
 106: #endif
 107: 
 108: #define CNIL    ((lispval) (OFFSET-4))
 109: #define NOTNIL(a)   (nil!=a)
 110: #define ISNIL(a)    (nil==a)
 111: 
 112: #ifdef SPISFP
 113: extern long *xsp, xstack[];
 114: #define sp() xsp
 115: #define stack(z) (xsp > xstack ? (*--xsp = z): xserr())
 116: #define unstack() (*xsp++)
 117: #define Keepxs() long *oxsp = xsp;
 118: #define Freexs() xsp = oxsp;
 119: #else
 120: extern long *sp(), stack(), unstack();
 121: #define Keepxs() /* */
 122: #define Freexs() /* */
 123: #endif
 124: 
 125: extern char typetable[];  /*  the table with types for each page  */
 126: #define ATOX(a1)    ((((int)(a1)) - OFFSET) >> 9)
 127: #define TYPE(a1)    ((typetable+1)[ATOX(a1)])
 128: #define TYPL(a1)    ((typetable+1)[ATOX(a1)])
 129: #define SETTYPE(a1,b,c)   {if((itemp = ATOX(a1)) >= fakettsize) \
 130:              { if(fakettsize >= TTSIZE) \
 131:                {\
 132:                   printf(" all space exausted, goodbye\n");\
 133:                   exit(1);\
 134:                }\
 135:                fakettsize++;  badmem(c);\
 136:              }\
 137:             (typetable + 1)[itemp] = (b); }
 138: 
 139: #define HUNKP(a1)   ((TYPE(a1) >= 11) & (TYPE(a1) <= 17))
 140: #define HUNKSIZE(a1)    ((TYPE(a1)+5) & 15)
 141: 
 142: #define UPTR(x) ((unsigned)(((long)(x))-(long)CNIL))
 143: #define VALID(a)    (UPTR(a) <= UPTR(datalim))
 144: 
 145: #define Popframe() (errp->olderrp)
 146: 
 147: 
 148: /* some types ***********************************************************/
 149: #define lispint long
 150: #define MAX10LNG 200000000      /* max long divided by 10	*/
 151: 
 152: 
 153: typedef union lispobj *lispval ;
 154: 
 155: struct dtpr {
 156:     lispval cdr, car;
 157: };
 158: 
 159: struct sdot {
 160:     int     I;
 161:     lispval CDR;
 162: };
 163: 
 164: 
 165: struct  atom    {
 166:     lispval     clb;        /* current level binding*/
 167:     lispval     plist;      /* pointer to prop list	*/
 168: #ifndef WILD
 169:     lispval     fnbnd;      /* function binding	*/
 170: #endif
 171:     struct  atom    *hshlnk;    /* hash link to next	*/
 172:     char        *pname;     /* print name	*/
 173:     };
 174: #ifdef WILD
 175: #define fnbnd clb
 176: #endif
 177: 
 178: struct array {
 179:     lispval accfun,     /*  access function--may be anything  */
 180:         aux;        /*  slot for dimensions or auxilliary data  */
 181:     char *data;     /*  pointer to first byte of array    */
 182:     lispval length, delta;  /* length in items and length of one item */
 183: };
 184: 
 185: struct bfun {
 186:     lispval (*start)(); /*  entry point to routine  */
 187:     lispval discipline, /*  argument-passing discipline  */
 188:         language,   /*  language coded in	*/
 189:         params,     /*  parameter list if relevant  */
 190:         loctab;     /*  local table  */
 191: };
 192: 
 193: struct Hunk {
 194:     lispval hunk[1];
 195: };
 196: 
 197: struct Vector {
 198:         lispval vector[1];
 199: };
 200: 
 201: /* the vectori types */
 202: struct Vectorb {
 203:         char vectorb[1];
 204: };
 205: 
 206: struct Vectorw {
 207:        short  vectorw[1];
 208: };
 209: 
 210: struct Vectorl {
 211:     long vectorl[1];
 212: };
 213: 
 214: union lispobj {
 215:     struct atom a;
 216:     FILE *p;
 217:     struct dtpr d;
 218:     long int i;
 219:     long int *j;
 220:     double r;
 221:     lispval (*f)();
 222:     struct array ar;
 223:     struct sdot s;
 224:     char c;
 225:     lispval l;
 226:     struct bfun bcd;
 227:     struct Hunk h;
 228:     struct Vector v;
 229:     struct Vectorb vb;
 230:     struct Vectorw vw;
 231:     struct Vectorl vl;
 232: };
 233: 
 234: #ifdef lint
 235: extern lispval Inewint();
 236: #define inewint(p) Inewint((long)(p))
 237: #else
 238: extern lispval inewint();
 239: #endif
 240: 
 241: 
 242: #include "sigtab.h"   /* table of all pointers to lisp data */
 243: 
 244: /* Port definitions *****************************************************/
 245: extern FILE *piport,        /* standard input port		*/
 246:     *poport,        /* standard output port		*/
 247:     *errport,       /* port for error messages	*/
 248:     *rdrport;       /* temporary port for readr	*/
 249: 
 250: #ifndef RTPORTS
 251: extern FILE *xports[];      /* page of file *'s for lisp	*/
 252: #define P(p)        ((lispval) (xports +((p)-_iob)))
 253: #define PN(p)       ((int) ((p)-_iob))
 254: #else
 255: extern lispval P();
 256: extern FILE **xports;
 257: #define PN(p) (((FILE **)P(p))-xports)
 258: #endif
 259: 
 260: extern int lineleng ;       /* line length desired		*/
 261: extern char rbktf;      /* logical flag: ] mode		*/
 262: extern unsigned char *ctable;       /* Character table in current use */
 263: #define Xdqc ctable[131]
 264: #define Xesc ctable[130]
 265: #define Xsdc ctable[129]
 266: 
 267: /* name stack ***********************************************************/
 268: 
 269: #define NAMESIZE 3072
 270: 
 271: /* the name stack limit is raised by NAMINC every namestack overflow to allow
 272:    a user function to handle the error
 273: */
 274: #define NAMINC 25
 275: 
 276: extern struct nament {
 277:     lispval val,
 278:         atm;
 279: }   *bnp,           /* first free bind entry*/
 280:     *bnplim;        /* limit of bindstack   */
 281: 
 282: struct argent {
 283:     lispval val;
 284: };
 285: extern struct argent *lbot, *np, *namptr;
 286: extern struct nament    *bnp;           /* first free bind entry*/
 287: extern struct argent *nplim;        /* don't have this = np	*/
 288: extern struct argent *orgnp;    /* used by top level to reset to start  */
 289: extern struct nament *orgbnp;   /* used by top level to reset to start  */
 290: extern struct nament *bnplim;       /* limit of bindstack   */
 291: extern struct argent    *np,            /* top entry on stack	*/
 292:         *lbot,          /* bottom of cur frame	*/
 293:         *namptr;        /* temporary pointer	*/
 294: extern lispval sigacts[16];
 295: extern lispval hunk_pages[7], hunk_items[7], hunk_name[7];
 296: 
 297: extern lispval Vprintsym;
 298: 
 299: #define TNP if(np >= nplim) namerr();
 300: 
 301: #define TNP if(np >= nplim) namerr();
 302: #define INRNP   if (np++ >= nplim) namerr();
 303: #define protect(p) (np++->val = (p))
 304: #define chkarg(p,x); if((p)!=np-lbot) argerr(x);
 305: 
 306: 
 307: /** status codes **********************************************/
 308: /*							      */
 309: /* these define how status and sstatus should service probes  */
 310: /* into the lisp data base				      */
 311: 
 312: /* common status codes */
 313: #define ST_NO 0
 314: 
 315: /* status codes */
 316: #define ST_READ 1
 317: #define ST_FEATR 2
 318: #define ST_SYNT 3
 319: #define ST_RINTB 4
 320: #define ST_NFETR 5
 321: #define ST_DMPR  6
 322: #define ST_CTIM  7
 323: #define ST_LOCT  8
 324: #define ST_ISTTY 9
 325: #define ST_UNDEF 10
 326: 
 327: /* sstatus codes */
 328: #define ST_SET 1
 329: #define ST_FEATW 2
 330: #define ST_TOLC 3
 331: #define ST_CORE 4
 332: #define ST_INTB 5
 333: #define ST_NFETW 6
 334: #define ST_DMPW  7
 335: #define ST_AUTR 8
 336: #define ST_TRAN 9
 337: #define ST_BCDTR 10
 338: #define ST_GCSTR 11
 339: 
 340: 
 341: /* number of counters for fasl to use in a profiling lisp  */
 342: #define NMCOUNT 5000
 343: 
 344: /* hashing things *******************************************************/
 345: #define HASHTOP 1024    /*  we handle 8-bit characters by dropping top bit  */
 346: extern struct   atom    *hasht[HASHTOP];
 347: extern int  hash;       /* set by ratom		*/
 348: extern int  atmlen;     /* length of atom including final null	*/
 349: 
 350: 
 351: /** exception handling ***********************************************/
 352: extern int exception;   /* if TRUE then an exception is pending, one of */
 353:             /* the below 				        */
 354: extern int sigintcnt;   /* if > 0 then there is a SIGINT pending	*/
 355: 
 356: /* big string buffer for whomever needs it ******************************/
 357: extern char *strbuf;
 358: extern char *endstrb;
 359: 
 360: /* break and error declarations *****************************************/
 361: #define SAVSIZE 44      /* number of bytes saved by setexit	*/
 362: #define BRRETB  1
 363: #define BRCONT  2
 364: #define BRGOTO  3
 365: #define BRRETN  4
 366: #define INTERRUPT 5
 367: #define THROW   6
 368: extern int  depth;      /* depth of nested breaks		*/
 369: extern lispval  contval;    /* the value being returned up		*/
 370: extern int  retval;     /* used by each error/prog call		*/
 371: extern lispval  lispretval; /* used by non-local go			*/
 372: extern int  rsetsw;     /* used by *rset mode			*/
 373: extern int  evalhcallsw;    /* used by evalhook			*/
 374: extern int  funhcallsw; /* used by evalhook			*/
 375: 
 376: 
 377: /* other stuff **********************************************************/
 378: extern lispval  ftemp,vtemp,argptr,ttemp;   /* temporaries: use briefly  */
 379: extern int itemp;
 380:                     /* for pointer type conversion  */
 381: #include    "dfuncs.h"
 382: 
 383: #define NUMBERP 2
 384: #define BCDP    5
 385: #define PORTP   6
 386: #define ARRAYP  7
 387: 
 388: #define ABSVAL  0
 389: #define MINUS   1
 390: #define ADD1    2
 391: #define SUB1    3
 392: #define NOT 4
 393: #define LNILL   5
 394: #define ZEROP   6
 395: #define ONEP    7
 396: #define PLUS    8
 397: #define TIMES   9
 398: #define DIFFERENCE  10
 399: #define QUOTIENT    11
 400: #define MOD 12
 401: #define LESSP   13
 402: #define GREATERP    14
 403: #define SUM 15
 404: #define PRODUCT 16
 405: #define AND 17
 406: #define OR  18
 407: #define XOR 19
 408: 
 409: interpt();
 410: handler();  extern sigdelay, sigstruck;
 411: 
 412: /* limit of valid data area **************************************/
 413: 
 414: extern lispval datalim;
 415: 
 416: /** macros to push and pop the value of an atom on the stack ******/
 417: 
 418: #define PUSHDOWN(atom,value)\
 419:     {bnp->atm=(atom);bnp++->val=(atom)->a.clb;(atom)->a.clb=value;\
 420:     if(bnp>bnplim) binderr();}
 421: 
 422: #define POP\
 423:     {--bnp;bnp->atm->a.clb=bnp->val;}
 424: 
 425: /* PUSHVAL  is used to store a specific atom and value on the
 426:  * bindstack.   Currently only used by closure code
 427:  */
 428: #define PUSHVAL(atom,value)\
 429:     {bnp->atm=(atom);bnp++->val=value;\
 430:     if(bnp>bnplim) binderr();}
 431: 
 432: /** macro for evaluating atoms in eval and interpreter  ***********/
 433: 
 434: #define EVALATOM(x) vtemp = x->a.clb;\
 435:             if( vtemp == CNIL ) {\
 436:                 printf("%s: ",(x)->a.pname);\
 437:                 vtemp = error("UNBOUND VARIABLE",TRUE);}
 438: 
 439: /*  having to do with small integers					*/
 440: extern long Fixzero[];
 441: #define SMALL(i)    ((lispval)(Fixzero + i))
 442: #define okport(arg,default) (vtemp = arg,((TYPE((vtemp))!=PORT)?default:(vtemp)->p))
 443: 
 444: extern lispval ioname[];    /* names of open files */
 445: /*  interpreter globals   */
 446: 
 447: extern int lctrace;
 448: 
 449: /* register lisp macros for registers */
 450: 
 451: #define saveonly(n) asm("#save	n")
 452: #define snpand(n)   asm("#protect	n")

Defined struct's

Hunk defined in line 193; used 2 times
  • in line 227(2)
Vector defined in line 197; used 2 times
  • in line 228(2)
Vectorb defined in line 202; used 2 times
  • in line 229(2)
Vectorl defined in line 210; used 2 times
  • in line 231(2)
Vectorw defined in line 206; used 2 times
  • in line 230(2)
argent defined in line 282; used 8 times
array defined in line 178; used 2 times
  • in line 222(2)
atom defined in line 165; used 7 times
bfun defined in line 185; used 2 times
  • in line 226(2)
dtpr defined in line 155; used 2 times
  • in line 217(2)
nament defined in line 276; used 6 times
sdot defined in line 159; used 2 times
  • in line 223(2)

Defined union's

lispobj defined in line 214; used 1 times

Defined typedef's

lispval defined in line 153; used 31 times

Defined macros

ABSVAL defined in line 388; never used
AD defined in line 18; never used
ADD1 defined in line 390; never used
AND defined in line 405; never used
ARRAYP defined in line 386; never used
ARRAYSPP defined in line 43; never used
ATOMSPP defined in line 38; never used
ATOX defined in line 126; used 3 times
BCDP defined in line 384; never used
BCDSPP defined in line 46; never used
BRCONT defined in line 363; never used
BRGOTO defined in line 364; never used
BRRETB defined in line 362; never used
BRRETN defined in line 365; never used
CNIL defined in line 108; used 2 times
DIFFERENCE defined in line 398; never used
DOUBSPP defined in line 42; never used
DTPRSPP defined in line 41; never used
EVALATOM defined in line 434; never used
EVER defined in line 24; never used
FALSE defined in line 22; never used
Freexs defined in line 122; never used
GREATERP defined in line 402; never used
HASHTOP defined in line 345; used 1 times
HUNK128SPP defined in line 55; never used
HUNK16SPP defined in line 52; never used
HUNK2SPP defined in line 49; never used
HUNK32SPP defined in line 53; never used
HUNK4SPP defined in line 50; never used
HUNK64SPP defined in line 54; never used
HUNK8SPP defined in line 51; never used
HUNKP defined in line 139; never used
HUNKSIZE defined in line 140; never used
INRNP defined in line 302; never used
INTERRUPT defined in line 366; never used
INTSPP defined in line 40; never used
ISNIL defined in line 110; never used
Keepxs defined in line 121; never used
LBPG defined in line 26; never used
LESSP defined in line 401; never used
LF defined in line 30; never used
LNILL defined in line 393; never used
MAX10LNG defined in line 150; never used
MINUS defined in line 389; never used
MOD defined in line 400; never used
MaxINT defined in line 79; never used
MinINT defined in line 80; never used
NAMESIZE defined in line 269; never used
NAMINC defined in line 274; never used
NMCOUNT defined in line 342; never used
NOT defined in line 392; never used
NOTNIL defined in line 109; never used
NULL_CHAR defined in line 29; never used
NUMBERP defined in line 383; never used
NUMSPACES defined in line 36; never used
ONEP defined in line 395; never used
OR defined in line 406; never used
P defined in line 252; used 2 times
PLUS defined in line 396; never used
PN defined in line 257; never used
POP defined in line 422; never used
PORTP defined in line 385; never used
PRODUCT defined in line 404; never used
PUSHDOWN defined in line 418; never used
PUSHVAL defined in line 428; never used
Popframe defined in line 145; never used
QUOTIENT defined in line 399; never used
Restorestack defined in line 100; never used
SAVSIZE defined in line 361; never used
SDOTSPP defined in line 44; never used
SETTYPE defined in line 129; never used
SMALL defined in line 441; never used
STRBLEN defined in line 25; never used
STRSPP defined in line 39; never used
ST_AUTR defined in line 335; never used
ST_BCDTR defined in line 337; never used
ST_CORE defined in line 331; never used
ST_CTIM defined in line 322; never used
ST_DMPR defined in line 321; never used
ST_DMPW defined in line 334; never used
ST_FEATR defined in line 317; never used
ST_FEATW defined in line 329; never used
ST_GCSTR defined in line 338; never used
ST_INTB defined in line 332; never used
ST_ISTTY defined in line 324; never used
ST_LOCT defined in line 323; never used
ST_NFETR defined in line 320; never used
ST_NFETW defined in line 333; never used
ST_NO defined in line 313; never used
ST_READ defined in line 316; never used
ST_RINTB defined in line 319; never used
ST_SET defined in line 328; never used
ST_SYNT defined in line 318; never used
ST_TOLC defined in line 330; never used
ST_TRAN defined in line 336; never used
ST_UNDEF defined in line 325; never used
SUB1 defined in line 391; never used
SUM defined in line 403; never used
Savestack defined in line 99; never used
THROW defined in line 367; never used
TIMES defined in line 397; never used
TNP defined in line 301; never used
TRUE defined in line 23; used 2 times
TYPE defined in line 127; used 4 times
TYPL defined in line 128; never used
UPTR defined in line 142; used 2 times
  • in line 143(2)
VALID defined in line 143; never used
VALSPP defined in line 45; never used
VECTORSPP defined in line 56; never used
VPropOff defined in line 62; never used
VSizeOff defined in line 61; never used
VecByteSize defined in line 76; never used
VecSize defined in line 74; never used
VecTotSize defined in line 68; never used
VecTotToByte defined in line 69; never used
VecWordSize defined in line 75; never used
WILDCHR defined in line 31; never used
XOR defined in line 407; never used
Xdqc defined in line 263; never used
Xesc defined in line 264; never used
Xsdc defined in line 265; never used
ZEROP defined in line 394; never used
chkarg defined in line 304; never used
eofa defined in line 98; never used
errorh1 defined in line 104; never used
errorh2 defined in line 105; never used
fnbnd defined in line 175; used 1 times
inewint defined in line 236; used 1 times
lispint defined in line 149; never used
nil defined in line 97; used 2 times
okport defined in line 442; never used
peekc defined in line 20; never used
protect defined in line 303; never used
saveonly defined in line 451; never used
snpand defined in line 452; used 1 times
  • in line 99
sp defined in line 114; used 1 times
stack defined in line 115; used 1 times
unstack defined in line 116; used 1 times

Usage of this include

Last modified: 1985-08-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3600
Valid CSS Valid XHTML 1.0 Strict