new copyright; att/bsd/shared
[unix-history] / usr / src / usr.bin / pascal / src / pc.h
CommitLineData
0fc6e47b
KB
1/*-
2 * Copyright (c) 1980 The Regents of the University of California.
3 * All rights reserved.
252367af 4 *
0fc6e47b
KB
5 * %sccs.include.redist.c%
6 *
7 * @(#)pc.h 5.3 (Berkeley) %G%
252367af 8 */
32882102
KM
9
10#include <setjmp.h>
f31c0eb1
PK
11
12 /*
7d79ff1c 13 * random constants for pc
f31c0eb1
PK
14 */
15
16 /*
17 * the name of the display.
f31c0eb1
PK
18 */
19#define DISPLAYNAME "__disply"
f31c0eb1
PK
20
21 /*
22 * the structure below describes the locals used by the run time system.
23 * at function entry, at least this much space is allocated,
24 * and the following information is filled in:
25 * the address of a routine to close the current frame for unwinding,
26 * a pointer to the display entry for the current static level and
27 * the previous contents of the display for this static level.
28 * the curfile location is used to point to the currently active file,
29 * and is filled in as io is initiated.
30 * one of these structures is allocated on the (negatively growing) stack.
31 * at function entry, fp is set to point to the last field of the struct,
32 * thus the offsets of the fields are as indicated below.
33 */
fe8ff1f7
KM
34#ifdef vax
35struct rtlocals {
36 jmp_buf gotoenv;
37 struct iorec *curfile;
38 struct dispsave dsave;
39} rtlocs;
40#endif vax
41
42#ifdef tahoe
f31c0eb1 43struct rtlocals {
32882102 44 jmp_buf gotoenv;
f31c0eb1
PK
45 struct iorec *curfile;
46 struct dispsave dsave;
fe8ff1f7 47 long savedregs[9];
f31c0eb1 48} rtlocs;
fe8ff1f7
KM
49#endif tahoe
50
51#ifdef mc68000
52struct rtlocals {
53 jmp_buf gotoenv;
54 struct iorec *curfile;
55 struct dispsave dsave;
56} rtlocs;
57#endif mc68000
58
32882102
KM
59#define GOTOENVOFFSET ( -sizeof rtlocs )
60#define CURFILEOFFSET ( GOTOENVOFFSET + sizeof rtlocs.gotoenv )
f31c0eb1 61#define DSAVEOFFSET ( CURFILEOFFSET + sizeof rtlocs.curfile )
f31c0eb1
PK
62
63 /*
7d79ff1c
PK
64 * this is a cookie used to communicate between the
65 * routine entry code and the routine exit code.
66 * mostly it's for labels shared between the two.
f31c0eb1 67 */
7d79ff1c
PK
68#ifdef vax
69struct entry_exit_cookie {
70 struct nl *nlp;
71 char extname[BUFSIZ];
72 int toplabel;
73 int savlabel;
74};
75#define FRAME_SIZE_LABEL "LF"
76#define SAVE_MASK_LABEL "L"
77#endif vax
f31c0eb1 78
fe8ff1f7
KM
79#ifdef tahoe
80struct entry_exit_cookie {
81 struct nl *nlp;
82 char extname[BUFSIZ];
83 int toplabel;
84 int savlabel;
85};
86#define FRAME_SIZE_LABEL "LF"
87#define SAVE_MASK_LABEL "L"
88#endif tahoe
89
7d79ff1c
PK
90#ifdef mc68000
91struct entry_exit_cookie {
92 struct nl *nlp;
93 char extname[BUFSIZ];
94 int toplabel;
95};
96#define FRAME_SIZE_LABEL "LF"
97#define PAGE_BREAK_LABEL "LP"
98#define SAVE_MASK_LABEL "LS"
99#endif mc68000
f31c0eb1
PK
100
101 /*
102 * formats for various names
103 * NAMEFORMAT arbitrary length strings.
104 * EXTFORMAT for externals, a preceding underscore.
e2345d2c 105 * LABELFORMAT for label names, a preceding dollar-sign.
f31c0eb1
PK
106 * PREFIXFORMAT used to print made up names with prefixes.
107 * LABELPREFIX with getlab() makes up label names.
108 * LLABELPREFIX with getlab() makes up sdb labels.
e641ce92 109 * FORMALPREFIX prefix for EXTFORMAT for formal entry points.
f31c0eb1
PK
110 * a typical use might be to print out a name with a preceeding underscore
111 * with putprintf( EXTFORMAT , 0 , name );
112 */
113#define NAMEFORMAT "%s"
114#define EXTFORMAT "_%s"
e2345d2c 115#define LABELFORMAT "$%s"
f31c0eb1
PK
116#define PREFIXFORMAT "%s%d"
117#define LABELPREFIX "L"
118#define LLABELPREFIX "LL"
e641ce92 119#define FORMALPREFIX "__"
f31c0eb1
PK
120
121 /*
122 * the name of the statement counter
123 */
124#define STMTCOUNT "__stcnt"
125
126 /*
127 * the name of the pcp counters
128 */
129#define PCPCOUNT "__pcpcount"
130
131 /*
132 * a vector of pointer to enclosing functions for fully qualified names.
133 */
134char *enclosing[ DSPLYSZ ];
135
7d79ff1c
PK
136#ifdef vax
137 /*
138 * the runtime framepointer and argumentpointer registers
139 */
140# define P2FP 13
141# define P2FPNAME "fp"
142# define P2AP 12
143# define P2APNAME "ap"
144
145 /*
146 * the register save mask for saving no registers
147 */
148# define RSAVEMASK ( 0 )
149
150 /*
151 * runtime check mask for divide check and integer overflow
152 */
153# define RUNCHECK ( ( 1 << 15 ) | ( 1 << 14 ) )
f763caa4 154
f31c0eb1
PK
155 /*
156 * and of course ...
157 */
7d79ff1c 158# define BITSPERBYTE 8
7d79ff1c
PK
159#endif vax
160
fe8ff1f7
KM
161#ifdef tahoe
162 /*
163 * the runtime framepointer and argumentpointer registers
164 */
165# define P2FP 13
166# define P2FPNAME "fp"
167# define P2AP 13
168# define P2APNAME "fp"
169
170 /*
171 * the register save mask for saving no registers
172 */
173# define RSAVEMASK ( 0 )
174
175 /*
176 * divide check and integer overflow don't exist in the save mask
177 */
178# define RUNCHECK ( 0 )
179
180 /*
181 * and of course ...
182 */
183# define BITSPERBYTE 8
184#endif tahoe
185
7d79ff1c
PK
186#ifdef mc68000
187 /*
f763caa4 188 * these magic numbers lifted from pcc/mac2defs
838d8636
PK
189 * the offsets are for mapping data and address register numbers
190 * to linear register numbers. e.g. d2 ==> r2, and a2 ==> r10.
7d79ff1c 191 */
838d8636
PK
192# define DATA_REG_OFFSET 0
193# define ADDR_REG_OFFSET 8
7d79ff1c 194# define P2FPNAME "a6"
838d8636 195# define P2FP (ADDR_REG_OFFSET + 6)
7d79ff1c 196# define P2APNAME "a6"
838d8636 197# define P2AP (ADDR_REG_OFFSET + 6)
7d79ff1c
PK
198
199 /*
200 * and still ...
201 */
202# define BITSPERBYTE 8
203#endif mc68000