X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ccl%2Fcclptree.c;h=0710fdd6083a653be95006fba0b2abb699c5c1ad;hb=c63b8160e6b822d640a4e92ca4c3d5fb79828bbc;hp=a1f00d541bbc2c8123e86f2f05124972fbadb896;hpb=79fb4b8deb48939a8d9e3fce48c7736eb3b1cf0b;p=yaz-moved-to-github.git diff --git a/ccl/cclptree.c b/ccl/cclptree.c index a1f00d5..0710fdd 100644 --- a/ccl/cclptree.c +++ b/ccl/cclptree.c @@ -44,7 +44,7 @@ /* CCL print rpn tree - infix notation * Europagate, 1995 * - * $Id: cclptree.c,v 1.10 2002-07-12 12:11:33 ja7 Exp $ + * $Id: cclptree.c,v 1.11 2002-12-28 12:13:03 adam Exp $ * * Old Europagate Log: * @@ -98,30 +98,50 @@ void ccl_pr_tree_as_qrpn(struct ccl_rpn_node *rpn, FILE *fd_out, int indent) fprintf (fd_out, "@attr %d=%d ", attr->type, attr->value); } fprintf (fd_out, "\"%s\"\n", rpn->u.t.term); - break; + 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; + 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; + 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; + 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; + fprintf (fd_out, "set=%s ", rpn->u.setname); + break; case CCL_RPN_PROX: - fprintf (fd_out, "@prox "); - 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; + 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(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(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); }