configure
libtool
yaz-config
-yaz.spec
yaz.pc
Doxyfile
dox
config.sub
Default
*~
+.settings
[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
DEBIAN_DIST="squeeze lenny"
-UBUNTU_DIST="lucid karmic"
+UBUNTU_DIST="maverick lucid karmic"
-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:
## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
AUTOMAKE_OPTIONS = foreign
+--- 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.
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
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
if [ "`uname -s`" = FreeBSD ]; then
cat <<EOF
When building from a Git, you need these FreeBSD Ports:
- autoconf259, automake19, libtool15, bison, tcl84,
- docbook-xsl, libxml2, libxslt, g++-4.0, make
+ pkg_add -r autoconf262 automake110 libtool bison tcl84 \\
+ docbook-xsl libxml2 libxslt
+ pkg_add -r icu4
EOF
fi
fi
## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
bin_PROGRAMS=yaz-client
EXTRA_PROGRAMS=bertorture
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
/* 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:
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <signal.h>
#if HAVE_SYS_TYPES_H
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/** \file client.c
* \brief yaz-client program
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
static char cur_host[200];
static Odr_int last_hit_count = 0;
+static int pretty_xml = 0;
+
typedef enum {
QueryType_Prefix,
QueryType_CCL,
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;
|| !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))
{
/* 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)
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
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/** \file fhistory.c
* \brief file history implementation
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
/* 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:
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <stdio.h>
/* 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:
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])
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=""
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=""
#include <readline/readline.h>
],[
rl_attempted_completion_over = 0;
- ],AC_DEFINE([HAVE_READLINE_COMPLETION_OVER]))
+ ],AC_DEFINE([HAVE_READLINE_COMPLETION_OVER],1,[Define to 1 if rl_attempted_completion_over is defined]))
AC_TRY_LINK([
#include <stdio.h>
#include <readline/readline.h>
],[
rl_completion_matches (0, 0);
- ],[AC_DEFINE([HAVE_READLINE_RL_COMPLETION_MATCHES])])
+ ],[AC_DEFINE([HAVE_READLINE_RL_COMPLETION_MATCHES],1,[Define to 1 if rl_completion_matches is defined])])
LIBS=$xLIBS
fi
dnl ------ iconv
],[
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"
],[
iconv_t t = iconv_open("", "");
],[
- AC_DEFINE([HAVE_ICONV_H])
+ AC_DEFINE([HAVE_ICONV_H],1)
AC_MSG_RESULT([yes])
],[
LIBS="$oldLIBS"
])
])
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])
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])
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
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"
])
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);}'`
dnl
AC_OUTPUT([
Makefile
-yaz.spec
src/Makefile
test/Makefile
util/Makefile
+yaz (4.1.7-1indexdata) unstable; urgency=low
+
+ * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk> Tue, 15 Mar 2011 13:59:18 +0100
+
+yaz (4.1.6-1indexdata) unstable; urgency=low
+
+ * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk> Thu, 10 Mar 2011 10:25:48 +0100
+
+yaz (4.1.5-1indexdata) unstable; urgency=low
+
+ * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk> Tue, 08 Mar 2011 13:53:17 +0100
+
+yaz (4.1.4-1indexdata) unstable; urgency=low
+
+ * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk> Mon, 21 Feb 2011 12:51:04 +0100
+
+yaz (4.1.3-1indexdata) unstable; urgency=low
+
+ * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk> Thu, 27 Jan 2011 13:56:54 +0100
+
+yaz (4.1.2-1indexdata) unstable; urgency=low
+
+ * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk> Tue, 02 Nov 2010 09:51:51 +0100
+
yaz (4.1.1-1indexdata) unstable; urgency=low
* Upstream.
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
## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
SUBDIRS = common
-Subproject commit 00de5ca16beac9c3ac135ff92ff719b86b0c6df9
+Subproject commit cc59b50a147656750bff1385f50fd6ad656d77e4
<!ENTITY gfs-synopsis-app "application">
<!ENTITY reference-tools-cql-map "<xref linkend='cql.to.rpn'/>">
<!ENTITY reference-tools-ccl-qualifiers "<xref linkend='ccl.qualifiers'/>">
-<!ENTITY copyright-year "1995-2010">
+<!ENTITY copyright-year "1995-2011">
<para>
&yaz; is a C/C++ library for information retrieval applications
- using the Z39.50/SRU protocols for information retrieval.
+ using the Z39.50/SRU/SOLR protocols for information retrieval.
</para>
<para>
</para></listitem>
<listitem><para>
Supports
- <ulink url="&url.solr;">SOLR</ulink> Web Service (client side only)
+ <ulink url="&url.solr;">SOLR</ulink> Web Service version 1.4.x (client side only)
</para></listitem>
<listitem><para>
Supports the following transports: BER over TCP/IP
</para>
<para>
- For TCP/IP and SSL, the special hostname <literal>@</literal>
- (at sign) is mapped to the address <literal>INADDR_ANY</literal>,
- which causes the server to listen on any local interface.
+ For TCP/IP and SSL, the special hostnames <literal>@</literal> and
+ <literal>@6</literal> are mapped to the addresses
+ <literal>INADDR_ANY</literal> (IPV4) and
+ <literal>IN6ADDR_ANY_INIT</literal> (IPV6)
+ respectively.
</para>
<example id="server.example.running.unix"><title>Running the GFS on Unix</title>
Must be one of <literal>POST</literal>,
<literal>GET</literal>, <literal>SOAP</literal> (default)
or <literal>SOLR</literal>. Version
- should be either 1.1 or 1.2. Other versions are allowed - for testing
- purposes (version negotiation with SRU server).
+ should be either 1.1 or 1.2 for SRU. Other versions are allowed - for testing
+ purposes (version negotiation with SRU server).
+ The version is currently not used for SOLR Web Services
</para>
</listitem>
</varlistentry>
<refsynopsisdiv>
<cmdsynopsis>
<command>yaz-icu</command>
- <arg choice="opt" rep="repeat">commands</arg>
<arg>-c <replaceable>config</replaceable></arg>
<arg>-p <replaceable>opt</replaceable></arg>
<arg>-s</arg>
<arg>-x</arg>
+ <arg choice="opt">infile</arg>
</cmdsynopsis>
</refsynopsisdiv>
<command>yaz-icu</command> is utility which demonstrates
the ICU chain module of yaz. (<filename>yaz/icu.h</filename>).
</para>
+ <para>
+ The utility can be used in two ways. It may read some text
+ using an XML configuration for configuring ICU and show text analysis.
+ This mode is triggered by option <literal>-c</literal> which specififies
+ the configuration to be used. The input file is read from standard
+ input or from a file if <literal>infile</literal> is specified.
+ </para>
+ <para>
+ The utility may also show ICU information. This is triggered by
+ option <literal>-p</literal>.
+ </para>
</refsect1>
<refsect1><title>OPTIONS</title>
YAZ is a C/C++ programmer's toolkit supporting the development
of Z39.50v3 clients and servers. The YAZ toolkit offers
several different levels of access to the ISO23950/Z39.50, SRU
- and ILL protocols. The level that you need to use depends
- on your requirements, and the role (server of client) that you want
+ SOLR (client only) and ILL protocols. The level that you need to use depends
+ on your requirements, and the role (server or client) that you want
to implement.
</para>
</refsect1>
connection can be forced to use SRU rather the SRW (the default) by
prefixing the target string with <literal>sru=get,</literal>, like this:
<literal>sru=get,http://sru.miketaylor.org.uk:80/sru.pl</literal>
- </para>
-
+ </para>
+ <para>
+ <ulink url="&url.solr;">SOLR</ulink> protocol support was added to YAZ in version 4.1.0,
+ as a dialect of a SRU protocol, since both are HTTP based protocols.
+ </para>
<para>
The lack of a simple Z39.50 client API for &yaz; has become more
and more apparent over time. So when the first &zoom; specification
<para>
You can prefix the host with a scheme followed by colon. The
default scheme is <literal>tcp</literal> (Z39.50 protocol).
- The scheme <literal>http</literal> selects SRU over HTTP.
+ The scheme <literal>http</literal> selects SRU/get over HTTP by default,
+ but can overridded to use SRU/post, SRW and the SOLR protocol.
</para>
<para>
You can prefix the scheme-qualified host-string with one or more
discover whether the server claims to support the specified
operations.
</entry><entry>none</entry></row>
- <row><entry>
- sru</entry><entry>
- SRU transport type. Must be either <literal>soap</literal>,
+ <row>
+ <entry>sru</entry><entry>
+ SRU/SOLR transport type. Must be either <literal>soap</literal>,
<literal>get</literal>, <literal>post</literal>, or
<literal>solr</literal>.
- </entry><entry>soap</entry></row>
+ </entry><entry>soap</entry></row>
<row><entry>
sru_version</entry><entry>
SRU/SRW version. Should be <literal>1.1</literal>, or
</para>
</sect2>
<sect2 id="zoom.sru.init.behavior">
- <title>SRU Protocol behavior</title>
+ <title>SRU/SOLR Protocol behavior</title>
<para>
- The SRU protocol doesn't feature an Inititialize Request, so
+ The HTTP based protocols (SRU, SRW, SOLR) doesn't feature an Inititialize Request, so
the connection phase merely establishes a TCP/IP connection
with the SOAP service.
</para>
<para>Most of the ZOOM connection options do not
- affect SRU and they are ignored. However, future versions
+ affect SRU/SOLR and they are ignored. However, future versions
of &yaz; might honor <literal>implementationName</literal> and
put that as part of User-Agent header for HTTP requests.
</para>
SRU SearchRetrieveRequest.
</para>
<para>
- Unfortunately, SRU does not define a database setting. Hence,
+ SOLR queries has to be done in SOLR query format.
+ </para>
+ <para>
+ Unfortunately, SRU or SOLR does not define a database setting. Hence,
<literal>databaseName</literal> is unsupported and ignored.
However, the path part in host parameter for functions
<function>ZOOM_connecton_new</function> and
The <parameter>type</parameter> is a string of the format:
</para>
<para>
- <replaceable>form</replaceable>[;charset=<replaceable>from</replaceable>[,<replaceable>to</replaceable>]][;format=<replaceable>v</replaceable>]
+ <replaceable>format</replaceable>[;charset=<replaceable>from</replaceable>[/<replaceable>opacfrom</replaceable>][,<replaceable>to</replaceable>]][;format=<replaceable>v</replaceable>]
</para>
<para>
- where <replaceable>form</replaceable> specifies the format of the
+ where <replaceable>format</replaceable> specifies the format of the
returned record, <replaceable>from</replaceable>
specifies the character set of the record in its original form
(as returned by the server), <replaceable>to</replaceable> specifies
the output (returned)
character set encoding.
- If charset is not given, then no character set conversion takes place.
If <replaceable>to</replaceable> is omitted UTF-8 is assumed.
+ If charset is not given, then no character set conversion takes place.
+ </para>
+
+ <para>OPAC records may be returned in a different
+ set from the bibliographic MARC record. If this is this the case,
+ <replaceable>opacfrom</replaceable> should be set to the character set
+ of the OPAC record part.
</para>
+ <note>
+ <para>
+ Specifying the OPAC record character set requires YAZ 4.1.5 or later.
+ </para>
+ </note>
<para>
The format argument controls whether record data should be XML
pretty-printed (post process operation).
</varlistentry>
<varlistentry><term><literal>xml</literal></term>
<listitem><para>The record is returned in XML if possible.
- SRU and Z39.50 records with transfer syntax XML are
+ SRU, SOLR and Z39.50 records with transfer syntax XML are
returned verbatim. MARC records are returned in
<ulink url="&url.marcxml;">
MARCXML
</para>
</sect2>
<sect2 id="zoom.sru.record.behavior">
- <title>SRU Protocol behavior</title>
+ <title>SRU/SOLR Protocol behavior</title>
<para>
- The ZOOM driver for SRU treats records returned by a SRU server
+ The ZOOM driver for SRU/SOLR treats records returned by a SRU/SOLR server
as if they where Z39.50 records with transfer syntax XML and
no element set name or database name.
</para>
</sect1>
<sect1 id="zoom.facets"><title>Facets</title>
<para>
+ Facets operations is not part of the official ZOOM specification, but is an Index Data extension
+ for YAZ-based Z39.50 targets or <ulink url="&url.solr;">SOLR</ulink> targets.
In case the target can and is requested to return facets, using a result set the ZOOM client
can request one or all facet fields. Using a facet field the client can request the term count and
then interate over the terms.
</para>
<para>
- The Scan interface is supported for both Z39.50 and SRU.
+ The Scan interface is supported for both Z39.50, SRU (and SOLR?).
</para>
<synopsis>
## 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 = \
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
Makefile
Makefile.in
+config.h
+config.h.in
+stamp-h1
\ No newline at end of file
## This file is part of the YAZ toolkit.
-## Copyright (C) 1995-2010 Index Data
+## Copyright (C) 1995-2011 Index Data
AUTOMAKE_OPTIONS = foreign
## 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
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
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
\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
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
\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);
/* 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:
\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);
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
--- /dev/null
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data.
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Index Data nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file stemming.h
+ * \brief Header for the stemming API. Simple wrapper to hide underlying implementation.
+ */
+
+#ifndef YAZ_STEMMER_H
+#define YAZ_STEMMER_H
+
+#include <yaz/yconfig.h>
+#include <yaz/xmltypes.h>
+#include <yaz/icu_I18N.h>
+#include <yaz/log.h>
+
+#include <unicode/ustring.h> /* some more string fcns*/
+#include <unicode/uchar.h> /* char names */
+
+
+YAZ_BEGIN_CDECL
+
+typedef struct yaz_stemmer_t *yaz_stemmer_p;
+
+YAZ_EXPORT
+yaz_stemmer_p yaz_stemmer_create(const char *locale, const char *rule, UErrorCode *status);
+
+YAZ_EXPORT
+yaz_stemmer_p yaz_stemmer_clone(yaz_stemmer_p stemmer);
+
+YAZ_EXPORT
+void yaz_stemmer_stem(yaz_stemmer_p stemmer, struct icu_buf_utf16 *dst, struct icu_buf_utf16* src, UErrorCode *status);
+
+YAZ_EXPORT
+void yaz_stemmer_destroy(yaz_stemmer_p stemmer);
+
+#endif
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
__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
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
/* 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:
#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);
--- /dev/null
+Subproject commit 368f4a253716e312b66209d61c927d5039c51287
-Subproject commit 1fa0b45a8141955801938f967f1d1dca1b042c17
+Subproject commit 96ff03f91b4539e315dadd50ab2564412c076394
## 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
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_
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
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file ccl_stop_words.c
* \brief Removes stop words from terms in RPN tree
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* This source file implements mapping between CCL error code and
* their string equivalents.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/ccl.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* of lookahead in the handling of relational operations.. So
* it's not really pure.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <string.h>
/* 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:
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* This source file implements functions to parse and print
* a CCL node tree (as a result of parsing).
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file cclqfile.c
* \brief Implements parsing of CCL qualifier specs in files
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file cclqual.c
* \brief Implements CCL qualifier utilities
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file cclstr.c
* \brief Implements CCL string compare utilities
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file ccltoken.c
* \brief Implements CCL lexical analyzer (scanner)
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file cclxmlconfig.c
\brief XML configuration for CCL
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
puts $f " Generated automatically by charconv.tcl"
puts $f "*/"
puts $f "\#include <string.h>"
+
+ puts $f "\#if HAVE_CONFIG_H"
+ puts $f "\#include <config.h>"
+ puts $f "\#endif"
+
puts $f "
struct yaz_iconv_trie_flat {
char from\[6\];
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file charneg.c
* \brief Implements Z39.50 Charset negotiation utilities
*
* Helper functions for Character Set and Language Negotiation - 3
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <yaz/otherinfo.h>
#include <yaz/z-charneg.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file comstack.c
* \brief Implements Generic COMSTACK functions
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <ctype.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file copy_types.c
\brief Copies various Z39.50 types
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/copy_types.h>
/* 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. */
* This is a YACC parser, but since it must be reentrant, Bison is required.
* The original source file is cql.y.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/*
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/*
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file cqlstdio.c
* \brief Implements query stream reading using FILE handle.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/cql.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file cqlstrer.c
* \brief Implements CQL error code map to description string.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/cql.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file cqlstring.c
* \brief Implements query stream reader that reads from a C string.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/cql.h>
/* This file 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).
* index
* relationModifier
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file cqlutil.c
* \brief Implements CQL tree node utilities.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <string.h>
puts $hfile "/** \\file [lindex $ifiles 2]"
set preamble " \\brief Diagnostics: Generated by csvtodiag.tcl from [lindex $ifiles 0] */"
puts $cfile $preamble
+ puts $cfile "\#ifdef HAVE_CONFIG_H"
+ puts $cfile "\#include <config.h>"
+ puts $cfile "\#endif"
+
puts $cfile "
#include \"diag-entry.h\"
\#include \"[lindex $ifiles 2]\"
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* 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:
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file 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.
* This source implements the main event loop for the Generic Frontend
* Server.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <errno.h>
/* 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:
/* This file 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 (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)
if (ae->which == Z_AttributeValue_numeric)
{
av->limit = *ae->value.numeric;
- yaz_log(YLOG_DEBUG, "limitattr %d ", av->limit);
}
else
{
{
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);
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 */
}
/* This file 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 <sys/stat.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <assert.h>
#include <yaz/wrbuf.h>
#include <yaz/tpath.h>
}
}
+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];
(*res)->entries = 0;
(*res)->last_entry = &(*res)->entries;
glob_r(*res, pattern, 0, prefix);
+ sort_them(*res);
return 0;
}
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file grs1disp.c
* \brief Implements display of GRS-1 records
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file http.c
* \brief Implements HTTP decoding
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <ctype.h>
#include <yaz/odr.h>
/* 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:
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
#include <yaz/icu_I18N.h>
-#include <yaz/log.h>
+#include <yaz/stemmer.h>
+#include <yaz/log.h>
+#include <yaz/nmem.h>
+#include <yaz/nmem_xml.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
enum icu_chain_step_type {
ICU_chain_step_type_none,
- ICU_chain_step_type_display, /* convert to utf8 display format */
- ICU_chain_step_type_casemap, /* apply utf16 charmap */
- ICU_chain_step_type_transform, /* apply utf16 transform */
- ICU_chain_step_type_tokenize, /* apply utf16 tokenization */
- ICU_chain_step_type_transliterate /* apply utf16 tokenization */
+ ICU_chain_step_type_display, /* convert to utf8 display format */
+ ICU_chain_step_type_casemap, /* apply utf16 charmap */
+ ICU_chain_step_type_transform, /* apply utf16 transform */
+ ICU_chain_step_type_tokenize, /* apply utf16 tokenization */
+ ICU_chain_step_type_transliterate, /* apply utf16 tokenization */
+ YAZ_chain_step_type_stemming /* apply utf16 stemming (YAZ) */
};
struct icu_chain_step
/* 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
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)
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;
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;
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;
}
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;
}
}
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;
return chain;
}
-void icu_chain_destroy(struct icu_chain * chain)
+void icu_chain_destroy(struct icu_chain *chain)
{
if (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;
return 0;
{
- xmlChar * xml_locale = xmlGetProp((xmlNode *) xml_node,
- (xmlChar *) "locale");
+ xmlChar *xml_locale = xmlGetProp((xmlNode *) xml_node,
+ (xmlChar *) "locale");
if (xml_locale)
{
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"))
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 {
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);
}
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)
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);
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
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);
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file ill-get.c
* \brief Implements ILL package creator utilities
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <yaz/ill.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file json.c
* \brief JSON encoding/decoding
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/json.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
static int l_level = YLOG_DEFAULT_LEVEL;
enum l_file_type { use_stderr, use_none, use_file };
-static enum l_file_type yaz_file_type = use_stderr;
-static FILE *yaz_global_log_file = NULL;
+
+struct {
+ enum l_file_type type;
+ FILE *log_file;
+ char l_prefix[512];
+ char l_prefix2[512];
+ char l_fname[512];
+} yaz_log_info = {
+ use_stderr, 0, "", "", ""
+};
static void (*start_hook_func)(int, const char *, void *) = NULL;
static void *start_hook_info;
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
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;
}
}
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();
}
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)
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);
}
}
- 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);
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
{
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);
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file logrpn.c
* \brief Implements Z39.50 Query Printing
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <assert.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file
* \brief Glob expression match
*/
-
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* 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:
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* 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:
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
puts $hfile "\#ifndef OID_STD_H"
puts $hfile "\#define OID_STD_H"
+ puts $cfile "\#if HAVE_CONFIG_H"
+ puts $cfile "\#include <config.h>"
+ puts $cfile "\#endif"
+
puts $cfile "\#include <yaz/oid_db.h>"
puts $cfile ""
# To avoid LNK4049
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file opacdisp.c
* \brief Implements OPAC record display
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
#include <yaz/proto.h>
#include <yaz/marcdisp.h>
-static void opac_element_str(WRBUF wrbuf, yaz_iconv_t cd,
+static void opac_element_str(WRBUF wrbuf, yaz_iconv_t cd1, yaz_iconv_t cd2,
int l, const char *elem,
const char *data)
{
if (data)
{
+ size_t pos;
while (--l >= 0)
wrbuf_puts(wrbuf, " ");
wrbuf_puts(wrbuf, "<");
wrbuf_puts(wrbuf, elem);
wrbuf_puts(wrbuf, ">");
- wrbuf_iconv_puts_cdata(wrbuf, cd, data);
+
+ pos = wrbuf->pos; /* save position */
+ if (wrbuf_iconv_write_x(wrbuf, cd1, data, strlen(data), 1) && cd2)
+ {
+ wrbuf->pos = pos; /* rewind to pos */
+ wrbuf_iconv_write_x(wrbuf, cd2, data, strlen(data), 1);
+ }
wrbuf_puts(wrbuf, "</");
wrbuf_puts(wrbuf, elem);
wrbuf_puts(wrbuf, ">\n");
}
}
-void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf)
+void yaz_opac_decode_wrbuf2(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf,
+ yaz_iconv_t cd2)
{
int i;
- yaz_iconv_t cd = yaz_marc_get_iconv(mt);
+ yaz_iconv_t cd1 = yaz_marc_get_iconv(mt);
wrbuf_puts(wrbuf, "<opacRecord>\n");
if (r->bibliographicRecord)
Z_HoldingsAndCircData *d = h->u.holdingsAndCirc;
- opac_element_str(wrbuf, cd, 2, "typeOfRecord", d->typeOfRecord);
- opac_element_str(wrbuf, cd, 2, "encodingLevel", d->encodingLevel);
- opac_element_str(wrbuf, cd, 2, "format", d->format);
- opac_element_str(wrbuf, cd, 2, "receiptAcqStatus", d->receiptAcqStatus);
- opac_element_str(wrbuf, cd, 2, "generalRetention", d->generalRetention);
- opac_element_str(wrbuf, cd, 2, "completeness", d->completeness);
- opac_element_str(wrbuf, cd, 2, "dateOfReport", d->dateOfReport);
- opac_element_str(wrbuf, cd, 2, "nucCode", d->nucCode);
- opac_element_str(wrbuf, cd, 2, "localLocation", d->localLocation);
- opac_element_str(wrbuf, cd, 2, "shelvingLocation", d->shelvingLocation);
- opac_element_str(wrbuf, cd, 2, "callNumber", d->callNumber);
- opac_element_str(wrbuf, cd, 2, "shelvingData", d->shelvingData);
-
- opac_element_str(wrbuf, cd, 2, "copyNumber", d->copyNumber);
- opac_element_str(wrbuf, cd, 2, "publicNote", d->publicNote);
- opac_element_str(wrbuf, cd, 2, "reproductionNote", d->reproductionNote);
- opac_element_str(wrbuf, cd, 2, "termsUseRepro", d->termsUseRepro);
- opac_element_str(wrbuf, cd, 2, "enumAndChron", d->enumAndChron);
+ opac_element_str(wrbuf, cd1, cd2, 2, "typeOfRecord",
+ d->typeOfRecord);
+ opac_element_str(wrbuf, cd1, cd2, 2, "encodingLevel",
+ d->encodingLevel);
+ opac_element_str(wrbuf, cd1, cd2, 2, "format",
+ d->format);
+ opac_element_str(wrbuf, cd1, cd2, 2, "receiptAcqStatus",
+ d->receiptAcqStatus);
+ opac_element_str(wrbuf, cd1, cd2, 2, "generalRetention",
+ d->generalRetention);
+ opac_element_str(wrbuf, cd1, cd2, 2, "completeness",
+ d->completeness);
+ opac_element_str(wrbuf, cd1, cd2, 2, "dateOfReport",
+ d->dateOfReport);
+ opac_element_str(wrbuf, cd1, cd2, 2, "nucCode", d->nucCode);
+ opac_element_str(wrbuf, cd1, cd2, 2, "localLocation",
+ d->localLocation);
+ opac_element_str(wrbuf, cd1, cd2, 2, "shelvingLocation",
+ d->shelvingLocation);
+ opac_element_str(wrbuf, cd1, cd2, 2, "callNumber",
+ d->callNumber);
+ opac_element_str(wrbuf, cd1, cd2, 2, "shelvingData",
+ d->shelvingData);
+ opac_element_str(wrbuf, cd1, cd2, 2, "copyNumber",
+ d->copyNumber);
+ opac_element_str(wrbuf, cd1, cd2, 2, "publicNote",
+ d->publicNote);
+ opac_element_str(wrbuf, cd1, cd2, 2, "reproductionNote",
+ d->reproductionNote);
+ opac_element_str(wrbuf, cd1, cd2, 2, "termsUseRepro",
+ d->termsUseRepro);
+ opac_element_str(wrbuf, cd1, cd2, 2, "enumAndChron",
+ d->enumAndChron);
if (d->num_volumes)
{
wrbuf_puts (wrbuf, " <volumes>\n");
for (j = 0; j<d->num_volumes; j++)
{
wrbuf_puts (wrbuf, " <volume>\n");
- opac_element_str(wrbuf, cd, 4, "enumeration",
+ opac_element_str(wrbuf, cd1, cd2, 4, "enumeration",
d->volumes[j]->enumeration);
- opac_element_str(wrbuf, cd, 4, "chronology",
+ opac_element_str(wrbuf, cd1, cd2, 4, "chronology",
d->volumes[j]->chronology);
- opac_element_str(wrbuf, cd, 4, "enumAndChron",
+ opac_element_str(wrbuf, cd1, cd2, 4, "enumAndChron",
d->volumes[j]->enumAndChron);
wrbuf_puts(wrbuf, " </volume>\n");
}
wrbuf_puts(wrbuf," <circulation>\n");
opac_element_bool(wrbuf, 4, "availableNow",
d->circulationData[j]->availableNow);
- opac_element_str(wrbuf, cd, 4, "availabiltyDate",
+ opac_element_str(wrbuf, cd1, cd2, 4, "availabiltyDate",
d->circulationData[j]->availablityDate);
- opac_element_str(wrbuf, cd, 4, "availableThru",
+ opac_element_str(wrbuf, cd1, cd2, 4, "availableThru",
d->circulationData[j]->availableThru);
- opac_element_str(wrbuf, cd, 4, "restrictions",
+ opac_element_str(wrbuf, cd1, cd2, 4, "restrictions",
d->circulationData[j]->restrictions);
- opac_element_str(wrbuf, cd, 4, "itemId",
+ opac_element_str(wrbuf, cd1, cd2, 4, "itemId",
d->circulationData[j]->itemId);
opac_element_bool(wrbuf, 4, "renewable",
d->circulationData[j]->renewable);
opac_element_bool(wrbuf, 4, "onHold",
d->circulationData[j]->onHold);
- opac_element_str(wrbuf, cd, 4, "enumAndChron",
+ opac_element_str(wrbuf, cd1, cd2, 4, "enumAndChron",
d->circulationData[j]->enumAndChron);
- opac_element_str(wrbuf, cd, 4, "midspine",
+ opac_element_str(wrbuf, cd1, cd2, 4, "midspine",
d->circulationData[j]->midspine);
- opac_element_str(wrbuf, cd, 4, "temporaryLocation",
+ opac_element_str(wrbuf, cd1, cd2, 4, "temporaryLocation",
d->circulationData[j]->temporaryLocation);
wrbuf_puts(wrbuf, " </circulation>\n");
}
wrbuf_puts(wrbuf, "</opacRecord>\n");
}
+void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf)
+{
+ yaz_opac_decode_wrbuf2(mt, r, wrbuf, 0);
+}
+
/*
* Local variables:
* c-basic-offset: 4
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file otherinfo.c
* \brief Implements Z39.50 OtherInfo utilities
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file
* \brief Select, poll wrapper
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file pquery.c
* \brief Implements PQF parsing
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file prt-ext.c
* \brief Implements handling of various Z39.50 Externals
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/proto.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file query-charset.c
\brief converts General Terms in RPN queries
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <assert.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file querytowrbuf.c
\brief Convert Z39.50 Z_Query to PQF (as WRBUF string)
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <assert.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file record_render.c
* \brief Render Z39.50 records (NamePlusRecord)
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
#include <yaz/proto.h>
#include <yaz/oid_db.h>
-static yaz_iconv_t iconv_create_charset(const char *record_charset)
+static yaz_iconv_t iconv_create_charset(const char *record_charset,
+ yaz_iconv_t *cd2)
{
- char to[40];
- char from[40];
+ char charset_buf[40];
yaz_iconv_t cd = 0;
-
- *from = '\0';
- strcpy(to, "UTF-8");
+ char *from_set1 = 0;
+ char *from_set2 = 0;
+ char *to_set = 0;
if (record_charset && *record_charset)
{
- /* Use "from,to" or just "from" */
- const char *cp = strchr(record_charset, ',');
- size_t clen = strlen(record_charset);
- if (cp && cp[1])
+ char *cp = charset_buf;
+
+ strncpy(charset_buf, record_charset, sizeof(charset_buf)-1);
+ charset_buf[sizeof(charset_buf)-1] = '\0';
+
+ from_set1 = cp;
+ while (*cp && *cp != ',' && *cp != '/')
+ cp++;
+ if (*cp == '/')
{
- strncpy( to, cp+1, sizeof(to)-1);
- to[sizeof(to)-1] = '\0';
- clen = cp - record_charset;
+ *cp++ = '\0'; /* terminate from_set1 */
+ from_set2 = cp;
+ while (*cp && *cp != ',')
+ cp++;
+ }
+ if (*cp == ',')
+ {
+ *cp++ = '\0'; /* terminate from_set1 or from_set2 */
+ to_set = cp;
+ while (*cp)
+ cp++;
}
- if (clen > sizeof(from)-1)
- clen = sizeof(from)-1;
-
- if (clen)
- strncpy(from, record_charset, clen);
- from[clen] = '\0';
}
- if (*from && *to)
- cd = yaz_iconv_open(to, from);
+
+ if (from_set1)
+ cd = yaz_iconv_open(to_set ? to_set : "UTF-8", from_set1);
+ if (cd2)
+ {
+ if (from_set2)
+ *cd2 = yaz_iconv_open(to_set ? to_set : "UTF-8", from_set2);
+ else
+ *cd2 = 0;
+ }
return cd;
}
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;
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);
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)
{
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* We also use the request-freelist to store encoding buffers, rather than
* freeing and xmalloc'ing them on each cycle.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file
* \brief Implements RPN to CQL conversion
- *
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file
* \brief Implements RPN to SOLR conversion
- *
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file sc.c
* \brief Windows Service Control
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#ifdef WIN32
#include <windows.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file sc_test.c
* \brief Small test for the Windows Service Control utility
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#ifdef WIN32
#include <windows.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* minimize memory allocation/deallocation during normal operation.
*
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <limits.h>
#include <stdlib.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,
}
if (freq.record == 0) /* no error and no record ? */
{
+ *pres = Z_PresentStatus_partial_4;
*next = 0; /* signal end-of-set and stop */
break;
}
/* 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:
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file snprintf.c
* \brief snprintf wrapper
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdarg.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* This implements encoding and decoding of SOAP packages using
* Libxml2.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/soap.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
- * \file srwutil.c
- * \brief Implements SRW/SRU utilities.
+ * \file solr.c
+ * \brief Implements SOAP Webservice decoding/encoding
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <assert.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
-const char *xml_node_attribute_value_get(xmlNodePtr ptr, const char *node_name, const char *attribute_name) {
-
- struct _xmlAttr *attr;
- // check if the node name matches
- if (strcmp((const char*) ptr->name, node_name))
- return 0;
- // check if the attribute name and return the value
- for (attr = ptr->properties; attr; attr = attr->next)
- if (attr->children && attr->children->type == XML_TEXT_NODE) {
- if (!strcmp((const char *) attr->name, attribute_name))
- return (const char *) attr->children->content;
- }
- return 0;
-}
-
-
static int match_xml_node_attribute(xmlNodePtr ptr, const char *node_name, const char *attribute_name, const char *value)
{
const char *attribute_value;
// check if the node name matches
if (strcmp((const char*) ptr->name, node_name))
return 0;
- attribute_value = xml_node_attribute_value_get(ptr, node_name, attribute_name);
- if (attribute_value && !strcmp(attribute_value, value))
+ if (attribute_name) {
+ attribute_value = yaz_element_attribute_value_get(ptr, node_name, attribute_name);
+ if (attribute_value && !strcmp(attribute_value, value))
+ return 1;
+ }
+ else /* No attribute to check */
return 1;
return 0;
}
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)
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++;
}
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;
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file solrtransform.c
* \brief Implements SOLR transform (SOLR to RPN conversion).
- *
- * Evaluation order of rules:
- *
- * always
- * relation
- * structure
- * position
- * truncation
- * index
- * relationModifier
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file sortspec.c
* \brief Implements SortSpec parsing.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* 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:
void yaz_add_name_value_int(ODR o, char **name, char **value, int *i,
char *a_name, Odr_int *val);
+
+Z_AttributeList *yaz_use_atttribute_create(ODR o, const char *name);
+
+#if YAZ_HAVE_XML2
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+const char *yaz_element_attribute_value_get(xmlNodePtr ptr, const char *node_name, const char *attribute_name);
+#endif
+
/*
* Local variables:
* c-basic-offset: 4
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file srw.c
* \brief Implements SRW/SRU package encoding and decoding
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
#include <yaz/srw.h>
+#include <yaz/wrbuf.h>
#if YAZ_HAVE_XML2
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <assert.h>
+#include "sru-p.h"
+
static void add_XML_n(xmlNodePtr ptr, const char *elem, char *val, int len,
xmlNsPtr ns_ptr)
{
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;
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"))
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file srwutil.c
* \brief Implements SRW/SRU utilities.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <assert.h>
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"
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,
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
* \brief Implements GFS logic
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
}
}
+static void remove_listeners(void);
+
/*
* handle incoming connect requests.
* The dynamic mode is a bit tricky mostly because we want to avoid
return;
}
+ if (control_block.one_shot)
+ remove_listeners();
+
yaz_log(log_sessiondetail, "Connect from %s", cs_addrstr(new_line));
no_sessions++;
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)
--- /dev/null
+
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if YAZ_HAVE_ICU
+
+#include <yaz/yconfig.h>
+
+#include <yaz/stemmer.h>
+
+#include <yaz/xmalloc.h>
+
+#include <libstemmer.h>
+
+#include <unicode/ustring.h> /* some more string fcns*/
+#include <unicode/uchar.h> /* char names */
+
+enum stemmer_implementation {
+ yaz_no_operation,
+ yaz_snowball
+};
+struct yaz_stemmer_t
+{
+ int implementation;
+ // Required for cloning.
+ char *locale;
+ char *rule;
+ struct sb_stemmer *sb_stemmer;
+};
+
+const char* yaz_stemmer_lookup_charenc(const char *charenc, const char *rule) {
+ return "UTF_8";
+}
+
+const char* yaz_stemmer_lookup_algorithm(const char *locale, const char *rule) {
+ return locale;
+}
+
+yaz_stemmer_p yaz_stemmer_snowball_create(const char *locale, const char *rule, UErrorCode *status) {
+ const char *charenc = yaz_stemmer_lookup_charenc(locale, rule);
+ const char *algorithm = yaz_stemmer_lookup_algorithm(locale,rule);
+ struct sb_stemmer *stemmer = sb_stemmer_new(algorithm, charenc);
+ yaz_stemmer_p yaz_stemmer;
+ if (stemmer == 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ yaz_log(YLOG_FATAL, "yaz_stemmer: Failed to create snowball stemmer from locale %srule %s. Showball: charenc %s algorithm %s ",
+ locale, rule, charenc, algorithm);
+ return 0;
+ }
+ yaz_log(YLOG_DEBUG, "created snowball stemmer: algoritm %s charenc %s ", algorithm, charenc);
+ yaz_stemmer = xmalloc(sizeof(*yaz_stemmer));
+ yaz_stemmer->implementation = yaz_snowball;
+
+ yaz_stemmer->locale = xstrdup(locale);
+ yaz_stemmer->rule = xstrdup(rule);
+ yaz_stemmer->sb_stemmer = stemmer;
+ yaz_log(YLOG_DEBUG, "created snowball stemmer: algoritm %s charenc %s ", algorithm, charenc);
+ return yaz_stemmer;
+}
+
+yaz_stemmer_p yaz_stemmer_create(const char *locale, const char *rule, UErrorCode *status) {
+ *status = U_ZERO_ERROR;
+ // dispatch logic required if more algorithms is implemented.
+ yaz_log(YLOG_DEBUG, "create stemmer: locale %s rule %s ", locale, rule);
+ return yaz_stemmer_snowball_create(locale, rule, status);
+}
+
+yaz_stemmer_p yaz_stemmer_clone(yaz_stemmer_p stemmer) {
+ UErrorCode error = U_ZERO_ERROR;
+ if (stemmer == 0)
+ return 0;
+ return yaz_stemmer_create(stemmer->locale, stemmer->rule, &error);
+}
+
+void yaz_stemmer_stem(yaz_stemmer_p stemmer, struct icu_buf_utf16 *dst, struct icu_buf_utf16* src, UErrorCode *status)
+{
+ switch(stemmer->implementation) {
+ case yaz_snowball: {
+ struct icu_buf_utf8 *utf8_buf = icu_buf_utf8_create(0);
+ icu_utf16_to_utf8(utf8_buf, src, status);
+ if (*status == U_ZERO_ERROR) {
+ const sb_symbol *cstr = (const sb_symbol*) icu_buf_utf8_to_cstr(utf8_buf);
+ const sb_symbol *sb_symbol = sb_stemmer_stem(stemmer->sb_stemmer, cstr, utf8_buf->utf8_len);
+ if (sb_symbol == 0) {
+ icu_buf_utf16_copy(dst, src);
+ }
+ else {
+
+ const char *cstr2 = (const char *) sb_symbol;
+ icu_utf16_from_utf8_cstr(dst, cstr2 , status);
+#if 0
+ yaz_log(YLOG_DEBUG, "stemming %s to %s ", cstr, cstr2);
+#endif
+ }
+ }
+ icu_buf_utf8_destroy(utf8_buf);
+ return ;
+ break;
+ }
+ case yaz_no_operation:
+ yaz_log(YLOG_DEBUG, "Stemmer (No operation) called");
+ default: {
+ // Default return the same as given.
+ icu_buf_utf16_copy(dst, src);
+ }
+ }
+}
+
+void yaz_stemmer_destroy(yaz_stemmer_p stemmer)
+{
+ /* Handle no stemmer correctly */
+ if (stemmer == 0)
+ return ;
+
+ switch (stemmer->implementation) {
+ case yaz_snowball:
+ sb_stemmer_delete(stemmer->sb_stemmer);
+ break;
+ }
+ xfree(stemmer->locale);
+ xfree(stemmer->rule);
+ xfree(stemmer);
+}
+
+#endif /* YAZ_HAVE_ICU */
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \brief Implements TCP WRAPPER check.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file tcpip.c
* \brief Implements TCP/IP + SSL COMSTACK.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
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
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;
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file tokenizer.c
* \brief Simple tokenizer system.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file unix.c
* \brief Implements UNIX domain socket COMSTACK
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#ifndef WIN32
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
- * \file srwutil.c
- * \brief Implements SRW/SRU utilities.
+ * \file uri.c
+ * \brief Implements URI utilities.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <yaz/srw.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file waislen.c
* \brief Implements WAIS package handling
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <yaz/comstack.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
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];
{
int e = yaz_iconv_error(cd);
if (e != YAZ_ICONV_E2BIG)
+ {
+ ret = -1;
break;
+ }
}
if (cdata)
wrbuf_xmlputs_n(b, outbuf, outp - outbuf);
else
wrbuf_write(b, buf, size);
}
+ return ret;
}
void wrbuf_iconv_write(WRBUF b, yaz_iconv_t cd, const char *buf, size_t size)
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file xcqlutil.c
* \brief Implements CQL to XCQL conversion.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file
\brief Log XML / XSLT Errors via yaz_log
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file xmlquery.c
\brief Query / XML conversions
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file yaz-ccl.c
* \brief Implements CCL node tree to RPN converson.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file zgdu.c
* \brief Implements HTTP and Z39.50 encoding and decoding.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <yaz/odr.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zget.c
* \brief Implements Z39.50 package creator utilities
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/proto.h>
#include <yaz/oid_db.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zoom-c.c
* \brief Implements ZOOM C interface.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
static void initlog(void)
{
static int log_level_initialized = 0;
+
if (!log_level_initialized)
{
log_api0 = yaz_log_module_level("zoom");
}
}
+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;
YAZ_SHPTR_INIT(r->record_wrbuf, w);
}
#endif
+ resultset_use(1);
return r;
}
#if SHPTR
YAZ_SHPTR_DEC(r->record_wrbuf, wrbuf_destroy);
#endif
+ resultset_use(-1);
xfree(r);
}
else
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);
}
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zoom-event.c
* \brief Implements ZOOM Event stuff
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zoom-opt.c
* \brief Implements ZOOM options handling
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <assert.h>
#include "zoom-p.h"
/* 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:
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zoom-query.c
* \brief Implements ZOOM C query interface.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zoom-record-cache.c
* \brief Implements ZOOM record caching
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zoom-socket.c
* \brief Implements ZOOM C socket interface.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zoom-sru.c
* \brief Implements ZOOM SRU
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/**
* \file zoom-z3950.c
* \brief Implements ZOOM Z39.50 handling
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
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;
package_oid = yaz_oid_extserv_database_update;
break;
default:
+ ZOOM_set_error(p->connection, ZOOM_ERROR_ES_INVALID_VERSION, version);
return 0;
}
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)
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);
test_file_glob
test_log_thread
test_mutex
+test_libstemmer
*.log
*.o
*~
## 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 \
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
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
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
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
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
-/* CCL test */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <yaz/ccl_xml.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
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;
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);
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
#if HAVE_CONFIG_H
#include <config.h>
#endif
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
xmlFreeDoc(doc);
YAZ_CHECK(chain);
+ if (!chain)
+ return;
YAZ_CHECK(icu_chain_assign_cstr(chain, en_str, &status));
xmlFreeDoc(doc);
YAZ_CHECK(chain);
+ if (!chain)
+ return;
YAZ_CHECK(icu_chain_assign_cstr(
chain, "O Romeo, Romeo! wherefore art thou\t Romeo?",
xmlFreeDoc(doc);
YAZ_CHECK(chain);
+ if (!chain)
+ return;
YAZ_CHECK(test_iter(chain, "Adobe Acrobat Reader, 1991-1999.",
"[adobe][acrobat][reader][1991][][1999][]"));
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data
+ * See the file LICENSE for details.
+ */
/**
* \file
* \brief JSON test
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <yaz/test.h>
#include <yaz/json.h>
#include <string.h>
--- /dev/null
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data
+ * See the file LICENSE for details.
+ */
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <yaz/test.h>
+
+#if YAZ_HAVE_ICU
+#include <yaz/stemmer.h>
+
+int test_stemmer_stem(yaz_stemmer_p stemmer, const char* to_stem, const char *expected)
+{
+ struct icu_buf_utf16 *src = icu_buf_utf16_create(0);
+ struct icu_buf_utf16 *dst = icu_buf_utf16_create(0);
+ struct icu_buf_utf8 *dst8 = icu_buf_utf8_create(0);
+
+ UErrorCode status;
+ const char *result;
+ icu_utf16_from_utf8_cstr(src, to_stem, &status);
+ yaz_stemmer_stem(stemmer, dst, src, &status);
+ /* Assume fail */
+ int rc = 0;
+ if (status == U_ZERO_ERROR) {
+ icu_utf16_to_utf8(dst8, dst, &status);
+ result = icu_buf_utf8_to_cstr(dst8);
+ rc = strcmp(result, expected) == 0;
+ }
+ icu_buf_utf8_destroy(dst8);
+ icu_buf_utf16_destroy(src);
+ icu_buf_utf16_destroy(dst);
+ return rc;
+}
+
+
+static void tst(void)
+{
+ UErrorCode status;
+ //== U_ZERO_ERROR;
+ yaz_stemmer_p stemmer = yaz_stemmer_create("en", "porter", &status);
+ YAZ_CHECK(stemmer);
+
+ /* fail */
+ YAZ_CHECK(test_stemmer_stem(stemmer, "beer", "water") == 0 );
+
+ /* Same */
+ YAZ_CHECK(test_stemmer_stem(stemmer, "adadwwr", "adadwwr"));
+
+ /* Remove S */
+ YAZ_CHECK(test_stemmer_stem(stemmer, "beers", "beer"));
+ YAZ_CHECK(test_stemmer_stem(stemmer, "persons", "person"));
+
+ /* Remove s and ing */
+ YAZ_CHECK(test_stemmer_stem(stemmer, "runs", "run"));
+ YAZ_CHECK(test_stemmer_stem(stemmer, "running", "run"));
+
+ yaz_stemmer_destroy(stemmer);
+}
+#endif
+
+int main (int argc, char **argv)
+{
+ YAZ_CHECK_INIT(argc, argv);
+#if YAZ_HAVE_ICU
+ tst();
+#endif
+ YAZ_CHECK_TERM;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/test.h>
#include <yaz/match_glob.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
#include <yaz/oid_util.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdlib.h>
#include <yaz/pquery.h>
#include <yaz/proto.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
#include <yaz/record_conv.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
#include <yaz/retrieval.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#if YAZ_HAVE_XML2
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <yaz/test.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
#include <yaz/tpath.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <string.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
--- /dev/null
+`a'
+``a''
--- /dev/null
+1 1 '‘a'
+' ''
+2 2 '“a''
+' ''
--- /dev/null
+<icu_chain locale="en">
+ <transliterate>
+$back = \` ;
+$back $back > “ ; # generate right d.q.m. (double quotation mark)
+$back > ‘ ;
+ </transliterate>
+</icu_chain>
+
--- /dev/null
+men running
+he runs
--- /dev/null
+1 1 'men' ''
+2 1 'run' ''
+3 2 'he' ''
+4 2 'run' ''
--- /dev/null
+<icu_chain locale="en">
+ <transform rule="[:Control:] Any-Remove"/>
+ <tokenize rule="l"/>
+ <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
+ <casemap rule="l"/>
+ <stemming rule="english" />
+</icu_chain>
## 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
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <yaz/srw.h>
#!/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.
#
puts $file(outc) ""
puts $file(outc) " ${greeting} ${yc_version}"
puts $file(outc) "*/"
+
+ puts $file(outc) "\#if HAVE_CONFIG_H"
+ puts $file(outc) "\#include <config.h>"
+ puts $file(outc) "\#endif"
+
puts $file(outc) {}
puts $file(outh) "/** \\file $inf(h-file)"
/* This file 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 <stdio.h>
#include <stdlib.h>
+#include <errno.h>
#include <yaz/options.h>
#include <unicode/ucol.h>
#include <unicode/ubrk.h>
#include <unicode/utrans.h>
+#include <unicode/uclean.h>
#include <yaz/icu.h>
#include <yaz/wrbuf.h>
/* commando line and config parameters */
-static struct config_t {
+struct config_t {
char conffile[1024];
char print[1024];
int xmloutput;
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"
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 */
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);
}
count = ucnv_countAvailable();
if (p_config->xmloutput)
- fprintf(config.outfile, "<converters count=\"%d\" default=\"%s\">\n",
+ fprintf(p_config->outfile, "<converters count=\"%d\" default=\"%s\">\n",
count, ucnv_getDefaultName());
- else {
- fprintf(config.outfile, "Available ICU converters: %d\n", count);
- fprintf(config.outfile, "Default ICU Converter is: '%s'\n",
+ else
+ {
+ fprintf(p_config->outfile, "Available ICU converters: %d\n", count);
+ fprintf(p_config->outfile, "Default ICU Converter is: '%s'\n",
ucnv_getDefaultName());
}
- for(i=0;i<count;i++)
+ for (i = 0; i < count; i++)
{
if (p_config->xmloutput)
- fprintf(config.outfile, "<converter id=\"%s\"/>\n",
+ fprintf(p_config->outfile, "<converter id=\"%s\"/>\n",
ucnv_getAvailableName(i));
else
- fprintf(config.outfile, "%s ", ucnv_getAvailableName(i));
+ fprintf(p_config->outfile, "%s\n", ucnv_getAvailableName(i));
}
if (p_config->xmloutput)
- fprintf(config.outfile, "</converters>\n");
+ fprintf(p_config->outfile, "</converters>\n");
else
- fprintf(config.outfile, "\n");
+ fprintf(p_config->outfile, "\n");
}
static void print_icu_transliterators(const struct config_t *p_config)
{
- int32_t buf_cap = 128;
- char buf[128];
- int32_t i;
- int32_t count = utrans_countAvailableIDs();
-
+ UErrorCode status;
+ UEnumeration *en = utrans_openIDs(&status);
+ int32_t count = uenum_count(en, &status);
+ const char *name;
+ int32_t length;
+
if (p_config->xmloutput)
- fprintf(config.outfile, "<transliterators count=\"%d\">\n", count);
+ fprintf(p_config->outfile, "<transliterators count=\"%d\">\n", count);
else
- fprintf(config.outfile, "Available ICU transliterators: %d\n", count);
-
- for(i = 0; i <count; i++)
+ fprintf(p_config->outfile, "Available ICU transliterators: %d\n", count);
+
+ while ((name = uenum_next(en, &length, &status)))
{
- utrans_getAvailableID(i, buf, buf_cap);
if (p_config->xmloutput)
- fprintf(config.outfile, "<transliterator id=\"%s\"/>\n", buf);
+ fprintf(p_config->outfile, "<transliterator id=\"%s\"/>\n", name);
else
- fprintf(config.outfile, " %s", buf);
+ fprintf(p_config->outfile, "%s\n", name);
}
-
+ uenum_close(en);
if (p_config->xmloutput)
- {
- fprintf(config.outfile, "</transliterators>\n");
- }
+ fprintf(p_config->outfile, "</transliterators>\n");
else
{
- fprintf(config.outfile, "\n\nUnicode Set Patterns:\n"
+ fprintf(p_config->outfile, "\n\nUnicode Set Patterns:\n"
" Pattern Description\n"
" Ranges [a-z] The lower case letters a through z\n"
" Named Chars [abc123] The six characters a,b,c,1,2 and 3\n"
" [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");
}
}
if (p_config->xmloutput)
{
- fprintf(config.outfile, "<locales count=\"%d\" default=\"%s\" collations=\"%d\">\n",
+ fprintf(p_config->outfile, "<locales count=\"%d\" default=\"%s\" collations=\"%d\">\n",
count, uloc_getDefault(), ucol_countAvailable());
}
+ else
+ {
+ fprintf(p_config->outfile, "Available ICU locales: %d\n", count);
+ fprintf(p_config->outfile, "Default locale is: %s\n", uloc_getDefault());
+ }
- for(i=0;i<count;i++)
+ for (i = 0; i < count; i++)
{
keyword_len
if (p_config->xmloutput)
{
- fprintf(config.outfile, "<locale id=\"%s\"", uloc_getAvailable(i));
- /* fprintf(config.outfile, " locale=\"%s\"", uloc_getAvailable(i)); */
+ fprintf(p_config->outfile, "<locale id=\"%s\"", uloc_getAvailable(i));
+ /* fprintf(p_config->outfile, " locale=\"%s\"", uloc_getAvailable(i)); */
/* if (strlen(keyword_str)) */
- /* fprintf(config.outfile, " keyword=\"%s\"", keyword_str); */
+ /* fprintf(p_config->outfile, " keyword=\"%s\"", keyword_str); */
/* if (ucol_getAvailable(i)) */
- /* fprintf(config.outfile, " collation=\"1\""); */
+ /* fprintf(p_config->outfile, " collation=\"1\""); */
if (strlen(lang_str))
- fprintf(config.outfile, " language=\"%s\"", lang_str);
+ fprintf(p_config->outfile, " language=\"%s\"", lang_str);
if (strlen(script_str))
- fprintf(config.outfile, " script=\"%s\"", script_str);
+ fprintf(p_config->outfile, " script=\"%s\"", script_str);
if (strlen(location_str))
- fprintf(config.outfile, " location=\"%s\"", location_str);
+ fprintf(p_config->outfile, " location=\"%s\"", location_str);
if (strlen(variant_str))
- fprintf(config.outfile, " variant=\"%s\"", variant_str);
+ fprintf(p_config->outfile, " variant=\"%s\"", variant_str);
if (strlen(name_str))
- fprintf(config.outfile, " name=\"%s\"", name_str);
+ fprintf(p_config->outfile, " name=\"%s\"", name_str);
if (strlen(localname_str))
- fprintf(config.outfile, " localname=\"%s\"", localname_str);
- fprintf(config.outfile, ">");
+ fprintf(p_config->outfile, " localname=\"%s\"", localname_str);
+ fprintf(p_config->outfile, ">");
if (strlen(localname_str))
- fprintf(config.outfile, "%s", localname_str);
- fprintf(config.outfile, "</locale>\n");
+ fprintf(p_config->outfile, "%s", localname_str);
+ fprintf(p_config->outfile, "</locale>\n");
}
else if (1 == p_config->xmloutput)
{
- fprintf(config.outfile, "%s", uloc_getAvailable(i));
- fprintf(config.outfile, " | ");
+ fprintf(p_config->outfile, "%s", uloc_getAvailable(i));
+ fprintf(p_config->outfile, " | ");
if (strlen(name_str))
- fprintf(config.outfile, "%s", name_str);
- fprintf(config.outfile, " | ");
+ fprintf(p_config->outfile, "%s", name_str);
+ fprintf(p_config->outfile, " | ");
if (strlen(localname_str))
- fprintf(config.outfile, "%s", localname_str);
- fprintf(config.outfile, "\n");
+ fprintf(p_config->outfile, "%s", localname_str);
+ fprintf(p_config->outfile, "\n");
}
else
- fprintf(config.outfile, "%s ", uloc_getAvailable(i));
+ fprintf(p_config->outfile, "%s\n", uloc_getAvailable(i));
}
if (p_config->xmloutput)
- fprintf(config.outfile, "</locales>\n");
+ fprintf(p_config->outfile, "</locales>\n");
else
- fprintf(config.outfile, "\n");
+ fprintf(p_config->outfile, "\n");
- if(U_FAILURE(status))
+ if (U_FAILURE(status))
{
fprintf(stderr, "ICU Error: %d %s\n", status, u_errorName(status));
exit(2);
static void print_info(const struct config_t *p_config)
{
if (p_config->xmloutput)
- fprintf(config.outfile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ fprintf(p_config->outfile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<icu>\n");
- if ('c' == config.print[0])
- print_icu_converters(&config);
- else if ('l' == config.print[0])
- print_icu_xml_locales(&config);
- else if ('t' == config.print[0])
- print_icu_transliterators(&config);
+ if ('c' == p_config->print[0])
+ print_icu_converters(p_config);
+ else if ('l' == p_config->print[0])
+ print_icu_xml_locales(p_config);
+ else if ('t' == p_config->print[0])
+ print_icu_transliterators(p_config);
else {
- print_icu_converters(&config);
- print_icu_xml_locales(&config);
- print_icu_transliterators(&config);
+ print_icu_converters(p_config);
+ print_icu_xml_locales(p_config);
+ print_icu_transliterators(p_config);
}
if (p_config->xmloutput)
- fprintf(config.outfile, "</icu>\n");
+ fprintf(p_config->outfile, "</icu>\n");
exit(0);
}
-static void process_text_file(const struct config_t *p_config)
+static void process_text_file(struct config_t *p_config)
{
char *line = 0;
char linebuf[1024];
- xmlDoc *doc = xmlParseFile(config.conffile);
+ xmlDoc *doc = xmlParseFile(p_config->conffile);
xmlNode *xml_node = xmlDocGetRootElement(doc);
long unsigned int token_count = 0;
if (!xml_node)
{
printf("Could not parse XML config file '%s' \n",
- config.conffile);
+ p_config->conffile);
exit(1);
}
- config.chain = icu_chain_xml_config(xml_node, 1, &status);
+ p_config->chain = icu_chain_xml_config(xml_node, 1, &status);
- if (!config.chain || !U_SUCCESS(status))
+ if (!p_config->chain || !U_SUCCESS(status))
{
printf("Could not set up ICU chain from config file '%s' \n",
- config.conffile);
+ p_config->conffile);
if (!U_SUCCESS(status))
printf("ICU Error: %d %s\n", status, u_errorName(status));
exit(1);
}
if (p_config->xmloutput)
- fprintf(config.outfile,
+ fprintf(p_config->outfile,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<icu>\n"
"<tokens>\n");
/* read input lines for processing */
- while ((line=fgets(linebuf, sizeof(linebuf)-1, config.infile)))
+ while ((line=fgets(linebuf, sizeof(linebuf)-1, p_config->infile)))
{
WRBUF sw = wrbuf_alloc();
WRBUF cdata = wrbuf_alloc();
- int success = icu_chain_assign_cstr(config.chain, line, &status);
+ int success = icu_chain_assign_cstr(p_config->chain, line, &status);
line_count++;
- while (success && icu_chain_next_token(config.chain, &status))
+ while (success && icu_chain_next_token(p_config->chain, &status))
{
if (U_FAILURE(status))
success = 0;
else
{
- const char *sortkey = icu_chain_token_sortkey(config.chain);
+ const char *sortkey = icu_chain_token_sortkey(p_config->chain);
wrbuf_rewind(sw);
wrbuf_puts_escaped(sw, sortkey);
token_count++;
if (p_config->xmloutput)
{
- fprintf(config.outfile,
+ fprintf(p_config->outfile,
"<token id=\"%lu\" line=\"%lu\"",
token_count, line_count);
wrbuf_rewind(cdata);
- wrbuf_xmlputs(cdata, icu_chain_token_norm(config.chain));
- fprintf(config.outfile, " norm=\"%s\"",
+ wrbuf_xmlputs(cdata, icu_chain_token_norm(p_config->chain));
+ fprintf(p_config->outfile, " norm=\"%s\"",
wrbuf_cstr(cdata));
wrbuf_rewind(cdata);
- wrbuf_xmlputs(cdata, icu_chain_token_display(config.chain));
- fprintf(config.outfile, " display=\"%s\"",
+ wrbuf_xmlputs(cdata, icu_chain_token_display(p_config->chain));
+ fprintf(p_config->outfile, " display=\"%s\"",
wrbuf_cstr(cdata));
if (p_config->sortoutput)
{
wrbuf_rewind(cdata);
wrbuf_xmlputs(cdata, wrbuf_cstr(sw));
- fprintf(config.outfile, " sortkey=\"%s\"",
+ fprintf(p_config->outfile, " sortkey=\"%s\"",
wrbuf_cstr(cdata));
}
- fprintf(config.outfile, "/>\n");
+ fprintf(p_config->outfile, "/>\n");
}
else
{
- fprintf(config.outfile, "%lu %lu '%s' '%s'",
+ fprintf(p_config->outfile, "%lu %lu '%s' '%s'",
token_count,
line_count,
- icu_chain_token_norm(config.chain),
- icu_chain_token_display(config.chain));
+ icu_chain_token_norm(p_config->chain),
+ icu_chain_token_display(p_config->chain));
if (p_config->sortoutput)
{
- fprintf(config.outfile, " '%s'", wrbuf_cstr(sw));
+ fprintf(p_config->outfile, " '%s'", wrbuf_cstr(sw));
}
- fprintf(config.outfile, "\n");
+ fprintf(p_config->outfile, "\n");
}
}
}
}
if (p_config->xmloutput)
- fprintf(config.outfile,
+ fprintf(p_config->outfile,
"</tokens>\n"
"</icu>\n");
- icu_chain_destroy(config.chain);
+ icu_chain_destroy(p_config->chain);
xmlFreeDoc(doc);
if (line)
free(line);
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))
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");
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
*
*
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-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
# This file is part of the YAZ toolkit.
-# Copyright (C) 1995-2010 Index Data
+# Copyright (C) 1995-2011 Index Data
# Parameters
/Fd"$(OBJDIR)\\"
COMMON_C_INCLUDES= \
- /I"$(ROOTDIR)\include"
+ /I"$(ROOTDIR)\include" \
+ /I"$(ROOTDIR)\libstemmer_c\include"
DEBUG_C_OPTIONS= \
/D "_DEBUG" \
$(OBJDIR)\zgdu.obj \
$(OBJDIR)\soap.obj \
$(OBJDIR)\solr.obj \
+ $(OBJDIR)\solrtransform.obj \
$(OBJDIR)\srw.obj \
$(OBJDIR)\srwutil.obj \
$(OBJDIR)\zoom-c.obj \
$(OBJDIR)\cqlutil.obj \
$(OBJDIR)\cqlstrer.obj \
$(OBJDIR)\rpn2cql.obj \
+ $(OBJDIR)\rpn2solr.obj \
$(OBJDIR)\xcqlutil.obj \
$(OBJDIR)\elementset.obj \
$(OBJDIR)\timing.obj \
$(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 \
$(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
{$(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)
; This file is part of the YAZ toolkit.
-; Copyright (C) 1995-2010 Index Data
+; Copyright (C) 1995-2011 Index Data
!include version.nsi
Section "YAZ Source" YAZ_Source
SectionIn 1
SetOutPath $INSTDIR
+ File ..\configure.ac
File /r ..\*.c
File /r /x yaz ..\*.h
SetOutPath $INSTDIR\util
#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"
#!/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
SSL_LIBS="@SSL_LIBS@"
LIBS="@LIBS@"
VERSION=@VERSION@
+YAZVERSION=$VERSION
VERSION_SHA1=@VERSION_SHA1@
usage()
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
--- /dev/null
+# This file is part of the YAZ toolkit
+# Copyright (C) 1995-2011 Index Data
+#
+# spec file for YAZ
+
+Name: yaz
+Summary: Z39.50 Programs
+Version: 4.1.7
+Release: 1indexdata
+
+# determine system
+%define is_mandrake %(test -e /etc/mandrake-release && echo 1 || echo 0)
+%define is_suse %(test -e /etc/SuSE-release >/dev/null && echo 1 || echo 0)
+%define is_suse11 %(grep 'VERSION = 11' /etc/SuSE-release >/dev/null 2>&1 && echo 1 || echo 0)
+%define is_fedora %(test -e /etc/fedora-release && echo 1 || echo 0)
+Requires: libxslt, gnutls, readline, libyaz4 = %{version}
+License: BSD
+Group: Applications/Internet
+Vendor: Index Data ApS <info@indexdata.dk>
+Source: yaz-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+Prefix: %{_prefix}
+
+%define TCPWRAPPER tcp_wrappers
+
+%if %is_fedora
+%define TCPWRAPPER tcp_wrappers-devel
+%endif
+
+%if %is_suse
+%define TCPWRAPPER tcpd-devel
+%endif
+
+BuildRequires: %{TCPWRAPPER}
+
+%if %is_suse11
+BuildRequires: libgnutls-devel
+%else
+BuildRequires: gnutls-devel
+%endif
+
+BuildRequires: pkgconfig
+BuildRequires: libxml2-devel
+BuildRequires: libxslt-devel
+BuildRequires: readline-devel
+BuildRequires: libicu-devel
+Packager: Adam Dickmeiss <adam@indexdata.dk>
+URL: http://www.indexdata.com/yaz
+
+%description
+This package contains both a test-server and clients (normal & ssl)
+for the ANSI/NISO Z39.50 protocol for Information Retrieval.
+
+%package -n libyaz4
+Summary: Z39.50 Library
+Group: Libraries
+Requires: libxslt, gnutls, libicu
+
+%description -n libyaz4
+YAZ is a library for the ANSI/NISO Z39.50 protocol for Information
+Retrieval.
+
+%post -n libyaz4 -p /sbin/ldconfig
+%postun -n libyaz4 -p /sbin/ldconfig
+
+%package -n libyaz4-devel
+Summary: Z39.50 Library - development package
+Group: Development/Libraries
+Requires: libyaz4 = %{version}, libxml2-devel, libxslt-devel, libicu-devel
+Conflicts: libyaz-devel
+
+%description -n libyaz4-devel
+Development libraries and includes for the libyaz package.
+
+%package -n yaz-illclient
+Summary: ILL client
+Group: Applications/Communication
+Requires: readline, libyaz4 = %{version}
+
+%description -n yaz-illclient
+yaz-illclient: an ISO ILL client.
+
+%package -n yaz-icu
+Summary: Command line utility for ICU utilities of YAZ
+Group: Applications/Communication
+Requires: libyaz4 = %{version}
+
+%description -n yaz-icu
+The yaz-icu program is a command-line based client which exposes the ICU
+chain facility of YAZ.
+
+%prep
+%setup
+
+%build
+
+CFLAGS="$RPM_OPT_FLAGS" \
+ ./configure --prefix=%{_prefix} --libdir=%{_libdir} --mandir=%{_mandir} \
+ --enable-shared --enable-tcpd --with-xslt --with-gnutls --with-icu
+make CFLAGS="$RPM_OPT_FLAGS"
+
+%install
+rm -fr ${RPM_BUILD_ROOT}
+make prefix=${RPM_BUILD_ROOT}/%{_prefix} mandir=${RPM_BUILD_ROOT}/%{_mandir} \
+ libdir=${RPM_BUILD_ROOT}/%{_libdir} install
+rm ${RPM_BUILD_ROOT}/%{_libdir}/*.la
+
+%clean
+rm -fr ${RPM_BUILD_ROOT}
+
+%files
+%defattr(-,root,root)
+%doc README LICENSE NEWS
+%{_bindir}/yaz-client
+%{_bindir}/yaz-ztest
+%{_bindir}/zoomsh
+%{_bindir}/yaz-marcdump
+%{_bindir}/yaz-iconv
+%{_bindir}/yaz-json-parse
+%{_mandir}/man1/yaz-client.*
+%{_mandir}/man1/yaz-json-parse.*
+%{_mandir}/man8/yaz-ztest.*
+%{_mandir}/man1/zoomsh.*
+%{_mandir}/man1/yaz-marcdump.*
+%{_mandir}/man1/yaz-iconv.*
+%{_mandir}/man7/yaz-log.*
+%{_mandir}/man7/bib1-attr.*
+
+%files -n libyaz4
+%defattr(-,root,root)
+%{_libdir}/*.so.*
+
+%files -n libyaz4-devel
+%defattr(-,root,root)
+%{_bindir}/yaz-config
+%{_bindir}/yaz-asncomp
+%{_includedir}/yaz
+%{_libdir}/pkgconfig/yaz.pc
+%{_libdir}/*.so
+%{_libdir}/*.a
+%{_datadir}/aclocal/yaz.m4
+%{_mandir}/man1/yaz-asncomp.*
+%{_mandir}/man7/yaz.*
+%{_mandir}/man?/yaz-config.*
+%{_datadir}/doc/yaz
+%{_datadir}/yaz
+
+%files -n yaz-illclient
+%defattr(-,root,root)
+%{_bindir}/yaz-illclient
+%{_mandir}/man1/yaz-illclient.*
+
+%files -n yaz-icu
+%defattr(-,root,root)
+%{_bindir}/yaz-icu
+%{_mandir}/man1/yaz-icu.*
+++ /dev/null
-Summary: Z39.50 Programs
-Name: yaz
-Version: @VERSION@
-Release: 1
-Requires: libxslt gnutls readline libyaz4 = %{version}
-License: BSD
-Group: Applications/Internet
-Vendor: Index Data ApS <info@indexdata.dk>
-Source: yaz-%{version}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-root
-%define TCPWRAPPER tcpd-devel
-%if "%{_vendor}" == "redhat"
-# Fedora requires tcp_wrappers-devel .
-%define TCPWRAPPER tcp_wrappers
-%endif
-BuildRequires: pkgconfig libxml2-devel libxslt-devel gnutls-devel readline-devel libicu-devel %{TCPWRAPPER}
-Packager: Adam Dickmeiss <adam@indexdata.dk>
-URL: http://www.indexdata.com/yaz
-
-%description
-This package contains both a test-server and clients (normal & ssl)
-for the ANSI/NISO Z39.50 protocol for Information Retrieval.
-
-%package -n libyaz4
-Summary: Z39.50 Library
-Group: Libraries
-Requires: libxslt gnutls libicu
-
-%description -n libyaz4
-YAZ is a library for the ANSI/NISO Z39.50 protocol for Information
-Retrieval.
-
-%post -n libyaz4 -p /sbin/ldconfig
-%postun -n libyaz4 -p /sbin/ldconfig
-
-%package -n libyaz4-devel
-Summary: Z39.50 Library - development package
-Group: Development/Libraries
-Requires: libyaz4 = %{version} libxml2-devel libxslt-devel libicu-devel
-Conflicts: libyaz-devel
-
-%description -n libyaz4-devel
-Development libraries and includes for the libyaz package.
-
-%package -n yaz-illclient
-Summary: ILL client
-Group: Applications/Communication
-Requires: readline libyaz4 = %{version}
-
-%description -n yaz-illclient
-yaz-illclient: an ISO ILL client.
-
-%package -n yaz-icu
-Summary: Command line utility for ICU utilities of YAZ
-Group: Applications/Communication
-Requires: libyaz4 = %{version}
-
-%description -n yaz-icu
-The yaz-icu program is a command-line based client which exposes the ICU
-chain facility of YAZ.
-
-%prep
-%setup
-
-%build
-
-CFLAGS="$RPM_OPT_FLAGS" \
- ./configure --prefix=%{_prefix} --libdir=%{_libdir} --mandir=%{_mandir} \
- --enable-shared --enable-tcpd --with-xslt --with-gnutls --with-icu
-make CFLAGS="$RPM_OPT_FLAGS"
-
-%install
-rm -fr ${RPM_BUILD_ROOT}
-make prefix=${RPM_BUILD_ROOT}/%{_prefix} mandir=${RPM_BUILD_ROOT}/%{_mandir} \
- libdir=${RPM_BUILD_ROOT}/%{_libdir} install
-rm ${RPM_BUILD_ROOT}/%{_libdir}/*.la
-
-%clean
-rm -fr ${RPM_BUILD_ROOT}
-
-%files
-%defattr(-,root,root)
-%doc README LICENSE NEWS
-%{_bindir}/yaz-client
-%{_bindir}/yaz-ztest
-%{_bindir}/zoomsh
-%{_bindir}/yaz-marcdump
-%{_bindir}/yaz-iconv
-%{_bindir}/yaz-json-parse
-%{_mandir}/man1/yaz-client.*
-%{_mandir}/man1/yaz-json-parse.*
-%{_mandir}/man8/yaz-ztest.*
-%{_mandir}/man1/zoomsh.*
-%{_mandir}/man1/yaz-marcdump.*
-%{_mandir}/man1/yaz-iconv.*
-%{_mandir}/man7/yaz-log.*
-%{_mandir}/man7/bib1-attr.*
-
-%files -n libyaz4
-%defattr(-,root,root)
-%{_libdir}/*.so.*
-
-%files -n libyaz4-devel
-%defattr(-,root,root)
-%{_bindir}/yaz-config
-%{_bindir}/yaz-asncomp
-%{_includedir}/yaz
-%{_libdir}/pkgconfig/yaz.pc
-%{_libdir}/*.so
-%{_libdir}/*.a
-%{_datadir}/aclocal/yaz.m4
-%{_mandir}/man1/yaz-asncomp.*
-%{_mandir}/man7/yaz.*
-%{_mandir}/man?/yaz-config.*
-%{_datadir}/doc/yaz
-%{_datadir}/yaz
-
-%files -n yaz-illclient
-%defattr(-,root,root)
-%{_bindir}/yaz-illclient
-%{_mandir}/man1/yaz-illclient.*
-
-%files -n yaz-icu
-%defattr(-,root,root)
-%{_bindir}/yaz-icu
-%{_mandir}/man1/yaz-icu.*
## 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)
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file zoomsh.c
\brief ZOOM C command line tool (shell)
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <yaz/wrbuf.h>
+#include <yaz/log.h>
#if HAVE_READLINE_READLINE_H
#include <readline/readline.h>
{
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));
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
## 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
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file
* \brief Little toy-thing to genearate an OPAC record with some values
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <ctype.h>
#include <yaz/wrbuf.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file
* \brief Demonstration of Generic Frontend Server API
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file
* \brief Little toy-thing to read GRS-1 records from a file.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <ctype.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file
* \brief Little toy-thing to read MARC records from a fixed array.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <ctype.h>
#include <yaz/wrbuf.h>
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2011 Index Data
* See the file LICENSE for details.
*/
-
/** \file
* \brief yaz-ztest Generic Frontend Server
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <math.h>
/* 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: