From: Dennis Schafroth Date: Thu, 11 Nov 2010 14:13:20 +0000 (+0100) Subject: Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz X-Git-Tag: v4.1.4~14 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=0f073baf2183a54f2a5691e697fde68c9a5f50c5;hp=31c5e5fa92f5980deac3c042b765e4148329cd1b Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz --- diff --git a/.gitignore b/.gitignore index f4ce873..c4ee00a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ config.guess config.sub Default *~ +.settings \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index d38140d..12d5b23 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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/NEWS b/NEWS index fed8f3b..86e4e39 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +--- 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 @@ -7,6 +13,8 @@ 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. diff --git a/buildconf.sh b/buildconf.sh index 9671592..f844bce 100755 --- a/buildconf.sh +++ b/buildconf.sh @@ -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 diff --git a/client/admin.c b/client/admin.c index 40a626b..d62b830 100644 --- a/client/admin.c +++ b/client/admin.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/client/bertorture.c b/client/bertorture.c index 599e26f..bd49e93 100644 --- a/client/bertorture.c +++ b/client/bertorture.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #if HAVE_SYS_TYPES_H diff --git a/client/client.c b/client/client.c index c9351d2..445dc52 100644 --- a/client/client.c +++ b/client/client.c @@ -5,6 +5,9 @@ /** \file client.c * \brief yaz-client program */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/client/fhistory.c b/client/fhistory.c index 9eecb27..2a2e124 100644 --- a/client/fhistory.c +++ b/client/fhistory.c @@ -5,6 +5,9 @@ /** \file fhistory.c * \brief file history implementation */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/client/tabcomplete.c b/client/tabcomplete.c index 31c696e..f866d56 100644 --- a/client/tabcomplete.c +++ b/client/tabcomplete.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/configure.ac b/configure.ac index 8675960..050299b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,8 @@ dnl This file is part of the YAZ toolkit. dnl Copyright (C) 1995-2010 Index Data AC_PREREQ([2.60]) -AC_INIT([yaz],[4.1.1],[yaz-help@indexdata.dk]) +AC_INIT([yaz],[4.1.2],[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 ],[ 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 #include ],[ 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);}'` diff --git a/debian/changelog b/debian/changelog index d959eff..7bc857c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +yaz (4.1.2-1indexdata) unstable; urgency=low + + * Upstream. + + -- Adam Dickmeiss Tue, 02 Nov 2010 09:51:51 +0100 + yaz (4.1.1-1indexdata) unstable; urgency=low * Upstream. diff --git a/debian/rules b/debian/rules index a6854cf..144918f 100755 --- a/debian/rules +++ b/debian/rules @@ -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.0)' dh_installdeb dh_shlibdeps -l debian/libyaz4/usr/lib dh_gencontrol diff --git a/doc/common b/doc/common index 00de5ca..cc59b50 160000 --- a/doc/common +++ b/doc/common @@ -1 +1 @@ -Subproject commit 00de5ca16beac9c3ac135ff92ff719b86b0c6df9 +Subproject commit cc59b50a147656750bff1385f50fd6ad656d77e4 diff --git a/doc/server.xml b/doc/server.xml index 18a4f27..52033bf 100644 --- a/doc/server.xml +++ b/doc/server.xml @@ -818,9 +818,11 @@ typedef struct bend_scan_rr { - For TCP/IP and SSL, the special hostname @ - (at sign) is mapped to the address INADDR_ANY, - which causes the server to listen on any local interface. + For TCP/IP and SSL, the special hostnames @ and + @6 are mapped to the addresses + INADDR_ANY (IPV4) and + IN6ADDR_ANY_INIT (IPV6) + respectively. Running the GFS on Unix diff --git a/include/.gitignore b/include/.gitignore index 282522d..56344fd 100644 --- a/include/.gitignore +++ b/include/.gitignore @@ -1,2 +1,5 @@ Makefile Makefile.in +config.h +config.h.in +stamp-h1 \ No newline at end of file diff --git a/include/yaz/Makefile.am b/include/yaz/Makefile.am index f34b2a7..3571f84 100644 --- a/include/yaz/Makefile.am +++ b/include/yaz/Makefile.am @@ -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 diff --git a/include/yaz/stemmer.h b/include/yaz/stemmer.h new file mode 100644 index 0000000..6e51cae --- /dev/null +++ b/include/yaz/stemmer.h @@ -0,0 +1,61 @@ +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2010 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 +#include +#include +#include + +#include /* some more string fcns*/ +#include /* 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 diff --git a/libstemmer_c b/libstemmer_c new file mode 160000 index 0000000..368f4a2 --- /dev/null +++ b/libstemmer_c @@ -0,0 +1 @@ +Subproject commit 368f4a253716e312b66209d61c927d5039c51287 diff --git a/src/Makefile.am b/src/Makefile.am index d0060df..c189246 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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../libstemmer_c/include libyaz_icu_la_LIBADD = libyaz.la $(ICU_LIBS) AM_YFLAGS=-p cql_ @@ -115,8 +115,19 @@ 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/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_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 diff --git a/src/ccl_stop_words.c b/src/ccl_stop_words.c index 9d06f98..3165378 100644 --- a/src/ccl_stop_words.c +++ b/src/ccl_stop_words.c @@ -6,6 +6,9 @@ * \file ccl_stop_words.c * \brief Removes stop words from terms in RPN tree */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/cclerrms.c b/src/cclerrms.c index 2d69c39..c6553f5 100644 --- a/src/cclerrms.c +++ b/src/cclerrms.c @@ -9,6 +9,9 @@ * This source file implements mapping between CCL error code and * their string equivalents. */ +#if HAVE_CONFIG_H +#include +#endif #include diff --git a/src/cclfind.c b/src/cclfind.c index 87a216c..0a2c272 100644 --- a/src/cclfind.c +++ b/src/cclfind.c @@ -11,6 +11,9 @@ * of lookahead in the handling of relational operations.. So * it's not really pure. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/cclptree.c b/src/cclptree.c index 98e6bb8..057c92b 100644 --- a/src/cclptree.c +++ b/src/cclptree.c @@ -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 +#endif #include #include diff --git a/src/cclqfile.c b/src/cclqfile.c index a2bb336..246b832 100644 --- a/src/cclqfile.c +++ b/src/cclqfile.c @@ -6,6 +6,9 @@ * \file cclqfile.c * \brief Implements parsing of CCL qualifier specs in files */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/cclqual.c b/src/cclqual.c index bdc499d..28ed642 100644 --- a/src/cclqual.c +++ b/src/cclqual.c @@ -6,6 +6,10 @@ * \file cclqual.c * \brief Implements CCL qualifier utilities */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/src/cclstr.c b/src/cclstr.c index 1f46616..037be1c 100644 --- a/src/cclstr.c +++ b/src/cclstr.c @@ -6,6 +6,9 @@ * \file cclstr.c * \brief Implements CCL string compare utilities */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include diff --git a/src/ccltoken.c b/src/ccltoken.c index b784295..a793f8b 100644 --- a/src/ccltoken.c +++ b/src/ccltoken.c @@ -6,6 +6,9 @@ * \file ccltoken.c * \brief Implements CCL lexical analyzer (scanner) */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/cclxmlconfig.c b/src/cclxmlconfig.c index d6a8de5..37f0bbe 100644 --- a/src/cclxmlconfig.c +++ b/src/cclxmlconfig.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** \file cclxmlconfig.c \brief XML configuration for CCL */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/charconv.tcl b/src/charconv.tcl index 5500f59..8f8cc9e 100644 --- a/src/charconv.tcl +++ b/src/charconv.tcl @@ -16,6 +16,11 @@ proc preamble_trie {ofilehandle ifiles ofile} { puts $f " Generated automatically by charconv.tcl" puts $f "*/" puts $f "\#include " + + puts $f "\#if HAVE_CONFIG_H" + puts $f "\#include " + puts $f "\#endif" + puts $f " struct yaz_iconv_trie_flat { char from\[6\]; diff --git a/src/charneg.c b/src/charneg.c index 48b168d..8467ba0 100644 --- a/src/charneg.c +++ b/src/charneg.c @@ -2,13 +2,16 @@ * Copyright (C) 1995-2010 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 +#endif + #include #include #include diff --git a/src/comstack.c b/src/comstack.c index 0df8678..a5f969d 100644 --- a/src/comstack.c +++ b/src/comstack.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file comstack.c * \brief Implements Generic COMSTACK functions */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/copy_types.c b/src/copy_types.c index dc34993..dd2558d 100644 --- a/src/copy_types.c +++ b/src/copy_types.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** \file copy_types.c \brief Copies various Z39.50 types */ +#if HAVE_CONFIG_H +#include +#endif #include diff --git a/src/cql.y b/src/cql.y index 25a4287..6958306 100644 --- a/src/cql.y +++ b/src/cql.y @@ -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 +#endif #include #include #include diff --git a/src/cqlstdio.c b/src/cqlstdio.c index 6d68439..c3c0a48 100644 --- a/src/cqlstdio.c +++ b/src/cqlstdio.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file cqlstdio.c * \brief Implements query stream reading using FILE handle. */ +#if HAVE_CONFIG_H +#include +#endif #include diff --git a/src/cqlstrer.c b/src/cqlstrer.c index 0dac583..dec4cbc 100644 --- a/src/cqlstrer.c +++ b/src/cqlstrer.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 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 +#endif #include diff --git a/src/cqlstring.c b/src/cqlstring.c index 762e5fa..ae9ffd5 100644 --- a/src/cqlstring.c +++ b/src/cqlstring.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 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 +#endif #include diff --git a/src/cqltransform.c b/src/cqltransform.c index 55c3366..8f24f19 100644 --- a/src/cqltransform.c +++ b/src/cqltransform.c @@ -2,7 +2,6 @@ * Copyright (C) 1995-2010 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 +#endif #include #include diff --git a/src/cqlutil.c b/src/cqlutil.c index b9ff63f..c20eb7f 100644 --- a/src/cqlutil.c +++ b/src/cqlutil.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file cqlutil.c * \brief Implements CQL tree node utilities. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/csvtodiag.tcl b/src/csvtodiag.tcl index 3124ba9..ce1db5f 100644 --- a/src/csvtodiag.tcl +++ b/src/csvtodiag.tcl @@ -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 " + puts $cfile "\#endif" + puts $cfile " #include \"diag-entry.h\" \#include \"[lindex $ifiles 2]\" diff --git a/src/eventl.c b/src/eventl.c index b5ef123..75d738c 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -2,7 +2,6 @@ * Copyright (C) 1995-2010 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 +#endif #include #include diff --git a/src/file_glob.c b/src/file_glob.c index 065b5c5..fb92e0a 100644 --- a/src/file_glob.c +++ b/src/file_glob.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -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; } diff --git a/src/grs1disp.c b/src/grs1disp.c index 1fd2727..e73b1ed 100644 --- a/src/grs1disp.c +++ b/src/grs1disp.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file grs1disp.c * \brief Implements display of GRS-1 records */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/http.c b/src/http.c index 4362c75..9b78cdd 100644 --- a/src/http.c +++ b/src/http.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file http.c * \brief Implements HTTP decoding */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/icu_chain.c b/src/icu_chain.c index 8ae80fc..4bf1f14 100644 --- a/src/icu_chain.c +++ b/src/icu_chain.c @@ -17,8 +17,11 @@ #include -#include +#include +#include +#include +#include #include #include #include @@ -29,11 +32,12 @@ 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); diff --git a/src/ill-get.c b/src/ill-get.c index 87e5e1a..2fe5b91 100644 --- a/src/ill-get.c +++ b/src/ill-get.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file ill-get.c * \brief Implements ILL package creator utilities */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/json.c b/src/json.c index 91cb4e4..79231e0 100644 --- a/src/json.c +++ b/src/json.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file json.c * \brief JSON encoding/decoding */ +#if HAVE_CONFIG_H +#include +#endif #include diff --git a/src/log.c b/src/log.c index b001c31..580de46 100644 --- a/src/log.c +++ b/src/log.c @@ -36,8 +36,16 @@ 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); diff --git a/src/logrpn.c b/src/logrpn.c index e70db5f..a224ef2 100644 --- a/src/logrpn.c +++ b/src/logrpn.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file logrpn.c * \brief Implements Z39.50 Query Printing */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/match_glob.c b/src/match_glob.c index f498139..43f78cc 100644 --- a/src/match_glob.c +++ b/src/match_glob.c @@ -2,12 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file * \brief Glob expression match */ - +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/oidtoc.tcl b/src/oidtoc.tcl index 314a0d9..fd35d0f 100644 --- a/src/oidtoc.tcl +++ b/src/oidtoc.tcl @@ -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 " + puts $cfile "\#endif" + puts $cfile "\#include " puts $cfile "" # To avoid LNK4049 diff --git a/src/opacdisp.c b/src/opacdisp.c index c596f65..e33c715 100644 --- a/src/opacdisp.c +++ b/src/opacdisp.c @@ -6,6 +6,9 @@ * \file opacdisp.c * \brief Implements OPAC record display */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/otherinfo.c b/src/otherinfo.c index 80cb19d..5e6ab78 100644 --- a/src/otherinfo.c +++ b/src/otherinfo.c @@ -6,6 +6,10 @@ * \file otherinfo.c * \brief Implements Z39.50 OtherInfo utilities */ +#if HAVE_CONFIG_H +#include +#endif + #include #include diff --git a/src/poll.c b/src/poll.c index 08e5d46..5f499a1 100644 --- a/src/poll.c +++ b/src/poll.c @@ -6,6 +6,9 @@ * \file * \brief Select, poll wrapper */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/pquery.c b/src/pquery.c index 65dcdd1..41a369d 100644 --- a/src/pquery.c +++ b/src/pquery.c @@ -6,6 +6,10 @@ * \file pquery.c * \brief Implements PQF parsing */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/src/prt-ext.c b/src/prt-ext.c index ccd2999..6d0d66a 100644 --- a/src/prt-ext.c +++ b/src/prt-ext.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 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 +#endif #include diff --git a/src/query-charset.c b/src/query-charset.c index fed4ba5..308c667 100644 --- a/src/query-charset.c +++ b/src/query-charset.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** \file query-charset.c \brief converts General Terms in RPN queries */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/querytowrbuf.c b/src/querytowrbuf.c index 3caf21b..80172ee 100644 --- a/src/querytowrbuf.c +++ b/src/querytowrbuf.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 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 +#endif #include #include diff --git a/src/record_render.c b/src/record_render.c index d4180dd..8fbf625 100644 --- a/src/record_render.c +++ b/src/record_render.c @@ -6,6 +6,9 @@ * \file record_render.c * \brief Render Z39.50 records (NamePlusRecord) */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/requestq.c b/src/requestq.c index 2c93d92..f4b6c55 100644 --- a/src/requestq.c +++ b/src/requestq.c @@ -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 +#endif #include diff --git a/src/rpn2cql.c b/src/rpn2cql.c index 68b359a..40dafc5 100644 --- a/src/rpn2cql.c +++ b/src/rpn2cql.c @@ -2,12 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file * \brief Implements RPN to CQL conversion - * */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/rpn2solr.c b/src/rpn2solr.c index de485ab..24b2a14 100644 --- a/src/rpn2solr.c +++ b/src/rpn2solr.c @@ -2,12 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file * \brief Implements RPN to SOLR conversion - * */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/sc.c b/src/sc.c index 4014471..e0d96f5 100644 --- a/src/sc.c +++ b/src/sc.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file sc.c * \brief Windows Service Control */ +#if HAVE_CONFIG_H +#include +#endif #ifdef WIN32 #include diff --git a/src/sc_test.c b/src/sc_test.c index e06a6ba..cd5977d 100644 --- a/src/sc_test.c +++ b/src/sc_test.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 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 +#endif #ifdef WIN32 #include diff --git a/src/seshigh.c b/src/seshigh.c index 378b130..64854a6 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -25,6 +25,9 @@ * minimize memory allocation/deallocation during normal operation. * */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/snprintf.c b/src/snprintf.c index 2aedb83..a9f6ba0 100644 --- a/src/snprintf.c +++ b/src/snprintf.c @@ -6,6 +6,9 @@ * \file snprintf.c * \brief snprintf wrapper */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/soap.c b/src/soap.c index 59930d2..1b1452c 100644 --- a/src/soap.c +++ b/src/soap.c @@ -9,6 +9,9 @@ * This implements encoding and decoding of SOAP packages using * Libxml2. */ +#if HAVE_CONFIG_H +#include +#endif #include diff --git a/src/solr.c b/src/solr.c index 9b77eee..b1398e6 100644 --- a/src/solr.c +++ b/src/solr.c @@ -3,9 +3,12 @@ * 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 +#endif #include #include diff --git a/src/solrtransform.c b/src/solrtransform.c index 2d41044..1b323f4 100644 --- a/src/solrtransform.c +++ b/src/solrtransform.c @@ -2,21 +2,13 @@ * Copyright (C) 1995-2010 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 +#endif #include #include diff --git a/src/sortspec.c b/src/sortspec.c index d469718..4c62193 100644 --- a/src/sortspec.c +++ b/src/sortspec.c @@ -6,6 +6,9 @@ * \file sortspec.c * \brief Implements SortSpec parsing. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/srw.c b/src/srw.c index 93ff77c..a34e483 100644 --- a/src/srw.c +++ b/src/srw.c @@ -6,6 +6,9 @@ * \file srw.c * \brief Implements SRW/SRU package encoding and decoding */ +#if HAVE_CONFIG_H +#include +#endif #include #if YAZ_HAVE_XML2 diff --git a/src/srwutil.c b/src/srwutil.c index 2746199..75512ca 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -6,6 +6,9 @@ * \file srwutil.c * \brief Implements SRW/SRU utilities. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/statserv.c b/src/statserv.c index d340a17..faca797 100644 --- a/src/statserv.c +++ b/src/statserv.c @@ -8,6 +8,10 @@ * \brief Implements GFS logic */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/src/stemmer.c b/src/stemmer.c new file mode 100644 index 0000000..5b8097f --- /dev/null +++ b/src/stemmer.c @@ -0,0 +1,115 @@ + + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#if YAZ_HAVE_ICU + +#include + +#include + +#include + +#include + +#include /* some more string fcns*/ +#include /* char names */ + +enum stemmer_implementation { + yaz_no_operation, + yaz_snowball +}; +struct yaz_stemmer_t +{ + int implementation; + // Required for cloning. + char *locale; + char *rule; + union { + 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; + yaz_log(YLOG_DEBUG, "create snowball stemmer: algoritm %s charenc %s ", algorithm, charenc); + if (stemmer == 0) { + *status = U_ILLEGAL_ARGUMENT_ERROR; + yaz_log(YLOG_DEBUG, "failed to create stemmer. Creating NOP stemmer"); + + return 0; + } + 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; + 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 *cstr = (const char *) sb_symbol; + icu_utf16_from_utf8_cstr(dst, cstr , status); + } + } + icu_buf_utf8_destroy(utf8_buf); + return ; + break; + } + default: { + // Default return the same as given. + icu_buf_utf16_copy(dst, src); + } + } +} + +void yaz_stemmer_destroy(yaz_stemmer_p stemmer) { + 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 */ diff --git a/src/tcpdchk.c b/src/tcpdchk.c index 24bf471..a97134f 100644 --- a/src/tcpdchk.c +++ b/src/tcpdchk.c @@ -7,6 +7,10 @@ * \brief Implements TCP WRAPPER check. */ +#if HAVE_CONFIG_H +#include +#endif + #include #include diff --git a/src/tcpip.c b/src/tcpip.c index dc1d127..b0ea098 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -6,6 +6,9 @@ * \file tcpip.c * \brief Implements TCP/IP + SSL COMSTACK. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/tokenizer.c b/src/tokenizer.c index cf76c89..bece9a8 100644 --- a/src/tokenizer.c +++ b/src/tokenizer.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file tokenizer.c * \brief Simple tokenizer system. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/unix.c b/src/unix.c index 8006a61..56dacc4 100644 --- a/src/unix.c +++ b/src/unix.c @@ -6,6 +6,9 @@ * \file unix.c * \brief Implements UNIX domain socket COMSTACK */ +#if HAVE_CONFIG_H +#include +#endif #ifndef WIN32 diff --git a/src/uri.c b/src/uri.c index cb4fc25..5654dae 100644 --- a/src/uri.c +++ b/src/uri.c @@ -3,9 +3,12 @@ * 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 +#endif #include #include diff --git a/src/waislen.c b/src/waislen.c index 9e44ab2..36f9798 100644 --- a/src/waislen.c +++ b/src/waislen.c @@ -6,6 +6,9 @@ * \file waislen.c * \brief Implements WAIS package handling */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/xcqlutil.c b/src/xcqlutil.c index 32fde13..30be8ac 100644 --- a/src/xcqlutil.c +++ b/src/xcqlutil.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** * \file xcqlutil.c * \brief Implements CQL to XCQL conversion. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/xmlerror.c b/src/xmlerror.c index 26b5840..efb7ebc 100644 --- a/src/xmlerror.c +++ b/src/xmlerror.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** \file \brief Log XML / XSLT Errors via yaz_log */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/xmlquery.c b/src/xmlquery.c index e4d287e..2a401e1 100644 --- a/src/xmlquery.c +++ b/src/xmlquery.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** \file xmlquery.c \brief Query / XML conversions */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/yaz-ccl.c b/src/yaz-ccl.c index 4bffebe..011be37 100644 --- a/src/yaz-ccl.c +++ b/src/yaz-ccl.c @@ -6,6 +6,9 @@ * \file yaz-ccl.c * \brief Implements CCL node tree to RPN converson. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/zgdu.c b/src/zgdu.c index d414406..61f93b0 100644 --- a/src/zgdu.c +++ b/src/zgdu.c @@ -2,11 +2,13 @@ * Copyright (C) 1995-2010 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 +#endif #include #include diff --git a/src/zget.c b/src/zget.c index 03066a8..a7b26e0 100644 --- a/src/zget.c +++ b/src/zget.c @@ -6,6 +6,9 @@ * \file zget.c * \brief Implements Z39.50 package creator utilities */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/zoom-c.c b/src/zoom-c.c index d557015..5188381 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -6,6 +6,9 @@ * \file zoom-c.c * \brief Implements ZOOM C interface. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/zoom-event.c b/src/zoom-event.c index bc1c84e..1a89f84 100644 --- a/src/zoom-event.c +++ b/src/zoom-event.c @@ -6,6 +6,9 @@ * \file zoom-event.c * \brief Implements ZOOM Event stuff */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/zoom-opt.c b/src/zoom-opt.c index 602f57d..0cda581 100644 --- a/src/zoom-opt.c +++ b/src/zoom-opt.c @@ -6,6 +6,10 @@ * \file zoom-opt.c * \brief Implements ZOOM options handling */ +#if HAVE_CONFIG_H +#include +#endif + #include #include "zoom-p.h" diff --git a/src/zoom-query.c b/src/zoom-query.c index 1049873..4553ff3 100644 --- a/src/zoom-query.c +++ b/src/zoom-query.c @@ -6,6 +6,9 @@ * \file zoom-query.c * \brief Implements ZOOM C query interface. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/zoom-record-cache.c b/src/zoom-record-cache.c index 9bc4e15..b3ac730 100644 --- a/src/zoom-record-cache.c +++ b/src/zoom-record-cache.c @@ -6,6 +6,9 @@ * \file zoom-record-cache.c * \brief Implements ZOOM record caching */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/zoom-socket.c b/src/zoom-socket.c index c0b670f..3916b7a 100644 --- a/src/zoom-socket.c +++ b/src/zoom-socket.c @@ -6,6 +6,9 @@ * \file zoom-socket.c * \brief Implements ZOOM C socket interface. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/zoom-sru.c b/src/zoom-sru.c index c6d11e7..05b671c 100644 --- a/src/zoom-sru.c +++ b/src/zoom-sru.c @@ -6,6 +6,9 @@ * \file zoom-sru.c * \brief Implements ZOOM SRU */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/zoom-z3950.c b/src/zoom-z3950.c index d13b336..5d6eb2f 100644 --- a/src/zoom-z3950.c +++ b/src/zoom-z3950.c @@ -6,6 +6,9 @@ * \file zoom-z3950.c * \brief Implements ZOOM Z39.50 handling */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/Makefile.am b/test/Makefile.am index 23b2f12..1fb2c35 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 diff --git a/test/test_ccl.c b/test/test_ccl.c index 9ebebad..f3b04b3 100644 --- a/test/test_ccl.c +++ b/test/test_ccl.c @@ -2,8 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - -/* CCL test */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_comstack.c b/test/test_comstack.c index eee72f8..df53b2e 100644 --- a/test/test_comstack.c +++ b/test/test_comstack.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_file_glob.c b/test/test_file_glob.c index 8cfc3c3..a679a68 100644 --- a/test/test_file_glob.c +++ b/test/test_file_glob.c @@ -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); diff --git a/test/test_iconv.c b/test/test_iconv.c index 352033a..857dce7 100644 --- a/test/test_iconv.c +++ b/test/test_iconv.c @@ -2,7 +2,6 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - #if HAVE_CONFIG_H #include #endif diff --git a/test/test_icu.c b/test/test_icu.c index 2ad005c..8be8869 100644 --- a/test/test_icu.c +++ b/test/test_icu.c @@ -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][]")); diff --git a/test/test_json.c b/test/test_json.c index d402c0e..b33c354 100644 --- a/test/test_json.c +++ b/test/test_json.c @@ -1,7 +1,15 @@ +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2010 Index Data + * See the file LICENSE for details. + */ /** * \file * \brief JSON test */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/test/test_log.c b/test/test_log.c index d4a83e5..4b373a6 100644 --- a/test/test_log.c +++ b/test/test_log.c @@ -2,6 +2,10 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/test/test_match_glob.c b/test/test_match_glob.c index 8421752..228402b 100644 --- a/test/test_match_glob.c +++ b/test/test_match_glob.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_matchstr.c b/test/test_matchstr.c index bdb9751..6674644 100644 --- a/test/test_matchstr.c +++ b/test/test_matchstr.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_mutex.c b/test/test_mutex.c index a4483fc..9602c56 100644 --- a/test/test_mutex.c +++ b/test/test_mutex.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_odr.c b/test/test_odr.c index 63ad290..af4a1d4 100644 --- a/test/test_odr.c +++ b/test/test_odr.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include diff --git a/test/test_odrstack.c b/test/test_odrstack.c index e81e4f9..f9a16aa 100644 --- a/test/test_odrstack.c +++ b/test/test_odrstack.c @@ -2,6 +2,10 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/test/test_oid.c b/test/test_oid.c index d00c23a..898176c 100644 --- a/test/test_oid.c +++ b/test/test_oid.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_pquery.c b/test/test_pquery.c index 313df6b..7692857 100644 --- a/test/test_pquery.c +++ b/test/test_pquery.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_query_charset.c b/test/test_query_charset.c index e3c83fc..cc87d53 100644 --- a/test/test_query_charset.c +++ b/test/test_query_charset.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_rpn2cql.c b/test/test_rpn2cql.c index 7aecbb0..e5a0afc 100644 --- a/test/test_rpn2cql.c +++ b/test/test_rpn2cql.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_rpn2solr.c b/test/test_rpn2solr.c index 029552c..b4a690e 100644 --- a/test/test_rpn2solr.c +++ b/test/test_rpn2solr.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_soap1.c b/test/test_soap1.c index eb2ba11..e237a74 100644 --- a/test/test_soap1.c +++ b/test/test_soap1.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #if YAZ_HAVE_XML2 diff --git a/test/test_soap2.c b/test/test_soap2.c index 620f5f3..2f64a9a 100644 --- a/test/test_soap2.c +++ b/test/test_soap2.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_timing.c b/test/test_timing.c index edbca1d..28e2286 100644 --- a/test/test_timing.c +++ b/test/test_timing.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_wrbuf.c b/test/test_wrbuf.c index af06e40..d7013e2 100644 --- a/test/test_wrbuf.c +++ b/test/test_wrbuf.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_xml_include.c b/test/test_xml_include.c index 7a289be..10596cc 100644 --- a/test/test_xml_include.c +++ b/test/test_xml_include.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/test_xmlquery.c b/test/test_xmlquery.c index 908adc6..1096d13 100644 --- a/test/test_xmlquery.c +++ b/test/test_xmlquery.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/test/tsticu-2.input b/test/tsticu-2.input new file mode 100644 index 0000000..579a976 --- /dev/null +++ b/test/tsticu-2.input @@ -0,0 +1,2 @@ +`a' +``a'' diff --git a/test/tsticu-2.output b/test/tsticu-2.output new file mode 100644 index 0000000..b5ee584 --- /dev/null +++ b/test/tsticu-2.output @@ -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 index 0000000..eea85bd --- /dev/null +++ b/test/tsticu-2.xml @@ -0,0 +1,8 @@ + + +$back = \` ; +$back $back > “ ; # generate right d.q.m. (double quotation mark) +$back > ‘ ; + + + diff --git a/test/tsticu-3.input b/test/tsticu-3.input new file mode 100644 index 0000000..989f89d --- /dev/null +++ b/test/tsticu-3.input @@ -0,0 +1,2 @@ +men running +he runs diff --git a/test/tsticu-3.output b/test/tsticu-3.output new file mode 100644 index 0000000..3139c0b --- /dev/null +++ b/test/tsticu-3.output @@ -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 index 0000000..f7db5c7 --- /dev/null +++ b/test/tsticu-3.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/util/benchmark.c b/util/benchmark.c index eff9d70..f50c0ac 100644 --- a/util/benchmark.c +++ b/util/benchmark.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/util/cclsh.c b/util/cclsh.c index 4d24d9c..bb69faf 100644 --- a/util/cclsh.c +++ b/util/cclsh.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/util/cql2pqf.c b/util/cql2pqf.c index d194da3..9f76c3a 100644 --- a/util/cql2pqf.c +++ b/util/cql2pqf.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/util/cql2xcql.c b/util/cql2xcql.c index 23afa1a..6474dfd 100644 --- a/util/cql2xcql.c +++ b/util/cql2xcql.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/util/json-parse.c b/util/json-parse.c index ce1da8b..dae869e 100644 --- a/util/json-parse.c +++ b/util/json-parse.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/util/srwtst.c b/util/srwtst.c index bace12a..b37b302 100644 --- a/util/srwtst.c +++ b/util/srwtst.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/util/yaz-asncomp b/util/yaz-asncomp index d02bd9d..2c32c00 100755 --- a/util/yaz-asncomp +++ b/util/yaz-asncomp @@ -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 " + puts $file(outc) "\#endif" + puts $file(outc) {} puts $file(outh) "/** \\file $inf(h-file)" diff --git a/util/yaz-icu.c b/util/yaz-icu.c index a8c43ce..2ca85b4 100644 --- a/util/yaz-icu.c +++ b/util/yaz-icu.c @@ -138,19 +138,20 @@ static void print_icu_converters(const struct config_t *p_config) if (p_config->xmloutput) fprintf(config.outfile, "\n", count, ucnv_getDefaultName()); - else { + else + { fprintf(config.outfile, "Available ICU converters: %d\n", count); fprintf(config.outfile, "Default ICU Converter is: '%s'\n", ucnv_getDefaultName()); } - for(i=0;ixmloutput) fprintf(config.outfile, "\n", ucnv_getAvailableName(i)); else - fprintf(config.outfile, "%s ", ucnv_getAvailableName(i)); + fprintf(config.outfile, "%s\n", ucnv_getAvailableName(i)); } if (p_config->xmloutput) @@ -177,13 +178,11 @@ static void print_icu_transliterators(const struct config_t *p_config) if (p_config->xmloutput) fprintf(config.outfile, "\n", name); else - fprintf(config.outfile, " %s", name); + fprintf(config.outfile, "%s\n", name); } uenum_close(en); if (p_config->xmloutput) - { fprintf(config.outfile, "\n"); - } else { fprintf(config.outfile, "\n\nUnicode Set Patterns:\n" @@ -223,10 +222,8 @@ 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" ); @@ -283,8 +280,13 @@ static void print_icu_xml_locales(const struct config_t *p_config) fprintf(config.outfile, "\n", count, uloc_getDefault(), ucol_countAvailable()); } + else + { + fprintf(config.outfile, "Available ICU locales: %d\n", count); + fprintf(config.outfile, "Default locale is: %s\n", uloc_getDefault()); + } - for(i=0;ixmloutput) fprintf(config.outfile, "\n"); else fprintf(config.outfile, "\n"); - if(U_FAILURE(status)) + if (U_FAILURE(status)) { fprintf(stderr, "ICU Error: %d %s\n", status, u_errorName(status)); exit(2); diff --git a/util/yaz-illclient.c b/util/yaz-illclient.c index 979400c..a77b208 100644 --- a/util/yaz-illclient.c +++ b/util/yaz-illclient.c @@ -31,6 +31,9 @@ * * */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/util/yaz-xmlquery.c b/util/yaz-xmlquery.c index dae8105..241a4e7 100644 --- a/util/yaz-xmlquery.c +++ b/util/yaz-xmlquery.c @@ -2,6 +2,9 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/zoom/zoomsh.c b/zoom/zoomsh.c index d32d01f..7d93701 100644 --- a/zoom/zoomsh.c +++ b/zoom/zoomsh.c @@ -2,16 +2,19 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** \file zoomsh.c \brief ZOOM C command line tool (shell) */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include #include #include +#include #if HAVE_READLINE_READLINE_H #include @@ -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)); diff --git a/ztest/dummy-opac.c b/ztest/dummy-opac.c index 7843b20..3fdf19d 100644 --- a/ztest/dummy-opac.c +++ b/ztest/dummy-opac.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 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 +#endif #include #include diff --git a/ztest/gfs-example.c b/ztest/gfs-example.c index 2e61d43..801c28c 100644 --- a/ztest/gfs-example.c +++ b/ztest/gfs-example.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** \file * \brief Demonstration of Generic Frontend Server API */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/ztest/read-grs.c b/ztest/read-grs.c index 441ee34..4821738 100644 --- a/ztest/read-grs.c +++ b/ztest/read-grs.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 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 +#endif #include #include diff --git a/ztest/read-marc.c b/ztest/read-marc.c index 107e679..9cf0a8c 100644 --- a/ztest/read-marc.c +++ b/ztest/read-marc.c @@ -2,10 +2,12 @@ * Copyright (C) 1995-2010 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 +#endif #include #include diff --git a/ztest/ztest.c b/ztest/ztest.c index 2ef8921..f27cb92 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -2,10 +2,13 @@ * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ - /** \file * \brief yaz-ztest Generic Frontend Server */ +#if HAVE_CONFIG_H +#include +#endif + #include #include