[project @ 1996-03-22 09:24:22 by partain]
[ghc-hetmet.git] / ghc / compiler / yaccParser / ttype.h
1 #ifndef ttype_defined
2 #define ttype_defined
3
4 #include <stdio.h>
5
6 #ifndef PROTO
7 #ifdef __STDC__
8 #define PROTO(x) x
9 #else
10 #define PROTO(x) /**/
11 #endif
12 #endif
13
14 typedef enum {
15         tname,
16         namedtvar,
17         tllist,
18         ttuple,
19         tfun,
20         context,
21         unidict,
22         unityvartemplate,
23         uniforall,
24         ty_maybe_nothing,
25         ty_maybe_just
26 } Tttype;
27
28 typedef struct { Tttype tag; } *ttype;
29
30 #ifdef __GNUC__
31 Tttype tttype(ttype t);
32 extern __inline__ Tttype tttype(ttype t)
33 {
34         return(t -> tag);
35 }
36 #else  /* ! __GNUC__ */
37 extern Tttype tttype PROTO((ttype));
38 #endif /* ! __GNUC__ */
39
40 struct Stname {
41         Tttype tag;
42         unkId Xgtypeid;
43         list Xgtypel;
44 };
45
46 struct Snamedtvar {
47         Tttype tag;
48         unkId Xgnamedtvar;
49 };
50
51 struct Stllist {
52         Tttype tag;
53         ttype Xgtlist;
54 };
55
56 struct Sttuple {
57         Tttype tag;
58         list Xgttuple;
59 };
60
61 struct Stfun {
62         Tttype tag;
63         ttype Xgtfun;
64         ttype Xgtarg;
65 };
66
67 struct Scontext {
68         Tttype tag;
69         list Xgtcontextl;
70         ttype Xgtcontextt;
71 };
72
73 struct Sunidict {
74         Tttype tag;
75         unkId Xgunidict_clas;
76         ttype Xgunidict_ty;
77 };
78
79 struct Sunityvartemplate {
80         Tttype tag;
81         unkId Xgunityvartemplate;
82 };
83
84 struct Suniforall {
85         Tttype tag;
86         list Xguniforall_tv;
87         ttype Xguniforall_ty;
88 };
89
90 struct Sty_maybe_nothing {
91         Tttype tag;
92 };
93
94 struct Sty_maybe_just {
95         Tttype tag;
96         ttype Xgty_maybe;
97 };
98
99 extern ttype mktname PROTO((unkId, list));
100 #ifdef __GNUC__
101
102 unkId *Rgtypeid PROTO((struct Stname *));
103
104 extern __inline__ unkId *Rgtypeid(struct Stname *t)
105 {
106 #ifdef UGEN_DEBUG
107         if(t -> tag != tname)
108                 fprintf(stderr,"gtypeid: illegal selection; was %d\n", t -> tag);
109 #endif /* UGEN_DEBUG */
110         return(& t -> Xgtypeid);
111 }
112 #else  /* ! __GNUC__ */
113 extern unkId *Rgtypeid PROTO((struct Stname *));
114 #endif /* ! __GNUC__ */
115
116 #define gtypeid(xyzxyz) (*Rgtypeid((struct Stname *) (xyzxyz)))
117 #ifdef __GNUC__
118
119 list *Rgtypel PROTO((struct Stname *));
120
121 extern __inline__ list *Rgtypel(struct Stname *t)
122 {
123 #ifdef UGEN_DEBUG
124         if(t -> tag != tname)
125                 fprintf(stderr,"gtypel: illegal selection; was %d\n", t -> tag);
126 #endif /* UGEN_DEBUG */
127         return(& t -> Xgtypel);
128 }
129 #else  /* ! __GNUC__ */
130 extern list *Rgtypel PROTO((struct Stname *));
131 #endif /* ! __GNUC__ */
132
133 #define gtypel(xyzxyz) (*Rgtypel((struct Stname *) (xyzxyz)))
134
135 extern ttype mknamedtvar PROTO((unkId));
136 #ifdef __GNUC__
137
138 unkId *Rgnamedtvar PROTO((struct Snamedtvar *));
139
140 extern __inline__ unkId *Rgnamedtvar(struct Snamedtvar *t)
141 {
142 #ifdef UGEN_DEBUG
143         if(t -> tag != namedtvar)
144                 fprintf(stderr,"gnamedtvar: illegal selection; was %d\n", t -> tag);
145 #endif /* UGEN_DEBUG */
146         return(& t -> Xgnamedtvar);
147 }
148 #else  /* ! __GNUC__ */
149 extern unkId *Rgnamedtvar PROTO((struct Snamedtvar *));
150 #endif /* ! __GNUC__ */
151
152 #define gnamedtvar(xyzxyz) (*Rgnamedtvar((struct Snamedtvar *) (xyzxyz)))
153
154 extern ttype mktllist PROTO((ttype));
155 #ifdef __GNUC__
156
157 ttype *Rgtlist PROTO((struct Stllist *));
158
159 extern __inline__ ttype *Rgtlist(struct Stllist *t)
160 {
161 #ifdef UGEN_DEBUG
162         if(t -> tag != tllist)
163                 fprintf(stderr,"gtlist: illegal selection; was %d\n", t -> tag);
164 #endif /* UGEN_DEBUG */
165         return(& t -> Xgtlist);
166 }
167 #else  /* ! __GNUC__ */
168 extern ttype *Rgtlist PROTO((struct Stllist *));
169 #endif /* ! __GNUC__ */
170
171 #define gtlist(xyzxyz) (*Rgtlist((struct Stllist *) (xyzxyz)))
172
173 extern ttype mkttuple PROTO((list));
174 #ifdef __GNUC__
175
176 list *Rgttuple PROTO((struct Sttuple *));
177
178 extern __inline__ list *Rgttuple(struct Sttuple *t)
179 {
180 #ifdef UGEN_DEBUG
181         if(t -> tag != ttuple)
182                 fprintf(stderr,"gttuple: illegal selection; was %d\n", t -> tag);
183 #endif /* UGEN_DEBUG */
184         return(& t -> Xgttuple);
185 }
186 #else  /* ! __GNUC__ */
187 extern list *Rgttuple PROTO((struct Sttuple *));
188 #endif /* ! __GNUC__ */
189
190 #define gttuple(xyzxyz) (*Rgttuple((struct Sttuple *) (xyzxyz)))
191
192 extern ttype mktfun PROTO((ttype, ttype));
193 #ifdef __GNUC__
194
195 ttype *Rgtfun PROTO((struct Stfun *));
196
197 extern __inline__ ttype *Rgtfun(struct Stfun *t)
198 {
199 #ifdef UGEN_DEBUG
200         if(t -> tag != tfun)
201                 fprintf(stderr,"gtfun: illegal selection; was %d\n", t -> tag);
202 #endif /* UGEN_DEBUG */
203         return(& t -> Xgtfun);
204 }
205 #else  /* ! __GNUC__ */
206 extern ttype *Rgtfun PROTO((struct Stfun *));
207 #endif /* ! __GNUC__ */
208
209 #define gtfun(xyzxyz) (*Rgtfun((struct Stfun *) (xyzxyz)))
210 #ifdef __GNUC__
211
212 ttype *Rgtarg PROTO((struct Stfun *));
213
214 extern __inline__ ttype *Rgtarg(struct Stfun *t)
215 {
216 #ifdef UGEN_DEBUG
217         if(t -> tag != tfun)
218                 fprintf(stderr,"gtarg: illegal selection; was %d\n", t -> tag);
219 #endif /* UGEN_DEBUG */
220         return(& t -> Xgtarg);
221 }
222 #else  /* ! __GNUC__ */
223 extern ttype *Rgtarg PROTO((struct Stfun *));
224 #endif /* ! __GNUC__ */
225
226 #define gtarg(xyzxyz) (*Rgtarg((struct Stfun *) (xyzxyz)))
227
228 extern ttype mkcontext PROTO((list, ttype));
229 #ifdef __GNUC__
230
231 list *Rgtcontextl PROTO((struct Scontext *));
232
233 extern __inline__ list *Rgtcontextl(struct Scontext *t)
234 {
235 #ifdef UGEN_DEBUG
236         if(t -> tag != context)
237                 fprintf(stderr,"gtcontextl: illegal selection; was %d\n", t -> tag);
238 #endif /* UGEN_DEBUG */
239         return(& t -> Xgtcontextl);
240 }
241 #else  /* ! __GNUC__ */
242 extern list *Rgtcontextl PROTO((struct Scontext *));
243 #endif /* ! __GNUC__ */
244
245 #define gtcontextl(xyzxyz) (*Rgtcontextl((struct Scontext *) (xyzxyz)))
246 #ifdef __GNUC__
247
248 ttype *Rgtcontextt PROTO((struct Scontext *));
249
250 extern __inline__ ttype *Rgtcontextt(struct Scontext *t)
251 {
252 #ifdef UGEN_DEBUG
253         if(t -> tag != context)
254                 fprintf(stderr,"gtcontextt: illegal selection; was %d\n", t -> tag);
255 #endif /* UGEN_DEBUG */
256         return(& t -> Xgtcontextt);
257 }
258 #else  /* ! __GNUC__ */
259 extern ttype *Rgtcontextt PROTO((struct Scontext *));
260 #endif /* ! __GNUC__ */
261
262 #define gtcontextt(xyzxyz) (*Rgtcontextt((struct Scontext *) (xyzxyz)))
263
264 extern ttype mkunidict PROTO((unkId, ttype));
265 #ifdef __GNUC__
266
267 unkId *Rgunidict_clas PROTO((struct Sunidict *));
268
269 extern __inline__ unkId *Rgunidict_clas(struct Sunidict *t)
270 {
271 #ifdef UGEN_DEBUG
272         if(t -> tag != unidict)
273                 fprintf(stderr,"gunidict_clas: illegal selection; was %d\n", t -> tag);
274 #endif /* UGEN_DEBUG */
275         return(& t -> Xgunidict_clas);
276 }
277 #else  /* ! __GNUC__ */
278 extern unkId *Rgunidict_clas PROTO((struct Sunidict *));
279 #endif /* ! __GNUC__ */
280
281 #define gunidict_clas(xyzxyz) (*Rgunidict_clas((struct Sunidict *) (xyzxyz)))
282 #ifdef __GNUC__
283
284 ttype *Rgunidict_ty PROTO((struct Sunidict *));
285
286 extern __inline__ ttype *Rgunidict_ty(struct Sunidict *t)
287 {
288 #ifdef UGEN_DEBUG
289         if(t -> tag != unidict)
290                 fprintf(stderr,"gunidict_ty: illegal selection; was %d\n", t -> tag);
291 #endif /* UGEN_DEBUG */
292         return(& t -> Xgunidict_ty);
293 }
294 #else  /* ! __GNUC__ */
295 extern ttype *Rgunidict_ty PROTO((struct Sunidict *));
296 #endif /* ! __GNUC__ */
297
298 #define gunidict_ty(xyzxyz) (*Rgunidict_ty((struct Sunidict *) (xyzxyz)))
299
300 extern ttype mkunityvartemplate PROTO((unkId));
301 #ifdef __GNUC__
302
303 unkId *Rgunityvartemplate PROTO((struct Sunityvartemplate *));
304
305 extern __inline__ unkId *Rgunityvartemplate(struct Sunityvartemplate *t)
306 {
307 #ifdef UGEN_DEBUG
308         if(t -> tag != unityvartemplate)
309                 fprintf(stderr,"gunityvartemplate: illegal selection; was %d\n", t -> tag);
310 #endif /* UGEN_DEBUG */
311         return(& t -> Xgunityvartemplate);
312 }
313 #else  /* ! __GNUC__ */
314 extern unkId *Rgunityvartemplate PROTO((struct Sunityvartemplate *));
315 #endif /* ! __GNUC__ */
316
317 #define gunityvartemplate(xyzxyz) (*Rgunityvartemplate((struct Sunityvartemplate *) (xyzxyz)))
318
319 extern ttype mkuniforall PROTO((list, ttype));
320 #ifdef __GNUC__
321
322 list *Rguniforall_tv PROTO((struct Suniforall *));
323
324 extern __inline__ list *Rguniforall_tv(struct Suniforall *t)
325 {
326 #ifdef UGEN_DEBUG
327         if(t -> tag != uniforall)
328                 fprintf(stderr,"guniforall_tv: illegal selection; was %d\n", t -> tag);
329 #endif /* UGEN_DEBUG */
330         return(& t -> Xguniforall_tv);
331 }
332 #else  /* ! __GNUC__ */
333 extern list *Rguniforall_tv PROTO((struct Suniforall *));
334 #endif /* ! __GNUC__ */
335
336 #define guniforall_tv(xyzxyz) (*Rguniforall_tv((struct Suniforall *) (xyzxyz)))
337 #ifdef __GNUC__
338
339 ttype *Rguniforall_ty PROTO((struct Suniforall *));
340
341 extern __inline__ ttype *Rguniforall_ty(struct Suniforall *t)
342 {
343 #ifdef UGEN_DEBUG
344         if(t -> tag != uniforall)
345                 fprintf(stderr,"guniforall_ty: illegal selection; was %d\n", t -> tag);
346 #endif /* UGEN_DEBUG */
347         return(& t -> Xguniforall_ty);
348 }
349 #else  /* ! __GNUC__ */
350 extern ttype *Rguniforall_ty PROTO((struct Suniforall *));
351 #endif /* ! __GNUC__ */
352
353 #define guniforall_ty(xyzxyz) (*Rguniforall_ty((struct Suniforall *) (xyzxyz)))
354
355 extern ttype mkty_maybe_nothing PROTO((void));
356
357 extern ttype mkty_maybe_just PROTO((ttype));
358 #ifdef __GNUC__
359
360 ttype *Rgty_maybe PROTO((struct Sty_maybe_just *));
361
362 extern __inline__ ttype *Rgty_maybe(struct Sty_maybe_just *t)
363 {
364 #ifdef UGEN_DEBUG
365         if(t -> tag != ty_maybe_just)
366                 fprintf(stderr,"gty_maybe: illegal selection; was %d\n", t -> tag);
367 #endif /* UGEN_DEBUG */
368         return(& t -> Xgty_maybe);
369 }
370 #else  /* ! __GNUC__ */
371 extern ttype *Rgty_maybe PROTO((struct Sty_maybe_just *));
372 #endif /* ! __GNUC__ */
373
374 #define gty_maybe(xyzxyz) (*Rgty_maybe((struct Sty_maybe_just *) (xyzxyz)))
375
376 #endif