1 /* Copyright (c) 1979 Regents of the University of California */ 2 3 /* static char sccsid[] = "@(#)pc.h 1.2 10/14/80"; */ 4 5 /* 6 * random constants for pc 7 */ 8 9 /* 10 * the name of the display. 11 * the display is made up of saved AP's and FP's. 12 * FP's are used to find locals, and AP's are used to find parameters. 13 * FP and AP are untyped pointers, but are used throughout as (char *). 14 * the display is used by adding AP_OFFSET or FP_OFFSET to the 15 * address of the approriate display entry. 16 */ 17 #define DISPLAYNAME "__disply" 18 struct dispsave { 19 char *savedAP; 20 char *savedFP; 21 }; 22 #define AP_OFFSET ( 0 ) 23 #define FP_OFFSET ( sizeof(char *) ) 24 25 /* 26 * the structure below describes the locals used by the run time system. 27 * at function entry, at least this much space is allocated, 28 * and the following information is filled in: 29 * the address of a routine to close the current frame for unwinding, 30 * a pointer to the display entry for the current static level and 31 * the previous contents of the display for this static level. 32 * the curfile location is used to point to the currently active file, 33 * and is filled in as io is initiated. 34 * one of these structures is allocated on the (negatively growing) stack. 35 * at function entry, fp is set to point to the last field of the struct, 36 * thus the offsets of the fields are as indicated below. 37 */ 38 struct rtlocals { 39 struct iorec *curfile; 40 struct dispsave dsave; 41 struct dispsave *dptr; 42 int (*unwind)(); 43 } rtlocs; 44 #define CURFILEOFFSET ( ( -sizeof rtlocs ) + sizeof rtlocs.unwind ) 45 #define DSAVEOFFSET ( CURFILEOFFSET + sizeof rtlocs.curfile ) 46 #define DPTROFFSET ( DSAVEOFFSET + sizeof rtlocs.dsave ) 47 #define UNWINDOFFSET ( DPTROFFSET + sizeof rtlocs.dptr ) 48 #define UNWINDNAME "_UNWIND" 49 50 /* 51 * the register save mask for saving no registers 52 */ 53 #define RSAVEMASK ( 0 ) 54 55 /* 56 * runtime check mask for divide check and integer overflow 57 */ 58 #define RUNCHECK ( ( 1 << 15 ) | ( 1 << 14 ) ) 59 60 /* 61 * formats for various names 62 * NAMEFORMAT arbitrary length strings. 63 * EXTFORMAT for externals, a preceding underscore. 64 * PREFIXFORMAT used to print made up names with prefixes. 65 * LABELPREFIX with getlab() makes up label names. 66 * LLABELPREFIX with getlab() makes up sdb labels. 67 * a typical use might be to print out a name with a preceeding underscore 68 * with putprintf( EXTFORMAT , 0 , name ); 69 */ 70 #define NAMEFORMAT "%s" 71 #define EXTFORMAT "_%s" 72 #define PREFIXFORMAT "%s%d" 73 #define LABELPREFIX "L" 74 #define LLABELPREFIX "LL" 75 76 /* 77 * the name of the statement counter 78 */ 79 #define STMTCOUNT "__stcnt" 80 81 /* 82 * the name of the pcp counters 83 */ 84 #define PCPCOUNT "__pcpcount" 85 86 /* 87 * a vector of pointer to enclosing functions for fully qualified names. 88 */ 89 char *enclosing[ DSPLYSZ ]; 90 91 /* 92 * and of course ... 93 */ 94 #define BITSPERBYTE 8 95 96 /* 97 * error number for case label not found (ECASE) 98 * stolen from ~mckusick/px/lib/h01errs.h 99 */ 100 #define ECASE 5 101