X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=zutil%2Fpquery.c;h=6f35004c51fd304b7b83ae389c26d0d3b8783394;hb=e347736dafbae4bbd1eec56e3577353662aee332;hp=a302244d09049aaca7fd177e72d51c0916713716;hpb=161ec45b40a3ab08e08946c9654ab6fea4604760;p=yaz-moved-to-github.git diff --git a/zutil/pquery.c b/zutil/pquery.c index a302244..6f35004 100644 --- a/zutil/pquery.c +++ b/zutil/pquery.c @@ -4,7 +4,13 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: pquery.c,v $ - * Revision 1.1 1999-06-08 10:10:16 adam + * Revision 1.3 1999-12-20 15:20:13 adam + * Implemented ccl_pquery to convert from CCL tree to prefix query. + * + * Revision 1.2 1999/11/30 13:47:12 adam + * Improved installation. Moved header files to include/yaz. + * + * Revision 1.1 1999/06/08 10:10:16 adam * New sub directory zutil. Moved YAZ Compiler to be part of YAZ tree. * * Revision 1.22 1999/04/20 09:56:49 adam @@ -85,10 +91,9 @@ #include #include -#include -#include - -#include +#include +#include +#include static oid_value p_query_dfset = VAL_NONE; @@ -397,6 +402,7 @@ static Z_RPNStructure *rpn_structure (struct lex_info *li, ODR o, { Z_RPNStructure *sz; const char *cp; + int i, attrtype; sz = (Z_RPNStructure *)odr_malloc (o, sizeof(*sz)); switch (li->query_look) @@ -443,9 +449,19 @@ static Z_RPNStructure *rpn_structure (struct lex_info *li, ODR o, else attr_set[num_attr] = VAL_NONE; } - attr_list[2*num_attr] = atoi (li->lex_buf); - attr_list[2*num_attr+1] = atoi (cp+1); - num_attr++; + attrtype = atoi (li->lex_buf); + for (i = 0; i < num_attr; i++) + if (attrtype == attr_list[2*i]) + { + attr_list[2*i+1] = atoi (cp+1); + break; + } + if (i == num_attr) + { + attr_list[2*num_attr] = attrtype; + attr_list[2*num_attr+1] = atoi (cp+1); + num_attr++; + } lex (li); return rpn_structure (li, o, proto, num_attr, max_attr, attr_list,