[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / compiler / yaccParser / list.c
1
2
3 #include "hspincl.h"
4 #include "yaccParser/list.h"
5
6 Tlist tlist(t)
7  list t;
8 {
9         return(t -> tag);
10 }
11
12
13 /************** lcons ******************/
14
15 list mklcons(PPlhd, PPltl)
16  VOID_STAR PPlhd;
17  list PPltl;
18 {
19         register struct Slcons *pp =
20                 (struct Slcons *) malloc(sizeof(struct Slcons));
21         pp -> tag = lcons;
22         pp -> Xlhd = PPlhd;
23         pp -> Xltl = PPltl;
24         return((list)pp);
25 }
26
27 VOID_STAR *Rlhd(t)
28  struct Slcons *t;
29 {
30 #ifdef UGEN_DEBUG
31         if(t -> tag != lcons)
32                 fprintf(stderr,"lhd: illegal selection; was %d\n", t -> tag);
33 #endif /* UGEN_DEBUG */
34         return(& t -> Xlhd);
35 }
36
37 list *Rltl(t)
38  struct Slcons *t;
39 {
40 #ifdef UGEN_DEBUG
41         if(t -> tag != lcons)
42                 fprintf(stderr,"ltl: illegal selection; was %d\n", t -> tag);
43 #endif /* UGEN_DEBUG */
44         return(& t -> Xltl);
45 }
46
47 /************** lnil ******************/
48
49 list mklnil()
50 {
51         register struct Slnil *pp =
52                 (struct Slnil *) malloc(sizeof(struct Slnil));
53         pp -> tag = lnil;
54         return((list)pp);
55 }