X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=ccl%2Fcclptree.c;fp=ccl%2Fcclptree.c;h=aebcb107689be39dc279670b717631c420bfc88c;hb=d79d0168774190148ff0927cea715996ad82bc62;hp=0000000000000000000000000000000000000000;hpb=98a49f6636e01e87e867688f4fb8a3b696a847ff;p=egate.git diff --git a/ccl/cclptree.c b/ccl/cclptree.c new file mode 100644 index 0000000..aebcb10 --- /dev/null +++ b/ccl/cclptree.c @@ -0,0 +1,64 @@ +/* CCL print rpn tree - infix notation + * Europagate, 1995 + * + * $Log: cclptree.c,v $ + * Revision 1.1 1995/02/14 10:25:56 adam + * The constructions 'qualifier rel term ...' implemented. + * + */ + +#include +#include +#include + +#include "cclp.h" + +void ccl_pr_tree (struct ccl_rpn_node *rpn) +{ + + switch (rpn->kind) + { + case TERM: + printf ("\"%s\"", rpn->u.t.term); + if (rpn->u.t.attr_list) + { + struct ccl_rpn_attr *attr; + for (attr = rpn->u.t.attr_list; attr; attr = attr->next) + printf (" %d=%d", attr->type, attr->value); + } + break; + case AND: + printf ("("); + ccl_pr_tree (rpn->u.p[0]); + printf (") and ("); + ccl_pr_tree (rpn->u.p[1]); + printf (")"); + break; + case OR: + printf ("("); + ccl_pr_tree (rpn->u.p[0]); + printf (") or ("); + ccl_pr_tree (rpn->u.p[1]); + printf (")"); + break; + case NOT: + printf ("("); + ccl_pr_tree (rpn->u.p[0]); + printf (") not ("); + ccl_pr_tree (rpn->u.p[1]); + printf (")"); + break; + case SET: + printf ("set=%s", rpn->u.setname); + break; + case PROX: + printf ("("); + ccl_pr_tree (rpn->u.p[0]); + printf (") prox ("); + ccl_pr_tree (rpn->u.p[1]); + printf (")"); + break; + default: + assert (0); + } +}