summaryrefslogtreecommitdiff
path: root/ghc/compiler/yaccParser/pbinding.c
blob: 4ea35b6d070ecd5d2e4965a43bbf486fc2fe57ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81


#include "hspincl.h"
#include "yaccParser/pbinding.h"

Tpbinding tpbinding(t)
 pbinding t;
{
	return(t -> tag);
}


/************** pgrhs ******************/

pbinding mkpgrhs(PPggpat, PPggdexprs, PPggbind, PPggfuncname, PPggline)
 tree PPggpat;
 list PPggdexprs;
 binding PPggbind;
 stringId PPggfuncname;
 long PPggline;
{
	register struct Spgrhs *pp =
		(struct Spgrhs *) malloc(sizeof(struct Spgrhs));
	pp -> tag = pgrhs;
	pp -> Xggpat = PPggpat;
	pp -> Xggdexprs = PPggdexprs;
	pp -> Xggbind = PPggbind;
	pp -> Xggfuncname = PPggfuncname;
	pp -> Xggline = PPggline;
	return((pbinding)pp);
}

tree *Rggpat(t)
 struct Spgrhs *t;
{
#ifdef UGEN_DEBUG
	if(t -> tag != pgrhs)
		fprintf(stderr,"ggpat: illegal selection; was %d\n", t -> tag);
#endif /* UGEN_DEBUG */
	return(& t -> Xggpat);
}

list *Rggdexprs(t)
 struct Spgrhs *t;
{
#ifdef UGEN_DEBUG
	if(t -> tag != pgrhs)
		fprintf(stderr,"ggdexprs: illegal selection; was %d\n", t -> tag);
#endif /* UGEN_DEBUG */
	return(& t -> Xggdexprs);
}

binding *Rggbind(t)
 struct Spgrhs *t;
{
#ifdef UGEN_DEBUG
	if(t -> tag != pgrhs)
		fprintf(stderr,"ggbind: illegal selection; was %d\n", t -> tag);
#endif /* UGEN_DEBUG */
	return(& t -> Xggbind);
}

stringId *Rggfuncname(t)
 struct Spgrhs *t;
{
#ifdef UGEN_DEBUG
	if(t -> tag != pgrhs)
		fprintf(stderr,"ggfuncname: illegal selection; was %d\n", t -> tag);
#endif /* UGEN_DEBUG */
	return(& t -> Xggfuncname);
}

long *Rggline(t)
 struct Spgrhs *t;
{
#ifdef UGEN_DEBUG
	if(t -> tag != pgrhs)
		fprintf(stderr,"ggline: illegal selection; was %d\n", t -> tag);
#endif /* UGEN_DEBUG */
	return(& t -> Xggline);
}