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