From: Adam Dickmeiss Date: Wed, 30 Mar 2011 14:03:04 +0000 (+0200) Subject: Merge branch 'master' of ssh://git.indexdata.com:222/home/git/pub/yaz X-Git-Tag: v4.2.0~54 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=7c182a7a93e1f99fad3403946776c7167dbb7e08;hp=74f55d91dabcfa4f82e481e1a49ac57937d82d2f Merge branch 'master' of ssh://git.indexdata.com:222/home/git/pub/yaz --- diff --git a/.gitignore b/.gitignore index f4ce873..c765f3f 100644 --- a/.gitignore +++ b/.gitignore @@ -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 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/IDMETA b/IDMETA index 3459caa..423a6de 100644 --- 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 --- 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: diff --git a/Makefile.am b/Makefile.am index 907d934..979716a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 --- 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. diff --git a/buildconf.sh b/buildconf.sh index 9671592..c82194a 100755 --- a/buildconf.sh +++ b/buildconf.sh @@ -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 < +#endif #include #include diff --git a/client/admin.h b/client/admin.h index 50a3578..a2326e2 100644 --- a/client/admin.h +++ b/client/admin.h @@ -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/client/bertorture.c b/client/bertorture.c index 599e26f..4d51bd2 100644 --- a/client/bertorture.c +++ b/client/bertorture.c @@ -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 +#endif #include #if HAVE_SYS_TYPES_H diff --git a/client/client.c b/client/client.c index c9351d2..71432b4 100644 --- a/client/client.c +++ b/client/client.c @@ -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 +#endif #include #include @@ -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 diff --git a/client/fhistory.c b/client/fhistory.c index 9eecb27..a34490a 100644 --- a/client/fhistory.c +++ b/client/fhistory.c @@ -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 +#endif #include #include diff --git a/client/fhistory.h b/client/fhistory.h index b4e4902..d3481e6 100644 --- a/client/fhistory.h +++ b/client/fhistory.h @@ -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/client/tabcomplete.c b/client/tabcomplete.c index 31c696e..be68db4 100644 --- a/client/tabcomplete.c +++ b/client/tabcomplete.c @@ -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 +#endif #include #include diff --git a/client/tabcomplete.h b/client/tabcomplete.h index acd3abe..c99b46f 100644 --- a/client/tabcomplete.h +++ b/client/tabcomplete.h @@ -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/configure.ac b/configure.ac index 8675960..441b971 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 +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 ],[ 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);}'` @@ -404,7 +395,6 @@ dnl ------ Makefiles dnl AC_OUTPUT([ Makefile -yaz.spec src/Makefile test/Makefile util/Makefile diff --git a/debian/changelog b/debian/changelog index d959eff..dc2cf57 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,39 @@ +yaz (4.1.7-1indexdata) unstable; urgency=low + + * Upstream. + + -- Adam Dickmeiss Tue, 15 Mar 2011 13:59:18 +0100 + +yaz (4.1.6-1indexdata) unstable; urgency=low + + * Upstream. + + -- Adam Dickmeiss Thu, 10 Mar 2011 10:25:48 +0100 + +yaz (4.1.5-1indexdata) unstable; urgency=low + + * Upstream. + + -- Adam Dickmeiss Tue, 08 Mar 2011 13:53:17 +0100 + +yaz (4.1.4-1indexdata) unstable; urgency=low + + * Upstream. + + -- Adam Dickmeiss Mon, 21 Feb 2011 12:51:04 +0100 + +yaz (4.1.3-1indexdata) unstable; urgency=low + + * Upstream. + + -- Adam Dickmeiss Thu, 27 Jan 2011 13:56:54 +0100 + +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..db5e508 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.5)' dh_installdeb dh_shlibdeps -l debian/libyaz4/usr/lib dh_gencontrol diff --git a/doc/Makefile.am b/doc/Makefile.am index d1e5836..1eb7d9e 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -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 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/entities.ent b/doc/entities.ent index c5afda8..5f310e9 100644 --- a/doc/entities.ent +++ b/doc/entities.ent @@ -26,4 +26,4 @@ "> "> - + diff --git a/doc/introduction.xml b/doc/introduction.xml index 1c54f74..fc9a628 100644 --- a/doc/introduction.xml +++ b/doc/introduction.xml @@ -2,7 +2,7 @@ &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. @@ -25,7 +25,7 @@ Supports - SOLR Web Service (client side only) + SOLR Web Service version 1.4.x (client side only) Supports the following transports: BER over TCP/IP 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/doc/yaz-client-commands.xml b/doc/yaz-client-commands.xml index a769ac4..769aa60 100644 --- a/doc/yaz-client-commands.xml +++ b/doc/yaz-client-commands.xml @@ -190,8 +190,9 @@ Must be one of POST, GET, SOAP (default) or SOLR. 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 diff --git a/doc/yaz-icu-man.xml b/doc/yaz-icu-man.xml index 5248b73..7c016bf 100644 --- a/doc/yaz-icu-man.xml +++ b/doc/yaz-icu-man.xml @@ -29,11 +29,11 @@ yaz-icu - commands -c config -p opt -s -x + infile @@ -42,6 +42,17 @@ yaz-icu is utility which demonstrates the ICU chain module of yaz. (yaz/icu.h). + + 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 -c which specififies + the configuration to be used. The input file is read from standard + input or from a file if infile is specified. + + + The utility may also show ICU information. This is triggered by + option -p. + OPTIONS diff --git a/doc/yaz-man.xml b/doc/yaz-man.xml index c21900a..378186e 100644 --- a/doc/yaz-man.xml +++ b/doc/yaz-man.xml @@ -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. diff --git a/doc/zoom.xml b/doc/zoom.xml index 7d043d2..8a6bb92 100644 --- a/doc/zoom.xml +++ b/doc/zoom.xml @@ -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 sru=get,, like this: sru=get,http://sru.miketaylor.org.uk:80/sru.pl - - + + + SOLR protocol support was added to YAZ in version 4.1.0, + as a dialect of a SRU protocol, since both are HTTP based protocols. + 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) You can prefix the host with a scheme followed by colon. The default scheme is tcp (Z39.50 protocol). - The scheme http selects SRU over HTTP. + The scheme http selects SRU/get over HTTP by default, + but can overridded to use SRU/post, SRW and the SOLR protocol. 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. none - - sru - SRU transport type. Must be either soap, + + sru + SRU/SOLR transport type. Must be either soap, get, post, or solr. - soap + soap sru_version SRU/SRW version. Should be 1.1, or @@ -362,14 +366,14 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) - SRU Protocol behavior + SRU/SOLR Protocol behavior - 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. 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 implementationName and put that as part of User-Agent header for HTTP requests. @@ -667,7 +671,10 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) SRU SearchRetrieveRequest. - Unfortunately, SRU does not define a database setting. Hence, + SOLR queries has to be done in SOLR query format. + + + Unfortunately, SRU or SOLR does not define a database setting. Hence, databaseName is unsupported and ignored. However, the path part in host parameter for functions ZOOM_connecton_new and @@ -743,18 +750,29 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) The type is a string of the format: - form[;charset=from[,to]][;format=v] + format[;charset=from[/opacfrom][,to]][;format=v] - where form specifies the format of the + where format specifies the format of the returned record, from specifies the character set of the record in its original form (as returned by the server), to specifies the output (returned) character set encoding. - If charset is not given, then no character set conversion takes place. If to is omitted UTF-8 is assumed. + If charset is not given, then no character set conversion takes place. + + + OPAC records may be returned in a different + set from the bibliographic MARC record. If this is this the case, + opacfrom should be set to the character set + of the OPAC record part. + + + Specifying the OPAC record character set requires YAZ 4.1.5 or later. + + 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) xml 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 MARCXML @@ -876,9 +894,9 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) - SRU Protocol behavior + SRU/SOLR Protocol behavior - 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. @@ -886,6 +904,8 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) Facets + Facets operations is not part of the official ZOOM specification, but is an Index Data extension + for YAZ-based Z39.50 targets or SOLR 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) - The Scan interface is supported for both Z39.50 and SRU. + The Scan interface is supported for both Z39.50, SRU (and SOLR?). diff --git a/etc/Makefile.am b/etc/Makefile.am index 73ee159..fa02f3f 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -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 = \ diff --git a/header.c b/header.c index 44176e9..bda6815 100644 --- 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. */ 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/Makefile.am b/include/Makefile.am index 268d417..b8d5613 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -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/include/yaz/Makefile.am b/include/yaz/Makefile.am index f34b2a7..d43ed8f 100644 --- a/include/yaz/Makefile.am +++ b/include/yaz/Makefile.am @@ -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 diff --git a/include/yaz/backend.h b/include/yaz/backend.h index 5c04a60..b27d4c8 100644 --- a/include/yaz/backend.h +++ b/include/yaz/backend.h @@ -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/ccl.h b/include/yaz/ccl.h index cee037a..9e175fa 100644 --- a/include/yaz/ccl.h +++ b/include/yaz/ccl.h @@ -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/ccl_xml.h b/include/yaz/ccl_xml.h index e08b59e..f821395 100644 --- a/include/yaz/ccl_xml.h +++ b/include/yaz/ccl_xml.h @@ -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/charneg.h b/include/yaz/charneg.h index f87f589..64be711 100644 --- a/include/yaz/charneg.h +++ b/include/yaz/charneg.h @@ -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/comstack.h b/include/yaz/comstack.h index e27cfa6..ed5065b 100644 --- a/include/yaz/comstack.h +++ b/include/yaz/comstack.h @@ -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/copy_types.h b/include/yaz/copy_types.h index c7ec5b3..f79c00e 100644 --- a/include/yaz/copy_types.h +++ b/include/yaz/copy_types.h @@ -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/cql.h b/include/yaz/cql.h index 8da61d0..2c92470 100644 --- a/include/yaz/cql.h +++ b/include/yaz/cql.h @@ -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/daemon.h b/include/yaz/daemon.h index 09ffb91..95af0bd 100644 --- a/include/yaz/daemon.h +++ b/include/yaz/daemon.h @@ -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/dirent.h b/include/yaz/dirent.h index b565ec2..7bafaa5 100644 --- a/include/yaz/dirent.h +++ b/include/yaz/dirent.h @@ -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/errno.h b/include/yaz/errno.h index e9dda14..f764245 100644 --- a/include/yaz/errno.h +++ b/include/yaz/errno.h @@ -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/facet.h b/include/yaz/facet.h index d51b2ef..5ac83ce 100644 --- a/include/yaz/facet.h +++ b/include/yaz/facet.h @@ -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/file_glob.h b/include/yaz/file_glob.h index dc0b45c..89baadd 100644 --- a/include/yaz/file_glob.h +++ b/include/yaz/file_glob.h @@ -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/gettimeofday.h b/include/yaz/gettimeofday.h index 4f4de48..67bf396 100644 --- a/include/yaz/gettimeofday.h +++ b/include/yaz/gettimeofday.h @@ -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/icu.h b/include/yaz/icu.h index 10af2a3..23364b3 100644 --- a/include/yaz/icu.h +++ b/include/yaz/icu.h @@ -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/icu_I18N.h b/include/yaz/icu_I18N.h index eb0f22d..09b30e6 100644 --- a/include/yaz/icu_I18N.h +++ b/include/yaz/icu_I18N.h @@ -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/ill.h b/include/yaz/ill.h index 22e8303..e3321cc 100644 --- a/include/yaz/ill.h +++ b/include/yaz/ill.h @@ -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/json.h b/include/yaz/json.h index 723ad02..de7803a 100644 --- a/include/yaz/json.h +++ b/include/yaz/json.h @@ -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/log.h b/include/yaz/log.h index ddcbb85..9560532 100644 --- a/include/yaz/log.h +++ b/include/yaz/log.h @@ -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/logrpn.h b/include/yaz/logrpn.h index 2874897..a82499c 100644 --- a/include/yaz/logrpn.h +++ b/include/yaz/logrpn.h @@ -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/marcdisp.h b/include/yaz/marcdisp.h index f472aba..c650fca 100644 --- a/include/yaz/marcdisp.h +++ b/include/yaz/marcdisp.h @@ -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 diff --git a/include/yaz/match_glob.h b/include/yaz/match_glob.h index a06e02e..33cf4f3 100644 --- a/include/yaz/match_glob.h +++ b/include/yaz/match_glob.h @@ -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/matchstr.h b/include/yaz/matchstr.h index 3493d81..df44f61 100644 --- a/include/yaz/matchstr.h +++ b/include/yaz/matchstr.h @@ -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/mutex.h b/include/yaz/mutex.h index 414e09f..4a740e5 100644 --- a/include/yaz/mutex.h +++ b/include/yaz/mutex.h @@ -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/nmem.h b/include/yaz/nmem.h index 13a3a8a..70dad4e 100644 --- a/include/yaz/nmem.h +++ b/include/yaz/nmem.h @@ -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/nmem_xml.h b/include/yaz/nmem_xml.h index c60fd8a..f79f262 100644 --- a/include/yaz/nmem_xml.h +++ b/include/yaz/nmem_xml.h @@ -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/odr.h b/include/yaz/odr.h index eb12dd4..f081581 100644 --- a/include/yaz/odr.h +++ b/include/yaz/odr.h @@ -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/oid_db.h b/include/yaz/oid_db.h index bbab0b3..f6bf7a7 100644 --- a/include/yaz/oid_db.h +++ b/include/yaz/oid_db.h @@ -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/oid_util.h b/include/yaz/oid_util.h index 0767ddd..054c98e 100644 --- a/include/yaz/oid_util.h +++ b/include/yaz/oid_util.h @@ -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/options.h b/include/yaz/options.h index e3e63ad..c4d4e13 100644 --- a/include/yaz/options.h +++ b/include/yaz/options.h @@ -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/otherinfo.h b/include/yaz/otherinfo.h index 1660f37..2bd1491 100644 --- a/include/yaz/otherinfo.h +++ b/include/yaz/otherinfo.h @@ -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/poll.h b/include/yaz/poll.h index bfecdbd..0d2a3b6 100644 --- a/include/yaz/poll.h +++ b/include/yaz/poll.h @@ -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/pquery.h b/include/yaz/pquery.h index a381db9..965b1ef 100644 --- a/include/yaz/pquery.h +++ b/include/yaz/pquery.h @@ -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/proto.h b/include/yaz/proto.h index 60d3ec7..36be422 100644 --- a/include/yaz/proto.h +++ b/include/yaz/proto.h @@ -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/prt-ext.h b/include/yaz/prt-ext.h index 1ed0de3..bb93c54 100644 --- a/include/yaz/prt-ext.h +++ b/include/yaz/prt-ext.h @@ -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/query-charset.h b/include/yaz/query-charset.h index 479d1e9..3688808 100644 --- a/include/yaz/query-charset.h +++ b/include/yaz/query-charset.h @@ -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/querytowrbuf.h b/include/yaz/querytowrbuf.h index 42c02d0..6af1134 100644 --- a/include/yaz/querytowrbuf.h +++ b/include/yaz/querytowrbuf.h @@ -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/readconf.h b/include/yaz/readconf.h index d15f40f..0e07fd0 100644 --- a/include/yaz/readconf.h +++ b/include/yaz/readconf.h @@ -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/record_conv.h b/include/yaz/record_conv.h index da9fec1..f8912bf 100644 --- a/include/yaz/record_conv.h +++ b/include/yaz/record_conv.h @@ -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/record_render.h b/include/yaz/record_render.h index bdc0889..f63630d 100644 --- a/include/yaz/record_render.h +++ b/include/yaz/record_render.h @@ -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/retrieval.h b/include/yaz/retrieval.h index 4736a47..4a239eb 100644 --- a/include/yaz/retrieval.h +++ b/include/yaz/retrieval.h @@ -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/rpn2cql.h b/include/yaz/rpn2cql.h index 09d83ba..7dcb96f 100644 --- a/include/yaz/rpn2cql.h +++ b/include/yaz/rpn2cql.h @@ -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); diff --git a/include/yaz/rpn2solr.h b/include/yaz/rpn2solr.h index f4dced9..80bd4c5 100644 --- a/include/yaz/rpn2solr.h +++ b/include/yaz/rpn2solr.h @@ -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); diff --git a/include/yaz/sc.h b/include/yaz/sc.h index 9976efe..dbf3b6f 100644 --- a/include/yaz/sc.h +++ b/include/yaz/sc.h @@ -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/shptr.h b/include/yaz/shptr.h index b621b3d..4feba83 100644 --- a/include/yaz/shptr.h +++ b/include/yaz/shptr.h @@ -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/snprintf.h b/include/yaz/snprintf.h index 9c65445..18fb812 100644 --- a/include/yaz/snprintf.h +++ b/include/yaz/snprintf.h @@ -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/soap.h b/include/yaz/soap.h index f565ea1..e655b46 100644 --- a/include/yaz/soap.h +++ b/include/yaz/soap.h @@ -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/solr.h b/include/yaz/solr.h index 09ecdcc..b9d798f 100644 --- a/include/yaz/solr.h +++ b/include/yaz/solr.h @@ -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/sortspec.h b/include/yaz/sortspec.h index 909f3b1..2b166d9 100644 --- a/include/yaz/sortspec.h +++ b/include/yaz/sortspec.h @@ -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/spipe.h b/include/yaz/spipe.h index 1b48650..c80f717 100644 --- a/include/yaz/spipe.h +++ b/include/yaz/spipe.h @@ -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/srw.h b/include/yaz/srw.h index bd0c782..b8bfae2 100644 --- a/include/yaz/srw.h +++ b/include/yaz/srw.h @@ -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/statserv.h b/include/yaz/statserv.h index decd6fc..1177e54 100644 --- a/include/yaz/statserv.h +++ b/include/yaz/statserv.h @@ -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 index 0000000..56f37fb --- /dev/null +++ b/include/yaz/stemmer.h @@ -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 +#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/include/yaz/tcpip.h b/include/yaz/tcpip.h index 7358db6..1c7f6fb 100644 --- a/include/yaz/tcpip.h +++ b/include/yaz/tcpip.h @@ -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/test.h b/include/yaz/test.h index c975567..0ea935e 100644 --- a/include/yaz/test.h +++ b/include/yaz/test.h @@ -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/thread_create.h b/include/yaz/thread_create.h index d93bc03..c6eb9b3 100644 --- a/include/yaz/thread_create.h +++ b/include/yaz/thread_create.h @@ -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/thread_id.h b/include/yaz/thread_id.h index bea3c19..a00d343 100644 --- a/include/yaz/thread_id.h +++ b/include/yaz/thread_id.h @@ -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/timing.h b/include/yaz/timing.h index 60456c0..0f8a982 100644 --- a/include/yaz/timing.h +++ b/include/yaz/timing.h @@ -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/tokenizer.h b/include/yaz/tokenizer.h index 388ea41..2898aab 100644 --- a/include/yaz/tokenizer.h +++ b/include/yaz/tokenizer.h @@ -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/tpath.h b/include/yaz/tpath.h index 59de466..da145dc 100644 --- a/include/yaz/tpath.h +++ b/include/yaz/tpath.h @@ -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/unix.h b/include/yaz/unix.h index c78c665..36b3999 100644 --- a/include/yaz/unix.h +++ b/include/yaz/unix.h @@ -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/wrbuf.h b/include/yaz/wrbuf.h index 0f393a6..56b5e60 100644 --- a/include/yaz/wrbuf.h +++ b/include/yaz/wrbuf.h @@ -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 diff --git a/include/yaz/xmalloc.h b/include/yaz/xmalloc.h index be4b703..f96cdd5 100644 --- a/include/yaz/xmalloc.h +++ b/include/yaz/xmalloc.h @@ -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/xml_include.h b/include/yaz/xml_include.h index 2b708c0..56dae79 100644 --- a/include/yaz/xml_include.h +++ b/include/yaz/xml_include.h @@ -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/xmlquery.h b/include/yaz/xmlquery.h index 909d2bf..42752d4 100644 --- a/include/yaz/xmlquery.h +++ b/include/yaz/xmlquery.h @@ -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/xmltypes.h b/include/yaz/xmltypes.h index 9df4982..193ce00 100644 --- a/include/yaz/xmltypes.h +++ b/include/yaz/xmltypes.h @@ -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/yaz-ccl.h b/include/yaz/yaz-ccl.h index 05baa16..c2aae1e 100644 --- a/include/yaz/yaz-ccl.h +++ b/include/yaz/yaz-ccl.h @@ -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/yaz-iconv.h b/include/yaz/yaz-iconv.h index 158e7ad..c0ebdd7 100644 --- a/include/yaz/yaz-iconv.h +++ b/include/yaz/yaz-iconv.h @@ -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/yaz-util.h b/include/yaz/yaz-util.h index b0bc26d..c09c647 100644 --- a/include/yaz/yaz-util.h +++ b/include/yaz/yaz-util.h @@ -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/yconfig.h b/include/yaz/yconfig.h index b2113e9..4d705bf 100644 --- a/include/yaz/yconfig.h +++ b/include/yaz/yconfig.h @@ -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/zgdu.h b/include/yaz/zgdu.h index a214429..d0f8f03 100644 --- a/include/yaz/zgdu.h +++ b/include/yaz/zgdu.h @@ -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/zoom.h b/include/yaz/zoom.h index ca38b0d..a505e12 100644 --- a/include/yaz/zoom.h +++ b/include/yaz/zoom.h @@ -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 index 0000000..368f4a2 --- /dev/null +++ b/libstemmer_c @@ -0,0 +1 @@ +Subproject commit 368f4a253716e312b66209d61c927d5039c51287 diff --git a/m4 b/m4 index 1fa0b45..96ff03f 160000 --- a/m4 +++ b/m4 @@ -1 +1 @@ -Subproject commit 1fa0b45a8141955801938f967f1d1dca1b042c17 +Subproject commit 96ff03f91b4539e315dadd50ab2564412c076394 diff --git a/src/Makefile.am b/src/Makefile.am index d0060df..5aeb22c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/advancegreek.c b/src/advancegreek.c index a207ca4..463c595 100644 --- a/src/advancegreek.c +++ b/src/advancegreek.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. */ /** diff --git a/src/atoin.c b/src/atoin.c index d22f84f..50a8381 100644 --- a/src/atoin.c +++ b/src/atoin.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. */ diff --git a/src/ber_any.c b/src/ber_any.c index ec526a9..8164e97 100644 --- a/src/ber_any.c +++ b/src/ber_any.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. */ diff --git a/src/ber_bit.c b/src/ber_bit.c index 70e4230..edce71a 100644 --- a/src/ber_bit.c +++ b/src/ber_bit.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. */ diff --git a/src/ber_bool.c b/src/ber_bool.c index a3d0571..f5310a3 100644 --- a/src/ber_bool.c +++ b/src/ber_bool.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. */ diff --git a/src/ber_int.c b/src/ber_int.c index 786321e..e7ed655 100644 --- a/src/ber_int.c +++ b/src/ber_int.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. */ diff --git a/src/ber_len.c b/src/ber_len.c index 5dbdda8..eec85f4 100644 --- a/src/ber_len.c +++ b/src/ber_len.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. */ diff --git a/src/ber_null.c b/src/ber_null.c index 94fa80c..91dc5f4 100644 --- a/src/ber_null.c +++ b/src/ber_null.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. */ diff --git a/src/ber_oct.c b/src/ber_oct.c index 9cccae9..404d7d7 100644 --- a/src/ber_oct.c +++ b/src/ber_oct.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. */ diff --git a/src/ber_oid.c b/src/ber_oid.c index 9a96e52..d076eaa 100644 --- a/src/ber_oid.c +++ b/src/ber_oid.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. */ diff --git a/src/ber_tag.c b/src/ber_tag.c index 69cdc8e..2c3e6c9 100644 --- a/src/ber_tag.c +++ b/src/ber_tag.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. */ diff --git a/src/ccl_stop_words.c b/src/ccl_stop_words.c index 9d06f98..db0e16c 100644 --- a/src/ccl_stop_words.c +++ b/src/ccl_stop_words.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 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..30a6969 100644 --- a/src/cclerrms.c +++ b/src/cclerrms.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. */ /** @@ -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..30abcbe 100644 --- a/src/cclfind.c +++ b/src/cclfind.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. */ /** @@ -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/cclp.h b/src/cclp.h index dbfc741..d792742 100644 --- a/src/cclp.h +++ b/src/cclp.h @@ -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/src/cclptree.c b/src/cclptree.c index 98e6bb8..1bbcaad 100644 --- a/src/cclptree.c +++ b/src/cclptree.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. */ /** @@ -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..c49df6c 100644 --- a/src/cclqfile.c +++ b/src/cclqfile.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 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..d196a00 100644 --- a/src/cclqual.c +++ b/src/cclqual.c @@ -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 +#endif + #include #include #include diff --git a/src/cclstr.c b/src/cclstr.c index 1f46616..7c1e3e9 100644 --- a/src/cclstr.c +++ b/src/cclstr.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 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..db5d9c9 100644 --- a/src/ccltoken.c +++ b/src/ccltoken.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 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..cc17229 100644 --- a/src/cclxmlconfig.c +++ b/src/cclxmlconfig.c @@ -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 +#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..9701cda 100644 --- a/src/charneg.c +++ b/src/charneg.c @@ -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 +#endif + #include #include #include diff --git a/src/comstack.c b/src/comstack.c index 0df8678..496fe22 100644 --- a/src/comstack.c +++ b/src/comstack.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 comstack.c * \brief Implements Generic COMSTACK functions */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/condvar.c b/src/condvar.c index 19291d4..2e7c48f 100644 --- a/src/condvar.c +++ b/src/condvar.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. */ diff --git a/src/copy_types.c b/src/copy_types.c index dc34993..2afd1dc 100644 --- a/src/copy_types.c +++ b/src/copy_types.c @@ -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 +#endif #include diff --git a/src/cql.y b/src/cql.y index 25a4287..7bb83f8 100644 --- 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 +#endif #include #include #include diff --git a/src/cql1.2.y b/src/cql1.2.y index 0a908ec..748cc7d 100644 --- a/src/cql1.2.y +++ b/src/cql1.2.y @@ -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. */ /* diff --git a/src/cql2.0.y b/src/cql2.0.y index 1c5f364..377fabe 100644 --- a/src/cql2.0.y +++ b/src/cql2.0.y @@ -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. */ /* diff --git a/src/cqlstdio.c b/src/cqlstdio.c index 6d68439..e1fe5f0 100644 --- a/src/cqlstdio.c +++ b/src/cqlstdio.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 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..f45a769 100644 --- a/src/cqlstrer.c +++ b/src/cqlstrer.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 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..4653b82 100644 --- a/src/cqlstring.c +++ b/src/cqlstring.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 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..a07894e 100644 --- a/src/cqltransform.c +++ b/src/cqltransform.c @@ -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 +#endif #include #include diff --git a/src/cqlutil.c b/src/cqlutil.c index b9ff63f..8eb25f3 100644 --- a/src/cqlutil.c +++ b/src/cqlutil.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 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/daemon.c b/src/daemon.c index 69c2330..838a808 100644 --- a/src/daemon.c +++ b/src/daemon.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. */ diff --git a/src/diag-entry.c b/src/diag-entry.c index 33894b7..cea53e6 100644 --- a/src/diag-entry.c +++ b/src/diag-entry.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. */ diff --git a/src/diag-entry.h b/src/diag-entry.h index 90ae3bf..4f16ef8 100644 --- a/src/diag-entry.h +++ b/src/diag-entry.h @@ -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/src/dirent.c b/src/dirent.c index 7ea1df4..3cf8ef9 100644 --- a/src/dirent.c +++ b/src/dirent.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. */ diff --git a/src/dumpber.c b/src/dumpber.c index e90ad27..c02ae3b 100644 --- a/src/dumpber.c +++ b/src/dumpber.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. */ diff --git a/src/elementset.c b/src/elementset.c index ae46836..0915d86 100644 --- a/src/elementset.c +++ b/src/elementset.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. */ /** diff --git a/src/errno.c b/src/errno.c index 666015c..ee542b2 100644 --- a/src/errno.c +++ b/src/errno.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. */ diff --git a/src/eventl.c b/src/eventl.c index b5ef123..d9f2e52 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -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 +#endif #include #include diff --git a/src/eventl.h b/src/eventl.h index f988224..19cc9f3 100644 --- a/src/eventl.h +++ b/src/eventl.h @@ -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/src/facet.c b/src/facet.c index dd27b6f..e4e787c 100644 --- a/src/facet.c +++ b/src/facet.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. */ @@ -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 */ } diff --git a/src/file_glob.c b/src/file_glob.c index 065b5c5..57b51ac 100644 --- a/src/file_glob.c +++ b/src/file_glob.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. */ @@ -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/gettimeofday.c b/src/gettimeofday.c index 2310920..8308b0b 100644 --- a/src/gettimeofday.c +++ b/src/gettimeofday.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. */ diff --git a/src/grs1disp.c b/src/grs1disp.c index 1fd2727..29b6304 100644 --- a/src/grs1disp.c +++ b/src/grs1disp.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 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..7546047 100644 --- a/src/http.c +++ b/src/http.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 http.c * \brief Implements HTTP decoding */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/iconv-p.h b/src/iconv-p.h index 805b827..4531f73 100644 --- a/src/iconv-p.h +++ b/src/iconv-p.h @@ -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/src/iconv_decode_danmarc.c b/src/iconv_decode_danmarc.c index 7196704..7e86c0d 100644 --- a/src/iconv_decode_danmarc.c +++ b/src/iconv_decode_danmarc.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. */ /** diff --git a/src/iconv_decode_iso5426.c b/src/iconv_decode_iso5426.c index 53a81e6..33847bc 100644 --- a/src/iconv_decode_iso5426.c +++ b/src/iconv_decode_iso5426.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. */ /** diff --git a/src/iconv_decode_marc8.c b/src/iconv_decode_marc8.c index e9f9969..7b31510 100644 --- a/src/iconv_decode_marc8.c +++ b/src/iconv_decode_marc8.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. */ /** diff --git a/src/iconv_encode_iso_8859_1.c b/src/iconv_encode_iso_8859_1.c index e68f49a..20b6505 100644 --- a/src/iconv_encode_iso_8859_1.c +++ b/src/iconv_encode_iso_8859_1.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. */ /** diff --git a/src/iconv_encode_marc8.c b/src/iconv_encode_marc8.c index 87c2a89..2d7b694 100644 --- a/src/iconv_encode_marc8.c +++ b/src/iconv_encode_marc8.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. */ /** diff --git a/src/iconv_encode_wchar.c b/src/iconv_encode_wchar.c index 79dd024..41b4492 100644 --- a/src/iconv_encode_wchar.c +++ b/src/iconv_encode_wchar.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. */ /** diff --git a/src/icu_casemap.c b/src/icu_casemap.c index 26aa737..6453229 100644 --- a/src/icu_casemap.c +++ b/src/icu_casemap.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. */ diff --git a/src/icu_chain.c b/src/icu_chain.c index 8ae80fc..4f36502 100644 --- a/src/icu_chain.c +++ b/src/icu_chain.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. */ @@ -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/icu_sortkey.c b/src/icu_sortkey.c index 8130055..8fed394 100644 --- a/src/icu_sortkey.c +++ b/src/icu_sortkey.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. */ diff --git a/src/icu_tokenizer.c b/src/icu_tokenizer.c index d6ec7fe..54cfbf3 100644 --- a/src/icu_tokenizer.c +++ b/src/icu_tokenizer.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. */ diff --git a/src/icu_transform.c b/src/icu_transform.c index 4e3036d..e8d2012 100644 --- a/src/icu_transform.c +++ b/src/icu_transform.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. */ @@ -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); diff --git a/src/icu_utf16.c b/src/icu_utf16.c index 6c028b4..c5970ef 100644 --- a/src/icu_utf16.c +++ b/src/icu_utf16.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. */ diff --git a/src/icu_utf8.c b/src/icu_utf8.c index 3ba9651..77fc2b3 100644 --- a/src/icu_utf8.c +++ b/src/icu_utf8.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. */ diff --git a/src/ill-get.c b/src/ill-get.c index 87e5e1a..d9ec51d 100644 --- a/src/ill-get.c +++ b/src/ill-get.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 ill-get.c * \brief Implements ILL package creator utilities */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/initopt.c b/src/initopt.c index e4a2292..4d147db 100644 --- a/src/initopt.c +++ b/src/initopt.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. */ diff --git a/src/iso5428.c b/src/iso5428.c index 61309bc..5f22b24 100644 --- a/src/iso5428.c +++ b/src/iso5428.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. */ /** diff --git a/src/json.c b/src/json.c index 91cb4e4..58a6690 100644 --- a/src/json.c +++ b/src/json.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 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..b68e308 100644 --- 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. */ @@ -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..56dc01a 100644 --- a/src/logrpn.c +++ b/src/logrpn.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 logrpn.c * \brief Implements Z39.50 Query Printing */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/marc_read_iso2709.c b/src/marc_read_iso2709.c index dcae48c..dd20fc8 100644 --- a/src/marc_read_iso2709.c +++ b/src/marc_read_iso2709.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. */ diff --git a/src/marc_read_line.c b/src/marc_read_line.c index eefeb84..82f455f 100644 --- a/src/marc_read_line.c +++ b/src/marc_read_line.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. */ diff --git a/src/marc_read_xml.c b/src/marc_read_xml.c index 6b3e3dd..a81e8c4 100644 --- a/src/marc_read_xml.c +++ b/src/marc_read_xml.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. */ diff --git a/src/marcdisp.c b/src/marcdisp.c index d9b16c6..0ef545e 100644 --- a/src/marcdisp.c +++ b/src/marcdisp.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. */ diff --git a/src/match_glob.c b/src/match_glob.c index f498139..8fe4a2e 100644 --- a/src/match_glob.c +++ b/src/match_glob.c @@ -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 +#endif #include #include diff --git a/src/matchstr.c b/src/matchstr.c index 88e0e5b..15296cc 100644 --- a/src/matchstr.c +++ b/src/matchstr.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. */ diff --git a/src/mime.c b/src/mime.c index 84dc96a..88dee67 100644 --- a/src/mime.c +++ b/src/mime.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. */ diff --git a/src/mime.h b/src/mime.h index 6ab6cac..d05c21e 100644 --- a/src/mime.h +++ b/src/mime.h @@ -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/src/mutex-p.h b/src/mutex-p.h index 783f119..21c61b9 100644 --- a/src/mutex-p.h +++ b/src/mutex-p.h @@ -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. */ diff --git a/src/mutex.c b/src/mutex.c index c4f6d5b..2ed3afc 100644 --- a/src/mutex.c +++ b/src/mutex.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. */ diff --git a/src/nmem.c b/src/nmem.c index a68ab6d..bca3366 100644 --- a/src/nmem.c +++ b/src/nmem.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. */ diff --git a/src/nmemsdup.c b/src/nmemsdup.c index f27f814..3c1c4e1 100644 --- a/src/nmemsdup.c +++ b/src/nmemsdup.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. */ diff --git a/src/odr-priv.h b/src/odr-priv.h index 4ab7f55..03615a3 100644 --- a/src/odr-priv.h +++ b/src/odr-priv.h @@ -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/src/odr.c b/src/odr.c index 7e376c1..0896859 100644 --- 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. */ diff --git a/src/odr_any.c b/src/odr_any.c index e8449ec..6f203b9 100644 --- a/src/odr_any.c +++ b/src/odr_any.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. */ diff --git a/src/odr_bit.c b/src/odr_bit.c index d046bf8..9a9d51d 100644 --- a/src/odr_bit.c +++ b/src/odr_bit.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. */ diff --git a/src/odr_bool.c b/src/odr_bool.c index 0763253..62354cb 100644 --- a/src/odr_bool.c +++ b/src/odr_bool.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. */ diff --git a/src/odr_choice.c b/src/odr_choice.c index 941476f..6121a57 100644 --- a/src/odr_choice.c +++ b/src/odr_choice.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. */ diff --git a/src/odr_cons.c b/src/odr_cons.c index 18b346b..db649ac 100644 --- a/src/odr_cons.c +++ b/src/odr_cons.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. */ diff --git a/src/odr_enum.c b/src/odr_enum.c index 69bbef4..caf83f3 100644 --- a/src/odr_enum.c +++ b/src/odr_enum.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. */ /** diff --git a/src/odr_int.c b/src/odr_int.c index d8a3757..bd8a59d 100644 --- a/src/odr_int.c +++ b/src/odr_int.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. */ /** diff --git a/src/odr_mem.c b/src/odr_mem.c index 9972c10..8dce213 100644 --- a/src/odr_mem.c +++ b/src/odr_mem.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. */ /** diff --git a/src/odr_null.c b/src/odr_null.c index e15d51d..ae62565 100644 --- a/src/odr_null.c +++ b/src/odr_null.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. */ /** diff --git a/src/odr_oct.c b/src/odr_oct.c index c5cc823..26ce001 100644 --- a/src/odr_oct.c +++ b/src/odr_oct.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. */ /** diff --git a/src/odr_oid.c b/src/odr_oid.c index 085c852..ec6d932 100644 --- a/src/odr_oid.c +++ b/src/odr_oid.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. */ /** diff --git a/src/odr_seq.c b/src/odr_seq.c index a7a819f..c57172a 100644 --- a/src/odr_seq.c +++ b/src/odr_seq.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. */ /** diff --git a/src/odr_tag.c b/src/odr_tag.c index d5f96af..b62fef1 100644 --- a/src/odr_tag.c +++ b/src/odr_tag.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. */ /** diff --git a/src/odr_use.c b/src/odr_use.c index acb2c32..4faed2f 100644 --- a/src/odr_use.c +++ b/src/odr_use.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. */ /** diff --git a/src/odr_util.c b/src/odr_util.c index 8cd47d5..238f1be 100644 --- a/src/odr_util.c +++ b/src/odr_util.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. */ /** diff --git a/src/oid_db.c b/src/oid_db.c index 7d9f103..5d9297e 100644 --- a/src/oid_db.c +++ b/src/oid_db.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. */ diff --git a/src/oid_util.c b/src/oid_util.c index 7cf02db..58c3a35 100644 --- a/src/oid_util.c +++ b/src/oid_util.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. */ 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..735d969 100644 --- a/src/opacdisp.c +++ b/src/opacdisp.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 opacdisp.c * \brief Implements OPAC record display */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -15,18 +18,25 @@ #include #include -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, "\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, "\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, " \n"); for (j = 0; jnum_volumes; j++) { wrbuf_puts (wrbuf, " \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, " \n"); } @@ -131,23 +157,23 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf) wrbuf_puts(wrbuf," \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, " \n"); } @@ -160,6 +186,11 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf) wrbuf_puts(wrbuf, "\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 diff --git a/src/options.c b/src/options.c index 7f6374c..4d92e13 100644 --- a/src/options.c +++ b/src/options.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. */ /** diff --git a/src/otherinfo.c b/src/otherinfo.c index 80cb19d..12be129 100644 --- a/src/otherinfo.c +++ b/src/otherinfo.c @@ -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 +#endif + #include #include diff --git a/src/poll.c b/src/poll.c index 08e5d46..66c7bc8 100644 --- a/src/poll.c +++ b/src/poll.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 * \brief Select, poll wrapper */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/pquery.c b/src/pquery.c index 65dcdd1..1a45b40 100644 --- a/src/pquery.c +++ b/src/pquery.c @@ -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 +#endif + #include #include #include diff --git a/src/prt-ext.c b/src/prt-ext.c index ccd2999..aad4cc7 100644 --- a/src/prt-ext.c +++ b/src/prt-ext.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 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..e8dda49 100644 --- a/src/query-charset.c +++ b/src/query-charset.c @@ -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 +#endif #include #include diff --git a/src/querytowrbuf.c b/src/querytowrbuf.c index 3caf21b..7343fb7 100644 --- a/src/querytowrbuf.c +++ b/src/querytowrbuf.c @@ -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 +#endif #include #include diff --git a/src/readconf.c b/src/readconf.c index 688a433..7a9c282 100644 --- a/src/readconf.c +++ b/src/readconf.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. */ diff --git a/src/record_conv.c b/src/record_conv.c index 9da5a44..c644c7d 100644 --- a/src/record_conv.c +++ b/src/record_conv.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. */ /** diff --git a/src/record_render.c b/src/record_render.c index d4180dd..ddfd391 100644 --- a/src/record_render.c +++ b/src/record_render.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 record_render.c * \brief Render Z39.50 records (NamePlusRecord) */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -17,34 +20,49 @@ #include #include -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) { diff --git a/src/requestq.c b/src/requestq.c index 2c93d92..41517d9 100644 --- a/src/requestq.c +++ b/src/requestq.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. */ /** @@ -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/retrieval.c b/src/retrieval.c index 4923e64..f60e231 100644 --- a/src/retrieval.c +++ b/src/retrieval.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. */ /** diff --git a/src/rpn2cql.c b/src/rpn2cql.c index 68b359a..ea21793 100644 --- a/src/rpn2cql.c +++ b/src/rpn2cql.c @@ -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 +#endif #include #include diff --git a/src/rpn2solr.c b/src/rpn2solr.c index de485ab..6390ebb 100644 --- a/src/rpn2solr.c +++ b/src/rpn2solr.c @@ -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 +#endif #include #include diff --git a/src/sc.c b/src/sc.c index 4014471..ef5d097 100644 --- 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 +#endif #ifdef WIN32 #include diff --git a/src/sc_test.c b/src/sc_test.c index e06a6ba..8da30a1 100644 --- a/src/sc_test.c +++ b/src/sc_test.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_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..0a3f9fa 100644 --- a/src/seshigh.c +++ b/src/seshigh.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. */ /** @@ -25,6 +25,9 @@ * minimize memory allocation/deallocation during normal operation. * */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -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; } diff --git a/src/session.h b/src/session.h index c66676f..34f1ddb 100644 --- a/src/session.h +++ b/src/session.h @@ -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/src/siconv.c b/src/siconv.c index 6e061d8..6a2618c 100644 --- a/src/siconv.c +++ b/src/siconv.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. */ /** diff --git a/src/snprintf.c b/src/snprintf.c index 2aedb83..1c157f4 100644 --- a/src/snprintf.c +++ b/src/snprintf.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 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..7f22cf3 100644 --- a/src/soap.c +++ b/src/soap.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. */ /** @@ -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 55a86ca..569125b 100644 --- a/src/solr.c +++ b/src/solr.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 solr.c + * \brief Implements SOAP Webservice decoding/encoding */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -24,30 +27,18 @@ #include #include -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; diff --git a/src/solrtransform.c b/src/solrtransform.c index 2d41044..d2732e5 100644 --- a/src/solrtransform.c +++ b/src/solrtransform.c @@ -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 +#endif #include #include diff --git a/src/sortspec.c b/src/sortspec.c index d469718..c733aad 100644 --- a/src/sortspec.c +++ b/src/sortspec.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 sortspec.c * \brief Implements SortSpec parsing. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/spipe.c b/src/spipe.c index 52c922a..a2ee268 100644 --- a/src/spipe.c +++ b/src/spipe.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. */ diff --git a/src/sru-p.h b/src/sru-p.h index 7fd57c4..9cd2597 100644 --- a/src/sru-p.h +++ b/src/sru-p.h @@ -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 +#include +const char *yaz_element_attribute_value_get(xmlNodePtr ptr, const char *node_name, const char *attribute_name); +#endif + /* * Local variables: * c-basic-offset: 4 diff --git a/src/srw.c b/src/srw.c index 93ff77c..bd3c577 100644 --- 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 +#endif + +#include #include +#include #if YAZ_HAVE_XML2 #include #include #include +#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")) diff --git a/src/srwutil.c b/src/srwutil.c index 2746199..353286f 100644 --- a/src/srwutil.c +++ b/src/srwutil.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. */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -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, diff --git a/src/statserv.c b/src/statserv.c index d340a17..7560058 100644 --- a/src/statserv.c +++ b/src/statserv.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. */ @@ -8,6 +8,10 @@ * \brief Implements GFS logic */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -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 index 0000000..7ee2633 --- /dev/null +++ b/src/stemmer.c @@ -0,0 +1,127 @@ + + +#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; + 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 */ diff --git a/src/tcpdchk.c b/src/tcpdchk.c index 24bf471..26acb8e 100644 --- a/src/tcpdchk.c +++ b/src/tcpdchk.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. */ /** @@ -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 d72bc44..8ffa3ab 100644 --- a/src/tcpip.c +++ b/src/tcpip.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 tcpip.c * \brief Implements TCP/IP + SSL COMSTACK. */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -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; diff --git a/src/test.c b/src/test.c index e4c226c..8fa3ac4 100644 --- a/src/test.c +++ b/src/test.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. */ diff --git a/src/thread_create.c b/src/thread_create.c index 16be9c5..e61d48b 100644 --- a/src/thread_create.c +++ b/src/thread_create.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. */ diff --git a/src/thread_id.c b/src/thread_id.c index db38a1b..57f1aa7 100644 --- a/src/thread_id.c +++ b/src/thread_id.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. */ diff --git a/src/timing.c b/src/timing.c index 9c10358..352c03d 100644 --- a/src/timing.c +++ b/src/timing.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. */ diff --git a/src/tokenizer.c b/src/tokenizer.c index cf76c89..108de00 100644 --- a/src/tokenizer.c +++ b/src/tokenizer.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 tokenizer.c * \brief Simple tokenizer system. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/tpath.c b/src/tpath.c index c743a60..67b823a 100644 --- a/src/tpath.c +++ b/src/tpath.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. */ /** diff --git a/src/ucs4.c b/src/ucs4.c index 557799f..1b10e30 100644 --- a/src/ucs4.c +++ b/src/ucs4.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. */ /** diff --git a/src/unix.c b/src/unix.c index 8006a61..ea8d0cc 100644 --- a/src/unix.c +++ b/src/unix.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 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..987b121 100644 --- 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 +#endif #include #include diff --git a/src/utf8.c b/src/utf8.c index 31e7e3b..ea1a5b0 100644 --- a/src/utf8.c +++ b/src/utf8.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. */ /** diff --git a/src/version.c b/src/version.c index c372c5b..1b8c57d 100644 --- a/src/version.c +++ b/src/version.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. */ diff --git a/src/waislen.c b/src/waislen.c index 9e44ab2..8df2c02 100644 --- a/src/waislen.c +++ b/src/waislen.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 waislen.c * \brief Implements WAIS package handling */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/wrbuf.c b/src/wrbuf.c index 31729b0..06e49de 100644 --- a/src/wrbuf.c +++ b/src/wrbuf.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. */ @@ -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) diff --git a/src/xcqlutil.c b/src/xcqlutil.c index 32fde13..1b15aa2 100644 --- a/src/xcqlutil.c +++ b/src/xcqlutil.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 xcqlutil.c * \brief Implements CQL to XCQL conversion. */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/src/xmalloc.c b/src/xmalloc.c index 179b143..3c28abe 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.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. */ /** diff --git a/src/xml_include.c b/src/xml_include.c index c0d2f0b..1e64b54 100644 --- a/src/xml_include.c +++ b/src/xml_include.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. */ diff --git a/src/xmlerror.c b/src/xmlerror.c index 26b5840..27bbb5c 100644 --- a/src/xmlerror.c +++ b/src/xmlerror.c @@ -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 +#endif #include #include diff --git a/src/xmlquery.c b/src/xmlquery.c index e4d287e..7a94d44 100644 --- a/src/xmlquery.c +++ b/src/xmlquery.c @@ -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 +#endif #include #include diff --git a/src/yaz-ccl.c b/src/yaz-ccl.c index 4bffebe..ddac41d 100644 --- a/src/yaz-ccl.c +++ b/src/yaz-ccl.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 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..182f201 100644 --- a/src/zgdu.c +++ b/src/zgdu.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 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..5e9af9c 100644 --- a/src/zget.c +++ b/src/zget.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 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..c3aa0ed 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.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 zoom-c.c * \brief Implements ZOOM C interface. */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -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); } diff --git a/src/zoom-event.c b/src/zoom-event.c index bc1c84e..1b48d87 100644 --- a/src/zoom-event.c +++ b/src/zoom-event.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 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..a1ba28b 100644 --- a/src/zoom-opt.c +++ b/src/zoom-opt.c @@ -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 +#endif + #include #include "zoom-p.h" diff --git a/src/zoom-p.h b/src/zoom-p.h index b0a39fc..3041928 100644 --- a/src/zoom-p.h +++ b/src/zoom-p.h @@ -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/src/zoom-query.c b/src/zoom-query.c index 1049873..c0e4312 100644 --- a/src/zoom-query.c +++ b/src/zoom-query.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 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..b9d7a1e 100644 --- a/src/zoom-record-cache.c +++ b/src/zoom-record-cache.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 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..6593ae7 100644 --- a/src/zoom-socket.c +++ b/src/zoom-socket.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 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..83e162f 100644 --- a/src/zoom-sru.c +++ b/src/zoom-sru.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 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 22dd87b..a8cf99b 100644 --- a/src/zoom-z3950.c +++ b/src/zoom-z3950.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 zoom-z3950.c * \brief Implements ZOOM Z39.50 handling */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -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); diff --git a/test/.gitignore b/test/.gitignore index 90d4151..cc7ce27 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -34,6 +34,7 @@ test_oid test_file_glob test_log_thread test_mutex +test_libstemmer *.log *.o *~ diff --git a/test/Makefile.am b/test/Makefile.am index 23b2f12..5e92f72 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 diff --git a/test/test_ccl.c b/test/test_ccl.c index 9ebebad..20f6503 100644 --- a/test/test_ccl.c +++ b/test/test_ccl.c @@ -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 +#endif #include #include diff --git a/test/test_comstack.c b/test/test_comstack.c index eee72f8..b7778d1 100644 --- a/test/test_comstack.c +++ b/test/test_comstack.c @@ -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 +#endif #include #include diff --git a/test/test_file_glob.c b/test/test_file_glob.c index 8cfc3c3..029382b 100644 --- a/test/test_file_glob.c +++ b/test/test_file_glob.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. */ @@ -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_filepath.c b/test/test_filepath.c index b06bb3d..c816034 100644 --- a/test/test_filepath.c +++ b/test/test_filepath.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. */ diff --git a/test/test_iconv.c b/test/test_iconv.c index 352033a..3c730cf 100644 --- a/test/test_iconv.c +++ b/test/test_iconv.c @@ -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 #endif diff --git a/test/test_icu.c b/test/test_icu.c index 2ad005c..1c04fb0 100644 --- a/test/test_icu.c +++ b/test/test_icu.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. */ @@ -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..f5e81c9 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-2011 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_libstemmer.c b/test/test_libstemmer.c new file mode 100644 index 0000000..a2ea678 --- /dev/null +++ b/test/test_libstemmer.c @@ -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 +#include + +#include + +#if YAZ_HAVE_ICU +#include + +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 + */ + diff --git a/test/test_log.c b/test/test_log.c index d4a83e5..aaeaced 100644 --- a/test/test_log.c +++ b/test/test_log.c @@ -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 +#endif + #include #include #include diff --git a/test/test_log_thread.c b/test/test_log_thread.c index 41c4ceb..e2cac23 100644 --- a/test/test_log_thread.c +++ b/test/test_log_thread.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. */ diff --git a/test/test_match_glob.c b/test/test_match_glob.c index 8421752..9a361bb 100644 --- a/test/test_match_glob.c +++ b/test/test_match_glob.c @@ -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 +#endif #include #include diff --git a/test/test_matchstr.c b/test/test_matchstr.c index bdb9751..0aa8c04 100644 --- a/test/test_matchstr.c +++ b/test/test_matchstr.c @@ -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 +#endif #include #include diff --git a/test/test_mutex.c b/test/test_mutex.c index a4483fc..ba376c2 100644 --- a/test/test_mutex.c +++ b/test/test_mutex.c @@ -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 +#endif #include #include diff --git a/test/test_nmem.c b/test/test_nmem.c index 80a2e56..cd47192 100644 --- a/test/test_nmem.c +++ b/test/test_nmem.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. */ diff --git a/test/test_odr.c b/test/test_odr.c index 63ad290..5865f0a 100644 --- a/test/test_odr.c +++ b/test/test_odr.c @@ -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 +#endif #include #include #include diff --git a/test/test_odrstack.c b/test/test_odrstack.c index e81e4f9..f746680 100644 --- a/test/test_odrstack.c +++ b/test/test_odrstack.c @@ -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 +#endif + #include #include #include diff --git a/test/test_oid.c b/test/test_oid.c index d00c23a..e42bd48 100644 --- a/test/test_oid.c +++ b/test/test_oid.c @@ -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 +#endif #include #include diff --git a/test/test_pquery.c b/test/test_pquery.c index 313df6b..fdbdee8 100644 --- a/test/test_pquery.c +++ b/test/test_pquery.c @@ -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 +#endif #include #include diff --git a/test/test_query_charset.c b/test/test_query_charset.c index e3c83fc..87dbcdc 100644 --- a/test/test_query_charset.c +++ b/test/test_query_charset.c @@ -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 +#endif #include #include diff --git a/test/test_record_conv.c b/test/test_record_conv.c index 80b6d02..2612f0e 100644 --- a/test/test_record_conv.c +++ b/test/test_record_conv.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. */ #include diff --git a/test/test_retrieval.c b/test/test_retrieval.c index 9b7bf8a..6983739 100644 --- a/test/test_retrieval.c +++ b/test/test_retrieval.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. */ #include diff --git a/test/test_rpn2cql.c b/test/test_rpn2cql.c index 7aecbb0..cb2dacb 100644 --- a/test/test_rpn2cql.c +++ b/test/test_rpn2cql.c @@ -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 +#endif #include #include diff --git a/test/test_rpn2solr.c b/test/test_rpn2solr.c index 029552c..a5956dd 100644 --- a/test/test_rpn2solr.c +++ b/test/test_rpn2solr.c @@ -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 +#endif #include #include diff --git a/test/test_shared_ptr.c b/test/test_shared_ptr.c index 3502238..3688695 100644 --- a/test/test_shared_ptr.c +++ b/test/test_shared_ptr.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. */ diff --git a/test/test_soap1.c b/test/test_soap1.c index eb2ba11..37f7c70 100644 --- a/test/test_soap1.c +++ b/test/test_soap1.c @@ -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 +#endif #include #if YAZ_HAVE_XML2 diff --git a/test/test_soap2.c b/test/test_soap2.c index 620f5f3..41f0b7b 100644 --- a/test/test_soap2.c +++ b/test/test_soap2.c @@ -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 +#endif #include #include diff --git a/test/test_timing.c b/test/test_timing.c index edbca1d..dda9e0b 100644 --- a/test/test_timing.c +++ b/test/test_timing.c @@ -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 +#endif #include #include diff --git a/test/test_tpath.c b/test/test_tpath.c index 411ae82..9009949 100644 --- a/test/test_tpath.c +++ b/test/test_tpath.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. */ #include diff --git a/test/test_wrbuf.c b/test/test_wrbuf.c index af06e40..007258a 100644 --- a/test/test_wrbuf.c +++ b/test/test_wrbuf.c @@ -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 +#endif #include #include diff --git a/test/test_xmalloc.c b/test/test_xmalloc.c index 877c93f..8dace8c 100644 --- a/test/test_xmalloc.c +++ b/test/test_xmalloc.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. */ diff --git a/test/test_xml_include.c b/test/test_xml_include.c index 7a289be..7934b5e 100644 --- a/test/test_xml_include.c +++ b/test/test_xml_include.c @@ -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 +#endif #include #include diff --git a/test/test_xmlquery.c b/test/test_xmlquery.c index 908adc6..9015fa8 100644 --- a/test/test_xmlquery.c +++ b/test/test_xmlquery.c @@ -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 +#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/Makefile.am b/util/Makefile.am index be5bf68..e2b519d 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -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 diff --git a/util/benchmark.c b/util/benchmark.c index eff9d70..abb1c7d 100644 --- a/util/benchmark.c +++ b/util/benchmark.c @@ -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 +#endif #include #include diff --git a/util/cclsh.c b/util/cclsh.c index 4d24d9c..155bfe3 100644 --- a/util/cclsh.c +++ b/util/cclsh.c @@ -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 +#endif #include #include diff --git a/util/cql2pqf.c b/util/cql2pqf.c index d194da3..40aa034 100644 --- a/util/cql2pqf.c +++ b/util/cql2pqf.c @@ -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 +#endif #include #include diff --git a/util/cql2xcql.c b/util/cql2xcql.c index 23afa1a..55d824d 100644 --- a/util/cql2xcql.c +++ b/util/cql2xcql.c @@ -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 +#endif #include #include diff --git a/util/json-parse.c b/util/json-parse.c index ce1da8b..6621c4d 100644 --- a/util/json-parse.c +++ b/util/json-parse.c @@ -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 +#endif #include #include diff --git a/util/marcdump.c b/util/marcdump.c index 0696df8..041a7df 100644 --- a/util/marcdump.c +++ b/util/marcdump.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. */ diff --git a/util/srwtst.c b/util/srwtst.c index bace12a..2a1802f 100644 --- a/util/srwtst.c +++ b/util/srwtst.c @@ -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 +#endif #include #include diff --git a/util/yaz-asncomp b/util/yaz-asncomp index d02bd9d..e155e5b 100755 --- a/util/yaz-asncomp +++ b/util/yaz-asncomp @@ -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 " + 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 2e99037..27180b9 100644 --- a/util/yaz-icu.c +++ b/util/yaz-icu.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. */ @@ -11,6 +11,7 @@ #include #include +#include #include @@ -21,12 +22,13 @@ #include #include #include +#include #include #include /* 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, "\n", + fprintf(p_config->outfile, "\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;ixmloutput) - fprintf(config.outfile, "\n", + fprintf(p_config->outfile, "\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, "\n"); + fprintf(p_config->outfile, "\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, "\n", count); + fprintf(p_config->outfile, "\n", count); else - fprintf(config.outfile, "Available ICU transliterators: %d\n", count); - - for(i = 0; i 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, "\n", buf); + fprintf(p_config->outfile, "\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, "\n"); - } + fprintf(p_config->outfile, "\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, "\n", + fprintf(p_config->outfile, "\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;ixmloutput) { - fprintf(config.outfile, "outfile, "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, "\n"); + fprintf(p_config->outfile, "%s", localname_str); + fprintf(p_config->outfile, "\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, "\n"); + fprintf(p_config->outfile, "\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, "\n" + fprintf(p_config->outfile, "\n" "\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, "\n"); + fprintf(p_config->outfile, "\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, "\n" "\n" "\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, "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, "\n" "\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"); diff --git a/util/yaz-illclient.c b/util/yaz-illclient.c index 979400c..4fbff1f 100644 --- a/util/yaz-illclient.c +++ b/util/yaz-illclient.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. */ @@ -31,6 +31,9 @@ * * */ +#if HAVE_CONFIG_H +#include +#endif #include #include diff --git a/util/yaz-record-conv.c b/util/yaz-record-conv.c index d05ea11..86e2eb4 100644 --- a/util/yaz-record-conv.c +++ b/util/yaz-record-conv.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. */ diff --git a/util/yaz-xmlquery.c b/util/yaz-xmlquery.c index dae8105..d203895 100644 --- a/util/yaz-xmlquery.c +++ b/util/yaz-xmlquery.c @@ -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 +#endif #include #include diff --git a/util/yaziconv.c b/util/yaziconv.c index cca3317..3d4a1f0 100644 --- a/util/yaziconv.c +++ b/util/yaziconv.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. */ diff --git a/win/LICENSE.txt b/win/LICENSE.txt index c932eba..41b24e5 100644 --- a/win/LICENSE.txt +++ b/win/LICENSE.txt @@ -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 diff --git a/win/makefile b/win/makefile index d4418f1..b850872 100644 --- a/win/makefile +++ b/win/makefile @@ -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) diff --git a/win/yaz.nsi b/win/yaz.nsi index 4a1c682..be73f62 100644 --- a/win/yaz.nsi +++ b/win/yaz.nsi @@ -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 diff --git a/win/yaz.rc b/win/yaz.rc index c03a1b5..81e2d45 100644 --- a/win/yaz.rc +++ b/win/yaz.rc @@ -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" diff --git a/yaz-config.in b/yaz-config.in index 2074827..9553d94 100644 --- a/yaz-config.in +++ b/yaz-config.in @@ -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 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 +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 +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 index 71ac35b..0000000 --- a/yaz.spec.in +++ /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 -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 -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/zoom/Makefile.am b/zoom/Makefile.am index 218fe33..0a5ed80 100644 --- a/zoom/Makefile.am +++ b/zoom/Makefile.am @@ -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) diff --git a/zoom/zoom-benchmark.c b/zoom/zoom-benchmark.c index 19934f6..25c6759 100644 --- a/zoom/zoom-benchmark.c +++ b/zoom/zoom-benchmark.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. */ diff --git a/zoom/zoom-bug-641.c b/zoom/zoom-bug-641.c index 3fa2fc7..2a2c9d7 100644 --- a/zoom/zoom-bug-641.c +++ b/zoom/zoom-bug-641.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. */ diff --git a/zoom/zoom-ka.c b/zoom/zoom-ka.c index f51f4b9..c39e3f4 100644 --- a/zoom/zoom-ka.c +++ b/zoom/zoom-ka.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. */ diff --git a/zoom/zoomsh.c b/zoom/zoomsh.c index d32d01f..461e848 100644 --- a/zoom/zoomsh.c +++ b/zoom/zoomsh.c @@ -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 +#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/zoom/zoomtst1.c b/zoom/zoomtst1.c index 6e7c034..371a467 100644 --- a/zoom/zoomtst1.c +++ b/zoom/zoomtst1.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. */ diff --git a/zoom/zoomtst10.c b/zoom/zoomtst10.c index 99e388d..837b5f8 100644 --- a/zoom/zoomtst10.c +++ b/zoom/zoomtst10.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. */ diff --git a/zoom/zoomtst11.c b/zoom/zoomtst11.c index 63926ad..bbcffd0 100644 --- a/zoom/zoomtst11.c +++ b/zoom/zoomtst11.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. */ diff --git a/zoom/zoomtst2.c b/zoom/zoomtst2.c index 1bcf83e..ddb43f2 100644 --- a/zoom/zoomtst2.c +++ b/zoom/zoomtst2.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. */ diff --git a/zoom/zoomtst3.c b/zoom/zoomtst3.c index 769df73..7c2f751 100644 --- a/zoom/zoomtst3.c +++ b/zoom/zoomtst3.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. */ diff --git a/zoom/zoomtst4.c b/zoom/zoomtst4.c index 1aa4b5f..ff1e563 100644 --- a/zoom/zoomtst4.c +++ b/zoom/zoomtst4.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. */ diff --git a/zoom/zoomtst5.c b/zoom/zoomtst5.c index 446b6aa..24bcac7 100644 --- a/zoom/zoomtst5.c +++ b/zoom/zoomtst5.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. */ diff --git a/zoom/zoomtst6.c b/zoom/zoomtst6.c index 50f455c..461b03f 100644 --- a/zoom/zoomtst6.c +++ b/zoom/zoomtst6.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. */ diff --git a/zoom/zoomtst7.c b/zoom/zoomtst7.c index c4ca7de..4fb83bd 100644 --- a/zoom/zoomtst7.c +++ b/zoom/zoomtst7.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. */ diff --git a/zoom/zoomtst8.c b/zoom/zoomtst8.c index 792bfda..51340a6 100644 --- a/zoom/zoomtst8.c +++ b/zoom/zoomtst8.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. */ diff --git a/zoom/zoomtst9.c b/zoom/zoomtst9.c index 75b53de..60ceb12 100644 --- a/zoom/zoomtst9.c +++ b/zoom/zoomtst9.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. */ diff --git a/ztest/Makefile.am b/ztest/Makefile.am index 55713fd..dbb59cb 100644 --- a/ztest/Makefile.am +++ b/ztest/Makefile.am @@ -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 diff --git a/ztest/dummy-opac.c b/ztest/dummy-opac.c index 7843b20..50af043 100644 --- a/ztest/dummy-opac.c +++ b/ztest/dummy-opac.c @@ -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 +#endif #include #include diff --git a/ztest/gfs-example.c b/ztest/gfs-example.c index 2e61d43..2aa5d8e 100644 --- a/ztest/gfs-example.c +++ b/ztest/gfs-example.c @@ -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 +#endif #include #include diff --git a/ztest/read-grs.c b/ztest/read-grs.c index 441ee34..162f9ab 100644 --- a/ztest/read-grs.c +++ b/ztest/read-grs.c @@ -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 +#endif #include #include diff --git a/ztest/read-marc.c b/ztest/read-marc.c index 107e679..3737554 100644 --- a/ztest/read-marc.c +++ b/ztest/read-marc.c @@ -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 +#endif #include #include diff --git a/ztest/ztest.c b/ztest/ztest.c index 2ef8921..88e0a21 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.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 * \brief yaz-ztest Generic Frontend Server */ +#if HAVE_CONFIG_H +#include +#endif + #include #include diff --git a/ztest/ztest.h b/ztest/ztest.h index 9b4377a..8e6959c 100644 --- a/ztest/ztest.h +++ b/ztest/ztest.h @@ -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: