[project @ 1996-01-12 11:35:21 by partain]
[ghc-hetmet.git] / ghc / compiler / yaccParser / pbinding.h
1 #ifndef pbinding_defined
2 #define pbinding_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         pgrhs
16 } Tpbinding;
17
18 typedef struct { Tpbinding tag; } *pbinding;
19
20 #ifdef __GNUC__
21 Tpbinding tpbinding(pbinding t);
22 extern __inline__ Tpbinding tpbinding(pbinding t)
23 {
24         return(t -> tag);
25 }
26 #else  /* ! __GNUC__ */
27 extern Tpbinding tpbinding PROTO((pbinding));
28 #endif /* ! __GNUC__ */
29
30 struct Spgrhs {
31         Tpbinding tag;
32         tree Xggpat;
33         list Xggdexprs;
34         binding Xggbind;
35         stringId Xggfuncname;
36         long Xggline;
37 };
38
39 extern pbinding mkpgrhs PROTO((tree, list, binding, stringId, long));
40 #ifdef __GNUC__
41
42 tree *Rggpat PROTO((struct Spgrhs *));
43
44 extern __inline__ tree *Rggpat(struct Spgrhs *t)
45 {
46 #ifdef UGEN_DEBUG
47         if(t -> tag != pgrhs)
48                 fprintf(stderr,"ggpat: illegal selection; was %d\n", t -> tag);
49 #endif /* UGEN_DEBUG */
50         return(& t -> Xggpat);
51 }
52 #else  /* ! __GNUC__ */
53 extern tree *Rggpat PROTO((struct Spgrhs *));
54 #endif /* ! __GNUC__ */
55
56 #define ggpat(xyzxyz) (*Rggpat((struct Spgrhs *) (xyzxyz)))
57 #ifdef __GNUC__
58
59 list *Rggdexprs PROTO((struct Spgrhs *));
60
61 extern __inline__ list *Rggdexprs(struct Spgrhs *t)
62 {
63 #ifdef UGEN_DEBUG
64         if(t -> tag != pgrhs)
65                 fprintf(stderr,"ggdexprs: illegal selection; was %d\n", t -> tag);
66 #endif /* UGEN_DEBUG */
67         return(& t -> Xggdexprs);
68 }
69 #else  /* ! __GNUC__ */
70 extern list *Rggdexprs PROTO((struct Spgrhs *));
71 #endif /* ! __GNUC__ */
72
73 #define ggdexprs(xyzxyz) (*Rggdexprs((struct Spgrhs *) (xyzxyz)))
74 #ifdef __GNUC__
75
76 binding *Rggbind PROTO((struct Spgrhs *));
77
78 extern __inline__ binding *Rggbind(struct Spgrhs *t)
79 {
80 #ifdef UGEN_DEBUG
81         if(t -> tag != pgrhs)
82                 fprintf(stderr,"ggbind: illegal selection; was %d\n", t -> tag);
83 #endif /* UGEN_DEBUG */
84         return(& t -> Xggbind);
85 }
86 #else  /* ! __GNUC__ */
87 extern binding *Rggbind PROTO((struct Spgrhs *));
88 #endif /* ! __GNUC__ */
89
90 #define ggbind(xyzxyz) (*Rggbind((struct Spgrhs *) (xyzxyz)))
91 #ifdef __GNUC__
92
93 stringId *Rggfuncname PROTO((struct Spgrhs *));
94
95 extern __inline__ stringId *Rggfuncname(struct Spgrhs *t)
96 {
97 #ifdef UGEN_DEBUG
98         if(t -> tag != pgrhs)
99                 fprintf(stderr,"ggfuncname: illegal selection; was %d\n", t -> tag);
100 #endif /* UGEN_DEBUG */
101         return(& t -> Xggfuncname);
102 }
103 #else  /* ! __GNUC__ */
104 extern stringId *Rggfuncname PROTO((struct Spgrhs *));
105 #endif /* ! __GNUC__ */
106
107 #define ggfuncname(xyzxyz) (*Rggfuncname((struct Spgrhs *) (xyzxyz)))
108 #ifdef __GNUC__
109
110 long *Rggline PROTO((struct Spgrhs *));
111
112 extern __inline__ long *Rggline(struct Spgrhs *t)
113 {
114 #ifdef UGEN_DEBUG
115         if(t -> tag != pgrhs)
116                 fprintf(stderr,"ggline: illegal selection; was %d\n", t -> tag);
117 #endif /* UGEN_DEBUG */
118         return(& t -> Xggline);
119 }
120 #else  /* ! __GNUC__ */
121 extern long *Rggline PROTO((struct Spgrhs *));
122 #endif /* ! __GNUC__ */
123
124 #define ggline(xyzxyz) (*Rggline((struct Spgrhs *) (xyzxyz)))
125
126 #endif