The constructions 'qualifier rel term ...' implemented.
[egate.git] / ccl / cclptree.c
diff --git a/ccl/cclptree.c b/ccl/cclptree.c
new file mode 100644 (file)
index 0000000..aebcb10
--- /dev/null
@@ -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 <stdio.h>
+#include <assert.h>
+#include <string.h>
+
+#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);
+    }
+}