[project @ 1996-03-22 09:24:22 by partain]
[ghc-hetmet.git] / ghc / compiler / yaccParser / finfot.h
1 #ifndef finfot_defined
2 #define finfot_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         finfo
16 } Tfinfot;
17
18 typedef struct { Tfinfot tag; } *finfot;
19
20 #ifdef __GNUC__
21 Tfinfot tfinfot(finfot t);
22 extern __inline__ Tfinfot tfinfot(finfot t)
23 {
24         return(t -> tag);
25 }
26 #else  /* ! __GNUC__ */
27 extern Tfinfot tfinfot PROTO((finfot));
28 #endif /* ! __GNUC__ */
29
30 struct Sfinfo {
31         Tfinfot tag;
32         stringId Xfi1;
33         stringId Xfi2;
34 };
35
36 extern finfot mkfinfo PROTO((stringId, stringId));
37 #ifdef __GNUC__
38
39 stringId *Rfi1 PROTO((struct Sfinfo *));
40
41 extern __inline__ stringId *Rfi1(struct Sfinfo *t)
42 {
43 #ifdef UGEN_DEBUG
44         if(t -> tag != finfo)
45                 fprintf(stderr,"fi1: illegal selection; was %d\n", t -> tag);
46 #endif /* UGEN_DEBUG */
47         return(& t -> Xfi1);
48 }
49 #else  /* ! __GNUC__ */
50 extern stringId *Rfi1 PROTO((struct Sfinfo *));
51 #endif /* ! __GNUC__ */
52
53 #define fi1(xyzxyz) (*Rfi1((struct Sfinfo *) (xyzxyz)))
54 #ifdef __GNUC__
55
56 stringId *Rfi2 PROTO((struct Sfinfo *));
57
58 extern __inline__ stringId *Rfi2(struct Sfinfo *t)
59 {
60 #ifdef UGEN_DEBUG
61         if(t -> tag != finfo)
62                 fprintf(stderr,"fi2: illegal selection; was %d\n", t -> tag);
63 #endif /* UGEN_DEBUG */
64         return(& t -> Xfi2);
65 }
66 #else  /* ! __GNUC__ */
67 extern stringId *Rfi2 PROTO((struct Sfinfo *));
68 #endif /* ! __GNUC__ */
69
70 #define fi2(xyzxyz) (*Rfi2((struct Sfinfo *) (xyzxyz)))
71
72 #endif