Compare commits
138 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 426e4a338f | |||
| 722ee70f3f | |||
| 5a3ebcaf3c | |||
| 2645eb8539 | |||
| 1d1780741a | |||
| bb2db885c0 | |||
| 7fd76b99a8 | |||
| 8d464bdbfc | |||
| 154430b8e4 | |||
| b7e4ae5eb7 | |||
| 0845d02c39 | |||
| 4660ee8966 | |||
| 5cbb7d3524 | |||
| d4a8e0f8f2 | |||
| 5c26d034c4 | |||
| 5c4ac00fb5 | |||
| 91955db366 | |||
| 5d70bf41de | |||
| 23afd06ef7 | |||
| 77f271876d | |||
| 6e6727b194 | |||
| f773e2a2f4 | |||
| ea6e60b217 | |||
| d795c59e95 | |||
| 41f8747ca9 | |||
| 07b37b9e90 | |||
| a95844b863 | |||
| ca04d0241e | |||
| 6df48db556 | |||
| 45476cc47b | |||
| 6f3e23c50e | |||
| 70d6da04ab | |||
| d8a8373931 | |||
| aff7758c85 | |||
| 3bdd4cbde9 | |||
| 17e3c2a308 | |||
| 449353f91b | |||
| f8fe125870 | |||
| 13f9dcd0ca | |||
| 1632cfd68a | |||
| c224849f87 | |||
| a4d5ccfb34 | |||
| 8ce1339a7a | |||
| 26f865c448 | |||
| 54e2e82bf4 | |||
| 61182fdcf5 | |||
| 745b2df92c | |||
| f280eb8490 | |||
| 06013ebc60 | |||
| d0ae6bc3a6 | |||
| 8e54ef5ab3 | |||
| e31d7842fc | |||
| f231aeea79 | |||
| f67fa7cfe9 | |||
| 8ff06fd1c4 | |||
| 90e8a95b6a | |||
| 07b8c90144 | |||
| 6c2350dcc8 | |||
| a477fc729a | |||
| c8b76933bb | |||
| 04c034b932 | |||
| 38db0ebefe | |||
| 77c41aa224 | |||
| 3d4dc3e9db | |||
| 6cb1793be7 | |||
| bc25bc985f | |||
| 1c4e90947f | |||
| 9523adc725 | |||
| 004ae5b87d | |||
| c787f57d95 | |||
| 567a1fa1b3 | |||
| e92b2d8da6 | |||
| fa80a0db2f | |||
| cff22138ac | |||
| 36164fa8fa | |||
| 25485609b4 | |||
| 605fa09732 | |||
| 29f4eeec4e | |||
| 38f62420e8 | |||
| 092a50fb56 | |||
| f60f7ba979 | |||
| 8bb71dc4de | |||
| 4081646700 | |||
| 51e1c068b2 | |||
| 88ff78730e | |||
| e0064cc435 | |||
| 376dc0d922 | |||
| b381044480 | |||
| db73be2e9b | |||
| 36e601d2d8 | |||
| 8f8392e79c | |||
| b4a2c683aa | |||
| 743d39e8c9 | |||
| bef9734a29 | |||
| 7428cb8225 | |||
| 160871308e | |||
| 092cf26f27 | |||
| 2e9fab5085 | |||
| 362bdba3f1 | |||
| d8f4a2c9c6 | |||
| 4778f84e82 | |||
| 37fbbedcd1 | |||
| 1733d8f8d5 | |||
| edefcbf9a0 | |||
| e8702938eb | |||
| d387763339 | |||
| cabf768111 | |||
| 047373e8a4 | |||
| d40daa006d | |||
| 5742d386c5 | |||
| e5c3d6ed42 | |||
| e40ca5fe4f | |||
| fc4adae8ad | |||
| 70feddb1a9 | |||
| e5854ef07e | |||
| 19024efb29 | |||
| ec971aa8cc | |||
| c043fd9f2d | |||
| 2373a97424 | |||
| 29a83a4e28 | |||
| 59c79d7b83 | |||
| 5777226c63 | |||
| cc24c5cd3a | |||
| 9597287f70 | |||
| 33381a7a69 | |||
| 9844ffc894 | |||
| f6b31cea2b | |||
| fe899f7eae | |||
| ed453ef287 | |||
| a2da45bb5c | |||
| 651fc3c33b | |||
| 789cf6f428 | |||
| 8a87ad354e | |||
| cf2c7b9f07 | |||
| 761f8d4993 | |||
| eadd44bbc0 | |||
| 9bd7e71e28 | |||
| 2f07c1f9b8 |
+14
-5
@@ -52,6 +52,8 @@ EXTRA_DIST = \
|
||||
init/bongo.init.fc4.in \
|
||||
init/bongo.init.sles9.in \
|
||||
init/bongo.init.suse10.in \
|
||||
init/bongo.init.debian.in \
|
||||
init/bongo-manager.default.debian \
|
||||
init/bongo.xml.solaris-smf \
|
||||
init/http-bongo.xml.solaris-smf \
|
||||
init/http-bongo.solaris-smf.in \
|
||||
@@ -81,14 +83,20 @@ doxygen/html:
|
||||
echo "No doxygen available"; \
|
||||
fi
|
||||
|
||||
docs: doxygen/html
|
||||
doxygen/diagrams:
|
||||
mkdir -p doxygen/diagrams
|
||||
find src/ -name \*.dot -printf "-o doxygen/diagrams/%f %h/%f" | xargs -l1 dot -Tpng -Nfontname="Bitstream Vera Sans" -Nfontsize=12
|
||||
for i in doxygen/diagrams/*.dot; do mv "$$i" "$${i/.dot}".png; done
|
||||
|
||||
clean: clean-recursive
|
||||
rm -rf ./doxygen/html ./doxygen/latex
|
||||
docs: doxygen/html doxygen/diagrams
|
||||
|
||||
clean: clean-recursive clean-docs
|
||||
|
||||
clean-docs:
|
||||
rm -rf ./doxygen/html ./doxygen/latex ./doxygen/diagrams
|
||||
|
||||
# disabled agents
|
||||
# src/agents/mailprox
|
||||
# src/agents/rules
|
||||
# src/agents/calcmd
|
||||
|
||||
include_subdirs = \
|
||||
@@ -122,6 +130,7 @@ include_subdirs = \
|
||||
src/agents/itip \
|
||||
src/agents/pop \
|
||||
src/agents/queue \
|
||||
src/agents/rules \
|
||||
src/agents/smtp \
|
||||
src/agents/store \
|
||||
src/agents/store/tests \
|
||||
@@ -174,7 +183,7 @@ include src/agents/itip/Bongo.rules
|
||||
#include src/agents/mailprox/Bongo.rules
|
||||
include src/agents/pop/Bongo.rules
|
||||
include src/agents/queue/Bongo.rules
|
||||
#include src/agents/rules/Bongo.rules
|
||||
include src/agents/rules/Bongo.rules
|
||||
include src/agents/smtp/Bongo.rules
|
||||
include src/agents/store/Bongo.rules
|
||||
include src/agents/store/tests/Bongo.rules
|
||||
|
||||
+3
-12
@@ -20,7 +20,6 @@ REQUIRED_DOC_COMMON_VERSION=${REQUIRED_DOC_COMMON_VERSION:-2.3.0}
|
||||
REQUIRED_M4MACROS=${REQUIRED_M4MACROS:-}
|
||||
FORBIDDEN_M4MACROS=${FORBIDDEN_M4MACROS:-}
|
||||
|
||||
mkdir import/clucene/config 2>/dev/null
|
||||
|
||||
|
||||
# Not all echo versions allow -n, so we check what is possible. This test is
|
||||
@@ -347,13 +346,6 @@ fi
|
||||
|
||||
for arg in $@; do
|
||||
case $arg in
|
||||
--with-clucene=*import*)
|
||||
rm -f import/clucene/NO-AUTO-GEN
|
||||
;;
|
||||
--with-clucene=*)
|
||||
touch import/clucene/NO-AUTO-GEN
|
||||
echo "Flagging import/clucene as no auto-gen as source is external"
|
||||
;;
|
||||
--with-sqlite3=*import*)
|
||||
rm -f import/sqlite3/NO-AUTO-GEN
|
||||
;;
|
||||
@@ -453,12 +445,11 @@ for configure_ac in $configure_files; do
|
||||
done
|
||||
|
||||
# remove any flags which tell us not to autogen things
|
||||
rm -f import/clucene/NO-AUTO-GEN
|
||||
rm -f import/sqlite3/NO-AUTO-GEN
|
||||
#rm -f import/sqlite3/NO-AUTO-GEN
|
||||
|
||||
echo \#define BONGO_BUILD_BRANCH \"0.3\" > ./include/bongo-buildinfo.h
|
||||
echo \#define BONGO_BUILD_BRANCH \"0.5\" > ./include/bongo-buildinfo.h
|
||||
echo \#define BONGO_BUILD_VSTR \"v\" >> ./include/bongo-buildinfo.h
|
||||
echo \#define BONGO_BUILD_VER \"0\" >> ./include/bongo-buildinfo.h
|
||||
echo \#define BONGO_BUILD_VER \"1104\" >> ./include/bongo-buildinfo.h
|
||||
|
||||
conf_flags="--enable-maintainer-mode"
|
||||
|
||||
|
||||
+36
-34
@@ -3,7 +3,7 @@ AC_PREREQ(2.52)
|
||||
|
||||
AC_INIT(src/libs/msgapi/msgapi.c)
|
||||
|
||||
AM_INIT_AUTOMAKE(bongo, 0.3.1)
|
||||
AM_INIT_AUTOMAKE(bongo, 0.5.2)
|
||||
|
||||
# this space is here to trick autogen.sh
|
||||
AM_GNU_GETTEXT([external])
|
||||
@@ -22,6 +22,7 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext d
|
||||
## must come before we use the $USE_MAINTAINER_MODE variable later
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AM_PROG_AS
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CXX
|
||||
@@ -29,6 +30,8 @@ AC_ISC_POSIX
|
||||
AC_HEADER_STDC
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
GCC_STACK_PROTECTOR
|
||||
|
||||
# Check taken from glib
|
||||
AC_MSG_CHECKING(for the suffix of shared libraries)
|
||||
case "$host_os" in
|
||||
@@ -313,7 +316,7 @@ AC_CHECK_HEADERS(sys/mount.h sys/statvfs.h sys/vfs.h alloca.h)
|
||||
|
||||
AC_CHECK_DECLS([ns_c_in],,,[#include <arpa/nameser.h>])
|
||||
|
||||
ALL_CFLAGS='-I$(top_srcdir)/import/log4c -I$(top_srcdir)/import/libical/src -I$(top_builddir)/import/libical/src -I$(top_srcdir)/import/libical/src/libical -I$(top_builddir)/import/libical/src/libical'
|
||||
ALL_CFLAGS='-I$(top_builddir) -I$(top_builddir)/include -I$(top_srcdir)/import/log4c'
|
||||
ALL_LIBS=
|
||||
|
||||
AC_SUBST(ALL_CFLAGS)
|
||||
@@ -333,7 +336,7 @@ info_check="No. Unit tests will not be run."
|
||||
AM_PATH_CHECK(0.9.0,
|
||||
[
|
||||
have_check=yes
|
||||
info_check="Yes."
|
||||
info_check="Yes."
|
||||
AC_DEFINE(BONGO_HAVE_CHECK, [], [Controls how tests that depend on check compile.])
|
||||
],
|
||||
[
|
||||
@@ -355,14 +358,19 @@ PKG_CHECK_MODULES(GNUTLS, gnutls,
|
||||
|
||||
AM_PATH_LIBGCRYPT()
|
||||
|
||||
AC_CHECK_GMIME()
|
||||
|
||||
AM_PATH_PYTHON(2.3)
|
||||
PYTHON_INST_PREFIX=`$PYTHON -c 'import sys; print sys.prefix'`
|
||||
PYTHON_CPPFLAGS="-I$PYTHON_INST_PREFIX/include/python$PYTHON_VERSION"
|
||||
case "$host" in
|
||||
*darwin*)
|
||||
*darwin*)
|
||||
PYTHON_LIBS="-framework Python"
|
||||
;;
|
||||
*)
|
||||
*freebsd*)
|
||||
PYTHON_LIBS="-L$PYTHON_INST_PREFIX/lib -lpython$PYTHON_VERSION"
|
||||
;;
|
||||
*)
|
||||
# this is the correct way to find the python libdir, but
|
||||
# people should just set LDFLAGS or whatever instead:
|
||||
# PYTHON_LIBS=`$PYTHON -c 'import sys
|
||||
@@ -620,31 +628,6 @@ fi
|
||||
|
||||
# import libraries
|
||||
|
||||
ACX_CLUCENE()
|
||||
case "x$CLUCENE_LIBS" in
|
||||
x)
|
||||
info_clucene="import"
|
||||
;;
|
||||
*import*)
|
||||
info_clucene="import"
|
||||
;;
|
||||
*)
|
||||
info_clucene="system"
|
||||
;;
|
||||
esac
|
||||
if test "x$info_clucene" = "ximport"; then
|
||||
AC_MSG_RESULT(Using imported CLucene)
|
||||
AC_CONFIG_SUBDIRS([import/clucene])
|
||||
AC_SUBST(CLUCENE_BONGO_API, "1")
|
||||
AC_SUBST(CLUCENE_LIBS, "\$(top_srcdir)/import/clucene/src/libclucene.la")
|
||||
AC_SUBST(CLUCENE_CXXFLAGS, "-I\$(top_srcdir)/import/clucene/src")
|
||||
else
|
||||
if test "x$host_cpu" = "xx86_64"; then
|
||||
AC_MSG_ERROR([Compiling against CLucene system libraries on x86_64 is known to be buggy. Recommend you use --with-clucene=import/clucene])
|
||||
fi
|
||||
AC_MSG_RESULT(Using system CLucene)
|
||||
fi
|
||||
|
||||
AC_CHECK_SQLITE3()
|
||||
case "x$SQLITE_LIBS" in
|
||||
x)
|
||||
@@ -666,8 +649,27 @@ else
|
||||
AC_MSG_RESULT(Using system SQLite)
|
||||
fi
|
||||
|
||||
have_libical="no"
|
||||
info_libical="import"
|
||||
AC_CONFIG_SUBDIRS([import/libical])
|
||||
AC_CHECK_HEADER(ical.h,[
|
||||
AC_CHECK_LIB(ical, icalparser_parse_string, [
|
||||
have_libical="yes"
|
||||
info_libical="system"
|
||||
])
|
||||
])
|
||||
AM_CONDITIONAL(HAVE_LIBICAL,test "$have_odbc" = "yes")
|
||||
AC_SUBST(LIBICAL_LIBS)
|
||||
if test "x$info_libical" = "ximport"; then
|
||||
AC_MSG_RESULT(Using imported libical)
|
||||
AC_CONFIG_SUBDIRS([import/libical])
|
||||
AC_SUBST(LIBICAL_CFLAGS, "-I\$(top_srcdir)/import/libical/src -I\$(top_srcdir)/import/libical/src/libical")
|
||||
AC_SUBST(LIBICAL_LIBS, "\$(top_srcdir)/import/libical/src/libical/libical-bongo.la")
|
||||
else
|
||||
AC_MSG_RESULT(Using system libical)
|
||||
AC_SUBST(LIBICAL_LIBS, "-lical")
|
||||
AC_SUBST(LIBICAL_CFLAGS, "")
|
||||
fi
|
||||
|
||||
AC_SUBST(IMPORT_SUBDIRS, $subdirs)
|
||||
|
||||
# check for doxygen
|
||||
@@ -680,7 +682,6 @@ ac_configure_args="$ac_configure_args --enable-threadsafe --enable-cross-thread-
|
||||
|
||||
# disabled agents
|
||||
# src/agents/mailprox/Makefile
|
||||
# src/agents/rules/Makefile
|
||||
# src/agents/pluspack/Makefile
|
||||
# src/agents/calcmd/Makefile
|
||||
|
||||
@@ -695,6 +696,7 @@ init/bongo.init.fc4
|
||||
init/bongo.init.sles9
|
||||
init/bongo.init.suse10
|
||||
init/bongo.init.rpl
|
||||
init/bongo.init.debian
|
||||
init/bongoinit.conf.rpl
|
||||
init/http-bongo.solaris-smf
|
||||
init/svc-bongo.solaris-smf
|
||||
@@ -708,6 +710,7 @@ src/agents/imap/tests/Makefile
|
||||
src/agents/itip/Makefile
|
||||
src/agents/pop/Makefile
|
||||
src/agents/queue/Makefile
|
||||
src/agents/rules/Makefile
|
||||
src/agents/smtp/Makefile
|
||||
src/agents/store/Makefile
|
||||
src/agents/store/tests/Makefile
|
||||
@@ -747,7 +750,7 @@ man/Makefile
|
||||
po/Makefile
|
||||
])
|
||||
|
||||
info_bongo_version=`$AWK '{ if ($ 1 == "#define" && $ 2 == "BONGO_BUILD_VER") print $ 3; }' < "./include/bongo-buildinfo.h" | tr -d '"'`
|
||||
info_bongo_version=`$AWK '{ if ($ 1 == "#define" && $ 2 == "BONGO_BUILD_VER") print $ 3; }' < "$(top_srcdir)/include/bongo-buildinfo.h" | tr -d '"'`
|
||||
|
||||
AC_MSG_NOTICE([Configured to build Bongo:
|
||||
|
||||
@@ -758,7 +761,6 @@ AC_MSG_NOTICE([Configured to build Bongo:
|
||||
Debug CFLAGS: ${info_debug_cflags}
|
||||
|
||||
Required libraries:
|
||||
CLucene: ${info_clucene}
|
||||
CURL: ${info_curl}
|
||||
SQLite: ${info_sqlite}
|
||||
libical: ${info_libical}
|
||||
|
||||
+56
-46
@@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.4.7
|
||||
# Doxyfile 1.5.2
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project
|
||||
@@ -14,6 +14,14 @@
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# This tag specifies the encoding used for all characters in the config file that
|
||||
# follow. The default is UTF-8 which is also the encoding used for all text before
|
||||
# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into
|
||||
# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of
|
||||
# possible encodings.
|
||||
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
|
||||
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
|
||||
# by quotes) that should identify the project.
|
||||
|
||||
@@ -30,7 +38,7 @@ PROJECT_NUMBER = 0.1.0
|
||||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = ./doxygen/
|
||||
OUTPUT_DIRECTORY = ./doxygen/
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
|
||||
# 4096 sub-directories (in 2 levels) under the output directory of each output
|
||||
@@ -45,24 +53,14 @@ CREATE_SUBDIRS = NO
|
||||
# documentation generated by doxygen is written. Doxygen will use this
|
||||
# information to generate all constant output in the proper language.
|
||||
# The default language is English, other supported languages are:
|
||||
# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
|
||||
# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
|
||||
# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
|
||||
# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
|
||||
# Swedish, and Ukrainian.
|
||||
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
|
||||
# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
|
||||
# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
|
||||
# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
|
||||
# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
|
||||
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
# This tag can be used to specify the encoding used in the generated output.
|
||||
# The encoding is not always determined by the language that is chosen,
|
||||
# but also whether or not the output is meant for Windows or non-Windows users.
|
||||
# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
|
||||
# forces the Windows encoding (this is the default for the Windows binary),
|
||||
# whereas setting the tag to NO uses a Unix-style encoding (the default for
|
||||
# all platforms other than Windows).
|
||||
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
|
||||
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
|
||||
# include brief member descriptions after the members that are listed in
|
||||
# the file and class documentation (similar to JavaDoc).
|
||||
@@ -204,6 +202,11 @@ OPTIMIZE_OUTPUT_JAVA = NO
|
||||
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
|
||||
# If you use Microsoft's C++/CLI language, you should set this option to YES to
|
||||
# enable parsing support.
|
||||
|
||||
CPP_CLI_SUPPORT = NO
|
||||
|
||||
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
|
||||
# tag is set to YES, then doxygen will reuse the documentation of the first
|
||||
# member in the group (if any) for the other members of the group. By default
|
||||
@@ -459,7 +462,15 @@ WARN_LOGFILE =
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = ./src/ ./include/
|
||||
INPUT = ./src/ \
|
||||
./include/
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files that
|
||||
# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
|
||||
# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding.
|
||||
# See http://www.gnu.org/software/libiconv for the list of possible encodings.
|
||||
|
||||
INPUT_ENCODING = UTF-8
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
@@ -468,7 +479,11 @@ INPUT = ./src/ ./include/
|
||||
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
|
||||
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
|
||||
|
||||
FILE_PATTERNS = *.c *.cpp *.h *.js *.py
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cpp \
|
||||
*.h \
|
||||
*.js \
|
||||
*.py
|
||||
|
||||
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
|
||||
# should be searched for input files as well. Possible values are YES and NO.
|
||||
@@ -496,6 +511,13 @@ EXCLUDE_SYMLINKS = NO
|
||||
|
||||
EXCLUDE_PATTERNS = *test*
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the output.
|
||||
# The symbol name can be a fully qualified name, a word, or if the wildcard * is used,
|
||||
# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
|
||||
|
||||
EXCLUDE_SYMBOLS =
|
||||
|
||||
# The EXAMPLE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
@@ -659,7 +681,7 @@ HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||
# style sheet that is used by each HTML page. *It can be used to
|
||||
# style sheet that is used by each HTML page. It can be used to
|
||||
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
||||
# will generate a default style sheet. Note that doxygen will try to copy
|
||||
# the style sheet file to the HTML output directory, so don't put your own
|
||||
@@ -1085,6 +1107,14 @@ PERL_PATH = /usr/bin/perl
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to
|
||||
# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to
|
||||
# specify the directory where the mscgen tool resides. If left empty the tool is assumed to
|
||||
# be found in the default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide
|
||||
# inheritance and usage relations if the target is undocumented
|
||||
# or is not a class.
|
||||
@@ -1187,33 +1217,13 @@ DOT_PATH =
|
||||
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
|
||||
# nodes that will be shown in the graph. If the number of nodes in a graph
|
||||
# becomes larger than this value, doxygen will truncate the graph, which is
|
||||
# visualized by representing a node as a red box. Note that doxygen will always
|
||||
# show the root nodes and its direct children regardless of this setting.
|
||||
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
|
||||
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
|
||||
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
|
||||
# graphs generated by dot. A depth value of 3 means that only nodes reachable
|
||||
# from the root by following a path via at most 3 edges will be shown. Nodes
|
||||
# that lay further from the root node will be omitted. Note that setting this
|
||||
# option to 1 or 2 may greatly reduce the computation time needed for large
|
||||
# code bases. Also note that a graph may be further truncated if the graph's
|
||||
# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
|
||||
# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
|
||||
# the graph is not depth-constrained.
|
||||
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
|
||||
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
|
||||
# background. This is disabled by default, which results in a white background.
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,22 +0,0 @@
|
||||
As with most development projects, contributions come from many people and in
|
||||
many forms. The CLucene project would like to thank it's many contributors.
|
||||
Omissions are merely accidental, please e-mail ustramooner@users.sourceforge.net
|
||||
if you have been left out or a contribution is not mentioned.
|
||||
|
||||
CLucene was originally ported to C++ by Ben van Klinken (ustramooner@users.sourceforge.net)
|
||||
from Doug Cutting's popular java search engine, Lucene (see http://lucene.apache.org).
|
||||
|
||||
Here is a list of contributors. Please send me an email at ustramooner@users.sourceforge.net
|
||||
if I have left you out.
|
||||
|
||||
Doug Cutting cutting@users.sourceforge.net
|
||||
John Wheeler j_wheeler@users.sourceforge.net
|
||||
Robert G. Ristroph rgristroph@users.sourceforge.net
|
||||
David Rushby woodsplitter@users.sourceforge.net
|
||||
Jimmy Pritts jpritts@sdf.lonestar.org
|
||||
Peter Edwards peter@dragonstaff.co.uk
|
||||
Jorge Sabater Redondo jsabater@elderecho.com
|
||||
Daniel Glassey danglassey@ntlworld.com
|
||||
Peter Gladkikh batyi@mail.ru
|
||||
Pedja amigo@max3d.com
|
||||
Peter Hodges hodges.peter@gmail.com
|
||||
@@ -1,69 +0,0 @@
|
||||
License
|
||||
|
||||
The CLucene Core Library uses a dual license strategy for the source code.
|
||||
These licenses are the GNU Lesser General Public License (LGPL) and the Apache
|
||||
License (Version 2.0). Users can choose the license they wish to distribute
|
||||
their software under. This means that you do not need to abide by *both*
|
||||
licenses, but rather than you can choose the license which most suits your
|
||||
needs.
|
||||
|
||||
To rephrase this and to make it perfectly clear:
|
||||
CLucene is distributed under the GNU Lesser General Public License (LGPL)
|
||||
*or*
|
||||
the Apache License, Version 2.0
|
||||
|
||||
However, we are an open source project, and we encourage users to use the LGPL
|
||||
license and participate fully in the free software community. Dual licensing
|
||||
of the CLucene source code provides open and free access to the technology both
|
||||
for the GPL community and for other developers or companies that cannot use the
|
||||
GPL.
|
||||
|
||||
You can freely modify, extend, and improve the CLucene source code. The only
|
||||
question is whether or not you must provide the source code and contribute
|
||||
modifications to the community. The GNU and Apache licenses allow different
|
||||
ranges of flexibility in this regard, but in the end, regardless of the license
|
||||
used, we highly recommend that you submit any bugs, incompatibilities or
|
||||
added features.
|
||||
|
||||
Note that this same license does *not* apply to the CLucene Contributions
|
||||
package. You should read the COPYING file in that directory or package for
|
||||
more information.
|
||||
|
||||
|
||||
CLUCENE SUBCOMPONENTS:
|
||||
|
||||
CLucene includes a number of subcomponents with separate copyright
|
||||
notices and license terms. Your use of the source code for the
|
||||
these subcomponents is subject to the terms and conditions of the
|
||||
following licenses.
|
||||
|
||||
For the src\CLucene\util\MD5Digester.cpp component:
|
||||
/*
|
||||
* This is work is derived from material Copyright RSA Data Security, Inc.
|
||||
*
|
||||
* The RSA copyright statement and Licence for that original material is
|
||||
* included below. This is followed by the Apache copyright statement and
|
||||
* licence for the modifications made to that material.
|
||||
*/
|
||||
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
Algorithm" in all material mentioning or referencing this software
|
||||
or this function.
|
||||
|
||||
License is also granted to make and use derivative works provided
|
||||
that such works are identified as "derived from the RSA Data
|
||||
Security, Inc. MD5 Message-Digest Algorithm" in all material
|
||||
mentioning or referencing the derived work.
|
||||
|
||||
RSA Data Security, Inc. makes no representations concerning either
|
||||
the merchantability of this software or the suitability of this
|
||||
software for any particular purpose. It is provided "as is"
|
||||
without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this
|
||||
documentation and/or software.
|
||||
*/
|
||||
|
||||
@@ -1,977 +0,0 @@
|
||||
# Doxyfile 1.2.18
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project
|
||||
#
|
||||
# All text after a hash (#) is considered a comment and will be ignored
|
||||
# The format is:
|
||||
# TAG = value [value, ...]
|
||||
# For lists items can also be appended using:
|
||||
# TAG += value [value, ...]
|
||||
# Values that contain spaces should be placed between quotes (" ")
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# General configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
|
||||
# by quotes) that should identify the project.
|
||||
|
||||
PROJECT_NAME = @PACKAGE@
|
||||
|
||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = @VERSION@
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = ./doc
|
||||
|
||||
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
|
||||
# documentation generated by doxygen is written. Doxygen will use this
|
||||
# information to generate all constant output in the proper language.
|
||||
# The default language is English, other supported languages are:
|
||||
# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
|
||||
# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en
|
||||
# (Japanese with english messages), Korean, Norwegian, Polish, Portuguese,
|
||||
# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish and Ukrainian.
|
||||
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
|
||||
# documentation are documented, even if no documentation was available.
|
||||
# Private class members and static file members will be hidden unless
|
||||
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
|
||||
|
||||
EXTRACT_ALL = YES
|
||||
|
||||
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
|
||||
# will be included in the documentation.
|
||||
|
||||
EXTRACT_PRIVATE = NO
|
||||
|
||||
# If the EXTRACT_STATIC tag is set to YES all static members of a file
|
||||
# will be included in the documentation.
|
||||
|
||||
EXTRACT_STATIC = YES
|
||||
|
||||
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
|
||||
# defined locally in source files will be included in the documentation.
|
||||
# If set to NO only classes defined in header files are included.
|
||||
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
|
||||
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
|
||||
# undocumented members of documented classes, files or namespaces.
|
||||
# If set to NO (the default) these members will be included in the
|
||||
# various overviews, but no documentation section is generated.
|
||||
# This option has no effect if EXTRACT_ALL is enabled.
|
||||
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
|
||||
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
|
||||
# undocumented classes that are normally visible in the class hierarchy.
|
||||
# If set to NO (the default) these class will be included in the various
|
||||
# overviews. This option has no effect if EXTRACT_ALL is enabled.
|
||||
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
|
||||
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
|
||||
# friend (class|struct|union) declarations.
|
||||
# If set to NO (the default) these declarations will be included in the
|
||||
# documentation.
|
||||
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
|
||||
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
|
||||
# include brief member descriptions after the members that are listed in
|
||||
# the file and class documentation (similar to JavaDoc).
|
||||
# Set to NO to disable this.
|
||||
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
|
||||
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
|
||||
# the brief description of a member or function before the detailed description.
|
||||
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
|
||||
# brief descriptions will be completely suppressed.
|
||||
|
||||
REPEAT_BRIEF = YES
|
||||
|
||||
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
|
||||
# Doxygen will generate a detailed section even if there is only a brief
|
||||
# description.
|
||||
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
|
||||
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
|
||||
# members of a class in the documentation of that class as if those members were
|
||||
# ordinary class members. Constructors, destructors and assignment operators of
|
||||
# the base classes will not be shown.
|
||||
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
|
||||
# path before files name in the file list and in the header files. If set
|
||||
# to NO the shortest path that makes the file name unique will be used.
|
||||
|
||||
FULL_PATH_NAMES = NO
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
|
||||
# can be used to strip a user defined part of the path. Stripping is
|
||||
# only done if one of the specified strings matches the left-hand part of
|
||||
# the path. It is allowed to use relative paths in the argument list.
|
||||
|
||||
STRIP_FROM_PATH =
|
||||
|
||||
# The INTERNAL_DOCS tag determines if documentation
|
||||
# that is typed after a \internal command is included. If the tag is set
|
||||
# to NO (the default) then the documentation will be excluded.
|
||||
# Set it to YES to include the internal documentation.
|
||||
|
||||
INTERNAL_DOCS = NO
|
||||
|
||||
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
|
||||
# doxygen to hide any special comment blocks from generated source code
|
||||
# fragments. Normal C and C++ comments will always remain visible.
|
||||
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
|
||||
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
|
||||
# file names in lower case letters. If set to YES upper case letters are also
|
||||
# allowed. This is useful if you have classes or files whose names only differ
|
||||
# in case and if your file system supports case sensitive file names. Windows
|
||||
# users are adviced to set this option to NO.
|
||||
|
||||
CASE_SENSE_NAMES = YES
|
||||
|
||||
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
|
||||
# (but less readable) file names. This can be useful is your file systems
|
||||
# doesn't support long names like on DOS, Mac, or CD-ROM.
|
||||
|
||||
SHORT_NAMES = NO
|
||||
|
||||
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
|
||||
# will show members with their full class and namespace scopes in the
|
||||
# documentation. If set to YES the scope will be hidden.
|
||||
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
|
||||
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
|
||||
# will generate a verbatim copy of the header file for each class for
|
||||
# which an include is specified. Set to NO to disable this.
|
||||
|
||||
VERBATIM_HEADERS = YES
|
||||
|
||||
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
|
||||
# will put list of the files that are included by a file in the documentation
|
||||
# of that file.
|
||||
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
|
||||
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
|
||||
# will interpret the first line (until the first dot) of a JavaDoc-style
|
||||
# comment as the brief description. If set to NO, the JavaDoc
|
||||
# comments will behave just like the Qt-style comments (thus requiring an
|
||||
# explict @brief command for a brief description.
|
||||
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
|
||||
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
|
||||
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
|
||||
# comments) as a brief description. This used to be the default behaviour.
|
||||
# The new default is to treat a multi-line C++ comment block as a detailed
|
||||
# description. Set this tag to YES if you prefer the old behaviour instead.
|
||||
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
|
||||
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
|
||||
# will output the detailed description near the top, like JavaDoc.
|
||||
# If set to NO, the detailed description appears after the member
|
||||
# documentation.
|
||||
|
||||
DETAILS_AT_TOP = NO
|
||||
|
||||
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
|
||||
# member inherits the documentation from any documented member that it
|
||||
# reimplements.
|
||||
|
||||
INHERIT_DOCS = YES
|
||||
|
||||
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
|
||||
# is inserted in the documentation for inline members.
|
||||
|
||||
INLINE_INFO = YES
|
||||
|
||||
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
|
||||
# will sort the (detailed) documentation of file and class members
|
||||
# alphabetically by member name. If set to NO the members will appear in
|
||||
# declaration order.
|
||||
|
||||
SORT_MEMBER_DOCS = YES
|
||||
|
||||
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
|
||||
# tag is set to YES, then doxygen will reuse the documentation of the first
|
||||
# member in the group (if any) for the other members of the group. By default
|
||||
# all members of a group must be documented explicitly.
|
||||
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
|
||||
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
|
||||
# Doxygen uses this value to replace tabs by spaces in code fragments.
|
||||
|
||||
TAB_SIZE = 8
|
||||
|
||||
# The GENERATE_TODOLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the todo list. This list is created by putting \todo
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_TODOLIST = YES
|
||||
|
||||
# The GENERATE_TESTLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the test list. This list is created by putting \test
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_TESTLIST = YES
|
||||
|
||||
# The GENERATE_BUGLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the bug list. This list is created by putting \bug
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_BUGLIST = YES
|
||||
|
||||
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the deprecated list. This list is created by putting \deprecated commands in the documentation.
|
||||
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
|
||||
# This tag can be used to specify a number of aliases that acts
|
||||
# as commands in the documentation. An alias has the form "name=value".
|
||||
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
|
||||
# put the command \sideeffect (or @sideeffect) in the documentation, which
|
||||
# will result in a user defined paragraph with heading "Side Effects:".
|
||||
# You can put \n's in the value part of an alias to insert newlines.
|
||||
|
||||
ALIASES =
|
||||
|
||||
# The ENABLED_SECTIONS tag can be used to enable conditional
|
||||
# documentation sections, marked by \if sectionname ... \endif.
|
||||
|
||||
ENABLED_SECTIONS =
|
||||
|
||||
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
|
||||
# the initial value of a variable or define consist of for it to appear in
|
||||
# the documentation. If the initializer consists of more lines than specified
|
||||
# here it will be hidden. Use a value of 0 to hide initializers completely.
|
||||
# The appearance of the initializer of individual variables and defines in the
|
||||
# documentation can be controlled using \showinitializer or \hideinitializer
|
||||
# command in the documentation regardless of this setting.
|
||||
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
||||
# only. Doxygen will then generate output that is more tailored for C.
|
||||
# For instance some of the names that are used will be different. The list
|
||||
# of all members will be omitted, etc.
|
||||
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
|
||||
# only. Doxygen will then generate output that is more tailored for Java.
|
||||
# For instance namespaces will be presented as packages, qualified scopes
|
||||
# will look different, etc.
|
||||
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
|
||||
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
|
||||
# at the bottom of the documentation of classes and structs. If set to YES the
|
||||
# list will mention the files that were used to generate the documentation.
|
||||
|
||||
SHOW_USED_FILES = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The QUIET tag can be used to turn on/off the messages that are generated
|
||||
# by doxygen. Possible values are YES and NO. If left blank NO is used.
|
||||
|
||||
QUIET = NO
|
||||
|
||||
# The WARNINGS tag can be used to turn on/off the warning messages that are
|
||||
# generated by doxygen. Possible values are YES and NO. If left blank
|
||||
# NO is used.
|
||||
|
||||
WARNINGS = YES
|
||||
|
||||
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
|
||||
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
|
||||
# automatically be disabled.
|
||||
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
|
||||
# The WARN_FORMAT tag determines the format of the warning messages that
|
||||
# doxygen can produce. The string should contain the $file, $line, and $text
|
||||
# tags, which will be replaced by the file and line number from which the
|
||||
# warning originated and the warning text.
|
||||
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
|
||||
# The WARN_LOGFILE tag can be used to specify a file to which warning
|
||||
# and error messages should be written. If left blank the output is written
|
||||
# to stderr.
|
||||
|
||||
WARN_LOGFILE =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The INPUT tag can be used to specify the files and/or directories that contain
|
||||
# documented source files. You may enter file names like "myfile.cpp" or
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = ./src/CLucene
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
# and *.h) to filter out the source-files in the directories. If left
|
||||
# blank the following patterns are tested:
|
||||
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
|
||||
# *.h++ *.idl *.odl
|
||||
|
||||
FILE_PATTERNS = *.h
|
||||
|
||||
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
|
||||
# should be searched for input files as well. Possible values are YES and NO.
|
||||
# If left blank NO is used.
|
||||
|
||||
RECURSIVE = YES
|
||||
|
||||
# The EXCLUDE tag can be used to specify files and/or directories that should
|
||||
# excluded from the INPUT source files. This way you can easily exclude a
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
|
||||
EXCLUDE = CLBackwards.h mem.h
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
|
||||
# that are symbolic links (a Unix filesystem feature) are excluded from the input.
|
||||
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
|
||||
# certain files from those directories.
|
||||
|
||||
EXCLUDE_PATTERNS = "**/config/**"
|
||||
|
||||
# The EXAMPLE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
|
||||
EXAMPLE_PATH =
|
||||
|
||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
# and *.h) to filter out the source-files in the directories. If left
|
||||
# blank all files are included.
|
||||
|
||||
EXAMPLE_PATTERNS =
|
||||
|
||||
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
|
||||
# searched for input files to be used with the \include or \dontinclude
|
||||
# commands irrespective of the value of the RECURSIVE tag.
|
||||
# Possible values are YES and NO. If left blank NO is used.
|
||||
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
|
||||
# The IMAGE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain image that are included in the documentation (see
|
||||
# the \image command).
|
||||
|
||||
IMAGE_PATH =
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
# by executing (via popen()) the command <filter> <input-file>, where <filter>
|
||||
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
|
||||
# input file. Doxygen will then use the output that the filter program writes
|
||||
# to standard output.
|
||||
|
||||
INPUT_FILTER =
|
||||
|
||||
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
|
||||
# INPUT_FILTER) will be used to filter the input files when producing source
|
||||
# files to browse (i.e. when SOURCE_BROWSER is set to YES).
|
||||
|
||||
FILTER_SOURCE_FILES = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
|
||||
# be generated. Documented entities will be cross-referenced with these sources.
|
||||
|
||||
SOURCE_BROWSER = NO
|
||||
|
||||
# Setting the INLINE_SOURCES tag to YES will include the body
|
||||
# of functions and classes directly in the documentation.
|
||||
|
||||
INLINE_SOURCES = NO
|
||||
|
||||
# If the REFERENCED_BY_RELATION tag is set to YES (the default)
|
||||
# then for each documented function all documented
|
||||
# functions referencing it will be listed.
|
||||
|
||||
REFERENCED_BY_RELATION = YES
|
||||
|
||||
# If the REFERENCES_RELATION tag is set to YES (the default)
|
||||
# then for each documented function all documented entities
|
||||
# called/used by that function will be listed.
|
||||
|
||||
REFERENCES_RELATION = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
|
||||
# of all compounds will be generated. Enable this if the project
|
||||
# contains a lot of classes, structs, unions or interfaces.
|
||||
|
||||
ALPHABETICAL_INDEX = NO
|
||||
|
||||
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
|
||||
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
|
||||
# in which this list will be split (can be a number in the range [1..20])
|
||||
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
|
||||
# In case all classes in a project start with a common prefix, all
|
||||
# classes will be put under the same header in the alphabetical index.
|
||||
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
|
||||
# should be ignored while generating the index headers.
|
||||
|
||||
IGNORE_PREFIX =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
|
||||
# generate HTML output.
|
||||
|
||||
GENERATE_HTML = YES
|
||||
|
||||
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `html' will be used as the default path.
|
||||
|
||||
HTML_OUTPUT = html
|
||||
|
||||
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
|
||||
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
|
||||
# doxygen will generate files with .html extension.
|
||||
|
||||
HTML_FILE_EXTENSION = .html
|
||||
|
||||
# The HTML_HEADER tag can be used to specify a personal HTML header for
|
||||
# each generated HTML page. If it is left blank doxygen will generate a
|
||||
# standard header.
|
||||
|
||||
HTML_HEADER = ./doc/helpheader.htm
|
||||
|
||||
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
|
||||
# each generated HTML page. If it is left blank doxygen will generate a
|
||||
# standard footer.
|
||||
|
||||
HTML_FOOTER = ./doc/helpfooter.htm
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user defined cascading
|
||||
# style sheet that is used by each HTML page. It can be used to
|
||||
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
||||
# will generate a default style sheet
|
||||
|
||||
HTML_STYLESHEET =
|
||||
|
||||
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
|
||||
# files or namespaces will be aligned in HTML using tables. If set to
|
||||
# NO a bullet list will be used.
|
||||
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
|
||||
# will be generated that can be used as input for tools like the
|
||||
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
|
||||
# of the generated HTML documentation.
|
||||
|
||||
GENERATE_HTMLHELP = NO
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
|
||||
# be used to specify the file name of the resulting .chm file. You
|
||||
# can add a path in front of the file if the result should not be
|
||||
# written to the html output dir.
|
||||
|
||||
CHM_FILE =
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
|
||||
# be used to specify the location (absolute path including file name) of
|
||||
# the HTML help compiler (hhc.exe). If non empty doxygen will try to run
|
||||
# the html help compiler on the generated index.hhp.
|
||||
|
||||
HHC_LOCATION =
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
|
||||
# controls if a separate .chi index file is generated (YES) or that
|
||||
# it should be included in the master .chm file (NO).
|
||||
|
||||
GENERATE_CHI = NO
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
|
||||
# controls whether a binary table of contents is generated (YES) or a
|
||||
# normal table of contents (NO) in the .chm file.
|
||||
|
||||
BINARY_TOC = NO
|
||||
|
||||
# The TOC_EXPAND flag can be set to YES to add extra items for group members
|
||||
# to the contents of the Html help documentation and to the tree view.
|
||||
|
||||
TOC_EXPAND = NO
|
||||
|
||||
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
|
||||
# top of each HTML page. The value NO (the default) enables the index and
|
||||
# the value YES disables it.
|
||||
|
||||
DISABLE_INDEX = NO
|
||||
|
||||
# This tag can be used to set the number of enum values (range [1..20])
|
||||
# that doxygen will group on one line in the generated HTML documentation.
|
||||
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
|
||||
# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
|
||||
# generated containing a tree-like index structure (just like the one that
|
||||
# is generated for HTML Help). For this to work a browser that supports
|
||||
# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
|
||||
# or Internet explorer 4.0+). Note that for large projects the tree generation
|
||||
# can take a very long time. In such cases it is better to disable this feature.
|
||||
# Windows users are probably better off using the HTML help feature.
|
||||
|
||||
GENERATE_TREEVIEW = NO
|
||||
|
||||
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
|
||||
# used to set the initial width (in pixels) of the frame in which the tree
|
||||
# is shown.
|
||||
|
||||
TREEVIEW_WIDTH = 250
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
|
||||
# generate Latex output.
|
||||
|
||||
GENERATE_LATEX = NO
|
||||
|
||||
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `latex' will be used as the default path.
|
||||
|
||||
LATEX_OUTPUT = latex
|
||||
|
||||
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
|
||||
|
||||
LATEX_CMD_NAME = latex
|
||||
|
||||
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
|
||||
# generate index for LaTeX. If left blank `makeindex' will be used as the
|
||||
# default command name.
|
||||
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
|
||||
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
|
||||
# LaTeX documents. This may be useful for small projects and may help to
|
||||
# save some trees in general.
|
||||
|
||||
COMPACT_LATEX = NO
|
||||
|
||||
# The PAPER_TYPE tag can be used to set the paper type that is used
|
||||
# by the printer. Possible values are: a4, a4wide, letter, legal and
|
||||
# executive. If left blank a4wide will be used.
|
||||
|
||||
PAPER_TYPE = a4wide
|
||||
|
||||
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
|
||||
# packages that should be included in the LaTeX output.
|
||||
|
||||
EXTRA_PACKAGES =
|
||||
|
||||
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
|
||||
# the generated latex document. The header should contain everything until
|
||||
# the first chapter. If it is left blank doxygen will generate a
|
||||
# standard header. Notice: only use this tag if you know what you are doing!
|
||||
|
||||
LATEX_HEADER =
|
||||
|
||||
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
|
||||
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
|
||||
# contain links (just like the HTML output) instead of page references
|
||||
# This makes the output suitable for online browsing using a pdf viewer.
|
||||
|
||||
PDF_HYPERLINKS = NO
|
||||
|
||||
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
|
||||
# plain latex in the generated Makefile. Set this option to YES to get a
|
||||
# higher quality PDF documentation.
|
||||
|
||||
USE_PDFLATEX = NO
|
||||
|
||||
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
|
||||
# command to the generated LaTeX files. This will instruct LaTeX to keep
|
||||
# running if errors occur, instead of asking the user for help.
|
||||
# This option is also used when generating formulas in HTML.
|
||||
|
||||
LATEX_BATCHMODE = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
|
||||
# The RTF output is optimised for Word 97 and may not look very pretty with
|
||||
# other RTF readers or editors.
|
||||
|
||||
GENERATE_RTF = NO
|
||||
|
||||
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `rtf' will be used as the default path.
|
||||
|
||||
RTF_OUTPUT = rtf
|
||||
|
||||
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
|
||||
# RTF documents. This may be useful for small projects and may help to
|
||||
# save some trees in general.
|
||||
|
||||
COMPACT_RTF = NO
|
||||
|
||||
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
|
||||
# will contain hyperlink fields. The RTF file will
|
||||
# contain links (just like the HTML output) instead of page references.
|
||||
# This makes the output suitable for online browsing using WORD or other
|
||||
# programs which support those fields.
|
||||
# Note: wordpad (write) and others do not support links.
|
||||
|
||||
RTF_HYPERLINKS = NO
|
||||
|
||||
# Load stylesheet definitions from file. Syntax is similar to doxygen's
|
||||
# config file, i.e. a series of assigments. You only have to provide
|
||||
# replacements, missing definitions are set to their default value.
|
||||
|
||||
RTF_STYLESHEET_FILE =
|
||||
|
||||
# Set optional variables used in the generation of an rtf document.
|
||||
# Syntax is similar to doxygen's config file.
|
||||
|
||||
RTF_EXTENSIONS_FILE =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
|
||||
# generate man pages
|
||||
|
||||
GENERATE_MAN = NO
|
||||
|
||||
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `man' will be used as the default path.
|
||||
|
||||
MAN_OUTPUT = man
|
||||
|
||||
# The MAN_EXTENSION tag determines the extension that is added to
|
||||
# the generated man pages (default is the subroutine's section .3)
|
||||
|
||||
MAN_EXTENSION = .3
|
||||
|
||||
# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
|
||||
# then it will generate one additional man file for each entity
|
||||
# documented in the real man page(s). These additional files
|
||||
# only source the real man page, but without them the man command
|
||||
# would be unable to find the correct page. The default is NO.
|
||||
|
||||
MAN_LINKS = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_XML tag is set to YES Doxygen will
|
||||
# generate an XML file that captures the structure of
|
||||
# the code including all documentation. Note that this
|
||||
# feature is still experimental and incomplete at the
|
||||
# moment.
|
||||
|
||||
GENERATE_XML = NO
|
||||
|
||||
# The XML_SCHEMA tag can be used to specify an XML schema,
|
||||
# which can be used by a validating XML parser to check the
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_SCHEMA =
|
||||
|
||||
# The XML_DTD tag can be used to specify an XML DTD,
|
||||
# which can be used by a validating XML parser to check the
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_DTD =
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
|
||||
# generate an AutoGen Definitions (see autogen.sf.net) file
|
||||
# that captures the structure of the code including all
|
||||
# documentation. Note that this feature is still experimental
|
||||
# and incomplete at the moment.
|
||||
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
|
||||
# evaluate all C-preprocessor directives found in the sources and include
|
||||
# files.
|
||||
|
||||
ENABLE_PREPROCESSING = YES
|
||||
|
||||
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
|
||||
# names in the source code. If set to NO (the default) only conditional
|
||||
# compilation will be performed. Macro expansion can be done in a controlled
|
||||
# way by setting EXPAND_ONLY_PREDEF to YES.
|
||||
|
||||
MACRO_EXPANSION = YES
|
||||
|
||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
||||
# then the macro expansion is limited to the macros specified with the
|
||||
# PREDEFINED and EXPAND_AS_PREDEFINED tags.
|
||||
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
|
||||
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
|
||||
# in the INCLUDE_PATH (see below) will be search if a #include is found.
|
||||
|
||||
SEARCH_INCLUDES = YES
|
||||
|
||||
# The INCLUDE_PATH tag can be used to specify one or more directories that
|
||||
# contain include files that are not input files but should be processed by
|
||||
# the preprocessor.
|
||||
|
||||
INCLUDE_PATH = ./src/
|
||||
|
||||
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
|
||||
# patterns (like *.h and *.hpp) to filter out the header-files in the
|
||||
# directories. If left blank, the patterns specified with FILE_PATTERNS will
|
||||
# be used.
|
||||
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
|
||||
# The PREDEFINED tag can be used to specify one or more macro names that
|
||||
# are defined before the preprocessor is started (similar to the -D option of
|
||||
# gcc). The argument of the tag is a list of macros of the form: name
|
||||
# or name=definition (no spaces). If the definition and the = are
|
||||
# omitted =1 is assumed.
|
||||
|
||||
PREDEFINED = "_MSC_VER=1400"
|
||||
PREDEFINED += "WIN32"
|
||||
PREDEFINED += "LUCENE_HIDE_INTERNAL"
|
||||
|
||||
#namespaces
|
||||
PREDEFINED += "CL_NS(sub)=lucene::sub"
|
||||
PREDEFINED += "CL_NS2(sub,sub2)=lucene::sub:sub2"
|
||||
PREDEFINED += "CL_NS_DEF(sub)=namespace lucene{ namespace sub{"
|
||||
PREDEFINED += "CL_NS_DEF2(sub,sub2)=namespace lucene{ namespace sub{ namespace sub2 {"
|
||||
PREDEFINED += "CL_NS_END=}}"
|
||||
PREDEFINED += "CL_NS_END2=}}}"
|
||||
PREDEFINED += "CL_NS_USE(sub)=using namespace lucene::sub"
|
||||
PREDEFINED += "CL_NS_USE2(sub,sub2)=using namespace lucene::sub::sub2"
|
||||
PREDEFINED += "CL_NS_STD(func)=std::func"
|
||||
PREDEFINED += "CL_NS_HASHING(func)=std::func"
|
||||
|
||||
PREDEFINED += "LUCENE_BASE=public CL_NS(debug)::LuceneBase"
|
||||
PREDEFINED += "LUCENE_POOLEDBASE(sc)=LUCENE_BASE"
|
||||
PREDEFINED += "LUCENE_REFBASE=public CL_NS(debug)::LuceneBase"
|
||||
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
|
||||
# this tag can be used to specify a list of macro names that should be expanded.
|
||||
# The macro definition that is found in the sources will be used.
|
||||
# Use the PREDEFINED tag if you want to use a different macro definition.
|
||||
|
||||
EXPAND_AS_DEFINED =
|
||||
|
||||
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
|
||||
# doxygen's preprocessor will remove all function-like macros that are alone
|
||||
# on a line, have an all uppercase name, and do not end with a semicolon. Such
|
||||
# function macros are typically used for boiler-plate code, and will confuse the
|
||||
# parser if not removed.
|
||||
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The TAGFILES tag can be used to specify one or more tagfiles.
|
||||
|
||||
TAGFILES =
|
||||
|
||||
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
|
||||
# a tag file that is based on the input files it reads.
|
||||
|
||||
GENERATE_TAGFILE =
|
||||
|
||||
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
|
||||
# in the class index. If set to NO only the inherited external classes
|
||||
# will be listed.
|
||||
|
||||
ALLEXTERNALS = NO
|
||||
|
||||
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
|
||||
# in the modules index. If set to NO, only the current project's groups will
|
||||
# be listed.
|
||||
|
||||
EXTERNAL_GROUPS = YES
|
||||
|
||||
# The PERL_PATH should be the absolute path and name of the perl script
|
||||
# interpreter (i.e. the result of `which perl').
|
||||
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
|
||||
# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
|
||||
# super classes. Setting the tag to NO turns the diagrams off. Note that this
|
||||
# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
|
||||
# recommended to install and use dot, since it yield more powerful graphs.
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide
|
||||
# inheritance and usage relations if the target is undocumented
|
||||
# or is not a class.
|
||||
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
|
||||
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
|
||||
# available from the path. This tool is part of Graphviz, a graph visualization
|
||||
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
|
||||
# have no effect if this option is set to NO (the default)
|
||||
|
||||
HAVE_DOT = @enable_dot@
|
||||
|
||||
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
||||
# will generate a graph for each documented class showing the direct and
|
||||
# indirect inheritance relations. Setting this tag to YES will force the
|
||||
# the CLASS_DIAGRAMS tag to NO.
|
||||
|
||||
CLASS_GRAPH = YES
|
||||
|
||||
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
||||
# will generate a graph for each documented class showing the direct and
|
||||
# indirect implementation dependencies (inheritance, containment, and
|
||||
# class references variables) of the class with other documented classes.
|
||||
|
||||
COLLABORATION_GRAPH = YES
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will show the
|
||||
# relations between templates and their instances.
|
||||
|
||||
TEMPLATE_RELATIONS = YES
|
||||
|
||||
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
|
||||
# tags are set to YES then doxygen will generate a graph for each documented
|
||||
# file showing the direct and indirect include dependencies of the file with
|
||||
# other documented files.
|
||||
|
||||
INCLUDE_GRAPH = YES
|
||||
|
||||
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
|
||||
# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
|
||||
# documented header file showing the documented files that directly or
|
||||
# indirectly include this file.
|
||||
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
|
||||
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
|
||||
# will graphical hierarchy of all classes instead of a textual one.
|
||||
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
|
||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||
# generated by dot. Possible values are png, jpg, or gif
|
||||
# If left blank png will be used.
|
||||
|
||||
DOT_IMAGE_FORMAT = png
|
||||
|
||||
# The tag DOT_PATH can be used to specify the path where the dot tool can be
|
||||
# found. If left blank, it is assumed the dot tool can be found on the path.
|
||||
|
||||
DOT_PATH =
|
||||
|
||||
# The DOTFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain dot files that are included in the documentation (see the
|
||||
# \dotfile command).
|
||||
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
|
||||
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
|
||||
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
|
||||
# generate a legend page explaining the meaning of the various boxes and
|
||||
# arrows in the dot generated graphs.
|
||||
|
||||
GENERATE_LEGEND = YES
|
||||
|
||||
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
|
||||
# remove the intermedate dot files that are used to generate
|
||||
# the various graphs.
|
||||
|
||||
DOT_CLEANUP = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The SEARCHENGINE tag specifies whether or not a search engine should be
|
||||
# used. If set to NO the values of all tags below this one will be ignored.
|
||||
|
||||
SEARCHENGINE = NO
|
||||
@@ -1,92 +0,0 @@
|
||||
|
||||
CVS
|
||||
---
|
||||
|
||||
CLucene's source repository is in SVN
|
||||
|
||||
For information on CVS, see:
|
||||
http://sourceforge.net/svn/?group_id=80013
|
||||
|
||||
|
||||
Coding Style
|
||||
------------
|
||||
|
||||
CLucene follows a hybrid coding style. Because of the nature of the code being
|
||||
a java port, there are naturally some java like syntax.
|
||||
|
||||
todo: put the coding standard here
|
||||
|
||||
* Never use CL_NS_USE(x) in a header file (use CL_NS(x):: for each class), it defeats the purpose of namespaces.
|
||||
* Use CL_NS_USE(x) in .cpp files if there are more than a few usages of that namespace.
|
||||
|
||||
Good development tips
|
||||
---------------------
|
||||
When developing, use the available clucene debugging tools:
|
||||
* _CND_DEBUG - condition debugging, an 'assert' type system (or configure with --enable-cnddebug)
|
||||
* LUCENE_ENABLE_MEMLEAKTRACKING - to assist in memory leak tracking (or configure with --enable-debug),
|
||||
enable this. This keeps track of clucene object creations
|
||||
and deletions. Always use _CLNEW and _CLDELETE. At the end
|
||||
of your program, call:
|
||||
|
||||
_lucene_run_objectcheck
|
||||
|
||||
lucene::debug::LuceneBase::__cl_PrintUnclosedObjects();
|
||||
which prints all the open clucene objects. Then call
|
||||
lucene::debug::LuceneBase::__cl_ClearMemory();
|
||||
which clears all the clucene memory, so that you can
|
||||
use other memory tracking tools to further help you
|
||||
discover memory leaks
|
||||
|
||||
__cl_PrintUnclosedObjects returns a list of objects with
|
||||
the number that it was created at. If your debugger allows
|
||||
you to set watches you can add:
|
||||
_lucene_counter_break
|
||||
to the watch list and change the value to this number. Then
|
||||
it will break into CLDebugBreak in the StdHeader.cpp file.
|
||||
|
||||
Another trick is to use set:
|
||||
_lucene_run_objectcheck
|
||||
to true. This will check the validity of memory before deleting it.
|
||||
It can't always help, but may help in some situations.
|
||||
|
||||
Good performance tips:
|
||||
CLucene has a lot of new changes to help improve performance.
|
||||
Some of them are still being tuned...
|
||||
LUCENE_ENABLE_MEMORY_POOL helps speed up allocations for small
|
||||
objects. The types of classes who are pooled are done on a
|
||||
class by class basis - thus it is still being tuned. More testing
|
||||
is required to see which classes would benefit from pooling.
|
||||
|
||||
(currently this is broken, i think)
|
||||
|
||||
MSVC profiling tutorial:
|
||||
http://webserver.tc.cornell.edu/services/edu/topics/Performance/Profiling/more.asp
|
||||
|
||||
For GCC see gprof
|
||||
you can enable gprof by configuring with --enable-gprof
|
||||
|
||||
Developing
|
||||
----------
|
||||
When developing, please keep in mind cross-platform issues and also
|
||||
character set issues (unicode/ascii).
|
||||
|
||||
Hint:
|
||||
To do a quick test to see if the code compiles
|
||||
run this command from the root directory of clucene.
|
||||
It will compile all the CLucene code monolithically.
|
||||
|
||||
% cd src; make monolithic; cd ../test; make monolithic; ./cl_test_monolithic
|
||||
|
||||
This will do a quick compile then run all the clucene tests.
|
||||
|
||||
GDB - GNU debugging tool
|
||||
------------------------
|
||||
This is not clucene specific, but useful for novices none the less.
|
||||
|
||||
Because cl_test is a libtool bash script, you can use this command to
|
||||
run gdb:
|
||||
|
||||
libtool --mode=execute gdb cl_test
|
||||
|
||||
Then type run to start the debug tool.
|
||||
If a crash occurs, you can type bt to get a backtrace.
|
||||
@@ -1,69 +0,0 @@
|
||||
Linux Build instructions
|
||||
=======================================
|
||||
|
||||
If you downloaded CLucene as a tar ball you should be able to skip straight
|
||||
to the section titled 'building', otherwise read the next section
|
||||
|
||||
|
||||
Rebuilding the autobuild scripts
|
||||
--------------------------------
|
||||
If you made changes to the configure.ac or any of the Makefile.am
|
||||
files you will also need to run through this process.
|
||||
|
||||
Requirements:
|
||||
GNU autotools is required. I have the following versions installed:
|
||||
Autoconf 2.57
|
||||
Automake 1.72
|
||||
Libtool 1.5a
|
||||
|
||||
If you use significantly older versions, I can almost guarantee
|
||||
issues. This is because each of the autotools is constantly changing
|
||||
with little regard to backward compatability or even compatiability
|
||||
with the other autotools.
|
||||
|
||||
Run the autogen.sh file in the root directory of clucene to run the necessary commands.
|
||||
|
||||
|
||||
Building
|
||||
--------
|
||||
The following will get you building assuming that you have suffciently
|
||||
recent buld tools installed.
|
||||
1.) unpack tarball
|
||||
2.) cd into clucene
|
||||
3.) if you downloaded a tar version skip to 5
|
||||
4.) run ./autogen.sh
|
||||
5.) run ./configure
|
||||
6.) run make
|
||||
7.) things will churn for a very long time, the clucene library will
|
||||
be built as well as the examples.
|
||||
8.) check the src/demo, test and src directory
|
||||
|
||||
In src/demo you should see:
|
||||
cl_demo
|
||||
|
||||
In test you should see
|
||||
cl_test
|
||||
|
||||
In src you should see:
|
||||
libclucene.so.0.0.0 libclucene.la libclucene.a
|
||||
and symbolic links to these files.
|
||||
|
||||
9.) If you want to run make install to copy the clucene files into the system
|
||||
include and lib directories
|
||||
10.) You may have to run
|
||||
export LD_LIBRARY_PATH=/path/to/clucene/lib
|
||||
|
||||
11.) run ./cl_test in the test directory and check that the tests all run
|
||||
|
||||
Alternative (faster) way of building:
|
||||
-------------------------------------
|
||||
This method does not create library files, so depending on your needs you may not
|
||||
find this method useful.
|
||||
|
||||
* Do steps 1-5 of the previous build process.
|
||||
* Change directory into src/
|
||||
* run make monolithic
|
||||
* Change directory into test/ (cd ../test/)
|
||||
* run make monolithic
|
||||
* You should see cl_test_monolithic in this directory
|
||||
* run ./cl_test_monolithic and check that the tests all run
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
project clucene
|
||||
: source-location src/ ;
|
||||
|
||||
|
||||
lib libclucene : CLucene/CLMonolithic.cpp
|
||||
: <include>src/ ;
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
project clucene
|
||||
: requirements <include>$(BOOST_ROOT)
|
||||
: requirements <include>src/
|
||||
: usage-requirements <include>$(BOOST_ROOT)
|
||||
: usage-requirements <include>src/
|
||||
: build-dir build
|
||||
;
|
||||
#todo: fix this
|
||||
build-project build/boost ;
|
||||
build-project test ;
|
||||
build-project contributions/demo ;
|
||||
build-project contributions/logreader ;
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
SUBDIRS = src test
|
||||
DIST_SUBDIRS = src test doc win32 .
|
||||
|
||||
ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4
|
||||
|
||||
EXTRA_DIST = $(top_srcdir)/APACHE.license \
|
||||
$(top_srcdir)/project-root.jam \
|
||||
$(top_srcdir)/Jamfile.v2 \
|
||||
$(top_srcdir)/Jamfile \
|
||||
$(top_srcdir)/autogen.sh \
|
||||
$(top_srcdir)/HACKING \
|
||||
$(top_srcdir)/REQUESTS
|
||||
|
||||
distall: distdir
|
||||
$(AMTAR) chof - $(distdir) >$(distdir).tar
|
||||
GZIP=$(GZIP_ENV) gzip -c $(distdir).tar >$(distdir).tar.gz
|
||||
bzip2 -9 -c $(distdir).tar >$(distdir).tar.bz2
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
-rm -f $(distdir).tar
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-hook:
|
||||
rm -rfd `find $(distdir)/ -name CVS`
|
||||
rm -rfd `find $(distdir)/ -name .svn`
|
||||
rm -rfd `find $(distdir)/ -name .dep`
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in \
|
||||
aclocal.m4 \
|
||||
configure \
|
||||
config.h.tmp.in
|
||||
|
||||
DISTCLEANFILES = *.tar.gz \
|
||||
*.tar.bz2 \
|
||||
*.zip \
|
||||
_configs.sed \
|
||||
src/CLucene/clucene-config.h \
|
||||
config.h.tmp
|
||||
|
||||
upload:
|
||||
make distcheck
|
||||
ncftpput -v upload.sourceforge.net /incoming @PACKAGE@-@VERSION@.tar.gz
|
||||
|
||||
doxygen:
|
||||
rm -fdr ./doc/html
|
||||
doxygen Doxyfile
|
||||
cp ./doc/clucene.jpg ./doc/html/clucene.jpg
|
||||
|
||||
|
||||
|
||||
#test-compiles using different compile options
|
||||
test-all: test-pedantic test-ascii test-namespace test-mmap test-mpool test-mtracking test-refcnt test-minqp
|
||||
|
||||
test-do:
|
||||
@rm -f src/CLMonolithic.$(OBJEXT)
|
||||
@rm -f test/cl_test_monolithic$(EXEEXT)
|
||||
@rm -f test/CLMonolithic_Test.$(OBJEXT)
|
||||
cd src && $(MAKE) $(AM_MAKEFLAGS) CLMonolithic.$(OBJEXT) AM_CPPFLAGS="-pedantic $(AM_CPPFLAGS)"
|
||||
cd test && $(MAKE) $(AM_MAKEFLAGS) CLMonolithic_Test.$(OBJEXT) AM_CPPFLAGS="-pedantic $(AM_CPPFLAGS)"
|
||||
cd test && $(MAKE) $(AM_MAKEFLAGS) cl_test_monolithic$(EXEEXT) AM_CPPFLAGS="-pedantic $(AM_CPPFLAGS)"
|
||||
test/cl_test_monolithic$(EXEEXT)
|
||||
|
||||
test-pedantic:
|
||||
$(MAKE) test-do AM_CPPFLAGS=""
|
||||
|
||||
test-ascii:
|
||||
$(MAKE) test-do AM_CPPFLAGS="-D_ASCII"
|
||||
|
||||
test-namespace:
|
||||
$(MAKE) test-do AM_CPPFLAGS="-DDISABLE_NAMESPACE"
|
||||
|
||||
test-mmap:
|
||||
$(MAKE) test-do AM_CPPFLAGS="-DLUCENE_FS_MMAP"
|
||||
|
||||
test-mpool:
|
||||
$(MAKE) test-do AM_CPPFLAGS="-DLUCENE_ENABLE_MEMORY_POOL"
|
||||
|
||||
test-mtracking:
|
||||
$(MAKE) test-do AM_CPPFLAGS="-DLUCENE_ENABLE_MEMLEAKTRACKING"
|
||||
|
||||
test-refcnt:
|
||||
$(MAKE) test-do AM_CPPFLAGS="-DLUCENE_ENABLE_REFCOUNT"
|
||||
|
||||
test-minqp:
|
||||
$(MAKE) test-do AM_CPPFLAGS="-DNO_FUZZY_QUERY -DNO_WILDCARD_QUERY -DNO_PREFIX_QUERY -DNO_RANGE_QUERY"
|
||||
|
||||
test-debug:
|
||||
$(MAKE) test-do AM_CPPFLAGS="-D_DEBUG"
|
||||
@@ -1,95 +0,0 @@
|
||||
CLucene README
|
||||
==============
|
||||
|
||||
------------------------------------------------------
|
||||
CLucene is a C++ port of Lucene.
|
||||
It is a high-performance, full-featured text search
|
||||
engine written in C++. CLucene is faster than lucene
|
||||
as it is written in C++.
|
||||
------------------------------------------------------
|
||||
|
||||
CLucene has contributions from many, see AUTHORS
|
||||
|
||||
CLucene is distributed under the GNU Lesser General Public License (LGPL)
|
||||
*or*
|
||||
the Apache License, Version 2.0
|
||||
See the LGPL.license and APACHE.license for the respective license information.
|
||||
Read COPYING for more about the license.
|
||||
|
||||
Installation
|
||||
------------
|
||||
* For Linux, MacOSX, cygwin and MinGW build information, read INSTALL.
|
||||
* Boost.Jam files are provided in the root directory and subdirectories.
|
||||
* Microsoft Visual Studio (6&7) are provided in the win32 folder.
|
||||
|
||||
Mailing List
|
||||
------------
|
||||
Questions and discussion should be directed to the CLucene mailing list
|
||||
at clucene-developers@lists.sourceforge.net
|
||||
Find subscription instructions at
|
||||
http://lists.sourceforge.net/lists/listinfo/clucene-developers
|
||||
Suggestions and bug reports can be made on our bug tracking database
|
||||
(http://sourceforge.net/tracker/?group_id=80013&atid=558446)
|
||||
|
||||
The latest version
|
||||
------------------
|
||||
Details of the latest version can be found on the CLucene sourceforge project
|
||||
web site: http://www.sourceforge.net/projects/clucene
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
Documentation is provided at http://clucene.sourceforge.net/doc/doxygen/html/
|
||||
You can also build your own documentation by running doxygen from the root directory
|
||||
of clucene.
|
||||
CLucene is a very close port of Java Lucene, so you can also try looking at the
|
||||
Java Docs on http://lucene.apache.org/java/
|
||||
|
||||
|
||||
Performance
|
||||
-----------
|
||||
Very little benchmarking has been done on clucene. Andi Vajda posted some
|
||||
limited statistics on the clucene list a while ago with the following results.
|
||||
|
||||
There are 250 HTML files under $JAVA_HOME/docs/api/java/util for about
|
||||
6108kb of HTML text.
|
||||
org.apache.lucene.demo.IndexFiles with java and gcj:
|
||||
on mac os x 10.3.1 (panther) powerbook g4 1ghz 1gb:
|
||||
. running with java 1.4.1_01-99 : 20379 ms
|
||||
. running with gcj 3.3.2 -O2 : 17842 ms
|
||||
. running clucene 0.8.9's demo : 9930 ms
|
||||
|
||||
I recently did some more tests and came up with these rough tests:
|
||||
663mb (797 files) of Guttenberg texts
|
||||
on a Pentium 4 running Windows XP with 1 GB of RAM. Indexing max 100,000 fields
|
||||
• Jlucene: 646453ms. peak mem usage ~72mb, avg ~14mb ram
|
||||
• Clucene: 232141. peak mem usage ~60, avg ~4mb ram
|
||||
|
||||
Searching indexing using 10,000 single word queries
|
||||
• Jlucene: ~60078ms and used ~13mb ram
|
||||
• Clucene: ~48359ms and used ~4.2mb ram
|
||||
|
||||
Platform notes
|
||||
--------------
|
||||
|
||||
'Too many open files'
|
||||
Some platforms don't provide enough file handles to run CLucene properly.
|
||||
To solve this, increase the open file limit:
|
||||
|
||||
On Solaris:
|
||||
ulimit -n 1024
|
||||
set rlim_fd_cur=1024
|
||||
|
||||
Acknowledgments
|
||||
----------------
|
||||
|
||||
The Apache Lucene project is the basis for this software, so the biggest
|
||||
acknoledgment goes to that project.
|
||||
|
||||
We wish to acknowledge the following copyrighted works that
|
||||
make up portions of the CLucene software:
|
||||
|
||||
This software contains code derived from the RSA Data Security
|
||||
Inc. MD5 Message-Digest Algorithm.
|
||||
|
||||
CLucene relies heavily on the use of autoconf and libtool to provide
|
||||
a build environment.
|
||||
@@ -1,3 +0,0 @@
|
||||
The todo list has been moved to the tracker at
|
||||
http://sourceforge.net/tracker/?func=browse&group_id=80013&atid=558449
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Bootstrap the CLucene installation.
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
ORIGDIR=`pwd`
|
||||
cd $srcdir
|
||||
PROJECT=clucene-core
|
||||
TEST_TYPE=-f
|
||||
FILE=src/CLucene/StdHeader.h
|
||||
|
||||
DIE=0
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to call autogen.sh."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
AUTOMAKE=automake-1.9
|
||||
ACLOCAL=aclocal-1.9
|
||||
|
||||
($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
|
||||
AUTOMAKE=automake
|
||||
ACLOCAL=aclocal
|
||||
}
|
||||
|
||||
($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have automake installed to call autogen.sh."
|
||||
echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(libtool --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`libtool' installed to call autogen.sh."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test $TEST_TYPE $FILE || {
|
||||
echo "You must run this script in the top-level $PROJECT directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if test "$1" = "--clean" || test "$1" = "--clear"; then
|
||||
make maintainer-clean
|
||||
rm -fdr build libltdl config autom4te.cache _configs.sed
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#create the temp gcc config dir
|
||||
mkdir config 2>/dev/null
|
||||
|
||||
set -x
|
||||
libtoolize --force --copy --ltdl --automake
|
||||
$ACLOCAL -I m4
|
||||
autoconf
|
||||
autoheader
|
||||
$AUTOMAKE --add-missing --copy
|
||||
|
||||
cd "$ORIGDIR"
|
||||
@@ -1,323 +0,0 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2005-05-14.22
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=
|
||||
chgrpcmd=
|
||||
stripcmd=
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dstarg=
|
||||
no_target_directory=
|
||||
|
||||
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
-c (ignored)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-c) shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd=$stripprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t) dstarg=$2
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-T) no_target_directory=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
*) # When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
test -n "$dir_arg$dstarg" && break
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dstarg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dstarg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dstarg=$arg
|
||||
done
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -z "$1"; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src ;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
src=
|
||||
|
||||
if test -d "$dst"; then
|
||||
mkdircmd=:
|
||||
chmodcmd=
|
||||
else
|
||||
mkdircmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dstarg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dstarg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst ;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dstarg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst/`basename "$src"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# This sed command emulates the dirname command.
|
||||
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if test ! -d "$dstdir"; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-$defaultIFS}"
|
||||
|
||||
oIFS=$IFS
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
shift
|
||||
IFS=$oIFS
|
||||
|
||||
pathcomp=
|
||||
|
||||
while test $# -ne 0 ; do
|
||||
pathcomp=$pathcomp$1
|
||||
shift
|
||||
if test ! -d "$pathcomp"; then
|
||||
$mkdirprog "$pathcomp"
|
||||
# mkdir can fail with a `File exist' error in case several
|
||||
# install-sh are creating the directory concurrently. This
|
||||
# is OK.
|
||||
test -d "$pathcomp" || exit
|
||||
fi
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
$doit $mkdircmd "$dst" \
|
||||
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
|
||||
|
||||
else
|
||||
dstfile=`basename "$dst"`
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
$doit $cpprog "$src" "$dsttmp" &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| {
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
if test -f "$dstdir/$dstfile"; then
|
||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|
||||
|| {
|
||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
else
|
||||
:
|
||||
fi
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||
}
|
||||
}
|
||||
fi || { (exit 1); exit 1; }
|
||||
done
|
||||
|
||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||
{
|
||||
(exit 0); exit 0
|
||||
}
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -1,267 +0,0 @@
|
||||
dnl ################################################################################
|
||||
dnl initialize autoconf and automake
|
||||
dnl ################################################################################
|
||||
|
||||
AC_PREREQ([2.57])
|
||||
AC_INIT(src/CLucene/StdHeader.h)
|
||||
|
||||
dnl the clucene-core package version
|
||||
VERSION=0.9.15
|
||||
|
||||
dnl increment if interfaces have been added, removed or changed
|
||||
clLIB_current=1
|
||||
|
||||
dnl increment if source code has changed
|
||||
dnl - set to zero if current is incremented
|
||||
clLIB_revision=0
|
||||
|
||||
dnl increment if interfaces have been added
|
||||
dnl - set to zero if interfaces have been removed or changed
|
||||
clLIB_age=0
|
||||
|
||||
CLLIB_VERSION=$clLIB_current:$clLIB_revision:$clLIB_age
|
||||
AC_SUBST(CLLIB_VERSION)
|
||||
|
||||
dnl version info
|
||||
PACKAGE=clucene-core
|
||||
PROJECT=CLuceneCore
|
||||
PACKAGE_BUGREPORT=clucene-developers@lists.sourceforge.net
|
||||
PACKAGE_NAME=CLuceneCore
|
||||
PACKAGE_VERSION=$VERSION
|
||||
|
||||
AC_CONFIG_SRCDIR([src/CLucene/StdHeader.h])
|
||||
AC_CONFIG_AUX_DIR([config])
|
||||
AC_CONFIG_HEADER([config.h.tmp])
|
||||
AX_PREFIX_CONFIG_H([src/CLucene/clucene-config.h],_CL,[config.h.tmp],
|
||||
[_ASCII _UCS2 _DEBUG _FILE_OFFSET_BITS _LARGE_FILES uint32_t uint64_t uint8_t int32_t int64_t LUCENE_STATIC_CONSTANT])
|
||||
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
|
||||
|
||||
dnl Check for existence of a C and C++ compilers.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_LANG(C++)
|
||||
|
||||
dnl Configure libtool.
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
dnl #######################################################################
|
||||
dnl # User choices
|
||||
dnl #######################################################################
|
||||
AX_CONFIG_FEATURE_DEFAULT_ENABLED
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
AC_HELP_STRING([--enable-debug], [build with debugging information]),
|
||||
[enable_debug=$enableval], [enable_debug=no])
|
||||
if test $enable_debug = yes; then
|
||||
AC_DEFINE(_DEBUG, 1, debuging option)
|
||||
if test $ac_cv_prog_cxx_g = yes; then
|
||||
CXXFLAGS="-g $CXXFLAGS"
|
||||
fi
|
||||
echo "enabling debug"
|
||||
else
|
||||
echo disabling debug
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(cnddebug,
|
||||
AC_HELP_STRING([--enable-cnddebug], [build with asserts]),
|
||||
[enable_cnddebug=$enableval], [enable_cnddebug=no])
|
||||
if test $enable_cnddebug = yes; then
|
||||
AC_DEFINE(_CND_DEBUG, 1, [Conditional Debugging])
|
||||
echo "enabling cnddebug"
|
||||
else
|
||||
echo disabling cnddebug
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(ascii,
|
||||
AC_HELP_STRING([--enable-ascii], [Forces into ascii mode]),
|
||||
[enable_ascii=yes], [enable_ascii=no])
|
||||
if test $enable_ascii = yes; then
|
||||
AC_DEFINE(_ASCII, 1, [Forces into Ascii mode])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(multithreading,
|
||||
AC_HELP_STRING([--disable-multithreading], [disable multithreading]),
|
||||
[enable_multithreading=no], [enable_multithreading=yes])
|
||||
if test $enable_multithreading = yes; then
|
||||
ACX_PTHREAD
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
|
||||
CC="$PTHREAD_CC"
|
||||
echo "enabled multithreading"
|
||||
else
|
||||
AC_DEFINE(DISABLE_MULTITHREADING, 1, [Disable multithreading])
|
||||
echo "disabled multithreading"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(gprof,
|
||||
AC_HELP_STRING([--enable-gprof], [turn on profiling support]),
|
||||
[enable_gprof=yes], [enable_gprof=no])
|
||||
if test $enable_gprof = yes; then
|
||||
CXXFLAGS="-pg $CPPFLAGS"
|
||||
LDFLAGS="-pg $LDFLAGS"
|
||||
echo "enabled gprof"
|
||||
fi
|
||||
|
||||
dnl #######################################################################
|
||||
dnl # Doxygen Stuff
|
||||
dnl #######################################################################
|
||||
AC_CHECK_PROG(DOXYGEN, doxygen, true, false)
|
||||
if test $DOXYGEN = false; then
|
||||
AC_MSG_WARN([*** doxygen not found, docs will not be available])
|
||||
enable_doxygen=no
|
||||
else
|
||||
enable_doxygen=yes
|
||||
AC_CHECK_PROG(DOT, dot, true, false)
|
||||
if test $DOT = false; then
|
||||
enable_dot = no;
|
||||
AC_MSG_WARN([*** dot not found, graphs will not be available])
|
||||
else
|
||||
enable_dot = yes;
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(enable_doxygen)
|
||||
AC_SUBST(enable_dot)
|
||||
|
||||
|
||||
dnl #######################################################################
|
||||
dnl # Check headers
|
||||
dnl #######################################################################
|
||||
|
||||
dnl Check for headers
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STAT
|
||||
AC_HEADER_TIME
|
||||
|
||||
dnl check for stl
|
||||
AC_CXX_HAVE_STL
|
||||
|
||||
dnl check for functioning wctype.h
|
||||
AC_CXX_HAVE_WCTYPE_H
|
||||
|
||||
AC_CHECK_HEADERS([algorithm functional map vector list set],,[AC_MSG_ERROR([A required C++ header file is not found.])])
|
||||
|
||||
dnl compulsary headers
|
||||
AC_CHECK_HEADERS([math.h],,[AC_MSG_ERROR([A required C header file is not found.])])
|
||||
|
||||
dnl optional headers
|
||||
AC_CHECK_HEADERS([hash_map hash_set ext/hash_map ext/hash_set stdarg.h sys/timeb.h wchar.h tchar.h errno.h fcntl.h ctype.h inttypes.h sys/types.h])
|
||||
|
||||
dnl seems as though c++ headers aren't being checked properly...
|
||||
AC_DEFINE([HAVE_STDEXCEPT],[],[x])
|
||||
|
||||
|
||||
dnl #######################################################################
|
||||
dnl # Check for compiler features
|
||||
dnl #######################################################################
|
||||
|
||||
dnl Check for large file support
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
dnl Check for strange function behaviours
|
||||
AC_FUNC_STRTOD
|
||||
|
||||
dnl check for namespace availability
|
||||
AC_CXX_NAMESPACES
|
||||
|
||||
dnl check for try/catch availability
|
||||
MDL_CXX_FUNCTION_TRY_BLOCKS
|
||||
|
||||
dnl check for std namespace
|
||||
AC_CXX_HAVE_STD
|
||||
|
||||
dnl check for mmap
|
||||
dnl todo: check that it functions...
|
||||
case "$host" in
|
||||
*cygwin*)
|
||||
AC_CHECK_FUNCS(mmap)
|
||||
;;
|
||||
*)
|
||||
AC_FUNC_MMAP
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl check for presence of certain optional methods
|
||||
if test $enable_ascii = yes; then
|
||||
AC_CHECK_FUNCS(strupr strlwr lltoa strtoll)
|
||||
else
|
||||
AC_CHECK_FUNCS(wcscpy wcsupr wcsncpy wcscasecmp wcsicmp wcscat wcschr wcstoll lltow wcstod wcsstr wcslen wcscmp wcsncmp wcscspn)
|
||||
dnl todo: wcstoq is bsd equiv of wcstoll, we can use that...
|
||||
fi
|
||||
dnl always check for file functions
|
||||
AC_CHECK_FUNCS(tell _filelength)
|
||||
|
||||
dnl check for presence of certain compulsary methods
|
||||
AC_CHECK_FUNCS(printf snprintf,,[AC_MSG_ERROR([A required function is not found.])])
|
||||
|
||||
dnl check for broken string functions
|
||||
dps_swprintf_works
|
||||
dps_snprintf_oflow
|
||||
|
||||
dnl Test for byte<->float conversions
|
||||
dps_float_byte
|
||||
|
||||
dnl Define a valid LUCENE_STATIC_CONSTANT macro
|
||||
dps_static_const
|
||||
|
||||
dnl only try using internal functions if the bugs are not detected
|
||||
if test $dps_cv_snprintf_bug -eq 0; then
|
||||
if test $dps_cv_swprintf_works -eq 0; then
|
||||
AC_CHECK_FUNCS(wprintf snwprintf vsnwprintf)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl #######################################################################
|
||||
dnl # Check for types
|
||||
dnl #######################################################################
|
||||
|
||||
dnl check for functioning long double type
|
||||
AC_C_LONG_DOUBLE
|
||||
|
||||
AC_DEFINE_INTEGER_BITS(uint64_t, unsigned long long, unsigned __int64, unsigned long)
|
||||
if test "$uint64_t" = no; then
|
||||
AC_MSG_ERROR([unable to continue without an unsigned 64-bit datatype])
|
||||
fi
|
||||
|
||||
AC_DEFINE_INTEGER_BITS(uint32_t, unsigned int, unsigned long)
|
||||
if test "$uint32_t" = no; then
|
||||
AC_MSG_ERROR([unable to continue without an unsigned 32-bit datatype])
|
||||
fi
|
||||
|
||||
AC_DEFINE_INTEGER_BITS(uint8_t, unsigned char)
|
||||
if test "$uint8_t" = no; then
|
||||
AC_MSG_ERROR([unable to continue without an unsigned 8-bit datatype])
|
||||
fi
|
||||
|
||||
dnl check for certain types
|
||||
AC_CHECK_TYPES([float_t],,,[#include <math.h>])
|
||||
|
||||
AC_CHECK_TYPES([wchar_t, intptr_t])
|
||||
|
||||
dnl #######################################################################
|
||||
dnl # Other stuff
|
||||
dnl #######################################################################
|
||||
|
||||
dnl Check for nanosleep library
|
||||
AC_SEARCH_LIBS([nanosleep], [rt],
|
||||
[AC_DEFINE([HAVE_NANOSLEEP], [1],
|
||||
[Define if you have the nanosleep function])])
|
||||
|
||||
dnl check for endian TODO:
|
||||
dnl AC_C_BIGENDIAN(AC_DEFINE([IS_BIG_ENDIAN],[],[Define if platform is big endian]),
|
||||
dnl AC_DEFINE([IS_LITTLE_ENDIAN],[],[Define if platform is little endian]))
|
||||
|
||||
|
||||
|
||||
dnl #######################################################################
|
||||
dnl # Finish off
|
||||
dnl #######################################################################
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile src/demo/Makefile
|
||||
doc/Makefile win32/Makefile
|
||||
test/Makefile test/data/Makefile])
|
||||
|
||||
AC_OUTPUT([Doxyfile doc/helpheader.htm])
|
||||
|
||||
echo "configured $PROJECT version $VERSION"
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
|
||||
docsrcdir = $(top_srcdir)/doc
|
||||
EXTRA_DIST = $(docsrcdir)/*.txt \
|
||||
$(docsrcdir)/*.htm \
|
||||
$(docsrcdir)/*.jpg \
|
||||
$(docsrcdir)/helpheader.htm.in
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
@@ -1,48 +0,0 @@
|
||||
i realise that these statistics are pretty rough, but i thought in the spirit of doing beat offs on lucene, i'd throw in my search engine into the ring... see what people have to say. i'm not going to attempt to show off using pretty graphs and mean/median/max charts. rather, i am going to hope to get some sort of stability out of doing the same test over and over again - and all tests will be run in one lump, so the start up of the VM will be 'masked' by the amount of time that it runs for.
|
||||
|
||||
comparison between apache lucene (i will call it jlucene) and clucene.
|
||||
machine is a pentium 4 running windows xp with 1gb ram.
|
||||
|
||||
indexed data:
|
||||
indexing 663mb (797 files) of guttenberg texts (some files removed and no graphics,etc):
|
||||
|
||||
java notes:
|
||||
using default memory -Xmx, etc.
|
||||
I wanted to not put any restrictions on maxFieldsLenght, but it ran out of memory. so i restricted maxFieldLength to 100,000 terms.
|
||||
|
||||
used the demo programs. indexing was first run with java maxFieldsLength left at 10,000.
|
||||
the whole directory was indexed in one hit.
|
||||
|
||||
jlucene indexing completed in 136219 ms. peak memory usage ~15mb, average ~12mb
|
||||
clucene(memory optimized) indexing completed in 53735 ms. peak memory usage ~7.5mb, average ~1.7mb
|
||||
clucene(speed optimized)
|
||||
|
||||
the whole thing was done again, this time setting the maxFieldsLength to 100,000.
|
||||
|
||||
jlucene indexing completed in 646453. peak memory usage ~72mb, average ~14mb (when it goes to some of the smaller files)
|
||||
clucene(memory optimized) indexing completed in 232141. peak memory usage ~~60, average ~4mb (when it goes to some of the smaller files)
|
||||
clucene(speed optimized)
|
||||
|
||||
then i made a text file containing text from the guttenberg collection with 10000 lines. each line represeting one query.
|
||||
i pruned out key search phrases and punctiuation, etc.
|
||||
i then modified the demo programs to search for each line of this file. I used the queryParser,
|
||||
each hits result was iterated through fully (but no text processing or retrieval of the fields was done, just the document).
|
||||
the 10000 queries were run 4 times each. all java variables were nulled as soon as they were not required anymore.
|
||||
the search was run on the index created with the previous tests - it was 176mb.
|
||||
|
||||
jlucene - searching completed on average 60078ms and used ~13mb for each iteration of 10000 queries.
|
||||
clucene(memory optimized) searching completed on average 53453ms and used ~4.2mb for each iteration of 10000 queries.
|
||||
clucene(speed optimized) searching completed on average 52350ms and used ~11mb for each iteration of 10000 queries.
|
||||
|
||||
i was a bit dissapointed with the performance gains on the searching side. however, i have only recently begun finetuning
|
||||
the performance of clucene. i started fine tuning the indexing side of things first - and i am pleased to see the performance
|
||||
gains - until recently clucene was in the order of 1.8 times faster at indexing.
|
||||
|
||||
of course jlucene currently has a much larger group of people working on the code so it stands to reason that there has been
|
||||
much more performance tuning done. until recently, clucene has basically had next to no time devoted to improving performance, and
|
||||
this really shows, especially on the search side of things.
|
||||
|
||||
i'd like to congratulate lucene and especially doug on an excellent search api!
|
||||
|
||||
cheers
|
||||
ben (clucene)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB |
@@ -1,4 +0,0 @@
|
||||
<HR>
|
||||
<p><a href=http://clucene.sourceforge.net><i>clucene.sourceforge.net</i></a></p>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,23 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
CLucene API Documentation (Version @VERSION@)
|
||||
</TITLE>
|
||||
|
||||
<META NAME="keywords" CONTENT="CLucene API Documentation (Version @VERSION@)">
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
{
|
||||
parent.document.title="CLucene API Documentation (Version @VERSION@)";
|
||||
}
|
||||
</SCRIPT>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white" onload="windowTitle();">
|
||||
|
||||
<P align=center><B>CLucene - a full-featured, c++ search engine</b><BR>
|
||||
API Documentation
|
||||
</P>
|
||||
<hr>
|
||||
@@ -1,173 +0,0 @@
|
||||
This document contains information about the porting status of CLucene<br />
|
||||
<br />
|
||||
Platforms and compilers that the CLucene test units work on<br />
|
||||
<i>Most of these were compiled monolithicly using 'make test-pedantic',
|
||||
except some platforms which did not have sufficient memory.</i>
|
||||
<br />
|
||||
<table border=1 cellpadding=4 cellspacing=0>
|
||||
<tr>
|
||||
<td>
|
||||
<B>Architecture/Platform/compiler</B></td>
|
||||
<td>
|
||||
<B>Status</B></td>
|
||||
<td>
|
||||
<B>Notes</B></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
x86/WinXP SP2/MSVC6</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
x86/WinXP SP2/MSVC8</td>
|
||||
<td>
|
||||
Pass</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
x86/WinXP SP2/Cygwin</td>
|
||||
<td>
|
||||
Pass</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
x86/WinXP SP2/MinGW32</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
x86/OpenBSD 3.8/GCC 3.3.5</td>
|
||||
<td>
|
||||
Pass</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
x86/FreeBSD 5.4/GCC 3.4.2</td>
|
||||
<td>
|
||||
Pass</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
x86/NetBSD 2.0.2/GCC 3.3.3</td>
|
||||
<td>
|
||||
Pass</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>x86/Debian 3.1 (Linux 2.6)/GCC 3.3.5
|
||||
</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>x86/Fedora Core 2/GCC 3.3.3
|
||||
</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>x86/Sun Solaris 9/GCC 3.3.2
|
||||
</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>AMD64/Fedora Core 3/GCC 3.4.2
|
||||
</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>x86 64bit/Sun Solaris 10/Forte 10.0
|
||||
</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PPC/MacOS X 10.2 Server Edition/GCC 3.1
|
||||
</td>
|
||||
<td>Pass *
|
||||
</td>
|
||||
<td>No wchar.h on this platform, so compiled with --enable-ascii
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PPC/AIX 5.3/xlc 7.0
|
||||
</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>System STL didn't work. Compiled using QT's STL.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PPC/AIX 5.3/GCC 3.2.3
|
||||
</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PPC64/SuSE Enterprise Server 9/GCC 3.3.3
|
||||
</td>
|
||||
<td>
|
||||
Pass</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sparc/Sun Solaris 9/GCC 3.3.2
|
||||
</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sparc/Sun Solaris 8/Forte 10.0
|
||||
</td>
|
||||
<td>Pass
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Alpha/Debian 3.0 (Linux 2.2)/GCC 2.95.4
|
||||
</td>
|
||||
<td>
|
||||
Failed configure*</td>
|
||||
<td>
|
||||
Cannot find a working pthread configuration,
|
||||
wchar related stuff breaks<br />
|
||||
if configured with pthreads and unicode off, then CLucene's
|
||||
reliance on exceptions causes unit tests to quit on first
|
||||
use of an exception. This is a very old gcc though.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -1,28 +0,0 @@
|
||||
Tests have been successful on the following platforms:
|
||||
|
||||
Win32 (MSVC)
|
||||
Win32 (Mingw32 based Dev-C++)
|
||||
Win32 (Cygwin autobuild)
|
||||
|
||||
AMD 64 (Fedora Core 3)
|
||||
x86 (FreeBSD 4.8)
|
||||
x86 (Fedora Core 2)
|
||||
IBM Power5 - Suse Enterprise Server 9
|
||||
|
||||
Also reported running on:
|
||||
Mandriva Linux LE 2005.
|
||||
|
||||
Too many files open on: (other than that, all tests pass)
|
||||
NetBSD 1.6.1 - 2 test fail
|
||||
Sparc - Sun Solaris 9 - 2 test fail
|
||||
x86 - Sun Solaris 9 - 2 test fail
|
||||
|
||||
|
||||
Current Build Fails On:
|
||||
Alpha (Linux 2.2, Debian 3.0) - implicit declaration of function `int wcstoll
|
||||
|
||||
|
||||
Currently Tests Fail on:
|
||||
PPC (Mac OsX 10.1 SERVER) - all tests fail, segfault on highfreq test
|
||||
PPC (Mac OsX 10.2 SERVER) - segfault on highfreq test
|
||||
OpenBSD 3.4 - segfaults on highfreq test
|
||||
@@ -1,12 +0,0 @@
|
||||
Here is a list of projects, applications or companies which use CLucene.
|
||||
If you would like to be added to this list, please send me an email:
|
||||
ustramooner@users.sourceforge.net
|
||||
|
||||
Kat (KDE desktop search engine) - http://kat.mandriva.org/
|
||||
ht://Dig (Intranet/Domain search engine) - http://www.htdig.org/
|
||||
The Sword Project (Bible tool) - http://www.crosswire.org/
|
||||
Flock (Firefox based web browser) - http://www.flock.com/developer/
|
||||
kio-clucene (KDE desktop search engine) - http://kio-clucene.sourceforge.net/
|
||||
GULP (Das Portal für IT) - http://www.gulp.de/
|
||||
Rootsweb.com (genealogy website)- http://archiver.rootsweb.com/cgi-bin/search
|
||||
im-brain (intelligent knowledge management, text classification) - http://www.im-brain.de/
|
||||
@@ -1,21 +0,0 @@
|
||||
dnl AC_CXX_HAVE_STD
|
||||
AC_DEFUN([AC_CXX_HAVE_STD],
|
||||
[AC_CACHE_CHECK(whether the compiler supports ISO C++ standard library,
|
||||
ac_cv_cxx_have_std,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_COMPILE([#include <iostream>
|
||||
#include <map>
|
||||
#include <iomanip>
|
||||
#include <cmath>
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace std;
|
||||
#endif],[return 0;],
|
||||
ac_cv_cxx_have_std=yes, ac_cv_cxx_have_std=no)
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_cv_cxx_have_std" = yes; then
|
||||
AC_DEFINE(HAVE_STD,,[define if the compiler supports ISO C++ standard library])
|
||||
fi
|
||||
])
|
||||
@@ -1,20 +0,0 @@
|
||||
dnl AC_CXX_HAVE_STL
|
||||
AC_DEFUN([AC_CXX_HAVE_STL],
|
||||
[AC_CACHE_CHECK(whether the compiler supports Standard Template Library,
|
||||
ac_cv_cxx_have_stl,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_COMPILE([#include <list>
|
||||
#include <deque>
|
||||
#ifdef HAVE_NAMESPACES
|
||||
using namespace std;
|
||||
#endif],[list<int> x; x.push_back(5);
|
||||
list<int>::iterator iter = x.begin(); if (iter != x.end()) ++iter; return 0;],
|
||||
ac_cv_cxx_have_stl=yes, ac_cv_cxx_have_stl=no)
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_cv_cxx_have_stl" = yes; then
|
||||
AC_DEFINE(HAVE_STL,,[define if the compiler supports Standard Template Library])
|
||||
fi
|
||||
])
|
||||
@@ -1,16 +0,0 @@
|
||||
dnl AC_CXX_HAVE_WCTYPE_H
|
||||
AC_DEFUN([AC_CXX_HAVE_WCTYPE_H],
|
||||
[AC_CACHE_CHECK(for a functioning wctype.h header,
|
||||
ac_cv_cxx_have_wctype_h,
|
||||
[AC_REQUIRE([AC_CXX_NAMESPACES])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_RUN([#include <wctype.h>
|
||||
int main(void){ int x=iswalnum(100); return 0;}],
|
||||
ac_cv_cxx_have_wctype_h=yes, ac_cv_cxx_have_wctype_h=no, ac_cv_cxx_have_wctype_h=no)
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_cv_cxx_have_wctype_h" = yes; then
|
||||
AC_DEFINE(HAVE_WCTYPE_H,,[Define to 1 if you have a functioning <wchar.h> header file.])
|
||||
fi
|
||||
])
|
||||
@@ -1,15 +0,0 @@
|
||||
dnl AC_CXX_NAMESPACES
|
||||
AC_DEFUN([AC_CXX_NAMESPACES],
|
||||
[AC_CACHE_CHECK(whether the compiler implements namespaces,
|
||||
ac_cv_cxx_namespaces,
|
||||
[AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
|
||||
[using namespace Outer::Inner; return i;],
|
||||
ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no)
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_cv_cxx_namespaces" = yes; then
|
||||
AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
|
||||
fi
|
||||
])
|
||||
@@ -1,32 +0,0 @@
|
||||
dnl AC_DEFINE_INTEGER_BITS
|
||||
AC_DEFUN([AC_DEFINE_INTEGER_BITS],
|
||||
[m4_define([ac_datatype_bits], [m4_translit($1, [a-zA-Z_])])
|
||||
m4_define([ac_datatype_bytes], [m4_eval(ac_datatype_bits/8)])
|
||||
AC_CHECK_TYPE($1, ,
|
||||
[
|
||||
AC_MSG_NOTICE([trying to find a suitable ]ac_datatype_bytes[-byte replacement for $1])
|
||||
$1=no
|
||||
find_$1 ()
|
||||
{
|
||||
_AC_DEFINE_INTEGER_BITS_HELPER($@)
|
||||
:
|
||||
}
|
||||
find_$1
|
||||
AC_DEFINE_UNQUOTED($1, $$1,
|
||||
[If not already defined, then define as a datatype of *exactly* ]ac_datatype_bits[ bits.])
|
||||
])
|
||||
])
|
||||
|
||||
dnl Iterate over arguments $2..$N, trying to find a good match for $1.
|
||||
m4_define([_AC_DEFINE_INTEGER_BITS_HELPER],
|
||||
[ifelse($2, , ,
|
||||
[m4_define([ac_datatype_bits], [m4_translit($1, [a-zA-Z_])])
|
||||
m4_define([ac_datatype_bytes], [m4_eval(ac_datatype_bits/8)])
|
||||
AC_CHECK_SIZEOF($2)
|
||||
if test "$AS_TR_SH(ac_cv_sizeof_$2)" -eq ac_datatype_bytes; then
|
||||
$1="$2"
|
||||
return
|
||||
fi
|
||||
_AC_DEFINE_INTEGER_BITS_HELPER($1, m4_shift(m4_shift($@)))
|
||||
])
|
||||
])
|
||||
@@ -1,234 +0,0 @@
|
||||
dnl Available from the GNU Autoconf Macro Archive at:
|
||||
dnl http://autoconf-archive.cryp.to/acx_pthread.html
|
||||
dnl Version: 2005-06-15
|
||||
dnl
|
||||
AC_DEFUN([ACX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
acx_pthread_ok=no
|
||||
|
||||
# We used to check for pthread.h first, but this fails if pthread.h
|
||||
# requires special compiler flags (e.g. on True64 or Sequent).
|
||||
# It gets checked for in the link test anyway.
|
||||
|
||||
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
||||
# etcetera environment variables, and if threads linking works using
|
||||
# them:
|
||||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
||||
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
|
||||
AC_MSG_RESULT($acx_pthread_ok)
|
||||
if test x"$acx_pthread_ok" = xno; then
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
fi
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
|
||||
# We must check for the threads library under a number of different
|
||||
# names; the ordering is very important because some systems
|
||||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||
# libraries is broken (non-POSIX).
|
||||
|
||||
# Create a list of thread flags to try. Items starting with a "-" are
|
||||
# C compiler flags, and other items are library names, except for "none"
|
||||
# which indicates that we try without any flags at all, and "pthread-config"
|
||||
# which is a program returning the flags for the Pth emulation library.
|
||||
|
||||
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
|
||||
# pthreads: AIX (must check this before -lpthread)
|
||||
# none: in case threads are in libc; should be tried before -Kthread and
|
||||
# other compiler flags to prevent continual compiler warnings
|
||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
|
||||
# -pthreads: Solaris/gcc
|
||||
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||
# doesn't hurt to check since this sometimes defines pthreads too;
|
||||
# also defines -D_REENTRANT)
|
||||
# pthread: Linux, etcetera
|
||||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*solaris*)
|
||||
|
||||
# On Solaris (at least, for some versions), libc contains stubbed
|
||||
# (non-functional) versions of the pthreads routines, so link-based
|
||||
# tests will erroneously succeed. (We need to link with -pthread or
|
||||
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
|
||||
# a function called by this macro, so we could check for that, but
|
||||
# who knows whether they'll stub that too in a future libc.) So,
|
||||
# we'll just look for -pthreads and -lpthread first:
|
||||
|
||||
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x"$acx_pthread_ok" = xno; then
|
||||
for flag in $acx_pthread_flags; do
|
||||
case $flag in
|
||||
none)
|
||||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||
;;
|
||||
|
||||
-*)
|
||||
AC_MSG_CHECKING([whether pthreads work with $flag])
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
|
||||
if test x"$acx_pthread_config" = xno; then continue; fi
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||
PTHREAD_LIBS="-l$flag"
|
||||
;;
|
||||
esac
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Check for various functions. We must include pthread.h,
|
||||
# since some functions may be macros. (On the Sequent, we
|
||||
# need a special flag -Kthread to make this header compile.)
|
||||
# We check for pthread_join because it is in -lpthread on IRIX
|
||||
# while pthread_create is in libc. We check for pthread_attr_init
|
||||
# due to DEC craziness with -lpthreads. We check for
|
||||
# pthread_cleanup_push because it is one of the few pthread
|
||||
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||
# We try pthread_create on general principles.
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[pthread_t th=pthread_self(); pthread_attr_t attr;pthread_join(th, 0);
|
||||
pthread_attr_init(&attr);
|
||||
pthread_mutex_t mtx; pthread_mutex_init(&mtx,0);
|
||||
pthread_mutex_lock(&mtx); pthread_mutex_unlock(&mtx);
|
||||
pthread_mutex_destroy(&mtx) ],
|
||||
[acx_pthread_ok=yes])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_MSG_RESULT($acx_pthread_ok)
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: threads are created detached by default
|
||||
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[int attr=PTHREAD_CREATE_JOINABLE;],
|
||||
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
|
||||
if test x"$ok" = xunknown; then
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[int attr=PTHREAD_CREATE_UNDETACHED;],
|
||||
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
|
||||
fi
|
||||
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
|
||||
[Define to the necessary symbol if this constant uses a non-standard name on your system.])
|
||||
fi
|
||||
AC_MSG_RESULT(${ok})
|
||||
if test x"$ok" = xunknown; then
|
||||
AC_MSG_WARN([we do not know how to create joinable pthreads])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
|
||||
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
|
||||
esac
|
||||
AC_MSG_RESULT($flag)
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
dnl Check for recursive mutex support (per SUSv3).
|
||||
AC_MSG_CHECKING([for recursive mutex support])
|
||||
AC_TRY_RUN([#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutex_t m;
|
||||
|
||||
exit (pthread_mutexattr_init(&attr)
|
||||
|| pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)
|
||||
|| pthread_mutex_init(&m, &attr));
|
||||
}], [acx_pthreads_recursive=yes], [acx_pthreads_recursive=no])
|
||||
dnl NOTE: pthread_mutexattr_setkind_np is the deprecated name for pthread_mutexattr_settype. old compilers might need it
|
||||
|
||||
if test "$acx_pthreads_recursive" = "yes"; then
|
||||
AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], 1,
|
||||
[Define if recursive pthread mutexes are available])
|
||||
fi
|
||||
AC_MSG_RESULT($acx_pthreads_recursive)
|
||||
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: must compile with cc_r
|
||||
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
|
||||
|
||||
else
|
||||
case $host in
|
||||
*-*-mingw32*)
|
||||
AC_MSG_RESULT([MINGW32: use windows threading library!])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Cannot find a working pthread configuration. If you think this is wrong, please review acx_pthread.m4 and report the problem])
|
||||
;;
|
||||
esac
|
||||
PTHREAD_CC="$CC"
|
||||
fi
|
||||
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
AC_SUBST(PTHREAD_CFLAGS)
|
||||
AC_SUBST(PTHREAD_CC)
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$acx_pthread_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
||||
:
|
||||
else
|
||||
acx_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_RESTORE
|
||||
])dnl ACX_PTHREAD
|
||||
@@ -1,65 +0,0 @@
|
||||
dnl AX_CONFIG_FEATURE
|
||||
AC_DEFUN([AX_CONFIG_FEATURE],[ dnl
|
||||
m4_pushdef([FEATURE], patsubst([$1], -, _))dnl
|
||||
|
||||
AC_ARG_ENABLE([$1],AC_HELP_STRING([--enable-$1],[$2]),[
|
||||
case "${enableval}" in
|
||||
yes)
|
||||
ax_config_feature_[]FEATURE[]="yes"
|
||||
;;
|
||||
no)
|
||||
ax_config_feature_[]FEATURE[]="no"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([bad value ${enableval} for feature --$1])
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
AS_IF([test "$ax_config_feature_[]FEATURE[]" = yes],[ dnl
|
||||
AC_DEFINE([$3])
|
||||
$5
|
||||
AS_IF([test "$ax_config_feature_verbose" = yes],[ dnl
|
||||
AC_MSG_NOTICE([Feature $1 is enabled])
|
||||
])
|
||||
],[ dnl
|
||||
$6
|
||||
AS_IF([test "$ax_config_feature_verbose" = yes],[ dnl
|
||||
AC_MSG_NOTICE([Feature $1 is disabled])
|
||||
])
|
||||
])
|
||||
|
||||
AH_TEMPLATE([$3],[$4])
|
||||
|
||||
m4_popdef([FEATURE])dnl
|
||||
])
|
||||
|
||||
dnl Feature global
|
||||
AC_DEFUN([AX_CONFIG_FEATURE_VERBOSE],[ dnl
|
||||
ax_config_feature_verbose=yes
|
||||
])
|
||||
|
||||
dnl Feature global
|
||||
AC_DEFUN([AX_CONFIG_FEATURE_SILENT],[ dnl
|
||||
ax_config_feature_verbose=no
|
||||
])
|
||||
|
||||
dnl Feature specific
|
||||
AC_DEFUN([AX_CONFIG_FEATURE_DEFAULT_ENABLED], [
|
||||
ax_config_feature_[]FEATURE[]_default=yes
|
||||
])
|
||||
|
||||
dnl Feature specific
|
||||
AC_DEFUN([AX_CONFIG_FEATURE_DEFAULT_DISABLED], [
|
||||
ax_config_feature_[]FEATURE[]_default=no
|
||||
])
|
||||
|
||||
dnl Feature specific
|
||||
AC_DEFUN([AX_CONFIG_FEATURE_ENABLE],[ dnl
|
||||
ax_config_feature_[]patsubst([$1], -, _)[]=yes
|
||||
])
|
||||
|
||||
dnl Feature specific
|
||||
AC_DEFUN([AX_CONFIG_FEATURE_DISABLE],[ dnl
|
||||
ax_config_feature_[]patsubst([$1], -, _)[]=yes
|
||||
])
|
||||
@@ -1,195 +0,0 @@
|
||||
dnl @synopsis AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])]
|
||||
dnl
|
||||
dnl This is a new variant from ac_prefix_config_ this one will use a
|
||||
dnl lowercase-prefix if the config-define was starting with a
|
||||
dnl lowercase-char, e.g. "#define const", "#define restrict", or
|
||||
dnl "#define off_t", (and this one can live in another directory, e.g.
|
||||
dnl testpkg/config.h therefore I decided to move the output-header to
|
||||
dnl be the first arg)
|
||||
dnl
|
||||
dnl takes the usual config.h generated header file; looks for each of
|
||||
dnl the generated "#define SOMEDEF" lines, and prefixes the defined
|
||||
dnl name (ie. makes it "#define PREFIX_SOMEDEF". The result is written
|
||||
dnl to the output config.header file. The PREFIX is converted to
|
||||
dnl uppercase for the conversions.
|
||||
dnl
|
||||
dnl Defaults:
|
||||
dnl
|
||||
dnl OUTPUT-HEADER = $PACKAGE-config.h
|
||||
dnl PREFIX = $PACKAGE
|
||||
dnl ORIG-HEADER, from AM_CONFIG_HEADER(config.h)
|
||||
dnl
|
||||
dnl Your configure.ac script should contain both macros in this order,
|
||||
dnl and unlike the earlier variations of this prefix-macro it is okay
|
||||
dnl to place the AX_PREFIX_CONFIG_H call before the AC_OUTPUT
|
||||
dnl invokation.
|
||||
dnl
|
||||
dnl Example:
|
||||
dnl
|
||||
dnl AC_INIT(config.h.in) # config.h.in as created by "autoheader"
|
||||
dnl AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE
|
||||
dnl AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in
|
||||
dnl AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it..
|
||||
dnl AC_MEMORY_H # makes "#undef NEED_MEMORY_H"
|
||||
dnl AC_C_CONST_H # makes "#undef const"
|
||||
dnl AC_OUTPUT(Makefile) # creates the "config.h" now
|
||||
dnl # and also mylib/_config.h
|
||||
dnl
|
||||
dnl if the argument to AX_PREFIX_CONFIG_H would have been omitted then
|
||||
dnl the default outputfile would have been called simply
|
||||
dnl "testpkg-config.h", but even under the name "mylib/_config.h" it
|
||||
dnl contains prefix-defines like
|
||||
dnl
|
||||
dnl #ifndef TESTPKG_VERSION
|
||||
dnl #define TESTPKG_VERSION "0.1.1"
|
||||
dnl #endif
|
||||
dnl #ifndef TESTPKG_NEED_MEMORY_H
|
||||
dnl #define TESTPKG_NEED_MEMORY_H 1
|
||||
dnl #endif
|
||||
dnl #ifndef _testpkg_const
|
||||
dnl #define _testpkg_const _const
|
||||
dnl #endif
|
||||
dnl
|
||||
dnl and this "mylib/_config.h" can be installed along with other
|
||||
dnl header-files, which is most convenient when creating a shared
|
||||
dnl library (that has some headers) where some functionality is
|
||||
dnl dependent on the OS-features detected at compile-time. No need to
|
||||
dnl invent some "mylib-confdefs.h.in" manually. :-)
|
||||
dnl
|
||||
dnl Note that some AC_DEFINEs that end up in the config.h file are
|
||||
dnl actually self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the
|
||||
dnl AC_TYPE_OFF_T say that they "will define inline|const|off_t if the
|
||||
dnl system does not do it by itself". You might want to clean up about
|
||||
dnl these - consider an extra mylib/conf.h that reads something like:
|
||||
dnl
|
||||
dnl #include <mylib/_config.h>
|
||||
dnl #ifndef _testpkg_const
|
||||
dnl #define _testpkg_const const
|
||||
dnl #endif
|
||||
dnl
|
||||
dnl and then start using _testpkg_const in the header files. That is
|
||||
dnl also a good thing to differentiate whether some library-user has
|
||||
dnl starting to take up with a different compiler, so perhaps it could
|
||||
dnl read something like this:
|
||||
dnl
|
||||
dnl #ifdef _MSC_VER
|
||||
dnl #include <mylib/_msvc.h>
|
||||
dnl #else
|
||||
dnl #include <mylib/_config.h>
|
||||
dnl #endif
|
||||
dnl #ifndef _testpkg_const
|
||||
dnl #define _testpkg_const const
|
||||
dnl #endif
|
||||
dnl
|
||||
dnl Modified by Ben van Klinken for CLucene. Added a 4th parameter which
|
||||
dnl should be a list of parameters that should not be prefixed. This
|
||||
dnl simplifies the usage by not requiring some of the previously documented
|
||||
dnl workarounds.
|
||||
dnl
|
||||
dnl @category Misc
|
||||
dnl @author Guido Draheim <guidod@gmx.de>
|
||||
dnl @author Mårten Svantesson <msv@kth.se>
|
||||
dnl @version 2005-06-08
|
||||
dnl @license GPLWithACException
|
||||
|
||||
AC_DEFUN([AX_PREFIX_CONFIG_H],[AC_REQUIRE([AC_CONFIG_HEADER])
|
||||
AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
|
||||
AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
|
||||
AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
|
||||
AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
|
||||
AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl
|
||||
AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
|
||||
AS_VAR_PUSHDEF([_IGN],[ac_prefix_conf_IGN])dnl
|
||||
AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
|
||||
m4_pushdef([_script],[conftest.prefix])dnl
|
||||
m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
|
||||
_OUT=`printf '%s\n' ifelse($1, , $PACKAGE-config.h, $1)`
|
||||
_DEF=`printf '%s\n' _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
|
||||
_PKG=`printf '%s\n' ifelse($2, , $PACKAGE, $2)`
|
||||
_LOW=`printf '%s\n' _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
|
||||
_UPP=`printf '%s\n' $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
|
||||
_IGN="$4"
|
||||
_INP=`printf '%s\n' "ifelse($3,,,$3)" | sed -e 's/ *//'`
|
||||
if test ".$_INP" = "."; then
|
||||
for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
|
||||
case "$ac_file" in
|
||||
*.h) _INP=$ac_file ;;
|
||||
*)
|
||||
esac
|
||||
test ".$_INP" != "." && break
|
||||
done
|
||||
fi
|
||||
if test ".$_INP" = "."; then
|
||||
case "$_OUT" in
|
||||
*/*) _INP=`basename "$_OUT"`
|
||||
;;
|
||||
*-*) _INP=`printf '%s\n' "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
|
||||
;;
|
||||
*) _INP=config.h
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test -z "$_PKG" ; then
|
||||
AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
|
||||
else
|
||||
if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
|
||||
_INP="$srcdir/$_INP"
|
||||
fi fi
|
||||
AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines)
|
||||
if test -f $_INP ; then
|
||||
printf '%s\n' "s/@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script
|
||||
printf '%s\n' "s/@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script
|
||||
printf '%s\n' "s/@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script
|
||||
printf '%s\n' "@%:@def[]ine $_UPP""_\\1 \\2 \\" >> _script
|
||||
printf '%s\n' "@%:@endif/" >>_script
|
||||
printf '%s\n' "s/@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script
|
||||
printf '%s\n' "@%:@define $_LOW""_\\1 \\2 \\" >> _script
|
||||
printf '%s\n' "@%:@endif/" >> _script
|
||||
|
||||
#take 4th parameter for the ignore list.
|
||||
#goes through the list and reverts each item back to its original state
|
||||
#works for both upper and lower case prefixes
|
||||
for _IGNx in $_IGN; do
|
||||
printf '%s\n' "s/#ifndef $ac_prefix_conf_LOW""_$_IGNx/#ifndef $_IGNx/" >> conftest.prefix
|
||||
printf '%s\n' "s/#define $ac_prefix_conf_LOW""_$_IGNx/#define $_IGNx/" >> conftest.prefix
|
||||
printf '%s\n' "s/#undef $ac_prefix_conf_LOW""_$_IGNx/#undef $_IGNx/" >> conftest.prefix
|
||||
printf '%s\n' "s/#ifndef $ac_prefix_conf_UPP""_$_IGNx/#ifndef $_IGNx/" >> conftest.prefix
|
||||
printf '%s\n' "s/#define $ac_prefix_conf_UPP""_$_IGNx/#define $_IGNx/" >> conftest.prefix
|
||||
printf '%s\n' "s/#undef $ac_prefix_conf_UPP""_$_IGNx/#undef $_IGNx/" >> conftest.prefix
|
||||
done
|
||||
|
||||
|
||||
# now executing _script on _DEF input to create _OUT output file
|
||||
printf '%s\n' "@%:@ifndef $_DEF" >$tmp/pconfig.h
|
||||
printf '%s\n' "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h
|
||||
printf '%s\n' ' ' >>$tmp/pconfig.h
|
||||
printf '%s\n' /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
|
||||
|
||||
sed -f _script $_INP >>$tmp/pconfig.h
|
||||
printf '%s\n' ' ' >>$tmp/pconfig.h
|
||||
printf '%s\n' '/* once:' $_DEF '*/' >>$tmp/pconfig.h
|
||||
printf '%s\n' "@%:@endif" >>$tmp/pconfig.h
|
||||
if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
|
||||
AC_MSG_NOTICE([$_OUT is unchanged])
|
||||
else
|
||||
ac_dir=`AS_DIRNAME(["$_OUT"])`
|
||||
AS_MKDIR_P(["$ac_dir"])
|
||||
rm -f "$_OUT"
|
||||
mv $tmp/pconfig.h "$_OUT"
|
||||
fi
|
||||
cp _script _configs.sed
|
||||
else
|
||||
AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
|
||||
fi
|
||||
rm -f conftest.*
|
||||
fi
|
||||
m4_popdef([_symbol])dnl
|
||||
m4_popdef([_script])dnl
|
||||
AS_VAR_POPDEF([_INP])dnl
|
||||
AS_VAR_POPDEF([_UPP])dnl
|
||||
AS_VAR_POPDEF([_LOW])dnl
|
||||
AS_VAR_POPDEF([_IGN])dnl
|
||||
AS_VAR_POPDEF([_PKG])dnl
|
||||
AS_VAR_POPDEF([_DEF])dnl
|
||||
AS_VAR_POPDEF([_OUT])dnl
|
||||
],[PACKAGE="$PACKAGE"])])
|
||||
@@ -1,100 +0,0 @@
|
||||
dnl dps_float_byte
|
||||
AC_DEFUN([dps_float_byte],
|
||||
[AC_MSG_CHECKING(whether ${CXX} supports our byte<->float conversions)
|
||||
AC_CACHE_VAL(mdl_cv_have_float_byte_support,
|
||||
[ AC_TRY_RUN(
|
||||
changequote(<:<, >:>)dnl
|
||||
<:<
|
||||
typedef long double float_t;
|
||||
typedef long int32_t;
|
||||
typedef char uint8_t;
|
||||
|
||||
//float to bits conversion utilities...
|
||||
union clvalue {
|
||||
int32_t i;
|
||||
float f; //must use a float type, else types dont match up
|
||||
};
|
||||
|
||||
int32_t floatToIntBits(float_t value)
|
||||
{
|
||||
clvalue u;
|
||||
int32_t e, f;
|
||||
u.f = value;
|
||||
e = u.i & 0x7f800000;
|
||||
f = u.i & 0x007fffff;
|
||||
|
||||
if (e == 0x7f800000 && f != 0)
|
||||
u.i = 0x7fc00000;
|
||||
|
||||
return u.i;
|
||||
}
|
||||
float_t intBitsToFloat(int32_t bits)
|
||||
{
|
||||
clvalue u;
|
||||
u.i = bits;
|
||||
return u.f;
|
||||
}
|
||||
|
||||
float_t byteToFloat(uint8_t b) {
|
||||
if (b == 0) // zero is a special case
|
||||
return 0.0f;
|
||||
int32_t mantissa = b & 7;
|
||||
int32_t exponent = (b >> 3) & 31;
|
||||
int32_t bits = ((exponent+(63-15)) << 24) | (mantissa << 21);
|
||||
return intBitsToFloat(bits);
|
||||
}
|
||||
|
||||
uint8_t floatToByte(float_t f) {
|
||||
if (f < 0.0f) // round negatives up to zero
|
||||
f = 0.0f;
|
||||
|
||||
if (f == 0.0f) // zero is a special case
|
||||
return 0;
|
||||
|
||||
int32_t bits = floatToIntBits(f); // parse float_t into parts
|
||||
int32_t mantissa = (bits & 0xffffff) >> 21;
|
||||
int32_t exponent = (((bits >> 24) & 0x7f) - 63) + 15;
|
||||
|
||||
if (exponent > 31) { // overflow: use max value
|
||||
exponent = 31;
|
||||
mantissa = 7;
|
||||
}
|
||||
|
||||
if (exponent < 0) { // underflow: use min value
|
||||
exponent = 0;
|
||||
mantissa = 1;
|
||||
}
|
||||
|
||||
return (uint8_t)((exponent << 3) | mantissa); // pack into a uint8_t
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
//well know conversion
|
||||
if ( floatToByte(0.5f) != 120 )
|
||||
return 1;
|
||||
|
||||
//converting back works?
|
||||
if ( floatToByte(byteToFloat(57)) != 57 )
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
>:>
|
||||
changequote([, ]), dps_float_byte_fail=0, dps_float_byte_fail=1,
|
||||
dps_float_byte_fail=2
|
||||
)]
|
||||
)
|
||||
|
||||
if test $dps_float_byte_fail -eq 0; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_FUNCTIONING_FLOAT_BYTE], [], [Does not support new float byte<->float conversions])
|
||||
elif test $dps_float_byte_fail -eq 1; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_DEFINE([HAVE_NO_FLOAT_BYTE], [], [Does not support new float byte<->float conversions])
|
||||
else
|
||||
AC_MSG_RESULT([unknown, assuming broken])
|
||||
AC_DEFINE([HAVE_NO_FLOAT_BYTE], [], [Does not support new float byte<->float conversions])
|
||||
fi
|
||||
|
||||
])
|
||||
@@ -1,41 +0,0 @@
|
||||
dnl dps_snprintf_oflow
|
||||
AC_DEFUN([dps_snprintf_oflow],
|
||||
[AC_MSG_CHECKING(whether snprintf ignores n)
|
||||
AC_CACHE_VAL(dps_cv_snprintf_bug,
|
||||
[AC_TRY_RUN(
|
||||
changequote(<<, >>)dnl
|
||||
<<#include <stdio.h>
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
#include "vsnprintf.h"
|
||||
#else /* not HAVE_VSNPRINTF */
|
||||
#include "vsnprintf.c"
|
||||
#endif /* HAVE_VSNPRINTF */
|
||||
#endif /* HAVE_SNPRINTF */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char ovbuf[7];
|
||||
int i;
|
||||
for (i=0; i<7; i++) ovbuf[i]='x';
|
||||
snprintf(ovbuf, 4,"foo%s", "bar");
|
||||
if (ovbuf[5]!='x') exit(1);
|
||||
snprintf(ovbuf, 4,"foo%d", 666);
|
||||
if (ovbuf[5]!='x') exit(1);
|
||||
exit(0);
|
||||
} >>
|
||||
changequote([, ]), dps_cv_snprintf_bug=0, dps_cv_snprintf_bug=1,
|
||||
dps_cv_snprintf_bug=2
|
||||
)
|
||||
])
|
||||
if test $dps_cv_snprintf_bug -eq 0; then
|
||||
AC_MSG_RESULT([no, snprintf is ok])
|
||||
elif test $dps_cv_snprintf_bug -eq 1; then
|
||||
AC_MSG_RESULT([yes, snprintf is broken])
|
||||
AC_DEFINE([HAVE_SNPRINTF_BUG],[][Defined if the snprintf overflow test fails])
|
||||
else
|
||||
AC_MSG_RESULT([unknown, assuming yes])
|
||||
AC_DEFINE([HAVE_SNPRINTF_BUG],[],[Defined if the snprintf overflow test fails])
|
||||
fi
|
||||
])
|
||||
@@ -1,33 +0,0 @@
|
||||
dnl dps_static_const
|
||||
AC_DEFUN([dps_static_const],
|
||||
[AC_MSG_CHECKING(whether ${CXX} supports static const definitions in classes)
|
||||
AC_CACHE_VAL(dps_static_const_type,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
AC_TRY_RUN([class x{public: static const int SCI=55; }; int main(){ x a; if ( a.SCI!=55 ) throw "err"; }],
|
||||
dps_static_const_type=1,
|
||||
dps_static_const_type=0,
|
||||
dps_static_const_type=0)
|
||||
|
||||
if test $dps_static_const_type -eq 0; then
|
||||
AC_TRY_RUN([class x{public: enum{ SCI=55 }; }; int main(){ x a; if ( a.SCI!=55 ) throw "err"; }],
|
||||
dps_static_const_type=2,
|
||||
dps_static_const_type=0,
|
||||
dps_static_const_type=0)
|
||||
fi
|
||||
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test $dps_static_const_type -eq 1; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([LUCENE_STATIC_CONSTANT_SYNTAX], 1, [How to define a static const in a class])
|
||||
elif test $dps_static_const_type -eq 2; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([LUCENE_STATIC_CONSTANT_SYNTAX], 2, [How to define a static const in a class])
|
||||
else
|
||||
AC_MSG_ERROR([Cannot figure out how to write static consts in classes. Check the m4 script or upgrade your compiler])
|
||||
fi
|
||||
|
||||
])
|
||||
@@ -1,31 +0,0 @@
|
||||
dnl dps_swprintf_works
|
||||
AC_DEFUN([dps_swprintf_works],
|
||||
[AC_MSG_CHECKING(whether swprintf is broken)
|
||||
AC_CACHE_VAL(dps_cv_swprintf_works,
|
||||
[ AC_TRY_RUN(
|
||||
changequote(<<, >>)dnl
|
||||
<<#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
wchar_t buf[5];
|
||||
swprintf(buf,5,L"%s",L"foo");
|
||||
if ( wcslen(buf) != 3 )
|
||||
exit(1);
|
||||
exit(0);
|
||||
} >>
|
||||
changequote([, ]), dps_cv_swprintf_works=0, dps_cv_swprintf_works=1,
|
||||
dps_cv_swprintf_works=2
|
||||
)]
|
||||
)
|
||||
if test $dps_cv_swprintf_works -eq 0; then
|
||||
AC_MSG_RESULT([no, swprintf is ok])
|
||||
elif test $dps_cv_swprintf_works -eq 1; then
|
||||
AC_MSG_RESULT([yes, swprintf is broken])
|
||||
AC_DEFINE([HAVE_SWPRINTF_BUG],[],[Defined if the swprintf test fails])
|
||||
else
|
||||
AC_MSG_RESULT([unknown, assuming yes])
|
||||
AC_DEFINE([HAVE_SWPRINTF_BUG],[],[Defined if the swprintf test fails])
|
||||
fi
|
||||
])
|
||||
@@ -1,19 +0,0 @@
|
||||
dnl MDL_CXX_FUNCTION_TRY_BLOCKS
|
||||
AC_DEFUN([MDL_CXX_FUNCTION_TRY_BLOCKS],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CXX])
|
||||
AC_MSG_CHECKING(whether ${CXX} supports function try blocks)
|
||||
AC_CACHE_VAL(mdl_cv_have_function_try_blocks,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_TRY_COMPILE([void foo() try{} catch( ... ){}],
|
||||
[foo();],
|
||||
mdl_cv_have_function_try_blocks=yes,
|
||||
mdl_cv_have_function_try_blocks=no)
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
AC_MSG_RESULT($mdl_cv_have_function_try_blocks)
|
||||
if test "$mdl_cv_have_function_try_blocks" = no; then
|
||||
AC_DEFINE([HAVE_NO_FUNCTION_TRY_BLOCKS], [], [Does not support try/catch blocks])
|
||||
fi])
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
//Includes some standard headers for searching and indexing.
|
||||
#ifndef _lucene_CLucene_
|
||||
#define _lucene_CLucene_
|
||||
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "CLucene/debug/condition.h"
|
||||
#include "CLucene/debug/mem.h"
|
||||
#include "CLucene/index/IndexReader.h"
|
||||
#include "CLucene/index/IndexWriter.h"
|
||||
#include "CLucene/index/MultiReader.h"
|
||||
#include "CLucene/index/Term.h"
|
||||
#include "CLucene/search/IndexSearcher.h"
|
||||
#include "CLucene/search/MultiSearcher.h"
|
||||
#include "CLucene/search/DateFilter.h"
|
||||
#include "CLucene/search/WildcardQuery.h"
|
||||
#include "CLucene/search/FuzzyQuery.h"
|
||||
#include "CLucene/search/PhraseQuery.h"
|
||||
#include "CLucene/search/PrefixQuery.h"
|
||||
#include "CLucene/search/RangeQuery.h"
|
||||
#include "CLucene/search/BooleanQuery.h"
|
||||
#include "CLucene/document/Document.h"
|
||||
#include "CLucene/document/Field.h"
|
||||
#include "CLucene/document/DateField.h"
|
||||
#include "CLucene/store/Directory.h"
|
||||
#include "CLucene/store/FSDirectory.h"
|
||||
#include "CLucene/queryParser/QueryParser.h"
|
||||
#include "CLucene/analysis/standard/StandardAnalyzer.h"
|
||||
#include "CLucene/analysis/Analyzers.h"
|
||||
#include "CLucene/util/Reader.h"
|
||||
|
||||
#endif
|
||||
@@ -1,87 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _clucene_backwards_h
|
||||
#define _clucene_backwards_h
|
||||
|
||||
//In light of the recent major changes to clucene,
|
||||
//this file should help to maintain some backwards compatibility
|
||||
//include it after including StdHeader.h
|
||||
//
|
||||
//Note: I haven't tested this much, so please send me your changes
|
||||
|
||||
//dirent is one of the most major changes that won't easily port.
|
||||
//you can use the TCHAR copying macros, STRCPY_TtoA and STRCPY_AtoT
|
||||
//to copy between different character types.
|
||||
|
||||
//If you use stringPrintF, you will need to add the target string
|
||||
//size parameter, because it is using _sntprintf... Change this if you
|
||||
//want, but _sntprintf is much safer
|
||||
|
||||
#define char_t TCHAR
|
||||
#define uchar_t TCHAR
|
||||
#define l_byte_t byte_t
|
||||
|
||||
//#define stringSpn _tcsspn //not used in clucene anymore
|
||||
#define stringCSpn _tcscspn
|
||||
#define stringLength _tcslen
|
||||
//#define stringToInteger _ttoi //not used in clucene anymore, use integer w/ base
|
||||
#define stringFind _tcsstr
|
||||
#define stringFindChar _tcschr
|
||||
#define stringCompare _tcscmp
|
||||
#define stringNCopy _tcsncpy
|
||||
#define stringCopy _tcscpy
|
||||
#define stringCat _tcscat
|
||||
//#define stringToken _tcstok //not used in clucene anymore
|
||||
#define stringPrintF _sntprintf //you will have errors, because now we used printf w/ bufferlen count
|
||||
#define printFormatted _tprintf
|
||||
|
||||
//conversion functions
|
||||
#define integerToString _i64tot
|
||||
#define stringToIntegerBase _tcstoi64
|
||||
#define stringToFloat _tcstod
|
||||
|
||||
//file find structures
|
||||
#define Cmd_Stat fileStat
|
||||
#define Struct_Stat fileStat
|
||||
#define stringICompare _tcsicmp
|
||||
#define stringNCompare _tcsncmp
|
||||
#define stringDifference _tcscmp
|
||||
|
||||
//character conversion functions
|
||||
#define isSpace _istspace
|
||||
#define isDigit _istwdigit
|
||||
#define isAlNum _istwalnum
|
||||
#define toLower _totlower
|
||||
#define stringUpper _tcsupr
|
||||
//#define stringLower _tcslwr //not used in clucene anymore
|
||||
|
||||
#define _THROWX(y) _THROWT(y)
|
||||
#define _THROWC(y) _THROWA(y)
|
||||
|
||||
//file naming stuff - remember we have changed all names to file naming lower case
|
||||
#define fileRename _rename
|
||||
#define fileFullName(abs,rel) _realpath(rel,abs)
|
||||
#define makeDirectory _tmkdir
|
||||
#define unlinkFile _unlink
|
||||
|
||||
//no longer supported definitions
|
||||
#ifdef _UNICODE
|
||||
#define TO_CHAR_T STRDUP_AtoT
|
||||
#define _cout wcout
|
||||
#define _cin wcin
|
||||
#define _cerr wcerr
|
||||
#else
|
||||
#define TO_CHAR_T STRDUP_WtoT
|
||||
#define _cout cout
|
||||
#define _cin cin
|
||||
#define _cerr cerr
|
||||
#endif
|
||||
|
||||
//some headers that used to be automatically included:
|
||||
#include "CLucene/util/dirent.h" //if we have dirent, then the native one will be used
|
||||
|
||||
#endif
|
||||
@@ -1,343 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_Config_
|
||||
#define _lucene_Config_
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// this settings should be set up in the compiler,
|
||||
// but are put here for reference as to what could be defined
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//define this if you want debugging code to be enabled
|
||||
//#define _DEBUG
|
||||
//
|
||||
//define this if you want condition debugging to be enabled
|
||||
#if defined(_DEBUG) && !defined(_CL__CND_DEBUG)
|
||||
#define _CL__CND_DEBUG
|
||||
#endif
|
||||
//
|
||||
//define this to print out lots of information about merges, etc
|
||||
//requires __CL__CND_DEBUG to be defined
|
||||
//#define _CL_DEBUG_INFO stdout
|
||||
//
|
||||
//to disable namespaces define this
|
||||
//#define DISABLE_NAMESPACE
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// These options can be set depending on the particular needs of
|
||||
// Your application
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//define this to force the build into ascii mode
|
||||
//#define _ASCII
|
||||
//
|
||||
//define this to force the build into ucs2 mode
|
||||
//#define _UCS2
|
||||
//
|
||||
//if a wide character is being converted to a ascii character and it
|
||||
//cannot fit, this character is used instead. Required.
|
||||
#define LUCENE_OOR_CHAR(c) ((char)(((unsigned short)c)&0xFF))
|
||||
//
|
||||
//define if you would like to force clucene to use the internal
|
||||
//character functions.
|
||||
//Tests may display unpredictable behaviour if this is not defined.
|
||||
#define LUCENE_USE_INTERNAL_CHAR_FUNCTIONS
|
||||
//
|
||||
//define this to enable mmap support in the fsdirectory IndexInput
|
||||
//todo: only available for windows so far...need to add MMapInput.cpp to project
|
||||
//EXPERIMENTAL
|
||||
//#define LUCENE_FS_MMAP
|
||||
//
|
||||
//LOCK_DIR implementation:
|
||||
//define this to set an exact directory for the lock dir (not recommended)
|
||||
//all other methods of getting the temporary directory will be ignored
|
||||
//#define LUCENE_LOCK_DIR "/tmp"
|
||||
//
|
||||
//define this to try and load the lock dir from this specified environment variable
|
||||
#define LUCENE_LOCK_DIR_ENV_1 "TEMP"
|
||||
//define this if you want to have look up this environment variable if the first one fails
|
||||
#define LUCENE_LOCK_DIR_ENV_2 "TMP"
|
||||
//define this if you want to have a fallback directory, if not defined then
|
||||
//the lockdirectory will be the index directory
|
||||
#define LUCENE_LOCK_DIR_ENV_FALLBACK "/tmp"
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// The following are search query options
|
||||
// THe NO_* options can make CLucene faster and/or smaller
|
||||
// special queries sometime require longer search times or may
|
||||
// not be required
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//Define this to remove fuzzy query and sloppy scoring
|
||||
//#define NO_FUZZY_QUERY
|
||||
//
|
||||
//Define to remove wildcard t*m or te?m to match term
|
||||
//#define NO_WILDCARD_QUERY
|
||||
//
|
||||
//Define to remove prefix term query - ter* to match term or terms
|
||||
//#define NO_PREFIX_QUERY
|
||||
//
|
||||
//Define to remove range (exlusive and inclusive)
|
||||
//#define NO_RANGE_QUERY
|
||||
//
|
||||
//This must always be defined. They can be adjusted if required. But
|
||||
//general Wildcard string would be '*' and Wildcard Char would be '?'
|
||||
//Both are Required.
|
||||
#define LUCENE_WILDCARDTERMENUM_WILDCARD_STRING '*'
|
||||
#define LUCENE_WILDCARDTERMENUM_WILDCARD_CHAR '?'
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// memory handling configurations
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//If this is defined, lucene's configurations are changed
|
||||
//to use less memory, but may run slower.
|
||||
//todo: i dont think this actualy changes speed much, just memory
|
||||
#define LUCENE_OPTIMIZE_FOR_MEMORY
|
||||
//
|
||||
//enable this if you want to enable lucene's memory pool.
|
||||
//The memory pooling can greatly increase clucene by
|
||||
//putting certain classes that are allocated and deallocated
|
||||
//a lot into a memory pool. This method will use more memory,
|
||||
//because it does not return the memory back to the application.
|
||||
//Using memory pooling is difficult for
|
||||
//debugging, so only use it for releases. To 'free' the used
|
||||
//memory pool, call lucene_release_memory_pool...
|
||||
//To add another class to the memory pool you need to change
|
||||
//the LUCENE_BASE class to LUCENE_POOLEDBASE(cls) and the
|
||||
//LUCENE_MP_DEFINE(ns,cls) added just before the class.
|
||||
//In lucenebase.cpp add the implementations to the top of the
|
||||
//file. And in the lucene_release_memory_pool, add the RELEASE_MP
|
||||
//line (so that that memory pool will be deleted) and include
|
||||
//the header for the class into lucenebase.cpp
|
||||
//Note: If you use this, you may want to call lucene_release_memory_pool
|
||||
//after doing memory intensive calls. This is a bit like doing manual
|
||||
//"garbage collection"
|
||||
//Todo: this method is horriblly implemented. ideally, there should
|
||||
//be only 1 memory pool. If anyone wants to look into combining the
|
||||
//memory pool, please do
|
||||
#if !defined(_DEBUG) && !defined(LUCENE_OPTIMIZE_FOR_MEMORY) && !defined(LUCENE_ENABLE_MEMORY_POOL)
|
||||
//#define LUCENE_ENABLE_MEMORY_POOL
|
||||
#endif
|
||||
//
|
||||
//define this if you want the pointer tracking to be enabled
|
||||
//this is a useful tool for memory leak tracking
|
||||
//The LuceneBase can slow down the code a *lot*
|
||||
//todo: currently cant be used with mempool...
|
||||
#if defined(_DEBUG) && !defined(LUCENE_ENABLE_MEMORY_POOL)
|
||||
#if !defined(LUCENE_DISABLE_MEMTRACKING) && !defined(LUCENE_ENABLE_MEMLEAKTRACKING)
|
||||
#define LUCENE_ENABLE_MEMLEAKTRACKING
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
//enable use of rich file/line tracking. use CL_FILELINE to pass
|
||||
//to functions like stringDuplicate (or use CL_STRDUP* functions instead) and
|
||||
//CLStringIntern::x.
|
||||
#if defined(LUCENE_ENABLE_MEMLEAKTRACKING)
|
||||
#define LUCENE_ENABLE_FILELINEINFO
|
||||
#endif
|
||||
//
|
||||
//enable creation of clucene.log file. Logs every
|
||||
//call to new operator. Must have LUCENE_ENABLE_MEMLEAKTRACKING enabled.
|
||||
//writes log in this format.
|
||||
//action,file name,file line,allocation size
|
||||
//logging can be disabled by setting _lucene_disable_debuglogging to true
|
||||
#if defined(LUCENE_ENABLE_MEMLEAKTRACKING) && defined(_DEBUG)
|
||||
//#define LUCENE_ENABLE_CONSTRUCTOR_LOG
|
||||
#endif
|
||||
//
|
||||
//
|
||||
//enable this if you want to enable reference counting. This is
|
||||
//not necessary or useful in most cases except when implementing wrappers
|
||||
//which have reference counting. If the wrapper wraps a StringReader,
|
||||
//for example, it should expect that the wrapped StringReader should not
|
||||
//be deleted. However, when the stringreader is added into a Field,
|
||||
//the Field usually takes over the stringReader and deletes it on completion.
|
||||
//If reference counting is enabled, the wrapper can add a reference to any class
|
||||
//and when _CLDECDELETE is called, the reference is decremented and only deleted
|
||||
//if the refcount is zero.
|
||||
//#define LUCENE_ENABLE_REFCOUNT
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// These options allow you to remove certain implementations
|
||||
// out of clucene so that they can be implemented in the client
|
||||
// application
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//define this to your own setting if you would like to implement your own
|
||||
//threading locking code. it should have the same sort of functions as
|
||||
//mutex_default. If not defined, clucene will try and use posix,win32 critical
|
||||
//sections, or a timer based mutex hack.
|
||||
//#define _LUCENE_THREADMUTEX CL_NS(util)::mutex_default
|
||||
//
|
||||
//define this if you want to implement the _Cnd_OutDebug routine yourself
|
||||
//you can then easily customise in your own application how to handle debug messages
|
||||
//#define _CND_DEBUG_DONTIMPLEMENT_OUTDEBUG
|
||||
//
|
||||
//define this if you want to implement your own namespace macros
|
||||
//#define _LUCENE_DONTIMPLEMENT_NS_MACROS
|
||||
//
|
||||
//define this if you do not want clucene to include any standard libraries.
|
||||
//this could be useful if you want to use alternate libraries
|
||||
//#define LUCENE_DISABLE_INCLUDES
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// These options will be changed depending on your compiler/platform
|
||||
// but can also be changed here if required
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//define this if multi-threading support is not required
|
||||
//if not defined, multi-thread locking will
|
||||
//occur (and its related processing overhead)
|
||||
//note: it is recommended to disable multithreading if you do not need it
|
||||
//there is a lot of overhead that can be avoided.
|
||||
//#define _CL_DISABLE_MULTITHREADING
|
||||
//
|
||||
//if you want to define your own default file encoding. specify it
|
||||
//here - normally defined in the platform specific headers
|
||||
//#define PLATFORM_DEFAULT_READER_ENCODING CL_NS(util)::FileReader::ENCODING_ASCII
|
||||
//
|
||||
//disable hash implementations (if available)
|
||||
//#define LUCENE_DISABLE_HASHING
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// These options should not be changed. But you can experiment with
|
||||
// them to optimize performance
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//some defaults, wouldn't usually need to be changed
|
||||
//Buffer size for input/output streams. Required.
|
||||
//todo: change this to BufferedIndexOutput::BUFFER_SIZE
|
||||
#define LUCENE_STREAM_BUFFER_SIZE 1024
|
||||
//
|
||||
// DSR:2004.08.19:
|
||||
// Formerly, StringBuffer used 1024 as the default size of its internal buffer.
|
||||
// However, StringBuffer is used primarily for token- and term-oriented
|
||||
// processing, e.g. in StandardTokenizer. I've calculated that the average
|
||||
// token (as produced by StandardTokenizer) in all .txt files distributed in
|
||||
// the Project Gutenberg CD Image (August 2003 release) has only 6 characters.
|
||||
// Although most languages are likely to have a longer average word length than
|
||||
// English due to the popularity of "non-atomized" conjugation and declension
|
||||
// mechanisms, 1024 is still vastly excessive.
|
||||
// I made two changes intended to deliver better overall performance:
|
||||
// a) Switched to a default StringBuffer character capacity of 32. Though 32
|
||||
// is longer than the average token, the high cost of realloc makes a
|
||||
// slightly liberal default size optimal. I chose the default size of 32
|
||||
// after fairly extensive experimentation on the Gutenberg e-texts. The
|
||||
// results are summarized in the following table:
|
||||
// ------------------------------------------------------------------------
|
||||
// LUCENE_DEFAULT_TOKEN_BUFFER_SIZE value | % faster than default size 1024
|
||||
// ------------------------------------------------------------------------
|
||||
// 8 : 4%
|
||||
// 16 : 7%
|
||||
// 32 : 6%
|
||||
// 64 : 3%
|
||||
// A default size of 32 is actually slightly slower than 16, but I was
|
||||
// experimenting on English text; I expect that 32 will maintain decent
|
||||
// performance in languages such as German, and in technical documents
|
||||
// with long tokens.
|
||||
//
|
||||
// b) To offset the switch to a smaller default buffer size, I implemented a
|
||||
// more aggressive growth strategy. A StringBuffer now [at least] doubles
|
||||
// the size of its internal buffer every time it needs to grow, rather
|
||||
// than [at least] increasing by LUCENE_DEFAULT_TOKEN_BUFFER_SIZE no
|
||||
// matter how many times it has already grown.
|
||||
//Required.
|
||||
#define LUCENE_DEFAULT_TOKEN_BUFFER_SIZE 32
|
||||
//todo: should implement a similar strategy in analysis/token
|
||||
//
|
||||
//Expert: The fraction of terms in the "dictionary" which should be stored
|
||||
//in RAM. Smaller values use more memory, but make searching slightly
|
||||
//faster, while larger values use less memory and make searching slightly
|
||||
//slower. Searching is typically not dominated by dictionary lookup, so
|
||||
//tweaking this is rarely useful.
|
||||
#define LUCENE_DEFAULT_WRITER_INDEX_INTERVAL 128
|
||||
//
|
||||
//Expert: The fraction of {@link TermDocs} entries stored in skip tables,
|
||||
//used to accellerate {@link TermDocs#skipTo(int)}. Larger values result in
|
||||
//smaller indices, greater acceleration, but fewer accelerable cases, while
|
||||
//smaller values result in bigger indices, less acceleration and more
|
||||
//accelerable cases. More detailed experiments would be useful here. */
|
||||
#define LUCENE_DEFAULT_TERMDOCS_SKIP_INTERVAL 16
|
||||
//
|
||||
//Size of TermScore cache. Required.
|
||||
#define LUCENE_SCORE_CACHE_SIZE 32
|
||||
//
|
||||
//analysis options
|
||||
//maximum length that the CharTokenizer uses. Required.
|
||||
//By adjusting this value, you can greatly improve the performance of searching
|
||||
//and especially indexing. Default is 255, but smaller numbers will decrease
|
||||
//the amount of memory used as well as increasing the speed.
|
||||
#define LUCENE_MAX_WORD_LEN 255
|
||||
//Maximum length of a token word.
|
||||
//Should be the same or more than LUCENE_MAX_WORD_LEN
|
||||
//if not defined, then no token limit, but may be slower
|
||||
//if defined will be faster (up to 15% in some cases), but will use more memory
|
||||
#ifndef LUCENE_OPTIMIZE_FOR_MEMORY
|
||||
#define LUCENE_TOKEN_WORD_LENGTH LUCENE_MAX_WORD_LEN
|
||||
#endif
|
||||
//
|
||||
//maximum field length. some optimisation can be done if a maximum field
|
||||
//length is given... The smaller the better
|
||||
#define LUCENE_MAX_FIELD_LEN 100
|
||||
//
|
||||
//Determines the minimal number of documents required before the buffered
|
||||
//in-memory documents are merging and a new Segment is created.
|
||||
//See IndexWriter.h for more info. Required. Default=10
|
||||
#define LUCENE_INDEXWRITER_DEFAULT_MIN_MERGE_DOCS 10
|
||||
//
|
||||
//The initial value set to BooleanQuery::maxClauseCount. Default is 1024
|
||||
#define LUCENE_BOOLEANQUERY_MAXCLAUSECOUNT 1024
|
||||
//
|
||||
//bvk: 12.3.2005
|
||||
//==============================================================================
|
||||
//Previously the way the tokenizer has worked has been changed to optionally
|
||||
//use a a fixed word length. I have implemented this in the Term class as well.
|
||||
//It seems that by predefining the text length instead of using new TCHAR[x]
|
||||
//in the constructor greatly improves the performance by 20-30% for certain
|
||||
//operations.
|
||||
//Maximum length of a term text.
|
||||
//Should be the same or more than LUCENE_MAX_WORD_LEN
|
||||
//if not defined, then no term text limit, but may be slower
|
||||
//if defined will be faster (up to 30% in some cases), but will use more memory
|
||||
#ifndef LUCENE_OPTIMIZE_FOR_MEMORY
|
||||
#define LUCENE_TERM_TEXT_LENGTH LUCENE_MAX_WORD_LEN
|
||||
#endif
|
||||
//
|
||||
//Size of the CharTokenizer buffersize. Required.
|
||||
#define LUCENE_IO_BUFFER_SIZE 1024
|
||||
//
|
||||
//the minimum amount the segment term enum should grow by. Must be at least 1
|
||||
#define LUCENE_SEGMENTTERMENUM_GROWSIZE 8
|
||||
//
|
||||
//thread locking. Both are Required.
|
||||
//todo: some of these are runtime options, they should be moved
|
||||
//into some sort of options file
|
||||
#define LUCENE_COMMIT_LOCK_TIMEOUT 10000
|
||||
#define LUCENE_WRITE_LOCK_TIMEOUT 1000
|
||||
#define LUCENE_DISABLE_LOCKS false
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* this is a monolithic file that can be used to compile clucene using one source file.
|
||||
* it simplifies some build processes by avoiding static & dynamic compalation pitfalls.
|
||||
*
|
||||
* note: when creating a project add either this file, or all the other .cpp files, not both!
|
||||
*/
|
||||
#include "CLucene/StdHeader.cpp"
|
||||
#include "CLucene/analysis/Analyzers.cpp"
|
||||
#include "CLucene/analysis/AnalysisHeader.cpp"
|
||||
#include "CLucene/analysis/standard/StandardAnalyzer.cpp"
|
||||
#include "CLucene/analysis/standard/StandardFilter.cpp"
|
||||
#include "CLucene/analysis/standard/StandardTokenizer.cpp"
|
||||
#include "CLucene/config/gunichartables.cpp"
|
||||
#include "CLucene/config/repl_tcscasecmp.cpp"
|
||||
#include "CLucene/config/repl_tcslwr.cpp"
|
||||
#include "CLucene/config/repl_tcstod.cpp"
|
||||
#include "CLucene/config/repl_lltot.cpp"
|
||||
#include "CLucene/config/repl_tcstoll.cpp"
|
||||
#include "CLucene/config/repl_tprintf.cpp"
|
||||
#include "CLucene/config/threads.cpp"
|
||||
#include "CLucene/config/utf8.cpp"
|
||||
#include "CLucene/debug/condition.cpp"
|
||||
#include "CLucene/debug/error.cpp"
|
||||
#include "CLucene/debug/mempool.cpp"
|
||||
#include "CLucene/debug/memtracking.cpp"
|
||||
#include "CLucene/document/DateField.cpp"
|
||||
#include "CLucene/document/Document.cpp"
|
||||
#include "CLucene/document/Field.cpp"
|
||||
#include "CLucene/index/CompoundFile.cpp"
|
||||
#include "CLucene/index/DocumentWriter.cpp"
|
||||
#include "CLucene/index/FieldInfos.cpp"
|
||||
#include "CLucene/index/FieldsReader.cpp"
|
||||
#include "CLucene/index/FieldsWriter.cpp"
|
||||
#include "CLucene/index/IndexWriter.cpp"
|
||||
#include "CLucene/index/IndexReader.cpp"
|
||||
#include "CLucene/index/MultiReader.cpp"
|
||||
#include "CLucene/index/SegmentInfos.cpp"
|
||||
#include "CLucene/index/SegmentMergeInfo.cpp"
|
||||
#include "CLucene/index/SegmentMergeQueue.cpp"
|
||||
#include "CLucene/index/SegmentMerger.cpp"
|
||||
#include "CLucene/index/SegmentReader.cpp"
|
||||
#include "CLucene/index/SegmentTermDocs.cpp"
|
||||
#include "CLucene/index/SegmentTermEnum.cpp"
|
||||
#include "CLucene/index/SegmentTermPositions.cpp"
|
||||
#include "CLucene/index/SegmentTermVector.cpp"
|
||||
#include "CLucene/index/Term.cpp"
|
||||
#include "CLucene/index/TermInfo.cpp"
|
||||
#include "CLucene/index/TermInfosReader.cpp"
|
||||
#include "CLucene/index/TermInfosWriter.cpp"
|
||||
#include "CLucene/index/TermVectorReader.cpp"
|
||||
#include "CLucene/index/TermVectorWriter.cpp"
|
||||
#include "CLucene/queryParser/Lexer.cpp"
|
||||
#include "CLucene/queryParser/MultiFieldQueryParser.cpp"
|
||||
#include "CLucene/queryParser/QueryParser.cpp"
|
||||
#include "CLucene/queryParser/QueryParserBase.cpp"
|
||||
#include "CLucene/queryParser/QueryToken.cpp"
|
||||
#include "CLucene/queryParser/TokenList.cpp"
|
||||
#include "CLucene/search/BooleanQuery.cpp"
|
||||
#include "CLucene/search/BooleanScorer.cpp"
|
||||
#include "CLucene/search/CachingWrapperFilter.cpp"
|
||||
#include "CLucene/search/ChainedFilter.cpp"
|
||||
#include "CLucene/search/DateFilter.cpp"
|
||||
#include "CLucene/search/ConjunctionScorer.cpp"
|
||||
#include "CLucene/search/ExactPhraseScorer.cpp"
|
||||
#include "CLucene/search/Explanation.cpp"
|
||||
#include "CLucene/search/FieldCache.cpp"
|
||||
#include "CLucene/search/FieldCacheImpl.cpp"
|
||||
#include "CLucene/search/FieldDocSortedHitQueue.cpp"
|
||||
#include "CLucene/search/FieldSortedHitQueue.cpp"
|
||||
#include "CLucene/search/FilteredTermEnum.cpp"
|
||||
#include "CLucene/search/FuzzyQuery.cpp"
|
||||
#include "CLucene/search/Hits.cpp"
|
||||
#include "CLucene/search/HitQueue.cpp"
|
||||
#include "CLucene/search/IndexSearcher.cpp"
|
||||
#include "CLucene/search/MultiSearcher.cpp"
|
||||
#include "CLucene/search/MultiTermQuery.cpp"
|
||||
#include "CLucene/search/PhrasePositions.cpp"
|
||||
#include "CLucene/search/PhraseQuery.cpp"
|
||||
#include "CLucene/search/PhraseScorer.cpp"
|
||||
#include "CLucene/search/PrefixQuery.cpp"
|
||||
#include "CLucene/search/QueryFilter.cpp"
|
||||
#include "CLucene/search/RangeQuery.cpp"
|
||||
#include "CLucene/search/RangeFilter.cpp"
|
||||
#include "CLucene/search/SearchHeader.cpp"
|
||||
#include "CLucene/search/Similarity.cpp"
|
||||
#include "CLucene/search/SloppyPhraseScorer.cpp"
|
||||
#include "CLucene/search/Sort.cpp"
|
||||
#include "CLucene/search/TermQuery.cpp"
|
||||
#include "CLucene/search/TermScorer.cpp"
|
||||
#include "CLucene/search/WildcardQuery.cpp"
|
||||
#include "CLucene/search/WildcardTermEnum.cpp"
|
||||
#include "CLucene/store/FSDirectory.cpp"
|
||||
#include "CLucene/store/IndexInput.cpp"
|
||||
#include "CLucene/store/Lock.cpp"
|
||||
#include "CLucene/store/MMapInput.cpp"
|
||||
#include "CLucene/store/IndexOutput.cpp"
|
||||
#include "CLucene/store/RAMDirectory.cpp"
|
||||
#include "CLucene/store/TransactionalRAMDirectory.cpp"
|
||||
#include "CLucene/util/BitVector.cpp"
|
||||
#include "CLucene/util/Equators.cpp"
|
||||
#include "CLucene/util/FastCharStream.cpp"
|
||||
#include "CLucene/util/fileinputstream.cpp"
|
||||
#include "CLucene/util/MD5Digester.cpp"
|
||||
#include "CLucene/util/Misc.cpp"
|
||||
#include "CLucene/util/Reader.cpp"
|
||||
#include "CLucene/util/StringBuffer.cpp"
|
||||
#include "CLucene/util/StringIntern.cpp"
|
||||
#include "CLucene/util/dirent.cpp"
|
||||
@@ -1,50 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _LuceneThreads_h
|
||||
#define _LuceneThreads_h
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(_CL_DISABLE_MULTITHREADING)
|
||||
#define SCOPED_LOCK_MUTEX(theMutex)
|
||||
#define SCOPED_LOCK_MUTEX_EX(theMutex,mutexname,dummy)
|
||||
#define DEFINE_MUTEX(x)
|
||||
#define STATIC_DEFINE_MUTEX(x)
|
||||
#else
|
||||
|
||||
#if defined(_LUCENE_DONTIMPLEMENT_THREADMUTEX)
|
||||
//do nothing
|
||||
#elif defined(_CL_HAVE_PTHREAD)
|
||||
#include "CLucene/config/threadPthread.h"
|
||||
#elif defined(_CLCOMPILER_MSVC) || defined(__MINGW32__) //note that mingw32 could have pthreads, so put this after.
|
||||
#include "CLucene/config/threadCSection.h"
|
||||
#else
|
||||
#error A valid thread library was not found
|
||||
#endif //mutex types
|
||||
|
||||
CL_NS_DEF(util)
|
||||
class mutexGuard
|
||||
{
|
||||
private:
|
||||
_LUCENE_THREADMUTEX* mrMutex;
|
||||
mutexGuard(const mutexGuard& clone);
|
||||
public:
|
||||
mutexGuard( _LUCENE_THREADMUTEX& rMutex );
|
||||
~mutexGuard();
|
||||
};
|
||||
CL_NS_END
|
||||
|
||||
#define SCOPED_LOCK_MUTEX(theMutex) CL_NS(util)::mutexGuard theMutexGuard(theMutex);
|
||||
#define DEFINE_MUTEX(theMutex) _LUCENE_THREADMUTEX theMutex;
|
||||
#define STATIC_DEFINE_MUTEX(theMutex) static _LUCENE_THREADMUTEX theMutex;
|
||||
|
||||
#endif //_CL_DISABLE_MULTITHREADING
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
stdhdir = $(includedir)/CLucene
|
||||
|
||||
libclucene_la_SOURCES += $(lsrcdir)/StdHeader.cpp
|
||||
stdh_HEADERS = $(lsrcdir)/CLBackwards.h
|
||||
stdh_HEADERS += $(lsrcdir)/CLConfig.h
|
||||
stdh_HEADERS += $(lsrcdir)/LuceneThreads.h
|
||||
stdh_HEADERS += $(lsrcdir)/StdHeader.h
|
||||
|
||||
clucene_configdir = $(libdir)/CLucene
|
||||
clucene_config_DATA = $(top_builddir)/src/CLucene/clucene-config.h
|
||||
@@ -1,119 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "CLucene/util/Misc.h"
|
||||
|
||||
#include "CLucene/search/Sort.h"
|
||||
#include "CLucene/search/Similarity.h"
|
||||
#include "CLucene/search/FieldCache.h"
|
||||
#include "CLucene/search/FieldSortedHitQueue.h"
|
||||
|
||||
#if defined(_CLCOMPILER_MSVC) && defined(_DEBUG)
|
||||
#define CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
CL_NS_USE(util)
|
||||
|
||||
TCHAR* _LUCENE_BLANK_STRING=_T("");
|
||||
char* _LUCENE_BLANK_ASTRING="";
|
||||
|
||||
#if defined(_LUCENE_THREADMUTEX_USINGDEFAULT)
|
||||
#if defined(_LUCENE_PRAGMA_WARNINGS)
|
||||
#pragma message ("==================Using clunky thread mutex!!!==================")
|
||||
#else
|
||||
#warning "==================Using clunky thread mutex!!!=================="
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_ASCII)
|
||||
#if defined(_LUCENE_PRAGMA_WARNINGS)
|
||||
#pragma message ("==================Using ascii mode!!!==================")
|
||||
#else
|
||||
#warning "==================Using ascii mode!!!=================="
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LUCENE_DISABLE_HASHING)
|
||||
#if defined(_LUCENE_PRAGMA_WARNINGS)
|
||||
#pragma message ("==================Hashing not available or is disabled! CLucene may run slower than optimal ==================")
|
||||
#else
|
||||
#warning "==================Hashing not available or is disabled! CLucene may run slower than optimal =================="
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//clears all static memory. do not attempt to do anything else
|
||||
//in clucene after calling this function
|
||||
void _lucene_shutdown(){
|
||||
CL_NS(search)::FieldSortedHitQueue::Comparators.clear();
|
||||
_CLDELETE(CL_NS(search)::Sort::RELEVANCE);
|
||||
_CLDELETE(CL_NS(search)::Sort::INDEXORDER);
|
||||
_CLDELETE(CL_NS(search)::ScoreDocComparator::INDEXORDER);
|
||||
_CLDELETE(CL_NS(search)::ScoreDocComparator::RELEVANCE);
|
||||
_CLDELETE(CL_NS(search)::SortField::FIELD_SCORE);
|
||||
_CLDELETE(CL_NS(search)::SortField::FIELD_DOC);
|
||||
_CLDELETE(CL_NS(search)::FieldCache::DEFAULT);
|
||||
|
||||
_CLLDELETE(CL_NS(search)::Similarity::getDefault());
|
||||
|
||||
CL_NS(util)::CLStringIntern::shutdown();
|
||||
}
|
||||
|
||||
void CLDebugBreak(){
|
||||
//can be used for debug breaking...
|
||||
#if defined(_CLCOMPILER_MSVC) && defined(_DEBUG)
|
||||
_CrtDbgBreak();
|
||||
#else
|
||||
int i=0; //a line to put breakpoint on
|
||||
#endif
|
||||
}
|
||||
|
||||
//these are functions that lucene uses which
|
||||
//are not replacement functions
|
||||
char* lucenestrdup(const char* v CL_FILELINEPARAM){
|
||||
size_t len = strlen(v);
|
||||
char* ret = new char[len+1];
|
||||
strncpy(ret,v,len+1);
|
||||
#if defined(LUCENE_ENABLE_MEMLEAKTRACKING)
|
||||
#if defined(LUCENE_ENABLE_FILELINEINFO)
|
||||
CL_NS(debug)::LuceneBase::__cl_voidpadd((void*)ret,file,line,len);
|
||||
#else
|
||||
CL_NS(debug)::LuceneBase::__cl_voidpadd((void*)ret,__FILE__,__LINE__,len);
|
||||
#endif
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef _UCS2
|
||||
wchar_t* lucenewcsdup(const wchar_t* v CL_FILELINEPARAM){
|
||||
size_t len = _tcslen(v);
|
||||
wchar_t* ret = new wchar_t[len+1];
|
||||
_tcsncpy(ret,v,len+1);
|
||||
#if defined(LUCENE_ENABLE_MEMLEAKTRACKING)
|
||||
#if defined(LUCENE_ENABLE_FILELINEINFO)
|
||||
CL_NS(debug)::LuceneBase::__cl_voidpadd((void*)ret,file,line,len);
|
||||
#else
|
||||
CL_NS(debug)::LuceneBase::__cl_voidpadd((void*)ret,__FILE__,__LINE__,len);
|
||||
#endif
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
#endif //ucs2
|
||||
|
||||
|
||||
//ok, these are the exceptions, but these never
|
||||
//exist on non-msvc platform, so lets put it here
|
||||
#ifndef _CL_HAVE_FILELENGTH
|
||||
int64_t lucene_filelength(int filehandle)
|
||||
{
|
||||
struct fileStat info;
|
||||
if (fileHandleStat(filehandle, &info) == -1)
|
||||
_CLTHROWA( CL_ERR_IO,"fileStat error" );
|
||||
return info.st_size;
|
||||
}
|
||||
#endif
|
||||
@@ -1,459 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef lucene_stdheader_h
|
||||
#define lucene_stdheader_h
|
||||
|
||||
#if defined(OVERRIDE_DEFAULT_CLCONFIG)
|
||||
#include "AltCLConfig.h"
|
||||
#else
|
||||
#include "CLucene/CLConfig.h"
|
||||
#endif
|
||||
|
||||
//first inclusion of compiler.h (it will be called again later)
|
||||
#include "CLucene/config/compiler.h"
|
||||
|
||||
extern void _lucene_shutdown();
|
||||
extern int _lucene_counter_break; //can set a watch on this
|
||||
#if defined(LUCENE_ENABLE_MEMLEAKTRACKING)
|
||||
extern bool _lucene_disable_debuglogging; //if LUCENE_ENABLE_CONSTRUCTOR_LOG is on, dont do log if this is true
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// default includes
|
||||
////////////////////////////////////////////////////////
|
||||
#ifndef LUCENE_DISABLE_INCLUDES
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(_CL_STDC_HEADERS)
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#else
|
||||
#if defined(_CL_HAVE_STDLIB_H)
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_STRING_H)
|
||||
#if !defined(_CL_STDC_HEADERS) && defined(_CL_HAVE_MEMORY_H)
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#elif defined(_CL_HAVE_STRINGS_H)
|
||||
//note: as a side note, strtok is not thread-safe.. so be careful where you use it!
|
||||
#error "strtok replacement for BSD has not been implemented"
|
||||
#include <strings.h>
|
||||
#if !defined(_CL_HAVE_STRCHR)
|
||||
#define strchr index
|
||||
#define strrchr rindex
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#elif defined(_CL_HAVE_IO_H) && defined(_CL_HAVE_DIRECT_H)
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#else
|
||||
#error "Neither unistd.h or (io.h & direct.h) were available"
|
||||
#endif
|
||||
|
||||
#ifndef _CL_DISABLE_NATIVE_EXCEPTIONS
|
||||
#ifdef _CL_HAVE_STDEXCEPT
|
||||
#include <stdexcept>
|
||||
#else
|
||||
#error "CLucene can't compile with exception handling on because <stdexcept> header is not available"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_CL_STAT_MACROS_BROKEN)
|
||||
#error "Haven't implemented STAT_MACROS_BROKEN fix yet"
|
||||
#elif defined(_CL_HAVE_SYS_STAT_H)
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#error "Haven't implemented platforms with no sys/stat.h"
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_STDARG_H)
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#error "CLucene can compile, but some extras may not work"
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_MATH_H)
|
||||
#include <math.h>
|
||||
#else
|
||||
#error "CLucene can't compile without <math.h>"
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_MAP)
|
||||
#include <map>
|
||||
#else
|
||||
#error "CLucene can't compile without the map header"
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_LIST)
|
||||
#include <list>
|
||||
#else
|
||||
#error "CLucene can't compile without the list header"
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_SET)
|
||||
#include <set>
|
||||
#else
|
||||
#error "CLucene can't compile without the set header"
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_VECTOR)
|
||||
#include <vector>
|
||||
#else
|
||||
#error "CLucene can't compile without the vector header"
|
||||
#endif
|
||||
|
||||
#if !defined(LUCENE_DISABLE_HASHING) && defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET)
|
||||
//hashing is all or nothing!
|
||||
#include <hash_map>
|
||||
#include <hash_set>
|
||||
#elif !defined(LUCENE_DISABLE_HASHING) && defined(_CL_HAVE_EXT_HASH_MAP) && defined(_CL_HAVE_EXT_HASH_SET)
|
||||
#include <ext/hash_map>
|
||||
#include <ext/hash_set>
|
||||
#elif !defined(LUCENE_DISABLE_HASHING)
|
||||
#define LUCENE_DISABLE_HASHING
|
||||
#endif
|
||||
#if !defined(LUCENE_DISABLE_HASHING) && !defined(CL_NS_HASHING)
|
||||
#define CL_NS_HASHING(func) std::func
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_ALGORITHM)
|
||||
# include <algorithm>
|
||||
#else
|
||||
# error "Can't compile clucene without <algorithm>"
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_FUNCTIONAL)
|
||||
# include <functional>
|
||||
#else
|
||||
# error "Can't compile clucene without <functional>"
|
||||
#endif
|
||||
|
||||
#if !defined(_CL_HAVE_PRINTF) || !defined(_CL_HAVE_SNPRINTF)
|
||||
#error "CLucene can't compile without printf or snprintf, replacements have not been implemented"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_UCS2)
|
||||
#if defined(_CL_HAVE_WCHAR_H)
|
||||
#include <wchar.h>
|
||||
#else
|
||||
//actually the repl_wchar.h replacements header will
|
||||
//always be included. It replaces some functions
|
||||
//that are missing in some wchar.h headers.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_UCS2) && defined(_CL_HAVE_WCTYPE_H)
|
||||
#include <wctype.h>
|
||||
#elif defined(_ASCII) && defined(_CL_HAVE_CTYPE_H)
|
||||
#include <ctype.h>
|
||||
#undef LUCENE_USE_INTERNAL_CHAR_FUNCTIONS
|
||||
#elif defined(_UCS2)
|
||||
//must be in _UCS2 to use internal char functions
|
||||
#undef LUCENE_USE_INTERNAL_CHAR_FUNCTIONS
|
||||
#define LUCENE_USE_INTERNAL_CHAR_FUNCTIONS
|
||||
#else
|
||||
#error "Cannot compile in _ASCII without ctype.h"
|
||||
#endif
|
||||
|
||||
//always include replacement, some missing tchar defines
|
||||
#include "CLucene/config/repl_tchar.h"
|
||||
|
||||
#if defined(_CL_HAVE_ERRNO_H)
|
||||
#include <errno.h>
|
||||
#else
|
||||
#error "Haven't implemented platforms with no errno.h"
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_FCNTL_H)
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#error "Haven't implemented platforms with no fcntl.h"
|
||||
#endif
|
||||
|
||||
#if defined(_CL_HAVE_WINDOWS_H)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#endif //LUCENE_DISABLE_INCLUDES
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
//second inclusion of compiler.h
|
||||
//this gives CompilerXXX.h a chance to include other headers
|
||||
#include "CLucene/config/compiler.h"
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// Character functions.
|
||||
// Here we decide whose character functions to use
|
||||
////////////////////////////////////////////////////////
|
||||
#if defined(LUCENE_USE_INTERNAL_CHAR_FUNCTIONS)
|
||||
#define stringCaseFold cl_tcscasefold
|
||||
|
||||
#undef _istspace
|
||||
#undef _istdigit
|
||||
#undef _istalnum
|
||||
#undef _istalpha
|
||||
#undef _totlower
|
||||
#undef _totupper
|
||||
#define _istalnum cl_isalnum
|
||||
#define _istalpha cl_isletter
|
||||
#define _istspace cl_isspace
|
||||
#define _istdigit cl_isdigit
|
||||
#define _totlower cl_tolower
|
||||
#define _totupper cl_toupper
|
||||
|
||||
//the methods contained in rep_wctype.h
|
||||
bool cl_isletter(TCHAR c);
|
||||
bool cl_isalnum(TCHAR c);
|
||||
bool cl_isdigit(TCHAR c);
|
||||
bool cl_isspace (TCHAR c);
|
||||
TCHAR cl_tolower (TCHAR c);
|
||||
TCHAR cl_toupper (TCHAR c);
|
||||
|
||||
#define stringCaseFold cl_tcscasefold
|
||||
#define stringCaseFoldCmp cl_tcscasefoldcmp
|
||||
int cl_tcscasefoldcmp(const TCHAR * dst, const TCHAR * src);
|
||||
TCHAR* cl_tcscasefold( TCHAR * str, int len=-1 );
|
||||
|
||||
//here are some functions to help deal with utf8/ucs2 conversions
|
||||
//lets let the user decide what mb functions to use... we provide pure utf8 ones no matter what.
|
||||
/*#undef _mbtowc
|
||||
#undef _mbstowcs
|
||||
#undef _wctomb
|
||||
#undef _wcstombs
|
||||
#define _mbtowc lucene_mbstowc
|
||||
#define _mbsstowcs lucene_mbstowcs
|
||||
#define _wctomb lucene_wcto_mb
|
||||
#define _wcstombs lucene_wcstombs*/
|
||||
#else
|
||||
//we are using native functions
|
||||
//here are some functions to help deal with utf8/ucs2 conversions
|
||||
/*#define _mbtowc mbtowc
|
||||
#define _wctomb wctomb
|
||||
#define _mbstowcs mbstowcs
|
||||
#define _wcstombs wcstombs*/
|
||||
|
||||
//we are using native character functions
|
||||
#if defined(_ASCII)
|
||||
#undef _istspace
|
||||
#undef _istdigit
|
||||
#undef _istalnum
|
||||
#undef _istalpha
|
||||
#undef _totlower
|
||||
#undef _totupper
|
||||
#define _istspace(x) isspace((unsigned char)x)
|
||||
#define _istdigit(x) isdigit((unsigned char)x)
|
||||
#define _istalnum(x) isalnum((unsigned char)x)
|
||||
#define _istalpha(x) isalpha((unsigned char)x)
|
||||
#define _totlower(x) tolower((unsigned char)x)
|
||||
#define _totupper(x) toupper((unsigned char)x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//we provide utf8 conversion functions
|
||||
size_t lucene_utf8towc (wchar_t *ret, const char *s, size_t n);
|
||||
size_t lucene_utf8towcs(wchar_t *, const char *, size_t maxslen);
|
||||
size_t lucene_wctoutf8 (char * ret, const wchar_t str);
|
||||
size_t lucene_wcstoutf8 (char *, const wchar_t *, size_t maxslen);
|
||||
size_t lucene_utf8charlen(const char *p);
|
||||
|
||||
///a blank string...
|
||||
extern TCHAR* _LUCENE_BLANK_STRING;
|
||||
#define LUCENE_BLANK_STRING _LUCENE_BLANK_STRING
|
||||
extern char* _LUCENE_BLANK_ASTRING;
|
||||
#define LUCENE_BLANK_ASTRING _LUCENE_BLANK_ASTRING
|
||||
|
||||
/* Converts a string into a form that is independent of case. The
|
||||
* result will not correspond to any particular case, but can be
|
||||
* compared for equality or ordered with the results of calling
|
||||
* stringCaseFold() on other strings.
|
||||
*
|
||||
* If we did not define this elsewhere, then just convert to lower case
|
||||
*/
|
||||
#ifndef stringCaseFold
|
||||
#define stringCaseFold _tcslwr
|
||||
#endif
|
||||
/* Compares 2 strings using case folding (if available)
|
||||
* If we did not define this elsewhere, then just compare
|
||||
* using normal method
|
||||
*/
|
||||
#ifndef stringCaseFoldCmp
|
||||
#define stringCaseFoldCmp _tcsicmp
|
||||
#endif
|
||||
|
||||
//now that all the character routines are completed, include the
|
||||
//wchar.h replacements.
|
||||
#include "CLucene/config/repl_wchar.h" //always include replacements
|
||||
|
||||
//a replacement for _tcsdup. This uses new TCHAR[] instead of malloc, so that we can use delete[] to free
|
||||
#if defined(LUCENE_ENABLE_FILELINEINFO)
|
||||
#define CL_FILELINE ,__FILE__,__LINE__
|
||||
#define CL_FILELINEREF ,file,line ///<for passing the reference along to another function
|
||||
#define CL_FILELINEREF2 ,file,line ///<for passing the reference along to another function
|
||||
#define CL_FILELINEPARAM ,char* file,int line
|
||||
#else
|
||||
#define CL_FILELINE
|
||||
#define CL_FILELINEREF
|
||||
#define CL_FILELINEREF2 ,NULL,-1
|
||||
#define CL_FILELINEPARAM
|
||||
#endif
|
||||
|
||||
char* lucenestrdup(const char* v CL_FILELINEPARAM);
|
||||
#if defined(_UCS2)
|
||||
wchar_t* lucenewcsdup(const wchar_t* v CL_FILELINEPARAM);
|
||||
#define stringDuplicate(x) lucenewcsdup(x CL_FILELINE) //don't change this... uses [] instead of malloc
|
||||
#else
|
||||
#define stringDuplicate(x) lucenestrdup(x CL_FILELINE) //don't change this... uses [] instead of malloc
|
||||
#endif
|
||||
|
||||
#define STRCPY_AtoA(target,src,len) strncpy(target,src,len)
|
||||
#define STRDUP_AtoA(x) lucenestrdup(x CL_FILELINE)
|
||||
|
||||
#if defined(_UCS2)
|
||||
#define STRDUP_WtoW(x) lucenewcsdup(x CL_FILELINE)
|
||||
#define STRDUP_TtoT STRDUP_WtoW
|
||||
#define STRDUP_WtoT STRDUP_WtoW
|
||||
#define STRDUP_TtoW STRDUP_WtoW
|
||||
|
||||
#define STRDUP_AtoW(x) CL_NS(util)::Misc::_charToWide(x CL_FILELINE)
|
||||
#define STRDUP_AtoT STRDUP_AtoW
|
||||
|
||||
#define STRDUP_WtoA(x) CL_NS(util)::Misc::_wideToChar(x CL_FILELINE)
|
||||
#define STRDUP_TtoA STRDUP_WtoA
|
||||
|
||||
#define STRCPY_WtoW(target,src,len) _tcsncpy(target,src,len)
|
||||
#define STRCPY_TtoW STRCPY_WtoW
|
||||
#define STRCPY_WtoT STRCPY_WtoW
|
||||
#define STRCPY_TtoT STRCPY_WtoW
|
||||
|
||||
#define STRCPY_AtoW(target,src,len) CL_NS(util)::Misc::_cpycharToWide(src,target,len)
|
||||
#define STRCPY_AtoT STRCPY_AtoW
|
||||
|
||||
#define STRCPY_WtoA(target,src,len) CL_NS(util)::Misc::_cpywideToChar(src,target,len)
|
||||
#define STRCPY_TtoA STRCPY_WtoA
|
||||
#else
|
||||
#define STRDUP_AtoT STRDUP_AtoA
|
||||
#define STRDUP_TtoA STRDUP_AtoA
|
||||
#define STRDUP_TtoT STRDUP_AtoA
|
||||
|
||||
#define STRDUP_WtoT(x) xxxxxxxxxxxxxxx //not possible
|
||||
#define STRCPY_WtoT(target,src,len) xxxxxxxxxxxxxxx //not possible
|
||||
|
||||
#define STRCPY_AtoT STRCPY_AtoA
|
||||
#define STRCPY_TtoA STRCPY_AtoA
|
||||
#define STRCPY_TtoT STRCPY_AtoA
|
||||
#endif
|
||||
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//namespace helper
|
||||
////////////////////////////////////////////////////////
|
||||
#if defined(_LUCENE_DONTIMPLEMENT_NS_MACROS)
|
||||
|
||||
#elif !defined(DISABLE_NAMESPACE)
|
||||
#define CL_NS_DEF(sub) namespace lucene{ namespace sub{
|
||||
#define CL_NS_DEF2(sub,sub2) namespace lucene{ namespace sub{ namespace sub2 {
|
||||
|
||||
#define CL_NS_END }}
|
||||
#define CL_NS_END2 }}}
|
||||
|
||||
#define CL_NS_USE(sub) using namespace lucene::sub;
|
||||
#define CL_NS_USE2(sub,sub2) using namespace lucene::sub::sub2;
|
||||
|
||||
#define CL_NS(sub) lucene::sub
|
||||
#define CL_NS2(sub,sub2) lucene::sub::sub2
|
||||
#else
|
||||
#define CL_NS_DEF(sub)
|
||||
#define CL_NS_DEF2(sub, sub2)
|
||||
#define CL_NS_END
|
||||
#define CL_NS_END2
|
||||
#define CL_NS_USE(sub)
|
||||
#define CL_NS_USE2(sub,sub2)
|
||||
#define CL_NS(sub)
|
||||
#define CL_NS2(sub,sub2)
|
||||
#endif
|
||||
|
||||
#if defined(LUCENE_NO_STDC_NAMESPACE)
|
||||
//todo: haven't actually tested this on a non-stdc compliant compiler
|
||||
#define CL_NS_STD(func) ::func
|
||||
#else
|
||||
#define CL_NS_STD(func) std::func
|
||||
#endif
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
void CLDebugBreak(); //define a debugbreak function
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// These are defines and functions used throughout clucene
|
||||
////////////////////////////////////////////////////////////////
|
||||
#undef _T //remove any previously defined _T - required for ppc os
|
||||
#if defined(_UCS2)
|
||||
#define _T(x) L ## x
|
||||
#else
|
||||
#define _T(x) x
|
||||
#endif
|
||||
|
||||
//third inclusion of compiler.h
|
||||
//this gives CompilerXXX.h a chance to fix any of the
|
||||
//default settings
|
||||
#include "CLucene/config/compiler.h"
|
||||
|
||||
//use std namespace
|
||||
#ifndef LUCENE_NO_STDC_NAMESPACE
|
||||
using namespace std;
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//misc shortcut defines
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
//include the headers that we need practically everywhere
|
||||
#include "CLucene/debug/error.h" //all delete/creation/mem debugging code
|
||||
#include "CLucene/debug/mem.h" //all delete/creation/mem debugging code
|
||||
#include "CLucene/debug/condition.h" //conditional debugging (like assert)
|
||||
#include "LuceneThreads.h" //lucene threading support
|
||||
|
||||
#include "CLucene/util/Misc.h"
|
||||
#include "CLucene/util/Equators.h"
|
||||
#include "CLucene/util/VoidList.h"
|
||||
#include "CLucene/util/VoidMap.h"
|
||||
|
||||
|
||||
CL_NS_DEF(util)
|
||||
typedef CL_NS(util)::CLVector<TCHAR*> StringArray;
|
||||
typedef CL_NS(util)::CLVector<TCHAR*, CL_NS(util)::Deletor::tcArray > StringArrayWithDeletor;
|
||||
typedef CL_NS(util)::CLVector<const TCHAR*> StringArrayConst;
|
||||
typedef CL_NS(util)::CLVector<const TCHAR*, CL_NS(util)::Deletor::tcArray > StringArrayConstWithDeletor;
|
||||
|
||||
typedef CL_NS(util)::CLVector<char*> AStringArray;
|
||||
typedef CL_NS(util)::CLVector<char*, CL_NS(util)::Deletor::acArray > AStringArrayWithDeletor;
|
||||
typedef CL_NS(util)::CLVector<const char*> AStringArrayConst;
|
||||
typedef CL_NS(util)::CLVector<const char*, CL_NS(util)::Deletor::acArray > AStringArrayConstWithDeletor;
|
||||
CL_NS_END
|
||||
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
#endif // STDHEADER_H
|
||||
@@ -1,176 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "AnalysisHeader.h"
|
||||
|
||||
CL_NS_USE(util)
|
||||
CL_NS_DEF(analysis)
|
||||
|
||||
const TCHAR* Token::defaultType=_T("word");
|
||||
|
||||
Token::Token():
|
||||
_startOffset (0),
|
||||
_endOffset (0),
|
||||
_type ( defaultType ),
|
||||
positionIncrement (1)
|
||||
{
|
||||
termTextLen = 0;
|
||||
#ifndef LUCENE_TOKEN_WORD_LENGTH
|
||||
_termText = NULL;
|
||||
bufferTextLen = 0;
|
||||
#else
|
||||
_termText[0] = 0; //make sure null terminated
|
||||
bufferTextLen = LUCENE_TOKEN_WORD_LENGTH+1;
|
||||
#endif
|
||||
}
|
||||
|
||||
Token::~Token(){
|
||||
#ifndef LUCENE_TOKEN_WORD_LENGTH
|
||||
_CLDELETE_CARRAY(_termText);
|
||||
#endif
|
||||
}
|
||||
|
||||
Token::Token(const TCHAR* text, const int32_t start, const int32_t end, const TCHAR* typ):
|
||||
_startOffset (start),
|
||||
_endOffset (end),
|
||||
_type ( typ ),
|
||||
positionIncrement (1)
|
||||
{
|
||||
termTextLen = 0;
|
||||
#ifndef LUCENE_TOKEN_WORD_LENGTH
|
||||
_termText = NULL;
|
||||
bufferTextLen = 0;
|
||||
#else
|
||||
_termText[0] = 0; //make sure null terminated
|
||||
bufferTextLen = LUCENE_TOKEN_WORD_LENGTH+1;
|
||||
#endif
|
||||
setText(text);
|
||||
}
|
||||
|
||||
void Token::set(const TCHAR* text, const int32_t start, const int32_t end, const TCHAR* typ){
|
||||
_startOffset = start;
|
||||
_endOffset = end;
|
||||
_type = typ;
|
||||
positionIncrement = 1;
|
||||
setText(text);
|
||||
|
||||
}
|
||||
|
||||
void Token::setText(const TCHAR* text){
|
||||
int32_t oldlen = termTextLen;
|
||||
termTextLen = _tcslen(text);
|
||||
|
||||
#ifndef LUCENE_TOKEN_WORD_LENGTH
|
||||
if ( termTextLen > oldlen || _termText == NULL ){
|
||||
_CLDELETE_CARRAY(_termText);
|
||||
_termText = _CL_NEWARRAY(TCHAR,termTextLen+1);
|
||||
bufferTextLen = termTextLen+1;
|
||||
}
|
||||
_tcsncpy(_termText,text,termTextLen+1);
|
||||
#else
|
||||
if ( termTextLen > LUCENE_TOKEN_WORD_LENGTH ){
|
||||
//in the case where this occurs, we will leave the endOffset as it is
|
||||
//since the actual word still occupies that space.
|
||||
termTextLen=LUCENE_TOKEN_WORD_LENGTH;
|
||||
}
|
||||
_tcsncpy(_termText,text,termTextLen+1);
|
||||
#endif
|
||||
_termText[termTextLen] = 0; //make sure null terminated
|
||||
}
|
||||
|
||||
void Token::growBuffer(size_t size){
|
||||
if(bufferTextLen>size)
|
||||
return;
|
||||
#ifndef LUCENE_TOKEN_WORD_LENGTH
|
||||
_CLDELETE_CARRAY(_termText);
|
||||
termTextLen=-1;
|
||||
bufferTextLen = size+1;
|
||||
_termText = _CL_NEWARRAY(TCHAR,bufferTextLen);
|
||||
#else
|
||||
_CLTHROWA(CL_ERR_TokenMgr,"Couldn't grow Token buffer");
|
||||
#endif
|
||||
}
|
||||
|
||||
void Token::setPositionIncrement(int32_t posIncr) {
|
||||
if (posIncr < 0) {
|
||||
_CLTHROWA(CL_ERR_IllegalArgument,"positionIncrement must be >= 0");
|
||||
}
|
||||
positionIncrement = posIncr;
|
||||
}
|
||||
|
||||
int32_t Token::getPositionIncrement() { return positionIncrement; }
|
||||
|
||||
// Returns the Token's term text.
|
||||
const TCHAR* Token::termText() {
|
||||
return (const TCHAR*) _termText;
|
||||
}
|
||||
size_t Token::termTextLength() {
|
||||
if ( termTextLen == -1 ) //it was invalidated by growBuffer
|
||||
termTextLen = _tcslen(_termText);
|
||||
return termTextLen;
|
||||
}
|
||||
void Token::resetTermTextLen(){
|
||||
termTextLen=-1;
|
||||
}
|
||||
bool Token::OrderCompare::operator()( Token* t1, Token* t2 ) const{
|
||||
if(t1->startOffset()>t2->startOffset())
|
||||
return false;
|
||||
if(t1->startOffset()<t2->startOffset())
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Token* TokenStream::next(){
|
||||
Token* t = _CLNEW Token;
|
||||
if ( !next(t) )
|
||||
_CLDELETE(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
TokenFilter::TokenFilter(TokenStream* in, bool deleteTS):
|
||||
input(in),
|
||||
deleteTokenStream(deleteTS)
|
||||
{
|
||||
}
|
||||
TokenFilter::~TokenFilter(){
|
||||
close();
|
||||
}
|
||||
|
||||
// Close the input TokenStream.
|
||||
void TokenFilter::close() {
|
||||
if ( input != NULL ){
|
||||
input->close();
|
||||
if ( deleteTokenStream )
|
||||
_CLDELETE( input );
|
||||
}
|
||||
input = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Tokenizer::Tokenizer() {
|
||||
input = NULL;
|
||||
}
|
||||
|
||||
Tokenizer::Tokenizer(CL_NS(util)::Reader* _input):
|
||||
input(_input)
|
||||
{
|
||||
}
|
||||
|
||||
void Tokenizer::close(){
|
||||
if (input != NULL) {
|
||||
// ? delete input;
|
||||
input = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Tokenizer::~Tokenizer(){
|
||||
close();
|
||||
}
|
||||
CL_NS_END
|
||||
@@ -1,181 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_analysis_AnalysisHeader_
|
||||
#define _lucene_analysis_AnalysisHeader_
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "CLucene/util/Reader.h"
|
||||
#include "CLucene/debug/pool.h"
|
||||
|
||||
CL_NS_DEF(analysis)
|
||||
|
||||
|
||||
LUCENE_MP_DEFINE(Token)
|
||||
/** A Token is an occurence of a term from the text of a field. It consists of
|
||||
a term's text, the start and end offset of the term in the text of the field,
|
||||
and a type string.
|
||||
|
||||
The start and end offsets permit applications to re-associate a token with
|
||||
its source text, e.g., to display highlighted query terms in a document
|
||||
browser, or to show matching text fragments in a KWIC (KeyWord In Context)
|
||||
display, etc.
|
||||
|
||||
The type is an interned string, assigned by a lexical analyzer
|
||||
(a.k.a. tokenizer), naming the lexical or syntactic class that the token
|
||||
belongs to. For example an end of sentence marker token might be implemented
|
||||
with type "eos". The default token type is "word". */
|
||||
class Token:LUCENE_POOLEDBASE(Token){
|
||||
private:
|
||||
int32_t _startOffset; // start in source text
|
||||
int32_t _endOffset; // end in source text
|
||||
const TCHAR* _type; // lexical type
|
||||
int32_t positionIncrement;
|
||||
int32_t termTextLen;
|
||||
size_t bufferTextLen;
|
||||
|
||||
static const TCHAR* defaultType;
|
||||
public:
|
||||
#ifndef LUCENE_HIDE_INTERNAL
|
||||
#ifndef LUCENE_TOKEN_WORD_LENGTH
|
||||
TCHAR* _termText; // the text of the term
|
||||
#else
|
||||
TCHAR _termText[LUCENE_TOKEN_WORD_LENGTH+1]; // the text of the term
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Token();
|
||||
~Token();
|
||||
// Constructs a Token with the given text, start and end offsets, & type.
|
||||
Token(const TCHAR* text, const int32_t start, const int32_t end, const TCHAR* typ=defaultType);
|
||||
void set(const TCHAR* text, const int32_t start, const int32_t end, const TCHAR* typ=defaultType);
|
||||
|
||||
size_t bufferLength(){ return bufferTextLen; }
|
||||
void growBuffer(size_t size);
|
||||
|
||||
/* Set the position increment. This determines the position of this
|
||||
* token relative to the previous Token in a TokenStream, used in
|
||||
* phrase searching.
|
||||
*
|
||||
* The default value is 1.
|
||||
*
|
||||
* Some common uses for this are:
|
||||
*
|
||||
* - Set it to zero to put multiple terms in the same position. This is
|
||||
* useful if, e.g., a word has multiple stems. Searches for phrases
|
||||
* including either stem will match. In this case, all but the first stem's
|
||||
* increment should be set to zero: the increment of the first instance
|
||||
* should be one. Repeating a token with an increment of zero can also be
|
||||
* used to boost the scores of matches on that token.
|
||||
*
|
||||
* - Set it to values greater than one to inhibit exact phrase matches.
|
||||
* If, for example, one does not want phrases to match across removed stop
|
||||
* words, then one could build a stop word filter that removes stop words and
|
||||
* also sets the increment to the number of stop words removed before each
|
||||
* non-stop word. Then exact phrase queries will only match when the terms
|
||||
* occur with no intervening stop words.
|
||||
*/
|
||||
void setPositionIncrement(int32_t posIncr);
|
||||
int32_t getPositionIncrement();
|
||||
const TCHAR* termText();
|
||||
size_t termTextLength();
|
||||
void resetTermTextLen();
|
||||
void setText(const TCHAR* txt);
|
||||
|
||||
// Returns this Token's starting offset, the position of the first character
|
||||
// corresponding to this token in the source text.
|
||||
//
|
||||
// Note that the difference between endOffset() and startOffset() may not be
|
||||
// equal to termText.length(), as the term text may have been altered by a
|
||||
// stemmer or some other filter.
|
||||
int32_t startOffset() const { return _startOffset; }
|
||||
void setStartOffset(int32_t val){ _startOffset =val; }
|
||||
|
||||
// Returns this Token's ending offset, one greater than the position of the
|
||||
// last character corresponding to this token in the source text.
|
||||
int32_t endOffset() const { return _endOffset; }
|
||||
void setEndOffset(int32_t val){ _endOffset =val; }
|
||||
|
||||
// Returns this Token's lexical type. Defaults to "word".
|
||||
const TCHAR* type() const { return _type; } ///<returns reference
|
||||
void setType(const TCHAR* val) { _type = val; } ///<returns reference
|
||||
|
||||
|
||||
///Compares the Token for their order
|
||||
class OrderCompare:LUCENE_BASE, public CL_NS(util)::Compare::_base //<Token*>
|
||||
{
|
||||
public:
|
||||
bool operator()( Token* t1, Token* t2 ) const;
|
||||
};
|
||||
};
|
||||
|
||||
class TokenStream:LUCENE_BASE {
|
||||
public:
|
||||
/**
|
||||
* Returns the next token in the stream, or null at EOS.
|
||||
*/
|
||||
virtual bool next(Token* token) = 0;
|
||||
|
||||
// Releases resources associated with this stream.
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual ~TokenStream(){
|
||||
}
|
||||
|
||||
/* This is for backwards compatibility only. You should pass the token you want to fill
|
||||
* to next(), this will save a lot of object construction and destructions.
|
||||
* @deprecated Kept only to avoid breaking existing code.
|
||||
*/
|
||||
Token* next();
|
||||
};
|
||||
|
||||
|
||||
class Analyzer:LUCENE_BASE{
|
||||
public:
|
||||
// Creates a TokenStream which tokenizes all the text in the provided
|
||||
// Reader. Default implementation forwards to tokenStream(Reader) for
|
||||
// compatibility with older version. Override to allow Analyzer to choose
|
||||
// strategy based on document and/or field. Must be able to handle null
|
||||
// field name for backward compatibility.
|
||||
virtual TokenStream* tokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader)=0;
|
||||
|
||||
virtual ~Analyzer(){
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Tokenizer:public TokenStream {
|
||||
protected:
|
||||
// The text source for this Tokenizer.
|
||||
CL_NS(util)::Reader* input;
|
||||
|
||||
public:
|
||||
Tokenizer();
|
||||
/** Construct a token stream processing the given input. */
|
||||
Tokenizer(CL_NS(util)::Reader* _input);
|
||||
|
||||
// By default, closes the input Reader.
|
||||
virtual void close();
|
||||
virtual ~Tokenizer();
|
||||
};
|
||||
|
||||
class TokenFilter:public TokenStream {
|
||||
protected:
|
||||
// The source of tokens for this filter.
|
||||
TokenStream* input;
|
||||
bool deleteTokenStream;
|
||||
|
||||
TokenFilter(TokenStream* in, bool deleteTS=false);
|
||||
virtual ~TokenFilter();
|
||||
public:
|
||||
// Close the input TokenStream.
|
||||
void close();
|
||||
};
|
||||
CL_NS_END
|
||||
#endif
|
||||
@@ -1,310 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "Analyzers.h"
|
||||
#include "CLucene/util/StringBuffer.h"
|
||||
|
||||
CL_NS_USE(util)
|
||||
CL_NS_DEF(analysis)
|
||||
|
||||
CharTokenizer::CharTokenizer(Reader* in) :
|
||||
//input(in), ; input is in tokenizer base class (bug fix thanks to Andy Osipienko)
|
||||
offset(0),
|
||||
bufferIndex(0),
|
||||
dataLen(0)
|
||||
|
||||
{
|
||||
input = in;
|
||||
}
|
||||
|
||||
TCHAR CharTokenizer::normalize(const TCHAR c) const
|
||||
{
|
||||
return c;
|
||||
}
|
||||
bool CharTokenizer::next(Token* token){
|
||||
int32_t length = 0;
|
||||
int32_t start = offset;
|
||||
while (true) {
|
||||
TCHAR c;
|
||||
offset++;
|
||||
if (bufferIndex >= dataLen) {
|
||||
dataLen = input->read(ioBuffer, LUCENE_IO_BUFFER_SIZE);
|
||||
if (dataLen == -1)
|
||||
dataLen = 0;
|
||||
bufferIndex = 0;
|
||||
}
|
||||
if (dataLen <= 0 ) {
|
||||
if (length > 0)
|
||||
break;
|
||||
else
|
||||
return false;
|
||||
}else
|
||||
c = ioBuffer[bufferIndex++];
|
||||
if (isTokenChar(c)) { // if it's a token TCHAR
|
||||
|
||||
if (length == 0) // start of token
|
||||
start = offset-1;
|
||||
|
||||
buffer[length++] = normalize(c); // buffer it, normalized
|
||||
|
||||
if (length == LUCENE_MAX_WORD_LEN) // buffer overflow!
|
||||
break;
|
||||
|
||||
} else if (length > 0) // at non-Letter w/ chars
|
||||
break; // return 'em
|
||||
|
||||
}
|
||||
buffer[length]=0;
|
||||
token->set( buffer, start, start+length);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LetterTokenizer::isTokenChar(const TCHAR c) const {
|
||||
return _istalpha(c)!=0;
|
||||
}
|
||||
|
||||
|
||||
TCHAR LowerCaseTokenizer::normalize(const TCHAR chr) const {
|
||||
return _totlower(chr);
|
||||
}
|
||||
|
||||
bool WhitespaceTokenizer::isTokenChar(const TCHAR c) const{
|
||||
return _istspace(c)==0; //(return true if NOT a space)
|
||||
}
|
||||
|
||||
TokenStream* WhitespaceAnalyzer::tokenStream(const TCHAR* fieldName, Reader* reader) {
|
||||
return _CLNEW WhitespaceTokenizer(reader);
|
||||
}
|
||||
|
||||
TokenStream* SimpleAnalyzer::tokenStream(const TCHAR* fieldName, Reader* reader) {
|
||||
return _CLNEW LowerCaseTokenizer(reader);
|
||||
}
|
||||
|
||||
bool LowerCaseFilter::next(Token* t){
|
||||
if (!input->next(t))
|
||||
return false;
|
||||
stringCaseFold( t->_termText );
|
||||
return true;
|
||||
}
|
||||
|
||||
StopFilter::StopFilter(TokenStream* in, bool deleteTokenStream, TCHAR** stopWords):
|
||||
TokenFilter(in, deleteTokenStream),
|
||||
table(_CLNEW CLSetList<TCHAR*>(false))
|
||||
{
|
||||
fillStopTable( table,stopWords );
|
||||
}
|
||||
|
||||
void StopFilter::fillStopTable(CLSetList<TCHAR*>* stopTable,
|
||||
TCHAR** stopWords) {
|
||||
for (int32_t i = 0; stopWords[i]!=NULL; i++)
|
||||
stopTable->insert(stopWords[i]);
|
||||
}
|
||||
|
||||
bool StopFilter::next(Token* token) {
|
||||
// return the first non-stop word found
|
||||
for (; input->next(token); ){
|
||||
if (table->find(token->_termText)==table->end()){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// reached EOS -- return nothing
|
||||
return false;
|
||||
}
|
||||
|
||||
StopAnalyzer::StopAnalyzer():stopTable(false)
|
||||
{
|
||||
StopFilter::fillStopTable(&stopTable,ENGLISH_STOP_WORDS);
|
||||
}
|
||||
StopAnalyzer::~StopAnalyzer()
|
||||
{
|
||||
}
|
||||
StopAnalyzer::StopAnalyzer( TCHAR** stopWords) {
|
||||
StopFilter::fillStopTable(&stopTable,stopWords);
|
||||
}
|
||||
TokenStream* StopAnalyzer::tokenStream(const TCHAR* fieldName, Reader* reader) {
|
||||
return _CLNEW StopFilter(_CLNEW LowerCaseTokenizer(reader),true, &stopTable);
|
||||
}
|
||||
|
||||
TCHAR* StopAnalyzer::ENGLISH_STOP_WORDS[] =
|
||||
{
|
||||
_T("a"), _T("an"), _T("and"), _T("are"), _T("as"), _T("at"), _T("be"), _T("but"), _T("by"),
|
||||
_T("for"), _T("if"), _T("in"), _T("into"), _T("is"), _T("it"),
|
||||
_T("no"), _T("not"), _T("of"), _T("on"), _T("or"), _T("s"), _T("such"),
|
||||
_T("t"), _T("that"), _T("the"), _T("their"), _T("then"), _T("there"), _T("these"),
|
||||
_T("they"), _T("this"), _T("to"), _T("was"), _T("will"), _T("with"), NULL
|
||||
};
|
||||
|
||||
PerFieldAnalyzerWrapper::PerFieldAnalyzerWrapper(Analyzer* defaultAnalyzer):
|
||||
analyzerMap(true,true)
|
||||
{
|
||||
this->defaultAnalyzer = defaultAnalyzer;
|
||||
}
|
||||
PerFieldAnalyzerWrapper::~PerFieldAnalyzerWrapper(){
|
||||
analyzerMap.clear();
|
||||
_CLDELETE(defaultAnalyzer);
|
||||
}
|
||||
|
||||
void PerFieldAnalyzerWrapper::addAnalyzer(const TCHAR* fieldName, Analyzer* analyzer) {
|
||||
analyzerMap.put(STRDUP_TtoT(fieldName), analyzer);
|
||||
}
|
||||
|
||||
TokenStream* PerFieldAnalyzerWrapper::tokenStream(const TCHAR* fieldName, Reader* reader) {
|
||||
Analyzer* analyzer = analyzerMap.get(fieldName);
|
||||
if (analyzer == NULL) {
|
||||
analyzer = defaultAnalyzer;
|
||||
}
|
||||
|
||||
return analyzer->tokenStream(fieldName, reader);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ISOLatin1AccentFilter::next(Token* token){
|
||||
if ( input->next(token) ){
|
||||
StringBuffer output;
|
||||
int32_t l = token->termTextLength();
|
||||
const TCHAR* chars = token->termText();
|
||||
for (int32_t i = 0; i < l; i++) {
|
||||
#ifdef _UCS2
|
||||
TCHAR c = chars[i];
|
||||
#else
|
||||
unsigned char c = chars[i];
|
||||
#endif
|
||||
switch (c) {
|
||||
case 0xC0 : // À
|
||||
case 0xC1 : // Á
|
||||
case 0xC2 : // Â
|
||||
case 0xC3 : // Ã
|
||||
case 0xC4 : // Ä
|
||||
case 0xC5 : // Å
|
||||
output.appendChar('A');
|
||||
break;
|
||||
case 0xC6 : // Æ
|
||||
output.append(_T("AE"));
|
||||
break;
|
||||
case 0xC7 : // Ç
|
||||
output.appendChar('C');
|
||||
break;
|
||||
case 0xC8 : // È
|
||||
case 0xC9 : // É
|
||||
case 0xCA : // Ê
|
||||
case 0xCB : // Ë
|
||||
output.appendChar('E');
|
||||
break;
|
||||
case 0xCC : // Ì
|
||||
case 0xCD : // Í
|
||||
case 0xCE : // Î
|
||||
case 0xCF : // Ï
|
||||
output.appendChar('I');
|
||||
break;
|
||||
case 0xD0 : // Ð
|
||||
output.appendChar('D');
|
||||
break;
|
||||
case 0xD1 : // Ñ
|
||||
output.appendChar('N');
|
||||
break;
|
||||
case 0xD2 : // Ò
|
||||
case 0xD3 : // Ó
|
||||
case 0xD4 : // Ô
|
||||
case 0xD5 : // Õ
|
||||
case 0xD6 : // Ö
|
||||
case 0xD8 : // Ø
|
||||
output.appendChar('O');
|
||||
break;
|
||||
case 0xDE : // Þ
|
||||
output.append(_T("TH"));
|
||||
break;
|
||||
case 0xD9 : // Ù
|
||||
case 0xDA : // Ú
|
||||
case 0xDB : // Û
|
||||
case 0xDC : // Ü
|
||||
output.appendChar('U');
|
||||
break;
|
||||
case 0xDD : // Ý
|
||||
output.appendChar('Y');
|
||||
break;
|
||||
case 0xE0 : // à
|
||||
case 0xE1 : // á
|
||||
case 0xE2 : // â
|
||||
case 0xE3 : // ã
|
||||
case 0xE4 : // ä
|
||||
case 0xE5 : // å
|
||||
output.appendChar('a');
|
||||
break;
|
||||
case 0xE6 : // æ
|
||||
output.append(_T("ae"));
|
||||
break;
|
||||
case 0xE7 : // ç
|
||||
output.appendChar('c');
|
||||
break;
|
||||
case 0xE8 : // è
|
||||
case 0xE9 : // é
|
||||
case 0xEA : // ê
|
||||
case 0xEB : // ë
|
||||
output.appendChar('e');
|
||||
break;
|
||||
case 0xEC : // ì
|
||||
case 0xED : // í
|
||||
case 0xEE : // î
|
||||
case 0xEF : // ï
|
||||
output.appendChar('i');
|
||||
break;
|
||||
case 0xF0 : // ð
|
||||
output.appendChar('d');
|
||||
break;
|
||||
case 0xF1 : // ñ
|
||||
output.appendChar('n');
|
||||
break;
|
||||
case 0xF2 : // ò
|
||||
case 0xF3 : // ó
|
||||
case 0xF4 : // ô
|
||||
case 0xF5 : // õ
|
||||
case 0xF6 : // ö
|
||||
case 0xF8 : // ø
|
||||
output.appendChar('o');
|
||||
break;
|
||||
case 0xDF : // ß
|
||||
output.append(_T("ss"));
|
||||
break;
|
||||
case 0xFE : // þ
|
||||
output.append(_T("th"));
|
||||
break;
|
||||
case 0xF9 : // ù
|
||||
case 0xFA : // ú
|
||||
case 0xFB : // û
|
||||
case 0xFC : // ü
|
||||
output.appendChar('u');
|
||||
break;
|
||||
case 0xFD : // ý
|
||||
case 0xFF : // ÿ
|
||||
output.appendChar('y');
|
||||
break;
|
||||
|
||||
#ifdef _UCS2
|
||||
case 0x152 : // Œ
|
||||
output.append(_T("OE"));
|
||||
break;
|
||||
case 0x153 : // œ
|
||||
output.append(_T("oe"));
|
||||
break;
|
||||
case 0x178 : // Ÿ
|
||||
output.appendChar('Y');
|
||||
break;
|
||||
#endif
|
||||
default :
|
||||
output.appendChar(chars[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
token->setText(output.getBuffer());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CL_NS_END
|
||||
@@ -1,261 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_analysis_Analyzers_
|
||||
#define _lucene_analysis_Analyzers_
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "CLucene/util/Reader.h"
|
||||
#include "AnalysisHeader.h"
|
||||
#include "CLucene/util/Misc.h"
|
||||
|
||||
CL_NS_DEF(analysis)
|
||||
class CharTokenizer:public Tokenizer {
|
||||
private:
|
||||
int32_t offset, bufferIndex, dataLen;
|
||||
TCHAR buffer[LUCENE_MAX_WORD_LEN+1];
|
||||
const TCHAR* ioBuffer;
|
||||
protected:
|
||||
// Returns true iff a character should be included in a token. This
|
||||
// tokenizer generates as tokens adjacent sequences of characters which
|
||||
// satisfy this predicate. Characters for which this is false are used to
|
||||
// define token boundaries and are not included in tokens.
|
||||
virtual bool isTokenChar(const TCHAR c) const = 0;
|
||||
|
||||
// Called on each token character to normalize it before it is added to the
|
||||
// token. The default implementation does nothing. Subclasses may use this
|
||||
// to, e.g., lowercase tokens.
|
||||
virtual TCHAR normalize(const TCHAR c) const;
|
||||
|
||||
public:
|
||||
CharTokenizer(CL_NS(util)::Reader* in);
|
||||
|
||||
virtual ~CharTokenizer(){
|
||||
}
|
||||
|
||||
// Returns the next token in the stream, or null at EOS.
|
||||
// *** This is not a pointer. Use of it must deleted.
|
||||
bool next(Token* token);
|
||||
};
|
||||
|
||||
class LetterTokenizer:public CharTokenizer {
|
||||
public:
|
||||
// Construct a new LetterTokenizer.
|
||||
LetterTokenizer(CL_NS(util)::Reader* in):
|
||||
CharTokenizer(in) {}
|
||||
|
||||
~LetterTokenizer(){}
|
||||
protected:
|
||||
// Collects only characters which satisfy
|
||||
// {@link Character#isLetter(TCHAR)}.
|
||||
bool isTokenChar(const TCHAR c) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// LowerCaseTokenizer performs the function of LetterTokenizer
|
||||
// and LowerCaseFilter together. It divides text at non-letters and converts
|
||||
// them to lower case. While it is functionally equivalent to the combination
|
||||
// of LetterTokenizer and LowerCaseFilter, there is a performance advantage
|
||||
// to doing the two tasks at once, hence this (redundant) implementation.
|
||||
// <P>
|
||||
// Note: this does a decent job for most European languages, but does a terrible
|
||||
// job for some Asian languages, where words are not separated by spaces.
|
||||
class LowerCaseTokenizer:public LetterTokenizer {
|
||||
public:
|
||||
// Construct a new LowerCaseTokenizer.
|
||||
LowerCaseTokenizer(CL_NS(util)::Reader* in):
|
||||
LetterTokenizer(in) {}
|
||||
|
||||
~LowerCaseTokenizer(){}
|
||||
protected:
|
||||
// Collects only characters which satisfy
|
||||
// {@link Character#isLetter(TCHAR)}.
|
||||
TCHAR normalize(const TCHAR chr) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class WhitespaceTokenizer: public CharTokenizer {
|
||||
public:
|
||||
// Construct a new WhitespaceTokenizer.
|
||||
WhitespaceTokenizer(CL_NS(util)::Reader* in):CharTokenizer(in) {}
|
||||
~WhitespaceTokenizer(){}
|
||||
protected:
|
||||
// Collects only characters which do not satisfy
|
||||
// {@link Character#isWhitespace(TCHAR)}.
|
||||
bool isTokenChar(const TCHAR c) const;
|
||||
};
|
||||
|
||||
|
||||
// An Analyzer that uses WhitespaceTokenizer.
|
||||
class WhitespaceAnalyzer: public Analyzer {
|
||||
public:
|
||||
TokenStream* tokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader);
|
||||
~WhitespaceAnalyzer(){}
|
||||
};
|
||||
|
||||
|
||||
class SimpleAnalyzer: public Analyzer {
|
||||
public:
|
||||
TokenStream* tokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader);
|
||||
~SimpleAnalyzer(){}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Normalizes token text to lower case.
|
||||
*
|
||||
* @version $Id: Analyzers.h 2187 2006-06-11 11:39:16Z ustramooner $
|
||||
*/
|
||||
class LowerCaseFilter: public TokenFilter {
|
||||
public:
|
||||
LowerCaseFilter(TokenStream* in, bool deleteTokenStream):TokenFilter(in,deleteTokenStream) {}
|
||||
~LowerCaseFilter(){}
|
||||
bool next(Token* token);
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Removes stop words from a token stream.
|
||||
class StopFilter: public TokenFilter {
|
||||
private:
|
||||
//bvk: i found this to work faster with a non-hash table. the number of items
|
||||
//in the stop table is not like to make it worth having hashing.
|
||||
CL_NS(util)::CLSetList<TCHAR*>* table;
|
||||
public:
|
||||
// Constructs a filter which removes words from the input
|
||||
// TokenStream that are named in the array of words.
|
||||
StopFilter(TokenStream* in, bool deleteTokenStream, TCHAR* stopWords[]);
|
||||
|
||||
~StopFilter(){}
|
||||
|
||||
// Constructs a filter which removes words from the input
|
||||
// TokenStream that are named in the Hashtable.
|
||||
StopFilter(TokenStream* in, bool deleteTokenStream, CL_NS(util)::CLSetList<TCHAR*>* stopTable):
|
||||
TokenFilter(in, deleteTokenStream),
|
||||
table(stopTable)
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
* Builds a Hashtable from an array of stop words, appropriate for passing
|
||||
* into the StopFilter constructor. This permits this table construction to
|
||||
* be cached once when an Analyzer is constructed.
|
||||
* Note: the stopWords list must be a static list because the strings are not copied
|
||||
*
|
||||
* @swig stopWords
|
||||
*/
|
||||
static void fillStopTable(CL_NS(util)::CLSetList<TCHAR*>* stopTable,
|
||||
TCHAR** stopWords);
|
||||
|
||||
/**
|
||||
* Returns the next input Token whose termText() is not a stop word.
|
||||
*
|
||||
* @swig token byref
|
||||
*/
|
||||
bool next(Token* token);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//An array containing some common English words that are usually not
|
||||
//useful for searching.
|
||||
|
||||
// Filters LetterTokenizer with LowerCaseFilter and StopFilter.
|
||||
class StopAnalyzer: public Analyzer {
|
||||
CL_NS(util)::CLSetList<TCHAR*> stopTable;
|
||||
|
||||
public:
|
||||
// Builds an analyzer which removes words in ENGLISH_STOP_WORDS.
|
||||
StopAnalyzer();
|
||||
~StopAnalyzer();
|
||||
|
||||
// Builds an analyzer which removes words in the provided array.
|
||||
StopAnalyzer( TCHAR** stopWords );
|
||||
// Filters LowerCaseTokenizer with StopFilter.
|
||||
TokenStream* tokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader);
|
||||
|
||||
static TCHAR* ENGLISH_STOP_WORDS[];
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This analyzer is used to facilitate scenarios where different
|
||||
* fields require different analysis techniques. Use {@link #addAnalyzer}
|
||||
* to add a non-default analyzer on a field name basis.
|
||||
*
|
||||
* <p>Example usage:
|
||||
*
|
||||
* <pre>
|
||||
* PerFieldAnalyzerWrapper aWrapper =
|
||||
* new PerFieldAnalyzerWrapper(new StandardAnalyzer());
|
||||
* aWrapper.addAnalyzer("firstname", new KeywordAnalyzer());
|
||||
* aWrapper.addAnalyzer("lastname", new KeywordAnalyzer());
|
||||
* </pre>
|
||||
*
|
||||
* <p>In this example, StandardAnalyzer will be used for all fields except "firstname"
|
||||
* and "lastname", for which KeywordAnalyzer will be used.
|
||||
*
|
||||
* <p>A PerFieldAnalyzerWrapper can be used like any other analyzer, for both indexing
|
||||
* and query parsing.
|
||||
*/
|
||||
class PerFieldAnalyzerWrapper : public Analyzer {
|
||||
private:
|
||||
Analyzer* defaultAnalyzer;
|
||||
CL_NS(util)::CLHashMap<const TCHAR*, Analyzer*, CL_NS(util)::Compare::TChar,
|
||||
CL_NS(util)::Deletor::tcArray,CL_NS(util)::Deletor::Void<Analyzer> > analyzerMap;
|
||||
public:
|
||||
/**
|
||||
* Constructs with default analyzer.
|
||||
*
|
||||
* @param defaultAnalyzer Any fields not specifically
|
||||
* defined to use a different analyzer will use the one provided here.
|
||||
*/
|
||||
PerFieldAnalyzerWrapper(Analyzer* defaultAnalyzer);
|
||||
~PerFieldAnalyzerWrapper();
|
||||
|
||||
/**
|
||||
* Defines an analyzer to use for the specified field.
|
||||
*
|
||||
* @param fieldName field name requiring a non-default analyzer
|
||||
* @param analyzer non-default analyzer to use for field
|
||||
*/
|
||||
void addAnalyzer(const TCHAR* fieldName, Analyzer* analyzer);
|
||||
TokenStream* tokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A filter that replaces accented characters in the ISO Latin 1 character set
|
||||
* (ISO-8859-1) by their unaccented equivalent. The case will not be altered.
|
||||
* <p>
|
||||
* For instance, 'à' will be replaced by 'a'.
|
||||
* <p>
|
||||
*/
|
||||
class ISOLatin1AccentFilter: public TokenFilter {
|
||||
public:
|
||||
ISOLatin1AccentFilter(TokenStream* input, bool deleteTs):
|
||||
TokenFilter(input,deleteTs)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* To replace accented characters in a String by unaccented equivalents.
|
||||
*/
|
||||
bool next(Token* token);
|
||||
};
|
||||
|
||||
CL_NS_END
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
analyzersdir = $(lsrcdir)/analysis
|
||||
analyzershdir = $(includedir)/CLucene/analysis
|
||||
|
||||
libclucene_la_SOURCES += $(analyzersdir)/Analyzers.cpp
|
||||
libclucene_la_SOURCES += $(analyzersdir)/AnalysisHeader.cpp
|
||||
|
||||
analyzersh_HEADERS = $(analyzersdir)/*.h
|
||||
@@ -1,9 +0,0 @@
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
stdandir = $(lsrcdir)/analysis/standard
|
||||
stdanhdir = $(includedir)/CLucene/analysis/standard
|
||||
|
||||
libclucene_la_SOURCES += $(stdandir)/StandardAnalyzer.cpp
|
||||
libclucene_la_SOURCES += $(stdandir)/StandardFilter.cpp
|
||||
libclucene_la_SOURCES += $(stdandir)/StandardTokenizer.cpp
|
||||
|
||||
stdanh_HEADERS = $(stdandir)/*.h
|
||||
@@ -1,47 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "StandardAnalyzer.h"
|
||||
|
||||
#include "CLucene/util/VoidMap.h"
|
||||
#include "CLucene/util/Reader.h"
|
||||
#include "CLucene/analysis/AnalysisHeader.h"
|
||||
#include "CLucene/analysis/Analyzers.h"
|
||||
#include "StandardFilter.h"
|
||||
#include "StandardTokenizer.h"
|
||||
|
||||
CL_NS_USE(util)
|
||||
CL_NS_USE(analysis)
|
||||
|
||||
CL_NS_DEF2(analysis,standard)
|
||||
|
||||
StandardAnalyzer::StandardAnalyzer():
|
||||
stopSet(false)
|
||||
{
|
||||
StopFilter::fillStopTable( &stopSet,CL_NS(analysis)::StopAnalyzer::ENGLISH_STOP_WORDS);
|
||||
}
|
||||
|
||||
StandardAnalyzer::StandardAnalyzer( TCHAR** stopWords):
|
||||
stopSet(false)
|
||||
{
|
||||
StopFilter::fillStopTable( &stopSet,stopWords );
|
||||
}
|
||||
|
||||
StandardAnalyzer::~StandardAnalyzer(){
|
||||
}
|
||||
|
||||
|
||||
TokenStream* StandardAnalyzer::tokenStream(const TCHAR* fieldName, Reader* reader)
|
||||
{
|
||||
TokenStream* ret = _CLNEW StandardTokenizer(reader);
|
||||
ret = _CLNEW StandardFilter(ret,true);
|
||||
ret = _CLNEW LowerCaseFilter(ret,true);
|
||||
ret = _CLNEW StopFilter(ret,true, &stopSet);
|
||||
//ret = _CLNEW PorterStemmerFilter(ret,true); //todo: can we add this in somewhere?
|
||||
return ret;
|
||||
}
|
||||
CL_NS_END2
|
||||
@@ -1,47 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_analysis_standard_StandardAnalyzer
|
||||
#define _lucene_analysis_standard_StandardAnalyzer
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "CLucene/util/VoidMap.h"
|
||||
#include "CLucene/util/Reader.h"
|
||||
#include "CLucene/analysis/AnalysisHeader.h"
|
||||
#include "CLucene/analysis/Analyzers.h"
|
||||
#include "StandardFilter.h"
|
||||
#include "StandardTokenizer.h"
|
||||
|
||||
|
||||
CL_NS_DEF2(analysis,standard)
|
||||
|
||||
//Represents a standard analyzer.
|
||||
class StandardAnalyzer : public Analyzer
|
||||
{
|
||||
private:
|
||||
CL_NS(util)::CLSetList<TCHAR*> stopSet;
|
||||
public:
|
||||
// <summary> Builds an analyzer. </summary>
|
||||
StandardAnalyzer();
|
||||
|
||||
//<summary> Builds an analyzer with the given stop words. </summary>
|
||||
StandardAnalyzer( TCHAR** stopWords);
|
||||
|
||||
~StandardAnalyzer();
|
||||
|
||||
|
||||
// <summary>
|
||||
// Constructs a StandardTokenizer filtered by a
|
||||
// StandardFilter, a LowerCaseFilter and a StopFilter.
|
||||
// </summary>
|
||||
TokenStream* tokenStream(const TCHAR* fieldName, CL_NS(util)::Reader* reader)
|
||||
;
|
||||
};
|
||||
CL_NS_END2
|
||||
#endif
|
||||
@@ -1,58 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "StandardFilter.h"
|
||||
|
||||
#include "../AnalysisHeader.h"
|
||||
#include "../Analyzers.h"
|
||||
#include "StandardTokenizerConstants.h"
|
||||
#include "CLucene/util/StringBuffer.h"
|
||||
|
||||
CL_NS_USE(analysis)
|
||||
CL_NS_USE(util)
|
||||
CL_NS_DEF2(analysis,standard)
|
||||
|
||||
StandardFilter::StandardFilter(TokenStream* in, bool deleteTokenStream):
|
||||
TokenFilter(in, deleteTokenStream)
|
||||
{
|
||||
}
|
||||
|
||||
StandardFilter::~StandardFilter(){
|
||||
}
|
||||
|
||||
bool StandardFilter::next(Token* t) {
|
||||
if (!input->next(t))
|
||||
return false;
|
||||
|
||||
TCHAR* text = t->_termText;
|
||||
const int32_t textLength = t->termTextLength();
|
||||
const TCHAR* type = t->type();
|
||||
|
||||
if ( type == tokenImage[APOSTROPHE] && //we can compare the type directy since the type should always come from the tokenImage
|
||||
( textLength >= 2 && _tcsicmp(text+textLength-2, _T("'s"))==0 ) )
|
||||
{
|
||||
// remove 's
|
||||
text[textLength-2]=0;
|
||||
t->resetTermTextLen();
|
||||
|
||||
return true;
|
||||
|
||||
} else if ( type == tokenImage[ACRONYM] ) { // remove dots
|
||||
int32_t j = 0;
|
||||
for ( int32_t i=0;i<textLength;i++ ){
|
||||
if ( text[i] != '.' )
|
||||
text[j++]=text[i];
|
||||
}
|
||||
text[j]=0;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
CL_NS_END2
|
||||
@@ -1,37 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_analysis_standard_StandardFilter
|
||||
#define _lucene_analysis_standard_StandardFilter
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "../AnalysisHeader.h"
|
||||
#include "../Analyzers.h"
|
||||
#include "StandardTokenizerConstants.h"
|
||||
#include "CLucene/util/StringBuffer.h"
|
||||
|
||||
CL_NS_DEF2(analysis,standard)
|
||||
|
||||
// Normalizes tokens extracted with {@link StandardTokenizer}.
|
||||
class StandardFilter: public TokenFilter{
|
||||
public:
|
||||
// Construct filtering <i>in</i>.
|
||||
StandardFilter(TokenStream* in, bool deleteTokenStream);
|
||||
|
||||
~StandardFilter();
|
||||
|
||||
|
||||
/** Returns the next token in the stream, or NULL at EOS.
|
||||
* <p>Removes <tt>'s</tt> from the end of words.
|
||||
* <p>Removes dots from acronyms.
|
||||
*/
|
||||
bool next(Token* token);
|
||||
};
|
||||
CL_NS_END2
|
||||
#endif
|
||||
@@ -1,415 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "StandardTokenizer.h"
|
||||
|
||||
CL_NS_USE(analysis)
|
||||
CL_NS_USE(util)
|
||||
CL_NS_DEF2(analysis,standard)
|
||||
|
||||
/* A bunch of shortcut macros, many of which make assumptions about variable
|
||||
** names. These macros enhance readability, not just convenience! */
|
||||
#define EOS (ch==-1 || rd->Eos())
|
||||
#define SPACE (_istspace((TCHAR)ch) != 0)
|
||||
#define ALPHA (_istalpha((TCHAR)ch) != 0)
|
||||
#define ALNUM (_istalnum(ch) != 0)
|
||||
#define DIGIT (_istdigit(ch) != 0)
|
||||
#define UNDERSCORE (ch == '_')
|
||||
|
||||
#define DASH (ch == '-')
|
||||
#define NEGATIVE_SIGN_ DASH
|
||||
#define POSITIVE_SIGN_ (ch == '+')
|
||||
#define SIGN (NEGATIVE_SIGN_ || POSITIVE_SIGN_)
|
||||
|
||||
#define DOT (ch == '.')
|
||||
#define DECIMAL DOT
|
||||
|
||||
|
||||
//freebsd seems to have a problem with defines over multiple lines, so this has to be one long line
|
||||
#define _CONSUME_AS_LONG_AS(conditionFails) while (true) { ch = readChar(); if (ch==-1 || (!(conditionFails) || str.len >= LUCENE_MAX_WORD_LEN)) { break; } str.appendChar(ch);}
|
||||
|
||||
#define CONSUME_ALPHAS _CONSUME_AS_LONG_AS(ALPHA)
|
||||
|
||||
#define CONSUME_DIGITS _CONSUME_AS_LONG_AS(DIGIT)
|
||||
|
||||
/* otherMatches is a condition (possibly compound) under which a character
|
||||
** that's not an ALNUM or UNDERSCORE can be considered not to break the
|
||||
** span. Callers should pass false if only ALNUM/UNDERSCORE are acceptable. */
|
||||
#define CONSUME_WORD _CONSUME_AS_LONG_AS(ALNUM || UNDERSCORE)
|
||||
#define CONSUME_WORD_OR(otherMatches) _CONSUME_AS_LONG_AS(ALNUM || UNDERSCORE || (otherMatches))
|
||||
|
||||
|
||||
/* It is considered that "nothing of value" has been read if:
|
||||
** a) The "read head" hasn't moved since specialCharPos was established.
|
||||
** or
|
||||
** b) The "read head" has moved by one character, but that character was
|
||||
** either whitespace or not among the characters found in the body of
|
||||
** a token (deliberately doesn't include the likes of '@'/'&'). */
|
||||
#define CONSUMED_NOTHING_OF_VALUE (rdPos == specialCharPos || (rdPos == specialCharPos+1 && ( SPACE || !(ALNUM || DOT || DASH || UNDERSCORE) )))
|
||||
|
||||
#define RIGHTMOST(sb) (sb.getBuffer()[sb.len-1])
|
||||
#define RIGHTMOST_IS(sb, c) (RIGHTMOST(sb) == c)
|
||||
/* To discard the last character in a StringBuffer, we decrement the buffer's
|
||||
** length indicator and move the terminator back by one character. */
|
||||
#define SHAVE_RIGHTMOST(sb) (sb.getBuffer()[--sb.len] = '\0')
|
||||
|
||||
#define REMOVE_TRAILING_CHARS(sb, charMatchesCondition) { TCHAR* sbBuf = sb.getBuffer(); for (int32_t i = sb.len-1; i >= 0; i--) { TCHAR c = sbBuf[i]; if (charMatchesCondition) { sbBuf[--sb.len] = '\0'; } else {break;}}}
|
||||
|
||||
/* Does StringBuffer sb contain any of the characters in string ofThese? */
|
||||
#define CONTAINS_ANY(sb, ofThese) (_tcscspn(sb.getBuffer(), _T(ofThese)) != static_cast<size_t>(sb.len))
|
||||
|
||||
|
||||
StandardTokenizer::StandardTokenizer(Reader* reader):
|
||||
rd(_CLNEW FastCharStream(reader)),
|
||||
/* rdPos is zero-based. It starts at -1, and will advance to the first
|
||||
** position when readChar() is first called. */
|
||||
rdPos(-1),
|
||||
tokenStart(-1)
|
||||
{
|
||||
}
|
||||
|
||||
StandardTokenizer::~StandardTokenizer() {
|
||||
_CLDELETE(rd);
|
||||
}
|
||||
|
||||
int StandardTokenizer::readChar() {
|
||||
/* Increment by 1 because we're speaking in terms of characters, not
|
||||
** necessarily bytes: */
|
||||
rdPos++;
|
||||
return rd->GetNext();
|
||||
}
|
||||
|
||||
void StandardTokenizer::unReadChar() {
|
||||
rd->UnGet();
|
||||
rdPos--;
|
||||
}
|
||||
|
||||
inline bool StandardTokenizer::setToken(Token* t, StringBuffer* sb, TokenTypes tokenCode) {
|
||||
t->setStartOffset(tokenStart);
|
||||
t->setEndOffset(tokenStart+sb->length());
|
||||
t->setType(tokenImage[tokenCode]);
|
||||
sb->getBuffer(); //null terminates the buffer
|
||||
t->resetTermTextLen();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*inline Token* StandardTokenizer::createToken(const TCHAR* text, int32_t tokenLength, TokenTypes tokenCode) {
|
||||
CND_PRECONDITION (tokenLength > 0,"Token length is less than or equal to zero");
|
||||
return _CLNEW Token(text, tokenStart, tokenStart+tokenLength, tokenImage[tokenCode]);
|
||||
}*/
|
||||
|
||||
bool StandardTokenizer::next(Token* t) {
|
||||
int ch=0;
|
||||
while (!EOS) {
|
||||
ch = readChar();
|
||||
|
||||
if ( ch == 0 || ch == -1 ){
|
||||
continue;
|
||||
} else if (SPACE) {
|
||||
continue;
|
||||
} else if (ALPHA || UNDERSCORE) {
|
||||
tokenStart = rdPos;
|
||||
return ReadAlphaNum(ch,t);
|
||||
} else if (DIGIT || NEGATIVE_SIGN_ || DECIMAL) {
|
||||
tokenStart = rdPos;
|
||||
/* ReadNumber returns NULL if it fails to extract a valid number; in
|
||||
** that case, we just continue. */
|
||||
if (ReadNumber(NULL, ch,t))
|
||||
return true;
|
||||
}else if (((TCHAR)ch>>8)&&((TCHAR)ch>=0xa0)){//add by Fox_Hawk
|
||||
//todo: this is new code...
|
||||
t->growBuffer(LUCENE_MAX_WORD_LEN);//make sure token can hold the next word
|
||||
StringBuffer str(t->_termText,t->bufferLength(),true); //use stringbuffer to read data onto the termText
|
||||
str.appendChar(ch);
|
||||
setToken(t,&str, CL_NS2(analysis,standard)::ALPHANUM);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StandardTokenizer::ReadNumber(const TCHAR* previousNumber, const TCHAR prev,Token* t) {
|
||||
/* previousNumber is only non-NULL if this function already read a complete
|
||||
** number in a previous recursion, yet has been asked to read additional
|
||||
** numeric segments. For example, in the HOST "192.168.1.3", "192.168" is
|
||||
** a complete number, but this function will recurse to read the "1.3",
|
||||
** generating a single HOST token "192.168.1.3". */
|
||||
t->growBuffer(LUCENE_MAX_WORD_LEN);//make sure token can hold the next word
|
||||
StringBuffer str(t->_termText,t->bufferLength(),true); //use stringbuffer to read data onto the termText
|
||||
TokenTypes tokenType;
|
||||
bool decExhausted;
|
||||
if (previousNumber != NULL) {
|
||||
str.prepend(previousNumber);
|
||||
tokenType = CL_NS2(analysis,standard)::HOST;
|
||||
decExhausted = false;
|
||||
} else {
|
||||
tokenType = CL_NS2(analysis,standard)::NUM;
|
||||
decExhausted = (prev == '.');
|
||||
}
|
||||
if ( str.len >= LUCENE_MAX_WORD_LEN ){
|
||||
//if a number is too long, i would say there is no point
|
||||
//storing it, because its going to be the wrong number anyway?
|
||||
//what do people think?
|
||||
return false;
|
||||
}
|
||||
str.appendChar(prev);
|
||||
|
||||
const bool signExhausted = (prev == '-');
|
||||
int ch = prev;
|
||||
|
||||
CONSUME_DIGITS;
|
||||
|
||||
if (str.len < 2 /* CONSUME_DIGITS didn't find any digits. */
|
||||
&& (
|
||||
(signExhausted && !DECIMAL)
|
||||
|| (decExhausted /* && !DIGIT is implied, since CONSUME_DIGITS stopped on a non-digit. */)
|
||||
)
|
||||
)
|
||||
{
|
||||
/* We have either:
|
||||
** a) a negative sign that's not followed by either digit(s) or a decimal
|
||||
** b) a decimal that's not followed by digit(s)
|
||||
** so this is not a valid number. */
|
||||
if (!EOS) {
|
||||
/* Unread the character that stopped CONSUME_DIGITS: */
|
||||
unReadChar();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* We just read a group of digits. Is it followed by a decimal symbol,
|
||||
** implying that there might be another group of digits available? */
|
||||
if (!EOS) {
|
||||
if (DECIMAL) {
|
||||
if ( str.len >= LUCENE_MAX_WORD_LEN )
|
||||
return false; //read above for rationale
|
||||
str.appendChar(ch);
|
||||
} else {
|
||||
unReadChar();
|
||||
goto SUCCESSFULLY_EXTRACTED_NUMBER;
|
||||
}
|
||||
|
||||
CONSUME_DIGITS;
|
||||
if (!DIGIT && !DECIMAL) {
|
||||
unReadChar();
|
||||
} else if (!EOS && DECIMAL && _istdigit(rd->Peek())) {
|
||||
/* We just read the fractional digit group, but it's also followed by
|
||||
** a decimal symbol and at least one more digit, so this must be a
|
||||
** HOST rather than a real number. */
|
||||
return ReadNumber(str.getBuffer(), '.',t);
|
||||
}
|
||||
}
|
||||
|
||||
SUCCESSFULLY_EXTRACTED_NUMBER:
|
||||
TCHAR rightmost = RIGHTMOST(str);
|
||||
/* Don't including a trailing decimal point. */
|
||||
if (rightmost == '.') {
|
||||
SHAVE_RIGHTMOST(str);
|
||||
unReadChar();
|
||||
rightmost = RIGHTMOST(str);
|
||||
}
|
||||
/* If all we have left is a negative sign, it's not a valid number. */
|
||||
if (rightmost == '-') {
|
||||
CND_PRECONDITION (str.len == 1, "Number is invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
return setToken(t,&str,tokenType);
|
||||
}
|
||||
|
||||
bool StandardTokenizer::ReadAlphaNum(const TCHAR prev, Token* t) {
|
||||
t->growBuffer(LUCENE_MAX_WORD_LEN);//make sure token can hold the next word
|
||||
StringBuffer str(t->_termText,t->bufferLength(),true); //use stringbuffer to read data onto the termText
|
||||
if ( str.len < LUCENE_MAX_WORD_LEN ){
|
||||
str.appendChar(prev);
|
||||
int ch = prev;
|
||||
|
||||
CONSUME_WORD;
|
||||
if (!EOS && str.len < LUCENE_MAX_WORD_LEN-1 ) { //still have space for 1 more character?
|
||||
switch(ch) { /* What follows the first alphanum segment? */
|
||||
case '.':
|
||||
str.appendChar('.');
|
||||
return ReadDotted(&str, CL_NS2(analysis,standard)::UNKNOWN,t);
|
||||
case '\'':
|
||||
str.appendChar('\'');
|
||||
return ReadApostrophe(&str,t);
|
||||
case '@':
|
||||
str.appendChar('@');
|
||||
return ReadAt(&str,t);
|
||||
case '&':
|
||||
str.appendChar('&');
|
||||
return ReadCompany(&str,t);
|
||||
/* default: fall through to end of this function. */
|
||||
}
|
||||
}
|
||||
}
|
||||
return setToken(t,&str,CL_NS2(analysis,standard)::ALPHANUM);
|
||||
}
|
||||
|
||||
bool StandardTokenizer::ReadDotted(StringBuffer* _str, TokenTypes forcedType, Token* t) {
|
||||
const int32_t specialCharPos = rdPos;
|
||||
StringBuffer& str=*_str;
|
||||
|
||||
/* A segment of a "dotted" is not allowed to begin with another dot or a dash.
|
||||
** Even though hosts, e-mail addresses, etc., could have a dotted-segment
|
||||
** that begins with a dot or a dash, it's far more common in source text
|
||||
** for a pattern like "abc.--def" to be intended as two tokens. */
|
||||
int ch = rd->Peek();
|
||||
if (!(DOT || DASH)) {
|
||||
bool prevWasDot;
|
||||
bool prevWasDash;
|
||||
if (str.len == 0) {
|
||||
prevWasDot = false;
|
||||
prevWasDash = false;
|
||||
} else {
|
||||
prevWasDot = RIGHTMOST(str) == '.';
|
||||
prevWasDash = RIGHTMOST(str) == '-';
|
||||
}
|
||||
while (!EOS && str.len < LUCENE_MAX_WORD_LEN-1 ) {
|
||||
ch = readChar();
|
||||
const bool dot = ch == '.';
|
||||
const bool dash = ch == '-';
|
||||
|
||||
if (!(ALNUM || UNDERSCORE || dot || dash)) {
|
||||
break;
|
||||
}
|
||||
/* Multiple dots or dashes in succession end the token.
|
||||
** Consider the following inputs:
|
||||
** "Visit windowsupdate.microsoft.com--update today!"
|
||||
** "In the U.S.A.--yes, even there!" */
|
||||
if ((dot || dash) && (prevWasDot || prevWasDash)) {
|
||||
/* We're not going to append the character we just read, in any case.
|
||||
** As to the character before it (which is currently RIGHTMOST(str)):
|
||||
** Unless RIGHTMOST(str) is a dot, in which we need to save it so the
|
||||
** acronym-versus-host detection can work, we want to get rid of it. */
|
||||
if (!prevWasDot) {
|
||||
SHAVE_RIGHTMOST(str);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
str.appendChar(ch);
|
||||
|
||||
prevWasDot = dot;
|
||||
prevWasDash = dash;
|
||||
}
|
||||
}
|
||||
|
||||
/* There's a potential StringBuffer.append call in the code above, which
|
||||
** could cause str to reallocate its internal buffer. We must wait to
|
||||
** obtain the optimization-oriented strBuf pointer until after the initial
|
||||
** potentially realloc-triggering operations on str.
|
||||
** Because there can be other such ops much later in this function, strBuf
|
||||
** is guarded within a block to prevent its use during or after the calls
|
||||
** that would potentially invalidate it. */
|
||||
{ /* Begin block-guard of strBuf */
|
||||
TCHAR* strBuf = str.getBuffer();
|
||||
|
||||
bool rightmostIsDot = RIGHTMOST_IS(str, '.');
|
||||
if (CONSUMED_NOTHING_OF_VALUE) {
|
||||
/* No more alphanums available for this token; shave trailing dot, if any. */
|
||||
if (rightmostIsDot) {
|
||||
SHAVE_RIGHTMOST(str);
|
||||
}
|
||||
/* If there are no dots remaining, this is a generic ALPHANUM. */
|
||||
if (_tcschr(strBuf, '.') == NULL) {
|
||||
forcedType = CL_NS2(analysis,standard)::ALPHANUM;
|
||||
}
|
||||
|
||||
/* Check the token to see if it's an acronym. An acronym must have a
|
||||
** letter in every even slot and a dot in every odd slot, including the
|
||||
** last slot (for example, "U.S.A."). */
|
||||
} else if (rightmostIsDot) {
|
||||
bool isAcronym = true;
|
||||
const int32_t upperCheckLimit = str.len - 1; /* -1 b/c we already checked the last slot. */
|
||||
|
||||
for (int32_t i = 0; i < upperCheckLimit; i++) {
|
||||
const bool even = (i % 2 == 0);
|
||||
ch = strBuf[i];
|
||||
if ( (even && !ALPHA) || (!even && !DOT) ) {
|
||||
isAcronym = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isAcronym) {
|
||||
forcedType = CL_NS2(analysis,standard)::ACRONYM;
|
||||
} else {
|
||||
/* If it's not an acronym, we don't want the trailing dot. */
|
||||
SHAVE_RIGHTMOST(str);
|
||||
/* If there are no dots remaining, this is a generic ALPHANUM. */
|
||||
if (_tcschr(strBuf, '.') == NULL) {
|
||||
forcedType = CL_NS2(analysis,standard)::ALPHANUM;
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* End block-guard of strBuf */
|
||||
|
||||
if (!EOS) {
|
||||
if (ch == '@' && str.len < LUCENE_MAX_WORD_LEN-1) {
|
||||
str.appendChar('@');
|
||||
return ReadAt(&str,t);
|
||||
} else {
|
||||
unReadChar();
|
||||
}
|
||||
}
|
||||
|
||||
return setToken(t,&str,CL_NS2(analysis,standard)::UNKNOWN
|
||||
? forcedType : CL_NS2(analysis,standard)::HOST);
|
||||
}
|
||||
|
||||
bool StandardTokenizer::ReadApostrophe(StringBuffer* _str, Token* t) {
|
||||
StringBuffer& str=*_str;
|
||||
|
||||
TokenTypes tokenType = CL_NS2(analysis,standard)::APOSTROPHE;
|
||||
const int32_t specialCharPos = rdPos;
|
||||
int ch=0;
|
||||
|
||||
CONSUME_ALPHAS;
|
||||
if (RIGHTMOST_IS(str, '\'') || CONSUMED_NOTHING_OF_VALUE) {
|
||||
/* After the apostrophe, no more alphanums were available within this
|
||||
** token; shave trailing apostrophe and revert to generic ALPHANUM. */
|
||||
SHAVE_RIGHTMOST(str);
|
||||
tokenType = CL_NS2(analysis,standard)::ALPHANUM;
|
||||
}
|
||||
if (!EOS) {
|
||||
unReadChar();
|
||||
}
|
||||
|
||||
return setToken(t,&str,tokenType);
|
||||
}
|
||||
|
||||
bool StandardTokenizer::ReadAt(StringBuffer* str, Token* t) {
|
||||
ReadDotted(str, CL_NS2(analysis,standard)::EMAIL,t);
|
||||
/* JLucene grammar indicates dots/digits not allowed in company name: */
|
||||
if (!CONTAINS_ANY((*str), ".0123456789")) {
|
||||
setToken(t,str,CL_NS2(analysis,standard)::COMPANY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StandardTokenizer::ReadCompany(StringBuffer* _str, Token* t) {
|
||||
StringBuffer& str = *_str;
|
||||
const int32_t specialCharPos = rdPos;
|
||||
int ch=0;
|
||||
|
||||
CONSUME_WORD;
|
||||
if (CONSUMED_NOTHING_OF_VALUE) {
|
||||
/* After the ampersand, no more alphanums were available within this
|
||||
** token; shave trailing ampersand and revert to ALPHANUM. */
|
||||
CND_PRECONDITION(RIGHTMOST_IS(str, '&'),"ReadCompany failed");
|
||||
SHAVE_RIGHTMOST(str);
|
||||
|
||||
|
||||
return setToken(t,&str,CL_NS2(analysis,standard)::ALPHANUM);
|
||||
}
|
||||
if (!EOS) {
|
||||
unReadChar();
|
||||
}
|
||||
|
||||
return setToken(t,&str,CL_NS2(analysis,standard)::COMPANY);
|
||||
}
|
||||
|
||||
CL_NS_END2
|
||||
@@ -1,70 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_analysis_standard_StandardTokenizer
|
||||
#define _lucene_analysis_standard_StandardTokenizer
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "../AnalysisHeader.h"
|
||||
#include "../Analyzers.h"
|
||||
#include "StandardTokenizerConstants.h"
|
||||
#include "CLucene/util/StringBuffer.h"
|
||||
#include "CLucene/util/FastCharStream.h"
|
||||
#include "CLucene/util/Reader.h"
|
||||
|
||||
|
||||
CL_NS_DEF2(analysis,standard)
|
||||
|
||||
// This should be a good tokenizer for most European-language documents.
|
||||
class StandardTokenizer: public Tokenizer {
|
||||
private:
|
||||
int32_t rdPos;
|
||||
int32_t tokenStart;
|
||||
|
||||
// Advance by one character, incrementing rdPos and returning the character.
|
||||
int readChar();
|
||||
// Retreat by one character, decrementing rdPos.
|
||||
void unReadChar();
|
||||
|
||||
// createToken centralizes token creation for auditing purposes.
|
||||
//Token* createToken(CL_NS(util)::StringBuffer* sb, TokenTypes tokenCode);
|
||||
inline bool setToken(Token* t, CL_NS(util)::StringBuffer* sb, TokenTypes tokenCode);
|
||||
|
||||
bool ReadDotted(CL_NS(util)::StringBuffer* str, TokenTypes forcedType,Token* t);
|
||||
|
||||
public:
|
||||
CL_NS(util)::FastCharStream* rd;
|
||||
|
||||
// Constructs a tokenizer for this Reader.
|
||||
StandardTokenizer(CL_NS(util)::Reader* reader);
|
||||
|
||||
~StandardTokenizer();
|
||||
|
||||
/** Returns the next token in the stream, or false at end-of-stream.
|
||||
* The returned token's type is set to an element of
|
||||
* StandardTokenizerConstants::tokenImage. */
|
||||
bool next(Token* token);
|
||||
|
||||
// Reads for number like "1"/"1234.567", or IP address like "192.168.1.2".
|
||||
bool ReadNumber(const TCHAR* previousNumber, const TCHAR prev, Token* t);
|
||||
|
||||
bool ReadAlphaNum(const TCHAR prev, Token* t);
|
||||
|
||||
// Reads for apostrophe-containing word.
|
||||
bool ReadApostrophe(CL_NS(util)::StringBuffer* str, Token* t);
|
||||
|
||||
// Reads for something@... it may be a COMPANY name or a EMAIL address
|
||||
bool ReadAt(CL_NS(util)::StringBuffer* str, Token* t);
|
||||
|
||||
// Reads for COMPANY name like AT&T.
|
||||
bool ReadCompany(CL_NS(util)::StringBuffer* str, Token* t);
|
||||
};
|
||||
|
||||
CL_NS_END2
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_analysis_standard_StandardTokenizerConstants
|
||||
#define _lucene_analysis_standard_StandardTokenizerConstants
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
CL_NS_DEF2(analysis,standard)
|
||||
enum TokenTypes {
|
||||
_EOF,
|
||||
UNKNOWN,
|
||||
ALPHANUM,
|
||||
APOSTROPHE,
|
||||
ACRONYM,
|
||||
COMPANY,
|
||||
EMAIL,
|
||||
HOST,
|
||||
NUM
|
||||
};
|
||||
|
||||
const static TCHAR* tokenImage[] = {
|
||||
_T("<EOF>"),
|
||||
_T("<UNKNOWN>"),
|
||||
_T("<ALPHANUM>"),
|
||||
_T("<APOSTROPHE>"),
|
||||
_T("<ACRONYM>"),
|
||||
_T("<COMPANY>"),
|
||||
_T("<EMAIL>"),
|
||||
_T("<HOST>"),
|
||||
_T("<NUM>")
|
||||
//_T("<P>"),
|
||||
//_T("<HAS_DIGIT>"),
|
||||
//_T("<ALPHA>"),
|
||||
//_T("<LETTER>"),
|
||||
//_T("<DIGIT>"),
|
||||
//_T("<NOISE>"),
|
||||
};
|
||||
|
||||
CL_NS_END2
|
||||
#endif
|
||||
@@ -1,71 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#if !defined(_lucene_COMPILER_BCB)
|
||||
#define _lucene_COMPILER_BCB
|
||||
|
||||
// It is internal CLucene header - DO NOT include it directly
|
||||
|
||||
#include "CLucene/config/define_std.h"
|
||||
#undef _CL_HAVE_STRTOLL
|
||||
#undef _CL_HAVE_WCSTOLL
|
||||
|
||||
#define _LUCENE_PRAGMA_ONCE
|
||||
#define _LUCENE_PRAGMA_WARNINGS //tell lucene to display warnings using pragmas instead of #warning
|
||||
#define LUCENE_DISABLE_HASHING
|
||||
#define LUCENE_STATIC_CONSTANT(type, assignment) enum { assignment }
|
||||
|
||||
#undef LUCENE_ENABLE_MEMLEAKTRACKING //it has been reported that this causes problems
|
||||
|
||||
#define fileSize filelength
|
||||
#define fileSeek lseek
|
||||
#define fileTell tell
|
||||
#define fileStat stat
|
||||
#define fileHandleStat fstat
|
||||
|
||||
#define _sleep Sleep
|
||||
#define O_RANDOM 0
|
||||
|
||||
//java long type
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
//#define LUCENE_INT64_MAX _I64_MAX
|
||||
|
||||
//java int type
|
||||
typedef int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
//#define LUCENE_INT32_MAX INT_MAX
|
||||
|
||||
//java byte type
|
||||
typedef unsigned char uint8_t;
|
||||
//#define LUCENE_UINT8_MAX UCHAR_MAX
|
||||
|
||||
//floating point type
|
||||
typedef double float_t;
|
||||
|
||||
//required type
|
||||
typedef int intptr_t;
|
||||
|
||||
#define _CL_ILONG(x) x ## L
|
||||
#define _ILONGLONG(x) x ## i64
|
||||
|
||||
|
||||
#elif !defined(_lucene_COMPILER_BCB2)
|
||||
#define _lucene_COMPILER_BCB2
|
||||
//second inclusion
|
||||
|
||||
#define _open open
|
||||
#define _timeb timeb
|
||||
#define _ftime ::ftime
|
||||
#define _rename rename
|
||||
|
||||
#define _realpath(rel,abs) _fullpath(abs,rel,CL_MAX_PATH)
|
||||
|
||||
#elif !defined(_lucene_COMPILER_BCB3)
|
||||
#define _lucene_COMPILER_BCB3
|
||||
//third inclusion
|
||||
|
||||
#endif
|
||||
@@ -1,162 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#if !defined(_lucene_COMPILER_GCC)
|
||||
#define _lucene_COMPILER_GCC
|
||||
|
||||
// It is internal CLucene header - DO NOT include it directly
|
||||
#if !defined(_SUPPRESS_MAKE_BASED_CONFIG)
|
||||
#include "CLucene/clucene-config.h" //make clucene-config.h file
|
||||
#endif
|
||||
|
||||
#if defined(_ASCII)
|
||||
#undef _UCS2
|
||||
#elif defined(_UCS2)
|
||||
//
|
||||
#else
|
||||
#define CL_CHARSET_GUESS
|
||||
#endif
|
||||
|
||||
//dont allow FS_MMAP if mmap is not available
|
||||
#if defined(LUCENE_FS_MMAP) && !defined(_CL_HAVE_MMAP)
|
||||
#error "LUCENE_FS_MMAP is defined and MMap doesn't appear to be available"
|
||||
#endif
|
||||
|
||||
#ifdef _CL_HAVE_NO_FUNCTION_TRY_BLOCKS
|
||||
#undef _LUCENE_DISABLE_EXCEPTIONS
|
||||
#define _LUCENE_DISABLE_EXCEPTIONS
|
||||
|
||||
#error "this is bad if you made it here... your compiler seems not to have try/catch blocks."
|
||||
#error "maybe you could implement an alternative solution for us? :)"
|
||||
#endif
|
||||
|
||||
#ifndef _CL_HAVE_NAMESPACES
|
||||
#define DISABLE_NAMESPACE
|
||||
#endif
|
||||
|
||||
#define CL_NS_HASHING(func) __gnu_cxx::func //todo: is this best way?
|
||||
#define LUCENE_DISABLE_HASHING
|
||||
|
||||
//define the file functions
|
||||
#define fileSeek lseek
|
||||
#define fileSize _filelength
|
||||
#define fileStat stat
|
||||
#define fileHandleStat fstat
|
||||
#ifdef _CL_HAVE_TELL
|
||||
#define fileTell tell
|
||||
#else
|
||||
//ftell (and probably soon ftell64) are POSIX standard functions, but tell and
|
||||
//tell64 are not, so we define fileTell in terms of fileSeek.
|
||||
#define fileTell(fhandle) fileSeek(fhandle, 0, SEEK_CUR)
|
||||
#endif
|
||||
|
||||
//this is needed early on so that CL_MAX_PATH can be correctly determined
|
||||
//in the StdHeader.h. This was earlier causing problems with macosx.
|
||||
//:: crash was due to realpath() that expects an output arguments that
|
||||
//has at least the size of PATH_MAX (even if the result has a lower size)
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef _CL_HAVE_WCHAR_T
|
||||
typedef unsigned short wchar_t;
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
//cygwin seems to incorrectly define that it has wprintf???
|
||||
#undef _CL_HAVE_WPRINTF
|
||||
#elif defined(__MINGW32__)
|
||||
#ifndef _CL_HAVE_WINDOWS_H
|
||||
#define _CL_HAVE_WINDOWS_H
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//end _lucene_COMPILER_GCC1
|
||||
#elif !defined(_lucene_COMPILER_GCC2)
|
||||
#define _lucene_COMPILER_GCC2
|
||||
//second inclusion
|
||||
|
||||
//types
|
||||
#if defined(_CL_HAVE_SYS_TYPES_H)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if defined(_CL_HAVE_INTTYPES_H)
|
||||
#include <inttypes.h>
|
||||
#elif defined(_CL_HAVE_STDINT_H)
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if _CL_SIZEOF_UNSIGNED_LONG_LONG==8
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef long long int64_t;
|
||||
#elif _CL_SIZEOF_UNSIGNED_LONG==8
|
||||
typedef unsigned long uint64_t;
|
||||
typedef long int64_t;
|
||||
#else
|
||||
#error I do not know what to use for a uint64_t.
|
||||
#endif
|
||||
|
||||
/* Give us an unsigned 32-bit data type. */
|
||||
#if _CL_SIZEOF_UNSIGNED_LONG==4
|
||||
typedef unsigned long uint32_t;
|
||||
typedef long int32_t;
|
||||
#elif _CL_SIZEOF_UNSIGNED_INT==4
|
||||
typedef unsigned int uint32_t;
|
||||
typedef int int32_t;
|
||||
#else
|
||||
#error I do not know what to use for a uint32_t.
|
||||
#endif
|
||||
|
||||
/* An unsigned 8-bit data type */
|
||||
#if _CL_SIZEOF_UNSIGNED_CHAR==1
|
||||
typedef unsigned char uint8_t;
|
||||
#else
|
||||
#error I do not know what to use for a uint8_t.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//second chance to fix default settings
|
||||
//this must be defined later, otherwise it messes up
|
||||
//the standard libraries
|
||||
#if !defined(__MINGW32__)
|
||||
#define _close ::close
|
||||
#define _read ::read
|
||||
#endif
|
||||
|
||||
//now that int64_t is defined, we can define this...
|
||||
#ifndef _CL_HAVE_FILELENGTH
|
||||
#undef fileSize
|
||||
#define fileSize lucene_filelength
|
||||
int64_t lucene_filelength(int handle);
|
||||
#endif
|
||||
|
||||
#elif !defined(_lucene_COMPILER_GCC3)
|
||||
#define _lucene_COMPILER_GCC3
|
||||
//third inclusion
|
||||
|
||||
#if !defined(__MINGW32__)
|
||||
//define replacements
|
||||
#define O_RANDOM 0
|
||||
#undef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#define _S_IREAD 0444
|
||||
#define _S_IWRITE 0333 // write and execute permissions
|
||||
|
||||
//some functions that are needed - not charset dependent and not tchar type functions
|
||||
#define _open open
|
||||
#define _sleep(x) usleep(x*1000) //_sleep should be in millis, usleep is in micros
|
||||
#define _write write
|
||||
#define _snprintf snprintf
|
||||
|
||||
//clucene uses ascii for filename interactions
|
||||
#define _realpath(rel,abs) realpath(rel,abs)
|
||||
#define _mkdir(x) mkdir(x,0777)
|
||||
#define _unlink unlink
|
||||
#else
|
||||
#define _realpath(rel,abs) _fullpath(abs,rel,CL_MAX_PATH)
|
||||
#endif
|
||||
//also required by mingw
|
||||
#define _rename rename
|
||||
#endif
|
||||
@@ -1,119 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#if !defined(_lucene_COMPILER_MSVC)
|
||||
#define _lucene_COMPILER_MSVC
|
||||
|
||||
// It is internal CLucene header - DO NOT include it directly
|
||||
|
||||
#include "CLucene/config/define_std.h"
|
||||
|
||||
#if (_MSC_VER >= 1300)
|
||||
//>= 7.0
|
||||
# pragma warning(disable: 4512) // This would be very annoying
|
||||
#define CL_NS_HASHING(func) stdext::func
|
||||
#define LUCENE_STATIC_CONSTANT_SYNTAX 1
|
||||
|
||||
#elif (_MSC_VER >= 1200)
|
||||
//6.0
|
||||
#ifdef LUCENE_ENABLE_MEMLEAKTRACKING
|
||||
#define _CLDELETE_CARRAY(x) if (x!=NULL){CL_NS(debug)::LuceneBase::__cl_voidpremove((void*)x,__FILE__,__LINE__);delete[] __CONST_CAST(TCHAR*,x); x=NULL;}
|
||||
#define _CLDELETE_CaARRAY(x) if (x!=NULL){CL_NS(debug)::LuceneBase::__cl_voidpremove((void*)x,__FILE__,__LINE__);delete[] __CONST_CAST(char*,x); x=NULL;}
|
||||
#define _CLDELETE_LCARRAY(x) if (x!=NULL){CL_NS(debug)::LuceneBase::__cl_voidpremove((void*)x,__FILE__,__LINE__);delete[] __CONST_CAST(TCHAR*,x);}
|
||||
#define _CLDELETE_LCaARRAY(x) if (x!=NULL){CL_NS(debug)::LuceneBase::__cl_voidpremove((void*)x,__FILE__,__LINE__);delete[] __CONST_CAST(char*,x);}
|
||||
#else
|
||||
#define _CLDELETE_CARRAY(x) if (x!=NULL){delete[] __CONST_CAST(TCHAR*,x); x=NULL;}
|
||||
#define _CLDELETE_CaARRAY(x) if (x!=NULL){delete[] __CONST_CAST(char*,x); x=NULL;}
|
||||
#define _CLDELETE_LCARRAY(x) if (x!=NULL){delete[] __CONST_CAST(TCHAR*,x);}
|
||||
#define _CLDELETE_LCaARRAY(x) if (x!=NULL){delete[] __CONST_CAST(char*,x);}
|
||||
|
||||
#endif
|
||||
#define LUCENE_STATIC_CONSTANT_SYNTAX 2
|
||||
|
||||
# pragma warning(disable: 4786) // This would be very annoying
|
||||
namespace std{
|
||||
# undef min // just in case
|
||||
# undef max // just in case
|
||||
|
||||
#define min(a,b) (a>b?b:a)
|
||||
#define max(a,b) (a>b?a:b)
|
||||
}
|
||||
|
||||
//only 7.0+ has these function
|
||||
#undef _CL_HAVE_LLTOA
|
||||
#undef _CL_HAVE_LLTOAW
|
||||
#undef _CL_HAVE_INTPTR_T
|
||||
#undef _CL_HAVE_WCSTOLL
|
||||
#undef _CL_HAVE_STRTOLL
|
||||
#undef _CL_HAVE_HASH_MAP
|
||||
#undef _CL_HAVE_HASH_SET
|
||||
|
||||
#else
|
||||
# error "This version of MSVC has not been tested. Please uncomment this line to try anyway. Please send a report to the Clucene's administration if successful"
|
||||
#endif
|
||||
|
||||
|
||||
#if _MSC_VER >= 1020
|
||||
#define _LUCENE_PRAGMA_ONCE
|
||||
#endif
|
||||
#define _LUCENE_PRAGMA_WARNINGS //tell lucene to display warnings using pragmas instead of #warning
|
||||
|
||||
//if we are compiling using single-threaded libraries, we can disable multi-threading stuff
|
||||
#if !defined(_MT) && !defined(_CL_DISABLE_MULTITHREADING)
|
||||
#define _CL_DISABLE_MULTITHREADING
|
||||
#endif
|
||||
|
||||
//msvc supports large files
|
||||
#ifdef _LARGE_FILES
|
||||
# define fileSize _filelengthi64
|
||||
# define fileSeek _lseeki64
|
||||
# define fileTell _telli64
|
||||
# define fileStat _stati64
|
||||
# define fileHandleStat _fstati64
|
||||
#else
|
||||
# define fileSize _filelength
|
||||
# define fileSeek _lseek
|
||||
# define fileTell _tell
|
||||
# define fileStat _stat
|
||||
# define fileHandleStat _fstat
|
||||
#endif
|
||||
|
||||
//_rename is not defined???
|
||||
#define _rename rename
|
||||
|
||||
#define CL_MAX_PATH 260 //give the windef.h value for this...
|
||||
#define _realpath(rel,abs) _fullpath(abs,rel,CL_MAX_PATH)
|
||||
|
||||
//java long type
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
//#define LUCENE_INT64_MAX _I64_MAX
|
||||
|
||||
//java int type
|
||||
typedef int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
//#define LUCENE_INT32_MAX INT_MAX
|
||||
|
||||
//java byte type
|
||||
typedef unsigned char uint8_t;
|
||||
//#define LUCENE_UINT8_MAX UCHAR_MAX
|
||||
|
||||
//floating point type
|
||||
typedef double float_t;
|
||||
|
||||
#define _CL_ILONG(x) x ## L
|
||||
#define _ILONGLONG(x) x ## i64
|
||||
|
||||
|
||||
#elif !defined(_lucene_COMPILER_MSVC2)
|
||||
#define _lucene_COMPILER_MSVC2
|
||||
//second inclusion
|
||||
|
||||
|
||||
#elif !defined(_lucene_COMPILER_MSVC3)
|
||||
#define _lucene_COMPILER_MSVC3
|
||||
//third inclusion
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
configdir = $(lsrcdir)/config
|
||||
confighdir = $(includedir)/CLucene/config
|
||||
|
||||
libclucene_la_SOURCES += $(configdir)/gunichartables.cpp
|
||||
libclucene_la_SOURCES += $(configdir)/repl_lltot.cpp
|
||||
libclucene_la_SOURCES += $(configdir)/repl_tcscasecmp.cpp
|
||||
libclucene_la_SOURCES += $(configdir)/repl_tcslwr.cpp
|
||||
libclucene_la_SOURCES += $(configdir)/repl_tcstod.cpp
|
||||
libclucene_la_SOURCES += $(configdir)/repl_tcstoll.cpp
|
||||
libclucene_la_SOURCES += $(configdir)/repl_tprintf.cpp
|
||||
libclucene_la_SOURCES += $(configdir)/threads.cpp
|
||||
libclucene_la_SOURCES += $(configdir)/utf8.cpp
|
||||
|
||||
configh_HEADERS = $(configdir)/*.h
|
||||
@@ -1,19 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
// It is internal CLucene header - DO NOT include it directly
|
||||
|
||||
# define PATH_DELIMITER _T("/")
|
||||
# define PATH_DELIMITERA "/"
|
||||
# define PATH_DELIMITERC '/'
|
||||
|
||||
# if (__GNUC__ < 3) && !defined( __APPLE_CC__)
|
||||
// GCC strange "ignore std" mode works better if you pretend everything
|
||||
// is in the std namespace, for the most part.
|
||||
# define LUCENE_NO_STDC_NAMESPACE
|
||||
# endif
|
||||
|
||||
#undef _T //apple has something else strange here...
|
||||
@@ -1,12 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
// It is internal CLucene header - DO NOT include it directly
|
||||
|
||||
# define PATH_DELIMITER _T("/")
|
||||
# define PATH_DELIMITERA "/"
|
||||
# define PATH_DELIMITERC '/'
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
// It is internal CLucene header - DO NOT include it directly
|
||||
|
||||
# define PATH_DELIMITER _T("\\")
|
||||
# define PATH_DELIMITERA "\\"
|
||||
# define PATH_DELIMITERC '\\'
|
||||
@@ -1,241 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#if !defined(lucene_compiler_h)
|
||||
#define lucene_compiler_h
|
||||
|
||||
#if defined(_MBCS) || defined(_ASCII)
|
||||
#undef _ASCII
|
||||
#undef _UCS2
|
||||
#define _ASCII
|
||||
#elif defined(_UNICODE)
|
||||
#define _UCS2
|
||||
#elif !defined(_UCS2)
|
||||
#define _UCS2
|
||||
#endif
|
||||
|
||||
//msvc needs unicode define so that it uses unicode library
|
||||
#ifdef _UCS2
|
||||
#undef _UNICODE
|
||||
#define _UNICODE
|
||||
#undef _ASCII
|
||||
#else
|
||||
#undef _UNICODE
|
||||
#undef _UCS2
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Figure out what compiler we are using
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__MWERKS__) && !defined (__ICL) && !defined (__COMO__)
|
||||
#define _CLCOMPILER_MSVC _MSC_VER
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__xlC__)
|
||||
#include "CLucene/config/CompilerGcc.h"
|
||||
|
||||
#elif defined(_CLCOMPILER_MSVC)
|
||||
/* Microsoft Visual C++ */
|
||||
#include "CLucene/config/CompilerMsvc.h"
|
||||
|
||||
#elif defined __BORLANDC__
|
||||
#include "CLucene/config/CompilerBcb.h"
|
||||
|
||||
#else
|
||||
//Unable to identify the compiler, issue error diagnostic.
|
||||
//Edit <CLucene/config/LuceneMycomp.h> to set STLport up for your compiler.
|
||||
//Uncomment this next line
|
||||
#error "Unable to identify the compiler, issue error diagnostic. Edit <CLucene/config/CompilerMycomp.h> to set Lucene up for your compiler."
|
||||
#include "CLucene/config/LuceneMycomp.h"
|
||||
#endif /* end of compiler choice */
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Now include platform specific definitions
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Operating system recognition (basic) */
|
||||
#if defined (__unix) || defined (__linux__) || defined (__QNX__) || defined (_AIX) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__Lynx__)
|
||||
#undef _UNIX
|
||||
#define _UNIX 1
|
||||
#include "CLucene/config/PlatformUnix.h"
|
||||
|
||||
#elif defined(macintosh) || defined (_MAC) || defined(__APPLE__)
|
||||
#undef _MAC
|
||||
#define _MAC 1
|
||||
#include "CLucene/config/PlatformMac.h"
|
||||
|
||||
#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__)
|
||||
#undef _WIN32
|
||||
#define _WIN32
|
||||
#include "CLucene/config/PlatformWin32.h"
|
||||
|
||||
#elif defined (__WIN16) || defined (WIN16) || defined (_WIN16)
|
||||
#undef _WIN16
|
||||
#define _WIN16
|
||||
#error "CLucene has not been tested on this platform. Please send a report to the lucene administrators if you are able to successfully compile"
|
||||
#else
|
||||
#error "CLucene could not identify the platform."
|
||||
#endif /* platforms */
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Now we take all that we have learnt, and define some things
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
//lets just say that we can always do unicode! :)
|
||||
#ifdef CL_CHARSET_GUESS
|
||||
#define _UCS2
|
||||
#endif
|
||||
|
||||
#if defined(_ASCII)
|
||||
#undef _UCS2
|
||||
#elif defined(_UCS2)
|
||||
#undef _ASCII
|
||||
#endif
|
||||
|
||||
#ifndef _LUCENE_NO_NEW_STYLE_CASTS
|
||||
#define __CONST_CAST(typ,var) const_cast<typ>(var)
|
||||
#define __REINTERPRET_CAST(typ,var) reinterpret_cast<typ>(var)
|
||||
#else
|
||||
#define __CONST_CAST(typ,var) ((typ)(var))
|
||||
#define __REINTERPRET_CAST,var) ((typ)(var))
|
||||
#endif
|
||||
|
||||
//cnd-debug exit command
|
||||
#ifndef debugFatalExit
|
||||
#define debugFatalExit(ret) exit(ret)
|
||||
#endif
|
||||
|
||||
#ifndef _CL_ILONG
|
||||
#define _CL_ILONG(x) x ## L
|
||||
#endif
|
||||
#ifndef _ILONGLONG
|
||||
#define _ILONGLONG(x) x ## LL
|
||||
#endif
|
||||
|
||||
//define whats the values of item intergers *should* be. we can check this in a test
|
||||
#define LUCENE_INT64_MAX_SHOULDBE _ILONGLONG(0x7FFFFFFFFFFFFFFF)
|
||||
#define LUCENE_INT32_MAX_SHOULDBE 0x7FFFFFFFL
|
||||
#define LUCENE_UINT8_MAX_SHOULDBE 0xff
|
||||
|
||||
//maximum path length. only used for buffers that use fullpath.
|
||||
//anything else should use a dynamic length.
|
||||
#if defined(CL_MAX_PATH)
|
||||
//do nothing...
|
||||
#elif defined(PATH_MAX)
|
||||
#define CL_MAX_PATH PATH_MAX
|
||||
#elif defined(MAX_PATH)
|
||||
#define CL_MAX_PATH MAX_PATH
|
||||
#elif defined(_MAX_PATH)
|
||||
#define CL_MAX_PATH _MAX_PATH
|
||||
#else
|
||||
#error "CL_MAX_PATH could not be determined"
|
||||
#endif
|
||||
|
||||
//this is the max filename... for now its just the same,
|
||||
//but this could change, so we use a different name
|
||||
#define CL_MAX_NAME CL_MAX_PATH
|
||||
//todo: this is a temporary fix for a potential buffer overflow...
|
||||
//should never use this
|
||||
#define CL_MAX_DIR CL_MAX_PATH*2
|
||||
|
||||
#ifdef _LARGE_FILES
|
||||
#define LUCENE_MAX_FILELENGTH LUCENE_INT64_MAX_SHOULDBE
|
||||
#else
|
||||
#define LUCENE_MAX_FILELENGTH LUCENE_INT32_MAX_SHOULDBE
|
||||
#endif
|
||||
|
||||
//use the LUCENE_STATIC_CONSTANT_SYNTAX to determine LUCENE_STATIC_CONSTANT
|
||||
#ifndef LUCENE_STATIC_CONSTANT
|
||||
//autoconf is not properly detecting the correct method for this, and since there's no real big
|
||||
//harm in always using an enum, we'll probably just make this the default.
|
||||
/*#if LUCENE_STATIC_CONSTANT_SYNTAX == 1
|
||||
#define LUCENE_STATIC_CONSTANT(type, assignment) static const type assignment
|
||||
#elif LUCENE_STATIC_CONSTANT_SYNTAX == 2*/
|
||||
#define LUCENE_STATIC_CONSTANT(type, assignment) enum { assignment }
|
||||
/*#else
|
||||
#error "LUCENE_STATIC_CONSTANT not defined, and/or LUCENE_STATIC_CONSTANT_SYNTAX is not defined to a valid value"
|
||||
#endif*/
|
||||
#endif
|
||||
|
||||
//end of lucene_compiler_h
|
||||
#elif !defined(lucene_compiler_h2)
|
||||
#define lucene_compiler_h2
|
||||
//here we include the compiler header again, this gives the header a
|
||||
//second chance at including stuff, after the main inclusions are complete
|
||||
|
||||
#if defined (__GNUC__) || defined(__SUNPRO_CC) || defined(__xlC__)
|
||||
#include "CLucene/config/CompilerGcc.h"
|
||||
|
||||
#elif defined(_CLCOMPILER_MSVC)
|
||||
/* Microsoft Visual C++ */
|
||||
#include "CLucene/config/CompilerMsvc.h"
|
||||
|
||||
#elif defined __BORLANDC__
|
||||
#include "CLucene/config/CompilerBcb.h"
|
||||
|
||||
#else
|
||||
//Unable to identify the compiler, issue error diagnostic.
|
||||
//Edit <CLucene/config/LuceneMycomp.h> to set STLport up for your compiler.
|
||||
//Uncomment this next line
|
||||
#error "Unable to identify the compiler, issue error diagnostic. Edit <CLucene/config/CompilerMycomp.h> to set Lucene up for your compiler."
|
||||
#include "CLucene/config/LuceneMycomp.h"
|
||||
#endif /* end of compiler choice */
|
||||
|
||||
#ifndef _CL_HAVE_FLOAT_T
|
||||
#ifdef _CL_HAVE_LONG_DOUBLE
|
||||
typedef long double float_t; /* `float' expressions are evaluated as `long double'. */
|
||||
#else
|
||||
typedef double float_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*todo: but need to define SIZEOF_VOID_P #if (SIZEOF_VOID_P > 4 && SIZEOF_VOID_P <= 8)
|
||||
#ifndef _CL_HAVE_INTPTR_T
|
||||
typedef int64_t intptr_t;
|
||||
#endif
|
||||
#elif (SIZEOF_VOID_P > 2 && SIZEOF_VOID_P <= 4)
|
||||
#ifndef _CL_HAVE_INTPTR_T
|
||||
typedef int32_t intptr_t;
|
||||
#endif
|
||||
#else
|
||||
#error "void * is either >8 bytes or <= 2. In either case, I am confused."
|
||||
#endif*/
|
||||
#ifndef _CL_HAVE_INTPTR_T
|
||||
typedef int64_t intptr_t;
|
||||
#endif
|
||||
|
||||
//end of lucene_compiler_h2
|
||||
#elif !defined(lucene_compiler_h3)
|
||||
#define lucene_compiler_h3
|
||||
//here we include the compiler header again, this gives the header a
|
||||
//third chance at including stuff, after the main inclusions are complete
|
||||
|
||||
#if defined (__GNUC__ ) || defined(__SUNPRO_CC) || defined(__xlC__)
|
||||
#include "CLucene/config/CompilerGcc.h"
|
||||
|
||||
#elif defined(_CLCOMPILER_MSVC)
|
||||
/* Microsoft Visual C++ */
|
||||
#include "CLucene/config/CompilerMsvc.h"
|
||||
|
||||
#elif defined __BORLANDC__
|
||||
#include "CLucene/config/CompilerBcb.h"
|
||||
|
||||
#else
|
||||
//Unable to identify the compiler, issue error diagnostic.
|
||||
//Edit <CLucene/config/LuceneMycomp.h> to set STLport up for your compiler.
|
||||
//Uncomment this next line
|
||||
#error "Unable to identify the compiler, issue error diagnostic. Edit <CLucene/config/CompilerMycomp.h> to set Lucene up for your compiler."
|
||||
#include "CLucene/config/LuceneMycomp.h"
|
||||
#endif /* end of compiler choice */
|
||||
|
||||
#endif
|
||||
@@ -1,110 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef lucene_define_std
|
||||
#define lucene_define_std
|
||||
//define a standard list of defines.
|
||||
//These defines represents a fairly complete compiler.
|
||||
//Of course it is preferable to use the autoconf generated
|
||||
//list, but then not all systems can do this :)
|
||||
|
||||
//we support long files - 64 bit file functions
|
||||
#define _LARGE_FILES
|
||||
|
||||
//support namespaces
|
||||
#define _CL_HAVE_NAMESPACES
|
||||
|
||||
//support try/catch blocks
|
||||
#define _CL_HAVE_FUNCTION_TRY_BLOCKS
|
||||
|
||||
//the normal headers
|
||||
#define _CL_STDC_HEADERS
|
||||
#define _CL_HAVE_STDARG_H
|
||||
#define _CL_HAVE_ALGORITHM
|
||||
#define _CL_HAVE_FUNCTIONAL
|
||||
#define _CL_HAVE_MATH_H
|
||||
#define _CL_HAVE_STL
|
||||
#define _CL_HAVE_HASH_MAP
|
||||
#define _CL_HAVE_HASH_SET
|
||||
#define _CL_HAVE_MAP
|
||||
#define _CL_HAVE_SET
|
||||
#define _CL_HAVE_LIST
|
||||
#define _CL_HAVE_VECTOR
|
||||
#define _CL_HAVE_STDEXCEPT
|
||||
#define _CL_HAVE_ERRNO_H
|
||||
#define _CL_HAVE_SYS_STAT_H
|
||||
#define _CL_HAVE_FCNTL_H
|
||||
|
||||
//character & std tchar support
|
||||
#define _CL_HAVE_TCHAR_H
|
||||
#ifdef _UCS2
|
||||
#define _CL_HAVE_WCTYPE_H
|
||||
|
||||
#define _CL_HAVE_WCSCPY
|
||||
#define _CL_HAVE_WCSNCPY
|
||||
#define _CL_HAVE_WCSCAT
|
||||
#define _CL_HAVE_WCSCHR
|
||||
#define _CL_HAVE_WCSSTR
|
||||
#define _CL_HAVE_WCSLEN
|
||||
#define _CL_HAVE_WCSCMP
|
||||
#define _CL_HAVE_WCSNCMP
|
||||
#define _CL_HAVE_WCSCSPN
|
||||
#else
|
||||
#define _CL_HAVE_CTYPE_H
|
||||
#endif
|
||||
|
||||
//already have the normal structures
|
||||
#define _CL_HAVE_FLOAT_T
|
||||
#define _CL_HAVE_INTPTR_T
|
||||
|
||||
//system dependant:
|
||||
#define _CL_HAVE_STRING_H //could be HAVE_STRINGS_H && HAVE_STRCHR
|
||||
#define _CL_HAVE_SYS_TIMEB_H
|
||||
#define _CL_HAVE_TIME_H
|
||||
|
||||
#if defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__)
|
||||
#define _CL_HAVE_IO_H
|
||||
#define _CL_HAVE_DIRECT_H
|
||||
#define _CL_HAVE_WINDOWS_H
|
||||
#else
|
||||
#define _CL_HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////
|
||||
//now for individual functions. some compilers
|
||||
//miss these, so must individually define what
|
||||
//we have
|
||||
////////////////////////////////////////////////
|
||||
|
||||
//string functions
|
||||
#define _CL_HAVE_STRLWR
|
||||
#define _CL_HAVE_WCSLWR
|
||||
#define _CL_HAVE_WCSCASECMP
|
||||
#define _CL_HAVE_STRCASECMP
|
||||
|
||||
//formatting functions
|
||||
#define _CL_HAVE_SNWPRINTF
|
||||
#define _CL_HAVE_VSNWPRINTF
|
||||
#define _CL_HAVE_WPRINTF
|
||||
#define _CL_HAVE_SNPRINTF
|
||||
#define _CL_HAVE_PRINTF
|
||||
|
||||
|
||||
//conversion functions
|
||||
#define _CL_HAVE_STRTOLL
|
||||
#define _CL_HAVE_WCSTOLL
|
||||
#define _CL_HAVE_WCSTOD
|
||||
#define _CL_HAVE_LLTOA
|
||||
#define _CL_HAVE_LLTOW
|
||||
#define _CL_HAVE_INTPTR_T
|
||||
|
||||
//these ones are not standard (msvc)
|
||||
//so you will probably need to undefine
|
||||
//if you are not using msvc
|
||||
#define _CL_HAVE_FILELENGTH
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,383 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 1999 Tom Tromey
|
||||
* Copyright (C) 2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*
|
||||
************************************************
|
||||
* Also licensed with permission from Tom Tromey
|
||||
* and Owen Taylor under the Apache license.
|
||||
* Original location:
|
||||
* http://cvs.gnome.org/viewcvs/glib/glib/guniprop.c?view=log
|
||||
************************************************
|
||||
*
|
||||
* Copyright 2003-2006 The Apache Software Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
typedef unsigned long gunichar;
|
||||
typedef unsigned short guint16;
|
||||
typedef short gint16;
|
||||
typedef char gchar;
|
||||
typedef unsigned char guchar;
|
||||
|
||||
/* These are the possible character classifications.
|
||||
* See http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
|
||||
or http://www.unicode.org/Public/UNIDATA/UCD.html.
|
||||
|
||||
todo: i think there is a new version of the unicode, which we should use.
|
||||
data is licensed like this: http://www.unicode.org/copyright.html... not sure but looks apache compatible
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
G_UNICODE_CONTROL,
|
||||
G_UNICODE_FORMAT,
|
||||
G_UNICODE_UNASSIGNED,
|
||||
G_UNICODE_PRIVATE_USE,
|
||||
G_UNICODE_SURROGATE,
|
||||
G_UNICODE_LOWERCASE_LETTER,
|
||||
G_UNICODE_MODIFIER_LETTER,
|
||||
G_UNICODE_OTHER_LETTER,
|
||||
G_UNICODE_TITLECASE_LETTER,
|
||||
G_UNICODE_UPPERCASE_LETTER,
|
||||
G_UNICODE_COMBINING_MARK,
|
||||
G_UNICODE_ENCLOSING_MARK,
|
||||
G_UNICODE_NON_SPACING_MARK,
|
||||
G_UNICODE_DECIMAL_NUMBER,
|
||||
G_UNICODE_LETTER_NUMBER,
|
||||
G_UNICODE_OTHER_NUMBER,
|
||||
G_UNICODE_CONNECT_PUNCTUATION,
|
||||
G_UNICODE_DASH_PUNCTUATION,
|
||||
G_UNICODE_CLOSE_PUNCTUATION,
|
||||
G_UNICODE_FINAL_PUNCTUATION,
|
||||
G_UNICODE_INITIAL_PUNCTUATION,
|
||||
G_UNICODE_OTHER_PUNCTUATION,
|
||||
G_UNICODE_OPEN_PUNCTUATION,
|
||||
G_UNICODE_CURRENCY_SYMBOL,
|
||||
G_UNICODE_MODIFIER_SYMBOL,
|
||||
G_UNICODE_MATH_SYMBOL,
|
||||
G_UNICODE_OTHER_SYMBOL,
|
||||
G_UNICODE_LINE_SEPARATOR,
|
||||
G_UNICODE_PARAGRAPH_SEPARATOR,
|
||||
G_UNICODE_SPACE_SEPARATOR
|
||||
} GUnicodeType;
|
||||
|
||||
|
||||
#include "gunichartables.h"
|
||||
|
||||
#define ATTR_TABLE(Page) (((Page) <= G_UNICODE_LAST_PAGE_PART1) \
|
||||
? attr_table_part1[Page] \
|
||||
: attr_table_part2[(Page) - 0xe00])
|
||||
|
||||
#define ATTTABLE(Page, Char) \
|
||||
((ATTR_TABLE(Page) == G_UNICODE_MAX_TABLE_INDEX) ? 0 : (attr_data[ATTR_TABLE(Page)][Char]))
|
||||
|
||||
|
||||
#define TTYPE_PART1(Page, Char) \
|
||||
((type_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX) \
|
||||
? (type_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX) \
|
||||
: (type_data[type_table_part1[Page]][Char]))
|
||||
|
||||
#define TTYPE_PART2(Page, Char) \
|
||||
((type_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX) \
|
||||
? (type_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX) \
|
||||
: (type_data[type_table_part2[Page]][Char]))
|
||||
|
||||
#define TYPE(Char) \
|
||||
(((Char) <= G_UNICODE_LAST_CHAR_PART1) \
|
||||
? TTYPE_PART1 ((Char) >> 8, (Char) & 0xff) \
|
||||
: (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR) \
|
||||
? TTYPE_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff) \
|
||||
: G_UNICODE_UNASSIGNED))
|
||||
|
||||
/* Count the number of elements in an array. The array must be defined
|
||||
* as such; using this with a dynamically allocated array will give
|
||||
* incorrect results.
|
||||
*/
|
||||
#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(LUCENE_USE_INTERNAL_CHAR_FUNCTIONS)
|
||||
#ifdef _LUCENE_PRAGMA_WARNINGS
|
||||
#pragma message ("===== Using internal character function =====")
|
||||
#else
|
||||
#warning "===== Using internal character function ====="
|
||||
#endif
|
||||
|
||||
bool cl_isletter(TCHAR ch)
|
||||
{
|
||||
gunichar c=ch;
|
||||
int t = TYPE ((gunichar)c);
|
||||
switch(t)
|
||||
{
|
||||
case G_UNICODE_LOWERCASE_LETTER: return true;
|
||||
case G_UNICODE_TITLECASE_LETTER: return true;
|
||||
case G_UNICODE_UPPERCASE_LETTER: return true;
|
||||
case G_UNICODE_MODIFIER_LETTER: return true;
|
||||
case G_UNICODE_OTHER_LETTER: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool cl_isalnum(TCHAR ch)
|
||||
{
|
||||
gunichar c=ch;
|
||||
int t = TYPE (c);
|
||||
switch(t)
|
||||
{
|
||||
case G_UNICODE_LOWERCASE_LETTER: return true;
|
||||
case G_UNICODE_TITLECASE_LETTER: return true;
|
||||
case G_UNICODE_UPPERCASE_LETTER: return true;
|
||||
case G_UNICODE_MODIFIER_LETTER: return true;
|
||||
case G_UNICODE_OTHER_LETTER: return true;
|
||||
case G_UNICODE_DECIMAL_NUMBER: return true;
|
||||
case G_UNICODE_LETTER_NUMBER: return true;
|
||||
case G_UNICODE_OTHER_NUMBER: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool cl_isdigit(TCHAR ch)
|
||||
{
|
||||
gunichar c=ch;
|
||||
int t = TYPE ((gunichar)c);
|
||||
switch(t)
|
||||
{
|
||||
case G_UNICODE_DECIMAL_NUMBER: return true;
|
||||
case G_UNICODE_LETTER_NUMBER: return true;
|
||||
case G_UNICODE_OTHER_NUMBER: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* cl_isspace:
|
||||
* @c: a Unicode character
|
||||
*
|
||||
* Determines whether a character is a space, tab, or line separator
|
||||
* (newline, carriage return, etc.). Given some UTF-8 text, obtain a
|
||||
* character value with lucene_utf8towc().
|
||||
*
|
||||
* (Note: don't use this to do word breaking; you have to use
|
||||
* Pango or equivalent to get word breaking right, the algorithm
|
||||
* is fairly complex.)
|
||||
*
|
||||
* Return value: %TRUE if @c is a punctuation character
|
||||
**/
|
||||
bool cl_isspace (TCHAR ch)
|
||||
{
|
||||
gunichar c=ch;
|
||||
switch (c)
|
||||
{
|
||||
/* special-case these since Unicode thinks they are not spaces */
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\f':
|
||||
return true;
|
||||
|
||||
default:
|
||||
{
|
||||
int t = TYPE ((gunichar)c);
|
||||
return (t == G_UNICODE_SPACE_SEPARATOR || t == G_UNICODE_LINE_SEPARATOR
|
||||
|| t == G_UNICODE_PARAGRAPH_SEPARATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* cl_tolower:
|
||||
* @c: a Unicode character.
|
||||
*
|
||||
* Converts a character to lower case.
|
||||
*
|
||||
* Return value: the result of converting @c to lower case.
|
||||
* If @c is not an upperlower or titlecase character,
|
||||
* or has no lowercase equivalent @c is returned unchanged.
|
||||
**/
|
||||
TCHAR cl_tolower (TCHAR ch)
|
||||
{
|
||||
gunichar c=ch;
|
||||
int t = TYPE ((gunichar)c);
|
||||
if (t == G_UNICODE_UPPERCASE_LETTER)
|
||||
{
|
||||
gunichar val = ATTTABLE (c >> 8, c & 0xff);
|
||||
if (val >= 0x1000000)
|
||||
{
|
||||
const gchar *p = special_case_table + val - 0x1000000;
|
||||
int len=0;
|
||||
wchar_t ret=0;
|
||||
lucene_utf8towc(&ret,p,6);
|
||||
#ifdef _UCS2
|
||||
return ret;
|
||||
#else
|
||||
return LUCENE_OOR_CHAR(ret);
|
||||
#endif
|
||||
//return cl_utf8_get_char (p, &len);
|
||||
}else
|
||||
return val ? val : c;
|
||||
}else if (t == G_UNICODE_TITLECASE_LETTER){
|
||||
unsigned int i;
|
||||
for (i = 0; i < G_N_ELEMENTS (title_table); ++i)
|
||||
{
|
||||
if (title_table[i][0] == c)
|
||||
return title_table[i][2];
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* cl_toupper:
|
||||
* @c: a Unicode character
|
||||
*
|
||||
* Converts a character to uppercase.
|
||||
*
|
||||
* Return value: the result of converting @c to uppercase.
|
||||
* If @c is not an lowercase or titlecase character,
|
||||
* or has no upper case equivalent @c is returned unchanged.
|
||||
**/
|
||||
TCHAR cl_toupper (TCHAR ch)
|
||||
{
|
||||
gunichar c=ch;
|
||||
int t = TYPE (c);
|
||||
if (t == G_UNICODE_LOWERCASE_LETTER)
|
||||
{
|
||||
gunichar val = ATTTABLE (c >> 8, c & 0xff);
|
||||
if (val >= 0x1000000)
|
||||
{
|
||||
const gchar *p = special_case_table + val - 0x1000000;
|
||||
|
||||
wchar_t ret=0;
|
||||
lucene_utf8towc(&ret,p,6);
|
||||
#ifdef _UCS2
|
||||
return ret;
|
||||
#else
|
||||
return LUCENE_OOR_CHAR(ret);
|
||||
#endif
|
||||
//return lucene_utf8towc (p);
|
||||
}
|
||||
else
|
||||
return val ? val : c;
|
||||
}
|
||||
else if (t == G_UNICODE_TITLECASE_LETTER)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < G_N_ELEMENTS (title_table); ++i)
|
||||
{
|
||||
if (title_table[i][0] == c)
|
||||
return title_table[i][1];
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* cl_tcasefold:
|
||||
* @str: a unicode string
|
||||
*
|
||||
* Converts a string into a form that is independent of case. The
|
||||
* result will not correspond to any particular case, but can be
|
||||
* compared for equality or ordered with the results of calling
|
||||
* cl_tcasefold() on other strings.
|
||||
*
|
||||
* Note that calling cl_tcasefold() followed by g_utf8_collate() is
|
||||
* only an approximation to the correct linguistic case insensitive
|
||||
* ordering, though it is a fairly good one. Getting this exactly
|
||||
* right would require a more sophisticated collation function that
|
||||
* takes case sensitivity into account. GLib does not currently
|
||||
* provide such a function.
|
||||
*
|
||||
* Return value: a newly allocated string, that is a
|
||||
* case independent form of @str.
|
||||
**/
|
||||
TCHAR cl_tcasefold(const TCHAR ch){
|
||||
int start = 0;
|
||||
int end = G_N_ELEMENTS (casefold_table);
|
||||
|
||||
if (ch >= casefold_table[start].ch &&
|
||||
ch <= casefold_table[end - 1].ch)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
int half = (start + end) / 2;
|
||||
if (ch == casefold_table[half].ch)
|
||||
{
|
||||
wchar_t ret=0;
|
||||
lucene_utf8towc(&ret,casefold_table[half].data,6);
|
||||
|
||||
#ifdef _UCS2
|
||||
return ret;
|
||||
#else
|
||||
LUCENE_OOR_CHAR(ret)
|
||||
#endif
|
||||
}else if (half == start){
|
||||
break;
|
||||
}else if (ch > casefold_table[half].ch){
|
||||
start = half;
|
||||
}else{
|
||||
end = half;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cl_tolower(ch);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//this function was not taken from gnome
|
||||
TCHAR* cl_tcscasefold( TCHAR * str, int len ) //len default is -1
|
||||
{
|
||||
TCHAR *p = str;
|
||||
while ((len < 0 || p < str + len) && *p)
|
||||
{
|
||||
*p = cl_tcasefold(*p);
|
||||
p++;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
//this function was not taken from gnome
|
||||
int cl_tcscasefoldcmp(const TCHAR * dst, const TCHAR * src){
|
||||
TCHAR f,l;
|
||||
|
||||
do{
|
||||
f = cl_tcasefold( (*(dst++)) );
|
||||
l = cl_tcasefold( (*(src++)) );
|
||||
} while ( (f) && (f == l) );
|
||||
|
||||
return (int)(f - l);
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,47 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
TCHAR* lucene_i64tot(
|
||||
int64_t value, /* [I] Value to be converted */
|
||||
TCHAR* str, /* [O] Destination for the converted value */
|
||||
int radix) /* [I] Number base for conversion */
|
||||
{
|
||||
uint64_t val;
|
||||
int negative;
|
||||
TCHAR buffer[65];
|
||||
TCHAR* pos;
|
||||
int digit;
|
||||
|
||||
if (value < 0 && radix == 10) {
|
||||
negative = 1;
|
||||
val = -value;
|
||||
} else {
|
||||
negative = 0;
|
||||
val = value;
|
||||
} /* if */
|
||||
|
||||
pos = &buffer[64];
|
||||
*pos = '\0';
|
||||
|
||||
do {
|
||||
digit = val % radix;
|
||||
val = val / radix;
|
||||
if (digit < 10) {
|
||||
*--pos = '0' + digit;
|
||||
} else {
|
||||
*--pos = 'a' + digit - 10;
|
||||
} /* if */
|
||||
} while (val != 0L);
|
||||
|
||||
if (negative) {
|
||||
*--pos = '-';
|
||||
} /* if */
|
||||
|
||||
_tcsncpy(str,pos,&buffer[64] - pos + 1); //needed for unicode to work
|
||||
return str;
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _CL_HAVE_TCHAR_H
|
||||
#if defined(_UCS2)
|
||||
#define TCHAR wchar_t
|
||||
|
||||
//note: descriptions with * in front have replacement functions
|
||||
|
||||
//formatting functions
|
||||
#define _sntprintf swprintf //* make a formatted a string
|
||||
#define _tprintf wprintf //* print a formatted string
|
||||
|
||||
//this one has no replacement functions yet, but it is only used in the tests
|
||||
#define _vsntprintf vsnwprintf //* print a formatted string using variable arguments
|
||||
|
||||
//we are using the internal functions of the compiler here
|
||||
//if LUCENE_USE_INTERNAL_CHAR_FUNCTIONS is defined, thesse
|
||||
//will be replaced by internal functions
|
||||
#define _istalnum iswalnum //* alpha/numeric char check
|
||||
#define _istalpha iswalpha //* alpha char check
|
||||
#define _istspace iswspace //* space char check
|
||||
#define _istdigit iswdigit //* digit char check
|
||||
#define _totlower towlower //* convert char to lower case
|
||||
#define _totupper towupper //* convert char to lower case
|
||||
#define _tcslwr wcslwr //* convert string to lower case
|
||||
|
||||
//these are the string handling functions
|
||||
//we may need to create wide-character/multi-byte replacements for these
|
||||
#define _tcscpy wcscpy //copy a string to another string
|
||||
#define _tcsncpy wcsncpy //copy a specified amount of one string to another string.
|
||||
#define _tcscat wcscat //copy a string onto the end of the other string
|
||||
#define _tcschr wcschr //find location of one character
|
||||
#define _tcsstr wcsstr //find location of a string
|
||||
#define _tcslen wcslen //get length of a string
|
||||
#define _tcscmp wcscmp //case sensitive compare two strings
|
||||
#define _tcsncmp wcsncmp //case sensitive compare two strings
|
||||
#define _tcscspn wcscspn //location of any of a set of character in a string
|
||||
|
||||
#ifdef _CL_HAVE_WCSICMP
|
||||
#define _tcsicmp wcsicmp //* case insensitive compare two string
|
||||
#else
|
||||
#define _tcsicmp wcscasecmp //* case insensitive compare two string
|
||||
#endif
|
||||
|
||||
//conversion functions
|
||||
#define _tcstod wcstod //convert a string to a double
|
||||
#define _tcstoi64 wcstoll //* convers a string to an 64bit bit integer
|
||||
#define _i64tot lltow //* converts a 64 bit integer to a string (with base)
|
||||
|
||||
#else //if defined(_ASCII)
|
||||
#define TCHAR char
|
||||
|
||||
//formatting functions
|
||||
#define _sntprintf snprintf
|
||||
#define _tprintf printf
|
||||
#define _vsntprintf vsnprintf
|
||||
|
||||
//we are using the internal functions of the compiler here
|
||||
//if LUCENE_USE_INTERNAL_CHAR_FUNCTIONS is defined, thesse
|
||||
//will be replaced by internal functions
|
||||
#define _istalnum isalnum
|
||||
#define _istalpha isalpha
|
||||
#define _istspace isspace
|
||||
#define _istdigit isdigit
|
||||
#define _totlower tolower
|
||||
#define _totupper toupper
|
||||
#define _tcslwr strlwr
|
||||
|
||||
//these are the string handling functions
|
||||
#define _tcscpy strcpy
|
||||
#define _tcsncpy strncpy
|
||||
#define _tcscat strcat
|
||||
#define _tcschr strchr
|
||||
#define _tcsstr strstr
|
||||
#define _tcslen strlen
|
||||
#define _tcscmp strcmp
|
||||
#define _tcsncmp strncmp
|
||||
#define _tcsicmp strcasecmp
|
||||
#define _tcscspn strcspn
|
||||
|
||||
//converstion methods
|
||||
#define _tcstod strtod
|
||||
#define _tcstoi64 strtoll
|
||||
#define _i64tot lltoa
|
||||
#endif
|
||||
#else //HAVE_TCHAR_H
|
||||
#include <tchar.h>
|
||||
|
||||
//some tchar headers miss these...
|
||||
#ifndef _tcstoi64
|
||||
#if defined(_UCS2)
|
||||
#define _tcstoi64 wcstoll //* convers a string to an 64bit bit integer
|
||||
#else
|
||||
#define _tcstoi64 strtoll
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif //HAVE_TCHAR_H
|
||||
@@ -1,21 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
int lucene_tcscasecmp(const TCHAR * sa, const TCHAR * sb){
|
||||
TCHAR ca,cb;
|
||||
if (sa == sb)
|
||||
return 0;
|
||||
|
||||
do{
|
||||
ca = _totlower( (*(sa++)) );
|
||||
cb = _totlower( (*(sb++)) );
|
||||
} while ( ca != L'\0' && (ca == cb) );
|
||||
|
||||
return (int)(ca - cb);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
TCHAR* lucene_tcslwr( TCHAR* str )
|
||||
{
|
||||
TCHAR* ret = str;
|
||||
for ( ; *str; str++) *str = _totlower(*str);
|
||||
return ret;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
#ifndef _ASCII
|
||||
double lucene_tcstod(const TCHAR *value, TCHAR **end){
|
||||
int32_t len = _tcslen(value)+1;
|
||||
char* avalue=_CL_NEWARRAY(char,len);
|
||||
char* aend=NULL;
|
||||
STRCPY_TtoA(avalue,value,len);
|
||||
|
||||
double ret = strtod(avalue,&aend);
|
||||
*end=(TCHAR*)value+(aend-avalue);
|
||||
_CLDELETE_CaARRAY(avalue);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
int64_t lucene_tcstoi64(const TCHAR* str, TCHAR**end, int radix){
|
||||
#define LUCENE_TCSTOI64_RADIX(x,r) ((x>=_T('0') && x<=_T('9'))?x-_T('0'):((x>=_T('a') && x<=_T('z'))?x-_T('a')+10:((x>=_T('A') && x<=_T('Z'))?x-_T('A')+10:1000)))
|
||||
|
||||
if (radix < 2 || radix > 36)
|
||||
return 0;
|
||||
|
||||
/* Skip white space. */
|
||||
while (_istspace (*str))
|
||||
++str;
|
||||
|
||||
int sign=1;
|
||||
if ( str[0] == _T('+') )
|
||||
str++;
|
||||
else if ( str[0] == _T('-') ){
|
||||
sign = -1;
|
||||
str++;
|
||||
}
|
||||
|
||||
*end=(TCHAR*)str;
|
||||
long r = -1;
|
||||
while ( (r=LUCENE_TCSTOI64_RADIX(*end[0],radix)) >=0 && r<radix )
|
||||
(*end)++;
|
||||
|
||||
TCHAR* p = (*end)-1;
|
||||
int64_t ret = 0;
|
||||
int pos = 0;
|
||||
for ( ;p>=str;p-- ){
|
||||
int i=LUCENE_TCSTOI64_RADIX(p[0],radix);
|
||||
if ( pos == 0 )
|
||||
ret=i;
|
||||
else
|
||||
ret += (int64_t)pow((float_t)radix,(float_t)pos) * i; //todo: might be quicker with a different pow overload
|
||||
|
||||
pos++;
|
||||
}
|
||||
return sign*ret;
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "CLucene/util/StringBuffer.h"
|
||||
|
||||
#ifdef __CL_INCLUDE_TPRINTF
|
||||
|
||||
CL_NS_USE(util)
|
||||
|
||||
//print a variable argument to a stream
|
||||
//currently special number formatting is not supported. it is very minimalistic
|
||||
void lucene_vfnwprintf(StringBuffer* buffer, size_t count, const wchar_t * format, va_list& valist){
|
||||
const wchar_t *iter = format;
|
||||
StringBuffer* tmp = NULL;
|
||||
if ( buffer == NULL )
|
||||
tmp = _CLNEW StringBuffer;
|
||||
else
|
||||
tmp = buffer;
|
||||
|
||||
while (*iter)
|
||||
{
|
||||
while (*iter && *iter != '%')
|
||||
{
|
||||
tmp->appendChar(*iter++);
|
||||
}
|
||||
if (*iter == '%')
|
||||
{
|
||||
if (iter[1] == '%')
|
||||
{
|
||||
//just print a %
|
||||
tmp->appendChar('%');
|
||||
iter += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
iter++;
|
||||
switch (*iter)
|
||||
{
|
||||
case 's':
|
||||
{
|
||||
//todo: this is faulty. it doesn't heed count
|
||||
|
||||
//print a string or null
|
||||
TCHAR *wstr = va_arg(valist, TCHAR *);
|
||||
if ( !wstr )
|
||||
wstr = _T("(null)");
|
||||
|
||||
tmp->append(wstr);
|
||||
iter++;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c':
|
||||
tmp->appendChar((TCHAR)va_arg(valist, int));
|
||||
iter++;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
//todo: this is faulty. it doesn't heed count
|
||||
|
||||
if (*iter == 'p')
|
||||
tmp->appendInt((int32_t)va_arg(valist, long));
|
||||
else
|
||||
{
|
||||
if (*iter == 'a' || *iter == 'A' ||
|
||||
*iter == 'e' || *iter == 'E' ||
|
||||
*iter == 'f' || *iter == 'F' ||
|
||||
*iter == 'g' || *iter == 'G')
|
||||
tmp->appendFloat((float_t)va_arg(valist, double),8);
|
||||
else if (*iter == 'd' || *iter == 'i' ){
|
||||
tmp->appendInt((int32_t)va_arg(valist, int));
|
||||
}else if (*iter == 'l' ){
|
||||
TCHAR b[100];
|
||||
_i64tot((int64_t)va_arg(valist, int64_t),b,10);
|
||||
tmp->append(b);
|
||||
}/*else{
|
||||
TCHAR b[100];
|
||||
_i64tot((int64_t)va_arg(valist, void*),b,10);
|
||||
tmp->append(b);
|
||||
}*/
|
||||
}
|
||||
iter++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( buffer == NULL ){
|
||||
//we are supposed to be writing to the console
|
||||
#ifdef _UCS2
|
||||
TCHAR* pointer = tmp->getBuffer();
|
||||
char ob[MB_LEN_MAX];
|
||||
size_t v;
|
||||
size_t len = tmp->length();
|
||||
for (size_t i=0;i<len;i++){
|
||||
v = wctomb(ob,*pointer);
|
||||
if ( v > 0 ){
|
||||
ob[v]='\0';
|
||||
fputs(ob,stdout);
|
||||
}
|
||||
pointer++;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
fputs(tmp->getBuffer(),stdout);
|
||||
#endif
|
||||
_CLDELETE(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
//print a list of arguments to a string
|
||||
int lucene_snwprintf(wchar_t* strbuf, size_t count, const wchar_t * format, ...){
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
StringBuffer buffer;
|
||||
lucene_vfnwprintf(&buffer,count,format,ap);
|
||||
va_end(ap);
|
||||
|
||||
int ret = min((int32_t)count,buffer.length());
|
||||
_tcsncpy(strbuf,buffer.getBuffer(),ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//print a list of arguments to the stdout
|
||||
void lucene_wprintf(const wchar_t * format, ...){
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
lucene_vfnwprintf(NULL,LUCENE_INT32_MAX_SHOULDBE,format,ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
//print a variable argument to a string
|
||||
int lucene_vsnwprintf(wchar_t * strbuf, size_t count, const wchar_t * format, va_list& ap){
|
||||
StringBuffer buffer;
|
||||
lucene_vfnwprintf(&buffer,count,format,ap);
|
||||
int ret = min((int32_t)count,buffer.length());
|
||||
_tcsncpy(strbuf,buffer.getBuffer(),ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif //__CL_INCLUDE_TPRINTF
|
||||
@@ -1,121 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_repl_wchar_h
|
||||
#define _lucene_repl_wchar_h
|
||||
|
||||
#ifdef _UCS2
|
||||
|
||||
#ifndef _CL_HAVE_WCSCPY
|
||||
//copy a string to another string
|
||||
#error wcscpy is not defined, and a licensed replacement has not been written yet
|
||||
#endif
|
||||
|
||||
#ifndef _CL_HAVE_WCSNCPY
|
||||
//copy a specified amount of one string to another string.
|
||||
#error wcsncpy is not defined, and a licensed replacement has not been written yet
|
||||
#endif
|
||||
|
||||
#ifndef _CL_HAVE_WCSCAT
|
||||
//copy a string onto the end of the other string
|
||||
#error wcscat is not defined, and a licensed replacement has not been written yet
|
||||
#endif
|
||||
|
||||
#ifndef _CL_HAVE_WCSCHR
|
||||
//find location of one character
|
||||
#error wcschr is not defined, and a licensed replacement has not been written yet
|
||||
#endif
|
||||
|
||||
#ifndef _CL_HAVE_WCSSTR
|
||||
//find location of a string
|
||||
#error wcspy is not defined, and a licensed replacement has not been written yet
|
||||
#endif
|
||||
|
||||
#ifndef _CL_HAVE_WCSLEN
|
||||
//get length of a string
|
||||
#error wcslen is not defined, and a licensed replacement has not been written yet
|
||||
#endif
|
||||
|
||||
#ifndef _CL_HAVE_WCSCMP
|
||||
//case sensitive compare two strings
|
||||
#error wcscmp is not defined, and a licensed replacement has not been written yet
|
||||
#endif
|
||||
|
||||
#ifndef _CL_HAVE_WCSNCMP
|
||||
//case sensitive compare two strings of a specified length
|
||||
#error wcsncmp is not defined, and a licensed replacement has not been written yet
|
||||
#endif
|
||||
|
||||
#ifndef _CL_HAVE_WCSCSPN
|
||||
//Return the length of the maximum initial segment
|
||||
//of WCS which contains only wide-characters not in REJECT.
|
||||
#error wcscspn is not defined, and a licensed replacement has not been written yet
|
||||
#endif
|
||||
|
||||
#endif //_UCS2
|
||||
|
||||
//string function replacements
|
||||
#if defined(LUCENE_USE_INTERNAL_CHAR_FUNCTIONS) || (defined(_UCS2) && !defined(_CL_HAVE_WCSCASECMP)) || (defined(_ASCII) && !defined(_CL_HAVE_STRCASECMP))
|
||||
int lucene_tcscasecmp(const TCHAR *, const TCHAR *);
|
||||
#undef _tcsicmp
|
||||
#define _tcsicmp lucene_tcscasecmp
|
||||
#endif
|
||||
#if defined(LUCENE_USE_INTERNAL_CHAR_FUNCTIONS) || (defined(_UCS2) && !defined(_CL_HAVE_WCSLWR)) || (defined(_ASCII) && !defined(_CL_HAVE_STRLWR))
|
||||
TCHAR* lucene_tcslwr( TCHAR* str );
|
||||
#undef _tcslwr
|
||||
#define _tcslwr lucene_tcslwr
|
||||
#endif
|
||||
|
||||
//conversion functions
|
||||
#if (defined(_ASCII) && !defined(_CL_HAVE_LLTOA)) || (defined(_UCS2) && !defined(_CL_HAVE_LLTOW))
|
||||
TCHAR* lucene_i64tot( int64_t value, TCHAR* str, int radix);
|
||||
#undef _i64tot
|
||||
#define _i64tot lucene_i64tot
|
||||
#endif
|
||||
#if (defined(_UCS2) && !defined(_CL_HAVE_WCSTOLL)) || (defined(_ASCII) && !defined(_CL_HAVE_STRTOLL))
|
||||
int64_t lucene_tcstoi64(const TCHAR* str, TCHAR**end, int radix);
|
||||
#undef _tcstoi64
|
||||
#define _tcstoi64 lucene_tcstoi64
|
||||
#endif
|
||||
#if defined(_UCS2) && !defined(_CL_HAVE_WCSTOD)
|
||||
double lucene_tcstod(const TCHAR *value, TCHAR **end);
|
||||
#undef _tcstod
|
||||
#define _tcstod lucene_tcstod
|
||||
#endif
|
||||
|
||||
//printf functions
|
||||
#if defined(_UCS2) && (!defined(_CL_HAVE_SNWPRINTF) || defined(_CL_HAVE_SWPRINTF_BUG) )
|
||||
#undef _sntprintf
|
||||
#define _sntprintf lucene_snwprintf
|
||||
int lucene_snwprintf(wchar_t* strbuf, size_t count, const wchar_t * format, ...);
|
||||
|
||||
#ifndef __CL_INCLUDE_TPRINTF
|
||||
#define __CL_INCLUDE_TPRINTF
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_UCS2) && !defined(_CL_HAVE_WPRINTF)
|
||||
#undef _tprintf
|
||||
#define _tprintf lucene_wprintf
|
||||
void lucene_wprintf(const wchar_t * format, ...);
|
||||
|
||||
#ifndef __CL_INCLUDE_TPRINTF
|
||||
#define __CL_INCLUDE_TPRINTF
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_UCS2) && (!defined(_CL_HAVE_VSNWPRINTF) || defined(_CL_HAVE_SWPRINTF_BUG) )
|
||||
#undef _vsntprintf
|
||||
#define _vsntprintf lucene_vsnwprintf
|
||||
int lucene_vsnwprintf(wchar_t * strbuf, size_t count, const wchar_t * format, va_list& ap);
|
||||
|
||||
#ifndef __CL_INCLUDE_TPRINTF
|
||||
#define __CL_INCLUDE_TPRINTF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//todo: if _CL_HAVE_SNPRINTF_BUG fails(snprintf overflow),we should use our own
|
||||
//function. but we don't have it currently, and our functions are dubious anyway...
|
||||
|
||||
#endif //end of _lucene_repl_wchar_h
|
||||
@@ -1,70 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
//NOTE: do not include this file directly, it is included from lucene internally.
|
||||
|
||||
#ifndef lucene_config_threadCSection_h
|
||||
#define lucene_config_threadCSection_h
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
CL_NS_DEF(util)
|
||||
|
||||
#if !defined(LUCENE_USE_WINDOWS_H) && !defined(_WINDOWS_)
|
||||
//we have not explicity included windows.h and windows.h has
|
||||
//not been included (check _WINDOWS_), then we must define
|
||||
//our own definitions to the thread locking functions:
|
||||
struct CRITICAL_SECTION
|
||||
{
|
||||
struct critical_section_debug * DebugInfo;
|
||||
long LockCount;
|
||||
long RecursionCount;
|
||||
void * OwningThread;
|
||||
void * LockSemaphore;
|
||||
#if defined(_WIN64)
|
||||
unsigned __int64 SpinCount;
|
||||
#else
|
||||
unsigned long SpinCount;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
///a windows implementation of the lock mutex
|
||||
///todo: boost has a InterlockedExchange way of locking too. More backwards compatible/faster???
|
||||
class mutex_win32
|
||||
{
|
||||
private:
|
||||
CRITICAL_SECTION mtx;
|
||||
public:
|
||||
mutex_win32(const mutex_win32& clone);
|
||||
mutex_win32();
|
||||
~mutex_win32();
|
||||
void lock();
|
||||
void unlock();
|
||||
};
|
||||
|
||||
class CLuceneThreadIdCompare
|
||||
{
|
||||
public:
|
||||
|
||||
enum
|
||||
{ // parameters for hash table
|
||||
bucket_size = 4, // 0 < bucket_size
|
||||
min_buckets = 8
|
||||
}; // min_buckets = 2 ^^ N, 0 < N
|
||||
|
||||
bool operator()( DWORD t1, DWORD t2 ) const{
|
||||
return t1 < t2;
|
||||
}
|
||||
};
|
||||
|
||||
#define _LUCENE_THREADMUTEX CL_NS(util)::mutex_win32
|
||||
#define _LUCENE_CURRTHREADID GetCurrentThreadId()
|
||||
#define _LUCENE_THREADID_TYPE DWORD
|
||||
CL_NS_END
|
||||
|
||||
#endif //lucene_config_threadCSection_h
|
||||
@@ -1,58 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
//NOTE: do not include this file directly, it is included from lucene internally.
|
||||
|
||||
#ifndef lucene_config_threadPthread_h
|
||||
#define lucene_config_threadPthread_h
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
CL_NS_DEF(util)
|
||||
|
||||
///a posix implementation of the lock mutex
|
||||
///todo: we need a spinlock implemenation for usage in reference counting
|
||||
class mutex_pthread
|
||||
{
|
||||
private:
|
||||
pthread_mutex_t mtx;
|
||||
|
||||
public:
|
||||
mutex_pthread(const mutex_pthread& clone);
|
||||
mutex_pthread();
|
||||
~mutex_pthread();
|
||||
void lock();
|
||||
void unlock();
|
||||
|
||||
private:
|
||||
#ifndef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
|
||||
pthread_t lockOwner;
|
||||
unsigned int lockCount;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define _LUCENE_THREADMUTEX CL_NS(util)::mutex_pthread
|
||||
#define _LUCENE_CURRTHREADID pthread_self()
|
||||
#define _LUCENE_THREADID_TYPE pthread_t
|
||||
|
||||
class CLuceneThreadIdCompare
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{ // parameters for hash table
|
||||
bucket_size = 4, // 0 < bucket_size
|
||||
min_buckets = 8
|
||||
}; // min_buckets = 2 ^^ N, 0 < N
|
||||
|
||||
bool operator()( pthread_t t1, pthread_t t2 ) const{
|
||||
return t1 < t2;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
CL_NS_END
|
||||
|
||||
#endif //lucene_config_threadPthread_h
|
||||
@@ -1,163 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
#ifndef _CL_DISABLE_MULTITHREADING
|
||||
CL_NS_DEF(util)
|
||||
|
||||
|
||||
mutexGuard::mutexGuard(const mutexGuard& clone){
|
||||
//no autoclone
|
||||
mrMutex = NULL;
|
||||
}
|
||||
mutexGuard::mutexGuard( _LUCENE_THREADMUTEX& rMutex ) :
|
||||
mrMutex(&rMutex)
|
||||
{
|
||||
mrMutex->lock();
|
||||
}
|
||||
mutexGuard::~mutexGuard()
|
||||
{
|
||||
mrMutex->unlock();
|
||||
}
|
||||
|
||||
#if defined(_LUCENE_DONTIMPLEMENT_THREADMUTEX)
|
||||
//do nothing
|
||||
#if defined(_LUCENE_PRAGMA_WARNINGS)
|
||||
#pragma message ("==================Not implementing any thread mutex==================")
|
||||
#else
|
||||
#warning "==================Not implementing any thread mutex=================="
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#elif defined(_CLCOMPILER_MSVC) || defined(__MINGW32__)
|
||||
#include "CLucene/config/threadCSection.h"
|
||||
|
||||
#if !defined(LUCENE_USE_WINDOWS_H) && !defined(_WINDOWS_)
|
||||
//we have not explicity included windows.h and windows.h has
|
||||
//not been included (check _WINDOWS_), then we must define
|
||||
//our own definitions to the thread locking functions:
|
||||
extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(CRITICAL_SECTION *);
|
||||
extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(CRITICAL_SECTION *);
|
||||
extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(CRITICAL_SECTION *);
|
||||
extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(CRITICAL_SECTION *);
|
||||
extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId();
|
||||
#endif
|
||||
|
||||
mutex_win32::mutex_win32(const mutex_win32& clone){
|
||||
InitializeCriticalSection(&mtx);
|
||||
}
|
||||
mutex_win32::mutex_win32()
|
||||
{
|
||||
InitializeCriticalSection(&mtx);
|
||||
}
|
||||
|
||||
mutex_win32::~mutex_win32()
|
||||
{
|
||||
DeleteCriticalSection(&mtx);
|
||||
}
|
||||
|
||||
void mutex_win32::lock()
|
||||
{
|
||||
EnterCriticalSection(&mtx);
|
||||
}
|
||||
|
||||
void mutex_win32::unlock()
|
||||
{
|
||||
LeaveCriticalSection(&mtx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#elif defined(_CL_HAVE_PTHREAD)
|
||||
#include "CLucene/config/threadPthread.h"
|
||||
|
||||
#ifdef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
|
||||
bool mutex_pthread_attr_initd=false;
|
||||
pthread_mutexattr_t mutex_pthread_attr;
|
||||
#endif
|
||||
|
||||
#ifdef _CL__CND_DEBUG
|
||||
//todo: add back CND_PRECONDITION(c==0,m)
|
||||
#define _CLPTHREAD_CHECK(c,m) c; //CND_PRECONDITION(c==0,m)
|
||||
#else
|
||||
#define _CLPTHREAD_CHECK(c,m) c;
|
||||
#endif
|
||||
|
||||
mutex_pthread::mutex_pthread(const mutex_pthread& clone){
|
||||
#ifdef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
|
||||
_CLPTHREAD_CHECK(pthread_mutex_init(&mtx, &mutex_pthread_attr), "mutex_pthread(clone) constructor failed")
|
||||
#else
|
||||
#if defined(__hpux) && defined(_DECTHREADS_)
|
||||
_CLPTHREAD_CHECK(pthread_mutex_init(&mtx, pthread_mutexattr_default), "mutex_pthread(clone) constructor failed")
|
||||
#else
|
||||
_CLPTHREAD_CHECK(pthread_mutex_init(&mtx, 0), "mutex_pthread(clone) constructor failed")
|
||||
#endif
|
||||
lockCount=0;
|
||||
lockOwner=0;
|
||||
#endif
|
||||
}
|
||||
mutex_pthread::mutex_pthread()
|
||||
{
|
||||
#ifdef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
|
||||
if ( mutex_pthread_attr_initd == false ){
|
||||
pthread_mutexattr_init(&mutex_pthread_attr);
|
||||
pthread_mutexattr_settype(&mutex_pthread_attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
mutex_pthread_attr_initd = true;
|
||||
}
|
||||
_CLPTHREAD_CHECK(pthread_mutex_init(&mtx, &mutex_pthread_attr), "mutex_pthread(clone) constructor failed")
|
||||
#else
|
||||
#if defined(__hpux) && defined(_DECTHREADS_)
|
||||
_CLPTHREAD_CHECK(pthread_mutex_init(&mtx, pthread_mutexattr_default), "mutex_pthread(clone) constructor failed")
|
||||
#else
|
||||
_CLPTHREAD_CHECK(pthread_mutex_init(&mtx, 0), "mutex_pthread(clone) constructor failed")
|
||||
#endif
|
||||
lockCount=0;
|
||||
lockOwner=0;
|
||||
#endif
|
||||
}
|
||||
|
||||
mutex_pthread::~mutex_pthread()
|
||||
{
|
||||
_CLPTHREAD_CHECK(pthread_mutex_destroy(&mtx), "~mutex_pthread destructor failed")
|
||||
}
|
||||
|
||||
void mutex_pthread::lock()
|
||||
{
|
||||
#ifndef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
|
||||
pthread_t currentThread = pthread_self();
|
||||
if( pthread_equal( lockOwner, currentThread ) ) {
|
||||
++lockCount;
|
||||
} else {
|
||||
_CLPTHREAD_CHECK(pthread_mutex_lock(&mtx), "mutex_pthread::lock")
|
||||
lockOwner = currentThread;
|
||||
lockCount = 1;
|
||||
}
|
||||
#else
|
||||
_CLPTHREAD_CHECK(pthread_mutex_lock(&mtx), "mutex_pthread::lock")
|
||||
#endif
|
||||
}
|
||||
|
||||
void mutex_pthread::unlock()
|
||||
{
|
||||
#ifndef _CL_HAVE_PTHREAD_MUTEX_RECURSIVE
|
||||
--lockCount;
|
||||
if( lockCount == 0 )
|
||||
{
|
||||
lockOwner = 0;
|
||||
_CLPTHREAD_CHECK(pthread_mutex_unlock(&mtx), "mutex_pthread::unlock")
|
||||
}
|
||||
#else
|
||||
_CLPTHREAD_CHECK(pthread_mutex_unlock(&mtx), "mutex_pthread::unlock")
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif //thread impl choice
|
||||
|
||||
|
||||
CL_NS_END
|
||||
#endif //!_CL_DISABLE_MULTITHREADING
|
||||
@@ -1,238 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 1999 Tom Tromey
|
||||
* Copyright (C) 2000 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*
|
||||
************************************************
|
||||
* Also licensed with permission from Tom Tromey
|
||||
* and Owen Taylor under the Apache license.
|
||||
* Original location:
|
||||
* http://cvs.gnome.org/viewcvs/glib/glib/gutf8.c?rev=1.50&view=log
|
||||
************************************************
|
||||
*
|
||||
* Copyright 2003-2006 The Apache Software Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
typedef unsigned long gunichar;
|
||||
typedef unsigned char guchar;
|
||||
|
||||
#define UTF8_COMPUTE(Char, Mask, Len) \
|
||||
if (Char < 128) \
|
||||
{ \
|
||||
Len = 1; \
|
||||
Mask = 0x7f; \
|
||||
} \
|
||||
else if ((Char & 0xe0) == 0xc0) \
|
||||
{ \
|
||||
Len = 2; \
|
||||
Mask = 0x1f; \
|
||||
} \
|
||||
else if ((Char & 0xf0) == 0xe0) \
|
||||
{ \
|
||||
Len = 3; \
|
||||
Mask = 0x0f; \
|
||||
} \
|
||||
else if ((Char & 0xf8) == 0xf0) \
|
||||
{ \
|
||||
Len = 4; \
|
||||
Mask = 0x07; \
|
||||
} \
|
||||
else if ((Char & 0xfc) == 0xf8) \
|
||||
{ \
|
||||
Len = 5; \
|
||||
Mask = 0x03; \
|
||||
} \
|
||||
else if ((Char & 0xfe) == 0xfc) \
|
||||
{ \
|
||||
Len = 6; \
|
||||
Mask = 0x01; \
|
||||
} \
|
||||
else \
|
||||
Len = -1;
|
||||
|
||||
#define UTF8_LENGTH(Char) \
|
||||
((Char) < 0x80 ? 1 : \
|
||||
((Char) < 0x800 ? 2 : \
|
||||
((Char) < 0x10000 ? 3 : \
|
||||
((Char) < 0x200000 ? 4 : \
|
||||
((Char) < 0x4000000 ? 5 : 6)))))
|
||||
|
||||
|
||||
#define UTF8_GET(Result, Chars, Count, Mask, Len) \
|
||||
(Result) = (Chars)[0] & (Mask); \
|
||||
for ((Count) = 1; (Count) < (Len); ++(Count)) \
|
||||
{ \
|
||||
if (((Chars)[(Count)] & 0xc0) != 0x80) \
|
||||
{ \
|
||||
(Result) = 0; \
|
||||
(Len) = 1; \
|
||||
break; \
|
||||
} \
|
||||
(Result) <<= 6; \
|
||||
(Result) |= ((Chars)[(Count)] & 0x3f); \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* lucene_wctoutf8:
|
||||
* @c: a ISO10646 character code
|
||||
* @outbuf: output buffer, must have at least 6 bytes of space.
|
||||
* If %NULL, the length will be computed and returned
|
||||
* and nothing will be written to @outbuf.
|
||||
*
|
||||
* Converts a single character to UTF-8.
|
||||
*
|
||||
* Return value: number of bytes written
|
||||
**/
|
||||
size_t lucene_wctoutf8(char * outbuf, const wchar_t ch)
|
||||
{
|
||||
gunichar c = ch;
|
||||
guchar len = 0;
|
||||
int first;
|
||||
int i;
|
||||
|
||||
if (c < 0x80)
|
||||
{
|
||||
first = 0;
|
||||
len = 1;
|
||||
}
|
||||
else if (c < 0x800)
|
||||
{
|
||||
first = 0xc0;
|
||||
len = 2;
|
||||
}
|
||||
else if (c < 0x10000)
|
||||
{
|
||||
first = 0xe0;
|
||||
len = 3;
|
||||
}
|
||||
else if (c < 0x200000)
|
||||
{
|
||||
first = 0xf0;
|
||||
len = 4;
|
||||
}
|
||||
else if (c < 0x4000000)
|
||||
{
|
||||
first = 0xf8;
|
||||
len = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
first = 0xfc;
|
||||
len = 6;
|
||||
}
|
||||
|
||||
if (outbuf)
|
||||
{
|
||||
for (i = len - 1; i > 0; --i)
|
||||
{
|
||||
outbuf[i] = (char)((c & 0x3f) | 0x80);
|
||||
c >>= 6;
|
||||
}
|
||||
outbuf[0] = c | first;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* lucene_utf8towc:
|
||||
* @p: a pointer to Unicode character encoded as UTF-8
|
||||
*
|
||||
* Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
|
||||
* If @p does not point to a valid UTF-8 encoded character, results are
|
||||
* undefined. If you are not sure that the bytes are complete
|
||||
* valid Unicode characters, you should use lucene_utf8towc_validated()
|
||||
* instead.
|
||||
*
|
||||
* Return value: the resulting character
|
||||
**/
|
||||
size_t lucene_utf8towc(wchar_t *pwc, const char *p, size_t n)
|
||||
{
|
||||
int i, mask = 0;
|
||||
int result;
|
||||
unsigned char c = (unsigned char) *p;
|
||||
int len=0;
|
||||
|
||||
UTF8_COMPUTE (c, mask, len);
|
||||
if (len == -1)
|
||||
return 0;
|
||||
UTF8_GET (result, p, i, mask, len);
|
||||
|
||||
*pwc = result;
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
//this function was not taken from gnome
|
||||
size_t lucene_wcstoutf8(char * result, const wchar_t * str, size_t result_length){
|
||||
char *p=result;
|
||||
int i = 0;
|
||||
|
||||
while (p < result + result_length-1 && str[i] != 0)
|
||||
p += lucene_wctoutf8(p,str[i++]);
|
||||
|
||||
*p = '\0';
|
||||
|
||||
return p-result;
|
||||
}
|
||||
//this function was not taken from gnome
|
||||
size_t lucene_utf8towcs(wchar_t * result, const char * str, size_t result_length){
|
||||
char *sp = (char*)str;
|
||||
wchar_t *rp = result;
|
||||
int i = 0;
|
||||
|
||||
while (rp < result + result_length && *sp!=0){
|
||||
size_t r = lucene_utf8towc(rp,sp,6);
|
||||
if ( r == -1 )
|
||||
return 0;
|
||||
sp += r;
|
||||
rp++;
|
||||
}
|
||||
|
||||
if ( sp-str < result_length )
|
||||
*rp = '\0';
|
||||
|
||||
size_t ret = sp-str;
|
||||
return ret;
|
||||
}
|
||||
//get the number of bytes that make up the utf8 character.
|
||||
//this function was not taken from gnome
|
||||
size_t lucene_utf8charlen(const char *p)
|
||||
{
|
||||
int mask = 0;
|
||||
int len=0;
|
||||
unsigned char c = (unsigned char) *p;
|
||||
|
||||
UTF8_COMPUTE (c, mask, len);
|
||||
return len;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
debugdir = $(lsrcdir)/debug
|
||||
debughdir = $(includedir)/CLucene/debug
|
||||
|
||||
libclucene_la_SOURCES += $(debugdir)/condition.cpp
|
||||
libclucene_la_SOURCES += $(debugdir)/error.cpp
|
||||
libclucene_la_SOURCES += $(debugdir)/mempool.cpp
|
||||
libclucene_la_SOURCES += $(debugdir)/memtracking.cpp
|
||||
|
||||
debugh_HEADERS = $(debugdir)/*.h
|
||||
@@ -1,80 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "condition.h"
|
||||
#include "CLucene/util/Misc.h"
|
||||
#ifdef _CL__CND_DEBUG
|
||||
|
||||
#define __CND_STR_PRECONDITION "PRECONDITION"
|
||||
#define __CND_STR_CONDITION "CONDITION"
|
||||
#define __CND_STR_WARNING "WARNING"
|
||||
#define __CND_STR_MESSAGE "MESSAGE"
|
||||
#define __CND_STR_DEBUGMESSAGE "DEBUG MESSAGE"
|
||||
#define __CND_STR_EXIT "EXIT"
|
||||
|
||||
#ifndef _CND_DEBUG_DONTIMPLEMENT_OUTDEBUG
|
||||
void _Cnd_OutDebug( const char* FormattedMsg, const char* StrTitle, const char* File, int32_t Line, int32_t Title, const char* Mes2, int32_t fatal ){
|
||||
#ifdef __WINDOWS_H
|
||||
/*Display a standard messagebox*/
|
||||
MessageBox(NULL, FormattedMsg, StrTitle, (fatal==1 ? MB_ICONSTOP:MB_ICONEXCLAMATION) | MB_OK | MB_TASKMODAL);
|
||||
#else
|
||||
printf("%s\n",FormattedMsg);
|
||||
#endif
|
||||
|
||||
#if defined(_CND_DEBUG_WARN_DEBUGGER) /*attempt to signal windows debugger*/
|
||||
OutputDebugString(FormattedMsg);
|
||||
DebugBreak(); /*Position debugger just before exit program*/
|
||||
#endif
|
||||
|
||||
if ( fatal )
|
||||
debugFatalExit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void __cnd_FormatDebug( const char* File, int32_t Line, int32_t Title, const char* Mes2, int32_t fatal ) {
|
||||
char M[512];
|
||||
char* StrTitle = NULL;
|
||||
|
||||
if( Mes2 )
|
||||
_snprintf(M,512,"file:%s line:%d\n%s",File,Line,Mes2);
|
||||
else
|
||||
_snprintf(M,512,"file:%s line:%d",File,Line);
|
||||
|
||||
/*Determine which title to use*/
|
||||
switch( Title ) {
|
||||
case CND_STR_PRECONDITION: {
|
||||
StrTitle = __CND_STR_PRECONDITION;
|
||||
break;
|
||||
}
|
||||
case CND_STR_CONDITION: {
|
||||
StrTitle = __CND_STR_CONDITION;
|
||||
break;
|
||||
}
|
||||
case CND_STR_WARNING: {
|
||||
StrTitle = __CND_STR_WARNING;
|
||||
break;
|
||||
}
|
||||
case CND_STR_MESSAGE: {
|
||||
StrTitle = __CND_STR_MESSAGE;
|
||||
break;
|
||||
}
|
||||
case CND_STR_DEBUGMESSAGE: {
|
||||
StrTitle = __CND_STR_DEBUGMESSAGE;
|
||||
break;
|
||||
}
|
||||
case CND_STR_EXIT: {
|
||||
StrTitle = __CND_STR_EXIT;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}/*switch*/
|
||||
|
||||
_Cnd_OutDebug(M, StrTitle, File, Line, Title, Mes2, fatal);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef __CONDITION_H
|
||||
#define __CONDITION_H
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/*
|
||||
To enable condition debugging uncomment _CND_DEBUG in CLConfig.h
|
||||
*/
|
||||
|
||||
#ifdef _CL__CND_DEBUG /* Don't include the debug code */
|
||||
#ifndef CND_STR_DEFINES
|
||||
#define CND_STR_DEFINES
|
||||
#define CND_STR_PRECONDITION 1
|
||||
#define CND_STR_CONDITION 2
|
||||
#define CND_STR_WARNING 3
|
||||
#define CND_STR_MESSAGE 4
|
||||
#define CND_STR_DEBUGMESSAGE 5
|
||||
#define CND_STR_EXIT 6
|
||||
#endif
|
||||
|
||||
/* _CL__CND_DEBUG defined, include debug code */
|
||||
|
||||
#ifdef _CND_NODEBUGTEXT
|
||||
#define CND_PRECONDITION(cond,usermessage) CND__EXITCONDITION(cond,__FILE__,__LINE__,CND_STR_PRECONDITION,NULL)
|
||||
#define CND_CONDITION(cond,usermessage) CND__EXITCONDITION(cond,__FILE__,__LINE__,CND_STR_CONDITION,NULL)
|
||||
#define CND_WARNING(cond,usermessage) CND__CONDITION(cond,__FILE__,__LINE__,CND_STR_WARNING,NULL)
|
||||
#define CND_MESSAGE(cond,usermessage) CND__CONDITION(cond,__FILE__,__LINE__,CND_STR_MESSAGE,NULL)
|
||||
#define CND_DEBUGMESSAGE(usermessage) CND__MESSAGE(__FILE__,__LINE__,CND_STR_DEBUGMESSAGE,NULL)
|
||||
#else
|
||||
#define CND_PRECONDITION(cond,usermessage) CND__EXITCONDITION(cond,__FILE__,__LINE__,CND_STR_PRECONDITION,usermessage)
|
||||
#define CND_CONDITION(cond,usermessage) CND__EXITCONDITION(cond,__FILE__,__LINE__,CND_STR_CONDITION,usermessage)
|
||||
#define CND_WARNING(cond,usermessage) CND__CONDITION(cond,__FILE__,__LINE__,CND_STR_WARNING,usermessage)
|
||||
#define CND_MESSAGE(cond,usermessage) CND__CONDITION(cond,__FILE__,__LINE__,CND_STR_MESSAGE,usermessage)
|
||||
#define CND_DEBUGMESSAGE(usermessage) CND__MESSAGE(__FILE__,__LINE__,CND_STR_DEBUGMESSAGE,usermessage)
|
||||
#endif
|
||||
|
||||
//if _CND_DEBUG_DONTIMPLEMENT_OUTDEBUG is defined, then you must implement
|
||||
//this routine in the client application. The debug callback can then
|
||||
//be better customised to the host application.
|
||||
//Here is the default implementation:
|
||||
void _Cnd_OutDebug( const char* FormattedMsg, const char* StrTitle, const char* File, int32_t Line, int32_t Title, const char* Mes2, int32_t fatal );
|
||||
|
||||
void __cnd_FormatDebug( const char* File, int32_t Line, int32_t Title, const char* Mes2, int32_t fatal );
|
||||
#define CND__EXIT(file,line,title,mes2) {__cnd_FormatDebug(file,line,title,mes2,1);}
|
||||
#define CND__EXITCONDITION(cond,file,line,title,mes2) {if(!(cond)){__cnd_FormatDebug(file,line,title,mes2,1);}}
|
||||
#define CND__CONDITION(cond,file,line,title,mes2) {if(!(cond)){__cnd_FormatDebug(file,line,title,mes2,0);}}
|
||||
#define CND__MESSAGE(file,line,title,mes2) {__cnd_FormatDebug(file,line,title,mes2,0);}
|
||||
#else
|
||||
#define CND_PRECONDITION(cond, usermessage)
|
||||
#define CND_CONDITION(cond, usermessage)
|
||||
#define CND_WARNING(cond,usermessage)
|
||||
#define CND_MESSAGE(cond,usermessage)
|
||||
#define CND_DEBUGMESSAGE(usermessage)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,73 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "CLucene/index/Term.h"
|
||||
|
||||
CL_NS_USE(util)
|
||||
|
||||
|
||||
#ifdef _LUCENE_DISABLE_EXCEPTIONS
|
||||
#ifdef _LUCENE_PRAGMA_WARNINGS
|
||||
#pragma message ("==================Lucene exceptions are disabled==================")
|
||||
#else
|
||||
#warning "==================Lucene exceptions are disabled=================="
|
||||
#endif
|
||||
#else
|
||||
CLuceneError::CLuceneError(int num, const char* str, bool ownstr)
|
||||
{
|
||||
error_number = num;
|
||||
_awhat=STRDUP_AtoA(str);
|
||||
_twhat=NULL;
|
||||
if ( ownstr )
|
||||
_CLDELETE_CaARRAY(str);
|
||||
}
|
||||
|
||||
CLuceneError::CLuceneError(const CLuceneError& clone)
|
||||
{
|
||||
this->error_number = clone.error_number;
|
||||
this->_awhat = NULL;
|
||||
this->_twhat = NULL;
|
||||
|
||||
if ( clone._awhat != NULL )
|
||||
this->_awhat = STRDUP_AtoA(clone._awhat);
|
||||
if ( clone._twhat != NULL )
|
||||
this->_twhat = STRDUP_TtoT(clone._twhat);
|
||||
}
|
||||
CLuceneError::~CLuceneError() throw(){
|
||||
_CLDELETE_CARRAY(_twhat);
|
||||
_CLDELETE_CaARRAY(_awhat);
|
||||
}
|
||||
char* CLuceneError::what(){
|
||||
#ifdef _ASCII
|
||||
if ( _twhat != NULL )
|
||||
return _twhat;
|
||||
#endif
|
||||
if ( _awhat == NULL )
|
||||
_awhat = STRDUP_TtoA(_twhat);
|
||||
return _awhat;
|
||||
}
|
||||
TCHAR* CLuceneError::twhat(){
|
||||
#ifdef _ASCII
|
||||
if ( _awhat != NULL )
|
||||
return _awhat;
|
||||
#endif
|
||||
if ( _twhat == NULL )
|
||||
_twhat = STRDUP_AtoT(_awhat);
|
||||
return _twhat;
|
||||
}
|
||||
|
||||
#ifndef _ASCII
|
||||
CLuceneError::CLuceneError(int num, const TCHAR* str, bool ownstr)
|
||||
{
|
||||
_twhat=STRDUP_TtoT(str);
|
||||
_awhat=NULL;
|
||||
if ( ownstr )
|
||||
_CLDELETE_CARRAY(str);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_LUCENE_DISABLE_EXCEPTIONS
|
||||
@@ -1,74 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_debug_error_
|
||||
#define _lucene_debug_error_
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#define CL_ERR_UNKNOWN -1
|
||||
#define CL_ERR_IO 1
|
||||
#define CL_ERR_NullPointer 2
|
||||
#define CL_ERR_Runtime 3
|
||||
#define CL_ERR_IllegalArgument 4
|
||||
#define CL_ERR_Parse 5
|
||||
#define CL_ERR_TokenMgr 6
|
||||
#define CL_ERR_UnsupportedOperation 7
|
||||
#define CL_ERR_InvalidState 8
|
||||
#define CL_ERR_IndexOutOfBounds 9
|
||||
#define CL_ERR_TooManyClauses 10
|
||||
#define CL_ERR_RAMTransaction 11
|
||||
#define CL_ERR_InvalidCast 12
|
||||
#define CL_ERR_IllegalState 13
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//error try/throw/catch definitions
|
||||
////////////////////////////////////////////////////////
|
||||
#ifdef _CL_DISABLE_NATIVE_EXCEPTIONS
|
||||
/*#define try _jpr_Try
|
||||
#define _CLCATCH _jpr_Catch
|
||||
#define _CLFINALLY(x) xxxx
|
||||
#define _CLTHROWA(y) _jpr_Throw
|
||||
#define _THROWA_DEL(y) _jpr_Throw
|
||||
#define _RETHROW(x) _jpr_Throw
|
||||
#define _CLTHROWT(y) _jpr_Throw
|
||||
|
||||
#define _THROWS ,_jpr_Throws*/
|
||||
#else
|
||||
class CLuceneError
|
||||
{
|
||||
int error_number;
|
||||
char* _awhat;
|
||||
TCHAR* _twhat;
|
||||
public:
|
||||
CLuceneError(const CLuceneError& clone);
|
||||
CLuceneError(int num, const char* str, bool ownstr);
|
||||
#ifdef _UCS2
|
||||
CLuceneError(int num, const TCHAR* str, bool ownstr);
|
||||
#endif
|
||||
int number(){return error_number;}
|
||||
char* what();
|
||||
TCHAR* twhat();
|
||||
~CLuceneError() throw();
|
||||
};
|
||||
|
||||
//#define _THROWS //does nothing
|
||||
#define _CLFINALLY(x) catch(...){ x; throw; } x //note: code x is not run if return is called
|
||||
#define _CLTHROWA(number, str) throw CLuceneError(number, str,false)
|
||||
#define _CLTHROWT(number, str) throw CLuceneError(number, str,false)
|
||||
#define _CLTHROWA_DEL(number, str) throw CLuceneError(number, str,true) //throw a string ensures the value is deleted
|
||||
#define _CLTHROWT_DEL(number, str) throw CLuceneError(number, str,true) //throw a string ensures the value is deleted
|
||||
|
||||
|
||||
#endif //_LUCENE_DISABLE_EXCEPTIONS
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
@@ -1,75 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_debug_lucenebase_
|
||||
#define _lucene_debug_lucenebase_
|
||||
|
||||
#ifdef _LUCENE_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
CL_NS_DEF(debug)
|
||||
|
||||
//Lucenebase is the superclass of all clucene objects. It provides
|
||||
//memory debugging tracking and/or reference counting
|
||||
class LuceneBase{
|
||||
public:
|
||||
#ifdef LUCENE_ENABLE_MEMLEAKTRACKING
|
||||
static void* operator new (size_t size);
|
||||
static void operator delete (void *p);
|
||||
int32_t __cl_initnum; ///< The order that the object was created at. This is then used to do a lookup in the objects list
|
||||
|
||||
static void* operator new (size_t size, char const * file, int32_t line);
|
||||
static void operator delete (void *p, char const * file, int32_t line);
|
||||
|
||||
static void* __cl_voidpadd(void* data, const char* file, int line, size_t size); ///<add arbitary data to the lucenbase_list and returns the same data
|
||||
static void __cl_voidpremove(const void* data, const char* file, int line);///<remove arbitary data to the lucenbase_list
|
||||
static void __cl_unregister(const void* obj); ///<un register object from the mem leak and ref count system
|
||||
|
||||
static int32_t __cl_GetUnclosedObjectsCount(); ///< gets the number of unclosed objects
|
||||
static const char* __cl_GetUnclosedObject(int32_t item); ///< get the name of the nth unclosed object
|
||||
static char* __cl_GetUnclosedObjects(); ///< get a string with the names of the unclosed objects
|
||||
static void __cl_PrintUnclosedObjects(); ///< print unclosed objects to the stdout
|
||||
|
||||
///This will clear memory relating to refcounting
|
||||
///other tools can be used to more accurately identify
|
||||
///memory leaks. This should only be called just
|
||||
///before closing, and after retrieving the
|
||||
///unclosed object list
|
||||
static void __cl_ClearMemory();
|
||||
|
||||
#endif //LUCENE_ENABLE_MEMLEAKTRACKING
|
||||
|
||||
int __cl_refcount;
|
||||
LuceneBase(){
|
||||
__cl_refcount=1;
|
||||
}
|
||||
inline int __cl_getref(){
|
||||
return __cl_refcount;
|
||||
}
|
||||
inline int __cl_addref(){
|
||||
__cl_refcount++;
|
||||
return __cl_refcount;
|
||||
}
|
||||
inline int __cl_decref(){
|
||||
__cl_refcount--;
|
||||
return __cl_refcount;
|
||||
}
|
||||
virtual ~LuceneBase(){};
|
||||
};
|
||||
|
||||
class LuceneVoidBase{
|
||||
public:
|
||||
#ifdef _DEBUG
|
||||
//a compile time check to make sure that _CLDELETE and _CLDECDELETE is being
|
||||
//used correctly.
|
||||
int dummy__see_mem_h_for_details;
|
||||
#endif
|
||||
virtual ~LuceneVoidBase(){};
|
||||
};
|
||||
|
||||
CL_NS_END
|
||||
#endif //_lucene_debug_lucenebase_
|
||||
@@ -1,99 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_debug_mem_h
|
||||
#define _lucene_debug_mem_h
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "lucenebase.h"
|
||||
|
||||
//some memory pool definitions
|
||||
#ifdef LUCENE_ENABLE_MEMORY_POOL
|
||||
#define LUCENE_MP_DEFINE(cls) extern lucene::debug::pool<> cls ## _mempool
|
||||
#else
|
||||
#define LUCENE_MP_DEFINE(cls)
|
||||
#endif
|
||||
|
||||
//Macro for creating new objects
|
||||
//todo: currently mempool and lucenebase are exclusive of each other
|
||||
//this doesnt need to be the case...
|
||||
#if defined(LUCENE_ENABLE_MEMORY_POOL)
|
||||
#define _CLNEW new
|
||||
#define LUCENE_BASE public CL_NS(debug)::LuceneVoidBase
|
||||
#define LUCENE_POOLEDBASE(sc) public CL_NS(debug)::LucenePoolBase<&sc ## _mempool>
|
||||
#elif defined(LUCENE_ENABLE_MEMLEAKTRACKING)
|
||||
#define _CLNEW new(__FILE__, __LINE__)
|
||||
#define LUCENE_BASE public CL_NS(debug)::LuceneBase
|
||||
#define LUCENE_POOLEDBASE(sc) LUCENE_BASE
|
||||
#elif defined(LUCENE_ENABLE_REFCOUNT)
|
||||
#define _CLNEW new
|
||||
#define LUCENE_BASE public CL_NS(debug)::LuceneBase
|
||||
#define LUCENE_POOLEDBASE(sc) LUCENE_BASE
|
||||
#else
|
||||
#define _CLNEW new
|
||||
#define LUCENE_BASE public CL_NS(debug)::LuceneVoidBase
|
||||
#define LUCENE_POOLEDBASE(sc) LUCENE_BASE
|
||||
#define LUCENE_BASE_CHECK(obj) (obj)->dummy__see_mem_h_for_details
|
||||
#endif
|
||||
#define _CL_POINTER(x) (x==NULL?NULL:(x->__cl_addref()>=0?x:x)) //return a add-ref'd object
|
||||
#define LUCENE_REFBASE public CL_NS(debug)::LuceneBase //this is the base of classes who *always* need refcounting
|
||||
|
||||
#if defined(_DEBUG)
|
||||
#if !defined(LUCENE_BASE_CHECK)
|
||||
#define LUCENE_BASE_CHECK(x)
|
||||
#endif
|
||||
#else
|
||||
#undef LUCENE_BASE_CHECK
|
||||
#define LUCENE_BASE_CHECK(x)
|
||||
#endif
|
||||
|
||||
//Macro for creating new arrays
|
||||
#ifdef LUCENE_ENABLE_MEMLEAKTRACKING
|
||||
#define _CL_NEWARRAY(type,size) (type*)CL_NS(debug)::LuceneBase::__cl_voidpadd(new type[(size_t)size],__FILE__,__LINE__,(size_t)size);
|
||||
#define _CLDELETE_ARRAY(x) if (x!=NULL){CL_NS(debug)::LuceneBase::__cl_voidpremove((const void*)x,__FILE__,__LINE__); delete [] x; x=NULL;}
|
||||
#define _CLDELETE_LARRAY(x) if (x!=NULL){CL_NS(debug)::LuceneBase::__cl_voidpremove((const void*)x,__FILE__,__LINE__);delete [] x;}
|
||||
#ifndef _CLDELETE_CARRAY
|
||||
#define _CLDELETE_CARRAY(x) if (x!=NULL){CL_NS(debug)::LuceneBase::__cl_voidpremove((const void*)x,__FILE__,__LINE__);delete [] x; x=NULL;}
|
||||
#define _CLDELETE_LCARRAY(x) if (x!=NULL){CL_NS(debug)::LuceneBase::__cl_voidpremove((const void*)x,__FILE__,__LINE__);delete [] x;}
|
||||
#endif
|
||||
#else
|
||||
#define _CL_NEWARRAY(type,size) new type[size]
|
||||
#define _CLDELETE_ARRAY(x) if (x!=NULL){delete [] x; x=NULL;}
|
||||
#define _CLDELETE_LARRAY(x) if (x!=NULL){delete [] x;}
|
||||
#ifndef _CLDELETE_CARRAY
|
||||
#define _CLDELETE_CARRAY(x) if (x!=NULL){delete [] x; x=NULL;}
|
||||
#define _CLDELETE_LCARRAY(x) if (x!=NULL){delete [] x;}
|
||||
#endif
|
||||
#endif
|
||||
//a shortcut for deleting a carray and all its contents
|
||||
#define _CLDELETE_CARRAY_ALL(x) {if ( x!=NULL ){ for(int xcda=0;x[xcda]!=NULL;xcda++)_CLDELETE_CARRAY(x[xcda]);}_CLDELETE_ARRAY(x)};
|
||||
#ifndef _CLDELETE_CaARRAY
|
||||
#define _CLDELETE_CaARRAY _CLDELETE_CARRAY
|
||||
#define _CLDELETE_LCaARRAY _CLDELETE_LCARRAY
|
||||
#endif
|
||||
|
||||
//Macro for deleting
|
||||
#ifdef LUCENE_ENABLE_REFCOUNT
|
||||
#define _CLDELETE(x) if (x!=NULL){ CND_PRECONDITION((x)->__cl_refcount>=0,"__cl_refcount was < 0"); if ((x)->__cl_decref() <= 0)delete x; x=NULL; }
|
||||
#define _CLLDELETE(x) if (x!=NULL){ CND_PRECONDITION((x)->__cl_refcount>=0,"__cl_refcount was < 0"); if ((x)->__cl_decref() <= 0)delete x; }
|
||||
#else
|
||||
#define _CLDELETE(x) if (x!=NULL){ LUCENE_BASE_CHECK(x); delete x; x=NULL; }
|
||||
#define _CLLDELETE(x) if (x!=NULL){ LUCENE_BASE_CHECK(x); delete x; }
|
||||
#endif
|
||||
|
||||
//_CLDECDELETE deletes objects which are *always* refcounted
|
||||
#define _CLDECDELETE(x) if (x!=NULL){ CND_PRECONDITION((x)->__cl_refcount>=0,"__cl_refcount was < 0"); if ((x)->__cl_decref() <= 0)delete x; x=NULL; }
|
||||
#define _CLLDECDELETE(x) if (x!=NULL){ CND_PRECONDITION((x)->__cl_refcount>=0,"__cl_refcount was < 0"); if ((x)->__cl_decref() <= 0)delete x; }
|
||||
|
||||
//_VDelete should be used for deleting non-clucene objects.
|
||||
//when using reference counting, _CLDELETE casts the object
|
||||
//into a LuceneBase*.
|
||||
#define _CLVDELETE(x) if(x!=NULL){delete x; x=NULL;}
|
||||
|
||||
#endif //_lucene_debug_lucenebase_
|
||||
@@ -1,37 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
#ifdef LUCENE_ENABLE_MEMORY_POOL
|
||||
//classes for use in the memory pool definitions:
|
||||
#include "CLucene/index/TermInfo.h"
|
||||
#include "CLucene/search/SearchHeader.h"
|
||||
#include "CLucene/analysis/Analyzers.h"
|
||||
|
||||
#define DEFINE_MP(ns,cls) lucene::debug::pool<> CL_NS(ns):: cls ##_mempool(sizeof(CL_NS(ns)::cls));
|
||||
|
||||
//define the implementations for the mempools
|
||||
DEFINE_MP(index,TermInfo);
|
||||
DEFINE_MP(search,HitDoc);
|
||||
DEFINE_MP(analysis,Token);
|
||||
|
||||
CL_NS_DEF(debug)
|
||||
|
||||
#ifdef LUCENE_ENABLE_MEMLEAKTRACKING
|
||||
#error "Cannot use memory pool and LuceneBase memory leak counting together"
|
||||
#endif
|
||||
#define RELEASE_MP(ns,cls) CL_NS(ns)::cls ## _mempool.release_memory()
|
||||
|
||||
//now the list of mempools to release
|
||||
void lucene_release_memory_pool(){
|
||||
RELEASE_MP(index,TermInfo);
|
||||
RELEASE_MP(search,HitDoc);
|
||||
RELEASE_MP(analysis,Token);
|
||||
}
|
||||
|
||||
CL_NS_END
|
||||
#endif
|
||||
@@ -1,373 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
#include "CLucene/util/StringBuffer.h"
|
||||
#include "CLucene/util/Misc.h"
|
||||
|
||||
bool _lucene_disable_debuglogging = true; //if LUCENE_ENABLE_CONSTRUCTOR_LOG is on, dont do log if this is true
|
||||
bool _lucene_run_objectcheck = false; //run a memory check before deleting objects
|
||||
int _lucene_counter_break = -1; //to break at this item, change this
|
||||
//and put break points at points below
|
||||
|
||||
CL_NS_USE(util)
|
||||
CL_NS_DEF(debug)
|
||||
|
||||
#ifdef LUCENE_ENABLE_MEMLEAKTRACKING
|
||||
int32_t _instance_counter = 0; //counter for initnumber
|
||||
|
||||
struct _file{
|
||||
int32_t refcount; ///times this has been used
|
||||
char* value; ///reference to the the basefile
|
||||
}; //structure for name counting
|
||||
struct _pointers{
|
||||
_file* file;
|
||||
int32_t initline;
|
||||
int32_t initnumber;
|
||||
};//structure for pointer-filename references
|
||||
|
||||
typedef CL_NS(util)::CLSet<const char*,_file*,Compare::Char,Deletor::Dummy,Deletor::Void<_file> > defFile;
|
||||
typedef CL_NS(util)::CLSet<LuceneBase*,_pointers*,Compare::Void<LuceneBase>,Deletor::Dummy,Deletor::Void<_pointers> > defPointer;
|
||||
typedef CL_NS(util)::CLSet<const void*,_pointers*,Compare::Void<const void>,Deletor::Dummy,Deletor::Void<_pointers> > defVoid;
|
||||
|
||||
DEFINE_MUTEX(memleak_lock)
|
||||
defFile LuceneBase_Files(false,true); //list of filenames used
|
||||
defPointer LuceneBase_Pointers(false,true); //list of pointers counted
|
||||
defVoid LuceneBase_Voids(false,true); //list of arbitary data added
|
||||
|
||||
//variables to trim filenames to just the base names
|
||||
char _files_trim_string[CL_MAX_DIR];
|
||||
int32_t _files_trim_start=-1;
|
||||
|
||||
//trim the filename and return the refcounted _file* structure
|
||||
_file* get_file(const char* file){
|
||||
if ( _files_trim_start == -1 ){
|
||||
//this trims the start of the name file name so
|
||||
//that the whole of the filename is not stored - more asthetic :)
|
||||
//need to find the base
|
||||
_files_trim_start = strlen(__FILE__) - 21; //(length of debug/memtracking.cpp)
|
||||
strcpy(_files_trim_string,__FILE__);
|
||||
_files_trim_string[_files_trim_start] = 0;
|
||||
}
|
||||
if ( strncmp(file,_files_trim_string,_files_trim_start) == 0 ){
|
||||
//this file should be within the same directory area as we found lucenebase.cpp
|
||||
//to be, lets trim the start
|
||||
file+=_files_trim_start;
|
||||
}
|
||||
|
||||
//now return an existing files structure (with refcount++) or create a new one
|
||||
defFile::iterator itr = LuceneBase_Files.find((const char*)file);
|
||||
if ( itr != LuceneBase_Files.end() ){
|
||||
_file* bf = itr->second;
|
||||
bf->refcount++;
|
||||
return bf;
|
||||
}else{
|
||||
_file* ref = new _file;
|
||||
ref->value = new char[strlen(file)+1]; //cannot use _CL_NEWARRAY otherwise recursion
|
||||
strcpy(ref->value,file);
|
||||
|
||||
ref->refcount = 1;
|
||||
LuceneBase_Files.insert(pair<const char*,_file*>(ref->value,ref));
|
||||
return ref;
|
||||
}
|
||||
}
|
||||
|
||||
void remove_file(_file* bf){
|
||||
bf->refcount--;
|
||||
if ( bf->refcount <= 0 ){
|
||||
defFile::iterator fi = LuceneBase_Files.find(bf->value);
|
||||
CND_PRECONDITION(fi!=LuceneBase_Files.end(),"fi==NULL");
|
||||
delete[] bf->value;
|
||||
LuceneBase_Files.removeitr(fi);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LUCENE_ENABLE_CONSTRUCTOR_LOG
|
||||
void constructor_log(const char* type,const char* file,const int line, const int size){
|
||||
if ( _lucene_disable_debuglogging ){
|
||||
FILE* f = fopen("clucene.log","a");
|
||||
char buf[CL_MAX_DIR+5];
|
||||
sprintf(buf,"%s,%s,%d,%d\n",type,file,line,size);
|
||||
fwrite(buf,sizeof(char),strlen(buf),f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
#define CONSTRUCTOR_LOG(type,file,line,size) constructor_log(type,file,line,size)
|
||||
#else
|
||||
#define CONSTRUCTOR_LOG(type,file,line,size)
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// the _CLNEW&_CLDELETE new/delete operators
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void* LuceneBase::operator new (size_t size, const char * file, int32_t line)
|
||||
{
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
|
||||
void* p = malloc (size);
|
||||
LuceneBase* lb = (LuceneBase*)p;
|
||||
|
||||
//create the pointer struct
|
||||
_file* br = get_file(file);
|
||||
_pointers* bp = new _pointers;
|
||||
bp->file = br;
|
||||
bp->initnumber = _instance_counter++;
|
||||
bp->initline = line;
|
||||
|
||||
//associate this object with the pointer
|
||||
lb->__cl_initnum = bp->initnumber;
|
||||
|
||||
//break if necessary
|
||||
if ( _lucene_counter_break == lb->__cl_initnum )
|
||||
CLDebugBreak(); //put break point here
|
||||
|
||||
//add the pointer object
|
||||
LuceneBase_Pointers.insert(pair<LuceneBase*,_pointers*>(lb, bp));
|
||||
|
||||
CONSTRUCTOR_LOG("newobj",file,line,size);
|
||||
return p;
|
||||
}
|
||||
void LuceneBase::operator delete (void *p, char const * file, int32_t line)
|
||||
{
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
|
||||
LuceneBase* lb=(LuceneBase*)p;
|
||||
|
||||
defPointer::iterator itr = LuceneBase_Pointers.find(lb);
|
||||
if ( itr != LuceneBase_Pointers.end() ){
|
||||
_pointers* bp = itr->second;
|
||||
remove_file(bp->file);
|
||||
|
||||
LuceneBase_Pointers.removeitr(itr);
|
||||
}else{
|
||||
//break
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// the generic new/delete operators
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
void* LuceneBase::operator new (size_t size)
|
||||
{
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
|
||||
void* p = malloc (size);
|
||||
LuceneBase* lb = (LuceneBase*)p;
|
||||
|
||||
//create the pointer struct
|
||||
_file* br = get_file("undefined");
|
||||
_pointers* bp = new _pointers;
|
||||
bp->file = br;
|
||||
bp->initnumber = _instance_counter++;
|
||||
bp->initline = -1;
|
||||
|
||||
//associate this object with the pointer
|
||||
lb->__cl_initnum = bp->initnumber;
|
||||
|
||||
//break if necessary
|
||||
if ( _lucene_counter_break == lb->__cl_initnum )
|
||||
CLDebugBreak();
|
||||
|
||||
//add the pointer object
|
||||
LuceneBase_Pointers.insert(pair<LuceneBase*,_pointers*>(lb,bp));
|
||||
|
||||
CONSTRUCTOR_LOG("newobj","unknown",-1,size);
|
||||
return p;
|
||||
}
|
||||
void LuceneBase::operator delete (void *p)
|
||||
{
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
|
||||
LuceneBase* lb=(LuceneBase*)p;
|
||||
|
||||
defPointer::iterator itr = LuceneBase_Pointers.find(lb);
|
||||
if ( itr != LuceneBase_Pointers.end() ){
|
||||
_pointers* bp = itr->second;
|
||||
remove_file(bp->file);
|
||||
LuceneBase_Pointers.removeitr(itr);
|
||||
}else{
|
||||
CLDebugBreak();
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// other memtracking functions
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
void LuceneBase::__cl_unregister(const void* obj){
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
|
||||
LuceneBase* lb=(LuceneBase*)obj;
|
||||
defPointer::iterator itr = LuceneBase_Pointers.find(lb);
|
||||
CND_PRECONDITION(itr != LuceneBase_Pointers.end(),"__cl_unregister object not found");
|
||||
_pointers* bp = itr->second;
|
||||
LuceneBase_Pointers.removeitr(itr);
|
||||
}
|
||||
|
||||
void* LuceneBase::__cl_voidpadd(void* data, const char* file, int line,size_t size){
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
|
||||
_file* br = get_file(file);
|
||||
_pointers* bp = new _pointers;
|
||||
bp->file = br;
|
||||
bp->initnumber = _instance_counter++;
|
||||
bp->initline = line;
|
||||
|
||||
LuceneBase_Voids.insert(pair<void*,_pointers*>(data,bp));
|
||||
CONSTRUCTOR_LOG("newarr",file,line,size);
|
||||
return data;
|
||||
}
|
||||
void LuceneBase::__cl_voidpremove(const void* data, const char* file, int line){
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
defVoid::iterator itr = LuceneBase_Voids.find(data);
|
||||
if ( itr != LuceneBase_Voids.end() ){
|
||||
_pointers* bp = itr->second;
|
||||
remove_file(bp->file);
|
||||
LuceneBase_Voids.removeitr(itr);
|
||||
}else{
|
||||
printf("Data deleted when not added with _CL_NEWARRAY in %s at %d\n",file,line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//The lucene base memory leak printout functions
|
||||
////////////////////////////////////////////////////////////
|
||||
//static
|
||||
void __internalcl_PrintUnclosedObject(bool isObject, string& sb,_pointers* bp,_file* bf, bool print){
|
||||
TCHAR ttmp[100];
|
||||
char atmp[100];
|
||||
|
||||
sb.append(" ");
|
||||
{
|
||||
_i64tot(bp->initnumber,ttmp,10);
|
||||
STRCPY_TtoA(atmp,ttmp,100);
|
||||
sb.append(atmp);
|
||||
}
|
||||
if ( isObject ){
|
||||
sb.append("(obj). ");
|
||||
}else{
|
||||
sb.append(". ");
|
||||
}
|
||||
sb.append(bf->value);
|
||||
sb.append(", line ");
|
||||
{
|
||||
_i64tot(bp->initline,ttmp,10);
|
||||
STRCPY_TtoA(atmp,ttmp,100);
|
||||
sb.append(atmp);
|
||||
}
|
||||
sb.append("\n");
|
||||
|
||||
if ( print && sb.length() > 0 ){
|
||||
printf("%s\n", sb.c_str());
|
||||
sb = "";
|
||||
}
|
||||
}
|
||||
char* __internalcl_GetUnclosedObjects(bool print){
|
||||
TCHAR ttmp[100];
|
||||
char atmp[100];
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
|
||||
string sb;
|
||||
bool unknowns = false;
|
||||
if ( LuceneBase_Pointers.size() > 0 ){
|
||||
{
|
||||
_i64tot(LuceneBase_Pointers.size(),ttmp,10);
|
||||
STRCPY_TtoA(atmp,ttmp,100);
|
||||
sb.append(atmp);
|
||||
}
|
||||
sb.append(" clucene objects are still open\n");
|
||||
|
||||
defPointer::iterator itr = LuceneBase_Pointers.begin();
|
||||
while ( itr != LuceneBase_Pointers.end() ){
|
||||
_pointers* bp = itr->second;
|
||||
_file* bf = bp->file;
|
||||
|
||||
if ( bp->initline == -1 )
|
||||
unknowns = true;
|
||||
__internalcl_PrintUnclosedObject(true, sb,bp,bf,print);
|
||||
|
||||
itr++;
|
||||
}
|
||||
|
||||
defVoid::iterator itr2 = LuceneBase_Voids.begin();
|
||||
while ( itr2 != LuceneBase_Voids.end() ){
|
||||
_pointers* bp = itr2->second;
|
||||
_file* bf = bp->file;
|
||||
|
||||
if ( bp->initline == -1 )
|
||||
unknowns = true;
|
||||
__internalcl_PrintUnclosedObject(false, sb,bp,bf,print);
|
||||
|
||||
itr2++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( unknowns == true ){
|
||||
sb.append("*** Some memory was not created with _CLNEW and was not tracked... ***\n");
|
||||
sb.append("*** Use _CLNEW instead of new when creating CLucene objects ***\n");
|
||||
sb.append("*** Memory may also have not been freed in the current context ***\n");
|
||||
}
|
||||
|
||||
if ( print ){
|
||||
if ( sb.length() > 0 ){
|
||||
printf("%s\n", sb.c_str());
|
||||
sb = "";
|
||||
}
|
||||
return NULL;
|
||||
}else{
|
||||
if ( sb.length() > 0 )
|
||||
return STRDUP_AtoA(sb.c_str());
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void LuceneBase::__cl_ClearMemory(){
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
|
||||
while ( LuceneBase_Files.size() > 0 ){
|
||||
defFile::iterator fi = LuceneBase_Files.begin();
|
||||
_file* f = fi->second;
|
||||
delete[] f->value;
|
||||
LuceneBase_Files.removeitr (fi);
|
||||
}
|
||||
LuceneBase_Pointers.clear();
|
||||
LuceneBase_Voids.clear();
|
||||
}
|
||||
char* LuceneBase::__cl_GetUnclosedObjects(){
|
||||
return __internalcl_GetUnclosedObjects(false);
|
||||
}
|
||||
//static
|
||||
int32_t LuceneBase::__cl_GetUnclosedObjectsCount(){
|
||||
return LuceneBase_Pointers.size();
|
||||
}
|
||||
|
||||
const char* LuceneBase::__cl_GetUnclosedObject(int32_t item){
|
||||
SCOPED_LOCK_MUTEX(memleak_lock)
|
||||
|
||||
defPointer::iterator itr=LuceneBase_Pointers.begin();
|
||||
int32_t i=0;
|
||||
for ( ;itr!=LuceneBase_Pointers.end() && i<item ;itr++ ){
|
||||
i++;
|
||||
}
|
||||
if ( itr != LuceneBase_Pointers.end() )
|
||||
return itr->second->file->value;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
void LuceneBase::__cl_PrintUnclosedObjects(){
|
||||
__internalcl_GetUnclosedObjects(true);
|
||||
}
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#endif //LUCENE_ENABLE_MEMLEAKTRACKING
|
||||
CL_NS_END
|
||||
@@ -1,772 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_debug_pool_
|
||||
#define _lucene_debug_pool_
|
||||
//this code is based on the boost memory pool library
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
#ifdef LUCENE_ENABLE_MEMORY_POOL //no point including if not using mempool
|
||||
CL_NS_DEF(debug)
|
||||
|
||||
void lucene_release_memory_pool();
|
||||
|
||||
//predefine some classes
|
||||
template <typename UserAllocator=default_user_allocator_malloc_free>
|
||||
class pool;
|
||||
struct default_user_allocator_malloc_free;
|
||||
|
||||
///The LucenePoolBase
|
||||
template <pool<>* mempool>
|
||||
#ifdef LUCENE_ENABLE_REFCOUNT
|
||||
class LucenePoolBase:public LuceneBase{
|
||||
#else
|
||||
class LucenePoolBase{
|
||||
#endif
|
||||
public:
|
||||
LucenePoolBase(){
|
||||
}
|
||||
static void* operator new (size_t size){
|
||||
return mempool->ordered_malloc();
|
||||
}
|
||||
static void operator delete (void *p){
|
||||
mempool->ordered_free(p);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////
|
||||
|
||||
//
|
||||
// gcd is an algorithm that calculates the greatest common divisor of two
|
||||
// integers, using Euclid's algorithm.
|
||||
//
|
||||
// Pre: A > 0 && B > 0
|
||||
// Recommended: A > B
|
||||
template <typename Integer>
|
||||
Integer gcd(Integer A, Integer B)
|
||||
{
|
||||
do
|
||||
{
|
||||
const Integer tmp(B);
|
||||
B = A % B;
|
||||
A = tmp;
|
||||
} while (B != 0);
|
||||
|
||||
return A;
|
||||
}
|
||||
//
|
||||
// lcm is an algorithm that calculates the least common multiple of two
|
||||
// integers.
|
||||
//
|
||||
// Pre: A > 0 && B > 0
|
||||
// Recommended: A > B
|
||||
template <typename Integer>
|
||||
Integer lcm(const Integer & A, const Integer & B)
|
||||
{
|
||||
Integer ret = A;
|
||||
ret /= gcd(A, B);
|
||||
ret *= B;
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct default_user_allocator_malloc_free
|
||||
{
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
static char * malloc(const size_type bytes)
|
||||
{ return reinterpret_cast<char *>(std::malloc(bytes)); }
|
||||
static void free(char * const block)
|
||||
{ std::free(block); }
|
||||
};
|
||||
|
||||
// PODptr is a class that pretends to be a "pointer" to different class types
|
||||
// that don't really exist. It provides member functions to access the "data"
|
||||
// of the "object" it points to. Since these "class" types are of variable
|
||||
// size, and contains some information at the *end* of its memory (for
|
||||
// alignment reasons), PODptr must contain the size of this "class" as well as
|
||||
// the pointer to this "object".
|
||||
// PODptr is a class that pretends to be a "pointer" to different class types
|
||||
// that don't really exist. It provides member functions to access the "data"
|
||||
// of the "object" it points to. Since these "class" types are of variable
|
||||
// size, and contains some information at the *end* of its memory (for
|
||||
// alignment reasons), PODptr must contain the size of this "class" as well as
|
||||
// the pointer to this "object".
|
||||
template <typename SizeType>
|
||||
class PODptr
|
||||
{
|
||||
public:
|
||||
typedef SizeType size_type;
|
||||
|
||||
private:
|
||||
char * ptr;
|
||||
size_type sz;
|
||||
size_t lcm_size;
|
||||
|
||||
char * ptr_next_size() const
|
||||
{ return (ptr + sz - sizeof(size_type)); }
|
||||
char * ptr_next_ptr() const
|
||||
{
|
||||
return (ptr_next_size() - lcm_size);
|
||||
}
|
||||
|
||||
public:
|
||||
PODptr(char * const nptr, const size_type nsize)
|
||||
:ptr(nptr), sz(nsize), lcm_size(lcm(sizeof(size_type), sizeof(void *))) { }
|
||||
PODptr()
|
||||
:ptr(0), sz(0), lcm_size(lcm(sizeof(size_type), sizeof(void *))) { }
|
||||
|
||||
bool valid() const { return (begin() != 0); }
|
||||
void invalidate() { begin() = 0; }
|
||||
char * & begin() { return ptr; }
|
||||
char * begin() const { return ptr; }
|
||||
char * end() const { return ptr_next_ptr(); }
|
||||
size_type total_size() const { return sz; }
|
||||
size_type element_size() const
|
||||
{
|
||||
return (sz - sizeof(size_type) - lcm_size);
|
||||
}
|
||||
|
||||
size_type & next_size() const
|
||||
{ return *(reinterpret_cast<size_type *>(ptr_next_size())); }
|
||||
char * & next_ptr() const
|
||||
{ return *(reinterpret_cast<char **>(ptr_next_ptr())); }
|
||||
|
||||
PODptr next() const
|
||||
{ return PODptr<size_type>(next_ptr(), next_size()); }
|
||||
void next(const PODptr & arg) const
|
||||
{
|
||||
next_ptr() = arg.begin();
|
||||
next_size() = arg.total_size();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename SizeType>
|
||||
class simple_segregated_storage
|
||||
{
|
||||
public:
|
||||
typedef SizeType size_type;
|
||||
|
||||
private:
|
||||
simple_segregated_storage(const simple_segregated_storage &);
|
||||
void operator=(const simple_segregated_storage &);
|
||||
|
||||
// pre: (n > 0), (start != 0), (nextof(start) != 0)
|
||||
// post: (start != 0)
|
||||
static void * try_malloc_n(void * & start, size_type n,
|
||||
size_type partition_size);
|
||||
|
||||
protected:
|
||||
void * first;
|
||||
|
||||
// Traverses the free list referred to by "first",
|
||||
// and returns the iterator previous to where
|
||||
// "ptr" would go if it was in the free list.
|
||||
// Returns 0 if "ptr" would go at the beginning
|
||||
// of the free list (i.e., before "first")
|
||||
void * find_prev(void * ptr);
|
||||
|
||||
// for the sake of code readability :)
|
||||
static void * & nextof(void * const ptr)
|
||||
{ return *(static_cast<void **>(ptr)); }
|
||||
|
||||
public:
|
||||
// Post: empty()
|
||||
simple_segregated_storage()
|
||||
:first(0) { }
|
||||
|
||||
// pre: npartition_sz >= sizeof(void *)
|
||||
// npartition_sz = sizeof(void *) * i, for some integer i
|
||||
// nsz >= npartition_sz
|
||||
// block is properly aligned for an array of object of
|
||||
// size npartition_sz and array of void *
|
||||
// The requirements above guarantee that any pointer to a chunk
|
||||
// (which is a pointer to an element in an array of npartition_sz)
|
||||
// may be cast to void **.
|
||||
static void * segregate(void * block,
|
||||
size_type nsz, size_type npartition_sz,
|
||||
void * end = 0);
|
||||
|
||||
// Same preconditions as 'segregate'
|
||||
// Post: !empty()
|
||||
void add_block(void * const block,
|
||||
const size_type nsz, const size_type npartition_sz)
|
||||
{
|
||||
// Segregate this block and merge its free list into the
|
||||
// free list referred to by "first"
|
||||
first = segregate(block, nsz, npartition_sz, first);
|
||||
}
|
||||
|
||||
// Same preconditions as 'segregate'
|
||||
// Post: !empty()
|
||||
void add_ordered_block(void * const block,
|
||||
const size_type nsz, const size_type npartition_sz)
|
||||
{
|
||||
// This (slower) version of add_block segregates the
|
||||
// block and merges its free list into our free list
|
||||
// in the proper order
|
||||
|
||||
// Find where "block" would go in the free list
|
||||
void * const loc = find_prev(block);
|
||||
|
||||
// Place either at beginning or in middle/end
|
||||
if (loc == 0)
|
||||
add_block(block, nsz, npartition_sz);
|
||||
else
|
||||
nextof(loc) = segregate(block, nsz, npartition_sz, nextof(loc));
|
||||
}
|
||||
|
||||
// default destructor
|
||||
|
||||
bool empty() const { return (first == 0); }
|
||||
|
||||
// pre: !empty()
|
||||
void * malloc()
|
||||
{
|
||||
void * const ret = first;
|
||||
|
||||
// Increment the "first" pointer to point to the next chunk
|
||||
first = nextof(first);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// pre: chunk was previously returned from a malloc() referring to the
|
||||
// same free list
|
||||
// post: !empty()
|
||||
void free(void * const chunk)
|
||||
{
|
||||
nextof(chunk) = first;
|
||||
first = chunk;
|
||||
}
|
||||
|
||||
// pre: chunk was previously returned from a malloc() referring to the
|
||||
// same free list
|
||||
// post: !empty()
|
||||
void ordered_free(void * const chunk)
|
||||
{
|
||||
// This (slower) implementation of 'free' places the memory
|
||||
// back in the list in its proper order.
|
||||
|
||||
// Find where "chunk" goes in the free list
|
||||
void * const loc = find_prev(chunk);
|
||||
|
||||
// Place either at beginning or in middle/end
|
||||
if (loc == 0)
|
||||
free(chunk);
|
||||
else
|
||||
{
|
||||
nextof(chunk) = nextof(loc);
|
||||
nextof(loc) = chunk;
|
||||
}
|
||||
}
|
||||
|
||||
// Note: if you're allocating/deallocating n a lot, you should
|
||||
// be using an ordered pool.
|
||||
void * malloc_n(size_type n, size_type partition_size);
|
||||
|
||||
// pre: chunks was previously allocated from *this with the same
|
||||
// values for n and partition_size
|
||||
// post: !empty()
|
||||
// Note: if you're allocating/deallocating n a lot, you should
|
||||
// be using an ordered pool.
|
||||
void free_n(void * const chunks, const size_type n,
|
||||
const size_type partition_size)
|
||||
{
|
||||
add_block(chunks, n * partition_size, partition_size);
|
||||
}
|
||||
|
||||
// pre: chunks was previously allocated from *this with the same
|
||||
// values for n and partition_size
|
||||
// post: !empty()
|
||||
void ordered_free_n(void * const chunks, const size_type n,
|
||||
const size_type partition_size)
|
||||
{
|
||||
add_ordered_block(chunks, n * partition_size, partition_size);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename UserAllocator>
|
||||
class pool: protected simple_segregated_storage<typename UserAllocator::size_type>
|
||||
{
|
||||
public:
|
||||
typedef UserAllocator user_allocator;
|
||||
typedef typename UserAllocator::size_type size_type;
|
||||
typedef typename UserAllocator::difference_type difference_type;
|
||||
private:
|
||||
// Returns 0 if out-of-memory
|
||||
// Called if malloc/ordered_malloc needs to resize the free list
|
||||
void * malloc_need_resize();
|
||||
void * ordered_malloc_need_resize();
|
||||
|
||||
const size_t min_alloc_size;
|
||||
const size_t min_alloc_size2;
|
||||
protected:
|
||||
PODptr<size_type> list;
|
||||
|
||||
simple_segregated_storage<size_type> & store() { return *this; }
|
||||
const simple_segregated_storage<size_type> & store() const { return *this; }
|
||||
const size_type requested_size;
|
||||
size_type next_size;
|
||||
|
||||
|
||||
// is_from() tests a chunk to determine if it belongs in a block
|
||||
static bool is_from(void * const chunk, char * const i,
|
||||
const size_type sizeof_i)
|
||||
{
|
||||
std::less_equal<void *> lt_eq;
|
||||
std::less<void *> lt;
|
||||
return (lt_eq(i, chunk) && lt(chunk, i + sizeof_i));
|
||||
}
|
||||
|
||||
size_type alloc_size() const
|
||||
{
|
||||
size_type min_size = min_alloc_size;
|
||||
return lcm<size_type>(requested_size, min_size);
|
||||
}
|
||||
|
||||
// for the sake of code readability :)
|
||||
static void * & nextof(void * const ptr)
|
||||
{ return *(static_cast<void **>(ptr)); }
|
||||
|
||||
public:
|
||||
// The second parameter here is an extension!
|
||||
// pre: npartition_size != 0 && nnext_size != 0
|
||||
explicit pool(const size_type nrequested_size,
|
||||
const size_type nnext_size = 32)
|
||||
:requested_size(nrequested_size), next_size(nnext_size),
|
||||
min_alloc_size(lcm(sizeof(void *), sizeof(size_type))),
|
||||
min_alloc_size2(lcm(sizeof(size_type), sizeof(void *)))
|
||||
{ }
|
||||
|
||||
size_type total_size() const { return list.total_size(); }
|
||||
~pool() { purge_memory(); }
|
||||
|
||||
// Releases memory blocks that don't have chunks allocated
|
||||
// pre: lists are ordered
|
||||
// Returns true if memory was actually deallocated
|
||||
bool release_memory();
|
||||
|
||||
// Releases *all* memory blocks, even if chunks are still allocated
|
||||
// Returns true if memory was actually deallocated
|
||||
bool purge_memory();
|
||||
|
||||
// These functions are extensions!
|
||||
size_type get_next_size() const { return next_size; }
|
||||
void set_next_size(const size_type nnext_size) { next_size = nnext_size; }
|
||||
|
||||
// Both malloc and ordered_malloc do a quick inlined check first for any
|
||||
// free chunks. Only if we need to get another memory block do we call
|
||||
// the non-inlined *_need_resize() functions.
|
||||
// Returns 0 if out-of-memory
|
||||
void * malloc()
|
||||
{
|
||||
// Look for a non-empty storage
|
||||
if (!store().empty())
|
||||
return store().malloc();
|
||||
return malloc_need_resize();
|
||||
}
|
||||
|
||||
void * ordered_malloc()
|
||||
{
|
||||
// Look for a non-empty storage
|
||||
if (!store().empty())
|
||||
return store().malloc();
|
||||
return ordered_malloc_need_resize();
|
||||
}
|
||||
|
||||
// Returns 0 if out-of-memory
|
||||
// Allocate a contiguous section of n chunks
|
||||
void * ordered_malloc(size_type n);
|
||||
|
||||
// pre: 'chunk' must have been previously
|
||||
// returned by *this.malloc().
|
||||
void free(void * const chunk)
|
||||
{ store().free(chunk); }
|
||||
|
||||
// pre: 'chunk' must have been previously
|
||||
// returned by *this.malloc().
|
||||
void ordered_free(void * const chunk)
|
||||
{ store().ordered_free(chunk); }
|
||||
|
||||
// pre: 'chunk' must have been previously
|
||||
// returned by *this.malloc(n).
|
||||
void ordered_free(void * const chunks, const size_type n)
|
||||
{
|
||||
const size_type partition_size = alloc_size();
|
||||
const size_type total_req_size = n * requested_size;
|
||||
const size_type num_chunks = total_req_size / partition_size +
|
||||
((total_req_size % partition_size)!=0);
|
||||
|
||||
store().ordered_free_n(chunks, num_chunks, partition_size);
|
||||
}
|
||||
|
||||
// pre: 'chunk' must have been previously
|
||||
// returned by *this.malloc(n).
|
||||
void free(void * const chunks, const size_type n)
|
||||
{
|
||||
const size_type partition_size = alloc_size();
|
||||
const size_type total_req_size = n * requested_size;
|
||||
const size_type num_chunks = total_req_size / partition_size +
|
||||
static_cast<bool>( (total_req_size % partition_size) != 0 );
|
||||
|
||||
store().free_n(chunks, num_chunks, partition_size);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename UserAllocator>
|
||||
bool pool<UserAllocator>::purge_memory()
|
||||
{
|
||||
PODptr<size_type> iter = list;
|
||||
|
||||
if (!iter.valid())
|
||||
return false;
|
||||
|
||||
do
|
||||
{
|
||||
// hold "next" pointer
|
||||
const PODptr<size_type> next = iter.next();
|
||||
|
||||
// delete the storage
|
||||
UserAllocator::free(iter.begin());
|
||||
|
||||
// increment iter
|
||||
iter = next;
|
||||
} while (iter.valid());
|
||||
|
||||
list.invalidate();
|
||||
this->first = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
template <typename UserAllocator>
|
||||
bool pool<UserAllocator>::release_memory()
|
||||
{
|
||||
// This is the return value: it will be set to true when we actually call
|
||||
// UserAllocator::free(..)
|
||||
bool ret = false;
|
||||
|
||||
// This is a current & previous iterator pair over the memory block list
|
||||
PODptr<size_type> ptr = list;
|
||||
PODptr<size_type> prev;
|
||||
|
||||
// This is a current & previous iterator pair over the free memory chunk list
|
||||
// Note that "prev_free" in this case does NOT point to the previous memory
|
||||
// chunk in the free list, but rather the last free memory chunk before the
|
||||
// current block.
|
||||
void * free = this->first;
|
||||
void * prev_free = 0;
|
||||
|
||||
const size_type partition_size = alloc_size();
|
||||
|
||||
// Search through all the all the allocated memory blocks
|
||||
while (ptr.valid())
|
||||
{
|
||||
// At this point:
|
||||
// ptr points to a valid memory block
|
||||
// free points to either:
|
||||
// 0 if there are no more free chunks
|
||||
// the first free chunk in this or some next memory block
|
||||
// prev_free points to either:
|
||||
// the last free chunk in some previous memory block
|
||||
// 0 if there is no such free chunk
|
||||
|
||||
// If there are no more free memory chunks, then every remaining
|
||||
// block is allocated out to its fullest capacity, and we can't
|
||||
// release any more memory
|
||||
if (free == 0)
|
||||
return ret;
|
||||
|
||||
// We have to check all the chunks. If they are *all* free (i.e., present
|
||||
// in the free list), then we can free the block.
|
||||
bool all_chunks_free = true;
|
||||
|
||||
// Iterate 'i' through all chunks in the memory block
|
||||
for (char * i = ptr.begin(); i != ptr.end(); i += partition_size)
|
||||
{
|
||||
// If this chunk is not free
|
||||
if (i != free)
|
||||
{
|
||||
// We won't be able to free this block
|
||||
all_chunks_free = false;
|
||||
|
||||
// Abort searching the chunks; we won't be able to free this
|
||||
// block because a chunk is not free.
|
||||
break;
|
||||
}
|
||||
|
||||
// We do not increment prev_free because we are in the same block
|
||||
free = nextof(free);
|
||||
}
|
||||
|
||||
const PODptr<size_type> next = ptr.next();
|
||||
|
||||
if (!all_chunks_free)
|
||||
{
|
||||
// Rush through all free chunks from this block
|
||||
std::less<void *> lt;
|
||||
void * const last = ptr.end() - partition_size;
|
||||
do
|
||||
{
|
||||
free = nextof(free);
|
||||
} while (lt(free, last));
|
||||
|
||||
// Increment free one more time and set prev_free to maintain the
|
||||
// invariants:
|
||||
// free points to the first free chunk in some next memory block, or
|
||||
// 0 if there is no such chunk.
|
||||
// prev_free points to the last free chunk in this memory block.
|
||||
prev_free = free;
|
||||
free = nextof(free);
|
||||
}
|
||||
else
|
||||
{
|
||||
// All chunks from this block are free
|
||||
|
||||
// Remove block from list
|
||||
if (prev.valid())
|
||||
prev.next(next);
|
||||
else
|
||||
list = next;
|
||||
|
||||
// Remove all entries in the free list from this block
|
||||
if (prev_free != 0)
|
||||
nextof(prev_free) = free;
|
||||
else
|
||||
this->first = free;
|
||||
|
||||
// And release memory
|
||||
UserAllocator::free(ptr.begin());
|
||||
ret = true;
|
||||
}
|
||||
|
||||
// Increment ptr
|
||||
ptr = next;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
template <typename UserAllocator>
|
||||
void * pool<UserAllocator>::ordered_malloc(const size_type n)
|
||||
{
|
||||
const size_type partition_size = alloc_size();
|
||||
const size_type total_req_size = n * requested_size;
|
||||
const size_type num_chunks = total_req_size / partition_size +
|
||||
((total_req_size % partition_size)!=0 );
|
||||
|
||||
void * ret = store().malloc_n(num_chunks, partition_size);
|
||||
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
// Not enougn memory in our storages; make a new storage,
|
||||
next_size = max(next_size, num_chunks);
|
||||
const size_type POD_size = next_size * partition_size +
|
||||
min_alloc_size2 + sizeof(size_type);
|
||||
char* const ptr = UserAllocator::malloc(POD_size);
|
||||
if (ptr == 0)
|
||||
return 0;
|
||||
const PODptr<size_type> node(ptr, POD_size);
|
||||
|
||||
// Split up block so we can use what wasn't requested
|
||||
// (we can use "add_block" here because we know that
|
||||
// the free list is empty, so we don't have to use
|
||||
// the slower ordered version)
|
||||
if (next_size > num_chunks)
|
||||
store().add_block(node.begin() + num_chunks * partition_size,
|
||||
node.element_size() - num_chunks * partition_size, partition_size);
|
||||
|
||||
next_size <<= 1;
|
||||
|
||||
// insert it into the list,
|
||||
// handle border case
|
||||
if (!list.valid() || std::greater<void *>()(list.begin(), node.begin()))
|
||||
{
|
||||
node.next(list);
|
||||
list = node;
|
||||
}
|
||||
else
|
||||
{
|
||||
PODptr<size_type> prev = list;
|
||||
|
||||
while (true)
|
||||
{
|
||||
// if we're about to hit the end or
|
||||
// if we've found where "node" goes
|
||||
if (prev.next_ptr() == 0
|
||||
|| std::greater<void *>()(prev.next_ptr(), node.begin()))
|
||||
break;
|
||||
|
||||
prev = prev.next();
|
||||
}
|
||||
|
||||
node.next(prev.next());
|
||||
prev.next(node);
|
||||
}
|
||||
|
||||
// and return it.
|
||||
return node.begin();
|
||||
}
|
||||
|
||||
template <typename SizeType>
|
||||
void * simple_segregated_storage<SizeType>::malloc_n(const size_type n,
|
||||
const size_type partition_size)
|
||||
{
|
||||
void * start = &first;
|
||||
void * iter;
|
||||
do
|
||||
{
|
||||
if (nextof(start) == 0)
|
||||
return 0;
|
||||
iter = try_malloc_n(start, n, partition_size);
|
||||
} while (iter == 0);
|
||||
void * const ret = nextof(start);
|
||||
nextof(start) = nextof(iter);
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <typename SizeType>
|
||||
void * simple_segregated_storage<SizeType>::find_prev(void * const ptr)
|
||||
{
|
||||
// Handle border case
|
||||
if (first == 0 || std::greater<void *>()(first, ptr))
|
||||
return 0;
|
||||
|
||||
void * iter = first;
|
||||
while (true)
|
||||
{
|
||||
// if we're about to hit the end or
|
||||
// if we've found where "ptr" goes
|
||||
if (nextof(iter) == 0 || std::greater<void *>()(nextof(iter), ptr))
|
||||
return iter;
|
||||
|
||||
iter = nextof(iter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename SizeType>
|
||||
void * simple_segregated_storage<SizeType>::segregate(
|
||||
void * const block,
|
||||
const size_type sz,
|
||||
const size_type partition_sz,
|
||||
void * const end)
|
||||
{
|
||||
// Get pointer to last valid chunk, preventing overflow on size calculations
|
||||
// The division followed by the multiplication just makes sure that
|
||||
// old == block + partition_sz * i, for some integer i, even if the
|
||||
// block size (sz) is not a multiple of the partition size.
|
||||
char * old = static_cast<char *>(block)
|
||||
+ ((sz - partition_sz) / partition_sz) * partition_sz;
|
||||
|
||||
// Set it to point to the end
|
||||
nextof(old) = end;
|
||||
|
||||
// Handle border case where sz == partition_sz (i.e., we're handling an array
|
||||
// of 1 element)
|
||||
if (old == block)
|
||||
return block;
|
||||
|
||||
// Iterate backwards, building a singly-linked list of pointers
|
||||
for (char * iter = old - partition_sz; iter != block;
|
||||
old = iter, iter -= partition_sz)
|
||||
nextof(iter) = old;
|
||||
|
||||
// Point the first pointer, too
|
||||
nextof(block) = old;
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
// The following function attempts to find n contiguous chunks
|
||||
// of size partition_size in the free list, starting at start.
|
||||
// If it succeds, it returns the last chunk in that contiguous
|
||||
// sequence, so that the sequence is known by [start, {retval}]
|
||||
// If it fails, it does do either because it's at the end of the
|
||||
// free list or hits a non-contiguous chunk. In either case,
|
||||
// it will return 0, and set start to the last considered
|
||||
// chunk. You are at the end of the free list if
|
||||
// nextof(start) == 0. Otherwise, start points to the last
|
||||
// chunk in the contiguous sequence, and nextof(start) points
|
||||
// to the first chunk in the next contiguous sequence (assuming
|
||||
// an ordered free list)
|
||||
template <typename SizeType>
|
||||
void * simple_segregated_storage<SizeType>::try_malloc_n(
|
||||
void * & start, size_type n, const size_type partition_size)
|
||||
{
|
||||
void * iter = nextof(start);
|
||||
while (--n != 0)
|
||||
{
|
||||
void * next = nextof(iter);
|
||||
if (next != static_cast<char *>(iter) + partition_size)
|
||||
{
|
||||
// next == 0 (end-of-list) or non-contiguous chunk found
|
||||
start = iter;
|
||||
return 0;
|
||||
}
|
||||
iter = next;
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
template <typename UserAllocator>
|
||||
void * pool<UserAllocator>::ordered_malloc_need_resize()
|
||||
{
|
||||
// No memory in any of our storages; make a new storage,
|
||||
const size_type partition_size = alloc_size();
|
||||
const size_type POD_size = next_size * partition_size +
|
||||
min_alloc_size2 + sizeof(size_type);
|
||||
char * const ptr = UserAllocator::malloc(POD_size);
|
||||
if (ptr == 0)
|
||||
return 0;
|
||||
const PODptr<size_type> node(ptr, POD_size);
|
||||
next_size <<= 1;
|
||||
|
||||
// initialize it,
|
||||
// (we can use "add_block" here because we know that
|
||||
// the free list is empty, so we don't have to use
|
||||
// the slower ordered version)
|
||||
store().add_block(node.begin(), node.element_size(), partition_size);
|
||||
|
||||
// insert it into the list,
|
||||
// handle border case
|
||||
if (!list.valid() || std::greater<void *>()(list.begin(), node.begin()))
|
||||
{
|
||||
node.next(list);
|
||||
list = node;
|
||||
}
|
||||
else
|
||||
{
|
||||
PODptr<size_type> prev = list;
|
||||
|
||||
while (true)
|
||||
{
|
||||
// if we're about to hit the end or
|
||||
// if we've found where "node" goes
|
||||
if (prev.next_ptr() == 0
|
||||
|| std::greater<void *>()(prev.next_ptr(), node.begin()))
|
||||
break;
|
||||
|
||||
prev = prev.next();
|
||||
}
|
||||
|
||||
node.next(prev.next());
|
||||
prev.next(node);
|
||||
}
|
||||
|
||||
// and return a chunk from it.
|
||||
return store().malloc();
|
||||
}
|
||||
CL_NS_END
|
||||
|
||||
#endif //LUCENE_ENABLE_MEMORY_POOL
|
||||
#endif //lucene_debug_pool
|
||||
@@ -1,56 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
|
||||
#include "DateField.h"
|
||||
#include "CLucene/util/Misc.h"
|
||||
CL_NS_USE(util)
|
||||
CL_NS_DEF(document)
|
||||
|
||||
DateField::~DateField(){
|
||||
}
|
||||
|
||||
TCHAR* DateField::timeToString(const int64_t time) {
|
||||
if (time < 0)
|
||||
_CLTHROWA (CL_ERR_IllegalArgument,"time too early"); //todo: make richer error
|
||||
|
||||
if (time > DATEFIELD_DATE_MAX)
|
||||
_CLTHROWA (CL_ERR_IllegalArgument, "time too late (past DATEFIELD_DATE_MAX"); //todo: make richer error
|
||||
|
||||
TCHAR* buf = _CL_NEWARRAY(TCHAR,DATEFIELD_DATE_LEN + 1);
|
||||
_i64tot(time, buf, 36);
|
||||
int32_t bufLen = _tcslen(buf);
|
||||
|
||||
CND_PRECONDITION (bufLen <= DATEFIELD_DATE_LEN, "timeToString length is greater than 9");
|
||||
|
||||
/* Supply leading zeroes if necessary. */
|
||||
if (bufLen < DATEFIELD_DATE_LEN) {
|
||||
const int32_t nMissingZeroes = DATEFIELD_DATE_LEN - bufLen;
|
||||
/* Move buffer contents forward to make room for leading zeroes. */
|
||||
for (int32_t i = DATEFIELD_DATE_LEN - 1; i >= nMissingZeroes; i--)
|
||||
buf[i] = buf[i - nMissingZeroes];
|
||||
|
||||
{// MSVC6 scoping fix
|
||||
/* Insert leading zeroes. */
|
||||
for (int32_t i = 0; i < nMissingZeroes; i++)
|
||||
buf[i] = '0';
|
||||
}
|
||||
|
||||
buf[DATEFIELD_DATE_LEN] = 0;
|
||||
}
|
||||
|
||||
CND_PRECONDITION (_tcslen(buf) == DATEFIELD_DATE_LEN, "timeToString return is not equal to 9");
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
int64_t DateField::stringToTime(const TCHAR* time) {
|
||||
TCHAR* end;
|
||||
return _tcstoi64(time, &end, 36);
|
||||
}
|
||||
|
||||
CL_NS_END
|
||||
@@ -1,58 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_document_DateField_
|
||||
#define _lucene_document_DateField_
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
CL_NS_DEF(document)
|
||||
|
||||
//here are some constants used throughout clucene
|
||||
//make date strings long enough to last a millenium
|
||||
#define DATEFIELD_DATE_MAX _ILONGLONG(31536000000000) //1000L*365*24*60*60*1000
|
||||
|
||||
#define DATEFIELD_DATE_LEN 9 ////Long.toString(DATEFIELD_DATE_MAX, Character.MAX_RADIX).length()
|
||||
|
||||
/**
|
||||
* Provides support for converting dates to strings and vice-versa.
|
||||
* The strings are structured so that lexicographic sorting orders by date,
|
||||
* which makes them suitable for use as field values and search terms.
|
||||
*
|
||||
* <P>Note that this class saves dates with millisecond granularity,
|
||||
* which is bad for {@link RangeQuery} and {@link PrefixQuery}, as those
|
||||
* queries are expanded to a BooleanQuery with a potentially large number
|
||||
* of terms when searching. Thus you might want to use
|
||||
* {@link DateTools} instead.
|
||||
*
|
||||
* <P>
|
||||
* Note: dates before 1970 cannot be used, and therefore cannot be
|
||||
* indexed when using this class. See {@link DateTools} for an
|
||||
* alternative without such a limitation.
|
||||
*
|
||||
* @deprecated If you build a new index, use {@link DateTools} instead. This class is included for use with existing
|
||||
* indices and will be removed in a future release.
|
||||
*/
|
||||
class DateField :LUCENE_BASE {
|
||||
private:
|
||||
static void initDS();
|
||||
public:
|
||||
~DateField();
|
||||
|
||||
/**
|
||||
* Converts a millisecond time to a string suitable for indexing.
|
||||
* @throws RuntimeException if the time specified in the
|
||||
* method argument is negative, that is, before 1970
|
||||
*/
|
||||
static TCHAR* timeToString(const int64_t time);
|
||||
|
||||
/** Converts a string-encoded date into a millisecond time. */
|
||||
static int64_t stringToTime(const TCHAR* s);
|
||||
};
|
||||
CL_NS_END
|
||||
#endif
|
||||
@@ -1,229 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "CLucene/StdHeader.h"
|
||||
#include "Document.h"
|
||||
#include "Field.h"
|
||||
#include "CLucene/util/StringBuffer.h"
|
||||
|
||||
CL_NS_USE(util)
|
||||
CL_NS_DEF(document)
|
||||
|
||||
DocumentFieldList::DocumentFieldList(Field* f, DocumentFieldList* n ) {
|
||||
//Func - Constructor
|
||||
//Pre - f != NULL
|
||||
// n may be NULL
|
||||
//Post - Instance has been created
|
||||
CND_PRECONDITION(f != NULL, "f is NULL");
|
||||
|
||||
field = f;
|
||||
next = n;
|
||||
}
|
||||
DocumentFieldList::~DocumentFieldList(){
|
||||
//Func - Destructor
|
||||
//Pre - true
|
||||
//Post - Instance has been destroyed
|
||||
|
||||
// Instead of recursively deleting the field list we do
|
||||
// it iteratively to avoid stack overflows when
|
||||
// dealing with several thousands of fields.
|
||||
|
||||
DocumentFieldList* cur = next;
|
||||
while (cur != NULL)
|
||||
{
|
||||
DocumentFieldList* temp = cur->next;
|
||||
cur->next = NULL;
|
||||
|
||||
_CLDELETE(cur);
|
||||
cur = temp;
|
||||
}
|
||||
_CLDELETE(field);
|
||||
}
|
||||
|
||||
|
||||
DocumentFieldEnumeration::DocumentFieldEnumeration(const DocumentFieldList* fl){
|
||||
//Func - Constructor
|
||||
//Pre - fl may be NULL
|
||||
//Post - Instance has been created
|
||||
|
||||
fields = fl;
|
||||
}
|
||||
|
||||
DocumentFieldEnumeration::~DocumentFieldEnumeration(){
|
||||
//Func - Destructor
|
||||
//Pre - true
|
||||
//Post - Instance has been destroyed
|
||||
}
|
||||
|
||||
bool DocumentFieldEnumeration::hasMoreElements() const {
|
||||
return fields == NULL ? false : true;
|
||||
}
|
||||
|
||||
Field* DocumentFieldEnumeration::nextElement() {
|
||||
//Func - Return the next element in the enumeration
|
||||
//Pre - true
|
||||
//Post - The next element is returned or NULL
|
||||
|
||||
|
||||
Field* result = NULL;
|
||||
//Check if fields is still valid
|
||||
if (fields){
|
||||
result = fields->field;
|
||||
fields = fields->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Constructs a new document with no fields. */
|
||||
Document::Document(){
|
||||
//Func - Constructor
|
||||
//Pre - true
|
||||
//Post - Instance has been created
|
||||
boost = 1.0f;
|
||||
fieldList = NULL;
|
||||
}
|
||||
|
||||
Document::~Document(){
|
||||
//Func - Destructor
|
||||
//Pre - true
|
||||
//Post - Instance has been destroyed
|
||||
|
||||
_CLDELETE(fieldList);
|
||||
}
|
||||
|
||||
void Document::add(Field& field) {
|
||||
fieldList = _CLNEW DocumentFieldList(&field, fieldList);
|
||||
}
|
||||
|
||||
void Document::setBoost(float_t boost) {
|
||||
this->boost = boost;
|
||||
}
|
||||
|
||||
float_t Document::getBoost() const {
|
||||
return boost;
|
||||
}
|
||||
|
||||
|
||||
Field* Document::getField(const TCHAR* name) const{
|
||||
CND_PRECONDITION(name != NULL, "name is NULL");
|
||||
|
||||
for (DocumentFieldList* list = fieldList; list != NULL; list = list->next)
|
||||
//cannot use interning here, because name is probably not interned
|
||||
if ( _tcscmp(list->field->name(), name) == 0 ){
|
||||
return list->field;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const TCHAR* Document::get(const TCHAR* field) const {
|
||||
CND_PRECONDITION(field != NULL, "field is NULL");
|
||||
Field *f = getField(field);
|
||||
if (f!=NULL)
|
||||
return f->stringValue(); //this returns null it is a binary(reader)
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DocumentFieldEnumeration* Document::fields() const {
|
||||
return _CLNEW DocumentFieldEnumeration(fieldList);
|
||||
}
|
||||
|
||||
|
||||
TCHAR* Document::toString() const {
|
||||
StringBuffer ret(_T("Document<"));
|
||||
for (DocumentFieldList* list = fieldList; list != NULL; list = list->next) {
|
||||
TCHAR* tmp = list->field->toString();
|
||||
ret.append( tmp );
|
||||
if (list->next != NULL)
|
||||
ret.append(_T(" "));
|
||||
_CLDELETE_ARRAY( tmp );
|
||||
}
|
||||
ret.append(_T(">"));
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Document::removeField(const TCHAR* name) {
|
||||
CND_PRECONDITION(name != NULL, "name is NULL");
|
||||
|
||||
DocumentFieldList* previous = NULL;
|
||||
DocumentFieldList* current = fieldList;
|
||||
while (current != NULL) {
|
||||
//cannot use interning here, because name is probably not interned
|
||||
if ( _tcscmp(current->field->name(),name) == 0 ){
|
||||
if (previous){
|
||||
previous->next = current->next;
|
||||
}else
|
||||
fieldList = current->next;
|
||||
current->next=NULL; //ensure fieldlist destructor doesnt delete it
|
||||
_CLDELETE(current);
|
||||
return;
|
||||
}
|
||||
previous = current;
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
|
||||
void Document::removeFields(const TCHAR* name) {
|
||||
CND_PRECONDITION(name != NULL, "name is NULL");
|
||||
|
||||
DocumentFieldList* previous = NULL;
|
||||
DocumentFieldList* current = fieldList;
|
||||
while (current != NULL) {
|
||||
//cannot use interning here, because name is probably not interned
|
||||
if ( _tcscmp(current->field->name(),name) == 0 ){
|
||||
if (previous){
|
||||
previous->next = current->next;
|
||||
}else
|
||||
fieldList = current->next;
|
||||
|
||||
current->next=NULL; //ensure fieldlist destructor doesnt delete it
|
||||
_CLDELETE(current);
|
||||
|
||||
if ( previous )
|
||||
current = previous->next;
|
||||
else
|
||||
current = fieldList;
|
||||
}else{
|
||||
previous = current;
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TCHAR** Document::getValues(const TCHAR* name) {
|
||||
DocumentFieldEnumeration* it = fields();
|
||||
int32_t count = 0;
|
||||
while ( it->hasMoreElements() ){
|
||||
Field* f = it->nextElement();
|
||||
//cannot use interning here, because name is probably not interned
|
||||
if ( _tcscmp(f->name(),name) == 0 && f->stringValue() != NULL )
|
||||
count++;
|
||||
}
|
||||
_CLDELETE(it);
|
||||
it = fields();
|
||||
|
||||
//todo: there must be a better way of doing this, we are doing two iterations of the fields
|
||||
TCHAR** ret = NULL;
|
||||
if ( count > 0 ){
|
||||
//start again
|
||||
ret = _CL_NEWARRAY(TCHAR*,count+1);
|
||||
int32_t i=0;
|
||||
while ( it->hasMoreElements() ){
|
||||
Field* fld=it->nextElement();
|
||||
if ( _tcscmp(fld->name(),name)== 0 && fld->stringValue() != NULL ){
|
||||
ret[i] = stringDuplicate(fld->stringValue());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
ret[count]=NULL;
|
||||
}
|
||||
_CLDELETE(it);
|
||||
return ret;
|
||||
}
|
||||
CL_NS_END
|
||||
@@ -1,152 +0,0 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
|
||||
*
|
||||
* Distributable under the terms of either the Apache License (Version 2.0) or
|
||||
* the GNU Lesser General Public License, as specified in the COPYING file.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _lucene_document_Document_
|
||||
#define _lucene_document_Document_
|
||||
|
||||
#if defined(_LUCENE_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "Field.h"
|
||||
|
||||
///todo: jlucene has change from using DocumentFieldList/Enumeration
|
||||
///to using a java List... do we want to do this too?
|
||||
CL_NS_DEF(document)
|
||||
|
||||
///\exclude Internal field enumeration
|
||||
class DocumentFieldList :LUCENE_BASE{
|
||||
public:
|
||||
DocumentFieldList(Field* f, DocumentFieldList* n);
|
||||
~DocumentFieldList();
|
||||
Field* field;
|
||||
DocumentFieldList* next;
|
||||
};
|
||||
|
||||
class DocumentFieldEnumeration :LUCENE_BASE{
|
||||
private:
|
||||
const DocumentFieldList* fields;
|
||||
public:
|
||||
DocumentFieldEnumeration(const DocumentFieldList* fl);
|
||||
~DocumentFieldEnumeration();
|
||||
bool hasMoreElements() const;
|
||||
Field* nextElement();
|
||||
};
|
||||
|
||||
/** Documents are the unit of indexing and search.
|
||||
*
|
||||
* A Document is a set of fields. Each field has a name and a textual value.
|
||||
* A field may be {@link Field#isStored() stored} with the document, in which
|
||||
* case it is returned with search hits on the document. Thus each document
|
||||
* should typically contain one or more stored fields which uniquely identify
|
||||
* it.
|
||||
*
|
||||
* <p>Note that fields which are <i>not</i> {@link Field#isStored() stored} are
|
||||
* <i>not</i> available in documents retrieved from the index, e.g. with {@link
|
||||
* Hits#doc(int32_t)}, {@link Searcher#doc(int32_t)} or {@link
|
||||
* IndexReader#document(int32_t)}.
|
||||
*/
|
||||
class Document:LUCENE_BASE {
|
||||
private:
|
||||
DocumentFieldList* fieldList;
|
||||
float_t boost;
|
||||
public:
|
||||
Document();
|
||||
~Document();
|
||||
|
||||
/**
|
||||
* <p>Adds a field to a document. Several fields may be added with
|
||||
* the same name. In this case, if the fields are indexed, their text is
|
||||
* treated as though appended for the purposes of search.</p>
|
||||
* <p> Note that add like the removeField(s) methods only makes sense
|
||||
* prior to adding a document to an index. These methods cannot
|
||||
* be used to change the content of an existing index! In order to achieve this,
|
||||
* a document has to be deleted from an index and a new changed version of that
|
||||
* document has to be added.</p>
|
||||
*
|
||||
*/
|
||||
void add(Field& field);
|
||||
/** Returns a field with the given name if any exist in this document, or
|
||||
* null. If multiple fields exists with this name, this method returns the
|
||||
* first value added.
|
||||
* Note: name is case sensitive
|
||||
*/
|
||||
Field* getField(const TCHAR* name) const;
|
||||
|
||||
/** Returns the string value of the field with the given name if any exist in
|
||||
* this document, or null. If multiple fields exist with this name, this
|
||||
* method returns the first value added. If only binary fields with this name
|
||||
* exist, returns null.
|
||||
*/
|
||||
const TCHAR* get(const TCHAR* field) const;
|
||||
|
||||
/** Returns an Enumeration of all the fields in a document. */
|
||||
DocumentFieldEnumeration* fields() const;
|
||||
/** Prints the fields of a document for human consumption. */
|
||||
TCHAR* toString() const;
|
||||
|
||||
/** Sets a boost factor for hits on any field of this document. This value
|
||||
* will be multiplied into the score of all hits on this document.
|
||||
*
|
||||
* <p>Values are multiplied into the value of {@link Field#getBoost()} of
|
||||
* each field in this document. Thus, this method in effect sets a default
|
||||
* boost for the fields of this document.
|
||||
*
|
||||
* @see Field#setBoost(float_t)
|
||||
*/
|
||||
void setBoost(float_t boost);
|
||||
|
||||
/** Returns the boost factor for hits on any field of this document.
|
||||
*
|
||||
* <p>The default value is 1.0.
|
||||
*
|
||||
* <p>Note: This value is not stored directly with the document in the index.
|
||||
* Documents returned from {@link IndexReader#document(int32_t)} and
|
||||
* {@link Hits#doc(int32_t)} may thus not have the same value present as when
|
||||
* this document was indexed.
|
||||
*
|
||||
* @see #setBoost(float_t)
|
||||
*/
|
||||
float_t getBoost() const;
|
||||
|
||||
/**
|
||||
* <p>Removes field with the specified name from the document.
|
||||
* If multiple fields exist with this name, this method removes the first field that has been added.
|
||||
* If there is no field with the specified name, the document remains unchanged.</p>
|
||||
* <p> Note that the removeField(s) methods like the add method only make sense
|
||||
* prior to adding a document to an index. These methods cannot
|
||||
* be used to change the content of an existing index! In order to achieve this,
|
||||
* a document has to be deleted from an index and a new changed version of that
|
||||
* document has to be added.</p>
|
||||
* Note: name is case sensitive
|
||||
*/
|
||||
void removeField(const TCHAR* name);
|
||||
|
||||
/**
|
||||
* <p>Removes all fields with the given name from the document.
|
||||
* If there is no field with the specified name, the document remains unchanged.</p>
|
||||
* <p> Note that the removeField(s) methods like the add method only make sense
|
||||
* prior to adding a document to an index. These methods cannot
|
||||
* be used to change the content of an existing index! In order to achieve this,
|
||||
* a document has to be deleted from an index and a new changed version of that
|
||||
* document has to be added.</p>
|
||||
* Note: name is case sensitive
|
||||
*/
|
||||
void removeFields(const TCHAR* name);
|
||||
|
||||
/**
|
||||
* Returns an array of values of the field specified as the method parameter.
|
||||
* This method can return <code>null</code>.
|
||||
* Note: name is case sensitive
|
||||
*
|
||||
* @param name the name of the field
|
||||
* @return a <code>String[]</code> of field values
|
||||
*/
|
||||
TCHAR** getValues(const TCHAR* name);
|
||||
};
|
||||
|
||||
CL_NS_END
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user