X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=zutil%2Fyaz-ccl.c;h=440972f3231a9d3bc2304230dfc62cd35727717f;hb=ece0783e15e266f33b30db9d55b2dcdbacb55ac6;hp=6b80f72f9b58d6c742c6295960a504ff8dd752d5;hpb=c126b2a625462f95475f00efdfdf9ce41a0e9c79;p=yaz-moved-to-github.git diff --git a/zutil/yaz-ccl.c b/zutil/yaz-ccl.c index 6b80f72..440972f 100644 --- a/zutil/yaz-ccl.c +++ b/zutil/yaz-ccl.c @@ -4,7 +4,19 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: yaz-ccl.c,v $ - * Revision 1.5 2000-01-31 13:15:22 adam + * Revision 1.9 2000-11-27 14:16:55 adam + * Fixed bug in ccl_rpn_simple regarding resultSetId's. + * + * Revision 1.8 2000/11/16 13:03:13 adam + * Function ccl_rpn_query sets attributeSet to Bib-1. + * + * Revision 1.7 2000/11/16 09:58:02 adam + * Implemented local AttributeSet setting for CCL field maps. + * + * Revision 1.6 2000/02/02 15:13:23 adam + * Minor change. + * + * Revision 1.5 2000/01/31 13:15:22 adam * Removed uses of assert(3). Cleanup of ODR. CCL parser update so * that some characters are not surrounded by spaces in resulting term. * ILL-code updates. @@ -82,6 +94,22 @@ static Z_AttributesPlusTerm *ccl_rpn_term (ODR o, struct ccl_rpn_node *p) (int *)odr_malloc(o, sizeof(int)); *elements[i]->attributeType = attr->type; elements[i]->attributeSet = 0; + if (attr->set && *attr->set) + { + int value = oid_getvalbyname (attr->set); + + if (value != VAL_NONE) + { + int oid[OID_SIZE]; + struct oident ident; + + ident.oclass = CLASS_ATTSET; + ident.proto = PROTO_Z3950; + ident.value = value; + elements[i]->attributeSet = + odr_oiddup (o, oid_ent_to_oid (&ident, oid)); + } + } elements[i]->which = Z_AttributeValue_numeric; elements[i]->value.numeric = (int *)odr_malloc (o, sizeof(int)); @@ -120,7 +148,7 @@ static Z_Operand *ccl_rpn_simple (ODR o, struct ccl_rpn_node *p) break; case CCL_RPN_SET: zo->which = Z_Operand_resultSetId; - zo->u.resultSetId = p->u.setname; + zo->u.resultSetId = odr_strdup (o, p->u.setname); break; default: return 0; @@ -217,9 +245,14 @@ static Z_RPNStructure *ccl_rpn_structure (ODR o, struct ccl_rpn_node *p) Z_RPNQuery *ccl_rpn_query (ODR o, struct ccl_rpn_node *p) { Z_RPNQuery *zq; + oident bib1; + int oid[OID_SIZE]; + bib1.proto = PROTO_Z3950; + bib1.oclass = CLASS_ATTSET; + bib1.value = VAL_BIB1; zq = (Z_RPNQuery *)odr_malloc (o, sizeof(*zq)); - zq->attributeSetId = NULL; + zq->attributeSetId = odr_oiddup (o, oid_ent_to_oid (&bib1, oid)); zq->RPNStructure = ccl_rpn_structure (o, p); return zq; } @@ -282,6 +315,5 @@ void ccl_pquery (WRBUF w, struct ccl_rpn_node *p) wrbuf_puts (w, p->u.t.term); wrbuf_puts (w, "} "); break; - default: } }