config.sub
Default
*~
+.settings
\ No newline at end of file
[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
+--- 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
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 $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
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <signal.h>
#if HAVE_SYS_TYPES_H
/** \file client.c
* \brief yaz-client program
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
/** \file fhistory.c
* \brief file history implementation
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <stdio.h>
dnl This file is part of the YAZ toolkit.
dnl Copyright (C) 1995-2010 Index Data
AC_PREREQ([2.60])
-AC_INIT([yaz],[4.1.1],[yaz-help@indexdata.dk])
+AC_INIT([yaz],[4.1.2],[yaz-help@indexdata.dk])
+AC_CONFIG_HEADERS(include/config.h)
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([1.9])
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);}'`
+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.0)'
dh_installdeb
dh_shlibdeps -l debian/libyaz4/usr/lib
dh_gencontrol
-Subproject commit 00de5ca16beac9c3ac135ff92ff719b86b0c6df9
+Subproject commit cc59b50a147656750bff1385f50fd6ad656d77e4
</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>
Makefile
Makefile.in
+config.h
+config.h.in
+stamp-h1
\ No newline at end of file
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
--- /dev/null
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2010 Index Data.
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Index Data nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file stemming.h
+ * \brief Header for the stemming API. Simple wrapper to hide underlying implementation.
+ */
+
+#ifndef YAZ_STEMMER_H
+#define YAZ_STEMMER_H
+
+#include <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
--- /dev/null
+Subproject commit 368f4a253716e312b66209d61c927d5039c51287
AM_CPPFLAGS=-I$(top_srcdir)/include $(XML2_CFLAGS) $(SSL_CFLAGS)
libyaz_la_LIBADD = $(SSL_LIBS) $(TCPD_LIBS)
libyaz_server_la_LIBADD = libyaz.la
-libyaz_icu_la_CPPFLAGS = $(AM_CPPFLAGS) $(ICU_CPPFLAGS)
+libyaz_icu_la_CPPFLAGS = $(AM_CPPFLAGS) $(ICU_CPPFLAGS) -I../libstemmer_c/include
libyaz_icu_la_LIBADD = libyaz.la $(ICU_LIBS)
AM_YFLAGS=-p cql_
libyaz_server_la_LDFLAGS=-version-info $(YAZ_VERSION_INFO)
-libyaz_icu_la_SOURCES = icu_chain.c icu_utf16.c icu_utf8.c \
- icu_transform.c icu_casemap.c icu_tokenizer.c icu_sortkey.c
+STEMMER_SOURCES = \
+ ../libstemmer_c/include/libstemmer.h \
+ ../libstemmer_c/libstemmer/libstemmer.c \
+ ../libstemmer_c/runtime/api.c \
+ ../libstemmer_c/runtime/api.h \
+ ../libstemmer_c/runtime/header.h \
+ ../libstemmer_c/runtime/utilities.c \
+ ../libstemmer_c/src_c/stem_UTF_8_english.c \
+ ../libstemmer_c/src_c/stem_UTF_8_english.h
+
+libyaz_icu_la_SOURCES = icu_chain.c icu_utf16.c icu_utf8.c stemmer.c \
+ icu_transform.c icu_casemap.c icu_tokenizer.c icu_sortkey.c \
+ $(STEMMER_SOURCES)
libyaz_icu_la_LDFLAGS=-version-info $(YAZ_VERSION_INFO)
# Rules for Z39.50 V3
* \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 source file implements mapping between CCL error code and
* their string equivalents.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/ccl.h>
* 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 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>
* \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>
* \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>
* \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>
* \file ccltoken.c
* \brief Implements CCL lexical analyzer (scanner)
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <stdlib.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file cclxmlconfig.c
\brief XML configuration for CCL
*/
+#if HAVE_CONFIG_H
+#include <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\];
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file charneg.c
* \brief Implements Z39.50 Charset negotiation utilities
*
* Helper functions for Character Set and Language Negotiation - 3
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <yaz/otherinfo.h>
#include <yaz/z-charneg.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file comstack.c
* \brief Implements Generic COMSTACK functions
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <ctype.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file copy_types.c
\brief Copies various Z39.50 types
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/copy_types.h>
* 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>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file cqlstdio.c
* \brief Implements query stream reading using FILE handle.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/cql.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file cqlstrer.c
* \brief Implements CQL error code map to description string.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/cql.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file cqlstring.c
* \brief Implements query stream reader that reads from a C string.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/cql.h>
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file cqlutil.c
* \brief Implements CQL tree node utilities.
*/
+#if HAVE_CONFIG_H
+#include <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]\"
* Copyright (C) 1995-2010 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>
#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;
}
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file grs1disp.c
* \brief Implements display of GRS-1 records
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
* Copyright (C) 1995-2010 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>
#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);
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file ill-get.c
* \brief Implements ILL package creator utilities
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <yaz/ill.h>
* Copyright (C) 1995-2010 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>
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);
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file logrpn.c
* \brief Implements Z39.50 Query Printing
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <assert.h>
* Copyright (C) 1995-2010 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>
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
* \file opacdisp.c
* \brief Implements OPAC record display
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
* \file otherinfo.c
* \brief Implements Z39.50 OtherInfo utilities
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <string.h>
* \file
* \brief Select, poll wrapper
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
* \file pquery.c
* \brief Implements PQF parsing
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file prt-ext.c
* \brief Implements handling of various Z39.50 Externals
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/proto.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file query-charset.c
\brief converts General Terms in RPN queries
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <assert.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file querytowrbuf.c
\brief Convert Z39.50 Z_Query to PQF (as WRBUF string)
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <assert.h>
* \file record_render.c
* \brief Render Z39.50 records (NamePlusRecord)
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
* 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>
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file sc_test.c
* \brief Small test for the Windows Service Control utility
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#ifdef WIN32
#include <windows.h>
* minimize memory allocation/deallocation during normal operation.
*
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <limits.h>
#include <stdlib.h>
* \file snprintf.c
* \brief snprintf wrapper
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdarg.h>
* This implements encoding and decoding of SOAP packages using
* Libxml2.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/soap.h>
* 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>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file solrtransform.c
* \brief Implements SOLR transform (SOLR to RPN conversion).
- *
- * Evaluation order of rules:
- *
- * always
- * relation
- * structure
- * position
- * truncation
- * index
- * relationModifier
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <stdlib.h>
* \file sortspec.c
* \brief Implements SortSpec parsing.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
* \file srw.c
* \brief Implements SRW/SRU package encoding and decoding
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/srw.h>
#if YAZ_HAVE_XML2
* \file srwutil.c
* \brief Implements SRW/SRU utilities.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <assert.h>
* \brief Implements GFS logic
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--- /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;
+ union {
+ struct sb_stemmer *sb_stemmer;
+ };
+};
+
+const char* yaz_stemmer_lookup_charenc(const char *charenc, const char *rule) {
+ return "UTF_8";
+}
+
+const char* yaz_stemmer_lookup_algorithm(const char *locale, const char *rule) {
+ return locale;
+}
+
+yaz_stemmer_p yaz_stemmer_snowball_create(const char *locale, const char *rule, UErrorCode *status) {
+ const char *charenc = yaz_stemmer_lookup_charenc(locale, rule);
+ const char *algorithm = yaz_stemmer_lookup_algorithm(locale,rule);
+ struct sb_stemmer *stemmer = sb_stemmer_new(algorithm, charenc);
+ yaz_stemmer_p yaz_stemmer;
+ yaz_log(YLOG_DEBUG, "create snowball stemmer: algoritm %s charenc %s ", algorithm, charenc);
+ if (stemmer == 0) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ yaz_log(YLOG_DEBUG, "failed to create stemmer. Creating NOP stemmer");
+
+ return 0;
+ }
+ yaz_stemmer = xmalloc(sizeof(*yaz_stemmer));
+ yaz_stemmer->implementation = yaz_snowball;
+ yaz_stemmer->locale = xstrdup(locale);
+ yaz_stemmer->rule = xstrdup(rule);
+ yaz_stemmer->sb_stemmer = stemmer;
+ yaz_log(YLOG_DEBUG, "created snowball stemmer: algoritm %s charenc %s ", algorithm, charenc);
+ return yaz_stemmer;
+}
+
+yaz_stemmer_p yaz_stemmer_create(const char *locale, const char *rule, UErrorCode *status) {
+ *status = U_ZERO_ERROR;
+ // dispatch logic required if more algorithms is implemented.
+ yaz_log(YLOG_DEBUG, "create stemmer: locale %s rule %s ", locale, rule);
+ return yaz_stemmer_snowball_create(locale, rule, status);
+}
+
+yaz_stemmer_p yaz_stemmer_clone(yaz_stemmer_p stemmer) {
+ UErrorCode error = U_ZERO_ERROR;
+ return yaz_stemmer_create(stemmer->locale, stemmer->rule, &error);
+}
+
+void yaz_stemmer_stem(yaz_stemmer_p stemmer, struct icu_buf_utf16 *dst, struct icu_buf_utf16* src, UErrorCode *status)
+{
+ switch(stemmer->implementation) {
+ case yaz_snowball: {
+ struct icu_buf_utf8 *utf8_buf = icu_buf_utf8_create(0);
+ icu_utf16_to_utf8(utf8_buf, src, status);
+ if (*status == U_ZERO_ERROR) {
+ const sb_symbol *cstr = (const sb_symbol*) icu_buf_utf8_to_cstr(utf8_buf);
+ const sb_symbol *sb_symbol = sb_stemmer_stem(stemmer->sb_stemmer, cstr, utf8_buf->utf8_len);
+ if (sb_symbol == 0) {
+ icu_buf_utf16_copy(dst, src);
+ }
+ else {
+ const char *cstr = (const char *) sb_symbol;
+ icu_utf16_from_utf8_cstr(dst, cstr , status);
+ }
+ }
+ icu_buf_utf8_destroy(utf8_buf);
+ return ;
+ break;
+ }
+ default: {
+ // Default return the same as given.
+ icu_buf_utf16_copy(dst, src);
+ }
+ }
+}
+
+void yaz_stemmer_destroy(yaz_stemmer_p stemmer) {
+ switch (stemmer->implementation) {
+ case yaz_snowball:
+ sb_stemmer_delete(stemmer->sb_stemmer);
+ break;
+ }
+ xfree(stemmer->locale);
+ xfree(stemmer->rule);
+ xfree(stemmer);
+}
+
+#endif /* YAZ_HAVE_ICU */
* \brief Implements TCP WRAPPER check.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <string.h>
* \file tcpip.c
* \brief Implements TCP/IP + SSL COMSTACK.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
* Copyright (C) 1995-2010 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>
* \file unix.c
* \brief Implements UNIX domain socket COMSTACK
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#ifndef WIN32
* 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>
* \file waislen.c
* \brief Implements WAIS package handling
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <yaz/comstack.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file xcqlutil.c
* \brief Implements CQL to XCQL conversion.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <string.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file
\brief Log XML / XSLT Errors via yaz_log
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <string.h>
* Copyright (C) 1995-2010 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>
* \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>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/**
* \file zgdu.c
* \brief Implements HTTP and Z39.50 encoding and decoding.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <string.h>
#include <yaz/odr.h>
* \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>
* \file zoom-c.c
* \brief Implements ZOOM C interface.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
* \file zoom-event.c
* \brief Implements ZOOM Event stuff
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
* \file zoom-opt.c
* \brief Implements ZOOM options handling
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <assert.h>
#include "zoom-p.h"
* \file zoom-query.c
* \brief Implements ZOOM C query interface.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
* \file zoom-record-cache.c
* \brief Implements ZOOM record caching
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
* \file zoom-socket.c
* \brief Implements ZOOM C socket interface.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
* \file zoom-sru.c
* \brief Implements ZOOM SRU
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
* \file zoom-z3950.c
* \brief Implements ZOOM Z39.50 handling
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <assert.h>
#include <string.h>
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
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <string.h>
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);
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
#if HAVE_CONFIG_H
#include <config.h>
#endif
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-2010 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>
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#if YAZ_HAVE_XML2
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <yaz/test.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <string.h>
* Copyright (C) 1995-2010 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>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <yaz/srw.h>
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)"
if (p_config->xmloutput)
fprintf(config.outfile, "<converters count=\"%d\" default=\"%s\">\n",
count, ucnv_getDefaultName());
- else {
+ else
+ {
fprintf(config.outfile, "Available ICU converters: %d\n", count);
fprintf(config.outfile, "Default ICU Converter is: '%s'\n",
ucnv_getDefaultName());
}
- for(i=0;i<count;i++)
+ for (i = 0; i < count; i++)
{
if (p_config->xmloutput)
fprintf(config.outfile, "<converter id=\"%s\"/>\n",
ucnv_getAvailableName(i));
else
- fprintf(config.outfile, "%s ", ucnv_getAvailableName(i));
+ fprintf(config.outfile, "%s\n", ucnv_getAvailableName(i));
}
if (p_config->xmloutput)
if (p_config->xmloutput)
fprintf(config.outfile, "<transliterator id=\"%s\"/>\n", name);
else
- fprintf(config.outfile, " %s", name);
+ fprintf(config.outfile, "%s\n", name);
}
uenum_close(en);
if (p_config->xmloutput)
- {
fprintf(config.outfile, "</transliterators>\n");
- }
else
{
fprintf(config.outfile, "\n\nUnicode Set Patterns:\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, "<locales count=\"%d\" default=\"%s\" collations=\"%d\">\n",
count, uloc_getDefault(), ucol_countAvailable());
}
+ else
+ {
+ fprintf(config.outfile, "Available ICU locales: %d\n", count);
+ fprintf(config.outfile, "Default locale is: %s\n", uloc_getDefault());
+ }
- for(i=0;i<count;i++)
+ for (i = 0; i < count; i++)
{
keyword_len
fprintf(config.outfile, "\n");
}
else
- fprintf(config.outfile, "%s ", uloc_getAvailable(i));
+ fprintf(config.outfile, "%s\n", uloc_getAvailable(i));
}
if (p_config->xmloutput)
fprintf(config.outfile, "</locales>\n");
else
fprintf(config.outfile, "\n");
- if(U_FAILURE(status))
+ if (U_FAILURE(status))
{
fprintf(stderr, "ICU Error: %d %s\n", status, u_errorName(status));
exit(2);
*
*
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file zoomsh.c
\brief ZOOM C command line tool (shell)
*/
+#if HAVE_CONFIG_H
+#include <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));
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file
* \brief Little toy-thing to genearate an OPAC record with some values
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <ctype.h>
#include <yaz/wrbuf.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file
* \brief Demonstration of Generic Frontend Server API
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file
* \brief Little toy-thing to read GRS-1 records from a file.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <ctype.h>
* Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
-
/** \file
* \brief Little toy-thing to read MARC records from a fixed array.
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <ctype.h>
#include <yaz/wrbuf.h>
* Copyright (C) 1995-2010 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>