Annotation of 40BSD/cmd/px/h00vars.h, revision 1.1.1.1

1.1       root        1: /* Copyright (c) 1979 Regents of the University of California */
                      2: 
                      3: /* static      char sccsid[] = "@(#)h00vars.h 4.1 10/10/80"; */
                      4: 
                      5: /*
                      6:  * px - Berkeley Pascal interpreter
                      7:  *
                      8:  * Version 2.0, January 1979
                      9:  *
                     10:  * Original version by Ken Thompson
                     11:  *
                     12:  * Substantial revisions by Bill Joy and Chuck Haley
                     13:  * November-December 1976
                     14:  *
                     15:  * Rewritten for VAX 11/780 by Kirk McKusick
                     16:  * Fall 1978
                     17:  *
                     18:  * Px is described in detail in the "PX 1.0 Implementation Notes"
                     19:  * The source code for px is in several major pieces:
                     20:  *
                     21:  *     int.c           C main program which reads in interpreter code
                     22:  *     00case.s        Driver including main interpreter loop
                     23:  *     dd*.s           Where dd are digits, interpreter instructions
                     24:  *                     grouped by their positions in the interpreter table.
                     25:  *     p*.c            Various C language routines supporting the system.
                     26:  *
                     27:  * In addition there are several headers defining mappings for error
                     28:  * messages names into codes, and a definition of the interpreter transfer
                     29:  * table. These are made by the script Emake in this directory and the scripts
                     30:  * in the directory '../opcodes'.
                     31:  */
                     32: #define TRUE           1
                     33: #define FALSE          0
                     34: #define BITSPERLONG    32
                     35: 
                     36: long   argc;
                     37: char   **argv;
                     38: 
                     39: /*
                     40:  * Pascal runtime errors transfer to the routine
                     41:  * 'error' in the file perror.c to decode them.
                     42:  */
                     43: int    perrno;         /* number of error which occurred */
                     44: 
                     45: /*
                     46:  * Definitions for memory allocation
                     47:  * Memory allocation is done by palloc in utilities.c
                     48:  */
                     49: 
                     50: /*
                     51:  * The file i/o routines maintain a notion of a "current file".
                     52:  * The printing name of this file is kept in the variable
                     53:  * "file" for use in error messages.
                     54:  */
                     55: char   *file;          /* ptr to active file name */
                     56: long   fchain;         /* head of active file chain */
                     57: 
                     58: /*
                     59:  * THE RUNTIME DISPLAY
                     60:  *
                     61:  * The entries in the display point to the active static block marks.
                     62:  * The first entry in the display is for the global variables,
                     63:  * then the procedure or function at level one, etc.
                     64:  * Each display entry points to a stack frame as shown:
                     65:  *
                     66:  *             base of stack frame
                     67:  *               ---------------
                     68:  *               |             |
                     69:  *               | block mark  |
                     70:  *               |             |
                     71:  *               ---------------  <-- display entry points here
                     72:  *               |             |
                     73:  *               |   local     |
                     74:  *               |  variables  |
                     75:  *               |             |
                     76:  *               ---------------
                     77:  *               |             |
                     78:  *               |  expression |
                     79:  *               |  temporary  |
                     80:  *               |  storage    |
                     81:  *               |             |
                     82:  *               - - - - - - - -
                     83:  *
                     84:  * The information in the block mark is thus at positive offsets from
                     85:  * the display pointer entries while the local variables are at negative
                     86:  * offsets. The block mark actually consists of two parts. The first
                     87:  * part is created at CALL and the second at entry, i.e. BEGIN. Thus:
                     88:  *
                     89:  *             -------------------------
                     90:  *             |                       |
                     91:  *             |  Saved lino           |
                     92:  *             |  Saved lc             |
                     93:  *             |  Saved dp             |
                     94:  *             |                       |
                     95:  *             -------------------------
                     96:  *             |                       |
                     97:  *             |  Saved (dp)           |
                     98:  *             |                       |
                     99:  *             |  Current section name |
                    100:  *             |   and entry line ptr  |
                    101:  *             |                       |
                    102:  *             |  Saved file name and  |
                    103:  *             |   file buffer ptr     |
                    104:  *             |                       |
                    105:  *             |  Empty tos value      |
                    106:  *             |                       |
                    107:  *             -------------------------
                    108:  */
                    109: 
                    110: /*
                    111:  * Structure for accessing things in the block mark
                    112:  */
                    113: struct stack {
                    114:        long    *tos;           /* pointer to top of stack frame */
                    115:        char    *file;          /* pointer to active file name */
                    116:        long    buf;            /* pointer to active file record */
                    117:        struct  {
                    118:                long    nargs;  /* number of bytes of arguments */
                    119:                short   offset; /* offset of procedure in source file */
                    120:                char    name[1];/* name of active procedure */
                    121:                } *entry;
                    122:        struct  stack *disp;    /* previous display value for this level */
                    123:        struct  stack **dp;     /* pointer to active display entry */
                    124:        long    lc;             /* previous location counter */
                    125:        long    lino;           /* previous line number */
                    126:        } *display[20];
                    127: 
                    128: /*
                    129:  * Program option variables
                    130:  */
                    131: long   stcnt;          /* number of statements executed */
                    132: long   stlim;          /* max number of statements to execute */
                    133: long   llimit;         /* max number of lines per text file */
                    134: short  nodump;         /* 1 => no post mortum dump */
                    135: short  mode;           /* mode of input to interpreter */
                    136: #define        PX      0       /* normal run of px */
                    137: #define        PIX     1       /* load and go */
                    138: #define        PIPE    2       /* bootstrap via a pipe */
                    139: 
                    140: /*
                    141:  * Pxp variables
                    142:  */
                    143: char   *pxpbuf;        /* pointer to pxp buffer */
                    144: long   pxpsize;        /* size of pxp buffer */
                    145: 
                    146: #ifdef profile
                    147: /*
                    148:  * Px execution profile data
                    149:  */
                    150: #define        numops 256
                    151: struct cntrec {
                    152:        double  counts[numops]; /* instruction counts */
                    153:        long    runs;           /* number of interpreter runs */
                    154:        long    startdate;      /* date profile started */
                    155:        long    usrtime;        /* total user time consumed */
                    156:        long    systime;        /* total system time consumed */
                    157:        double  stmts;          /* number of pascal statements executed */
                    158:        } profdata;
                    159: long   profcnts[numops];
                    160: #define        proffile        "/usr/grad/mckusick/px/profile/pcnt.out"
                    161: FILE   *datafile;              /* input datafiles */
                    162: #else
                    163: int    profcnts;       /* dummy just to keep the linker happy */
                    164: #endif

unix.superglobalmegacorp.com

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