From 699e7501d441803e6abd38bb8771cef20846a0d6 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 14 Nov 2006 08:37:37 +0000 Subject: [PATCH] Added utilities yaz_{set,get}_esn to set/get element set name from record composition. --- NEWS | 3 +++ include/yaz/proto.h | 18 +++++++++++++++++- src/Makefile.am | 4 ++-- src/seshigh.c | 35 ++++------------------------------- win/makefile | 5 +++-- 5 files changed, 29 insertions(+), 36 deletions(-) diff --git a/NEWS b/NEWS index 682dff9..0195045 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +Added utilities yaz_{set,get}_esn to set/get element set name from +record composition. + Removed the build of libyazthread.la. The libyaz.so is the threaded version of YAZ and has been so since YAZ 2.1.10. diff --git a/include/yaz/proto.h b/include/yaz/proto.h index eea99f8..92b3da1 100644 --- a/include/yaz/proto.h +++ b/include/yaz/proto.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: proto.h,v 1.24 2006-10-13 11:30:37 adam Exp $ */ +/* $Id: proto.h,v 1.25 2006-11-14 08:37:38 adam Exp $ */ /** * \file proto.h @@ -182,6 +182,22 @@ Z_DiagRecs *zget_DiagRecs(ODR o, int error, const char *addinfo); YAZ_EXPORT Z_DiagRec *zget_DiagRec(ODR o, int error, const char *addinfo); +/** \brief get element set name from RecordComposition + \param comp record composition + \returns element set name or NULL if no element set name was given +*/ +YAZ_EXPORT +const char *yaz_get_esn(Z_RecordComposition *comp); + +/** \brief set element set name in RecordComposition struct + \param comp_p record composition ptr + \param esn element set name string + \param nmem memory for result composition +*/ +YAZ_EXPORT +void yaz_set_esn(Z_RecordComposition **comp_p, const char *esn, NMEM nmem); + + YAZ_END_CDECL #include diff --git a/src/Makefile.am b/src/Makefile.am index cbf279d..3103a3b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ ## This file is part of the YAZ toolkit. ## Copyright (C) 1994-2006, Index Data, All rights reserved. -## $Id: Makefile.am,v 1.43 2006-11-02 08:06:03 adam Exp $ +## $Id: Makefile.am,v 1.44 2006-11-14 08:37:38 adam Exp $ YAZ_VERSION_INFO=2:1:0 @@ -79,7 +79,7 @@ libyaz_la_SOURCES=version.c options.c log.c marcdisp.c oid.c wrbuf.c \ xmlquery.c \ mime.c mime.h \ nfa.c nfaxml.c \ - record_conv.c retrieval.c + record_conv.c retrieval.c elementset.c libyaz_la_LDFLAGS=-version-info $(YAZ_VERSION_INFO) diff --git a/src/seshigh.c b/src/seshigh.c index de71c65..28830c2 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.103 2006-10-27 11:22:09 adam Exp $ + * $Id: seshigh.c,v 1.104 2006-11-14 08:37:38 adam Exp $ */ /** * \file seshigh.c @@ -565,33 +565,6 @@ static int srw_bend_init(association *assoc, Z_SRW_diagnostic **d, int *num, Z_S return 1; } -static const char *get_esn(Z_RecordComposition *comp) -{ - if (comp && comp->which == Z_RecordComp_complex) - { - if (comp->u.complex->generic - && comp->u.complex->generic->elementSpec - && (comp->u.complex->generic->elementSpec->which == - Z_ElementSpec_elementSetName)) - return comp->u.complex->generic->elementSpec->u.elementSetName; - } - else if (comp && comp->which == Z_RecordComp_simple && - comp->u.simple->which == Z_ElementSetNames_generic) - return comp->u.simple->u.generic; - return 0; -} - -static void set_esn(Z_RecordComposition **comp_p, const char *esn, NMEM nmem) -{ - Z_RecordComposition *comp = nmem_malloc(nmem, sizeof(*comp)); - - comp->which = Z_RecordComp_simple; - comp->u.simple = nmem_malloc(nmem, sizeof(*comp->u.simple)); - comp->u.simple->which = Z_ElementSetNames_generic; - comp->u.simple->u.generic = nmem_strdup(nmem, esn); - *comp_p = comp; -} - static int retrieve_fetch(association *assoc, bend_fetch_rr *rr) { #if YAZ_HAVE_XML2 @@ -602,7 +575,7 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr) if (assoc->server) { int r; - const char *input_schema = get_esn(rr->comp); + const char *input_schema = yaz_get_esn(rr->comp); Odr_oid *input_syntax_raw = rr->request_format_raw; const char *backend_schema = 0; @@ -647,7 +620,7 @@ static int retrieve_fetch(association *assoc, bend_fetch_rr *rr) } if (backend_schema) { - set_esn(&rr->comp, backend_schema, rr->stream->mem); + yaz_set_esn(&rr->comp, backend_schema, rr->stream->mem); } if (backend_syntax) { @@ -2361,7 +2334,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) assoc->init->implementation_name, odr_prepend(assoc->encode, "GFS", resp->implementationName)); - version = odr_strdup(assoc->encode, "$Revision: 1.103 $"); + version = odr_strdup(assoc->encode, "$Revision: 1.104 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; resp->implementationVersion = odr_prepend(assoc->encode, diff --git a/win/makefile b/win/makefile index b012faa..f739568 100644 --- a/win/makefile +++ b/win/makefile @@ -1,6 +1,6 @@ # Copyright (C) 1994-2006, Index Data ApS # All rights reserved. -# $Id: makefile,v 1.119 2006-10-29 18:33:54 adam Exp $ +# $Id: makefile,v 1.120 2006-11-14 08:37:39 adam Exp $ # # Programmed by # Heikki Levanto & Adam Dickmeiss @@ -416,7 +416,8 @@ MISC_OBJS= \ $(OBJDIR)\cqltransform.obj \ $(OBJDIR)\cqlutil.obj \ $(OBJDIR)\cqlstrer.obj \ - $(OBJDIR)\xcqlutil.obj + $(OBJDIR)\xcqlutil.obj \ + $(OBJDIR)\elementset.obj Z3950_OBJS= \ $(OBJDIR)\z-date.obj\ -- 1.7.10.4