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