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