Added utilities z_ext_record_{xml,sutrs,usmarc}.
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 13 Apr 2007 09:55:41 +0000 (09:55 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 13 Apr 2007 09:55:41 +0000 (09:55 +0000)
include/yaz/prt-ext.h
src/prt-ext.c
src/zoom-c.c
ztest/ztest.c

index daa5820..33917db 100644 (file)
@@ -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.
  */
  * (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
 
 /**
  * \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);
 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);
 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
 YAZ_END_CDECL
 
 #endif
index ba73b6e..80d3418 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
  * 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;
 }
 
     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
 /*
  * Local variables:
  * c-basic-offset: 4
index a67405a..fb30049 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
  * 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
  */
 /**
  * \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));
     
                     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 = 
     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)
     {
     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 =
         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);
     }
     else
         req->u.esRequest->notToKeep->itemRequest = encode_ill_request(p);
index 75034af..d45c8b1 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
  * 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 = 
                 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,
                 targetPart->taskPackageRecords[0]->correlationInfo = 0; 
                 targetPart->taskPackageRecords[0]->recordStatus =
                     odr_intdup (rr->stream,