X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=zutil%2Fyaz-ccl.c;h=4c86dfe130fa01f10537996d23ffad42b898359a;hb=670615227704f9ab1dc20c8bdf3db8f09b9600ea;hp=f4033e1e8428e422c236fe1d3217b677d4eb4e47;hpb=da907ba05501a2050d0a70b1d1fdf22a8130589a;p=yaz-moved-to-github.git diff --git a/zutil/yaz-ccl.c b/zutil/yaz-ccl.c index f4033e1..4c86dfe 100644 --- a/zutil/yaz-ccl.c +++ b/zutil/yaz-ccl.c @@ -1,10 +1,16 @@ /* * Copyright (c) 1996-2001, Index Data. * See the file LICENSE for details. - * Sebastian Hammer, Adam Dickmeiss * * $Log: yaz-ccl.c,v $ - * Revision 1.12 2001-03-07 13:24:40 adam + * Revision 1.14 2001-09-24 21:51:56 adam + * New Z39.50 OID utilities: yaz_oidval_to_z3950oid, yaz_str_to_z3950oid + * and yaz_z3950oid_to_str. + * + * Revision 1.13 2001/05/09 23:31:35 adam + * String attribute values for PQF. Proper C-backslash escaping for PQF. + * + * Revision 1.12 2001/03/07 13:24:40 adam * Member and_not in Z_Operator is kept for backwards compatibility. * Added support for definition of CCL operators in field spec file. * @@ -110,14 +116,8 @@ static Z_AttributesPlusTerm *ccl_rpn_term (ODR o, struct ccl_rpn_node *p) if (value != VAL_NONE) { - int oid[OID_SIZE]; - struct oident ident; - - ident.oclass = CLASS_ATTSET; - ident.proto = PROTO_Z3950; - ident.value = (oid_value) value; elements[i]->attributeSet = - odr_oiddup (o, oid_ent_to_oid (&ident, oid)); + yaz_oidval_to_z3950oid(o, CLASS_ATTSET, value); } } elements[i]->which = Z_AttributeValue_numeric; @@ -254,15 +254,8 @@ 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 = odr_oiddup (o, oid_ent_to_oid (&bib1, oid)); + Z_RPNQuery *zq = (Z_RPNQuery *)odr_malloc (o, sizeof(*zq)); + zq->attributeSetId = yaz_oidval_to_z3950oid (o, CLASS_ATTSET, VAL_BIB1); zq->RPNStructure = ccl_rpn_structure (o, p); return zq; } @@ -300,6 +293,7 @@ static void ccl_pquery_complex (WRBUF w, struct ccl_rpn_node *p) void ccl_pquery (WRBUF w, struct ccl_rpn_node *p) { struct ccl_rpn_attr *att; + const char *cp; switch (p->kind) { @@ -327,9 +321,13 @@ void ccl_pquery (WRBUF w, struct ccl_rpn_node *p) sprintf(tmpattr, "%d=%d ", att->type, att->value); wrbuf_puts (w, tmpattr); } - wrbuf_puts (w, "{"); - wrbuf_puts (w, p->u.t.term); - wrbuf_puts (w, "} "); + for (cp = p->u.t.term; *cp; cp++) + { + if (*cp == ' ' || *cp == '\\') + wrbuf_putc (w, '\\'); + wrbuf_putc (w, *cp); + } + wrbuf_puts (w, " "); break; } }