Merge branch 'master' of ssh://git.indexdata.com:222/home/git/pub/yaz
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 30 Mar 2011 14:03:04 +0000 (16:03 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 30 Mar 2011 14:03:04 +0000 (16:03 +0200)
355 files changed:
.gitignore
.gitmodules
IDMETA
LICENSE
Makefile.am
NEWS
buildconf.sh
client/Makefile.am
client/admin.c
client/admin.h
client/bertorture.c
client/client.c
client/fhistory.c
client/fhistory.h
client/tabcomplete.c
client/tabcomplete.h
configure.ac
debian/changelog
debian/rules
doc/Makefile.am
doc/common
doc/entities.ent
doc/introduction.xml
doc/server.xml
doc/yaz-client-commands.xml
doc/yaz-icu-man.xml
doc/yaz-man.xml
doc/zoom.xml
etc/Makefile.am
header.c
include/.gitignore
include/Makefile.am
include/yaz/Makefile.am
include/yaz/backend.h
include/yaz/ccl.h
include/yaz/ccl_xml.h
include/yaz/charneg.h
include/yaz/comstack.h
include/yaz/copy_types.h
include/yaz/cql.h
include/yaz/daemon.h
include/yaz/dirent.h
include/yaz/errno.h
include/yaz/facet.h
include/yaz/file_glob.h
include/yaz/gettimeofday.h
include/yaz/icu.h
include/yaz/icu_I18N.h
include/yaz/ill.h
include/yaz/json.h
include/yaz/log.h
include/yaz/logrpn.h
include/yaz/marcdisp.h
include/yaz/match_glob.h
include/yaz/matchstr.h
include/yaz/mutex.h
include/yaz/nmem.h
include/yaz/nmem_xml.h
include/yaz/odr.h
include/yaz/oid_db.h
include/yaz/oid_util.h
include/yaz/options.h
include/yaz/otherinfo.h
include/yaz/poll.h
include/yaz/pquery.h
include/yaz/proto.h
include/yaz/prt-ext.h
include/yaz/query-charset.h
include/yaz/querytowrbuf.h
include/yaz/readconf.h
include/yaz/record_conv.h
include/yaz/record_render.h
include/yaz/retrieval.h
include/yaz/rpn2cql.h
include/yaz/rpn2solr.h
include/yaz/sc.h
include/yaz/shptr.h
include/yaz/snprintf.h
include/yaz/soap.h
include/yaz/solr.h
include/yaz/sortspec.h
include/yaz/spipe.h
include/yaz/srw.h
include/yaz/statserv.h
include/yaz/stemmer.h [new file with mode: 0644]
include/yaz/tcpip.h
include/yaz/test.h
include/yaz/thread_create.h
include/yaz/thread_id.h
include/yaz/timing.h
include/yaz/tokenizer.h
include/yaz/tpath.h
include/yaz/unix.h
include/yaz/wrbuf.h
include/yaz/xmalloc.h
include/yaz/xml_include.h
include/yaz/xmlquery.h
include/yaz/xmltypes.h
include/yaz/yaz-ccl.h
include/yaz/yaz-iconv.h
include/yaz/yaz-util.h
include/yaz/yconfig.h
include/yaz/zgdu.h
include/yaz/zoom.h
libstemmer_c [new submodule]
m4
src/Makefile.am
src/advancegreek.c
src/atoin.c
src/ber_any.c
src/ber_bit.c
src/ber_bool.c
src/ber_int.c
src/ber_len.c
src/ber_null.c
src/ber_oct.c
src/ber_oid.c
src/ber_tag.c
src/ccl_stop_words.c
src/cclerrms.c
src/cclfind.c
src/cclp.h
src/cclptree.c
src/cclqfile.c
src/cclqual.c
src/cclstr.c
src/ccltoken.c
src/cclxmlconfig.c
src/charconv.tcl
src/charneg.c
src/comstack.c
src/condvar.c
src/copy_types.c
src/cql.y
src/cql1.2.y
src/cql2.0.y
src/cqlstdio.c
src/cqlstrer.c
src/cqlstring.c
src/cqltransform.c
src/cqlutil.c
src/csvtodiag.tcl
src/daemon.c
src/diag-entry.c
src/diag-entry.h
src/dirent.c
src/dumpber.c
src/elementset.c
src/errno.c
src/eventl.c
src/eventl.h
src/facet.c
src/file_glob.c
src/gettimeofday.c
src/grs1disp.c
src/http.c
src/iconv-p.h
src/iconv_decode_danmarc.c
src/iconv_decode_iso5426.c
src/iconv_decode_marc8.c
src/iconv_encode_iso_8859_1.c
src/iconv_encode_marc8.c
src/iconv_encode_wchar.c
src/icu_casemap.c
src/icu_chain.c
src/icu_sortkey.c
src/icu_tokenizer.c
src/icu_transform.c
src/icu_utf16.c
src/icu_utf8.c
src/ill-get.c
src/initopt.c
src/iso5428.c
src/json.c
src/log.c
src/logrpn.c
src/marc_read_iso2709.c
src/marc_read_line.c
src/marc_read_xml.c
src/marcdisp.c
src/match_glob.c
src/matchstr.c
src/mime.c
src/mime.h
src/mutex-p.h
src/mutex.c
src/nmem.c
src/nmemsdup.c
src/odr-priv.h
src/odr.c
src/odr_any.c
src/odr_bit.c
src/odr_bool.c
src/odr_choice.c
src/odr_cons.c
src/odr_enum.c
src/odr_int.c
src/odr_mem.c
src/odr_null.c
src/odr_oct.c
src/odr_oid.c
src/odr_seq.c
src/odr_tag.c
src/odr_use.c
src/odr_util.c
src/oid_db.c
src/oid_util.c
src/oidtoc.tcl
src/opacdisp.c
src/options.c
src/otherinfo.c
src/poll.c
src/pquery.c
src/prt-ext.c
src/query-charset.c
src/querytowrbuf.c
src/readconf.c
src/record_conv.c
src/record_render.c
src/requestq.c
src/retrieval.c
src/rpn2cql.c
src/rpn2solr.c
src/sc.c
src/sc_test.c
src/seshigh.c
src/session.h
src/siconv.c
src/snprintf.c
src/soap.c
src/solr.c
src/solrtransform.c
src/sortspec.c
src/spipe.c
src/sru-p.h
src/srw.c
src/srwutil.c
src/statserv.c
src/stemmer.c [new file with mode: 0644]
src/tcpdchk.c
src/tcpip.c
src/test.c
src/thread_create.c
src/thread_id.c
src/timing.c
src/tokenizer.c
src/tpath.c
src/ucs4.c
src/unix.c
src/uri.c
src/utf8.c
src/version.c
src/waislen.c
src/wrbuf.c
src/xcqlutil.c
src/xmalloc.c
src/xml_include.c
src/xmlerror.c
src/xmlquery.c
src/yaz-ccl.c
src/zgdu.c
src/zget.c
src/zoom-c.c
src/zoom-event.c
src/zoom-opt.c
src/zoom-p.h
src/zoom-query.c
src/zoom-record-cache.c
src/zoom-socket.c
src/zoom-sru.c
src/zoom-z3950.c
test/.gitignore
test/Makefile.am
test/test_ccl.c
test/test_comstack.c
test/test_file_glob.c
test/test_filepath.c
test/test_iconv.c
test/test_icu.c
test/test_json.c
test/test_libstemmer.c [new file with mode: 0644]
test/test_log.c
test/test_log_thread.c
test/test_match_glob.c
test/test_matchstr.c
test/test_mutex.c
test/test_nmem.c
test/test_odr.c
test/test_odrstack.c
test/test_oid.c
test/test_pquery.c
test/test_query_charset.c
test/test_record_conv.c
test/test_retrieval.c
test/test_rpn2cql.c
test/test_rpn2solr.c
test/test_shared_ptr.c
test/test_soap1.c
test/test_soap2.c
test/test_timing.c
test/test_tpath.c
test/test_wrbuf.c
test/test_xmalloc.c
test/test_xml_include.c
test/test_xmlquery.c
test/tsticu-2.input [new file with mode: 0644]
test/tsticu-2.output [new file with mode: 0644]
test/tsticu-2.xml [new file with mode: 0644]
test/tsticu-3.input [new file with mode: 0644]
test/tsticu-3.output [new file with mode: 0644]
test/tsticu-3.xml [new file with mode: 0644]
util/Makefile.am
util/benchmark.c
util/cclsh.c
util/cql2pqf.c
util/cql2xcql.c
util/json-parse.c
util/marcdump.c
util/srwtst.c
util/yaz-asncomp
util/yaz-icu.c
util/yaz-illclient.c
util/yaz-record-conv.c
util/yaz-xmlquery.c
util/yaziconv.c
win/LICENSE.txt
win/makefile
win/yaz.nsi
win/yaz.rc
yaz-config.in
yaz.spec [new file with mode: 0644]
yaz.spec.in [deleted file]
zoom/Makefile.am
zoom/zoom-benchmark.c
zoom/zoom-bug-641.c
zoom/zoom-ka.c
zoom/zoomsh.c
zoom/zoomtst1.c
zoom/zoomtst10.c
zoom/zoomtst11.c
zoom/zoomtst2.c
zoom/zoomtst3.c
zoom/zoomtst4.c
zoom/zoomtst5.c
zoom/zoomtst6.c
zoom/zoomtst7.c
zoom/zoomtst8.c
zoom/zoomtst9.c
ztest/Makefile.am
ztest/dummy-opac.c
ztest/gfs-example.c
ztest/read-grs.c
ztest/read-marc.c
ztest/ztest.c
ztest/ztest.h

index f4ce873..c765f3f 100644 (file)
@@ -8,7 +8,6 @@ config.status
 configure
 libtool
 yaz-config
-yaz.spec
 yaz.pc
 Doxyfile
 dox
@@ -19,3 +18,4 @@ config.guess
 config.sub
 Default
 *~
+.settings
index d38140d..12d5b23 100644 (file)
@@ -4,3 +4,6 @@
 [submodule "doc/common"]
        path = doc/common
        url = git://git.indexdata.com/id-docbook-common
+[submodule "libstemmer_c"]
+       path = libstemmer_c
+       url = git://git.indexdata.com/libstemmer_c
diff --git a/IDMETA b/IDMETA
index 3459caa..423a6de 100644 (file)
--- a/IDMETA
+++ b/IDMETA
@@ -1,2 +1,2 @@
 DEBIAN_DIST="squeeze lenny"
-UBUNTU_DIST="lucid karmic"
+UBUNTU_DIST="maverick lucid karmic"
diff --git a/LICENSE b/LICENSE
index fdae22d..6b2ceda 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 1995-2010, Index Data
+Copyright (c) 1995-2011, Index Data
 All rights reserved.
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
index 907d934..979716a 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 AUTOMAKE_OPTIONS = foreign 
 
diff --git a/NEWS b/NEWS
index e761eff..db88861 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,67 @@
+--- 4.1.7 2011/03/15
+
+Add -lCrun when linking with ICU on Solaris.
+
+More quicks character set conversions for OPAC records.
+
+--- 4.1.6 2011/03/10
+
+fix problem with record_render: records were converted (character set
+wise) even if no charset was given. Problem introduced in YAZ 4.1.5.
+
+--- 4.1.5 2011/03/08
+
+SRU: add methods for handling DADS SRU-proxy facets.
+
+Separate OPAC record character set for ZOOM_record. yaz_record_render
+allows a character set given as charset=from/opacfrom,to where 'from' is
+the character set of a bibliographic record, 'opacfrom' is character set
+of OPAC record and 'to' is the target character set.
+
+--- 4.1.4 2011/02/21
+
+yaz-client: show may XML format records. Command show followed by 'format'
+will format XML records retrieved using Libxml2's xmlDocDumpFormatMemory
+function.
+
+src/stemmer.c: Avoid using unnamed union. It is not supported by some
+older C compilers.
+
+For PHPYAZ: set YAZVERSION, not YAZ_VERSION.
+
+--- 4.1.3 2011/01/27
+Update yaz.spec to operate on both SLES11 / Centos 5.5.
+
+RPM: Release includes 'indexdata' name. Use indexdata in release name so
+this package can be distinguished from other vendors.
+
+yaz-config: Use exec_prefix, libdir, includedir .  Use these variables
+as determined by configure
+
+yaz-config: set YAZ_VERSION env. php_yaz relies on it.
+
+GFS: Z_PresentStatus_partial_4 for missing record. If bend_fetch handler
+returns no error and no record, the present request is considered
+partial (only a subset of the records could be returned by backend), and
+so it is appropriate to set Present Status to partial-4.
+
+--- 4.1.2 2010/11/02
+
+Move yaz-config man pages to section 1.
+
+More documentation about SOLR.
+
+tcp comstack: change behavior for @-specs (anyaddr). @ listens on
+AF_INET (IPV4) peers, and @6 listens to AF_INET6 (ipv6) peers.
+Previously @ listened on AF_INET6 which accepted both IPV4 and IPV6
+peers on some Linux systems. However, in general that does not work
+so YAZ can not rely on that to work. Debian changed behavior in this
+respect from Debian lenny to Debian squeeze (still testing as of Oct
+2010). Refer to:
+http://www.mail-archive.com/debian-devel@lists.debian.org/msg277726.html
+
+zoomsh: remove "debugging" output. Was added by mistake in 4.1.0.
+
 --- 4.1.1 2010/10/05
 
 Fix yaz-config output: echo_source not set correctly by configure.
index 9671592..c82194a 100755 (executable)
@@ -14,11 +14,11 @@ fi
 if [ "`uname -s`" = FreeBSD ]; then
     # FreeBSD intalls the various auto* tools with version numbers
     echo "Using special configuration for FreeBSD ..."
-    automake=automake19
-    aclocal="aclocal19 -I /usr/local/share/aclocal"
-    autoconf=autoconf259
-    libtoolize=libtoolize15
-    autoheader=autoheader259
+    automake=automake
+    aclocal="aclocal -I /usr/local/share/aclocal"
+    autoconf=autoconf
+    libtoolize=libtoolize
+    autoheader=autoheader
 fi
 
 if [ "`uname -s`" = Darwin ]; then
@@ -78,7 +78,8 @@ esac
 if $enable_configure; then
     if [ -n "$sh_cflags" ]; then
        if $has_libtool; then
-           CFLAGS="$sh_cflags" CXXFLAGS="$sh_cxxflags" ./configure --disable-shared --enable-static $*
+           CFLAGS="$sh_cflags" CXXFLAGS="$sh_cxxflags" ./configure \
+               --disable-shared --enable-static --with-pic $*
         else
            CFLAGS="$sh_cflags" CXXFLAGS="$sh_cxxflags" ./configure $*
         fi
@@ -128,8 +129,9 @@ EOF
     if [ "`uname -s`" = FreeBSD ]; then
         cat <<EOF
 When building from a Git, you need these FreeBSD Ports:
-  autoconf259, automake19, libtool15, bison, tcl84,
-  docbook-xsl, libxml2, libxslt, g++-4.0, make
+  pkg_add -r autoconf262 automake110 libtool bison tcl84 \\
+             docbook-xsl libxml2 libxslt
+  pkg_add -r icu4
 EOF
     fi
 fi
index a6092c0..29a0e0f 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 bin_PROGRAMS=yaz-client 
 EXTRA_PROGRAMS=bertorture
index 40a626b..fed8c55 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
index 50a3578..a2326e2 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 599e26f..4d51bd2 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <signal.h>
 #if HAVE_SYS_TYPES_H
index c9351d2..71432b4 100644 (file)
@@ -1,10 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** \file client.c
  *  \brief yaz-client program
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -145,6 +148,8 @@ static int scan_size = 20;
 static char cur_host[200];
 static Odr_int last_hit_count = 0;
 
+static int pretty_xml = 0;
+
 typedef enum {
     QueryType_Prefix,
     QueryType_CCL,
@@ -846,6 +851,31 @@ static void print_record(const char *buf, size_t len)
         printf("\n");
 }
 
+static void print_xml_record(const char *buf, size_t len)
+{
+    int has_printed = 0;
+#if YAZ_HAVE_XML2
+    if (pretty_xml)
+    {
+        xmlDocPtr doc;
+        xmlKeepBlanksDefault(0); /* get get xmlDocFormatMemory to work! */
+        doc = xmlParseMemory(buf, len);
+        if (doc)
+        {
+            xmlChar *xml_mem;
+            int xml_size;
+            xmlDocDumpFormatMemory(doc, &xml_mem, &xml_size, 1);
+            fwrite(xml_mem, 1, xml_size, stdout);
+            xmlFree(xml_mem);
+            xmlFreeDoc(doc);
+            has_printed = 1;
+        }
+    }
+#endif
+    if (!has_printed)
+        fwrite(buf, 1, len, stdout);
+}
+
 static void display_record(Z_External *r)
 {
     const Odr_oid *oid = r->direct_reference;
@@ -905,7 +935,8 @@ static void display_record(Z_External *r)
             || !oid_oidcmp(oid, yaz_oid_recsyn_xml)
             || !oid_oidcmp(oid, yaz_oid_recsyn_html))
         {
-            fwrite(octet_buf, 1, octet_len, stdout);
+            print_xml_record(octet_buf, octet_len);
+
         }
         else if (yaz_oid_is_iso2709(oid))
         {
@@ -2985,21 +3016,50 @@ static int cmd_setnames(const char *arg)
 
 /* PRESENT SERVICE ----------------------------- */
 
+size_t check_token(const char *haystack, const char *token)
+{
+    size_t len = strlen(token);
+    size_t extra;
+    if (strncmp(haystack, token, len))
+        return 0;
+    for (extra = 0; haystack[extra + len] != '\0'; extra++)
+        if (!strchr(" \r\n\t", haystack[extra + len]))
+        {
+            if (extra)
+                break;
+            else
+                return 0;  /* no whitespace after token */
+        }
+    return extra + len;
+}
+
 static int parse_show_args(const char *arg_c, char *setstring,
                            Odr_int *start, Odr_int *number)
 {
     char *end_ptr;
     Odr_int start_position;
+    size_t token_len;
 
     if (setnumber >= 0)
         sprintf(setstring, "%d", setnumber);
     else
         *setstring = '\0';
+    
+    token_len = check_token(arg_c, "format");
+    if (token_len)
+    {
+        pretty_xml = 1;
+        arg_c += token_len;
+    }
+    else
+        pretty_xml = 0;
 
-    if (!strcmp(arg_c, "all"))
+    token_len = check_token(arg_c, "all");
+    if (token_len)
     {
         *number = last_hit_count;
         *start = 1;
+        return 1;
     }
     start_position = odr_strtol(arg_c, &end_ptr, 10);
     if (end_ptr == arg_c)
@@ -4282,7 +4342,7 @@ static void handle_srw_record(Z_SRW_record *rec)
     printf("\n");
     if (rec->recordData_buf && rec->recordData_len)
     {
-        printf("%.*s", rec->recordData_len, rec->recordData_buf);
+        print_xml_record(rec->recordData_buf, rec->recordData_len);
         marc_file_write(rec->recordData_buf, rec->recordData_len);
     }
     else
index 9eecb27..a34490a 100644 (file)
@@ -1,10 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** \file fhistory.c
  *  \brief file history implementation
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
index b4e4902..d3481e6 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 31c696e..be68db4 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <string.h>
 #include <stdio.h>
index acd3abe..c99b46f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 8675960..441b971 100644 (file)
@@ -1,7 +1,8 @@
 dnl This file is part of the YAZ toolkit.
-dnl Copyright (C) 1995-2010 Index Data
+dnl Copyright (C) 1995-2011 Index Data
 AC_PREREQ([2.60])
-AC_INIT([yaz],[4.1.1],[yaz-help@indexdata.dk])
+AC_INIT([yaz],[4.1.7],[yaz-help@indexdata.dk])
+AC_CONFIG_HEADERS(include/config.h)
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_AUX_DIR([config])
 AM_INIT_AUTOMAKE([1.9])
@@ -112,7 +113,7 @@ if test "$openssl" != "no"; then
     fi
     AC_MSG_CHECKING([for SSL])
     if test "$sslver" != "no"; then
-       SSL_CFLAGS="-DHAVE_OPENSSL_SSL_H=1 $SSL_CFLAGS"
+       AC_DEFINE([HAVE_OPENSSL_SSL_H],[1],[Define to 1 if OpenSSL is present])
        AC_MSG_RESULT([$sslver])
     else
        SSL_CFLAGS=""
@@ -146,7 +147,7 @@ if test "$gnutls" != "no" -a "$sslver" = "no"; then
     fi
     AC_MSG_CHECKING([for GNU TLS])
     if test "$gnutlsver" != "no"; then
-       SSL_CFLAGS="-DHAVE_GNUTLS_H=1 $SSL_CFLAGS"
+       AC_DEFINE([HAVE_GNUTLS_H],[1],[Define to 1 if GNUTLS is present])
        AC_MSG_RESULT([$gnutlsver])
     else
        SSL_CFLAGS=""
@@ -174,13 +175,13 @@ if test "$ac_cv_lib_readline_readline" = "yes"; then
        #include <readline/readline.h>
            ],[
            rl_attempted_completion_over = 0;
-           ],AC_DEFINE([HAVE_READLINE_COMPLETION_OVER]))
+           ],AC_DEFINE([HAVE_READLINE_COMPLETION_OVER],1,[Define to 1 if rl_attempted_completion_over is defined]))
     AC_TRY_LINK([
        #include <stdio.h>
        #include <readline/readline.h>
            ],[
            rl_completion_matches (0, 0);
-           ],[AC_DEFINE([HAVE_READLINE_RL_COMPLETION_MATCHES])])
+           ],[AC_DEFINE([HAVE_READLINE_RL_COMPLETION_MATCHES],1,[Define to 1 if rl_completion_matches is defined])])
     LIBS=$xLIBS
 fi
 dnl ------ iconv
@@ -198,7 +199,7 @@ if test "$with_iconv" != "no"; then
            ],[
            iconv_t t = iconv_open("", "");
            ],[
-           AC_DEFINE([HAVE_ICONV_H])
+           AC_DEFINE([HAVE_ICONV_H],1,[Define to 1 if iconv.h is present])
            AC_MSG_RESULT([yes])
            ],[
            LIBS="$LIBS -liconv"
@@ -207,7 +208,7 @@ if test "$with_iconv" != "no"; then
                    ],[
            iconv_t t = iconv_open("", "");
                    ],[
-           AC_DEFINE([HAVE_ICONV_H])
+           AC_DEFINE([HAVE_ICONV_H],1)
            AC_MSG_RESULT([yes])
                    ],[
            LIBS="$oldLIBS"
@@ -278,8 +279,7 @@ extern int accept(int, struct sockaddr *, size_t t *);
                ])
        ])
 AC_MSG_RESULT([$ac_cv_check_socklen_t])
-AC_DEFINE_UNQUOTED([YAZ_SOCKLEN_T],[$ac_cv_check_socklen_t])
-AC_DEFINE([YAZ_USE_NEW_LOG])
+AC_DEFINE_UNQUOTED([YAZ_SOCKLEN_T],[$ac_cv_check_socklen_t],[socklen_t type])
 dnl
 dnl ------ tcpd
 AC_ARG_ENABLE([tcpd],[  --enable-tcpd[=PREFIX]  enable TCP wrapper for server if available])
@@ -307,7 +307,7 @@ if test "$enable_tcpd" -a "$enable_tcpd" != "no"; then
     else
        TCPD_LIBS="-lwrap"
        AC_MSG_RESULT([yes])
-       AC_DEFINE([HAVE_TCPD_H])
+       AC_DEFINE([HAVE_TCPD_H],1,[Define to 1 if tcp wrap library is present])
     fi
 fi
 AC_SUBST([TCPD_LIBS])
@@ -336,7 +336,7 @@ if test "$enable_threads" = "yes" -a "$HAVETHREADS" = "0"; then
                LIBS=$OLIBS
            fi
            LIBS="$LIBS $PTHREAD_LIBS"
-           CFLAGS="$CFLAGS -DYAZ_POSIX_THREADS=1"
+           AC_DEFINE(YAZ_POSIX_THREADS,1,[Define to 1 if POSIX threads is present])
            YAZ_CONFIG_CFLAGS="$YAZ_CONFIG_CFLAGS -DYAZ_POSIX_THREADS=1"
            ])
 fi
@@ -346,18 +346,18 @@ AC_SUBST([XML2_CFLAGS])
 
 xml_enabled=false
 YAZ_LIBXML2([
-       AC_DEFINE(YAZ_HAVE_XML2) 
+       AC_DEFINE(YAZ_HAVE_XML2,1,[Define to 1 if Libxml2 is present])
        YAZ_CONFIG_CFLAGS="$YAZ_CONFIG_CFLAGS -DYAZ_HAVE_XML2=1"
        xml_enabled=true
     ])
 
 if test "$xml_enabled" = "true"; then
     YAZ_LIBXSLT([
-           AC_DEFINE(YAZ_HAVE_XSLT)
+           AC_DEFINE(YAZ_HAVE_XSLT,1,[Define to 1 if Libxslt is present])
            YAZ_CONFIG_CFLAGS="$YAZ_CONFIG_CFLAGS -DYAZ_HAVE_XSLT=1"
        ])
     YAZ_LIBEXSLT([
-           AC_DEFINE(YAZ_HAVE_EXSLT)
+           AC_DEFINE(YAZ_HAVE_EXSLT,1,[Define to 1 if EXSLT is present])
            YAZ_CONFIG_CFLAGS="$YAZ_CONFIG_CFLAGS -DYAZ_HAVE_EXSLT=1"
        ])
     
@@ -378,15 +378,6 @@ AC_CHECK_ICU([3.4],[
            AC_MSG_WARN([ICU support disabled because XML support is unavailable])
        fi
 ])
-dnl
-dnl ------ Memory debugging
-AC_ARG_ENABLE([memdebug],[  --enable-memdebug       enable memory debugging],[enable_memdebug=$enableval],[enable_memdebug=none])
-if test "$enable_memdebug" = "yes"; then
-    AC_DEFINE([TRACE_XMALLOC],[2])
-elif test "$enable_memdebug" = "no"; then
-    AC_DEFINE([TRACE_XMALLOC],[0])
-fi
-dnl
 dnl ------ versioning
 dnl
 WIN_FILEVERSION=`echo $PACKAGE_VERSION | $AWK 'BEGIN { FS = "."; } { m = $4; printf("%d,%d,%d,%d", $1, $2, $3 == "" ? "0" : $3, $4 == "" ? "1" : $4);}'`
@@ -404,7 +395,6 @@ dnl ------ Makefiles
 dnl
 AC_OUTPUT([
 Makefile
-yaz.spec
 src/Makefile
 test/Makefile
 util/Makefile
index d959eff..dc2cf57 100644 (file)
@@ -1,3 +1,39 @@
+yaz (4.1.7-1indexdata) unstable; urgency=low
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Tue, 15 Mar 2011 13:59:18 +0100
+
+yaz (4.1.6-1indexdata) unstable; urgency=low
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Thu, 10 Mar 2011 10:25:48 +0100
+
+yaz (4.1.5-1indexdata) unstable; urgency=low
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Tue, 08 Mar 2011 13:53:17 +0100
+
+yaz (4.1.4-1indexdata) unstable; urgency=low
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Mon, 21 Feb 2011 12:51:04 +0100
+
+yaz (4.1.3-1indexdata) unstable; urgency=low
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Thu, 27 Jan 2011 13:56:54 +0100
+
+yaz (4.1.2-1indexdata) unstable; urgency=low
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Tue, 02 Nov 2010 09:51:51 +0100
+
 yaz (4.1.1-1indexdata) unstable; urgency=low
 
   * Upstream.
index a6854cf..db5e508 100755 (executable)
@@ -98,7 +98,7 @@ binary-arch: build install
        dh_fixperms
 #      dh_perl
 #      dh_python
-       dh_makeshlibs -V 'libyaz4 (>= 4.0.12)'
+       dh_makeshlibs -V 'libyaz4 (>= 4.1.5)'
        dh_installdeb
        dh_shlibdeps  -l debian/libyaz4/usr/lib
        dh_gencontrol
index d1e5836..1eb7d9e 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 SUBDIRS = common
 
index 00de5ca..cc59b50 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 00de5ca16beac9c3ac135ff92ff719b86b0c6df9
+Subproject commit cc59b50a147656750bff1385f50fd6ad656d77e4
index c5afda8..5f310e9 100644 (file)
@@ -26,4 +26,4 @@
 <!ENTITY gfs-synopsis-app "application">
 <!ENTITY reference-tools-cql-map "<xref linkend='cql.to.rpn'/>">
 <!ENTITY reference-tools-ccl-qualifiers "<xref linkend='ccl.qualifiers'/>">
-<!ENTITY copyright-year "1995-2010">
+<!ENTITY copyright-year "1995-2011">
index 1c54f74..fc9a628 100644 (file)
@@ -2,7 +2,7 @@
 
   <para>
    &yaz; is a C/C++ library for information retrieval applications
-   using the Z39.50/SRU protocols for information retrieval.
+   using the Z39.50/SRU/SOLR protocols for information retrieval.
   </para>
   
   <para>
@@ -25,7 +25,7 @@
      </para></listitem>
     <listitem><para>
       Supports 
-      <ulink url="&url.solr;">SOLR</ulink> Web Service (client side only)
+      <ulink url="&url.solr;">SOLR</ulink> Web Service version 1.4.x (client side only)
      </para></listitem>
     <listitem><para>
       Supports the following transports: BER over TCP/IP
index 18a4f27..52033bf 100644 (file)
@@ -818,9 +818,11 @@ typedef struct bend_scan_rr {
    </para>
 
    <para>
-    For TCP/IP and SSL, the special hostname <literal>@</literal> 
-    (at sign) is mapped to the address <literal>INADDR_ANY</literal>,
-    which causes the server to listen on any local interface. 
+    For TCP/IP and SSL, the special hostnames <literal>@</literal> and
+    <literal>@6</literal> are mapped to the addresses 
+    <literal>INADDR_ANY</literal> (IPV4) and
+    <literal>IN6ADDR_ANY_INIT</literal> (IPV6)
+    respectively. 
    </para>
 
    <example id="server.example.running.unix"><title>Running the GFS on Unix</title>
index a769ac4..769aa60 100644 (file)
     Must be one of <literal>POST</literal>,
     <literal>GET</literal>, <literal>SOAP</literal> (default)
     or <literal>SOLR</literal>. Version
-    should be either 1.1 or 1.2. Other versions are allowed - for testing
-    purposes (version negotiation with SRU server).
+    should be either 1.1 or 1.2 for SRU. Other versions are allowed - for testing
+    purposes (version negotiation with SRU server). 
+    The version is currently not used for SOLR Web Services
    </para>
   </listitem>
  </varlistentry>
index 5248b73..7c016bf 100644 (file)
  <refsynopsisdiv>
   <cmdsynopsis>
    <command>yaz-icu</command>
-   <arg choice="opt" rep="repeat">commands</arg>
    <arg>-c <replaceable>config</replaceable></arg>
    <arg>-p <replaceable>opt</replaceable></arg>
    <arg>-s</arg>
    <arg>-x</arg>
+   <arg choice="opt">infile</arg>
   </cmdsynopsis>
  </refsynopsisdiv>
  
    <command>yaz-icu</command> is utility which demonstrates 
    the ICU chain module of yaz. (<filename>yaz/icu.h</filename>).
   </para>
+  <para>
+    The utility can be used in two ways. It may read some text
+    using an XML configuration for configuring ICU and show text analysis.
+    This mode is triggered by option <literal>-c</literal> which specififies
+    the configuration to be used. The input file is read from standard
+    input or from a file if <literal>infile</literal> is specified.
+  </para>
+  <para>
+    The utility may also show ICU information. This is triggered by
+    option <literal>-p</literal>.
+  </para>
  </refsect1>
 
  <refsect1><title>OPTIONS</title>
index c21900a..378186e 100644 (file)
@@ -31,8 +31,8 @@
    YAZ is a C/C++ programmer's toolkit supporting the development
    of Z39.50v3 clients and servers. The YAZ toolkit offers
    several different levels of access to the ISO23950/Z39.50, SRU
-   and ILL protocols. The level that you need to use depends
-   on your requirements, and the role (server of client) that you want
+   SOLR (client only) and ILL protocols. The level that you need to use depends
+   on your requirements, and the role (server or client) that you want
    to implement.
   </para>
  </refsect1>
index 7d043d2..8a6bb92 100644 (file)
@@ -43,8 +43,11 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
     connection can be forced to use SRU rather the SRW (the default) by
     prefixing the target string with <literal>sru=get,</literal>, like this:
     <literal>sru=get,http://sru.miketaylor.org.uk:80/sru.pl</literal>
-   </para>
-  
+  </para>
+  <para>
+    <ulink url="&url.solr;">SOLR</ulink>  protocol support was added to YAZ in version 4.1.0, 
+    as a dialect of a SRU protocol, since both are HTTP based protocols. 
+  </para>
   <para>
    The lack of a simple Z39.50 client API for &yaz; has become more
    and more apparent over time. So when the first &zoom; specification
@@ -115,7 +118,8 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
    <para>
     You can prefix the host with a scheme followed by colon. The
     default scheme is <literal>tcp</literal> (Z39.50 protocol).
-    The scheme <literal>http</literal> selects SRU over HTTP.
+    The scheme <literal>http</literal> selects SRU/get over HTTP by default, 
+    but can overridded to use SRU/post, SRW and the SOLR protocol. 
    </para>
    <para>
     You can prefix the scheme-qualified host-string with one or more
@@ -274,12 +278,12 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
        discover whether the server claims to support the specified
        operations.
        </entry><entry>none</entry></row>
-      <row><entry>
-        sru</entry><entry>
-       SRU transport type. Must be either <literal>soap</literal>,
+      <row>
+       <entry>sru</entry><entry>
+       SRU/SOLR transport type. Must be either <literal>soap</literal>,
        <literal>get</literal>, <literal>post</literal>, or
        <literal>solr</literal>.
-       </entry><entry>soap</entry></row>
+        </entry><entry>soap</entry></row>
       <row><entry>
         sru_version</entry><entry>
        SRU/SRW version. Should be <literal>1.1</literal>, or
@@ -362,14 +366,14 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
     </para>
     </sect2>
    <sect2 id="zoom.sru.init.behavior">
-    <title>SRU Protocol behavior</title>
+    <title>SRU/SOLR Protocol behavior</title>
     <para>
-     The SRU protocol doesn't feature an Inititialize Request, so
+     The HTTP based protocols (SRU, SRW, SOLR) doesn't feature an Inititialize Request, so
      the connection phase merely establishes a TCP/IP connection
      with the SOAP service.
     </para>
     <para>Most of the ZOOM connection options do not
-     affect SRU and they are ignored. However, future versions
+     affect SRU/SOLR and they are ignored. However, future versions
      of &yaz; might honor <literal>implementationName</literal> and
      put that as part of User-Agent header for HTTP requests.
      </para>
@@ -667,7 +671,10 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
      SRU SearchRetrieveRequest.
     </para>
     <para>
-     Unfortunately, SRU does not define a database setting. Hence,
+     SOLR queries has to be done in SOLR query format.
+    </para>
+    <para>
+     Unfortunately, SRU or SOLR does not define a database setting. Hence,
      <literal>databaseName</literal> is unsupported and ignored.
      However, the path part in host parameter for functions 
      <function>ZOOM_connecton_new</function> and
@@ -743,18 +750,29 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
     The <parameter>type</parameter> is a string of the format:
    </para>
    <para>
-    <replaceable>form</replaceable>[;charset=<replaceable>from</replaceable>[,<replaceable>to</replaceable>]][;format=<replaceable>v</replaceable>]
+    <replaceable>format</replaceable>[;charset=<replaceable>from</replaceable>[/<replaceable>opacfrom</replaceable>][,<replaceable>to</replaceable>]][;format=<replaceable>v</replaceable>]
    </para>
    <para>
-    where <replaceable>form</replaceable> specifies the format of the
+    where <replaceable>format</replaceable> specifies the format of the
     returned record, <replaceable>from</replaceable>
     specifies the character set of the record in its original form
     (as returned by the server), <replaceable>to</replaceable> specifies
     the output (returned)
     character set encoding.
-    If charset is not given, then no character set conversion takes place.
     If <replaceable>to</replaceable> is omitted UTF-8 is assumed.
+    If charset is not given, then no character set conversion takes place.
+   </para>
+   
+   <para>OPAC records may be returned in a different
+     set from the bibliographic MARC record. If this is this the case,
+    <replaceable>opacfrom</replaceable> should be set to the character set
+    of the OPAC record part.
    </para>
+   <note>
+     <para>
+       Specifying the OPAC record character set requires YAZ 4.1.5 or later.
+     </para>
+   </note>
    <para>
     The format argument controls whether record data should be XML
     pretty-printed (post process operation).
@@ -809,7 +827,7 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
      </varlistentry>
      <varlistentry><term><literal>xml</literal></term>
       <listitem><para>The record is returned in XML if possible.
-       SRU and Z39.50 records with transfer syntax XML are
+       SRU, SOLR and Z39.50 records with transfer syntax XML are
        returned verbatim. MARC records are returned in
        <ulink url="&url.marcxml;">
         MARCXML
@@ -876,9 +894,9 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
     </para>
    </sect2>
    <sect2 id="zoom.sru.record.behavior">
-    <title>SRU Protocol behavior</title>
+    <title>SRU/SOLR Protocol behavior</title>
     <para>
-     The ZOOM driver for SRU treats records returned by a SRU server
+     The ZOOM driver for SRU/SOLR treats records returned by a SRU/SOLR server
      as if they where Z39.50 records with transfer syntax XML and
      no element set name or database name.
     </para>
@@ -886,6 +904,8 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
   </sect1>
   <sect1 id="zoom.facets"><title>Facets</title>
    <para>
+    Facets operations is not part of the official ZOOM specification, but is an Index Data extension 
+    for YAZ-based Z39.50 targets or <ulink url="&url.solr;">SOLR</ulink> targets. 
     In case the target can and is requested to return facets, using a result set the ZOOM client 
     can request one or all facet fields. Using a facet field the client can request the term count and 
     then interate over the terms.
@@ -945,7 +965,7 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
    </para>
 
    <para>
-    The Scan interface is supported for both Z39.50 and SRU.
+    The Scan interface is supported for both Z39.50, SRU (and SOLR?).
    </para>
 
    <synopsis>
index 73ee159..fa02f3f 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 etcdatadir = $(pkgdatadir)/etc
 etcdata_DATA =  \
index 44176e9..bda6815 100644 (file)
--- a/header.c
+++ b/header.c
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 282522d..56344fd 100644 (file)
@@ -1,2 +1,5 @@
 Makefile
 Makefile.in
+config.h
+config.h.in
+stamp-h1
\ No newline at end of file
index 268d417..b8d5613 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 AUTOMAKE_OPTIONS = foreign 
 
index f34b2a7..d43ed8f 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 noinst_HEADERS = icu_I18N.h
 
@@ -23,7 +23,7 @@ pkginclude_HEADERS= backend.h ccl.h ccl_xml.h cql.h rpn2cql.h rpn2solr.h \
  zes-psched.h zes-admin.h zes-pset.h zes-update.h zes-update0.h \
  zoom.h z-charneg.h charneg.h soap.h srw.h zgdu.h matchstr.h json.h \
  file_glob.h dirent.h thread_id.h gettimeofday.h shptr.h thread_create.h \
- spipe.h
+ spipe.h stemmer.h
 
 EXTRA_DIST = yaz-version.h.in
 
index 5c04a60..b27d4c8 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index cee037a..9e175fa 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index e08b59e..f821395 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index f87f589..64be711 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index e27cfa6..ed5065b 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index c7ec5b3..f79c00e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 8da61d0..2c92470 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 09ffb91..95af0bd 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index b565ec2..7bafaa5 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index e9dda14..f764245 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index d51b2ef..5ac83ce 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index dc0b45c..89baadd 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 4f4de48..67bf396 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 10af2a3..23364b3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index eb0f22d..09b30e6 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 22e8303..e3321cc 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 723ad02..de7803a 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index ddcbb85..9560532 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 2874897..a82499c 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index f472aba..c650fca 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -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
+    
+    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);
 
+/** \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
index a06e02e..33cf4f3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 3493d81..df44f61 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 414e09f..4a740e5 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 13a3a8a..70dad4e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index c60fd8a..f79f262 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index eb12dd4..f081581 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index bbab0b3..f6bf7a7 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 0767ddd..054c98e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index e3e63ad..c4d4e13 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 1660f37..2bd1491 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index bfecdbd..0d2a3b6 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index a381db9..965b1ef 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 60d3ec7..36be422 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 1ed0de3..bb93c54 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 479d1e9..3688808 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 42c02d0..6af1134 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index d15f40f..0e07fd0 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index da9fec1..f8912bf 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index bdc0889..f63630d 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 4736a47..4a239eb 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 09d83ba..7dcb96f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -70,6 +70,7 @@ int cql_transform_rpn2cql_wrbuf(cql_transform_t ct,
     \param attributes RPN attributes
     \returns pattern value or NULL if not found
  */
+YAZ_EXPORT
 const char *cql_lookup_reverse(cql_transform_t ct, 
                                const char *category,
                                Z_AttributeList *attributes);
index f4dced9..80bd4c5 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -70,6 +70,7 @@ int solr_transform_rpn2solr_wrbuf(solr_transform_t ct,
     \param attributes RPN attributes
     \returns pattern value or NULL if not found
  */
+YAZ_EXPORT
 const char *solr_lookup_reverse(solr_transform_t ct,
                                const char *category,
                                Z_AttributeList *attributes);
index 9976efe..dbf3b6f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index b621b3d..4feba83 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 9c65445..18fb812 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index f565ea1..e655b46 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 09ecdcc..b9d798f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 909f3b1..2b166d9 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 1b48650..c80f717 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index bd0c782..b8bfae2 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index decd6fc..1177e54 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
diff --git a/include/yaz/stemmer.h b/include/yaz/stemmer.h
new file mode 100644 (file)
index 0000000..56f37fb
--- /dev/null
@@ -0,0 +1,61 @@
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data.
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Index Data nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file stemming.h
+ * \brief Header for the stemming API. Simple wrapper to hide underlying implementation.
+ */
+
+#ifndef YAZ_STEMMER_H
+#define YAZ_STEMMER_H
+
+#include <yaz/yconfig.h>
+#include <yaz/xmltypes.h>
+#include <yaz/icu_I18N.h>
+#include <yaz/log.h>
+
+#include <unicode/ustring.h>  /* some more string fcns*/
+#include <unicode/uchar.h>    /* char names           */
+
+
+YAZ_BEGIN_CDECL
+
+typedef struct yaz_stemmer_t *yaz_stemmer_p;
+
+YAZ_EXPORT
+yaz_stemmer_p yaz_stemmer_create(const char *locale, const char *rule, UErrorCode *status);
+
+YAZ_EXPORT
+yaz_stemmer_p yaz_stemmer_clone(yaz_stemmer_p stemmer);
+
+YAZ_EXPORT
+void yaz_stemmer_stem(yaz_stemmer_p stemmer, struct icu_buf_utf16 *dst, struct icu_buf_utf16* src, UErrorCode *status);
+
+YAZ_EXPORT
+void yaz_stemmer_destroy(yaz_stemmer_p stemmer);
+
+#endif
index 7358db6..1c7f6fb 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index c975567..0ea935e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index d93bc03..c6eb9b3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index bea3c19..a00d343 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 60456c0..0f8a982 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 388ea41..2898aab 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 59de466..da145dc 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index c78c665..36b3999 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 0f393a6..56b5e60 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -124,6 +124,19 @@ YAZ_EXPORT void wrbuf_printf(WRBUF b, const char *fmt, ...)
         __attribute__ ((format (printf, 2, 3)))
 #endif
         ;
+
+/** \brief general writer of string using iconv and cdata
+    \param b WRBUF
+    \param cd iconv handle (0 for no conversion)
+    \param buf buffer
+    \param size size of buffer
+    \param cdata non-zero for CDATA; 0 for cdata
+    \returns -1 if invalid sequence was encountered (truncation in effect)
+    \returns 0 if buffer could be converted and written
+*/
+int wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf,
+                        size_t size, int cdata);
+
 /** \brief iconv converts buffer and appends to WRBUF
     \param b WRBUF
     \param cd iconv handle
index be4b703..f96cdd5 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 2b708c0..56dae79 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 909d2bf..42752d4 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 9df4982..193ce00 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 05baa16..c2aae1e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 158e7ad..c0ebdd7 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index b0bc26d..c09c647 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index b2113e9..4d705bf 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index a214429..d0f8f03 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index ca38b0d..a505e12 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -140,6 +140,9 @@ ZOOM_diag_str (int error);
 #define ZOOM_ERROR_CQL_TRANSFORM 10012
 #define ZOOM_ERROR_CCL_CONFIG 10013
 #define ZOOM_ERROR_CCL_PARSE 10014
+#define ZOOM_ERROR_ES_INVALID_ACTION 10015
+#define ZOOM_ERROR_ES_INVALID_VERSION 10016
+#define ZOOM_ERROR_ES_INVALID_SYNTAX 10017
 
 ZOOM_API(int)
 ZOOM_connection_last_event(ZOOM_connection cs);
diff --git a/libstemmer_c b/libstemmer_c
new file mode 160000 (submodule)
index 0000000..368f4a2
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 368f4a253716e312b66209d61c927d5039c51287
diff --git a/m4 b/m4
index 1fa0b45..96ff03f 160000 (submodule)
--- a/m4
+++ b/m4
@@ -1 +1 @@
-Subproject commit 1fa0b45a8141955801938f967f1d1dca1b042c17
+Subproject commit 96ff03f91b4539e315dadd50ab2564412c076394
index d0060df..5aeb22c 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 YAZ_VERSION_INFO=4:0:0
 
@@ -28,7 +28,7 @@ YAZCOMP_I = $(YAZCOMP) -d $(srcdir)/ill.tcl -i yaz -I$(top_srcdir)/include
 AM_CPPFLAGS=-I$(top_srcdir)/include $(XML2_CFLAGS) $(SSL_CFLAGS) 
 libyaz_la_LIBADD = $(SSL_LIBS) $(TCPD_LIBS)
 libyaz_server_la_LIBADD = libyaz.la
-libyaz_icu_la_CPPFLAGS = $(AM_CPPFLAGS) $(ICU_CPPFLAGS)
+libyaz_icu_la_CPPFLAGS = $(AM_CPPFLAGS) $(ICU_CPPFLAGS) -I$(top_srcdir)/libstemmer_c/include
 libyaz_icu_la_LIBADD = libyaz.la $(ICU_LIBS)
 
 AM_YFLAGS=-p cql_
@@ -115,8 +115,22 @@ libyaz_server_la_SOURCES = statserv.c seshigh.c eventl.c \
 
 libyaz_server_la_LDFLAGS=-version-info $(YAZ_VERSION_INFO)
 
-libyaz_icu_la_SOURCES = icu_chain.c icu_utf16.c icu_utf8.c \
-       icu_transform.c icu_casemap.c icu_tokenizer.c icu_sortkey.c
+STEMMER_SOURCES = \
+       ../libstemmer_c/include/libstemmer.h \
+       ../libstemmer_c/libstemmer/libstemmer.c \
+       ../libstemmer_c/libstemmer/modules.h \
+       ../libstemmer_c/runtime/api.c \
+       ../libstemmer_c/runtime/api.h \
+       ../libstemmer_c/runtime/header.h \
+       ../libstemmer_c/runtime/utilities.c \
+       ../libstemmer_c/src_c/stem_UTF_8_porter.c \
+       ../libstemmer_c/src_c/stem_UTF_8_porter.h \
+       ../libstemmer_c/src_c/stem_UTF_8_english.c \
+       ../libstemmer_c/src_c/stem_UTF_8_english.h
+
+libyaz_icu_la_SOURCES = icu_chain.c icu_utf16.c icu_utf8.c stemmer.c \
+       icu_transform.c icu_casemap.c icu_tokenizer.c icu_sortkey.c \
+       $(STEMMER_SOURCES)
 libyaz_icu_la_LDFLAGS=-version-info $(YAZ_VERSION_INFO)
 
 # Rules for Z39.50 V3
index a207ca4..463c595 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index d22f84f..50a8381 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index ec526a9..8164e97 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 70e4230..edce71a 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index a3d0571..f5310a3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 786321e..e7ed655 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 5dbdda8..eec85f4 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 94fa80c..91dc5f4 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 9cccae9..404d7d7 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 9a96e52..d076eaa 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 69cdc8e..2c3e6c9 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 9d06f98..db0e16c 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** 
  * \file ccl_stop_words.c
  * \brief Removes stop words from terms in RPN tree
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
index 2d69c39..30a6969 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** 
@@ -9,6 +9,9 @@
  * This source file implements mapping between CCL error code and
  * their string equivalents.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/ccl.h>
 
index 87a216c..30abcbe 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** 
@@ -11,6 +11,9 @@
  * of lookahead in the handling of relational operations.. So
  * it's not really pure.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <string.h>
index dbfc741..d792742 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 98e6bb8..1bbcaad 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** 
@@ -9,6 +9,9 @@
  * This source file implements functions to parse and print
  * a CCL node tree (as a result of parsing).
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
index a2bb336..c49df6c 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** 
  * \file cclqfile.c
  * \brief Implements parsing of CCL qualifier specs in files
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
index bdc499d..d196a00 100644 (file)
@@ -1,11 +1,15 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** 
  * \file cclqual.c
  * \brief Implements CCL qualifier utilities
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 1f46616..7c1e3e9 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** 
  * \file cclstr.c
  * \brief Implements CCL string compare utilities
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
index b784295..db5d9c9 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /** 
  * \file ccltoken.c
  * \brief Implements CCL lexical analyzer (scanner)
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <string.h>
 #include <stdlib.h>
index d6a8de5..cc17229 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file cclxmlconfig.c
     \brief XML configuration for CCL
 */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
index 5500f59..8f8cc9e 100644 (file)
@@ -16,6 +16,11 @@ proc preamble_trie {ofilehandle ifiles ofile} {
     puts $f "    Generated automatically by charconv.tcl"
     puts $f "*/"
     puts $f "\#include <string.h>"
+
+    puts $f "\#if HAVE_CONFIG_H"
+    puts $f "\#include <config.h>"
+    puts $f "\#endif"
+
     puts $f "
         struct yaz_iconv_trie_flat {
             char from\[6\];
index 48b168d..9701cda 100644 (file)
@@ -1,14 +1,17 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** 
  * \file charneg.c
  * \brief Implements Z39.50 Charset negotiation utilities
  *
  * Helper functions for Character Set and Language Negotiation - 3
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <yaz/otherinfo.h>
 #include <yaz/z-charneg.h>
index 0df8678..496fe22 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** 
  * \file comstack.c
  * \brief Implements Generic COMSTACK functions
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <string.h>
 #include <ctype.h>
index 19291d4..2e7c48f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index dc34993..2afd1dc 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file copy_types.c
     \brief Copies various Z39.50 types
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/copy_types.h>
 
index 25a4287..7bb83f8 100644 (file)
--- a/src/cql.y
+++ b/src/cql.y
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */ 
 /* bison parser for CQL grammar. */
@@ -11,6 +11,9 @@
  * This is a YACC parser, but since it must be reentrant, Bison is required.
  * The original source file is cql.y.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 0a908ec..748cc7d 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /*
index 1c5f364..377fabe 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /*
index 6d68439..e1fe5f0 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file cqlstdio.c
  * \brief Implements query stream reading using FILE handle.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/cql.h>
 
index 0dac583..f45a769 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file cqlstrer.c
  * \brief Implements CQL error code map to description string.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/cql.h>
 
index 762e5fa..4653b82 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file cqlstring.c
  * \brief Implements query stream reader that reads from a C string.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/cql.h>
 
index 55c3366..a07894e 100644 (file)
@@ -1,8 +1,7 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file cqltransform.c
  * \brief Implements CQL transform (CQL to RPN conversion).
@@ -17,6 +16,9 @@
  * index
  * relationModifier
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <stdlib.h>
index b9ff63f..8eb25f3 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file cqlutil.c
  * \brief Implements CQL tree node utilities.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <string.h>
index 3124ba9..ce1db5f 100644 (file)
@@ -20,6 +20,10 @@ proc csvtodiag {ifiles name alias} {
     puts $hfile "/** \\file [lindex $ifiles 2]"
     set preamble "    \\brief Diagnostics: Generated by csvtodiag.tcl from [lindex $ifiles 0] */"
     puts $cfile $preamble
+    puts $cfile "\#ifdef HAVE_CONFIG_H"
+    puts $cfile "\#include <config.h>"
+    puts $cfile "\#endif"
+
     puts $cfile "
 #include \"diag-entry.h\"
 \#include \"[lindex $ifiles 2]\"
index 69c2330..838a808 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 33894b7..cea53e6 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 90ae3bf..4f16ef8 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 7ea1df4..3cf8ef9 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index e90ad27..c02ae3b 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index ae46836..0915d86 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 666015c..ee542b2 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index b5ef123..d9f2e52 100644 (file)
@@ -1,8 +1,7 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file eventl.c
  * \brief Implements event loop handling for GFS.
@@ -10,6 +9,9 @@
  * This source implements the main event loop for the Generic Frontend
  * Server.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <errno.h>
index f988224..19cc9f3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index dd27b6f..e4e787c 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
@@ -91,7 +91,6 @@ static void useattr(Z_AttributeElement *ae, struct yaz_facet_attr *av)
     if (ae->which == Z_AttributeValue_complex)
     {
         s = stringattr(ae->value.complex);
-        yaz_log(YLOG_DEBUG, "useattr %s %s", s, av->useattr);
         if (s)
         {
             if (!av->useattr)
@@ -147,7 +146,6 @@ static void limitattr(Z_AttributeElement *ae, struct yaz_facet_attr *av)
     if (ae->which == Z_AttributeValue_numeric)
     {
         av->limit = *ae->value.numeric;
-        yaz_log(YLOG_DEBUG, "limitattr %d ", av->limit);
     }
     else
     {
@@ -171,12 +169,9 @@ void yaz_facet_attr_get_z_attributes(const Z_AttributeList *attributes,
 {
     int i;
     Z_AttributeElement *ae;
-    yaz_log(YLOG_DEBUG, "Attribute num attributes: %d",
-            attributes->num_attributes);
     for (i=0; i < attributes->num_attributes; i++) {
         ae = attributes->attributes[i];
         /* ignoring the attributeSet here */
-        yaz_log(YLOG_DEBUG, "Attribute type %d", (int) *ae->attributeType);
         if (*ae->attributeType == 1)
         { /* use attribute */
             useattr(ae, av);
@@ -195,7 +190,7 @@ void yaz_facet_attr_get_z_attributes(const Z_AttributeList *attributes,
             sprintf(av->useattrbuff, ODR_INT_PRINTF,
                         *ae-> attributeType);
             av->errstring = av->useattrbuff;
-            yaz_log(YLOG_DEBUG, "Unsupported attribute type %s", av->useattrbuff);
+            yaz_log(YLOG_WARN, "Unsupported attribute type %s", av->useattrbuff);
             /* would like to give a better message, but the standard */
             /* tells me to return the attribute type */
         }
index 065b5c5..57b51ac 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
@@ -14,6 +14,7 @@
 #include <sys/stat.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #include <assert.h>
 #include <yaz/wrbuf.h>
 #include <yaz/tpath.h>
@@ -97,6 +98,34 @@ static void glob_r(yaz_glob_res_t res, const char *pattern, size_t off,
     }
 }
 
+static int cmp_entry(const void *a, const void *b)
+{
+    struct res_entry *ent_a = *(struct res_entry **) a;
+    struct res_entry *ent_b = *(struct res_entry **) b;
+    return strcmp(ent_a->file, ent_b->file);
+}
+
+static void sort_them(yaz_glob_res_t res)
+{
+    size_t i;
+    struct res_entry **ent_p;
+    struct res_entry **ent = nmem_malloc(res->nmem, sizeof(*ent) * res->number_of_entries);
+    struct res_entry *ent_i = res->entries;
+    for (i = 0; i < res->number_of_entries; i++)
+    {
+        ent[i] = ent_i;
+        ent_i = ent_i->next;
+    }
+    qsort(ent, res->number_of_entries, sizeof(*ent), cmp_entry);
+    ent_p = &res->entries;
+    for (i = 0; i < res->number_of_entries; i++)
+    {
+        *ent_p = ent[i];
+        ent_p = &ent[i]->next;
+    }
+    *ent_p = 0;
+}
+
 int yaz_file_glob(const char *pattern, yaz_glob_res_t *res)
 {
     char prefix[FILENAME_MAX+1];
@@ -109,6 +138,7 @@ int yaz_file_glob(const char *pattern, yaz_glob_res_t *res)
     (*res)->entries = 0;
     (*res)->last_entry = &(*res)->entries;
     glob_r(*res, pattern, 0, prefix);
+    sort_them(*res);
     return 0;
 }
 
index 2310920..8308b0b 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 1fd2727..29b6304 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file grs1disp.c
  * \brief Implements display of GRS-1 records
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
index 4362c75..7546047 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file http.c
  * \brief Implements HTTP decoding
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <ctype.h>
 #include <yaz/odr.h>
index 805b827..4531f73 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 7196704..7e86c0d 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 53a81e6..33847bc 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index e9f9969..7b31510 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index e68f49a..20b6505 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 87c2a89..2d7b694 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 79dd024..41b4492 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 26aa737..6453229 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 8ae80fc..4f36502 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
 
 #include <yaz/icu_I18N.h>
 
-#include <yaz/log.h>
+#include <yaz/stemmer.h>
 
+#include <yaz/log.h>
+#include <yaz/nmem.h>
+#include <yaz/nmem_xml.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 
 enum icu_chain_step_type {
     ICU_chain_step_type_none,
-    ICU_chain_step_type_display,   /* convert to utf8 display format */
-    ICU_chain_step_type_casemap,   /* apply utf16 charmap */
-    ICU_chain_step_type_transform, /* apply utf16 transform */
-    ICU_chain_step_type_tokenize,  /* apply utf16 tokenization */
-    ICU_chain_step_type_transliterate  /* apply utf16 tokenization */
+    ICU_chain_step_type_display,        /* convert to utf8 display format */
+    ICU_chain_step_type_casemap,        /* apply utf16 charmap */
+    ICU_chain_step_type_transform,      /* apply utf16 transform */
+    ICU_chain_step_type_tokenize,       /* apply utf16 tokenization */
+    ICU_chain_step_type_transliterate,  /* apply utf16 tokenization */
+    YAZ_chain_step_type_stemming        /* apply utf16 stemming (YAZ) */
 };
 
 struct icu_chain_step
@@ -41,11 +45,12 @@ struct icu_chain_step
     /* type and action object */
     enum icu_chain_step_type type;
     union {
-       struct icu_casemap * casemap;
-       struct icu_transform * transform;
-       struct icu_tokenizer * tokenizer;  
+       struct icu_casemap   *casemap;
+       struct icu_transform *transform;
+       struct icu_tokenizer *tokenizer;  
+        yaz_stemmer_p         stemmer;
     } u;
-    struct icu_chain_step * previous;
+    struct icu_chain_step *previous;
 };
 
 struct icu_chain
@@ -54,10 +59,10 @@ struct icu_chain
     char *locale;
     int sort;
 
-    UCollator * coll;
+    UCollator *coll;
     
     /* linked list of chain steps */
-    struct icu_chain_step * csteps;
+    struct icu_chain_step *csteps;
 };
 
 int icu_check_status(UErrorCode status)
@@ -70,12 +75,11 @@ int icu_check_status(UErrorCode status)
     return 1;
 }
 
-static struct icu_chain_step *icu_chain_step_create(
-    struct icu_chain * chain,  enum icu_chain_step_type type,
-    const uint8_t * rule, 
-    UErrorCode *status)
+static struct icu_chain_step *icu_chain_insert_step(
+    struct icu_chain *chain, enum icu_chain_step_type type,
+    const uint8_t *rule, UErrorCode *status)
 {
-    struct icu_chain_step * step = 0;
+    struct icu_chain_step *step = 0;
     
     if (!chain || !type || !rule)
         return 0;
@@ -105,14 +109,20 @@ static struct icu_chain_step *icu_chain_step_create(
         step->u.transform = icu_transform_create("custom", 'f',
                                                  (const char *) rule, status);
         break;
+    case YAZ_chain_step_type_stemming:
+        step->u.stemmer = yaz_stemmer_create((char *) chain->locale, (const char *) rule, status);
+        break;
     default:
         break;
     }
+    step->previous = chain->csteps;
+    chain->csteps = step;
+
     return step;
 }
 
 
-static void icu_chain_step_destroy(struct icu_chain_step * step)
+static void icu_chain_step_destroy(struct icu_chain_step *step)
 {
     if (!step)
         return;
@@ -133,6 +143,9 @@ static void icu_chain_step_destroy(struct icu_chain_step * step)
     case ICU_chain_step_type_tokenize:
         icu_tokenizer_destroy(step->u.tokenizer);
         break;
+    case YAZ_chain_step_type_stemming:
+        yaz_stemmer_destroy(step->u.stemmer);
+        break;
     default:
         break;
     }
@@ -162,6 +175,9 @@ struct icu_chain_step *icu_chain_step_clone(struct icu_chain_step *old)
         case ICU_chain_step_type_tokenize:
             (*sp)->u.tokenizer = icu_tokenizer_clone(old->u.tokenizer);
             break;
+        case YAZ_chain_step_type_stemming:
+            (*sp)->u.stemmer = yaz_stemmer_clone(old->u.stemmer);
+            break;
         case ICU_chain_step_type_none:
             break;
         }
@@ -173,9 +189,9 @@ struct icu_chain_step *icu_chain_step_clone(struct icu_chain_step *old)
 }
 
 struct icu_chain *icu_chain_create(const char *locale, int sort,
-                                   UErrorCode * status)
+                                   UErrorCode *status)
 {
-    struct icu_chain * chain 
+    struct icu_chain *chain 
         = (struct icu_chain *) xmalloc(sizeof(*chain));
 
     *status = U_ZERO_ERROR;
@@ -195,7 +211,7 @@ struct icu_chain *icu_chain_create(const char *locale, int sort,
     return chain;
 }
 
-void icu_chain_destroy(struct icu_chain * chain)
+void icu_chain_destroy(struct icu_chain *chain)
 {
     if (chain)
     {
@@ -211,15 +227,17 @@ void icu_chain_destroy(struct icu_chain * chain)
 }
 
 static struct icu_chain_step *icu_chain_insert_step(
-    struct icu_chain * chain, enum icu_chain_step_type type,
-    const uint8_t * rule, UErrorCode *status);
+    struct icu_chain *chain, enum icu_chain_step_type type,
+    const uint8_t *rule, UErrorCode *status);
 
-struct icu_chain * icu_chain_xml_config(const xmlNode *xml_node, 
-                                        int sort,
-                                        UErrorCode * status)
+struct icu_chain *icu_chain_xml_config(const xmlNode *xml_node, 
+                                       int sort,
+                                       UErrorCode *status)
 {
     xmlNode *node = 0;
-    struct icu_chain * chain = 0;
+    int no_errors = 0;
+    struct icu_chain *chain = 0;
+    NMEM nmem = 0;
    
     *status = U_ZERO_ERROR;
 
@@ -227,8 +245,8 @@ struct icu_chain * icu_chain_xml_config(const xmlNode *xml_node,
         return 0;
     
     {
-        xmlChar * xml_locale = xmlGetProp((xmlNode *) xml_node, 
-                                          (xmlChar *) "locale");
+        xmlChar *xml_locale = xmlGetProp((xmlNode *) xml_node, 
+                                         (xmlChar *) "locale");
         
         if (xml_locale)
         {
@@ -240,37 +258,58 @@ struct icu_chain * icu_chain_xml_config(const xmlNode *xml_node,
     if (!chain)
         return 0;
 
+    nmem = nmem_create();
     for (node = xml_node->children; node; node = node->next)
     {
-        xmlChar *xml_rule;
-        struct icu_chain_step * step = 0;
+        char *rule = 0;
+        struct icu_chain_step *step = 0;
+        struct _xmlAttr *attr;
 
+        nmem_reset(nmem);
         if (node->type != XML_ELEMENT_NODE)
             continue;
 
-        xml_rule = xmlGetProp(node, (xmlChar *) "rule");
-
+        for (attr = node->properties; attr; attr = attr->next)
+        {
+            if (!strcmp((const char *) attr->name, "rule"))
+            {
+                rule = nmem_text_node_cdata(attr->children, nmem);
+            }
+            else
+            {
+                yaz_log(YLOG_WARN, "Unsupported attribute '%s' for "
+                        "element '%s'", attr->name, node->name);
+                no_errors++;
+                continue;
+            }
+        }
+        if (!rule && node->children)
+            rule = nmem_text_node_cdata(node->children, nmem);
+        
         if (!strcmp((const char *) node->name, "casemap"))
             step = icu_chain_insert_step(chain, ICU_chain_step_type_casemap, 
-                                         (const uint8_t *) xml_rule, status);
+                                         (const uint8_t *) rule, status);
         else if (!strcmp((const char *) node->name, "transform"))
             step = icu_chain_insert_step(chain, ICU_chain_step_type_transform, 
-                                         (const uint8_t *) xml_rule, status);
+                                         (const uint8_t *) rule, status);
         else if (!strcmp((const char *) node->name, "transliterate"))
             step = icu_chain_insert_step(chain, ICU_chain_step_type_transliterate, 
-                                         (const uint8_t *) xml_rule, status);
+                                         (const uint8_t *) rule, status);
         else if (!strcmp((const char *) node->name, "tokenize"))
             step = icu_chain_insert_step(chain, ICU_chain_step_type_tokenize, 
-                                         (const uint8_t *) xml_rule, status);
+                                         (const uint8_t *) rule, status);
         else if (!strcmp((const char *) node->name, "display"))
             step = icu_chain_insert_step(chain, ICU_chain_step_type_display, 
                                          (const uint8_t *) "", status);
+        else if (!strcmp((const char *) node->name, "stemming"))
+            step = icu_chain_insert_step(chain, YAZ_chain_step_type_stemming,
+                                         (const uint8_t *) rule, status);
         else if (!strcmp((const char *) node->name, "normalize"))
         {
             yaz_log(YLOG_WARN, "Element %s is deprecated. "
                     "Use transform instead", node->name);
             step = icu_chain_insert_step(chain, ICU_chain_step_type_transform, 
-                                         (const uint8_t *) xml_rule, status);
+                                         (const uint8_t *) rule, status);
         }
         else if (!strcmp((const char *) node->name, "index")
                  || !strcmp((const char *) node->name, "sortkey"))
@@ -281,36 +320,22 @@ struct icu_chain * icu_chain_xml_config(const xmlNode *xml_node,
         else
         {
             yaz_log(YLOG_WARN, "Unknown element %s", node->name);
-            icu_chain_destroy(chain);
-            return 0;
+            no_errors++;
+            continue;
         }
-        xmlFree(xml_rule);
         if (step && U_FAILURE(*status))
         {
-            icu_chain_destroy(chain);
-            return 0;
+            no_errors++;
+            break;
         }
     }
-    return chain;
-}
-
-
-static struct icu_chain_step *icu_chain_insert_step(
-    struct icu_chain * chain, enum icu_chain_step_type type,
-    const uint8_t * rule, UErrorCode *status)
-{    
-    struct icu_chain_step * step = 0;
-    if (!chain || !type || !rule)
+    nmem_destroy(nmem);
+    if (no_errors)
+    {
+        icu_chain_destroy(chain);
         return 0;
-
-    /* create actual chain step with this buffer */
-    step = icu_chain_step_create(chain, type, rule,
-                                 status);
-
-    step->previous = chain->csteps;
-    chain->csteps = step;
-
-    return step;
+    }
+    return chain;
 }
 
 struct icu_iter {
@@ -398,6 +423,15 @@ struct icu_buf_utf16 *icu_iter_invoke(yaz_icu_iter_t iter,
             if (dst)
                 icu_utf16_to_utf8(iter->display, dst, &iter->status);
             break;
+        case YAZ_chain_step_type_stemming:
+            if (dst)
+            {
+                struct icu_buf_utf16 *src = dst;
+                dst = icu_buf_utf16_create(0);
+                yaz_stemmer_stem(step->u.stemmer, dst, src, &iter->status);
+                icu_buf_utf16_destroy(src);
+            }
+            break;
         default:
             assert(0);
         }
@@ -495,7 +529,7 @@ int icu_iter_get_token_number(yaz_icu_iter_t iter)
     return iter->token_count;
 }
 
-int icu_chain_assign_cstr(struct icu_chain * chain, const char * src8cstr, 
+int icu_chain_assign_cstr(struct icu_chain *chain, const char *src8cstr, 
                           UErrorCode *status)
 {
     if (chain->iter)
@@ -505,34 +539,34 @@ int icu_chain_assign_cstr(struct icu_chain * chain, const char * src8cstr,
     return 1;
 }
 
-int icu_chain_next_token(struct icu_chain * chain, UErrorCode *status)
+int icu_chain_next_token(struct icu_chain *chain, UErrorCode *status)
 {
     *status = U_ZERO_ERROR;
     return icu_iter_next(chain->iter);
 }
 
-int icu_chain_token_number(struct icu_chain * chain)
+int icu_chain_token_number(struct icu_chain *chain)
 {
     if (chain && chain->iter)
         return chain->iter->token_count;
     return 0;
 }
 
-const char * icu_chain_token_display(struct icu_chain * chain)
+const char *icu_chain_token_display(struct icu_chain *chain)
 {
     if (chain->iter)
         return icu_iter_get_display(chain->iter);
     return 0;
 }
 
-const char * icu_chain_token_norm(struct icu_chain * chain)
+const char *icu_chain_token_norm(struct icu_chain *chain)
 {
     if (chain->iter)
         return icu_iter_get_norm(chain->iter);
     return 0;
 }
 
-const char * icu_chain_token_sortkey(struct icu_chain * chain)
+const char *icu_chain_token_sortkey(struct icu_chain *chain)
 {
     if (chain->iter)
         return icu_iter_get_sortkey(chain->iter);
index 8130055..8fed394 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index d6ec7fe..54cfbf3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 4e3036d..e8d2012 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
@@ -60,10 +60,8 @@ struct icu_transform * icu_transform_create(const char *id, char action,
     transform->trans = 0;
 
     if (id)
-    {
         icu_utf16_from_utf8_cstr(id16, id, status);
-        id16->utf16[id16->utf16_len] = 0;
-    }
+
     if (rules)
         icu_utf16_from_utf8_cstr(rules16, rules, status);
 
index 6c028b4..c5970ef 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 3ba9651..77fc2b3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 87e5e1a..d9ec51d 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file ill-get.c
  * \brief Implements ILL package creator utilities
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <yaz/ill.h>
index e4a2292..4d147db 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 61309bc..5f22b24 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 91cb4e4..58a6690 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file json.c
  * \brief JSON encoding/decoding
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/json.h>
 
index b001c31..b68e308 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
 static int l_level = YLOG_DEFAULT_LEVEL;
 
 enum l_file_type { use_stderr, use_none, use_file };
-static enum l_file_type yaz_file_type = use_stderr;
-static FILE *yaz_global_log_file = NULL;
+
+struct {
+    enum l_file_type type;
+    FILE *log_file;
+    char l_prefix[512];
+    char l_prefix2[512];
+    char l_fname[512];
+} yaz_log_info = {
+    use_stderr, 0, "", "", ""
+};
 
 static void (*start_hook_func)(int, const char *, void *) = NULL;
 static void *start_hook_info;
@@ -48,11 +56,6 @@ static void *end_hook_info;
 static void (*hook_func)(int, const char *, void *) = NULL;
 static void *hook_info;
 
-static char l_prefix[512] = "";
-static char l_prefix2[512] = "";
-static char l_fname[512] = "";
-
-
 static char l_old_default_format[] = "%H:%M:%S-%d/%m";
 static char l_new_default_format[] = "%Y%m%d-%H%M%S";
 #define TIMEFORMAT_LEN 50
@@ -114,21 +117,21 @@ static void internal_log_init(void)
 FILE *yaz_log_file(void)
 {
     FILE *f = 0;
-    switch(yaz_file_type)
+    switch (yaz_log_info.type)
     {
         case use_stderr: f = stderr; break;
         case use_none: f = 0; break;
-        case use_file: f = yaz_global_log_file; break;
+        case use_file: f = yaz_log_info.log_file; break;
     }
     return f;
 }
 
 void yaz_log_close(void)
 {
-    if (yaz_file_type == use_file && yaz_global_log_file)
+    if (yaz_log_info.type == use_file && yaz_log_info.log_file)
     {
-        fclose(yaz_global_log_file);
-        yaz_global_log_file = 0;
+        fclose(yaz_log_info.log_file);
+        yaz_log_info.log_file = 0;
     }
 }
 
@@ -140,16 +143,16 @@ void yaz_log_init_file(const char *fname)
     if (fname)
     {
         if (*fname == '\0')
-            yaz_file_type = use_stderr; /* empty name; use stderr */
+            yaz_log_info.type = use_stderr; /* empty name; use stderr */
         else
-            yaz_file_type = use_file;
-        strncpy(l_fname, fname, sizeof(l_fname)-1);
-        l_fname[sizeof(l_fname)-1] = '\0';
+            yaz_log_info.type = use_file;
+        strncpy(yaz_log_info.l_fname, fname, sizeof(yaz_log_info.l_fname)-1);
+        yaz_log_info.l_fname[sizeof(yaz_log_info.l_fname)-1] = '\0';
     }
     else
     {
-        yaz_file_type = use_none;  /* NULL name; use no file at all */
-        l_fname[0] = '\0'; 
+        yaz_log_info.type = use_none;  /* NULL name; use no file at all */
+        yaz_log_info.l_fname[0] = '\0'; 
     }
     yaz_log_reopen();
 }
@@ -230,17 +233,19 @@ void yaz_log_init_level(int level)
 void yaz_log_init_prefix(const char *prefix)
 {
     if (prefix && *prefix)
-        yaz_snprintf(l_prefix, sizeof(l_prefix), "%s ", prefix);
+        yaz_snprintf(yaz_log_info.l_prefix,
+                     sizeof(yaz_log_info.l_prefix), "%s ", prefix);
     else
-        *l_prefix = 0;
+        *yaz_log_info.l_prefix = 0;
 }
 
 void yaz_log_init_prefix2(const char *prefix)
 {
     if (prefix && *prefix)
-        yaz_snprintf(l_prefix2, sizeof(l_prefix2), "%s ", prefix);
+        yaz_snprintf(yaz_log_info.l_prefix2,
+                     sizeof(yaz_log_info.l_prefix2), "%s ", prefix);
     else
-        *l_prefix2 = 0;
+        *yaz_log_info.l_prefix2 = 0;
 }
 
 void yaz_log_init(int level, const char *prefix, const char *fname)
@@ -283,12 +288,13 @@ static void yaz_log_open_check(struct tm *tm, int force, const char *filemode)
     char new_filename[512];
     static char cur_filename[512] = "";
 
-    if (yaz_file_type != use_file)
+    if (yaz_log_info.type != use_file)
         return;
 
-    if (*l_fname)
+    if (*yaz_log_info.l_fname)
     {
-        strftime(new_filename, sizeof(new_filename)-1, l_fname, tm);
+        strftime(new_filename, sizeof(new_filename)-1, yaz_log_info.l_fname,
+                 tm);
         if (strcmp(new_filename, cur_filename))
         {
             strcpy(cur_filename, new_filename);
@@ -296,9 +302,9 @@ static void yaz_log_open_check(struct tm *tm, int force, const char *filemode)
         }
     }
 
-    if (l_max_size > 0 && yaz_global_log_file)
+    if (l_max_size > 0 && yaz_log_info.log_file)
     {
-        long flen = ftell(yaz_global_log_file);
+        long flen = ftell(yaz_log_info.log_file);
         if (flen > l_max_size)
         {
             rotate_log(cur_filename);
@@ -315,9 +321,9 @@ static void yaz_log_open_check(struct tm *tm, int force, const char *filemode)
         if (new_file)
         {
             yaz_log_close();
-            yaz_global_log_file = new_file;
+            yaz_log_info.log_file = new_file;
             if (l_level & YLOG_FLUSH)
-                setvbuf(yaz_global_log_file, 0, _IONBF, 0);
+                setvbuf(yaz_log_info.log_file, 0, _IONBF, 0);
         }
         else
         {
@@ -424,7 +430,8 @@ static void yaz_log_to_file(int level, const char *log_message)
                 strcat(tid, " ");
         }
 
-        fprintf(file, "%s%s%s%s %s%s\n", tbuf, l_prefix, tid, flags, l_prefix2,
+        fprintf(file, "%s%s%s%s %s%s\n", tbuf, yaz_log_info.l_prefix,
+                tid, flags, yaz_log_info.l_prefix2,
                 log_message);
         if (l_level & YLOG_FLUSH)
             fflush(file);
index e70db5f..56dc01a 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file logrpn.c
  * \brief Implements Z39.50 Query Printing
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <assert.h>
index dcae48c..dd20fc8 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index eefeb84..82f455f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 6b3e3dd..a81e8c4 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index d9b16c6..0ef545e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index f498139..8fe4a2e 100644 (file)
@@ -1,13 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file
  * \brief Glob expression match
  */
-
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <stdlib.h>
index 88e0e5b..15296cc 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 84dc96a..88dee67 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 6ab6cac..d05c21e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 783f119..21c61b9 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index c4f6d5b..2ed3afc 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index a68ab6d..bca3366 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index f27f814..3c1c4e1 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 4ab7f55..03615a3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 7e376c1..0896859 100644 (file)
--- a/src/odr.c
+++ b/src/odr.c
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index e8449ec..6f203b9 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index d046bf8..9a9d51d 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 0763253..62354cb 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 941476f..6121a57 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 18b346b..db649ac 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 69bbef4..caf83f3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index d8a3757..bd8a59d 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 9972c10..8dce213 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index e15d51d..ae62565 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index c5cc823..26ce001 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 085c852..ec6d932 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index a7a819f..c57172a 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index d5f96af..b62fef1 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index acb2c32..4faed2f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 8cd47d5..238f1be 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 7d9f103..5d9297e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 7cf02db..58c3a35 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 314a0d9..fd35d0f 100644 (file)
@@ -109,6 +109,10 @@ proc oid_to_c {srcdir input cname hname} {
     puts $hfile "\#ifndef OID_STD_H"
     puts $hfile "\#define OID_STD_H"
 
+    puts $cfile "\#if HAVE_CONFIG_H"
+    puts $cfile "\#include <config.h>"
+    puts $cfile "\#endif"
+
     puts $cfile "\#include <yaz/oid_db.h>"
     puts $cfile ""
     # To avoid LNK4049
index c596f65..735d969 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file opacdisp.c
  * \brief Implements OPAC record display
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
 #include <yaz/proto.h>
 #include <yaz/marcdisp.h>
 
-static void opac_element_str(WRBUF wrbuf, yaz_iconv_t cd, 
+static void opac_element_str(WRBUF wrbuf, yaz_iconv_t cd1, yaz_iconv_t cd2,
                              int l, const char *elem,
                              const char *data)
 {
     if (data)
     {
+        size_t pos;
         while (--l >= 0)
             wrbuf_puts(wrbuf, " ");
         wrbuf_puts(wrbuf, "<");
         wrbuf_puts(wrbuf, elem);
         wrbuf_puts(wrbuf, ">");
-        wrbuf_iconv_puts_cdata(wrbuf, cd, data);
+        
+        pos = wrbuf->pos; /* save position */
+        if (wrbuf_iconv_write_x(wrbuf, cd1, data, strlen(data), 1) && cd2)
+        {
+            wrbuf->pos = pos; /* rewind to pos */
+            wrbuf_iconv_write_x(wrbuf, cd2, data, strlen(data), 1);
+        }
         wrbuf_puts(wrbuf, "</");
         wrbuf_puts(wrbuf, elem);
         wrbuf_puts(wrbuf, ">\n");
@@ -49,10 +59,11 @@ 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 cd2)
 {
     int i;
-    yaz_iconv_t cd = yaz_marc_get_iconv(mt);
+    yaz_iconv_t cd1 = yaz_marc_get_iconv(mt);
 
     wrbuf_puts(wrbuf, "<opacRecord>\n");
     if (r->bibliographicRecord)
@@ -89,35 +100,50 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf)
             
             Z_HoldingsAndCircData *d = h->u.holdingsAndCirc;
         
-            opac_element_str(wrbuf, cd, 2, "typeOfRecord", d->typeOfRecord);
-            opac_element_str(wrbuf, cd, 2, "encodingLevel", d->encodingLevel);
-            opac_element_str(wrbuf, cd, 2, "format", d->format);
-            opac_element_str(wrbuf, cd, 2, "receiptAcqStatus", d->receiptAcqStatus);
-            opac_element_str(wrbuf, cd, 2, "generalRetention", d->generalRetention);
-            opac_element_str(wrbuf, cd, 2, "completeness", d->completeness);
-            opac_element_str(wrbuf, cd, 2, "dateOfReport", d->dateOfReport);
-            opac_element_str(wrbuf, cd, 2, "nucCode", d->nucCode);
-            opac_element_str(wrbuf, cd, 2, "localLocation", d->localLocation);
-            opac_element_str(wrbuf, cd, 2, "shelvingLocation", d->shelvingLocation);
-            opac_element_str(wrbuf, cd, 2, "callNumber", d->callNumber);
-            opac_element_str(wrbuf, cd, 2, "shelvingData", d->shelvingData);
-            
-            opac_element_str(wrbuf, cd, 2, "copyNumber", d->copyNumber);
-            opac_element_str(wrbuf, cd, 2, "publicNote", d->publicNote);
-            opac_element_str(wrbuf, cd, 2, "reproductionNote", d->reproductionNote);
-            opac_element_str(wrbuf, cd, 2, "termsUseRepro", d->termsUseRepro);
-            opac_element_str(wrbuf, cd, 2, "enumAndChron", d->enumAndChron);
+            opac_element_str(wrbuf, cd1, cd2, 2, "typeOfRecord",
+                             d->typeOfRecord);
+            opac_element_str(wrbuf, cd1, cd2, 2, "encodingLevel",
+                             d->encodingLevel);
+            opac_element_str(wrbuf, cd1, cd2, 2, "format",
+                             d->format);
+            opac_element_str(wrbuf, cd1, cd2, 2, "receiptAcqStatus",
+                             d->receiptAcqStatus);
+            opac_element_str(wrbuf, cd1, cd2, 2, "generalRetention",
+                             d->generalRetention);
+            opac_element_str(wrbuf, cd1, cd2, 2, "completeness",
+                             d->completeness);
+            opac_element_str(wrbuf, cd1, cd2, 2, "dateOfReport",
+                             d->dateOfReport);
+            opac_element_str(wrbuf, cd1, cd2, 2, "nucCode", d->nucCode);
+            opac_element_str(wrbuf, cd1, cd2, 2, "localLocation",
+                             d->localLocation);
+            opac_element_str(wrbuf, cd1, cd2, 2, "shelvingLocation",
+                             d->shelvingLocation);
+            opac_element_str(wrbuf, cd1, cd2, 2, "callNumber",
+                             d->callNumber);
+            opac_element_str(wrbuf, cd1, cd2, 2, "shelvingData",
+                             d->shelvingData);
+            opac_element_str(wrbuf, cd1, cd2, 2, "copyNumber",
+                             d->copyNumber);
+            opac_element_str(wrbuf, cd1, cd2, 2, "publicNote",
+                             d->publicNote);
+            opac_element_str(wrbuf, cd1, cd2, 2, "reproductionNote",
+                             d->reproductionNote);
+            opac_element_str(wrbuf, cd1, cd2, 2, "termsUseRepro",
+                             d->termsUseRepro);
+            opac_element_str(wrbuf, cd1, cd2, 2, "enumAndChron",
+                             d->enumAndChron);
             if (d->num_volumes)
             {
                 wrbuf_puts (wrbuf, "  <volumes>\n");
                 for (j = 0; j<d->num_volumes; j++)
                 {
                     wrbuf_puts (wrbuf, "   <volume>\n");
-                    opac_element_str(wrbuf, cd, 4, "enumeration",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "enumeration",
                                      d->volumes[j]->enumeration);
-                    opac_element_str(wrbuf, cd, 4, "chronology",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "chronology",
                                      d->volumes[j]->chronology);
-                    opac_element_str(wrbuf, cd, 4, "enumAndChron",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "enumAndChron",
                                      d->volumes[j]->enumAndChron);
                     wrbuf_puts(wrbuf, "   </volume>\n");
                 }
@@ -131,23 +157,23 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf)
                     wrbuf_puts(wrbuf,"   <circulation>\n");
                     opac_element_bool(wrbuf, 4, "availableNow",
                                       d->circulationData[j]->availableNow);
-                    opac_element_str(wrbuf, cd, 4, "availabiltyDate",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "availabiltyDate",
                                      d->circulationData[j]->availablityDate);
-                    opac_element_str(wrbuf, cd, 4, "availableThru",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "availableThru",
                                       d->circulationData[j]->availableThru);
-                    opac_element_str(wrbuf, cd, 4, "restrictions",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "restrictions",
                                       d->circulationData[j]->restrictions);
-                    opac_element_str(wrbuf, cd, 4, "itemId",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "itemId",
                                       d->circulationData[j]->itemId);
                     opac_element_bool(wrbuf, 4, "renewable",
                                       d->circulationData[j]->renewable);
                     opac_element_bool(wrbuf, 4, "onHold",
                                       d->circulationData[j]->onHold);
-                    opac_element_str(wrbuf, cd, 4, "enumAndChron",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "enumAndChron",
                                       d->circulationData[j]->enumAndChron);
-                    opac_element_str(wrbuf, cd, 4, "midspine",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "midspine",
                                       d->circulationData[j]->midspine);
-                    opac_element_str(wrbuf, cd, 4, "temporaryLocation",
+                    opac_element_str(wrbuf, cd1, cd2, 4, "temporaryLocation",
                                       d->circulationData[j]->temporaryLocation);
                     wrbuf_puts(wrbuf, "   </circulation>\n");
                 }
@@ -160,6 +186,11 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf)
     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, 0);
+}
+
 /*
  * Local variables:
  * c-basic-offset: 4
index 7f6374c..4d92e13 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 80cb19d..12be129 100644 (file)
@@ -1,11 +1,15 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file otherinfo.c
  * \brief Implements Z39.50 OtherInfo utilities
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <string.h>
 
index 08e5d46..66c7bc8 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file 
  * \brief Select, poll wrapper
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <string.h>
index 65dcdd1..1a45b40 100644 (file)
@@ -1,11 +1,15 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file pquery.c
  * \brief Implements PQF parsing
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index ccd2999..aad4cc7 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file prt-ext.c
  * \brief Implements handling of various Z39.50 Externals
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/proto.h>
 
index fed4ba5..e8dda49 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file query-charset.c
     \brief converts General Terms in RPN queries
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <assert.h>
index 3caf21b..7343fb7 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file querytowrbuf.c
     \brief Convert Z39.50 Z_Query to PQF (as WRBUF string)
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <assert.h>
index 688a433..7a9c282 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 9da5a44..c644c7d 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index d4180dd..ddfd391 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file record_render.c
  * \brief Render Z39.50 records (NamePlusRecord)
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <string.h>
 #include <yaz/proto.h>
 #include <yaz/oid_db.h>
 
-static yaz_iconv_t iconv_create_charset(const char *record_charset)
+static yaz_iconv_t iconv_create_charset(const char *record_charset,
+                                        yaz_iconv_t *cd2)
 {
-    char to[40];
-    char from[40];
+    char charset_buf[40];
     yaz_iconv_t cd = 0;
-
-    *from = '\0';
-    strcpy(to, "UTF-8");
+    char *from_set1 = 0;
+    char *from_set2 = 0;
+    char *to_set = 0;
     if (record_charset && *record_charset)
     {
-        /* Use "from,to" or just "from" */
-        const char *cp = strchr(record_charset, ',');
-        size_t clen = strlen(record_charset);
-        if (cp && cp[1])
+        char *cp = charset_buf;
+        
+        strncpy(charset_buf, record_charset, sizeof(charset_buf)-1);
+        charset_buf[sizeof(charset_buf)-1] = '\0';
+        
+        from_set1 = cp;
+        while (*cp && *cp != ',' && *cp != '/')
+            cp++;
+        if (*cp == '/')
         {
-            strncpy( to, cp+1, sizeof(to)-1);
-            to[sizeof(to)-1] = '\0';
-            clen = cp - record_charset;
+            *cp++ = '\0'; /* terminate from_set1 */
+            from_set2 = cp;
+            while (*cp && *cp != ',')
+                cp++;
+        }
+        if (*cp == ',')
+        {
+            *cp++ = '\0';  /* terminate from_set1 or from_set2 */
+            to_set = cp;
+            while (*cp)
+                cp++;
         }
-        if (clen > sizeof(from)-1)
-            clen = sizeof(from)-1;
-        
-        if (clen)
-            strncpy(from, record_charset, clen);
-        from[clen] = '\0';
     }
-    if (*from && *to)
-        cd = yaz_iconv_open(to, from);
+    
+    if (from_set1)
+        cd = yaz_iconv_open(to_set ? to_set : "UTF-8", from_set1);
+    if (cd2)
+    {
+        if (from_set2)
+            *cd2 = yaz_iconv_open(to_set ? to_set : "UTF-8", from_set2);
+        else
+            *cd2 = 0;
+    }
     return cd;
 }
 
@@ -54,7 +72,7 @@ static const char *return_marc_record(WRBUF wrbuf,
                                       const char *buf, int sz,
                                       const char *record_charset)
 {
-    yaz_iconv_t cd = iconv_create_charset(record_charset);
+    yaz_iconv_t cd = iconv_create_charset(record_charset, 0);
     yaz_marc_t mt = yaz_marc_create();
     const char *ret_string = 0;
 
@@ -79,18 +97,25 @@ static const char *return_opac_record(WRBUF wrbuf,
                                       Z_OPACRecord *opac_rec,
                                       const char *record_charset)
 {
-    yaz_iconv_t cd = iconv_create_charset(record_charset);
+    yaz_iconv_t cd2;
+    yaz_iconv_t cd = iconv_create_charset(record_charset, &cd2);
     yaz_marc_t mt = yaz_marc_create();
 
     if (cd)
         yaz_marc_iconv(mt, cd);
     yaz_marc_xml(mt, marc_type);
 
-    yaz_opac_decode_wrbuf(mt, opac_rec, wrbuf);
+    if (cd2)
+        yaz_opac_decode_wrbuf2(mt, opac_rec, wrbuf, cd2);
+    else
+        yaz_opac_decode_wrbuf(mt, opac_rec, wrbuf);
+        
     yaz_marc_destroy(mt);
 
     if (cd)
         yaz_iconv_close(cd);
+    if (cd2)
+        yaz_iconv_close(cd2);
     if (len)
         *len = wrbuf_len(wrbuf);
     return wrbuf_cstr(wrbuf);
@@ -101,7 +126,7 @@ static const char *return_string_record(WRBUF wrbuf,
                                         const char *buf, int sz,
                                         const char *record_charset)
 {
-    yaz_iconv_t cd = iconv_create_charset(record_charset);
+    yaz_iconv_t cd = iconv_create_charset(record_charset, 0);
 
     if (cd)
     {
index 2c93d92..41517d9 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
@@ -9,6 +9,9 @@
  * We also use the request-freelist to store encoding buffers, rather than
  * freeing and xmalloc'ing them on each cycle.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 
index 4923e64..f60e231 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 68b359a..ea21793 100644 (file)
@@ -1,13 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file
  * \brief Implements RPN to CQL conversion
- *
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <stdlib.h>
index de485ab..6390ebb 100644 (file)
@@ -1,13 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file
  * \brief Implements RPN to SOLR conversion
- *
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <stdlib.h>
index 4014471..ef5d097 100644 (file)
--- a/src/sc.c
+++ b/src/sc.c
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file sc.c
  * \brief Windows Service Control
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifdef WIN32
 #include <windows.h>
index e06a6ba..8da30a1 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file sc_test.c
  * \brief Small test for the Windows Service Control utility
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifdef WIN32
 #include <windows.h>
index 378b130..0a3f9fa 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
@@ -25,6 +25,9 @@
  * minimize memory allocation/deallocation during normal operation.
  *
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <limits.h>
 #include <stdlib.h>
@@ -224,10 +227,6 @@ void destroy_association(association *h)
     request_delq(&h->outgoing);
     xfree(h);
     xmalloc_trav("session closed");
-    if (cb && cb->one_shot)
-    {
-        exit(0);
-    }
 }
 
 static void do_close_req(association *a, int reason, char *message,
@@ -2502,6 +2501,7 @@ static Z_Records *pack_records(association *a, char *setname, Odr_int start,
         }
         if (freq.record == 0)  /* no error and no record ? */
         {
+            *pres = Z_PresentStatus_partial_4;
             *next = 0;   /* signal end-of-set and stop */
             break;
         }
index c66676f..34f1ddb 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 6e061d8..6a2618c 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 2aedb83..1c157f4 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file snprintf.c
  * \brief snprintf wrapper
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdarg.h>
index 59930d2..7f22cf3 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
@@ -9,6 +9,9 @@
  * This implements encoding and decoding of SOAP packages using
  * Libxml2.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/soap.h>
 
index 55a86ca..569125b 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
- * \file srwutil.c
- * \brief Implements SRW/SRU utilities.
+ * \file solr.c
+ * \brief Implements SOAP Webservice decoding/encoding
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <assert.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
-const char *xml_node_attribute_value_get(xmlNodePtr ptr, const char *node_name, const char *attribute_name) {
-
-    struct _xmlAttr *attr;
-    // check if the node name matches
-    if (strcmp((const char*) ptr->name, node_name))
-        return 0;
-    // check if the attribute name and return the value
-    for (attr = ptr->properties; attr; attr = attr->next)
-        if (attr->children && attr->children->type == XML_TEXT_NODE) {
-            if (!strcmp((const char *) attr->name, attribute_name))
-                return (const char *) attr->children->content;
-        }
-    return 0;
-}
-
-
 static int match_xml_node_attribute(xmlNodePtr ptr, const char *node_name, const char *attribute_name, const char *value)
 {
     const char *attribute_value;
     // check if the node name matches
     if (strcmp((const char*) ptr->name, node_name))
         return 0;
-    attribute_value = xml_node_attribute_value_get(ptr, node_name, attribute_name);
-    if (attribute_value && !strcmp(attribute_value, value))
+    if (attribute_name) {
+        attribute_value = yaz_element_attribute_value_get(ptr, node_name, attribute_name);
+        if (attribute_value && !strcmp(attribute_value, value))
+            return 1;
+    }
+    else /* No attribute to check */
         return 1;
     return 0;
 }
@@ -114,38 +105,9 @@ static int  yaz_solr_decode_result(ODR o, xmlNodePtr ptr, Z_SRW_searchRetrieveRe
     return -1;
 }
 
-static Z_AttributeList *yaz_solr_use_atttribute_create(ODR o, const char *name) {
-    Z_AttributeList *attributes= (Z_AttributeList *) odr_malloc(o, sizeof(*attributes));
-    Z_AttributeElement ** elements;
-    attributes->num_attributes = 1;
-    /* TODO check on name instead
-    if (!attributes->num_attributes) {
-        attributes->attributes = (Z_AttributeElement**)odr_nullval();
-        return attributes;
-    }
-    */
-    elements = (Z_AttributeElement**) odr_malloc (o, attributes->num_attributes * sizeof(*elements));
-    elements[0] = (Z_AttributeElement*)odr_malloc(o,sizeof(**elements));
-    elements[0]->attributeType = odr_malloc(o, sizeof(*elements[0]->attributeType));
-   *elements[0]->attributeType = 1;
-    elements[0]->attributeSet = odr_nullval();
-    elements[0]->which = Z_AttributeValue_complex;
-    elements[0]->value.complex = (Z_ComplexAttribute *) odr_malloc(o, sizeof(Z_ComplexAttribute));
-    elements[0]->value.complex->num_list = 1;
-    elements[0]->value.complex->list = (Z_StringOrNumeric **) odr_malloc(o, 1 * sizeof(Z_StringOrNumeric *));
-    elements[0]->value.complex->list[0] = (Z_StringOrNumeric *) odr_malloc(o, sizeof(Z_StringOrNumeric));
-    elements[0]->value.complex->list[0]->which = Z_StringOrNumeric_string;
-    elements[0]->value.complex->list[0]->u.string = (Z_InternationalString *) odr_strdup(o, name);
-    elements[0]->value.complex->semanticAction = 0;
-    elements[0]->value.complex->num_semanticAction = 0;
-    attributes->attributes = elements;
-    return attributes;
-}
-
-
 static const char *get_facet_term_count(xmlNodePtr node, int *freq) {
 
-    const char *term = xml_node_attribute_value_get(node, "int", "name");
+    const char *term = yaz_element_attribute_value_get(node, "int", "name");
     xmlNodePtr child;
     WRBUF wrbuf = wrbuf_alloc();
     if (!term)
@@ -169,13 +131,13 @@ Z_FacetField *yaz_solr_decode_facet_field(ODR o, xmlNodePtr ptr, Z_SRW_searchRet
     int index = 0;
     xmlNodePtr node;
     // USE attribute
-    const char* name = xml_node_attribute_value_get(ptr, "lst", "name");
+    const char* name = yaz_element_attribute_value_get(ptr, "lst", "name");
     char *pos = strstr(name, "_exact");
     /* HACK */
     if (pos) {
         pos[0] = 0;
     }
-    list = yaz_solr_use_atttribute_create(o, name);
+    list = yaz_use_atttribute_create(o, name);
     for (node = ptr->children; node; node = node->next) {
         num_terms++;
     }
@@ -257,7 +219,7 @@ int yaz_solr_decode_response(ODR o, Z_HTTP_Response *hres, Z_SRW_PDU **pdup)
                         rc_result = yaz_solr_decode_result(o, ptr, sr);
                 /* TODO The check on hits is a work-around to avoid garbled facets on zero results from the SOLR server.
                  * The work-around works because the results is before the facets in the xml. */
-                if (rc_result == 0 && match_xml_node_attribute(ptr, "lst", "name", "facet_counts"))
+                if (rc_result == 0 &&  *sr->numberOfRecords > 0 && match_xml_node_attribute(ptr, "lst", "name", "facet_counts"))
                     rc_facets =  yaz_solr_decode_facet_counts(o, ptr, sr);
             }
             ret = rc_result + rc_facets;
index 2d41044..d2732e5 100644 (file)
@@ -1,22 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file solrtransform.c
  * \brief Implements SOLR transform (SOLR to RPN conversion).
- *
- * Evaluation order of rules:
- *
- * always
- * relation
- * structure
- * position
- * truncation
- * index
- * relationModifier
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <stdlib.h>
index d469718..c733aad 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file sortspec.c
  * \brief Implements SortSpec parsing.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
index 52c922a..a2ee268 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 7fd57c4..9cd2597 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -34,6 +34,15 @@ void yaz_add_name_value_str(ODR o, char **name, char **value,  int *i,
 
 void yaz_add_name_value_int(ODR o, char **name, char **value, int *i,
                             char *a_name, Odr_int *val);
+
+Z_AttributeList *yaz_use_atttribute_create(ODR o, const char *name);
+
+#if YAZ_HAVE_XML2
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+const char *yaz_element_attribute_value_get(xmlNodePtr ptr, const char *node_name, const char *attribute_name);
+#endif
+
 /*
  * Local variables:
  * c-basic-offset: 4
index 93ff77c..bd3c577 100644 (file)
--- a/src/srw.c
+++ b/src/srw.c
@@ -1,18 +1,26 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file srw.c
  * \brief Implements SRW/SRU package encoding and decoding
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
 
 #include <yaz/srw.h>
+#include <yaz/wrbuf.h>
 #if YAZ_HAVE_XML2
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <assert.h>
 
+#include "sru-p.h"
+
 static void add_XML_n(xmlNodePtr ptr, const char *elem, char *val, int len,
                       xmlNsPtr ns_ptr)
 {
@@ -439,11 +447,91 @@ static int yaz_srw_versions(ODR o, xmlNodePtr pptr,
     return 0;
 }
 
+Z_FacetTerm *yaz_sru_proxy_get_facet_term_count(ODR odr, xmlNodePtr node) {
+
+    int freq;
+    xmlNodePtr child;
+    WRBUF wrbuf = wrbuf_alloc();
+    const char *freq_string = yaz_element_attribute_value_get(node, "facetvalue", "est_representation");
+    Z_Term *term;
+    if (freq_string)
+        freq =  atoi(freq_string);
+    else
+        freq = -1;
+
+    for (child = node->children; child ; child = child->next) {
+        if (child->type == XML_TEXT_NODE)
+        wrbuf_puts(wrbuf, (const char *) child->content);
+    }
+    term = term_create(odr, wrbuf_cstr(wrbuf));
+    yaz_log(YLOG_DEBUG, "sru-proxy facet: %s %d", wrbuf_cstr(wrbuf), freq);
+    wrbuf_destroy(wrbuf);
+    return facet_term_create(odr, term, freq);
+};
+
+static Z_FacetField *yaz_sru_proxy_decode_facet_field(ODR odr, xmlNodePtr ptr) {
+    Z_AttributeList *list;
+    Z_FacetField *facet_field;
+    int num_terms = 0;
+    int index = 0;
+    xmlNodePtr node;
+    // USE attribute
+    const char* name = yaz_element_attribute_value_get(ptr, "facet", "code");
+    yaz_log(YLOG_DEBUG, "sru-proxy facet type: %s", name);
+
+    list = yaz_use_atttribute_create(odr, name);
+    for (node = ptr->children; node; node = node->next) {
+        if (match_element(node, "facetvalue"))
+            num_terms++;
+    }
+    facet_field = facet_field_create(odr, list, num_terms);
+    index = 0;
+    for (node = ptr->children; node; node = node->next) {
+        if (match_element(node, "facetvalue")) {
+            facet_field_term_set(odr, facet_field, yaz_sru_proxy_get_facet_term_count(odr, node), index);
+        index++;
+        }
+    }
+    return facet_field;
+}
+
+static int yaz_sru_proxy_decode_facets(ODR o, xmlNodePtr root, Z_FacetList **facetList)
+{
+    xmlNodePtr ptr;
+
+    for (ptr = root->children; ptr; ptr = ptr->next)
+    {
+        if (match_element(ptr, "facets"))
+        {
+            xmlNodePtr node;
+            Z_FacetList *facet_list;
+            int num_facets = 0;
+            for (node = ptr->children; node; node= node->next)
+            {
+                if (node->type == XML_ELEMENT_NODE)
+                    num_facets++;
+            }
+            facet_list = facet_list_create(o, num_facets);
+            num_facets = 0;
+            for (node = ptr->children; node; node= node->next)
+            {
+                if (match_element(node, "facet")) {
+                    facet_list_field_set(o, facet_list, yaz_sru_proxy_decode_facet_field(o, node), num_facets);
+                    num_facets++;
+                }
+            }
+            *facetList = facet_list;
+            break;
+        }
+    }
+    return 0;
+}
+
+
 
 static int yaz_srw_decode_diagnostics(ODR o, xmlNodePtr pptr,
                                       Z_SRW_diagnostic **recs, int *num,
                                       void *client_data, const char *ns)
-    
 {
     int i;
     xmlNodePtr ptr;
@@ -765,6 +853,8 @@ int yaz_srw_codec(ODR o, void * vptr, Z_SRW_PDU **handler_data,
                     yaz_srw_diagnostics(o, ptr, &res->diagnostics,
                                         &res->num_diagnostics,
                                         client_data, ns);
+                else if (match_element(ptr, "facet_analysis"))
+                    yaz_sru_proxy_decode_facets(o, ptr, &res->facetList);
             }
         }
         else if (!xmlStrcmp(method->name, BAD_CAST "explainRequest"))
index 2746199..353286f 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file srwutil.c
  * \brief Implements SRW/SRU utilities.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <assert.h>
@@ -33,7 +36,51 @@ char *yaz_encode_sru_dbpath_odr(ODR out, const char *db)
     return dst;
 }
 
+Z_AttributeList *yaz_use_atttribute_create(ODR o, const char *name) {
+    Z_AttributeList *attributes= (Z_AttributeList *) odr_malloc(o, sizeof(*attributes));
+    Z_AttributeElement ** elements;
+    attributes->num_attributes = 1;
+    /* TODO check on name instead
+    if (!attributes->num_attributes) {
+        attributes->attributes = (Z_AttributeElement**)odr_nullval();
+        return attributes;
+    }
+    */
+    elements = (Z_AttributeElement**) odr_malloc (o, attributes->num_attributes * sizeof(*elements));
+    elements[0] = (Z_AttributeElement*)odr_malloc(o,sizeof(**elements));
+    elements[0]->attributeType = odr_malloc(o, sizeof(*elements[0]->attributeType));
+   *elements[0]->attributeType = 1;
+    elements[0]->attributeSet = odr_nullval();
+    elements[0]->which = Z_AttributeValue_complex;
+    elements[0]->value.complex = (Z_ComplexAttribute *) odr_malloc(o, sizeof(Z_ComplexAttribute));
+    elements[0]->value.complex->num_list = 1;
+    elements[0]->value.complex->list = (Z_StringOrNumeric **) odr_malloc(o, 1 * sizeof(Z_StringOrNumeric *));
+    elements[0]->value.complex->list[0] = (Z_StringOrNumeric *) odr_malloc(o, sizeof(Z_StringOrNumeric));
+    elements[0]->value.complex->list[0]->which = Z_StringOrNumeric_string;
+    elements[0]->value.complex->list[0]->u.string = (Z_InternationalString *) odr_strdup(o, name);
+    elements[0]->value.complex->semanticAction = 0;
+    elements[0]->value.complex->num_semanticAction = 0;
+    attributes->attributes = elements;
+    return attributes;
+}
+
 #if YAZ_HAVE_XML2
+const char *yaz_element_attribute_value_get(xmlNodePtr ptr, const char *node_name, const char *attribute_name) {
+
+    struct _xmlAttr *attr;
+    // check if the node name matches
+    if (strcmp((const char*) ptr->name, node_name))
+        return 0;
+    // check if the attribute name and return the value
+    for (attr = ptr->properties; attr; attr = attr->next)
+        if (attr->children && attr->children->type == XML_TEXT_NODE) {
+            if (!strcmp((const char *) attr->name, attribute_name))
+                return (const char *) attr->children->content;
+        }
+    return 0;
+}
+
+
 static int yaz_base64decode(const char *in, char *out)
 {
     const char *map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -1190,6 +1237,7 @@ int yaz_sru_get_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu,
         odr_malloc(encode, strlen(hreq->path) + strlen(uri_args) + 4);
 
     sprintf(path, "%s?%s", hreq->path, uri_args);
+    yaz_log(YLOG_DEBUG, "SRU HTTP Get Request %s", path);
     hreq->path = path;
 
     z_HTTP_header_add_content_type(encode, &hreq->headers,
index d340a17..7560058 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
@@ -8,6 +8,10 @@
  * \brief Implements GFS logic
  */
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -606,6 +610,8 @@ static void xml_config_bend_stop(void)
     }
 }
 
+static void remove_listeners(void);
+
 /*
  * handle incoming connect requests.
  * The dynamic mode is a bit tricky mostly because we want to avoid
@@ -905,6 +911,9 @@ static void listener(IOCHAN h, int event)
             return;
         }
 
+        if (control_block.one_shot)
+            remove_listeners();
+
         yaz_log(log_sessiondetail, "Connect from %s", cs_addrstr(new_line));
 
         no_sessions++;
@@ -1125,6 +1134,13 @@ static int add_listener(char *where, int listen_id)
     return 0; /* OK */
 }
 
+static void remove_listeners(void)
+{
+    IOCHAN l = pListener;
+    for (; l; l = l->next)
+        iochan_destroy(l);
+}
+
 #ifndef WIN32
 /* UNIX only (for windows we don't need to catch the signals) */
 static void catchchld(int num)
diff --git a/src/stemmer.c b/src/stemmer.c
new file mode 100644 (file)
index 0000000..7ee2633
--- /dev/null
@@ -0,0 +1,127 @@
+
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if YAZ_HAVE_ICU
+
+#include <yaz/yconfig.h>
+
+#include <yaz/stemmer.h>
+
+#include <yaz/xmalloc.h>
+
+#include <libstemmer.h>
+
+#include <unicode/ustring.h>  /* some more string fcns*/
+#include <unicode/uchar.h>    /* char names           */
+
+enum stemmer_implementation {
+    yaz_no_operation,
+    yaz_snowball
+};
+struct yaz_stemmer_t
+{
+    int implementation;
+    // Required for cloning.
+    char *locale;
+    char *rule;
+    struct sb_stemmer *sb_stemmer;
+};
+
+const char* yaz_stemmer_lookup_charenc(const char *charenc, const char *rule) {
+    return "UTF_8";
+}
+
+const char* yaz_stemmer_lookup_algorithm(const char *locale, const char *rule) {
+    return locale;
+}
+
+yaz_stemmer_p yaz_stemmer_snowball_create(const char *locale, const char *rule, UErrorCode *status) {
+    const char *charenc = yaz_stemmer_lookup_charenc(locale, rule);
+    const char *algorithm = yaz_stemmer_lookup_algorithm(locale,rule);
+    struct sb_stemmer *stemmer = sb_stemmer_new(algorithm, charenc);
+    yaz_stemmer_p yaz_stemmer;
+    if (stemmer == 0) {
+        *status = U_ILLEGAL_ARGUMENT_ERROR;
+        yaz_log(YLOG_FATAL, "yaz_stemmer: Failed to create snowball stemmer from locale %srule %s. Showball: charenc %s algorithm %s ", 
+               locale, rule, charenc, algorithm);
+       return 0;
+    }
+    yaz_log(YLOG_DEBUG, "created snowball stemmer: algoritm %s charenc %s ", algorithm, charenc);
+    yaz_stemmer = xmalloc(sizeof(*yaz_stemmer));
+    yaz_stemmer->implementation = yaz_snowball;
+      
+    yaz_stemmer->locale = xstrdup(locale);
+    yaz_stemmer->rule = xstrdup(rule);
+    yaz_stemmer->sb_stemmer = stemmer;
+    yaz_log(YLOG_DEBUG, "created snowball stemmer: algoritm %s charenc %s ", algorithm, charenc);
+    return yaz_stemmer;
+}
+
+yaz_stemmer_p yaz_stemmer_create(const char *locale, const char *rule, UErrorCode *status) {
+    *status = U_ZERO_ERROR;
+    // dispatch logic required if more algorithms is implemented.
+    yaz_log(YLOG_DEBUG, "create stemmer: locale %s rule %s ", locale, rule);
+    return yaz_stemmer_snowball_create(locale, rule, status);
+}
+
+yaz_stemmer_p yaz_stemmer_clone(yaz_stemmer_p stemmer) {
+    UErrorCode error = U_ZERO_ERROR;
+    if (stemmer == 0)
+      return 0;
+    return yaz_stemmer_create(stemmer->locale, stemmer->rule, &error);
+}
+
+void yaz_stemmer_stem(yaz_stemmer_p stemmer, struct icu_buf_utf16 *dst, struct icu_buf_utf16* src, UErrorCode *status)
+{
+    switch(stemmer->implementation) {
+        case yaz_snowball: {
+            struct icu_buf_utf8 *utf8_buf = icu_buf_utf8_create(0);
+            icu_utf16_to_utf8(utf8_buf, src, status);
+            if (*status == U_ZERO_ERROR) {
+                const sb_symbol *cstr = (const sb_symbol*) icu_buf_utf8_to_cstr(utf8_buf);
+                const sb_symbol *sb_symbol = sb_stemmer_stem(stemmer->sb_stemmer, cstr, utf8_buf->utf8_len);
+                if (sb_symbol == 0) {
+                    icu_buf_utf16_copy(dst, src);
+                }
+                else {
+
+                    const char *cstr2 = (const char *) sb_symbol;
+                    icu_utf16_from_utf8_cstr(dst, cstr2 , status);
+#if 0            
+                   yaz_log(YLOG_DEBUG, "stemming %s to %s ", cstr, cstr2);
+#endif
+                }
+            }
+            icu_buf_utf8_destroy(utf8_buf);
+            return ;
+            break;
+        }
+    case yaz_no_operation:
+      yaz_log(YLOG_DEBUG, "Stemmer (No operation) called");
+    default: {
+            // Default return the same as given.
+            icu_buf_utf16_copy(dst, src);
+        }
+    }
+}
+
+void yaz_stemmer_destroy(yaz_stemmer_p stemmer) 
+{
+  /* Handle no stemmer correctly */
+  if (stemmer == 0)
+    return ;
+
+  switch (stemmer->implementation) {
+  case yaz_snowball:
+    sb_stemmer_delete(stemmer->sb_stemmer);
+    break;
+  }
+  xfree(stemmer->locale);
+  xfree(stemmer->rule);
+  xfree(stemmer);
+}
+
+#endif /* YAZ_HAVE_ICU */
index 24bf471..26acb8e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
@@ -7,6 +7,10 @@
  * \brief Implements TCP WRAPPER check.
  */
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <string.h>
 
index d72bc44..8ffa3ab 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file tcpip.c
  * \brief Implements TCP/IP + SSL COMSTACK.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
@@ -363,6 +366,13 @@ struct addrinfo *tcpip_getaddrinfo(const char *str, const char *port)
     if (!strcmp("@", host))
     {
         hints.ai_flags = AI_PASSIVE;
+        hints.ai_family = AF_INET;
+        error = getaddrinfo(0, port, &hints, &res);
+    }
+    else if (!strcmp("@6", host))
+    {
+        hints.ai_flags = AI_PASSIVE;
+        hints.ai_family = AF_INET6;
         error = getaddrinfo(0, port, &hints, &res);
     }
     else
@@ -434,25 +444,11 @@ void *tcpip_straddr(COMSTACK h, const char *str)
     if (sp->ai && h->state == CS_ST_UNBND)
     {
         int s = -1;
-        /* try to make IPV6 socket first */
         for (ai = sp->ai; ai; ai = ai->ai_next)
         {
-            if (ai->ai_family == AF_INET6)
-            {
-                s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
-                if (s != -1)
-                    break;
-            }
-        }
-        if (s == -1)
-        {
-            /* no IPV6 could be made.. Try them all */
-            for (ai = sp->ai; ai; ai = ai->ai_next)
-            {
-                s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
-                if (s != -1)
-                    break;
-            }
+            s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+            if (s != -1)
+                break;
         }
         if (s == -1)
             return 0;
index e4c226c..8fa3ac4 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 16be9c5..e61d48b 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index db38a1b..57f1aa7 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 9c10358..352c03d 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index cf76c89..108de00 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file tokenizer.c
  * \brief Simple tokenizer system.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <stdio.h>
index c743a60..67b823a 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 557799f..1b10e30 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index 8006a61..ea8d0cc 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file unix.c
  * \brief Implements UNIX domain socket COMSTACK
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #ifndef WIN32
 
index cb4fc25..987b121 100644 (file)
--- a/src/uri.c
+++ b/src/uri.c
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
- * \file srwutil.c
- * \brief Implements SRW/SRU utilities.
+ * \file uri.c
+ * \brief Implements URI utilities.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <yaz/srw.h>
index 31e7e3b..ea1a5b0 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index c372c5b..1b8c57d 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 9e44ab2..8df2c02 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file waislen.c
  * \brief Implements WAIS package handling
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <yaz/comstack.h>
index 31729b0..06e49de 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
@@ -152,9 +152,10 @@ void wrbuf_printf(WRBUF b, const char *fmt, ...)
     va_end(ap);
 }
 
-static void wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf,
-                                size_t size, int cdata)
+int wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf,
+                        size_t size, int cdata)
 {
+    int ret = 0;
     if (cd)
     {
         char outbuf[128];
@@ -170,7 +171,10 @@ static void wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf,
             {
                 int e = yaz_iconv_error(cd);
                 if (e != YAZ_ICONV_E2BIG)
+                {
+                    ret = -1;
                     break;
+                }
             }
             if (cdata)
                 wrbuf_xmlputs_n(b, outbuf, outp - outbuf);
@@ -185,6 +189,7 @@ static void wrbuf_iconv_write_x(WRBUF b, yaz_iconv_t cd, const char *buf,
         else
             wrbuf_write(b, buf, size);
     }
+    return ret;
 }
 
 void wrbuf_iconv_write(WRBUF b, yaz_iconv_t cd, const char *buf, size_t size)
index 32fde13..1b15aa2 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file xcqlutil.c
  * \brief Implements CQL to XCQL conversion.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <string.h>
index 179b143..3c28abe 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
index c0d2f0b..1e64b54 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 26b5840..27bbb5c 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file
     \brief Log XML / XSLT Errors via yaz_log
 */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
index e4d287e..7a94d44 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file xmlquery.c
     \brief Query / XML conversions
 */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
index 4bffebe..ddac41d 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file yaz-ccl.c
  * \brief Implements CCL node tree to RPN converson.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
index d414406..182f201 100644 (file)
@@ -1,12 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /**
  * \file zgdu.c
  * \brief Implements HTTP and Z39.50 encoding and decoding.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <string.h>
 #include <yaz/odr.h>
index 03066a8..5e9af9c 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file zget.c
  * \brief Implements Z39.50 package creator utilities
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/proto.h>
 #include <yaz/oid_db.h>
index d557015..c3aa0ed 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file zoom-c.c
  * \brief Implements ZOOM C interface.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <string.h>
@@ -37,6 +40,7 @@ static zoom_ret do_write_ex(ZOOM_connection c, char *buf_out, int len_out);
 static void initlog(void)
 {
     static int log_level_initialized = 0;
+
     if (!log_level_initialized)
     {
         log_api0 = yaz_log_module_level("zoom");
@@ -606,6 +610,27 @@ void ZOOM_resultset_addref(ZOOM_resultset r)
     }
 }
 
+static int g_resultsets = 0;
+static YAZ_MUTEX g_resultset_mutex = 0;
+
+/* TODO We need to initialize this before running threaded:
+ * call resultset_use(0)  */
+
+static int resultset_use(int delta) {
+    int resultset_count;
+    if (g_resultset_mutex == 0)
+        yaz_mutex_create(&g_resultset_mutex);
+    yaz_mutex_enter(g_resultset_mutex);
+    g_resultsets += delta;
+    resultset_count = g_resultsets;
+    yaz_mutex_leave(g_resultset_mutex);
+    return resultset_count;
+}
+
+int resultsets_count(void) {
+    return resultset_use(0);
+}
+
 ZOOM_resultset ZOOM_resultset_create(void)
 {
     int i;
@@ -639,6 +664,7 @@ ZOOM_resultset ZOOM_resultset_create(void)
         YAZ_SHPTR_INIT(r->record_wrbuf, w);
     }
 #endif
+    resultset_use(1);
     return r;
 }
 
@@ -828,6 +854,7 @@ static void resultset_destroy(ZOOM_resultset r)
 #if SHPTR
         YAZ_SHPTR_DEC(r->record_wrbuf, wrbuf_destroy);
 #endif
+        resultset_use(-1);
         xfree(r);
     }
     else
@@ -1854,6 +1881,12 @@ ZOOM_API(const char *)
         return "CCL configuration error";
     case ZOOM_ERROR_CCL_PARSE:
         return "CCL parsing error";
+    case ZOOM_ERROR_ES_INVALID_ACTION:
+        return "Extended Service. invalid action";
+    case ZOOM_ERROR_ES_INVALID_VERSION:
+        return "Extended Service. invalid version";
+    case ZOOM_ERROR_ES_INVALID_SYNTAX:
+        return "Extended Service. invalid syntax";
     default:
         return diagbib1_str(error);
     }
index bc1c84e..1b48d87 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file zoom-event.c
  * \brief Implements ZOOM Event stuff
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <string.h>
index 602f57d..a1ba28b 100644 (file)
@@ -1,11 +1,15 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file zoom-opt.c
  * \brief Implements ZOOM options handling
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <assert.h>
 #include "zoom-p.h"
 
index b0a39fc..3041928 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
index 1049873..c0e4312 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file zoom-query.c
  * \brief Implements ZOOM C query interface.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <string.h>
index 9bc4e15..b9d7a1e 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file zoom-record-cache.c
  * \brief Implements ZOOM record caching
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <string.h>
index c0b670f..6593ae7 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file zoom-socket.c
  * \brief Implements ZOOM C socket interface.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <string.h>
index c6d11e7..83e162f 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file zoom-sru.c
  * \brief Implements ZOOM SRU
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <string.h>
index 22dd87b..a8cf99b 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 /**
  * \file zoom-z3950.c
  * \brief Implements ZOOM Z39.50 handling
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <string.h>
@@ -321,12 +324,15 @@ static Z_APDU *create_update_package(ZOOM_package p)
                                            p->odr_out);
     }
     if (!syntax_oid)
+    { 
+        ZOOM_set_error(p->connection, ZOOM_ERROR_ES_INVALID_SYNTAX, syntax_str);
         return 0;
+    }
 
     if (num_db > 0)
         first_db = db[0];
     
-    switch(*version)
+    switch (*version)
     {
     case '1':
         package_oid = yaz_oid_extserv_database_update_first_version;
@@ -345,6 +351,7 @@ static Z_APDU *create_update_package(ZOOM_package p)
         package_oid = yaz_oid_extserv_database_update;
         break;
     default:
+        ZOOM_set_error(p->connection, ZOOM_ERROR_ES_INVALID_VERSION, version);
         return 0;
     }
     
@@ -359,7 +366,10 @@ static Z_APDU *create_update_package(ZOOM_package p)
     else if (!strcmp(action, "specialUpdate"))
         action_no = Z_IUOriginPartToKeep_specialUpdate;
     else
+    {
+        ZOOM_set_error(p->connection, ZOOM_ERROR_ES_INVALID_ACTION, action);
         return 0;
+    }
 
     apdu = create_es_package(p, package_oid);
     if (apdu)
@@ -666,7 +676,7 @@ zoom_ret ZOOM_connection_Z3950_send_search(ZOOM_connection c)
             yaz_oi_set_facetlist(oi, c->odr_out, facet_list);
         }
         else
-            yaz_log(YLOG_WARN, "Unable to parse facets: ", facets);
+            yaz_log(YLOG_WARN, "Unable to parse facets: %s", facets);
     }
 
     assert(r);
index 90d4151..cc7ce27 100644 (file)
@@ -34,6 +34,7 @@ test_oid
 test_file_glob
 test_log_thread
 test_mutex
+test_libstemmer
 *.log
 *.o
 *~
index 23b2f12..5e92f72 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 check_PROGRAMS = test_xmalloc test_iconv test_nmem test_matchstr test_wrbuf \
  test_odr test_ccl test_log test_mutex \
@@ -7,7 +7,7 @@ check_PROGRAMS = test_xmalloc test_iconv test_nmem test_matchstr test_wrbuf \
  test_comstack test_filepath test_record_conv test_retrieval test_tpath \
  test_timing test_query_charset test_oid test_icu test_match_glob \
  test_rpn2cql test_rpn2solr test_json test_xml_include test_file_glob \
- test_shared_ptr
+ test_shared_ptr test_libstemmer
 
 check_SCRIPTS = tstmarc.sh tstmarccol.sh tstcql2xcql.sh tstcql2pqf.sh tsticu.sh
 
@@ -23,6 +23,7 @@ EXTRA_DIST = tstodr.asn test_odrcodec.c test_odrcodec.h cql2xcqlsample \
  marccol5.u8.marc marccol5.u8.1.lst marccol5.u8.2.lst \
  tsticu-0.xml tsticu-0.input tsticu-0.output \
  tsticu-1.xml tsticu-1.input tsticu-1.output \
+ tsticu-2.xml tsticu-2.input tsticu-2.output \
  test_record_conv.xsl test_xml_include.xml
 
 YAZCOMP = ../util/yaz-asncomp
@@ -47,8 +48,9 @@ dist-hook:
 test_odrcodec.c test_odrcodec.h: tstodr.asn $(YAZCOMP)
        cd $(srcdir); $(YAZCOMP) tstodr.asn
 
-LDADD = ../src/libyaz.la
+LDADD = ../src/libyaz.la 
 test_icu_LDADD = ../src/libyaz_icu.la ../src/libyaz.la $(ICU_LIBS)
+test_libstemmer_LDADD = ../src/libyaz_icu.la ../src/libyaz.la $(ICU_LIBS)
 
 CONFIG_CLEAN_FILES=*.log
 
@@ -83,3 +85,4 @@ test_json_SOURCES = test_json.c
 test_xml_include_SOURCES = test_xml_include.c
 test_file_glob_SOURCES = test_file_glob.c
 test_shared_ptr_SOURCES = test_shared_ptr.c
+test_libstemmer_SOURCES = test_libstemmer.c
index 9ebebad..20f6503 100644 (file)
@@ -1,9 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
-/* CCL test */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <string.h>
 #include <yaz/ccl_xml.h>
index eee72f8..b7778d1 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <string.h>
index 8cfc3c3..029382b 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
@@ -33,6 +33,16 @@ void tst_with_path(const char *tpath)
     yaz_file_globfree(&glob_res);
 }
 
+static check_file(const char *got, const char *expect)
+{
+    const char *f = got;
+    size_t l_match = strlen(expect);
+    YAZ_CHECK(f && strlen(f) >= l_match);
+    if (f && strlen(f) >= l_match && !strcmp(f + strlen(f) - l_match, expect))
+        return 1;
+    return 0;
+}
+
 void tst(void)
 {
     yaz_glob_res_t glob_res;
@@ -45,20 +55,17 @@ void tst(void)
         wrbuf_puts(tpath, srcdir);
         wrbuf_puts(tpath, "/");
     }
-    wrbuf_puts(tpath, "Make*.am");
+    wrbuf_puts(tpath, "test_file*.c");
     ret = yaz_file_glob(wrbuf_cstr(tpath), &glob_res);
     YAZ_CHECK_EQ(ret, 0);
 
-    YAZ_CHECK_EQ(1, yaz_file_glob_get_num(glob_res));
-    if (yaz_file_glob_get_num(glob_res) == 1)
+    YAZ_CHECK_EQ(2, yaz_file_glob_get_num(glob_res));
+    if (yaz_file_glob_get_num(glob_res) == 2)
     {
-        const char *f = yaz_file_glob_get_file(glob_res, 0);
-        size_t l_match = strlen("Makefile.am");
-        YAZ_CHECK(f && strlen(f) >= l_match);
-        if (f && strlen(f) >= l_match)
-        {
-            YAZ_CHECK(!strcmp(f + strlen(f) - l_match, "Makefile.am"));
-        }
+        YAZ_CHECK(check_file(yaz_file_glob_get_file(glob_res, 0),
+                             "test_file_glob.c"));
+        YAZ_CHECK(check_file(yaz_file_glob_get_file(glob_res, 1),
+                             "test_filepath.c"));
     }
     wrbuf_destroy(tpath);
     yaz_file_globfree(&glob_res);
index b06bb3d..c816034 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 352033a..3c730cf 100644 (file)
@@ -1,8 +1,7 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 #if HAVE_CONFIG_H
 #include <config.h>
 #endif
index 2ad005c..1c04fb0 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
@@ -450,6 +450,8 @@ static void check_icu_chain(void)
 
     xmlFreeDoc(doc);
     YAZ_CHECK(chain);
+    if (!chain)
+        return;
 
     YAZ_CHECK(icu_chain_assign_cstr(chain, en_str, &status));
 
@@ -507,6 +509,8 @@ static void check_bug_1140(void)
 
     xmlFreeDoc(doc);
     YAZ_CHECK(chain);
+    if (!chain)
+        return;
     
     YAZ_CHECK(icu_chain_assign_cstr(
                   chain,  "O Romeo, Romeo! wherefore art thou\t Romeo?",
@@ -773,6 +777,8 @@ static void check_icu_iter2(void)
 
     xmlFreeDoc(doc);
     YAZ_CHECK(chain);
+    if (!chain)
+        return;
     
     YAZ_CHECK(test_iter(chain, "Adobe Acrobat Reader, 1991-1999.",
                         "[adobe][acrobat][reader][1991][][1999][]"));
index d402c0e..f5e81c9 100644 (file)
@@ -1,7 +1,15 @@
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data
+ * See the file LICENSE for details.
+ */
 /**
  * \file 
  * \brief JSON test
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <yaz/test.h>
 #include <yaz/json.h>
 #include <string.h>
diff --git a/test/test_libstemmer.c b/test/test_libstemmer.c
new file mode 100644 (file)
index 0000000..a2ea678
--- /dev/null
@@ -0,0 +1,83 @@
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data
+ * See the file LICENSE for details.
+ */
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <yaz/test.h>
+
+#if YAZ_HAVE_ICU
+#include <yaz/stemmer.h>
+
+int test_stemmer_stem(yaz_stemmer_p stemmer, const char* to_stem, const char *expected) 
+{
+    struct icu_buf_utf16 *src  = icu_buf_utf16_create(0);
+    struct icu_buf_utf16 *dst  = icu_buf_utf16_create(0);
+    struct icu_buf_utf8  *dst8 = icu_buf_utf8_create(0);
+
+    UErrorCode status; 
+    const char *result;
+    icu_utf16_from_utf8_cstr(src, to_stem, &status);
+    yaz_stemmer_stem(stemmer, dst, src, &status); 
+    /* Assume fail */
+    int rc = 0;
+    if (status == U_ZERO_ERROR) {
+        icu_utf16_to_utf8(dst8, dst, &status);
+        result = icu_buf_utf8_to_cstr(dst8);
+        rc = strcmp(result, expected) == 0;
+    }
+    icu_buf_utf8_destroy(dst8);
+    icu_buf_utf16_destroy(src);
+    icu_buf_utf16_destroy(dst);
+    return rc;
+}
+
+
+static void tst(void)
+{
+    UErrorCode status;
+    //== U_ZERO_ERROR; 
+    yaz_stemmer_p stemmer = yaz_stemmer_create("en", "porter", &status);
+    YAZ_CHECK(stemmer); 
+
+    /* fail  */
+    YAZ_CHECK(test_stemmer_stem(stemmer, "beer", "water") == 0 ); 
+
+    /* Same */
+    YAZ_CHECK(test_stemmer_stem(stemmer, "adadwwr", "adadwwr")); 
+
+    /* Remove S */
+    YAZ_CHECK(test_stemmer_stem(stemmer, "beers", "beer")); 
+    YAZ_CHECK(test_stemmer_stem(stemmer, "persons", "person")); 
+
+    /* Remove s and ing  */
+    YAZ_CHECK(test_stemmer_stem(stemmer, "runs", "run")); 
+    YAZ_CHECK(test_stemmer_stem(stemmer, "running", "run")); 
+
+    yaz_stemmer_destroy(stemmer);
+}
+#endif
+
+int main (int argc, char **argv)
+{
+    YAZ_CHECK_INIT(argc, argv);
+#if YAZ_HAVE_ICU
+    tst();
+#endif
+    YAZ_CHECK_TERM;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index d4a83e5..aaeaced 100644 (file)
@@ -1,7 +1,11 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index 41c4ceb..e2cac23 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 8421752..9a361bb 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <yaz/test.h>
 #include <yaz/match_glob.h>
index bdb9751..0aa8c04 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
index a4483fc..ba376c2 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index 80a2e56..cd47192 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 63ad290..5865f0a 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <yaz/oid_util.h>
index e81e4f9..f746680 100644 (file)
@@ -1,7 +1,11 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdlib.h>
 #include <yaz/pquery.h>
 #include <yaz/proto.h>
index d00c23a..e42bd48 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index 313df6b..fdbdee8 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index e3c83fc..87dbcdc 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index 80b6d02..2612f0e 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 #include <yaz/record_conv.h>
index 9b7bf8a..6983739 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 #include <yaz/retrieval.h>
index 7aecbb0..cb2dacb 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index 029552c..a5956dd 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index 3502238..3688695 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index eb2ba11..37f7c70 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #if YAZ_HAVE_XML2
index 620f5f3..41f0b7b 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <yaz/test.h>
index edbca1d..dda9e0b 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index 411ae82..9009949 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 #include <yaz/tpath.h>
index af06e40..007258a 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index 877c93f..8dace8c 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 7a289be..7934b5e 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <string.h>
index 908adc6..9015fa8 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/test/tsticu-2.input b/test/tsticu-2.input
new file mode 100644 (file)
index 0000000..579a976
--- /dev/null
@@ -0,0 +1,2 @@
+`a'
+``a''
diff --git a/test/tsticu-2.output b/test/tsticu-2.output
new file mode 100644 (file)
index 0000000..b5ee584
--- /dev/null
@@ -0,0 +1,4 @@
+1 1 '‘a'
+' ''
+2 2 '“a''
+' ''
diff --git a/test/tsticu-2.xml b/test/tsticu-2.xml
new file mode 100644 (file)
index 0000000..eea85bd
--- /dev/null
@@ -0,0 +1,8 @@
+<icu_chain locale="en">
+ <transliterate>
+$back = \` ;
+$back $back > â€œ ; # generate right d.q.m. (double quotation mark)
+$back > â€˜ ;
+ </transliterate>
+</icu_chain>
+
diff --git a/test/tsticu-3.input b/test/tsticu-3.input
new file mode 100644 (file)
index 0000000..989f89d
--- /dev/null
@@ -0,0 +1,2 @@
+men running
+he runs 
diff --git a/test/tsticu-3.output b/test/tsticu-3.output
new file mode 100644 (file)
index 0000000..3139c0b
--- /dev/null
@@ -0,0 +1,4 @@
+1 1 'men' ''
+2 1 'run' ''
+3 2 'he' ''
+4 2 'run' ''
diff --git a/test/tsticu-3.xml b/test/tsticu-3.xml
new file mode 100644 (file)
index 0000000..f7db5c7
--- /dev/null
@@ -0,0 +1,7 @@
+<icu_chain locale="en">
+  <transform rule="[:Control:] Any-Remove"/>
+  <tokenize rule="l"/>
+  <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
+  <casemap rule="l"/>
+  <stemming rule="english" />
+</icu_chain>
index be5bf68..e2b519d 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 bin_SCRIPTS = yaz-asncomp yaz-config 
 
index eff9d70..abb1c7d 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index 4d24d9c..155bfe3 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
index d194da3..40aa034 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index 23afa1a..55d824d 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
index ce1da8b..6621c4d 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
index 0696df8..041a7df 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index bace12a..2a1802f 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <yaz/srw.h>
index d02bd9d..e155e5b 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/tclsh
 #
 # yaz-comp: ASN.1 Compiler for YAZ
-# (c) Index Data 1996-2010
+# (c) Index Data 1996-2011
 # See the file LICENSE for details.
 #
 
@@ -1092,6 +1092,11 @@ proc asnModules {} {
            puts $file(outc) ""
            puts $file(outc) "    ${greeting} ${yc_version}"
            puts $file(outc) "*/"
+
+           puts $file(outc) "\#if HAVE_CONFIG_H"
+           puts $file(outc) "\#include <config.h>"
+           puts $file(outc) "\#endif"
+
            puts $file(outc) {}
 
            puts $file(outh) "/** \\file $inf(h-file)"
index 2e99037..27180b9 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 
 #include <yaz/options.h>
 
 #include <unicode/ucol.h> 
 #include <unicode/ubrk.h>
 #include <unicode/utrans.h>
+#include <unicode/uclean.h>
 
 #include <yaz/icu.h>
 #include <yaz/wrbuf.h>
 
 /* commando line and config parameters */
-static struct config_t { 
+struct config_t { 
     char conffile[1024];
     char print[1024];
     int xmloutput;
@@ -34,18 +36,16 @@ static struct config_t {
     yaz_icu_chain_t chain;
     FILE * infile;
     FILE * outfile;
-} config;
-
-
+};
   
 void print_option_error(const struct config_t *p_config)
 {  
-    fprintf(stderr, "Calling error, valid options are :\n");
-    fprintf(stderr, "yaz-icu\n"
-            "   [-c (path/to/config/file.xml)]\n"
-            "   [-p (a|c|l|t)] print ICU info \n"
-            "   [-s] Show sort normalization key\n"
-            "   [-x] XML output\n"
+    fprintf(stderr, "yaz-icu [options] [infile]\n"
+            "Options:\n"
+            "   -c file         XML configuration\n"
+            "   -p a|c|l|t      Print ICU info \n"
+            "   -s              Show sort normalization key\n"
+            "   -x              XML output instread of text\n"
             "\n"
             "Examples:\n"
             "cat hugetextfile.txt | ./yaz-icu -c config.xml \n"
@@ -75,7 +75,7 @@ void read_params(int argc, char **argv, struct config_t *p_config)
     p_config->xmloutput = 0;
     p_config->sortoutput = 0;
     p_config->chain = 0;
-    p_config->infile = stdin;
+    p_config->infile = 0;
     p_config->outfile = stdout;
     
     /* set up command line parameters */
@@ -96,17 +96,30 @@ void read_params(int argc, char **argv, struct config_t *p_config)
         case 'x':
             p_config->xmloutput = 1;
             break;
+        case 0:
+            if (p_config->infile)
+            {
+                fprintf(stderr, "yaz-icu: only one input file may be given\n");
+                print_option_error(p_config);
+            }
+            p_config->infile = fopen(arg, "r");
+            if (!p_config->infile)
+            {
+                fprintf(stderr, "yaz-icu: cannot open %s : %s\n",
+                        arg, strerror(errno));
+                exit(1);
+            }
+            break;
         default:
-            printf("Got %d\n", ret);
+            fprintf(stderr, "yaz_icu: invalid option: %s\n", arg);
             print_option_error(p_config);
         }
     }
-    
-    if ((!strlen(p_config->conffile)
-         && !strlen(p_config->print))
-        || !config.infile
-        || !config.outfile)
-        
+
+    if (p_config->infile == 0)
+        p_config->infile = stdin;
+
+    if (!strlen(p_config->conffile) && !strlen(p_config->print))
         print_option_error(p_config);
 }
 
@@ -136,57 +149,56 @@ static void print_icu_converters(const struct config_t *p_config)
 
     count = ucnv_countAvailable();
     if (p_config->xmloutput)
-        fprintf(config.outfile, "<converters count=\"%d\" default=\"%s\">\n",
+        fprintf(p_config->outfile, "<converters count=\"%d\" default=\"%s\">\n",
                 count, ucnv_getDefaultName());
-    else {    
-        fprintf(config.outfile, "Available ICU converters: %d\n", count);
-        fprintf(config.outfile, "Default ICU Converter is: '%s'\n", 
+    else
+    {    
+        fprintf(p_config->outfile, "Available ICU converters: %d\n", count);
+        fprintf(p_config->outfile, "Default ICU Converter is: '%s'\n", 
                 ucnv_getDefaultName());
     }
     
-    for(i=0;i<count;i++)
+    for (i = 0; i < count; i++)
     {
         if (p_config->xmloutput)
-            fprintf(config.outfile, "<converter id=\"%s\"/>\n", 
+            fprintf(p_config->outfile, "<converter id=\"%s\"/>\n", 
                     ucnv_getAvailableName(i));
         else     
-            fprintf(config.outfile, "%s ", ucnv_getAvailableName(i));
+            fprintf(p_config->outfile, "%s\n", ucnv_getAvailableName(i));
     }
     
     if (p_config->xmloutput)
-        fprintf(config.outfile, "</converters>\n");
+        fprintf(p_config->outfile, "</converters>\n");
     else
-        fprintf(config.outfile, "\n");
+        fprintf(p_config->outfile, "\n");
 }
 
 static void print_icu_transliterators(const struct config_t *p_config)
 {
-    int32_t buf_cap = 128;
-    char buf[128];
-    int32_t i;
-    int32_t count = utrans_countAvailableIDs();
-    
+    UErrorCode status;
+    UEnumeration *en = utrans_openIDs(&status);
+    int32_t count = uenum_count(en, &status);
+    const char *name;
+    int32_t length;
+
     if (p_config->xmloutput)
-        fprintf(config.outfile, "<transliterators count=\"%d\">\n",  count);
+        fprintf(p_config->outfile, "<transliterators count=\"%d\">\n",  count);
     else 
-        fprintf(config.outfile, "Available ICU transliterators: %d\n", count);
-    
-    for(i = 0; i <count; i++)
+        fprintf(p_config->outfile, "Available ICU transliterators: %d\n", count);
+
+    while ((name = uenum_next(en, &length, &status)))
     {
-        utrans_getAvailableID(i, buf, buf_cap);
         if (p_config->xmloutput)
-            fprintf(config.outfile, "<transliterator id=\"%s\"/>\n", buf);
+            fprintf(p_config->outfile, "<transliterator id=\"%s\"/>\n", name);
         else
-            fprintf(config.outfile, " %s", buf);
+            fprintf(p_config->outfile, "%s\n", name);
     }
-    
+    uenum_close(en);
     if (p_config->xmloutput)
-    {
-        fprintf(config.outfile, "</transliterators>\n");
-    }
+        fprintf(p_config->outfile, "</transliterators>\n");
     else
     {
-        fprintf(config.outfile, "\n\nUnicode Set Patterns:\n"
+        fprintf(p_config->outfile, "\n\nUnicode Set Patterns:\n"
                 "   Pattern         Description\n"
                 "   Ranges          [a-z]      The lower case letters a through z\n"
                 "   Named Chars     [abc123] The six characters a,b,c,1,2 and 3\n"
@@ -223,14 +235,12 @@ static void print_icu_transliterators(const struct config_t *p_config)
                 "   [A-Za-z]; Lower(); Latin-Katakana; Katakana-Hiragana (transforms latin and katagana to hiragana)\n"
                 "   [[:separator:][:start punctuation:][:initial punctuation:]] Remove \n"
                 "\n"
-                "see http://icu.sourceforge.net/userguide/Transform.html\n"
-                "    http://www.unicode.org/Public/UNIDATA/UCD.html\n"
-                "    http://icu.sourceforge.net/userguide/Transform.html\n"
-                "    http://icu.sourceforge.net/userguide/TransformRule.html\n"
+                "see http://userguide.icu-project.org/transforms/general\n"
+                "    http://www.unicode.org/reports/tr44/\n"
             );
         
         
-        fprintf(config.outfile, "\n\n");
+        fprintf(p_config->outfile, "\n\n");
         
     }
 }
@@ -280,11 +290,16 @@ static void print_icu_xml_locales(const struct config_t *p_config)
 
     if (p_config->xmloutput)
     {
-        fprintf(config.outfile, "<locales count=\"%d\" default=\"%s\" collations=\"%d\">\n", 
+        fprintf(p_config->outfile, "<locales count=\"%d\" default=\"%s\" collations=\"%d\">\n", 
                 count, uloc_getDefault(), ucol_countAvailable());
     }
+    else
+    {
+        fprintf(p_config->outfile, "Available ICU locales: %d\n", count);
+        fprintf(p_config->outfile, "Default locale is: %s\n",  uloc_getDefault());
+    }
   
-    for(i=0;i<count;i++) 
+    for (i = 0; i < count; i++) 
     {
 
         keyword_len 
@@ -355,49 +370,49 @@ static void print_icu_xml_locales(const struct config_t *p_config)
 
         if (p_config->xmloutput)
         {
-            fprintf(config.outfile, "<locale id=\"%s\"", uloc_getAvailable(i)); 
-            /* fprintf(config.outfile, " locale=\"%s\"", uloc_getAvailable(i)); */
+            fprintf(p_config->outfile, "<locale id=\"%s\"", uloc_getAvailable(i)); 
+            /* fprintf(p_config->outfile, " locale=\"%s\"", uloc_getAvailable(i)); */
             /* if (strlen(keyword_str)) */
-            /*   fprintf(config.outfile, " keyword=\"%s\"", keyword_str); */
+            /*   fprintf(p_config->outfile, " keyword=\"%s\"", keyword_str); */
             /* if (ucol_getAvailable(i)) */
-            /*   fprintf(config.outfile, " collation=\"1\""); */
+            /*   fprintf(p_config->outfile, " collation=\"1\""); */
             if (strlen(lang_str))
-                fprintf(config.outfile, " language=\"%s\"", lang_str);
+                fprintf(p_config->outfile, " language=\"%s\"", lang_str);
             if (strlen(script_str))
-                fprintf(config.outfile, " script=\"%s\"", script_str);
+                fprintf(p_config->outfile, " script=\"%s\"", script_str);
             if (strlen(location_str))
-                fprintf(config.outfile, " location=\"%s\"", location_str);
+                fprintf(p_config->outfile, " location=\"%s\"", location_str);
             if (strlen(variant_str))
-                fprintf(config.outfile, " variant=\"%s\"", variant_str);
+                fprintf(p_config->outfile, " variant=\"%s\"", variant_str);
             if (strlen(name_str))
-                fprintf(config.outfile, " name=\"%s\"", name_str);
+                fprintf(p_config->outfile, " name=\"%s\"", name_str);
             if (strlen(localname_str))
-                fprintf(config.outfile, " localname=\"%s\"", localname_str);
-            fprintf(config.outfile, ">");
+                fprintf(p_config->outfile, " localname=\"%s\"", localname_str);
+            fprintf(p_config->outfile, ">");
             if (strlen(localname_str))
-                fprintf(config.outfile, "%s", localname_str);
-            fprintf(config.outfile, "</locale>\n"); 
+                fprintf(p_config->outfile, "%s", localname_str);
+            fprintf(p_config->outfile, "</locale>\n"); 
         }
         else if (1 == p_config->xmloutput)
         {
-            fprintf(config.outfile, "%s", uloc_getAvailable(i)); 
-            fprintf(config.outfile, " | ");
+            fprintf(p_config->outfile, "%s", uloc_getAvailable(i)); 
+            fprintf(p_config->outfile, " | ");
             if (strlen(name_str))
-                fprintf(config.outfile, "%s", name_str);
-            fprintf(config.outfile, " | ");
+                fprintf(p_config->outfile, "%s", name_str);
+            fprintf(p_config->outfile, " | ");
             if (strlen(localname_str))
-                fprintf(config.outfile, "%s", localname_str);
-            fprintf(config.outfile, "\n");
+                fprintf(p_config->outfile, "%s", localname_str);
+            fprintf(p_config->outfile, "\n");
         }
         else
-            fprintf(config.outfile, "%s ", uloc_getAvailable(i));
+            fprintf(p_config->outfile, "%s\n", uloc_getAvailable(i));
     }
     if (p_config->xmloutput)
-        fprintf(config.outfile, "</locales>\n");
+        fprintf(p_config->outfile, "</locales>\n");
     else
-        fprintf(config.outfile, "\n");
+        fprintf(p_config->outfile, "\n");
 
-    if(U_FAILURE(status))
+    if (U_FAILURE(status))
     {
         fprintf(stderr, "ICU Error: %d %s\n", status, u_errorName(status));
         exit(2);
@@ -408,35 +423,35 @@ static void print_icu_xml_locales(const struct config_t *p_config)
 static void print_info(const struct config_t *p_config)
 {
     if (p_config->xmloutput)
-        fprintf(config.outfile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+        fprintf(p_config->outfile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                 "<icu>\n");
 
-    if ('c' == config.print[0])
-        print_icu_converters(&config);
-    else if ('l' == config.print[0])
-        print_icu_xml_locales(&config);
-    else if ('t' == config.print[0])
-        print_icu_transliterators(&config);
+    if ('c' == p_config->print[0])
+        print_icu_converters(p_config);
+    else if ('l' == p_config->print[0])
+        print_icu_xml_locales(p_config);
+    else if ('t' == p_config->print[0])
+        print_icu_transliterators(p_config);
     else {
-        print_icu_converters(&config);
-        print_icu_xml_locales(&config);
-        print_icu_transliterators(&config);
+        print_icu_converters(p_config);
+        print_icu_xml_locales(p_config);
+        print_icu_transliterators(p_config);
     }
 
     if (p_config->xmloutput)
-        fprintf(config.outfile, "</icu>\n");
+        fprintf(p_config->outfile, "</icu>\n");
 
     exit(0);
 }
 
 
 
-static void process_text_file(const struct config_t *p_config)
+static void process_text_file(struct config_t *p_config)
 {
     char *line = 0;
     char linebuf[1024];
  
-    xmlDoc *doc = xmlParseFile(config.conffile);  
+    xmlDoc *doc = xmlParseFile(p_config->conffile);  
     xmlNode *xml_node = xmlDocGetRootElement(doc);
 
     long unsigned int token_count = 0;    
@@ -447,82 +462,82 @@ static void process_text_file(const struct config_t *p_config)
     if (!xml_node)
     {   
         printf("Could not parse XML config file '%s' \n",
-                config.conffile);
+                p_config->conffile);
         exit(1);
     }
 
-    config.chain = icu_chain_xml_config(xml_node, 1, &status);
+    p_config->chain = icu_chain_xml_config(xml_node, 1, &status);
 
-    if (!config.chain || !U_SUCCESS(status))
+    if (!p_config->chain || !U_SUCCESS(status))
     {   
         printf("Could not set up ICU chain from config file '%s' \n",
-                config.conffile);
+                p_config->conffile);
         if (!U_SUCCESS(status))
             printf("ICU Error: %d %s\n", status, u_errorName(status));
         exit(1);
     }
 
     if (p_config->xmloutput)
-        fprintf(config.outfile,
+        fprintf(p_config->outfile,
                 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                 "<icu>\n"
                 "<tokens>\n");
     
     /* read input lines for processing */
-    while ((line=fgets(linebuf, sizeof(linebuf)-1, config.infile)))
+    while ((line=fgets(linebuf, sizeof(linebuf)-1, p_config->infile)))
     {
         WRBUF sw = wrbuf_alloc();
         WRBUF cdata = wrbuf_alloc();
-        int success = icu_chain_assign_cstr(config.chain, line, &status);
+        int success = icu_chain_assign_cstr(p_config->chain, line, &status);
         line_count++;
 
-        while (success && icu_chain_next_token(config.chain, &status))
+        while (success && icu_chain_next_token(p_config->chain, &status))
         {
             if (U_FAILURE(status))
                 success = 0;
             else
             {
-                const char *sortkey = icu_chain_token_sortkey(config.chain);
+                const char *sortkey = icu_chain_token_sortkey(p_config->chain);
                 wrbuf_rewind(sw);
                 wrbuf_puts_escaped(sw, sortkey);
                 token_count++;
                 if (p_config->xmloutput)                    
                 {
-                    fprintf(config.outfile, 
+                    fprintf(p_config->outfile, 
                             "<token id=\"%lu\" line=\"%lu\"",
                             token_count, line_count);
 
                     wrbuf_rewind(cdata);
-                    wrbuf_xmlputs(cdata, icu_chain_token_norm(config.chain));
-                    fprintf(config.outfile, " norm=\"%s\"",
+                    wrbuf_xmlputs(cdata, icu_chain_token_norm(p_config->chain));
+                    fprintf(p_config->outfile, " norm=\"%s\"",
                             wrbuf_cstr(cdata));
 
                     wrbuf_rewind(cdata);
-                    wrbuf_xmlputs(cdata, icu_chain_token_display(config.chain));
-                    fprintf(config.outfile, " display=\"%s\"",
+                    wrbuf_xmlputs(cdata, icu_chain_token_display(p_config->chain));
+                    fprintf(p_config->outfile, " display=\"%s\"",
                             wrbuf_cstr(cdata));
                     
                     if (p_config->sortoutput)
                     {
                         wrbuf_rewind(cdata);
                         wrbuf_xmlputs(cdata, wrbuf_cstr(sw));
-                        fprintf(config.outfile, " sortkey=\"%s\"",
+                        fprintf(p_config->outfile, " sortkey=\"%s\"",
                                 wrbuf_cstr(cdata));
                     }
-                    fprintf(config.outfile, "/>\n");
+                    fprintf(p_config->outfile, "/>\n");
                 }
                 else
                 {
-                    fprintf(config.outfile, "%lu %lu '%s' '%s'",
+                    fprintf(p_config->outfile, "%lu %lu '%s' '%s'",
                             token_count,
                             line_count,
-                            icu_chain_token_norm(config.chain),
-                            icu_chain_token_display(config.chain));
+                            icu_chain_token_norm(p_config->chain),
+                            icu_chain_token_display(p_config->chain));
                     if (p_config->sortoutput)
                     {
-                        fprintf(config.outfile, " '%s'", wrbuf_cstr(sw));
+                        fprintf(p_config->outfile, " '%s'", wrbuf_cstr(sw));
                     }
-                    fprintf(config.outfile, "\n");
+                    fprintf(p_config->outfile, "\n");
                 }
             }
         }
@@ -531,11 +546,11 @@ static void process_text_file(const struct config_t *p_config)
     }
 
     if (p_config->xmloutput)
-        fprintf(config.outfile,
+        fprintf(p_config->outfile,
                 "</tokens>\n"
                 "</icu>\n");
     
-    icu_chain_destroy(config.chain);
+    icu_chain_destroy(p_config->chain);
     xmlFreeDoc(doc);
     if (line)
         free(line);
@@ -546,9 +561,9 @@ static void process_text_file(const struct config_t *p_config)
 
 int main(int argc, char **argv) 
 {
+    struct config_t config;
 
 #if YAZ_HAVE_ICU
-
     read_params(argc, argv, &config);
 
     if (config.conffile && strlen(config.conffile))
@@ -557,10 +572,11 @@ int main(int argc, char **argv)
     if (config.print && strlen(config.print))
         print_info(&config);
 
+    u_cleanup();
 #else /* YAZ_HAVE_ICU */
 
     printf("ICU not available on your system.\n"
-           "Please install libicu36-dev and icu-doc or similar, "
+           "Please install libicu-dev and icu-doc or similar, "
            "re-configure and re-compile\n");
 
 
index 979400c..4fbff1f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
@@ -31,6 +31,9 @@
  *
  *
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index d05ea11..86e2eb4 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index dae8105..d203895 100644 (file)
@@ -1,7 +1,10 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
index cca3317..3d4a1f0 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index c932eba..41b24e5 100644 (file)
@@ -1,4 +1,4 @@
-Copyright (c) 1995-2010, Index Data.
+Copyright (c) 1995-2011, Index Data.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
index d4418f1..b850872 100644 (file)
@@ -1,5 +1,5 @@
 # This file is part of the YAZ toolkit.
-# Copyright (C) 1995-2010 Index Data
+# Copyright (C) 1995-2011 Index Data
 
 # Parameters 
 
@@ -258,7 +258,8 @@ COMMON_C_OPTIONS=          \
   /Fd"$(OBJDIR)\\" 
 
 COMMON_C_INCLUDES= \
-  /I"$(ROOTDIR)\include"
+  /I"$(ROOTDIR)\include" \
+  /I"$(ROOTDIR)\libstemmer_c\include"
 
 DEBUG_C_OPTIONS=  \
   /D "_DEBUG"      \
@@ -481,6 +482,7 @@ MISC_OBJS= \
    $(OBJDIR)\zgdu.obj \
    $(OBJDIR)\soap.obj \
    $(OBJDIR)\solr.obj \
+   $(OBJDIR)\solrtransform.obj \
    $(OBJDIR)\srw.obj \
    $(OBJDIR)\srwutil.obj \
    $(OBJDIR)\zoom-c.obj \
@@ -504,6 +506,7 @@ MISC_OBJS= \
    $(OBJDIR)\cqlutil.obj \
    $(OBJDIR)\cqlstrer.obj \
    $(OBJDIR)\rpn2cql.obj \
+   $(OBJDIR)\rpn2solr.obj \
    $(OBJDIR)\xcqlutil.obj \
    $(OBJDIR)\elementset.obj \
    $(OBJDIR)\timing.obj \
@@ -570,10 +573,17 @@ ILL_OBJS= \
    $(OBJDIR)\ill-core.obj\
    $(OBJDIR)\item-req.obj
 
+STEMMER_OBJS = \
+   $(OBJDIR)\libstemmer.obj \
+   $(OBJDIR)\api.obj \
+   $(OBJDIR)\utilities.obj \
+   $(OBJDIR)\stem_UTF_8_porter.obj \
+   $(OBJDIR)\stem_UTF_8_english.obj
+
 DLL_OBJS =\
    $(MISC_OBJS) \
    $(Z3950_OBJS) \
-   $(ILL_OBJS) \
+   $(ILL_OBJS)
    
 ICU_DLL_OBJS =\
    $(OBJDIR)\icu_chain.obj \
@@ -582,7 +592,9 @@ ICU_DLL_OBJS =\
    $(OBJDIR)\icu_transform.obj \
    $(OBJDIR)\icu_casemap.obj \
    $(OBJDIR)\icu_tokenizer.obj \
-   $(OBJDIR)\icu_sortkey.obj
+   $(OBJDIR)\icu_sortkey.obj \
+   $(OBJDIR)\stemmer.obj \
+   $(STEMMER_OBJS) 
 
 # Generated C and H files
 
@@ -742,6 +754,15 @@ generate: \
 {$(TESTDIR)}.c{$(OBJDIR)}.obj:
        $(CPP) $(COPT) $< 
 
+{$(ROOTDIR)\libstemmer_c\libstemmer}.c{$(OBJDIR)}.obj:
+       $(CPP) $(COPT) $< 
+
+{$(ROOTDIR)\libstemmer_c\runtime}.c{$(OBJDIR)}.obj:
+       $(CPP) $(COPT) $< 
+
+{$(ROOTDIR)\libstemmer_c\src_c}.c{$(OBJDIR)}.obj:
+       $(CPP) $(COPT) $< 
+
 # ASN-generated files
 
 !if $(HAVE_TCL)
index 4a1c682..be73f62 100644 (file)
@@ -1,5 +1,5 @@
 ; This file is part of the YAZ toolkit.
-; Copyright (C) 1995-2010 Index Data
+; Copyright (C) 1995-2011 Index Data
 
 !include version.nsi
 
@@ -143,6 +143,7 @@ SectionEnd
 Section "YAZ Source" YAZ_Source
        SectionIn 1
        SetOutPath $INSTDIR
+       File ..\configure.ac
        File /r ..\*.c
        File /r /x yaz ..\*.h
        SetOutPath $INSTDIR\util
index c03a1b5..81e2d45 100644 (file)
@@ -27,7 +27,7 @@ VS_VERSION_INFO VERSIONINFO
 #endif
             VALUE "FileVersion", YAZ_VERSION "\0"
             VALUE "InternalName", "YAZ\0"
-            VALUE "LegalCopyright", "Copyright Â© 1995-2010 Index Data\0"
+            VALUE "LegalCopyright", "Copyright Â© 1995-2011 Index Data\0"
             VALUE "LegalTrademarks", "\0"
             VALUE "OriginalFilename", "yaz.res\0"
             VALUE "PrivateBuild", "\0"
index 2074827..9553d94 100644 (file)
@@ -1,8 +1,11 @@
 #!/bin/sh
 # This file is part of the YAZ toolkit.
-# Copyright (C) 1995-2008 Index Data
+# Copyright (C) 1995-2011 Index Data
 
 prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
 echo_cflags=no
 echo_libs=no
 echo_help=no
@@ -16,6 +19,7 @@ ICU_CPPFLAGS="@ICU_CPPFLAGS@"
 SSL_LIBS="@SSL_LIBS@"
 LIBS="@LIBS@"
 VERSION=@VERSION@
+YAZVERSION=$VERSION
 VERSION_SHA1=@VERSION_SHA1@
 
 usage()
@@ -145,12 +149,12 @@ else
     YAZCOMP=${prefix}/bin/yaz-asncomp
 
     if test "$prefix" != "/usr"; then
-       YAZLIB="-L$prefix/lib $YAZLIB"
+       YAZLIB="-L$libdir $YAZLIB"
     fi
     YAZLIB="$YAZLIB $LIBS"
     YAZLALIB=$YAZLIB
     if test "$prefix" != "/usr"; then
-       YAZINC="-I$prefix/include $YAZINC"
+       YAZINC="-I${includedir} $YAZINC"
     fi
 fi
 
diff --git a/yaz.spec b/yaz.spec
new file mode 100644 (file)
index 0000000..ac8fcc7
--- /dev/null
+++ b/yaz.spec
@@ -0,0 +1,156 @@
+# This file is part of the YAZ toolkit
+# Copyright (C) 1995-2011 Index Data
+#
+# spec file for YAZ
+
+Name: yaz
+Summary: Z39.50 Programs
+Version: 4.1.7
+Release: 1indexdata
+
+# determine system
+%define is_mandrake %(test -e /etc/mandrake-release && echo 1 || echo 0)
+%define is_suse %(test -e /etc/SuSE-release >/dev/null && echo 1 || echo 0)
+%define is_suse11 %(grep 'VERSION = 11' /etc/SuSE-release >/dev/null 2>&1 && echo 1 || echo 0)
+%define is_fedora %(test -e /etc/fedora-release && echo 1 || echo 0)
+Requires: libxslt, gnutls, readline, libyaz4 = %{version}
+License: BSD
+Group: Applications/Internet
+Vendor: Index Data ApS <info@indexdata.dk>
+Source: yaz-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+Prefix: %{_prefix}
+
+%define TCPWRAPPER tcp_wrappers
+
+%if %is_fedora
+%define TCPWRAPPER tcp_wrappers-devel
+%endif
+
+%if %is_suse
+%define TCPWRAPPER tcpd-devel
+%endif
+
+BuildRequires: %{TCPWRAPPER}
+
+%if %is_suse11
+BuildRequires: libgnutls-devel
+%else
+BuildRequires: gnutls-devel
+%endif
+
+BuildRequires: pkgconfig
+BuildRequires: libxml2-devel
+BuildRequires: libxslt-devel
+BuildRequires: readline-devel
+BuildRequires: libicu-devel
+Packager: Adam Dickmeiss <adam@indexdata.dk>
+URL: http://www.indexdata.com/yaz
+
+%description
+This package contains both a test-server and clients (normal & ssl)
+for the ANSI/NISO Z39.50 protocol for Information Retrieval.
+
+%package -n libyaz4
+Summary: Z39.50 Library
+Group: Libraries
+Requires: libxslt, gnutls, libicu
+
+%description -n libyaz4
+YAZ is a library for the ANSI/NISO Z39.50 protocol for Information
+Retrieval.
+
+%post -n libyaz4 -p /sbin/ldconfig 
+%postun -n libyaz4 -p /sbin/ldconfig 
+
+%package -n libyaz4-devel
+Summary: Z39.50 Library - development package
+Group: Development/Libraries
+Requires: libyaz4 = %{version}, libxml2-devel, libxslt-devel, libicu-devel
+Conflicts: libyaz-devel
+
+%description -n libyaz4-devel
+Development libraries and includes for the libyaz package.
+
+%package -n yaz-illclient
+Summary: ILL client
+Group: Applications/Communication
+Requires: readline, libyaz4 = %{version}
+
+%description -n yaz-illclient
+yaz-illclient: an ISO ILL client.
+
+%package -n yaz-icu
+Summary: Command line utility for ICU utilities of YAZ
+Group: Applications/Communication
+Requires: libyaz4 = %{version}
+
+%description -n yaz-icu
+The yaz-icu program is a command-line based client which exposes the ICU
+chain facility of YAZ.
+
+%prep
+%setup
+
+%build
+
+CFLAGS="$RPM_OPT_FLAGS" \
+ ./configure --prefix=%{_prefix} --libdir=%{_libdir} --mandir=%{_mandir} \
+       --enable-shared --enable-tcpd --with-xslt --with-gnutls --with-icu
+make CFLAGS="$RPM_OPT_FLAGS"
+
+%install
+rm -fr ${RPM_BUILD_ROOT}
+make prefix=${RPM_BUILD_ROOT}/%{_prefix} mandir=${RPM_BUILD_ROOT}/%{_mandir} \
+       libdir=${RPM_BUILD_ROOT}/%{_libdir} install
+rm ${RPM_BUILD_ROOT}/%{_libdir}/*.la
+
+%clean
+rm -fr ${RPM_BUILD_ROOT}
+
+%files
+%defattr(-,root,root)
+%doc README LICENSE NEWS
+%{_bindir}/yaz-client
+%{_bindir}/yaz-ztest
+%{_bindir}/zoomsh
+%{_bindir}/yaz-marcdump
+%{_bindir}/yaz-iconv
+%{_bindir}/yaz-json-parse
+%{_mandir}/man1/yaz-client.*
+%{_mandir}/man1/yaz-json-parse.*
+%{_mandir}/man8/yaz-ztest.*
+%{_mandir}/man1/zoomsh.*
+%{_mandir}/man1/yaz-marcdump.*
+%{_mandir}/man1/yaz-iconv.*
+%{_mandir}/man7/yaz-log.*
+%{_mandir}/man7/bib1-attr.*
+
+%files -n libyaz4
+%defattr(-,root,root)
+%{_libdir}/*.so.*
+
+%files -n libyaz4-devel
+%defattr(-,root,root)
+%{_bindir}/yaz-config
+%{_bindir}/yaz-asncomp
+%{_includedir}/yaz
+%{_libdir}/pkgconfig/yaz.pc
+%{_libdir}/*.so
+%{_libdir}/*.a
+%{_datadir}/aclocal/yaz.m4
+%{_mandir}/man1/yaz-asncomp.*
+%{_mandir}/man7/yaz.*
+%{_mandir}/man?/yaz-config.*
+%{_datadir}/doc/yaz
+%{_datadir}/yaz
+
+%files -n yaz-illclient
+%defattr(-,root,root)
+%{_bindir}/yaz-illclient
+%{_mandir}/man1/yaz-illclient.*
+
+%files -n yaz-icu
+%defattr(-,root,root)
+%{_bindir}/yaz-icu
+%{_mandir}/man1/yaz-icu.*
diff --git a/yaz.spec.in b/yaz.spec.in
deleted file mode 100644 (file)
index 71ac35b..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-Summary: Z39.50 Programs
-Name: yaz
-Version: @VERSION@
-Release: 1
-Requires: libxslt gnutls readline libyaz4 = %{version}
-License: BSD
-Group: Applications/Internet
-Vendor: Index Data ApS <info@indexdata.dk>
-Source: yaz-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-root
-%define TCPWRAPPER tcpd-devel
-%if "%{_vendor}" == "redhat"
-# Fedora requires tcp_wrappers-devel .
-%define TCPWRAPPER tcp_wrappers
-%endif
-BuildRequires: pkgconfig libxml2-devel libxslt-devel gnutls-devel readline-devel libicu-devel %{TCPWRAPPER}
-Packager: Adam Dickmeiss <adam@indexdata.dk>
-URL: http://www.indexdata.com/yaz
-
-%description
-This package contains both a test-server and clients (normal & ssl)
-for the ANSI/NISO Z39.50 protocol for Information Retrieval.
-
-%package -n libyaz4
-Summary: Z39.50 Library
-Group: Libraries
-Requires: libxslt gnutls libicu
-
-%description -n libyaz4
-YAZ is a library for the ANSI/NISO Z39.50 protocol for Information
-Retrieval.
-
-%post -n libyaz4 -p /sbin/ldconfig 
-%postun -n libyaz4 -p /sbin/ldconfig 
-
-%package -n libyaz4-devel
-Summary: Z39.50 Library - development package
-Group: Development/Libraries
-Requires: libyaz4 = %{version} libxml2-devel libxslt-devel libicu-devel
-Conflicts: libyaz-devel
-
-%description -n libyaz4-devel
-Development libraries and includes for the libyaz package.
-
-%package -n yaz-illclient
-Summary: ILL client
-Group: Applications/Communication
-Requires: readline libyaz4 = %{version}
-
-%description -n yaz-illclient
-yaz-illclient: an ISO ILL client.
-
-%package -n yaz-icu
-Summary: Command line utility for ICU utilities of YAZ
-Group: Applications/Communication
-Requires: libyaz4 = %{version}
-
-%description -n yaz-icu
-The yaz-icu program is a command-line based client which exposes the ICU
-chain facility of YAZ.
-
-%prep
-%setup
-
-%build
-
-CFLAGS="$RPM_OPT_FLAGS" \
- ./configure --prefix=%{_prefix} --libdir=%{_libdir} --mandir=%{_mandir} \
-       --enable-shared --enable-tcpd --with-xslt --with-gnutls --with-icu
-make CFLAGS="$RPM_OPT_FLAGS"
-
-%install
-rm -fr ${RPM_BUILD_ROOT}
-make prefix=${RPM_BUILD_ROOT}/%{_prefix} mandir=${RPM_BUILD_ROOT}/%{_mandir} \
-       libdir=${RPM_BUILD_ROOT}/%{_libdir} install
-rm ${RPM_BUILD_ROOT}/%{_libdir}/*.la
-
-%clean
-rm -fr ${RPM_BUILD_ROOT}
-
-%files
-%defattr(-,root,root)
-%doc README LICENSE NEWS
-%{_bindir}/yaz-client
-%{_bindir}/yaz-ztest
-%{_bindir}/zoomsh
-%{_bindir}/yaz-marcdump
-%{_bindir}/yaz-iconv
-%{_bindir}/yaz-json-parse
-%{_mandir}/man1/yaz-client.*
-%{_mandir}/man1/yaz-json-parse.*
-%{_mandir}/man8/yaz-ztest.*
-%{_mandir}/man1/zoomsh.*
-%{_mandir}/man1/yaz-marcdump.*
-%{_mandir}/man1/yaz-iconv.*
-%{_mandir}/man7/yaz-log.*
-%{_mandir}/man7/bib1-attr.*
-
-%files -n libyaz4
-%defattr(-,root,root)
-%{_libdir}/*.so.*
-
-%files -n libyaz4-devel
-%defattr(-,root,root)
-%{_bindir}/yaz-config
-%{_bindir}/yaz-asncomp
-%{_includedir}/yaz
-%{_libdir}/pkgconfig/yaz.pc
-%{_libdir}/*.so
-%{_libdir}/*.a
-%{_datadir}/aclocal/yaz.m4
-%{_mandir}/man1/yaz-asncomp.*
-%{_mandir}/man7/yaz.*
-%{_mandir}/man?/yaz-config.*
-%{_datadir}/doc/yaz
-%{_datadir}/yaz
-
-%files -n yaz-illclient
-%defattr(-,root,root)
-%{_bindir}/yaz-illclient
-%{_mandir}/man1/yaz-illclient.*
-
-%files -n yaz-icu
-%defattr(-,root,root)
-%{_bindir}/yaz-icu
-%{_mandir}/man1/yaz-icu.*
index 218fe33..0a5ed80 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 AM_CPPFLAGS = -I$(top_srcdir)/include $(XML2_CFLAGS)
 
index 19934f6..25c6759 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 3fa2fc7..2a2c9d7 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index f51f4b9..c39e3f4 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index d32d01f..461e848 100644 (file)
@@ -1,17 +1,20 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file zoomsh.c
     \brief ZOOM C command line tool (shell)
 */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include <yaz/wrbuf.h>
+#include <yaz/log.h>
 
 #if HAVE_READLINE_READLINE_H
 #include <readline/readline.h> 
@@ -29,12 +32,12 @@ static void process_events(ZOOM_connection *c)
 {
     int i;
 
-    printf("process_events\n");
+    yaz_log(YLOG_DEBUG, "process_events");
     while ((i = ZOOM_event(MAX_CON, c)) != 0)
     {
         int peek = ZOOM_connection_peek_event(c[i-1]);
         int event = ZOOM_connection_last_event(c[i-1]);
-        printf ("no = %d peek = %d event = %d %s\n", i-1,
+        yaz_log(YLOG_DEBUG, "no = %d peek = %d event = %d %s", i-1,
                 peek,
                 event,
                 ZOOM_get_event_str(event));
index 6e7c034..371a467 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 99e388d..837b5f8 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 63926ad..bbcffd0 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 1bcf83e..ddb43f2 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 769df73..7c2f751 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 1aa4b5f..ff1e563 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 446b6aa..24bcac7 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 50f455c..461b03f 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index c4ca7de..4fb83bd 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 792bfda..51340a6 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 75b53de..60ceb12 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
 
index 55713fd..dbb59cb 100644 (file)
@@ -1,5 +1,5 @@
 ## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
 
 bin_PROGRAMS=yaz-ztest
 noinst_PROGRAMS=gfs-example
index 7843b20..50af043 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file
  * \brief Little toy-thing to genearate an OPAC record with some values
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <ctype.h>
 #include <yaz/wrbuf.h>
index 2e61d43..2aa5d8e 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file
  * \brief Demonstration of Generic Frontend Server API
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
index 441ee34..162f9ab 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file
  * \brief Little toy-thing to read GRS-1 records from a file.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <ctype.h>
index 107e679..3737554 100644 (file)
@@ -1,11 +1,13 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file
  * \brief Little toy-thing to read MARC records from a fixed array.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <ctype.h>
 #include <yaz/wrbuf.h>
index 2ef8921..88e0a21 100644 (file)
@@ -1,11 +1,14 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
-
 /** \file
  * \brief yaz-ztest Generic Frontend Server
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 
 #include <stdio.h>
 #include <math.h>
index 9b4377a..8e6959c 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data.
+ * Copyright (C) 1995-2011 Index Data.
  * All rights reserved.
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met: