1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  *
7  *	@(#)defines.h	5.4 (Berkeley) 04/12/91
8  */
9 
10 /*
11  * defines.h
12  *
13  * Global definitions for the first pass of the f77 compiler, Unix 4.3 BSD.
14  *
15  * University of Utah CS Dept modification history:
16  *
17  * $Log:	defines.h,v $
18  * Revision 5.2  85/08/10  05:11:20  donn
19  * Added comment header; added Jerry Berkman's changes to delete INTRCNST
20  * and to ifdef 66 code.
21  *
22  */
23 
24 #define INTERDATA 2
25 #define GCOS 3
26 #define PDP11 4
27 #define IBM 5
28 #define CMACH 6
29 #define VAX 7
30 
31 #define DMR 2
32 #define PCC 3
33 
34 #ifndef FAMILY
35 FAMILY NOT DEFINED !!!
36 Family = FAMILY
37 #endif
38 
39 #ifndef HERE
40 HERE NOT DEFINED !!!!
41 Here = HERE
42 #endif
43 
44 #define M(x) (1<<x)
45 #define ALLOC(x)	(struct x *) ckalloc(sizeof(struct x))
46 #define ALLOCN(n,x)	(struct x *) ckalloc(n*sizeof(struct x))
47 #define ALLEXPR		(expptr) ckalloc( sizeof(union Expression) )
48 typedef int *ptr;
49 typedef char *charptr;
50 typedef FILE *FILEP;
51 typedef short flag;
52 typedef char field;	/* actually need only 4 bits */
53 typedef long int ftnint;
54 #define LOCAL static
55 
56 #define NO 0
57 #define YES 1
58 
59 #define CNULL (char *) 0
60 #define PNULL (ptr) 0
61 #define CHNULL (chainp) 0
62 #define ENULL (expptr) 0
63 
64 
65 
66 /* block tag values */
67 
68 #define TNAME 1
69 #define TCONST 2
70 #define TEXPR 3
71 #define TADDR 4
72 #define TTEMP 5
73 #define TPRIM 6
74 #define TLIST 7
75 #define TIMPLDO 8
76 #define TERROR 9
77 
78 
79 /* parser states */
80 
81 #define OUTSIDE 0
82 #define INSIDE 1
83 #define INDCL 2
84 #define INDATA 3
85 #define INEXEC 4
86 
87 /* procedure classes */
88 
89 #define PROCMAIN 1
90 #define PROCBLOCK 2
91 #define PROCSUBR 3
92 #define PROCFUNCT 4
93 
94 
95 /* storage classes -- vstg values */
96 
97 #define STGUNKNOWN 0
98 #define STGARG 1
99 #define STGAUTO 2
100 #define STGBSS 3
101 #define STGINIT 4
102 #define STGCONST 5
103 #define STGEXT 6
104 #define STGINTR 7
105 #define STGSTFUNCT 8
106 #define STGCOMMON 9
107 #define STGEQUIV 10
108 #define STGREG 11
109 #define STGLENG 12
110 #define STGNULL 13
111 #define STGPREG 14
112 
113 /* name classes -- vclass values */
114 
115 #define CLUNKNOWN 0
116 #define CLPARAM 1
117 #define CLVAR 2
118 #define CLENTRY 3
119 #define CLMAIN 4
120 #define CLBLOCK 5
121 #define CLPROC 6
122 #define CLNAMELIST 7
123 
124 
125 /* vprocclass values */
126 
127 #define PUNKNOWN 0
128 #define PEXTERNAL 1
129 #define PINTRINSIC 2
130 #define PSTFUNCT 3
131 #define PTHISPROC 4
132 
133 /* control stack codes */
134 
135 #define CTLDO 1
136 #define CTLIF 2
137 #define CTLELSE 3
138 
139 
140 /* operators -- see also arrays 'ops' and 'ops2' in put.c */
141 
142 #define OPPLUS 1
143 #define OPMINUS 2
144 #define OPSTAR 3
145 #define OPSLASH 4
146 #define OPPOWER 5
147 #define OPNEG 6
148 #define OPOR 7
149 #define OPAND 8
150 #define OPEQV 9
151 #define OPNEQV 10
152 #define OPNOT 11
153 #define OPCONCAT 12
154 #define OPLT 13
155 #define OPEQ 14
156 #define OPGT 15
157 #define OPLE 16
158 #define OPNE 17
159 #define OPGE 18
160 #define OPCALL 19
161 #define OPCCALL 20
162 #define OPASSIGN 21
163 #define OPPLUSEQ 22
164 #define OPSTAREQ 23
165 #define OPCONV 24
166 #define OPLSHIFT 25
167 #define OPMOD 26
168 #define OPCOMMA 27
169 #define OPQUEST 28
170 #define OPCOLON 29
171 #define OPABS 30
172 #define OPMIN 31
173 #define OPMAX 32
174 #define OPADDR 33
175 #define OPINDIRECT 34
176 #define OPBITOR 35
177 #define OPBITAND 36
178 #define OPBITXOR 37
179 #define OPBITNOT 38
180 #define OPRSHIFT 39
181 #define OPPAREN 40
182 #define	OPUNARYPLUS 41
183 
184 
185 /* label type codes */
186 
187 #define LABUNKNOWN 0
188 #define LABEXEC 1
189 #define LABFORMAT 2
190 #define LABOTHER 3
191 
192 
193 /* INTRINSIC function codes*/
194 
195 #define INTREND 0
196 #define INTRCONV 1
197 #define INTRMIN 2
198 #define INTRMAX 3
199 #define INTRGEN 4
200 #define INTRSPEC 5
201 #define INTRBOOL 6
202 
203 
204 /* I/O statement codes */
205 
206 #define IOSTDIN ICON(5)
207 #define IOSTDOUT ICON(6)
208 #define IOSTDERR ICON(0)
209 
210 #define IOSBAD (-1)
211 #define IOSPOSITIONAL 0
212 #define IOSUNIT 1
213 #define IOSFMT 2
214 
215 #define IOINQUIRE 1
216 #define IOOPEN 2
217 #define IOCLOSE 3
218 #define IOREWIND 4
219 #define IOBACKSPACE 5
220 #define IOENDFILE 6
221 #define IOREAD 7
222 #define IOWRITE 8
223 
224 
225 /* type masks */
226 
227 #define MSKLOGICAL	M(TYLOGICAL)
228 #define MSKADDR	M(TYADDR)
229 #define MSKCHAR	M(TYCHAR)
230 #define MSKINT	M(TYSHORT)|M(TYLONG)
231 #define MSKREAL	M(TYREAL)|M(TYDREAL)
232 #define MSKCOMPLEX	M(TYCOMPLEX)|M(TYDCOMPLEX)
233 #define MSKSTATIC (M(STGINIT)|M(STGBSS)|M(STGCOMMON)|M(STGEQUIV)|M(STGCONST))
234 
235 /* miscellaneous macros */
236 
237 #define ONEOF(x,y) (M(x) & (y))
238 #define ISCOMPLEX(z) ONEOF(z, MSKCOMPLEX)
239 #define ISREAL(z) ONEOF(z, MSKREAL)
240 #define ISNUMERIC(z) ONEOF(z, MSKINT|MSKREAL|MSKCOMPLEX)
241 #define ISICON(z) (z->tag==TCONST && ISINT(z->constblock.vtype))
242 #define ISCHAR(z) (z->headblock.vtype==TYCHAR)
243 #define ISINT(z)   ONEOF(z, MSKINT)
244 #define ISCONST(z) (z->tag==TCONST)
245 #define ISERROR(z) (z->tag==TERROR)
246 #define ISPLUSOP(z) (z->tag==TEXPR && z->exprblock.opcode==OPPLUS)
247 #define ISSTAROP(z) (z->tag==TEXPR && z->exprblock.opcode==OPSTAR)
248 #define ISONE(z) (ISICON(z) && z->constblock.constant.ci==1)
249 #define INT(z) ONEOF(z, MSKINT|MSKCHAR)
250 #define ICON(z) mkintcon( (ftnint)(z) )
251 
252 #ifdef ONLY66
253 #define NO66(s)	if(no66flag) err66(s)
254 #define NOEXT(s)	if(noextflag) errext(s)
255 #else
256 #define NO66(s)
257 #define NOEXT(s)
258 #endif
259 
260 /* round a up to a multiple of b */
261 #define roundup(a,b)    ( b * ( (a+b-1)/b) )
262 
263 
264 /* optimization buffer slot types */
265 
266 #define SKNULL		0
267 #define SKIFN		1
268 #define SKGOTO		2
269 #define SKLABEL		3
270 #define SKEQ		4
271 #define SKCALL		5
272 #define SKCMGOTO	6
273 #define SKSTOP		7
274 #define SKDOHEAD	8
275 #define SKENDDO		9
276 #define SKARIF		10
277 #define SKRETURN	11
278 #define SKASGOTO	12
279 #define SKPAUSE		13
280 #define SKASSIGN	14
281 #define SKIOIFN		15
282 #define SKFRTEMP	16
283