From: Adam Dickmeiss Date: Wed, 3 Jun 2015 12:12:22 +0000 (+0200) Subject: Remove YAZ_781 def (=1) YAZ-781 X-Git-Tag: v5.14.2~9 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=349f8f12502e38018d65da6a6b89cdc95992496a;ds=sidebyside Remove YAZ_781 def (=1) YAZ-781 --- diff --git a/include/yaz/ccl.h b/include/yaz/ccl.h index c22e455..d701095 100644 --- a/include/yaz/ccl.h +++ b/include/yaz/ccl.h @@ -78,8 +78,6 @@ YAZ_BEGIN_CDECL -#define YAZ_781 1 - #define CCL_ERR_OK 0 #define CCL_ERR_TERM_EXPECTED 1 #define CCL_ERR_RP_EXPECTED 2 diff --git a/src/cclfind.c b/src/cclfind.c index c86015f..621d79d 100644 --- a/src/cclfind.c +++ b/src/cclfind.c @@ -327,7 +327,6 @@ static int append_term(CCL_parser cclp, const char *src_str, size_t src_len, } -#if YAZ_781 static struct ccl_rpn_node *ccl_term_one_use(CCL_parser cclp, struct ccl_rpn_attr *attr_use, ccl_qualifier_t *qa, @@ -509,7 +508,6 @@ static struct ccl_rpn_node *ccl_term_one_use(CCL_parser cclp, } return p; } -#endif /** * search_term: Parse CCL search term. @@ -565,19 +563,6 @@ static struct ccl_rpn_node *search_term_x(CCL_parser cclp, int len = 0; int is_phrase = 0; int is_ccl_masked = 0; -#if YAZ_781 -#else - char *attset; - int relation_value = -1; - int position_value = -1; - int structure_value = -1; - int truncation_value = -1; - int completeness_value = -1; - int left_trunc = 0; - int right_trunc = 0; - int regex_trunc = 0; - int z3958_trunc = 0; -#endif size_t max = 200; if (and_list || or_list || !multi) max = 1; @@ -616,7 +601,6 @@ static struct ccl_rpn_node *search_term_x(CCL_parser cclp, if (len == 0) break; /* no more terms . stop . */ -#if YAZ_781 /* go through all attributes and add them to the attribute list */ for (i = 0; qa && qa[i]; i++) { @@ -657,163 +641,6 @@ static struct ccl_rpn_node *search_term_x(CCL_parser cclp, } for (i = 0; i < no; i++) ADVANCE; -#else - /* create the term node, but wait a moment before adding the term */ - p = ccl_rpn_node_create(CCL_RPN_TERM); - p->u.t.attr_list = NULL; - p->u.t.term = NULL; - if (qa && qa[0]) - { - const char *n = ccl_qual_get_name(qa[0]); - if (n) - p->u.t.qual = xstrdup(n); - } - - /* go through all attributes and add them to the attribute list */ - for (i=0; qa && qa[i]; i++) - { - struct ccl_rpn_attr *attr; - - for (attr = ccl_qual_get_attr(qa[i]); attr; attr = attr->next) - switch(attr->kind) - { - case CCL_RPN_ATTR_STRING: - ccl_add_attr_string(p, attr->set, attr->type, - attr->value.str); - break; - case CCL_RPN_ATTR_NUMERIC: - if (attr->value.numeric > 0) - { /* deal only with REAL attributes (positive) */ - switch (attr->type) - { - case CCL_BIB1_REL: - if (relation_value != -1) - continue; - relation_value = attr->value.numeric; - break; - case CCL_BIB1_POS: - if (position_value != -1) - continue; - position_value = attr->value.numeric; - break; - case CCL_BIB1_STR: - if (structure_value != -1) - continue; - structure_value = attr->value.numeric; - break; - case CCL_BIB1_TRU: - if (truncation_value != -1) - continue; - truncation_value = attr->value.numeric; - break; - case CCL_BIB1_COM: - if (completeness_value != -1) - continue; - completeness_value = attr->value.numeric; - break; - } - ccl_add_attr_numeric(p, attr->set, attr->type, - attr->value.numeric); - } - } - } - attset = 0; - if (structure_value == -1 && ( - auto_group || - qual_val_type(qa, CCL_BIB1_STR, CCL_BIB1_STR_WP, &attset)) - ) - { - if (!is_phrase) - ccl_add_attr_numeric(p, attset, CCL_BIB1_STR, 2); - else - ccl_add_attr_numeric(p, attset, CCL_BIB1_STR, 1); - } - - if (qual_val_type(qa, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_REGEX, - &attset)) - { - if (is_ccl_masked) - regex_trunc = 1; /* regex trunc (102) allowed */ - } - else if (qual_val_type(qa, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_Z3958, - &attset)) - { - if (is_ccl_masked) - z3958_trunc = 1; /* Z39.58 trunc (CCL) trunc allowed */ - } - - /* make the RPN token */ - p->u.t.term = (char *)xmalloc(len * 2 + 2); - ccl_assert(p->u.t.term); - p->u.t.term[0] = '\0'; - for (i = 0; ilook_token->name; - size_t src_len = cclp->look_token->len; - - if (p->u.t.term[0] && cclp->look_token->ws_prefix_len) - { - strxcat(p->u.t.term, cclp->look_token->ws_prefix_buf, - cclp->look_token->ws_prefix_len); - } - if (append_term(cclp, src_str, src_len, p->u.t.term, regex_trunc, - z3958_trunc, truncation_aliases, mask_aliases, - i == 0, i == no - 1, - &left_trunc, &right_trunc)) - { - ccl_rpn_delete(p); - return NULL; - } - ADVANCE; - } - if (left_trunc && right_trunc) - { - if (!qual_val_type(qa, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_BOTH, - &attset)) - { - cclp->error_code = CCL_ERR_TRUNC_NOT_BOTH; - ccl_rpn_delete(p); - return NULL; - } - ccl_add_attr_numeric(p, attset, CCL_BIB1_TRU, 3); - } - else if (right_trunc) - { - if (!qual_val_type(qa, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_RIGHT, - &attset)) - { - cclp->error_code = CCL_ERR_TRUNC_NOT_RIGHT; - ccl_rpn_delete(p); - return NULL; - } - ccl_add_attr_numeric(p, attset, CCL_BIB1_TRU, 1); - } - else if (left_trunc) - { - if (!qual_val_type(qa, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_LEFT, - &attset)) - { - cclp->error_code = CCL_ERR_TRUNC_NOT_LEFT; - ccl_rpn_delete(p); - return NULL; - } - ccl_add_attr_numeric(p, attset, CCL_BIB1_TRU, 2); - } - else if (regex_trunc) - { - ccl_add_attr_numeric(p, attset, CCL_BIB1_TRU, 102); - } - else if (z3958_trunc) - { - ccl_add_attr_numeric(p, attset, CCL_BIB1_TRU, 104); - } - else - { - if (qual_val_type(qa, CCL_BIB1_TRU, CCL_BIB1_TRU_CAN_NONE, - &attset)) - ccl_add_attr_numeric(p, attset, CCL_BIB1_TRU, 100); - } -#endif /* make the top node point to us.. */ if (p_top) { diff --git a/test/test_ccl.c b/test/test_ccl.c index fc244b6..bcd753c 100644 --- a/test/test_ccl.c +++ b/test/test_ccl.c @@ -263,12 +263,8 @@ void tst1(int pass) "@prox 0 1 0 2 k 2 " "@attr 4=2 @attr 1=1016 a " "@or @attr 4=2 @attr 1=1016 b " -#if YAZ_781 "@or @attr 4=2 @attr 1=/my/title c " "@attr 4=2 @attr 1=1016 c " -#else - "@attr 4=2 @attr 1=1016 @attr 1=/my/title c " -#endif )); YAZ_CHECK(tst_ccl_query(bibset, "(a b) % (c)",