1: /*
   2:  * px - Berkeley Pascal interpreter
   3:  *
   4:  * Version 1.0, July 1977
   5:  *
   6:  * Written by Bill Joy and Chuck Haley
   7:  * November-December 1976
   8:  *
   9:  * Based on an earlier version by Ken Thompson
  10:  *
  11:  * Px is described in detail in the "PX 1.0 Implementation Notes"
  12:  * The source code for px is in several major pieces:
  13:  *
  14:  *	int.c		C main program which reads in interpreter code
  15:  *	00int.s		Driver including main interpreter loop
  16:  *	dd*.s		Where dd are digits, interpreter instructions
  17:  *			grouped by their positions in the interpreter table.
  18:  *	p*.c		Various C language routines supporting the system.
  19:  *
  20:  * In addition there are several headers defining mappings for error
  21:  * messages names into codes, and a definition of the interpreter transfer
  22:  * table. These are made by the script Emake in this directory and the scripts
  23:  * in the directory '../opcodes'.
  24:  */
  25: 
  26: int argc;
  27: char    **argv;
  28: 
  29: /*
  30:  * Pascal runtime errors cause emulator traps
  31:  * to the routine onemt which transfers to the
  32:  * routine 'error' in the file perror.c to decode them.
  33:  * This method saves at least one word per static error.
  34:  */
  35: int onemt();
  36: 
  37: /*
  38:  * Definitions for memory allocation
  39:  * Memory allocation routines are in 'palloc.c'
  40:  */
  41: char    *bottmem, *memptr, *high, *maxstk;
  42: 
  43: /*
  44:  * The file i/o routines maintain a notion of a "current file".
  45:  * The printing name of this file is kept in the variable
  46:  * "file" for use in error messages.
  47:  */
  48: char    *file;
  49: 
  50: /*
  51:  * THE RUNTIME DISPLAY
  52:  *
  53:  * The entries in the display point to the active static block marks.
  54:  * The first entry in the display is for the global variables,
  55:  * then the procedure or function at level one, etc.
  56:  * Each display entry points to a stack frame as shown:
  57:  *
  58:  *		base of stack frame
  59:  *		  ---------------
  60:  *		  |		|
  61:  *		  | block mark  |
  62:  *		  |		|
  63:  *		  ---------------  <-- display entry points here
  64:  *		  |             |
  65:  *		  |   local	|
  66:  *		  |  variables  |
  67:  *		  |		|
  68:  *		  ---------------
  69:  *		  |		|
  70:  *		  |  expression |
  71:  *		  |  temporary  |
  72:  *		  |  storage	|
  73:  *		  |		|
  74:  *		  - - - - - - - -
  75:  *
  76:  * The information in the block mark is thus at positive offsets from
  77:  * the display pointer entries while the local variables are at negative
  78:  * offsets. The block mark actually consists of two parts. The first
  79:  * part is created at CALL and the second at entry, i.e. BEGIN. Thus:
  80:  *
  81:  *		-------------------------
  82:  *		|			|
  83:  *		|  Saved lino		|
  84:  *		|  Saved lc		|
  85:  *		|  Saved dp		|
  86:  *		|			|
  87:  *		-------------------------
  88:  *		|			|
  89:  *		|  Saved (dp)		|
  90:  *		|			|
  91:  *		|  Current section name	|
  92:  *		|   and entry line ptr	|
  93:  *		|			|
  94:  *		|  Saved file name and	|
  95:  *		|   file buffer ptr	|
  96:  *		|			|
  97:  *		|  Empty tos value	|
  98:  *		|			|
  99:  *		-------------------------
 100:  */
 101: int display[20], *dp;
 102: 
 103: int lino;
 104: int nodump;
 105: 
 106: /*
 107:  * Random number generator constants
 108:  */
 109: long    seed;
 110: double  randa;
 111: double  randc;
 112: double  randm;
 113: double  randim;
 114: 
 115: /*
 116:  * Structures to access things on the stack
 117:  */
 118: struct {
 119:     char    pchar;
 120: };
 121: struct {
 122:     int pint;
 123:     int p2int;
 124: };
 125: struct {
 126:     long    plong;
 127: };
 128: struct {
 129:     double  pdouble;
 130: };
 131: 
 132: char    discard;

Defined variables

argc defined in line 26; used 7 times
bottmem defined in line 41; used 1 times
discard defined in line 132; used 5 times
display defined in line 101; used 4 times
dp defined in line 101; used 22 times
high defined in line 41; used 3 times
lino defined in line 103; used 9 times
maxstk defined in line 41; used 3 times
memptr defined in line 41; used 6 times
nodump defined in line 104; used 4 times
randa defined in line 110; never used
randc defined in line 111; never used
randm defined in line 112; used 1 times
seed defined in line 109; never used

Usage of this include

Last modified: 1981-12-07
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2617
Valid CSS Valid XHTML 1.0 Strict