Allow multiple languages and charsets to be specified with
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 31 Mar 2006 09:51:21 +0000 (09:51 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 31 Mar 2006 09:51:21 +0000 (09:51 +0000)
yaz-client. Each item must be separated by comma (NO BLANKS). E.g.
negcharset iso-8859-1,utf-8
Added az_set_proposal_charneg_list.

NEWS
client/client.c
include/yaz/charneg.h
src/charneg.c
src/zoom-c.c

diff --git a/NEWS b/NEWS
index 0a659f4..ee69886 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,8 @@
---- 2.1.16 2006/03/30 
+--- 2.1.16 2006/03/31 
+
+Allow multiple languages and charsets to be specified with
+yaz-client. Each item must be separated by comma (NO BLANKS). E.g.
+  negcharset iso-8859-1,utf-8
 
 Translation of proximity nodes from CQL into PQF now works.
 
index b478ce2..74ca30f 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: client.c,v 1.302 2005-12-20 23:07:27 adam Exp $
+ * $Id: client.c,v 1.303 2006-03-31 09:51:21 adam Exp $
  */
 
 #include <stdio.h>
@@ -341,12 +341,10 @@ static void send_initRequest(const char* type_and_host)
             
             p0->which = Z_OtherInfo_externallyDefinedInfo;
             p0->information.externallyDefinedInfo =
-                yaz_set_proposal_charneg(
-                    out,
-                    (const char**)&negotiationCharset, 
-                    negotiationCharset ? 1 : 0,
-                    (const char**)&yazLang, yazLang ? 1 : 0, 
-                    negotiationCharsetRecords);
+                yaz_set_proposal_charneg_list(out, ",", 
+                                              negotiationCharset, 
+                                              yazLang,
+                                              negotiationCharsetRecords);
         }
     }
     
index 8b21d33..f7cca05 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: charneg.h,v 1.7 2005-06-25 15:46:01 adam Exp $
+ * $Id: charneg.h,v 1.8 2006-03-31 09:51:22 adam Exp $
  */
 /** 
  * \file charneg.h
@@ -69,6 +69,13 @@ Z_External *yaz_set_proposal_charneg(ODR odr,
                                      int num_langs, int selected);
 
 YAZ_EXPORT
+Z_External *yaz_set_proposal_charneg_list(ODR o,
+                                          const char *delim,
+                                          const char *charset_list,
+                                          const char *lang_list,
+                                          int selected);
+
+YAZ_EXPORT
 void yaz_get_response_charneg(NMEM mem,
                               Z_CharSetandLanguageNegotiation *p,
                               char **charset, char **lang,
@@ -90,6 +97,8 @@ void yaz_get_proposal_charneg(NMEM mem,
                               char ***charsets, int *num_charsets,
                               char ***langs, int *num_langs,
                               int *selected);
+
+
 YAZ_END_CDECL
 
 #endif
index ff4bc47..8469eee 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: charneg.c,v 1.5 2005-06-25 15:46:03 adam Exp $
+ * $Id: charneg.c,v 1.6 2006-03-31 09:51:22 adam Exp $
  */
 
 /** 
@@ -193,6 +193,32 @@ Z_External *yaz_set_proposal_charneg(ODR o,
     return p;
 }
 
+Z_External *yaz_set_proposal_charneg_list(ODR o,
+                                          const char *delim,
+                                          const char *charset_list,
+                                          const char *lang_list,
+                                          int selected)
+{
+    char **charsets_addresses = 0;
+    char **langs_addresses = 0;
+    int charsets_count = 0;
+    int langs_count = 0;
+    
+    if (charset_list)
+        nmem_strsplit(o->mem, delim, charset_list,
+                      &charsets_addresses, &charsets_count);
+    if (lang_list)
+        nmem_strsplit(o->mem, delim, lang_list,
+                      &langs_addresses, &langs_count);    
+    return yaz_set_proposal_charneg(o,
+                                    (const char **) charsets_addresses,
+                                    charsets_count,
+                                    (const char **) langs_addresses,
+                                    langs_count, 
+                                    selected);
+}
+
+
 /* used by yaz_set_response_charneg */
 static Z_TargetResponse *z_get_TargetResponse(ODR o, const char *charset,
                                               const char *lang, int selected)
index 13a63e9..21d17c9 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: zoom-c.c,v 1.65 2006-03-13 10:48:14 adam Exp $
+ * $Id: zoom-c.c,v 1.66 2006-03-31 09:51:22 adam Exp $
  */
 /**
  * \file zoom-c.c
@@ -1144,7 +1144,7 @@ static zoom_ret ZOOM_connection_send_init (ZOOM_connection c)
         ZOOM_options_get(c->options, "implementationName"),
         odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName));
 
-    version = odr_strdup(c->odr_out, "$Revision: 1.65 $");
+    version = odr_strdup(c->odr_out, "$Revision: 1.66 $");
     if (strlen(version) > 10)   /* check for unexpanded CVS strings */
         version[strlen(version)-2] = '\0';
     ireq->implementationVersion = odr_prepend(c->odr_out,
@@ -1211,26 +1211,11 @@ static zoom_ret ZOOM_connection_send_init (ZOOM_connection c)
         
         if ((oi_unit = yaz_oi_update(oi, c->odr_out, NULL, 0, 0)))
         {
-            char **charsets_addresses = 0;
-            char **langs_addresses = 0;
-            int charsets_count = 0;
-            int langs_count = 0;
-           
-            if (c->charset)
-                nmem_strsplit_blank(c->odr_out->mem, c->charset,
-                                    &charsets_addresses, &charsets_count);
-            if (c->lang)
-                nmem_strsplit_blank(c->odr_out->mem, c->lang,
-                                    &langs_addresses, &langs_count);
             ODR_MASK_SET(ireq->options, Z_Options_negotiationModel);
             oi_unit->which = Z_OtherInfo_externallyDefinedInfo;
             oi_unit->information.externallyDefinedInfo =
-                yaz_set_proposal_charneg(c->odr_out,
-                                         (const char **) charsets_addresses,
-                                         charsets_count,
-                                         (const char **) langs_addresses,
-                                         langs_count, 
-                                         1);
+                yaz_set_proposal_charneg_list(c->odr_out, " ",
+                                              c->charset, c->lang, 1);
         }
     }
     assert (apdu);