[project @ 1996-03-22 09:24:22 by partain]
[ghc-hetmet.git] / ghc / compiler / yaccParser / entidt.h
1 #ifndef entidt_defined
2 #define entidt_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         entid,
16         enttype,
17         enttypeall,
18         enttypecons,
19         entclass,
20         entmod
21 } Tentidt;
22
23 typedef struct { Tentidt tag; } *entidt;
24
25 #ifdef __GNUC__
26 Tentidt tentidt(entidt t);
27 extern __inline__ Tentidt tentidt(entidt t)
28 {
29         return(t -> tag);
30 }
31 #else  /* ! __GNUC__ */
32 extern Tentidt tentidt PROTO((entidt));
33 #endif /* ! __GNUC__ */
34
35 struct Sentid {
36         Tentidt tag;
37         stringId Xgentid;
38 };
39
40 struct Senttype {
41         Tentidt tag;
42         stringId Xgitentid;
43 };
44
45 struct Senttypeall {
46         Tentidt tag;
47         stringId Xgatentid;
48 };
49
50 struct Senttypecons {
51         Tentidt tag;
52         stringId Xgctentid;
53         list Xgctentcons;
54 };
55
56 struct Sentclass {
57         Tentidt tag;
58         stringId Xgcentid;
59         list Xgcentops;
60 };
61
62 struct Sentmod {
63         Tentidt tag;
64         stringId Xgmentid;
65 };
66
67 extern entidt mkentid PROTO((stringId));
68 #ifdef __GNUC__
69
70 stringId *Rgentid PROTO((struct Sentid *));
71
72 extern __inline__ stringId *Rgentid(struct Sentid *t)
73 {
74 #ifdef UGEN_DEBUG
75         if(t -> tag != entid)
76                 fprintf(stderr,"gentid: illegal selection; was %d\n", t -> tag);
77 #endif /* UGEN_DEBUG */
78         return(& t -> Xgentid);
79 }
80 #else  /* ! __GNUC__ */
81 extern stringId *Rgentid PROTO((struct Sentid *));
82 #endif /* ! __GNUC__ */
83
84 #define gentid(xyzxyz) (*Rgentid((struct Sentid *) (xyzxyz)))
85
86 extern entidt mkenttype PROTO((stringId));
87 #ifdef __GNUC__
88
89 stringId *Rgitentid PROTO((struct Senttype *));
90
91 extern __inline__ stringId *Rgitentid(struct Senttype *t)
92 {
93 #ifdef UGEN_DEBUG
94         if(t -> tag != enttype)
95                 fprintf(stderr,"gitentid: illegal selection; was %d\n", t -> tag);
96 #endif /* UGEN_DEBUG */
97         return(& t -> Xgitentid);
98 }
99 #else  /* ! __GNUC__ */
100 extern stringId *Rgitentid PROTO((struct Senttype *));
101 #endif /* ! __GNUC__ */
102
103 #define gitentid(xyzxyz) (*Rgitentid((struct Senttype *) (xyzxyz)))
104
105 extern entidt mkenttypeall PROTO((stringId));
106 #ifdef __GNUC__
107
108 stringId *Rgatentid PROTO((struct Senttypeall *));
109
110 extern __inline__ stringId *Rgatentid(struct Senttypeall *t)
111 {
112 #ifdef UGEN_DEBUG
113         if(t -> tag != enttypeall)
114                 fprintf(stderr,"gatentid: illegal selection; was %d\n", t -> tag);
115 #endif /* UGEN_DEBUG */
116         return(& t -> Xgatentid);
117 }
118 #else  /* ! __GNUC__ */
119 extern stringId *Rgatentid PROTO((struct Senttypeall *));
120 #endif /* ! __GNUC__ */
121
122 #define gatentid(xyzxyz) (*Rgatentid((struct Senttypeall *) (xyzxyz)))
123
124 extern entidt mkenttypecons PROTO((stringId, list));
125 #ifdef __GNUC__
126
127 stringId *Rgctentid PROTO((struct Senttypecons *));
128
129 extern __inline__ stringId *Rgctentid(struct Senttypecons *t)
130 {
131 #ifdef UGEN_DEBUG
132         if(t -> tag != enttypecons)
133                 fprintf(stderr,"gctentid: illegal selection; was %d\n", t -> tag);
134 #endif /* UGEN_DEBUG */
135         return(& t -> Xgctentid);
136 }
137 #else  /* ! __GNUC__ */
138 extern stringId *Rgctentid PROTO((struct Senttypecons *));
139 #endif /* ! __GNUC__ */
140
141 #define gctentid(xyzxyz) (*Rgctentid((struct Senttypecons *) (xyzxyz)))
142 #ifdef __GNUC__
143
144 list *Rgctentcons PROTO((struct Senttypecons *));
145
146 extern __inline__ list *Rgctentcons(struct Senttypecons *t)
147 {
148 #ifdef UGEN_DEBUG
149         if(t -> tag != enttypecons)
150                 fprintf(stderr,"gctentcons: illegal selection; was %d\n", t -> tag);
151 #endif /* UGEN_DEBUG */
152         return(& t -> Xgctentcons);
153 }
154 #else  /* ! __GNUC__ */
155 extern list *Rgctentcons PROTO((struct Senttypecons *));
156 #endif /* ! __GNUC__ */
157
158 #define gctentcons(xyzxyz) (*Rgctentcons((struct Senttypecons *) (xyzxyz)))
159
160 extern entidt mkentclass PROTO((stringId, list));
161 #ifdef __GNUC__
162
163 stringId *Rgcentid PROTO((struct Sentclass *));
164
165 extern __inline__ stringId *Rgcentid(struct Sentclass *t)
166 {
167 #ifdef UGEN_DEBUG
168         if(t -> tag != entclass)
169                 fprintf(stderr,"gcentid: illegal selection; was %d\n", t -> tag);
170 #endif /* UGEN_DEBUG */
171         return(& t -> Xgcentid);
172 }
173 #else  /* ! __GNUC__ */
174 extern stringId *Rgcentid PROTO((struct Sentclass *));
175 #endif /* ! __GNUC__ */
176
177 #define gcentid(xyzxyz) (*Rgcentid((struct Sentclass *) (xyzxyz)))
178 #ifdef __GNUC__
179
180 list *Rgcentops PROTO((struct Sentclass *));
181
182 extern __inline__ list *Rgcentops(struct Sentclass *t)
183 {
184 #ifdef UGEN_DEBUG
185         if(t -> tag != entclass)
186                 fprintf(stderr,"gcentops: illegal selection; was %d\n", t -> tag);
187 #endif /* UGEN_DEBUG */
188         return(& t -> Xgcentops);
189 }
190 #else  /* ! __GNUC__ */
191 extern list *Rgcentops PROTO((struct Sentclass *));
192 #endif /* ! __GNUC__ */
193
194 #define gcentops(xyzxyz) (*Rgcentops((struct Sentclass *) (xyzxyz)))
195
196 extern entidt mkentmod PROTO((stringId));
197 #ifdef __GNUC__
198
199 stringId *Rgmentid PROTO((struct Sentmod *));
200
201 extern __inline__ stringId *Rgmentid(struct Sentmod *t)
202 {
203 #ifdef UGEN_DEBUG
204         if(t -> tag != entmod)
205                 fprintf(stderr,"gmentid: illegal selection; was %d\n", t -> tag);
206 #endif /* UGEN_DEBUG */
207         return(& t -> Xgmentid);
208 }
209 #else  /* ! __GNUC__ */
210 extern stringId *Rgmentid PROTO((struct Sentmod *));
211 #endif /* ! __GNUC__ */
212
213 #define gmentid(xyzxyz) (*Rgmentid((struct Sentmod *) (xyzxyz)))
214
215 #endif