From: Adam Dickmeiss Date: Fri, 13 Apr 2007 09:55:41 +0000 (+0000) Subject: Added utilities z_ext_record_{xml,sutrs,usmarc}. X-Git-Tag: YAZ.3.0.0~56 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=b8d35dbb7de11dcfe5bc76fb2a353012baa5b63e;p=yaz-moved-to-github.git Added utilities z_ext_record_{xml,sutrs,usmarc}. --- diff --git a/include/yaz/prt-ext.h b/include/yaz/prt-ext.h index daa5820..33917db 100644 --- a/include/yaz/prt-ext.h +++ b/include/yaz/prt-ext.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: prt-ext.h,v 1.16 2007-04-12 13:52:57 adam Exp $ */ +/* $Id: prt-ext.h,v 1.17 2007-04-13 09:55:41 adam Exp $ */ /** * \file prt-ext.h @@ -144,9 +144,18 @@ struct Z_External YAZ_EXPORT int z_External(ODR o, Z_External **p, int opt, const char *name); /** \brief returns type information for OID (NULL if not known) */ YAZ_EXPORT Z_ext_typeent *z_ext_getentbyref(const int *oid); -/** \brief encodes EXTERNAL record based on OID (NULL if knot known) */ +/** \brief encodes EXTERNAL record based on OID (NULL if not known) */ YAZ_EXPORT Z_External *z_ext_record_oid(ODR o, const int *oid, const char *buf, int len); +/** \brief encodes EXTERNAL XML record */ +Z_External *z_ext_record_xml(ODR o, const char *buf, int len); + +/** \brief encodes EXTERNAL SUTRS record */ +Z_External *z_ext_record_sutrs(ODR o, const char *buf, int len); + +/** \brief encodes EXTERNAL USMARC/MARC21 record */ +Z_External *z_ext_record_usmarc(ODR o, const char *buf, int len); + YAZ_END_CDECL #endif diff --git a/src/prt-ext.c b/src/prt-ext.c index ba73b6e..80d3418 100644 --- a/src/prt-ext.c +++ b/src/prt-ext.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: prt-ext.c,v 1.8 2007-04-12 13:52:57 adam Exp $ + * $Id: prt-ext.c,v 1.9 2007-04-13 09:55:41 adam Exp $ */ /** @@ -320,6 +320,27 @@ Z_External *z_ext_record_oid(ODR o, const int *oid, const char *buf, int len) return thisext; } +Z_External *z_ext_record_xml(ODR o, const char *buf, int len) +{ + const int *oid = yaz_string_to_oid(yaz_oid_std(), + CLASS_RECSYN, OID_STR_XML); + return z_ext_record_oid(o, oid, buf, len); +} + +Z_External *z_ext_record_sutrs(ODR o, const char *buf, int len) +{ + const int *oid = yaz_string_to_oid(yaz_oid_std(), + CLASS_RECSYN, OID_STR_SUTRS); + return z_ext_record_oid(o, oid, buf, len); +} + +Z_External *z_ext_record_usmarc(ODR o, const char *buf, int len) +{ + const int *oid = yaz_string_to_oid(yaz_oid_std(), + CLASS_RECSYN, OID_STR_USMARC); + return z_ext_record_oid(o, oid, buf, len); +} + /* * Local variables: * c-basic-offset: 4 diff --git a/src/zoom-c.c b/src/zoom-c.c index a67405a..fb30049 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.123 2007-04-12 13:52:57 adam Exp $ + * $Id: zoom-c.c,v 1.124 2007-04-13 09:55:41 adam Exp $ */ /** * \file zoom-c.c @@ -1298,7 +1298,7 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c) odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.123 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.124 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = @@ -2988,10 +2988,8 @@ static Z_ItemOrder *encode_item_order(ZOOM_package p) str = ZOOM_options_get(p->options, "doc"); if (str) { - const int *oid = yaz_string_to_oid(yaz_oid_std(), - CLASS_RECSYN, OID_STR_XML); req->u.esRequest->notToKeep->itemRequest = - z_ext_record_oid(p->odr_out, oid, str, strlen(str)); + z_ext_record_xml(p->odr_out, str, strlen(str)); } else req->u.esRequest->notToKeep->itemRequest = encode_ill_request(p); diff --git a/ztest/ztest.c b/ztest/ztest.c index 75034af..d45c8b1 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: ztest.c,v 1.86 2007-04-12 13:52:58 adam Exp $ + * $Id: ztest.c,v 1.87 2007-04-13 09:55:41 adam Exp $ */ /* @@ -373,13 +373,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) targetPart->taskPackageRecords[0]->which = Z_IUTaskPackageRecordStructure_record; targetPart->taskPackageRecords[0]->u.record = - z_ext_record_oid(rr->stream, - yaz_string_to_oid_odr( - yaz_oid_std(), - CLASS_RECSYN, - OID_STR_SUTRS, - rr->stream), - "test", 4); + z_ext_record_sutrs(rr->stream, "test", 4); targetPart->taskPackageRecords[0]->correlationInfo = 0; targetPart->taskPackageRecords[0]->recordStatus = odr_intdup (rr->stream,