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