Annotation of 3BSD/cmd/lisp/global.h, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: 
        !             3: #define AD 0
        !             4: 
        !             5: #define        peekc(p)        (p->_cnt>0? *(p)->_ptr&0377:_filbuf(p)==-1?-1:((p)->_cnt++,*--(p)->_ptr&0377))
        !             6: 
        !             7: /**********************************************************************/
        !             8: /*                                                                    */
        !             9: /*   file: global.h                                                  */
        !            10: /*   contents:                                                       */
        !            11: /* GLOBAL STUFF *******************************************************/
        !            12: 
        !            13: 
        !            14: #define FALSE  0
        !            15: #define        TRUE    1
        !            16: #define EVER   ;;
        !            17: #include <pagsiz.h>
        !            18: #define        CNIL    ((lispval) -4)
        !            19: #define nil    ((lispval) 0)
        !            20: #define eofa   ((lispval) 20)
        !            21: #define NOTNIL(a)      ((int)a)
        !            22: #define ISNIL(a)       (!(int)a)
        !            23: #define STRBLEN 256
        !            24: 
        !            25: 
        !            26: #define        NULL_CHAR       0
        !            27: #define        LF      '\n'
        !            28: #define        WILDCHR '\0177'
        !            29: 
        !            30: 
        !            31: /* type flags and the macros to get them ********************************/
        !            32: 
        !            33: #define        UNBO    -1
        !            34: #define        STRNG   0
        !            35: #define        ATOM    1
        !            36: #define        INT     2
        !            37: #define        DTPR    3
        !            38: #define DOUB   4
        !            39: #define        BCD     5
        !            40: #define        PORT    6
        !            41: #define        ARRAY   7
        !            42: #define SDOT   9
        !            43: #define VALUE  10
        !            44: 
        !            45: /* the numbers per page of the different data objects *******************/
        !            46: #define ATOMSPP 25
        !            47: #define STRSPP NBPG
        !            48: #define INTSPP 128
        !            49: #define DTPRSPP 64
        !            50: #define DOUBSPP 64
        !            51: #define ARRAYSPP 25
        !            52: #define SDOTSPP 64
        !            53: #define VALSPP 128
        !            54: #define BCDSPP 64
        !            55: 
        !            56: extern char typetab[];  /*  the table with types for each page  */
        !            57: 
        !            58: #define TTSIZE 4096
        !            59:                        /*  Absolute limit, in pages of the
        !            60:                         size to which the lisp system may grow.
        !            61:                         If you change this, you must recompile
        !            62:                         alloc.c and data.c */
        !            63: 
        !            64: #define TYPL(a1)       ((typetab+1)[(int)(a1) >> 9])
        !            65: #define SETTYPE(a1,b)   {if((itemp = ((int)a1) >> 9) > TTSIZE) badmem();\
        !            66:                        (typetab + 1)[itemp] = (b); }
        !            67: 
        !            68: #define        TYPE(a1)        ((typetab+1)[(int)(a1) >> 9])
        !            69: 
        !            70: #define VALID(a)       (a >= CNIL && a < datalim)
        !            71: 
        !            72: /* some types ***********************************************************/
        !            73: #define lispint long
        !            74: #define MAX10LNG 200000000             /* max long divided by 10       */
        !            75: 
        !            76: 
        !            77: typedef union lispobj *lispval ;
        !            78: struct dtpr {lispval   cdr,
        !            79:                        car;};
        !            80: struct sdot {
        !            81:        int     I;
        !            82:        lispval CDR;
        !            83: };
        !            84: 
        !            85: 
        !            86: struct atom    {
        !            87:        lispval         clb;            /* current level binding*/
        !            88:        lispval         plist;          /* pointer to prop list */
        !            89: #ifndef WILD
        !            90:        lispval         fnbnd;          /* function binding     */
        !            91: #endif
        !            92:        struct  atom    *hshlnk;        /* hash link to next    */
        !            93:        char            *pname;         /* print name   */
        !            94:        };
        !            95: #ifdef WILD
        !            96: #define fnbnd clb
        !            97: #endif
        !            98: 
        !            99: struct array {
        !           100:        lispval accfun,         /*  access function--may be anything  */
        !           101:                aux;            /*  slot for dimensions or auxilliary data  */
        !           102:        char *data;             /*  pointer to first byte of array    */
        !           103:        lispval length, delta;  /* length in items and length of one item */
        !           104: };
        !           105: 
        !           106: struct bfun {
        !           107:        lispval (*entry)();     /*  entry point to routine  */
        !           108:        lispval discipline,     /*  argument-passing discipline  */
        !           109:                language,       /*  language coded in   */
        !           110:                params,         /*  parameter list if relevant  */
        !           111:                loctab;         /*  local table  */
        !           112:        };
        !           113: 
        !           114: union lispobj {
        !           115:        struct atom a;
        !           116:        FILE *p;
        !           117:        struct dtpr d;
        !           118:        long int i;
        !           119:        long int *j;
        !           120:        double r;
        !           121:        lispval (*f)();
        !           122:        struct array ar;
        !           123:        struct sdot s;
        !           124:        char c;
        !           125:        lispval l;
        !           126:        struct bfun bcd;
        !           127: };
        !           128: 
        !           129: 
        !           130: #include "sigtab.h"   /* table of all pointers to lisp data */
        !           131: 
        !           132: /* Port definitions *****************************************************/
        !           133: extern FILE    *piport,                /* standard input port          */
        !           134:        *poport,                /* standard output port         */
        !           135:        *errport,               /* port for error messages      */
        !           136:        *rdrport;               /* temporary port for readr     */
        !           137: extern FILE *xports[];         /* page of file *'s for lisp    */
        !           138: extern int lineleng ;          /* line length desired          */
        !           139: extern char rbktf;             /* logical flag: ] mode         */
        !           140: extern char *ctable;           /* Character table in current use */
        !           141: #define Xdqc ctable[131]
        !           142: #define Xesc ctable[130]
        !           143: #define Xsdc ctable[129]
        !           144: 
        !           145: /* name stack ***********************************************************/
        !           146: 
        !           147: #ifdef ROWAN
        !           148: #define NAMESIZE 4096
        !           149: #else
        !           150: #define NAMESIZE 1024
        !           151: #endif
        !           152: 
        !           153: extern struct  nament  {
        !           154:        lispval val,
        !           155:                atm;
        !           156: }      *bnp,                   /* first free bind entry*/
        !           157:        *bnplim;                /* limit of bindstack   */
        !           158: 
        !           159: extern struct argent {
        !           160:        lispval val;
        !           161: }      *np,                    /* top entry on stack   */
        !           162:        *lbot,                  /* bottom of cur frame  */
        !           163:        *namptr,                /* temporary pointer    */
        !           164:        *nplim;                 /* don't have this = np */
        !           165: 
        !           166: #define TNP    if(np >= nplim) namerr();
        !           167: #define INRNP  if (np++ >= nplim) namerr();
        !           168: 
        !           169: #define INCNP(x,y)     {np[1].atm = (lispval)(x); np[1].val = (lispval)(y);\
        !           170:                        if(np++ >=  nplim) namerr();}
        !           171: 
        !           172: 
        !           173: /** status codes **********************************************/
        !           174: /*                                                           */
        !           175: /* these define how status and sstatus should service probes  */
        !           176: /* into the lisp data base                                   */
        !           177: 
        !           178: /* common status codes */
        !           179: #define ST_NO 0
        !           180: 
        !           181: /* status codes */
        !           182: #define ST_READ 1
        !           183: #define ST_FEATR 2
        !           184: #define ST_SYNT 3
        !           185: #define ST_RINTB 4
        !           186: #define ST_NFETR 5
        !           187: #define ST_DMPR  6
        !           188: 
        !           189: /* sstatus codes */
        !           190: #define ST_SET 1
        !           191: #define ST_FEATW 2
        !           192: #define ST_TOLC 3
        !           193: #define ST_CORE 4
        !           194: #define ST_INTB 5
        !           195: #define ST_NFETW 6
        !           196: #define ST_DMPW  7
        !           197: 
        !           198: 
        !           199: 
        !           200: /* hashing things *******************************************************/
        !           201: #define        HASHTOP 128     /*  we handle 8-bit characters by dropping top bit  */
        !           202: extern struct  atom    *hasht[HASHTOP];
        !           203: extern int     hash;           /* set by ratom         */
        !           204: extern int     atmlen;         /* length of atom including final null  */
        !           205: 
        !           206: 
        !           207: /* big string buffer for whomever needs it ******************************/
        !           208: extern char    strbuf[STRBLEN];
        !           209: extern char    *endstrb;
        !           210: 
        !           211: /* break and error declarations *****************************************/
        !           212: #define        SAVSIZE 40              /* number of bytes saved by setexit     */
        !           213: #define        BRRETB  1
        !           214: #define BRCONT 2
        !           215: #define        BRGOTO  3
        !           216: #define        BRRETN  4
        !           217: #define INTERRUPT 5
        !           218: #define THROW  6
        !           219: extern int     depth;          /* depth of nested breaks               */
        !           220: extern lispval contval;        /* the value being returned up          */
        !           221: extern int     retval;         /* used by each error/prog call         */
        !           222: extern struct argent *orgnp;   /* used by top level to reset to start  */
        !           223: extern struct nament *orgbnp;  /* used by top level to reset to start  */
        !           224: 
        !           225: 
        !           226: /* other stuff **********************************************************/
        !           227: extern lispval ftemp,vtemp,argptr,ttemp;       /* temporaries: use briefly  */
        !           228: extern int itemp;
        !           229:                                        /* for pointer type conversion  */
        !           230: #include       "dfuncs.h"
        !           231: 
        !           232: #define        NUMBERP 2
        !           233: #define        BCDP    5
        !           234: #define        PORTP   6
        !           235: #define ARRAYP 7
        !           236: 
        !           237: #define        ABSVAL  0
        !           238: #define        MINUS   1
        !           239: #define        ADD1    2
        !           240: #define        SUB1    3
        !           241: #define        NOT     4
        !           242: #define        LNILL   5
        !           243: #define        ZEROP   6
        !           244: #define        ONEP    7
        !           245: #define        PLUS    8
        !           246: #define        TIMES   9
        !           247: #define        DIFFERENCE      10
        !           248: #define        QUOTIENT        11
        !           249: #define        MOD     12
        !           250: #define        LESSP   13
        !           251: #define        GREATERP        14
        !           252: #define        SUM     15
        !           253: #define        PRODUCT 16
        !           254: #define        AND     17
        !           255: #define        OR      18
        !           256: #define        XOR     19
        !           257: 
        !           258: interpt();
        !           259: handler(); extern lispval sigacts[16]; extern sigdelay, sigstruck;
        !           260: 
        !           261: /* limit of valid data area **************************************/
        !           262: 
        !           263: extern lispval datalim;
        !           264: 
        !           265: /** macros to push and pop the value of an atom on the stack ******/
        !           266: 
        !           267: #define PUSHDOWN(atom,value)\
        !           268:        {bnp->atm=atom;bnp++->val=atom->clb;atom->clb=value;if(bnp>bnplim) binderr();}
        !           269: 
        !           270: #define POP\
        !           271:        {--bnp;bnp->atm->clb=bnp->val;}
        !           272: 
        !           273: /** macro for evaluating atoms in eval and interpreter  ***********/
        !           274: 
        !           275: #define EVALATOM(x)    vtemp = x->clb;\
        !           276:                        if( vtemp == CNIL ) {\
        !           277:                                printf("%s: ",(x)->pname);\
        !           278:                                vtemp = error("UNBOUND VARIABLE",TRUE);}
        !           279: 
        !           280: /*  having to do with small integers                                   */
        !           281: 
        !           282: #define SMALL(i)       ((lispval)(1024 + (i<<2)))
        !           283: #define P(p)           ((lispval) (xports +((p)-_iob)))
        !           284: 
        !           285: /*  interpreter globals   */
        !           286: 
        !           287: extern int lctrace;
        !           288: 
        !           289: /* register lisp macros for registers */
        !           290: #define saveonly(n)    asm("#save      n");
        !           291: #define snpand(n)      asm("#protect   n");

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.