[project @ 1996-01-08 20:28:12 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         nofinfo,
16         finfo
17 } Tfinfot;
18
19 typedef struct { Tfinfot tag; } *finfot;
20
21 #ifdef __GNUC__
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 Snofinfo {
31         Tfinfot tag;
32 };
33
34 struct Sfinfo {
35         Tfinfot tag;
36         stringId Xfi1;
37         stringId Xfi2;
38 };
39
40 extern finfot mknofinfo PROTO(());
41
42 extern finfot mkfinfo PROTO((stringId, stringId));
43 #ifdef __GNUC__
44
45 extern __inline__ stringId *Rfi1(struct Sfinfo *t)
46 {
47 #ifdef UGEN_DEBUG
48         if(t -> tag != finfo)
49                 fprintf(stderr,"fi1: illegal selection; was %d\n", t -> tag);
50 #endif /* UGEN_DEBUG */
51         return(& t -> Xfi1);
52 }
53 #else  /* ! __GNUC__ */
54 extern stringId *Rfi1 PROTO((struct Sfinfo *));
55 #endif /* ! __GNUC__ */
56
57 #define fi1(xyzxyz) (*Rfi1((struct Sfinfo *) (xyzxyz)))
58 #ifdef __GNUC__
59
60 extern __inline__ stringId *Rfi2(struct Sfinfo *t)
61 {
62 #ifdef UGEN_DEBUG
63         if(t -> tag != finfo)
64                 fprintf(stderr,"fi2: illegal selection; was %d\n", t -> tag);
65 #endif /* UGEN_DEBUG */
66         return(& t -> Xfi2);
67 }
68 #else  /* ! __GNUC__ */
69 extern stringId *Rfi2 PROTO((struct Sfinfo *));
70 #endif /* ! __GNUC__ */
71
72 #define fi2(xyzxyz) (*Rfi2((struct Sfinfo *) (xyzxyz)))
73
74 #endif