X-Git-Url: http://git.indexdata.com/?p=simpleserver-moved-to-github.git;a=blobdiff_plain;f=SimpleServer.xs;h=da613c2f812e954efa29b6837559c127582d5b07;hp=0275571d914d71d379b3f6ababb53f71e181121d;hb=ef4825a7e6f74209103a34d79243c1e4f03b2a4b;hpb=595dfb3a35af82a4b6b7268b36345863424a3601 diff --git a/SimpleServer.xs b/SimpleServer.xs index 0275571..da613c2 100644 --- a/SimpleServer.xs +++ b/SimpleServer.xs @@ -1,5 +1,5 @@ /* - * $Id: SimpleServer.xs,v 1.68 2007-08-16 15:12:58 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);