The constructions 'qualifier rel term ...' implemented.
[egate.git] / ccl / cclptree.c
1 /* CCL print rpn tree - infix notation
2  * Europagate, 1995
3  *
4  * $Log: cclptree.c,v $
5  * Revision 1.1  1995/02/14 10:25:56  adam
6  * The constructions 'qualifier rel term ...' implemented.
7  *
8  */
9
10 #include <stdio.h>
11 #include <assert.h>
12 #include <string.h>
13
14 #include "cclp.h"
15
16 void ccl_pr_tree (struct ccl_rpn_node *rpn)
17 {
18
19     switch (rpn->kind)
20     {
21     case TERM:
22         printf ("\"%s\"", rpn->u.t.term);
23         if (rpn->u.t.attr_list)
24         {
25             struct ccl_rpn_attr *attr;
26             for (attr = rpn->u.t.attr_list; attr; attr = attr->next)
27                 printf (" %d=%d", attr->type, attr->value);
28         }
29         break;
30     case AND:
31         printf ("(");
32         ccl_pr_tree (rpn->u.p[0]);
33         printf (") and (");
34         ccl_pr_tree (rpn->u.p[1]);
35         printf (")");
36         break;
37     case OR:
38         printf ("(");
39         ccl_pr_tree (rpn->u.p[0]);
40         printf (") or (");
41         ccl_pr_tree (rpn->u.p[1]);
42         printf (")");
43         break;
44     case NOT:
45         printf ("(");
46         ccl_pr_tree (rpn->u.p[0]);
47         printf (") not (");
48         ccl_pr_tree (rpn->u.p[1]);
49         printf (")");
50         break;
51     case SET:
52         printf ("set=%s", rpn->u.setname);
53         break;
54     case PROX:
55         printf ("(");
56         ccl_pr_tree (rpn->u.p[0]);
57         printf (") prox (");
58         ccl_pr_tree (rpn->u.p[1]);
59         printf (")");
60         break;
61     default:
62         assert (0);
63     }
64 }