xref: /csrg-svn/usr.bin/pascal/src/pc.h (revision 10659)
1 /* Copyright (c) 1979 Regents of the University of California */
2 
3 /* static	char sccsid[] = "@(#)pc.h 1.7 02/01/83"; */
4 
5 #include <setjmp.h>
6 
7     /*
8      *	random constants for pc
9      */
10 
11     /*
12      *	the name of the display.
13      */
14 #define	DISPLAYNAME	"__disply"
15 
16     /*
17      *	the structure below describes the locals used by the run time system.
18      *	at function entry, at least this much space is allocated,
19      *	and the following information is filled in:
20      *	the address of a routine to close the current frame for unwinding,
21      *	a pointer to the display entry for the current static level and
22      *	the previous contents of the display for this static level.
23      *	the curfile location is used to point to the currently active file,
24      *	and is filled in as io is initiated.
25      *	one of these structures is allocated on the (negatively growing) stack.
26      *	at function entry, fp is set to point to the last field of the struct,
27      *	thus the offsets of the fields are as indicated below.
28      */
29 struct rtlocals {
30     jmp_buf		gotoenv;
31     struct iorec	*curfile;
32     struct dispsave	dsave;
33 } rtlocs;
34 #define	GOTOENVOFFSET	( -sizeof rtlocs )
35 #define	CURFILEOFFSET	( GOTOENVOFFSET + sizeof rtlocs.gotoenv )
36 #define	DSAVEOFFSET	( CURFILEOFFSET + sizeof rtlocs.curfile )
37 
38     /*
39      *	this is a cookie used to communicate between the
40      *	routine entry code and the routine exit code.
41      *	mostly it's for labels shared between the two.
42      */
43 #ifdef vax
44 struct entry_exit_cookie {
45     struct nl	*nlp;
46     char	extname[BUFSIZ];
47     int		toplabel;
48     int		savlabel;
49 };
50 #define	FRAME_SIZE_LABEL	"LF"
51 #define	SAVE_MASK_LABEL		"L"
52 #endif vax
53 
54 #ifdef mc68000
55 struct entry_exit_cookie {
56     struct nl	*nlp;
57     char	extname[BUFSIZ];
58     int		toplabel;
59 };
60 #define	FRAME_SIZE_LABEL	"LF"
61 #define	PAGE_BREAK_LABEL	"LP"
62 #define	SAVE_MASK_LABEL		"LS"
63 #endif mc68000
64 
65     /*
66      *	formats for various names
67      *	    NAMEFORMAT		arbitrary length strings.
68      *	    EXTFORMAT		for externals, a preceding underscore.
69      *	    LABELFORMAT		for label names, a preceding dollar-sign.
70      *	    PREFIXFORMAT	used to print made up names with prefixes.
71      *	    LABELPREFIX		with getlab() makes up label names.
72      *	    LLABELPREFIX	with getlab() makes up sdb labels.
73      *	    FORMALPREFIX	prefix for EXTFORMAT for formal entry points.
74      *	a typical use might be to print out a name with a preceeding underscore
75      *	with putprintf( EXTFORMAT , 0 , name );
76      */
77 #define	NAMEFORMAT	"%s"
78 #define	EXTFORMAT	"_%s"
79 #define	LABELFORMAT	"$%s"
80 #define	PREFIXFORMAT	"%s%d"
81 #define	LABELPREFIX	"L"
82 #define	LLABELPREFIX	"LL"
83 #define	FORMALPREFIX	"__"
84 
85     /*
86      *	the name of the statement counter
87      */
88 #define	STMTCOUNT	"__stcnt"
89 
90     /*
91      *	the name of the pcp counters
92      */
93 #define	PCPCOUNT	"__pcpcount"
94 
95     /*
96      *	a vector of pointer to enclosing functions for fully qualified names.
97      */
98 char	*enclosing[ DSPLYSZ ];
99 
100 #ifdef vax
101     /*
102      *	the runtime framepointer and argumentpointer registers
103      */
104 #   define	P2FP		13
105 #   define	P2FPNAME	"fp"
106 #   define	P2AP		12
107 #   define	P2APNAME	"ap"
108 
109     /*
110      *	the register save mask for saving no registers
111      */
112 #   define	RSAVEMASK	( 0 )
113 
114     /*
115      *	runtime check mask for divide check and integer overflow
116      */
117 #   define	RUNCHECK	( ( 1 << 15 ) | ( 1 << 14 ) )
118     /*
119      *	and of course ...
120      */
121 #   define	BITSPERBYTE	8
122 
123 #endif vax
124 
125 #ifdef mc68000
126     /*
127      *	this magic numbers lifted from pcc/mac2defs
128      */
129 #   define	P2FP		14
130 #   define	P2FPNAME	"a6"
131 #   define	P2AP		14
132 #   define	P2APNAME	"a6"
133 
134     /*
135      *	and still ...
136      */
137 #   define	BITSPERBYTE	8
138 #endif mc68000
139