X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=SimpleServer.xs;h=da613c2f812e954efa29b6837559c127582d5b07;hb=ef4825a7e6f74209103a34d79243c1e4f03b2a4b;hp=6af248f5b3945ea3de05e01e44a21ec13683831b;hpb=8b44ee5f70e299a90738ebda0a87e879d6130aca;p=simpleserver-moved-to-github.git diff --git a/SimpleServer.xs b/SimpleServer.xs index 6af248f..da613c2 100644 --- a/SimpleServer.xs +++ b/SimpleServer.xs @@ -1,5 +1,5 @@ /* - * $Id: SimpleServer.xs,v 1.65 2007-08-10 00:00:14 mike Exp $ + * $Id: SimpleServer.xs,v 1.69 2007-08-17 12:31:40 mike Exp $ * ---------------------------------------------------------------------- * * Copyright (c) 2000-2004, Index Data. @@ -32,6 +32,7 @@ #include "proto.h" #include "embed.h" #include "XSUB.h" +#include #include #include #include @@ -440,9 +441,24 @@ static SV *rpn2perl(Z_RPNStructure *s) translateOID(elem->attributeSet)); setMember(hv2, "attributeType", newSViv(*elem->attributeType)); - assert(elem->which == Z_AttributeValue_numeric); - setMember(hv2, "attributeValue", - newSViv(*elem->value.numeric)); + if (elem->which == Z_AttributeValue_numeric) { + setMember(hv2, "attributeValue", + newSViv(*elem->value.numeric)); + } else { + assert(elem->which == Z_AttributeValue_complex); + Z_ComplexAttribute *complex = elem->value.complex; + Z_StringOrNumeric *son; + /* We ignore semantic actions and multiple values */ + assert(complex->num_list > 0); + son = complex->list[0]; + if (son->which == Z_StringOrNumeric_numeric) { + setMember(hv2, "attributeValue", + newSViv(*son->u.numeric)); + } else { /*Z_StringOrNumeric_string*/ + setMember(hv2, "attributeValue", + newSVpv(son->u.string, 0)); + } + } av_push(av, tmp); } setMember(hv, "attributes", attrs); @@ -1243,7 +1259,7 @@ int bend_scan(void *handle, bend_scan_rr *rr) scan_list = (struct scan_entry *) odr_malloc (rr->stream, rr->num_entries * sizeof(*scan_list)); buffer = scan_list; entries = (AV *)SvRV(entries_ref); - for (i = 0; i < rr->num_entries; i++) + if (rr->errcode == 0) for (i = 0; i < rr->num_entries; i++) { scan_item = (HV *)SvRV(sv_2mortal(av_shift(entries))); temp = hv_fetch(scan_item, "TERM", 4, 1); @@ -1627,3 +1643,12 @@ yazlog(arg) char *ptr; ptr = SvPV(arg, len); yaz_log(YLOG_LOG, "%.*s", len, ptr); + +int +yaz_diag_srw_to_bib1(srw_code) + int srw_code + +int +yaz_diag_bib1_to_srw(bib1_code) + int bib1_code +