Implement yaz_opac_decode_wrbuf2
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 8 Mar 2011 12:28:10 +0000 (13:28 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 8 Mar 2011 12:28:10 +0000 (13:28 +0100)
This function behaves likes yaz_opac_decode_wrbuf but takes yaz_iconv_t
to allow character set conversion different from yaz_iconv_t part of
yaz_marc_t. This is because OPAC record ASN.1 fields may have different
encoding from the bibliographic MARC record.

include/yaz/marcdisp.h
src/opacdisp.c

index 6c64854..c650fca 100644 (file)
@@ -419,10 +419,25 @@ void yaz_marc_write_using_libxml2(yaz_marc_t mt, int enable);
     \param mt handle
     \param r OPAC record
     \param wrbuf WRBUF for resulting display string
     \param mt handle
     \param r OPAC record
     \param wrbuf WRBUF for resulting display string
+    
+    This function uses iconv_handle of yaz_marc_t for character set
+    conversion of both OPAC + ISO2709 part.
     \*/
 YAZ_EXPORT void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r,
                                       WRBUF wrbuf);
 
     \*/
 YAZ_EXPORT void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r,
                                       WRBUF wrbuf);
 
+/** \brief Performs "pretty" display of OPAC record to WRBUF using marc_t
+    \param mt handle
+    \param r OPAC record
+    \param wrbuf WRBUF for resulting display string
+    \param cd iconv handle for OPAC content (not ISO2709 part)
+
+    This function uses iconv handle of yaz_marc_t for character set
+    conversion of ISO2709 part and supplied handle (cd) for OPAC part.
+    \*/
+YAZ_EXPORT void yaz_opac_decode_wrbuf2(yaz_marc_t mt, Z_OPACRecord *r,
+                                       WRBUF wrbuf, yaz_iconv_t cd);
+
 /** \brief flushes records
     \param mt handle
     \param wr WRBUF for output
 /** \brief flushes records
     \param mt handle
     \param wr WRBUF for output
index 7e96839..807ca2b 100644 (file)
@@ -52,10 +52,10 @@ static void opac_element_bool(WRBUF wrbuf, int l, const char *elem, int *data)
     }
 }
 
     }
 }
 
-void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf)
+void yaz_opac_decode_wrbuf2(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf,
+                            yaz_iconv_t cd)
 {
     int i;
 {
     int i;
-    yaz_iconv_t cd = yaz_marc_get_iconv(mt);
 
     wrbuf_puts(wrbuf, "<opacRecord>\n");
     if (r->bibliographicRecord)
 
     wrbuf_puts(wrbuf, "<opacRecord>\n");
     if (r->bibliographicRecord)
@@ -163,6 +163,11 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf)
     wrbuf_puts(wrbuf, "</opacRecord>\n");
 }
 
     wrbuf_puts(wrbuf, "</opacRecord>\n");
 }
 
+void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf)
+{
+    yaz_opac_decode_wrbuf2(mt, r, wrbuf, yaz_marc_get_iconv(mt));
+}
+
 /*
  * Local variables:
  * c-basic-offset: 4
 /*
  * Local variables:
  * c-basic-offset: 4