-void ccl_pr_tree_as_qrpn(struct ccl_rpn_node *rpn, FILE *fd_out, int indent)
-{
- if(indent>0)
- fprintSpaces(indent,fd_out);
- switch (rpn->kind)
- {
- case CCL_RPN_TERM:
- if (rpn->u.t.attr_list)
- {
- struct ccl_rpn_attr *attr;
- for (attr = rpn->u.t.attr_list; attr; attr = attr->next)
- {
- if (attr->set)
- fprintf(fd_out, "@attr %s ", attr->set);
- else
- fprintf(fd_out, "@attr ");
- switch(attr->kind)
- {
- case CCL_RPN_ATTR_NUMERIC:
- fprintf (fd_out, "%d=%d ", attr->type,
- attr->value.numeric);
- break;
- case CCL_RPN_ATTR_STRING:
- fprintf (fd_out, "%d=%s ", attr->type,
- attr->value.str);
- }
- }
- }
- fprintf (fd_out, "\"%s\"\n", rpn->u.t.term);
- break;
- case CCL_RPN_AND:
- fprintf (fd_out, "@and \n");
- ccl_pr_tree_as_qrpn (rpn->u.p[0], fd_out,indent+2);
- ccl_pr_tree_as_qrpn (rpn->u.p[1], fd_out,indent+2);
- break;
- case CCL_RPN_OR:
- fprintf (fd_out, "@or \n");
- ccl_pr_tree_as_qrpn (rpn->u.p[0], fd_out,indent+2);
- ccl_pr_tree_as_qrpn (rpn->u.p[1], fd_out,indent+2);
- break;
- case CCL_RPN_NOT:
- fprintf (fd_out, "@not ");
- ccl_pr_tree_as_qrpn (rpn->u.p[0], fd_out,indent+2);
- ccl_pr_tree_as_qrpn (rpn->u.p[1], fd_out,indent+2);
- break;
- case CCL_RPN_SET:
- fprintf (fd_out, "set=%s ", rpn->u.setname);
- break;
- case CCL_RPN_PROX:
- if (rpn->u.p[2] && rpn->u.p[2]->kind == CCL_RPN_TERM)
- {
- const char *cp = rpn->u.p[2]->u.t.term;
- /* exlusion distance ordered relation which-code unit-code */
- if (*cp == '!')
- {
- /* word order specified */
- if (isdigit(((const unsigned char *) cp)[1]))
- fprintf(fd_out, "@prox 0 %s 1 2 known 2", cp+1);
- else
- fprintf(fd_out, "@prox 0 1 1 2 known 2");
- }
- else if (*cp == '%')
- {
- /* word order not specified */
- if (isdigit(((const unsigned char *) cp)[1]))
- fprintf(fd_out, "@prox 0 %s 0 2 known 2", cp+1);
- else
- fprintf(fd_out, "@prox 0 1 0 2 known 2");
- }
- }
- ccl_pr_tree_as_qrpn (rpn->u.p[0], fd_out,indent+2);
- ccl_pr_tree_as_qrpn (rpn->u.p[1], fd_out,indent+2);
- break;
- default:
- fprintf(stderr,"Internal Error Unknown ccl_rpn node type %d\n",rpn->kind);
- }
-}
-
-
-void ccl_pr_tree (struct ccl_rpn_node *rpn, FILE *fd_out)
-{
- ccl_pr_tree_as_qrpn(rpn,fd_out,0);
-}
-
-
-static void ccl_pquery_complex (WRBUF w, struct ccl_rpn_node *p)