Added ifdef USE_XTIMOSI; so that 'make depend' works.
[yaz-moved-to-github.git] / ccl / cclptree.c
1 /* CCL print rpn tree - infix notation
2  * Europagate, 1995
3  *
4  * $Log: cclptree.c,v $
5  * Revision 1.3  1995-09-29 17:11:59  quinn
6  * Smallish
7  *
8  * Revision 1.2  1995/09/27  15:02:44  quinn
9  * Modified function heads & prototypes.
10  *
11  * Revision 1.1  1995/04/10  10:28:20  quinn
12  * Added copy of CCL.
13  *
14  * Revision 1.5  1995/02/23  08:31:59  adam
15  * Changed header.
16  *
17  * Revision 1.3  1995/02/15  17:42:16  adam
18  * Minor changes of the api of this module. FILE* argument added
19  * to ccl_pr_tree.
20  *
21  * Revision 1.2  1995/02/14  19:55:11  adam
22  * Header files ccl.h/cclp.h are gone! They have been merged an
23  * moved to ../include/ccl.h.
24  * Node kind(s) in ccl_rpn_node have changed names.
25  *
26  * Revision 1.1  1995/02/14  10:25:56  adam
27  * The constructions 'qualifier rel term ...' implemented.
28  *
29  */
30
31 #include <stdio.h>
32 #include <assert.h>
33 #include <string.h>
34
35 #include <ccl.h>
36
37 void ccl_pr_tree (struct ccl_rpn_node *rpn, FILE *fd_out)
38 {
39
40     switch (rpn->kind)
41     {
42     case CCL_RPN_TERM:
43         fprintf (fd_out, "\"%s\"", rpn->u.t.term);
44         if (rpn->u.t.attr_list)
45         {
46             struct ccl_rpn_attr *attr;
47             for (attr = rpn->u.t.attr_list; attr; attr = attr->next)
48                 fprintf (fd_out, " %d=%d", attr->type, attr->value);
49         }
50         break;
51     case CCL_RPN_AND:
52         fprintf (fd_out, "(");
53         ccl_pr_tree (rpn->u.p[0], fd_out);
54         fprintf (fd_out, ") and (");
55         ccl_pr_tree (rpn->u.p[1], fd_out);
56         fprintf (fd_out, ")");
57         break;
58     case CCL_RPN_OR:
59         fprintf (fd_out, "(");
60         ccl_pr_tree (rpn->u.p[0], fd_out);
61         fprintf (fd_out, ") or (");
62         ccl_pr_tree (rpn->u.p[1], fd_out);
63         fprintf (fd_out, ")");
64         break;
65     case CCL_RPN_NOT:
66         fprintf (fd_out, "(");
67         ccl_pr_tree (rpn->u.p[0], fd_out);
68         fprintf (fd_out, ") not (");
69         ccl_pr_tree (rpn->u.p[1], fd_out);
70         fprintf (fd_out, ")");
71         break;
72     case CCL_RPN_SET:
73         fprintf (fd_out, "set=%s", rpn->u.setname);
74         break;
75     case CCL_RPN_PROX:
76         fprintf (fd_out, "(");
77         ccl_pr_tree (rpn->u.p[0], fd_out);
78         fprintf (fd_out, ") prox (");
79         ccl_pr_tree (rpn->u.p[1], fd_out);
80         fprintf (fd_out, ")");
81         break;
82     default:
83         assert (0);
84     }
85 }