- switch(attr->kind)
- {
- case CCL_RPN_ATTR_STRING:
- 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;
- left_trunc = right_trunc = mid_trunc = 0;
- break;
- case CCL_BIB1_COM:
- if (completeness_value != -1)
- continue;
- completeness_value = attr->value.numeric;
- break;
- }
- add_attr_numeric(p, attr->set, attr->type,
- attr->value.numeric);
- }
- }
+ switch(attr->kind)
+ {
+ case CCL_RPN_ATTR_STRING:
+ 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;
+ left_trunc = right_trunc = mid_trunc = 0;
+ break;
+ case CCL_BIB1_COM:
+ if (completeness_value != -1)
+ continue;
+ completeness_value = attr->value.numeric;
+ break;
+ }
+ add_attr_numeric(p, attr->set, attr->type,
+ attr->value.numeric);
+ }
+ }
- /* allow - inside term and treat it as range _always_ */
- /* relation is =. Extract "embedded" - to separate terms */
- if (KIND == CCL_TOK_TERM)
- {
- int i;
- for (i = 0; i<cclp->look_token->len; i++)
- {
- if (cclp->look_token->name[i] == '-')
- break;
- }
-
- if (cclp->look_token->len > 1 && i == 0)
- { /* -xx*/
- struct ccl_token *ntoken = ccl_token_add (cclp->look_token);
-
- ntoken->kind = CCL_TOK_TERM;
- ntoken->name = cclp->look_token->name + 1;
- ntoken->len = cclp->look_token->len - 1;
-
- cclp->look_token->len = 1;
- cclp->look_token->name = "-";
- }
- else if (cclp->look_token->len > 1 && i == cclp->look_token->len-1)
- { /* xx- */
- struct ccl_token *ntoken = ccl_token_add (cclp->look_token);
-
- ntoken->kind = CCL_TOK_TERM;
- ntoken->name = "-";
- ntoken->len = 1;
-
- (cclp->look_token->len)--;
- }
- else if (cclp->look_token->len > 2 && i < cclp->look_token->len)
- { /* xx-yy */
- struct ccl_token *ntoken1 = ccl_token_add (cclp->look_token);
- struct ccl_token *ntoken2 = ccl_token_add (ntoken1);
-
- ntoken1->kind = CCL_TOK_TERM; /* generate - */
- ntoken1->name = "-";
- ntoken1->len = 1;
-
- ntoken2->kind = CCL_TOK_TERM; /* generate yy */
- ntoken2->name = cclp->look_token->name + (i+1);
- ntoken2->len = cclp->look_token->len - (i+1);
-
- cclp->look_token->len = i; /* adjust xx */
- }
- else if (i == cclp->look_token->len &&
- cclp->look_token->next &&
- cclp->look_token->next->kind == CCL_TOK_TERM &&
- cclp->look_token->next->len > 1 &&
- cclp->look_token->next->name[0] == '-')
-
- { /* xx -yy */
- /* we _know_ that xx does not have - in it */
- struct ccl_token *ntoken = ccl_token_add (cclp->look_token);
-
- ntoken->kind = CCL_TOK_TERM; /* generate - */
- ntoken->name = "-";
- ntoken->len = 1;
-
- (ntoken->next->name)++; /* adjust yy */
- (ntoken->next->len)--;
- }
- }
+ /* allow - inside term and treat it as range _always_ */
+ /* relation is =. Extract "embedded" - to separate terms */
+ if (KIND == CCL_TOK_TERM)
+ {
+ size_t i;
+ for (i = 0; i<cclp->look_token->len; i++)
+ {
+ if (cclp->look_token->name[i] == '-')
+ break;
+ }
+
+ if (cclp->look_token->len > 1 && i == 0)
+ { /* -xx*/
+ struct ccl_token *ntoken = ccl_token_add (cclp->look_token);
+
+ ntoken->kind = CCL_TOK_TERM;
+ ntoken->name = cclp->look_token->name + 1;
+ ntoken->len = cclp->look_token->len - 1;
+
+ cclp->look_token->len = 1;
+ cclp->look_token->name = "-";
+ }
+ else if (cclp->look_token->len > 1 && i == cclp->look_token->len-1)
+ { /* xx- */
+ struct ccl_token *ntoken = ccl_token_add (cclp->look_token);
+
+ ntoken->kind = CCL_TOK_TERM;
+ ntoken->name = "-";
+ ntoken->len = 1;
+
+ (cclp->look_token->len)--;
+ }
+ else if (cclp->look_token->len > 2 && i < cclp->look_token->len)
+ { /* xx-yy */
+ struct ccl_token *ntoken1 = ccl_token_add (cclp->look_token);
+ struct ccl_token *ntoken2 = ccl_token_add (ntoken1);
+
+ ntoken1->kind = CCL_TOK_TERM; /* generate - */
+ ntoken1->name = "-";
+ ntoken1->len = 1;
+
+ ntoken2->kind = CCL_TOK_TERM; /* generate yy */
+ ntoken2->name = cclp->look_token->name + (i+1);
+ ntoken2->len = cclp->look_token->len - (i+1);
+
+ cclp->look_token->len = i; /* adjust xx */
+ }
+ else if (i == cclp->look_token->len &&
+ cclp->look_token->next &&
+ cclp->look_token->next->kind == CCL_TOK_TERM &&
+ cclp->look_token->next->len > 1 &&
+ cclp->look_token->next->name[0] == '-')
+
+ { /* xx -yy */
+ /* we _know_ that xx does not have - in it */
+ struct ccl_token *ntoken = ccl_token_add (cclp->look_token);
+
+ ntoken->kind = CCL_TOK_TERM; /* generate - */
+ ntoken->name = "-";
+ ntoken->len = 1;
+
+ (ntoken->next->name)++; /* adjust yy */
+ (ntoken->next->len)--;
+ }
+ }
- struct ccl_rpn_node *p1;
- if (!(p1 = search_term (cclp, ap)))
- return NULL;
- ADVANCE; /* skip '-' */
- if (KIND == CCL_TOK_TERM) /* = term - term ? */
- {
- struct ccl_rpn_node *p2;
-
- if (!(p2 = search_term (cclp, ap)))
- {
- ccl_rpn_delete (p1);
- return NULL;
- }
- p = mk_node (CCL_RPN_AND);
- p->u.p[0] = p1;
- add_attr_numeric (p1, attset, CCL_BIB1_REL, 4);
- p->u.p[1] = p2;
- add_attr_numeric (p2, attset, CCL_BIB1_REL, 2);
- return p;
- }
- else /* = term - */
- {
- add_attr_numeric (p1, attset, CCL_BIB1_REL, 4);
- return p1;
- }
+ struct ccl_rpn_node *p1;
+ if (!(p1 = search_term (cclp, ap)))
+ return NULL;
+ ADVANCE; /* skip '-' */
+ if (KIND == CCL_TOK_TERM) /* = term - term ? */
+ {
+ struct ccl_rpn_node *p2;
+
+ if (!(p2 = search_term (cclp, ap)))
+ {
+ ccl_rpn_delete (p1);
+ return NULL;
+ }
+ p = mk_node (CCL_RPN_AND);
+ p->u.p[0] = p1;
+ add_attr_numeric (p1, attset, CCL_BIB1_REL, 4);
+ p->u.p[1] = p2;
+ add_attr_numeric (p2, attset, CCL_BIB1_REL, 2);
+ return p;
+ }
+ else /* = term - */
+ {
+ add_attr_numeric (p1, attset, CCL_BIB1_REL, 4);
+ return p1;
+ }