# 2.11BSD#431 - /usr/src/ucb/PORT/pascal/px/vars.h

##### Macros

    BITSPERBYTE       X
    BITSPERLONG       X
    EOFF              X
    EOLN              X
    ERR               X
    FDEF              X
    FILNIL            X
    FREAD             X
    FTEXT             X
    FWRITE            X
    GLVL              X
    HZ                X
    INPUT             X
    MAXFILES          X
    NAMSIZ            X
    NUMOPS            X
    OUTPUT            X
    PDX               X
    PIPE              X
    PIX               X
    PREDEF            X
    PX                X
    PXPFILE           X
    STDLVL            X
    SYNC              X
    TEMP              X
    releq             X
    relge             X
    relgt             X
    relle             X
    rellt             X
    relne             X

##### struct's

    iorec             X
    iorechd           X
    sze8              X

##### unions's

    progcntr          X

       1: /*
       2:  * Copyright (c) 1980 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  *
       6:  *	@(#)vars.h	5.1 (Berkeley) 6/5/85
       7:  */
       8:
       9: #include <stdio.h>
      10:
      11: /*
      12:  * px - Berkeley Pascal interpreter
      13:  *
      14:  * Version 4.0, January 1981
      15:  *
      16:  * Original version by Ken Thompson
      17:  *
      18:  * Substantial revisions by Bill Joy and Chuck Haley
      19:  * November-December 1976
      20:  *
      21:  * Rewritten for VAX 11/780 by Kirk McKusick
      22:  * Fall 1978
      23:  *
      24:  * Rewritten in ``C'' using libpc by Kirk McKusick
      25:  * Winter 1981
      26:  *
      27:  * Px is described in detail in the "PX 4.0 Implementation Notes"
      28:  * The source code for px is in several major pieces:
      29:  *
      30:  *	int.c		C main program which reads in interpreter code
      31:  *	interp.c	Driver including main interpreter loop and
      32:  *			the interpreter instructions grouped by their
      33:  *			positions in the interpreter table.
      34:  *	utilities.c	Interpreter exit, backtrace, and runtime statistics.
      35:  *
      36:  * In addition there are several headers defining mappings for panic
      37:  * names into codes, and a definition of the interpreter transfer
      38:  * table. These are made by the script make.ed1 in this directory and
      39:  * the routine opc.c from ${PASCALDIR}. (see the makefile for details)
      40:  */
      41: #define PXPFILE     "pmon.out"
      42: #define BITSPERBYTE 8
      43: #define BITSPERLONG (BITSPERBYTE * sizeof(long))
      44: #define HZ      100
      45: #define NAMSIZ      76
      46: #define MAXFILES    32
      47: #define PREDEF      2
      48: #ifdef ADDR32
      49: #define STDLVL      ((struct iorec *)(0x7ffffff1))
      50: #define GLVL        ((struct iorec *)(0x7ffffff0))
      51: #endif ADDR32
      52: #ifdef ADDR16
      53: #define STDLVL      ((struct iorec *)(0xfff1))
      54: #define GLVL        ((struct iorec *)(0xfff0))
      55: #endif ADDR16
      56: #define FILNIL      ((struct iorec *)(0))
      57: #define INPUT       ((struct iorec *)(&input))
      58: #define OUTPUT      ((struct iorec *)(&output))
      59: #define ERR     ((struct iorec *)(&_err))
      60: #define PX  0   /* normal run of px */
      61: #define PIX 1   /* load and go */
      62: #define PIPE    2   /* bootstrap via a pipe */
      63: #define PDX 3   /* invoked by the debugger "pdx" */
      64: #define releq 0
      65: #define relne 2
      66: #define rellt 4
      67: #define relgt 6
      68: #define relle 8
      69: #define relge 10
      70: typedef enum {FALSE, TRUE} bool;
      71:
      72: /*
      73:  * interrupt and allocation routines
      74:  */
      75: extern long createtime;
      76: extern char *PALLOC();
      77: extern char *malloc();
      78: extern long time();
      79: extern intr();
      80: extern memsize();
      81: extern syserr();
      82: extern liberr();
      83:
      84: /*
      85:  * stack routines and structures
      86:  */
      87: struct sze8 {
      88:     char element[8];
      89: };
      90: extern short pop2();
      91: extern long pop4();
      92: extern double pop8();
      93: extern struct sze8 popsze8();
      94: extern char *pushsp();
      95:
      96: /*
      97:  * emulated pc types
      98:  */
      99: union progcntr {
     100:     char *cp;
     101:     unsigned char *ucp;
     102:     short *sp;
     103:     unsigned short *usp;
     104:     long *lp;
     105:     double *dbp;
     106:     struct hdr *hdrp;
     107: };
     108:
     109: /*
     110:  * THE RUNTIME DISPLAY
     111:  *
     112:  * The entries in the display point to the active static block marks.
     113:  * The first entry in the display is for the global variables,
     114:  * then the procedure or function at level one, etc.
     115:  * Each display entry points to a stack frame as shown:
     116:  *
     117:  *		base of stack frame
     118:  *		  ---------------
     119:  *		  |		|
     120:  *		  | block mark  |
     121:  *		  |		|
     122:  *		  ---------------  <-- display entry "stp" points here
     123:  *		  |             |  <-- display entry "locvars" points here
     124:  *		  |   local	|
     125:  *		  |  variables  |
     126:  *		  |		|
     127:  *		  ---------------
     128:  *		  |		|
     129:  *		  |  expression |
     130:  *		  |  temporary  |
     131:  *		  |  storage	|
     132:  *		  |		|
     133:  *		  - - - - - - - -
     134:  *
     135:  * The information in the block mark is thus at positive offsets from
     136:  * the display.stp pointer entries while the local variables are at negative
     137:  * offsets from display.locvars. The block mark actually consists of
     138:  * two parts. The first part is created at CALL and the second at entry,
     139:  * i.e. BEGIN. Thus:
     140:  *
     141:  *		-------------------------
     142:  *		|			|
     143:  *		|  Saved lino		|
     144:  *		|  Saved lc		|
     145:  *		|  Saved dp		|
     146:  *		|			|
     147:  *		-------------------------
     148:  *		|			|
     149:  *		|  Saved (dp)		|
     150:  *		|			|
     151:  *		|  Pointer to current 	|
     152:  *		|   routine header info	|
     153:  *		|			|
     154:  *		|  Saved value of	|
     155:  *		|   "curfile"		|
     156:  *		|			|
     157:  *		|  Empty tos value	|
     158:  *		|			|
     159:  *		-------------------------
     160:  */
     161:
     162: /*
     163:  * program variables
     164:  */
     165: extern union display    _display;   /* runtime display */
     166: extern struct dispsave  *_dp;       /* ptr to active frame */
     167: extern long     _lino;      /* current line number */
     168: extern int      _argc;      /* number of passed args */
     169: extern char     **_argv;    /* values of passed args */
     170: extern bool     _nodump;    /* TRUE => no post mortum dump */
     171: extern long     _runtst;    /* TRUE => runtime tests */
     172: extern long     _mode;      /* execl by PX, PIPE, or PIX */
     173: extern long     _stlim;     /* statement limit */
     174: extern long     _stcnt;     /* statement count */
     175: extern long     _seed;      /* random number seed */
     176: extern char     *_maxptr;   /* maximum valid pointer */
     177: extern char     *_minptr;   /* minimum valid pointer */
     178: extern long     *_pcpcount; /* pointer to pxp buffer */
     179: extern long     _cntrs;     /* number of counters */
     180: extern long     _rtns;      /* number of routine cntrs */
     181:
     182: /*
     183:  * The file i/o routines maintain a notion of a "current file".
     184:  * A pointer to this file structure is kept in "curfile".
     185:  *
     186:  * file structures
     187:  */
     188: struct iorechd {
     189:     char        *fileptr;   /* ptr to file window */
     190:     long        lcount;     /* number of lines printed */
     191:     long        llimit;     /* maximum number of text lines */
     192:     FILE        *fbuf;      /* FILE ptr */
     193:     struct iorec    *fchain;    /* chain to next file */
     194:     struct iorec    *flev;      /* ptr to associated file variable */
     195:     char        *pfname;    /* ptr to name of file */
     196:     short       funit;      /* file status flags */
     197:     short       fblk;       /* index into active file table */
     198:     long        fsize;      /* size of elements in the file */
     199:     char        fname[NAMSIZ];  /* name of associated UNIX file */
     200: };
     201:
     202: struct iorec {
     203:     char        *fileptr;   /* ptr to file window */
     204:     long        lcount;     /* number of lines printed */
     205:     long        llimit;     /* maximum number of text lines */
     206:     FILE        *fbuf;      /* FILE ptr */
     207:     struct iorec    *fchain;    /* chain to next file */
     208:     struct iorec    *flev;      /* ptr to associated file variable */
     209:     char        *pfname;    /* ptr to name of file */
     210:     short       funit;      /* file status flags */
     211:     short       fblk;       /* index into active file table */
     212:     long        fsize;      /* size of elements in the file */
     213:     char        fname[NAMSIZ];  /* name of associated UNIX file */
     214:     char        buf[BUFSIZ];    /* I/O buffer */
     215:     char        window[1];  /* file window element */
     216: };
     217:
     218: /*
     219:  * unit flags
     220:  */
     221: #define FDEF    0x80    /* 1 => reserved file name */
     222: #define FTEXT   0x40    /* 1 => text file, process EOLN */
     223: #define FWRITE  0x20    /* 1 => open for writing */
     224: #define FREAD   0x10    /* 1 => open for reading */
     225: #define TEMP    0x08    /* 1 => temporary file */
     226: #define SYNC    0x04    /* 1 => window is out of sync */
     227: #define EOLN    0x02    /* 1 => at end of line */
     228: #define EOFF    0x01    /* 1 => at end of file */
     229:
     230: /*
     231:  * file routines
     232:  */
     233: extern struct iorec *GETNAME();
     234: extern char     *MKTEMP();
     235:
     236: /*
     237:  * file record variables
     238:  */
     239: extern struct iorechd   _fchain;    /* head of active file chain */
     240: extern struct iorec *_actfile[];    /* table of active files */
     241: extern long     _filefre;   /* last used entry in _actfile */
     242:
     243: /*
     244:  * standard files
     245:  */
     246: extern struct iorechd   input;
     247: extern struct iorechd   output;
     248: extern struct iorechd   _err;
     249:
     250: /*
     251:  * Px execution profile array
     252:  */
     253: #ifdef PROFILE
     254: #define NUMOPS 256
     255: extern long _profcnts[NUMOPS];
     256: #endif PROFILE

#### Defined struct's

iorec defined in line 202; used 24 times

- in line 193-194(2), 207-208(4), 233(2), 240(2)
- in /usr/src/ucb/PORT/pascal/px/interp.c line 94(2), 127(2), 144(2), 165-168(8)

iorechd defined in line 188; used 16 times

- in line 239(2), 246-248(6)
- in /usr/src/ucb/PORT/pascal/px/interp.c line 49(2), 61(2), 73(2), 90(2)

sze8 defined in line 87; used 12 times

- in line 93(2)
- in /usr/src/ucb/PORT/pascal/px/interp.c line 136(2), 558(2), 998(2), 1033(2), 1068(2)

#### Defined union's

progcntr defined in line 99; used 10 times

- in /usr/src/ucb/PORT/pascal/px/int.c line 39(2), 190(2)
- in /usr/src/ucb/PORT/pascal/px/interp.c line 104(2), 125(2), 143(2)

#### Defined macros

BITSPERBYTE defined in line 42; used 1 times

- in line 43

BITSPERLONG defined in line 43; never used
EOFF defined in line 228; used 2 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 57, 69

EOLN defined in line 227; used 1 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 81

ERR defined in line 59; used 3 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 66, 97, 1512

FDEF defined in line 221; never used
FILNIL defined in line 56; used 2 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 54, 160

FREAD defined in line 224; used 1 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 81

FTEXT defined in line 222; used 3 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 57, 69, 81

FWRITE defined in line 223; used 2 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 57, 69

GLVL defined in line 54; never used
HZ defined in line 44; never used
INPUT defined in line 57; used 4 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 92-95(2), 168, 1503

MAXFILES defined in line 46; used 2 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 94, 160

NAMSIZ defined in line 45; used 2 times

- in line 199, 213

NUMOPS defined in line 254; used 4 times

- in line 255
- in /usr/src/ucb/PORT/pascal/px/interp.c line 111
- in /usr/src/ucb/PORT/pascal/px/utilities.c line 26, 46

OUTPUT defined in line 58; used 4 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 78, 96, 167, 1507

PDX defined in line 63; used 2 times

- in /usr/src/ucb/PORT/pascal/px/int.c line 66, 158

PIPE defined in line 62; used 3 times

- in /usr/src/ucb/PORT/pascal/px/int.c line 74, 96, 123

PIX defined in line 61; used 4 times

- in /usr/src/ucb/PORT/pascal/px/int.c line 70, 141, 158
- in /usr/src/ucb/PORT/pascal/px/utilities.c line 107

PREDEF defined in line 47; used 1 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 89

PX defined in line 60; used 2 times

- in /usr/src/ucb/PORT/pascal/px/int.c line 79, 88

PXPFILE defined in line 41; never used
STDLVL defined in line 53; used 3 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 55, 67, 79

SYNC defined in line 226; used 1 times

- in /usr/src/ucb/PORT/pascal/px/interp.c line 81

TEMP defined in line 225; never used
releq defined in line 64; never used
relge defined in line 69; never used
relgt defined in line 67; never used
relle defined in line 68; never used
rellt defined in line 66; never used
relne defined in line 65; never used

#### Usage of this include

vars.h used 3 times

- in /usr/src/ucb/PORT/pascal/px/int.c line 29
- in /usr/src/ucb/PORT/pascal/px/interp.c line 14
- in /usr/src/ucb/PORT/pascal/px/utilities.c line 13

Last modified: 1985-06-05 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 798 |