[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / compiler / yaccParser / ttype.c
1
2
3 #include "hspincl.h"
4 #include "yaccParser/ttype.h"
5
6 Tttype tttype(t)
7  ttype t;
8 {
9         return(t -> tag);
10 }
11
12
13 /************** tname ******************/
14
15 ttype mktname(PPgtypeid, PPgtypel)
16  unkId PPgtypeid;
17  list PPgtypel;
18 {
19         register struct Stname *pp =
20                 (struct Stname *) malloc(sizeof(struct Stname));
21         pp -> tag = tname;
22         pp -> Xgtypeid = PPgtypeid;
23         pp -> Xgtypel = PPgtypel;
24         return((ttype)pp);
25 }
26
27 unkId *Rgtypeid(t)
28  struct Stname *t;
29 {
30 #ifdef UGEN_DEBUG
31         if(t -> tag != tname)
32                 fprintf(stderr,"gtypeid: illegal selection; was %d\n", t -> tag);
33 #endif /* UGEN_DEBUG */
34         return(& t -> Xgtypeid);
35 }
36
37 list *Rgtypel(t)
38  struct Stname *t;
39 {
40 #ifdef UGEN_DEBUG
41         if(t -> tag != tname)
42                 fprintf(stderr,"gtypel: illegal selection; was %d\n", t -> tag);
43 #endif /* UGEN_DEBUG */
44         return(& t -> Xgtypel);
45 }
46
47 /************** namedtvar ******************/
48
49 ttype mknamedtvar(PPgnamedtvar)
50  unkId PPgnamedtvar;
51 {
52         register struct Snamedtvar *pp =
53                 (struct Snamedtvar *) malloc(sizeof(struct Snamedtvar));
54         pp -> tag = namedtvar;
55         pp -> Xgnamedtvar = PPgnamedtvar;
56         return((ttype)pp);
57 }
58
59 unkId *Rgnamedtvar(t)
60  struct Snamedtvar *t;
61 {
62 #ifdef UGEN_DEBUG
63         if(t -> tag != namedtvar)
64                 fprintf(stderr,"gnamedtvar: illegal selection; was %d\n", t -> tag);
65 #endif /* UGEN_DEBUG */
66         return(& t -> Xgnamedtvar);
67 }
68
69 /************** tllist ******************/
70
71 ttype mktllist(PPgtlist)
72  ttype PPgtlist;
73 {
74         register struct Stllist *pp =
75                 (struct Stllist *) malloc(sizeof(struct Stllist));
76         pp -> tag = tllist;
77         pp -> Xgtlist = PPgtlist;
78         return((ttype)pp);
79 }
80
81 ttype *Rgtlist(t)
82  struct Stllist *t;
83 {
84 #ifdef UGEN_DEBUG
85         if(t -> tag != tllist)
86                 fprintf(stderr,"gtlist: illegal selection; was %d\n", t -> tag);
87 #endif /* UGEN_DEBUG */
88         return(& t -> Xgtlist);
89 }
90
91 /************** ttuple ******************/
92
93 ttype mkttuple(PPgttuple)
94  list PPgttuple;
95 {
96         register struct Sttuple *pp =
97                 (struct Sttuple *) malloc(sizeof(struct Sttuple));
98         pp -> tag = ttuple;
99         pp -> Xgttuple = PPgttuple;
100         return((ttype)pp);
101 }
102
103 list *Rgttuple(t)
104  struct Sttuple *t;
105 {
106 #ifdef UGEN_DEBUG
107         if(t -> tag != ttuple)
108                 fprintf(stderr,"gttuple: illegal selection; was %d\n", t -> tag);
109 #endif /* UGEN_DEBUG */
110         return(& t -> Xgttuple);
111 }
112
113 /************** tfun ******************/
114
115 ttype mktfun(PPgtfun, PPgtarg)
116  ttype PPgtfun;
117  ttype PPgtarg;
118 {
119         register struct Stfun *pp =
120                 (struct Stfun *) malloc(sizeof(struct Stfun));
121         pp -> tag = tfun;
122         pp -> Xgtfun = PPgtfun;
123         pp -> Xgtarg = PPgtarg;
124         return((ttype)pp);
125 }
126
127 ttype *Rgtfun(t)
128  struct Stfun *t;
129 {
130 #ifdef UGEN_DEBUG
131         if(t -> tag != tfun)
132                 fprintf(stderr,"gtfun: illegal selection; was %d\n", t -> tag);
133 #endif /* UGEN_DEBUG */
134         return(& t -> Xgtfun);
135 }
136
137 ttype *Rgtarg(t)
138  struct Stfun *t;
139 {
140 #ifdef UGEN_DEBUG
141         if(t -> tag != tfun)
142                 fprintf(stderr,"gtarg: illegal selection; was %d\n", t -> tag);
143 #endif /* UGEN_DEBUG */
144         return(& t -> Xgtarg);
145 }
146
147 /************** context ******************/
148
149 ttype mkcontext(PPgtcontextl, PPgtcontextt)
150  list PPgtcontextl;
151  ttype PPgtcontextt;
152 {
153         register struct Scontext *pp =
154                 (struct Scontext *) malloc(sizeof(struct Scontext));
155         pp -> tag = context;
156         pp -> Xgtcontextl = PPgtcontextl;
157         pp -> Xgtcontextt = PPgtcontextt;
158         return((ttype)pp);
159 }
160
161 list *Rgtcontextl(t)
162  struct Scontext *t;
163 {
164 #ifdef UGEN_DEBUG
165         if(t -> tag != context)
166                 fprintf(stderr,"gtcontextl: illegal selection; was %d\n", t -> tag);
167 #endif /* UGEN_DEBUG */
168         return(& t -> Xgtcontextl);
169 }
170
171 ttype *Rgtcontextt(t)
172  struct Scontext *t;
173 {
174 #ifdef UGEN_DEBUG
175         if(t -> tag != context)
176                 fprintf(stderr,"gtcontextt: illegal selection; was %d\n", t -> tag);
177 #endif /* UGEN_DEBUG */
178         return(& t -> Xgtcontextt);
179 }
180
181 /************** unidict ******************/
182
183 ttype mkunidict(PPgunidict_clas, PPgunidict_ty)
184  unkId PPgunidict_clas;
185  ttype PPgunidict_ty;
186 {
187         register struct Sunidict *pp =
188                 (struct Sunidict *) malloc(sizeof(struct Sunidict));
189         pp -> tag = unidict;
190         pp -> Xgunidict_clas = PPgunidict_clas;
191         pp -> Xgunidict_ty = PPgunidict_ty;
192         return((ttype)pp);
193 }
194
195 unkId *Rgunidict_clas(t)
196  struct Sunidict *t;
197 {
198 #ifdef UGEN_DEBUG
199         if(t -> tag != unidict)
200                 fprintf(stderr,"gunidict_clas: illegal selection; was %d\n", t -> tag);
201 #endif /* UGEN_DEBUG */
202         return(& t -> Xgunidict_clas);
203 }
204
205 ttype *Rgunidict_ty(t)
206  struct Sunidict *t;
207 {
208 #ifdef UGEN_DEBUG
209         if(t -> tag != unidict)
210                 fprintf(stderr,"gunidict_ty: illegal selection; was %d\n", t -> tag);
211 #endif /* UGEN_DEBUG */
212         return(& t -> Xgunidict_ty);
213 }
214
215 /************** unityvartemplate ******************/
216
217 ttype mkunityvartemplate(PPgunityvartemplate)
218  unkId PPgunityvartemplate;
219 {
220         register struct Sunityvartemplate *pp =
221                 (struct Sunityvartemplate *) malloc(sizeof(struct Sunityvartemplate));
222         pp -> tag = unityvartemplate;
223         pp -> Xgunityvartemplate = PPgunityvartemplate;
224         return((ttype)pp);
225 }
226
227 unkId *Rgunityvartemplate(t)
228  struct Sunityvartemplate *t;
229 {
230 #ifdef UGEN_DEBUG
231         if(t -> tag != unityvartemplate)
232                 fprintf(stderr,"gunityvartemplate: illegal selection; was %d\n", t -> tag);
233 #endif /* UGEN_DEBUG */
234         return(& t -> Xgunityvartemplate);
235 }
236
237 /************** uniforall ******************/
238
239 ttype mkuniforall(PPguniforall_tv, PPguniforall_ty)
240  list PPguniforall_tv;
241  ttype PPguniforall_ty;
242 {
243         register struct Suniforall *pp =
244                 (struct Suniforall *) malloc(sizeof(struct Suniforall));
245         pp -> tag = uniforall;
246         pp -> Xguniforall_tv = PPguniforall_tv;
247         pp -> Xguniforall_ty = PPguniforall_ty;
248         return((ttype)pp);
249 }
250
251 list *Rguniforall_tv(t)
252  struct Suniforall *t;
253 {
254 #ifdef UGEN_DEBUG
255         if(t -> tag != uniforall)
256                 fprintf(stderr,"guniforall_tv: illegal selection; was %d\n", t -> tag);
257 #endif /* UGEN_DEBUG */
258         return(& t -> Xguniforall_tv);
259 }
260
261 ttype *Rguniforall_ty(t)
262  struct Suniforall *t;
263 {
264 #ifdef UGEN_DEBUG
265         if(t -> tag != uniforall)
266                 fprintf(stderr,"guniforall_ty: illegal selection; was %d\n", t -> tag);
267 #endif /* UGEN_DEBUG */
268         return(& t -> Xguniforall_ty);
269 }
270
271 /************** ty_maybe_nothing ******************/
272
273 ttype mkty_maybe_nothing()
274 {
275         register struct Sty_maybe_nothing *pp =
276                 (struct Sty_maybe_nothing *) malloc(sizeof(struct Sty_maybe_nothing));
277         pp -> tag = ty_maybe_nothing;
278         return((ttype)pp);
279 }
280
281 /************** ty_maybe_just ******************/
282
283 ttype mkty_maybe_just(PPgty_maybe)
284  ttype PPgty_maybe;
285 {
286         register struct Sty_maybe_just *pp =
287                 (struct Sty_maybe_just *) malloc(sizeof(struct Sty_maybe_just));
288         pp -> tag = ty_maybe_just;
289         pp -> Xgty_maybe = PPgty_maybe;
290         return((ttype)pp);
291 }
292
293 ttype *Rgty_maybe(t)
294  struct Sty_maybe_just *t;
295 {
296 #ifdef UGEN_DEBUG
297         if(t -> tag != ty_maybe_just)
298                 fprintf(stderr,"gty_maybe: illegal selection; was %d\n", t -> tag);
299 #endif /* UGEN_DEBUG */
300         return(& t -> Xgty_maybe);
301 }