remem-2.12/0000777000076500007650000000000010014272767006330 5remem-2.12/acconfig.h0000644000076500007650000000017607760625115010175 /* Placate autoheader + automake */ #if 0 #undef PACKAGE #undef VERSION #endif /* signed version of size_t */ #undef ssize_t remem-2.12/aclocal.m40000644000076500007650000010270407760625362010117 # aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # Do all the work for Automake. -*- Autoconf -*- # This macro actually does too much some checks are only needed if # your package does certain things. But this isn't really a big deal. # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... AC_PREREQ([2.52]) # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow # the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_][CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_][CC], defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_][CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_][CXX], defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # Copyright 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.6.3])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # # Check to make sure that the build environment is sane. # # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # -*- Autoconf -*- # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # AM_AUX_DIR_EXPAND # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. # Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50]) AC_DEFUN([AM_AUX_DIR_EXPAND], [ # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # AM_PROG_INSTALL_STRIP # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # serial 4 -*- Autoconf -*- # Copyright 1999, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_$1_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null AC_SUBST([DEPDIR]) ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. #serial 2 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST(am__include) AC_SUBST(am__quote) AC_MSG_RESULT($_am_result) rm -f confinc confmf ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 5 AC_PREREQ(2.52) # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([conditional \"$1\" was never defined. Usually this means the macro was only invoked conditionally.]) fi])]) # Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_PREREQ([2.52]) # serial 6 # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. We must strip everything past the first ":", # and everything past the last "/". # _AM_DIRNAME(PATH) # ----------------- # Like AS_DIRNAME, only do it during macro expansion AC_DEFUN([_AM_DIRNAME], [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, m4_if(regexp([$1], [^//\([^/]\|$\)]), -1, m4_if(regexp([$1], [^/.*]), -1, [.], patsubst([$1], [^\(/\).*], [\1])), patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl ])# _AM_DIRNAME # The stamp files are numbered to have different names. # We could number them on a directory basis, but that's additional # complications, let's have a unique counter. m4_define([_AM_STAMP_Count], [0]) # _AM_STAMP(HEADER) # ----------------- # The name of the stamp file for HEADER. AC_DEFUN([_AM_STAMP], [m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl AS_ESCAPE(_AM_DIRNAME(patsubst([$1], [:.*])))/stamp-h[]_AM_STAMP_Count]) # _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS) # ------------------------------------------------------------ # We used to try to get a real timestamp in stamp-h. But the fear is that # that will cause unnecessary cvs conflicts. AC_DEFUN([_AM_CONFIG_HEADER], [# Add the stamp file to the list of files AC keeps track of, # along with our hook. AC_CONFIG_HEADERS([$1], [# update the timestamp echo 'timestamp for $1' >"_AM_STAMP([$1])" $2], [$3]) ])# _AM_CONFIG_HEADER # AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) # -------------------------------------------------------------- AC_DEFUN([AM_CONFIG_HEADER], [AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) ])# AM_CONFIG_HEADER # Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 5 # AM_PATH_LISPDIR # --------------- AC_DEFUN([AM_PATH_LISPDIR], [AC_ARG_WITH(lispdir, [ --with-lispdir Override the default lisp directory ], [ lispdir="$withval" AC_MSG_CHECKING([where .elc files should go]) AC_MSG_RESULT([$lispdir])], [ # If set to t, that means we are running in a shell under Emacs. # If you have an Emacs named "t", then use the full path. test x"$EMACS" = xt && EMACS= AC_CHECK_PROGS(EMACS, emacs xemacs, no) if test $EMACS != "no"; then if test x${lispdir+set} != xset; then AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [# If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly # Some emacsen will start up in interactive mode, requiring C-x C-c to exit, # which is non-obvious for non-emacs users. # Redirecting /dev/null should help a bit; pity we can't detect "broken" # emacsen earlier and avoid running this altogether. AC_RUN_LOG([$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' conftest.out]) am_cv_lispdir=`sed -n \ -e 's,/$,,' \ -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' \ -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}' \ conftest.out` rm conftest.out if test -z "$am_cv_lispdir"; then am_cv_lispdir='${datadir}/emacs/site-lisp' fi ]) lispdir="$am_cv_lispdir" fi fi ]) AC_SUBST(lispdir) ])# AM_PATH_LISPDIR # Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 AC_PREREQ(2.50) # AM_PROG_LEX # ----------- # Autoconf leaves LEX=: if lex or flex can't be found. Change that to a # "missing" invocation, for better error output. AC_DEFUN([AM_PROG_LEX], [AC_REQUIRE([AM_MISSING_HAS_RUN])dnl AC_REQUIRE([AC_PROG_LEX])dnl if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) remem-2.12/AUTHORS0000644000076500007650000000022707760625115007320 Author/maintainer: Bradley Rhodes Contributors: Jan Nelson Bayard Wenzel Aneel Nazarath Matthew Burnside Alex Park remem-2.12/ChangeLog0000644000076500007650000002631307760625115010026 ChangeLog for remem: 2.12 - 09/21/01 - Made a few changes so Savant will compile on OS-X. First, removed the include of malloc.h in dateyacc.c, since OS-X has trouble finding it and we don't seem to need it anyway. Second, added /sw/include to configure.in and /sw/lib to main/Makefile.am so OS-X can find the PCRE libraries when they were installed using Fink. At least the Makefile change should be moved into configure.in before releasing. Also, I ran the following command: "cd remem-2.12; automake --add-missing -c; autoreconf" to update the "missing" script to a later version. Not yet sure if I want to include the missing files myself or just include that command in the installation directions. 2.11 - 08/06/01 - Changed parse-text so it indexes words with more than one punctuation mark after them (e.g. "doh!!!" or "really?!?" or "hmm..."). Removed pcre from the source distribution. I was including 1.09 and it's up to 3.4 now, plus the library is often included in other distributions (e.g. kdesupport). This distribution should include documentation saying where to get the pcre libraries, and include pointers to RPMS. Updated the email_body_filter_regexps filter to only look at the first 100 lines of a header. This sanity check keeps pcre from blowing up if, say, you're given an email body with thousands of lines of code all indented so it thinks it's all one header. Moved this text to ChangeLog and out of savant.h. Updated the man pages. Removed the code in rmain.c that changed relative pathnames to absolute pathnames, 'cause it upsets Windows (and doesn't seem necessary for Unix). 2.10 - 04/26/01 - changed delimiter of RMAIL from "^_^L" to "(^|\n)^_^L" to fix a potential parse error (it's just more correct, mainly). Also redid parsedoc.c's find_next_doc to not re-search the entire file for a delimiter after it's not found in the first pass (should speed up indexing a little for long documents, e.g. ones with attachments). It also includes a fix for an off-by-one error that made find_next_doc occationally produce one-character-long documents. In remem.el, Fixed clobbering of C-xo bug that I introduced in 2.09, plus fixed remem-query-extra-string-previous bug (should be remem-query-extra-text-string-previous) 2.09 - 01/18/01 - Moved HTML template to before Unix Mail. Unix Mail is just too easy to get a false positive. Added a different Jimminy-query-mode template for the new jimminy. Made it so setting biases doesn't print in non-verbose mode. Added vm-mode to the emacs rmail query mode stuff. Got rid of values.h from dateyacc.c, which was upsetting BSD. 2.08 - 02/18/00 - Included Webra template, logging of doc & query types in remem.el, plus a new normalization based on query length (now normalize by number of unique words, not number of words total). The former tended to penalize longer queries. This is still a tricky issue, but this one at least seems a little bit fairer. Also fixed (I hope) the unix mail to include the first message of the archive. Remem.el now defaults to printing hash marks for how relevant a hit is, rather than the numbers. Also can set it to not show hits below a certain threshold. Also added the remem-mode-db-alist change database based on major mode. 2.07 - 09/23/99 - Included official signature-line filter ("\n-- \n"), Added "follow symbolic links" option. More remem.el work, including looking at "RMAIL" buffer when in "RMAIL-summary" buffer, and same for VM. 2.06 - 09/02/99 - load doc template info all at the beginning to avoid multiple disk seeks while filling the cache. Saves a lot of time when going over NFS (though we're still about twice as slow as from local disk) Lots of remem.el work. 2.05 - 07/19/99 - Added output of template type, output of filename 2.04 - 06/16/99 - Changed all_sims and total_sims to use a hash table instead of an array. This saves buckos of memory in ra-retrieve (like it's probably less than half now on average). Also added C-cf, the field query. 2.03 - 05/25/99 - Added some sanity checks to remem.el so it gives clear error messages when the config is wrong. Also added a sanity check so if a single document goes more than 100K we assume we goofed and truncate (don't index) the rest of the file. 2.02 - 04/12/99 - Added logging to remem.el, added man pages for ra-index and ra-retrieve, and got rid of having a period on a line by itself delimit a query, since that can be a part of a query. (Now you have to use ^D). Also now works on the Alpha (64-bit clean), and fixed a few other minor bugs. 2.01 - 02/10/99 - Mainly changes to remem.el -- a few minor bug fixes, plus lots of changes to have it work for XEmacs. Also got rid of (require 'jimminy), which was neither released with this version nor used by it. 2.00 - 02/26/99 - Release 2.0, which is a major rewrite of almost all aspects of the code. Includes generalized templates using perl regular expressions, generalized addition of new field-types, and function pointers for new data types so you can add new distance metrics (e.g. for GPS coordinates), with potential for code reuse. The text retrieval now uses the Okapi TF/iDF algorithm from City University, and has a completely different database format that is about 40% the size of the old system. The emacs front-end is also rewritten, with mouse support and more customization. It also sends major-mode information to Savant, so the back-end can be more clever about parsing a query (e.g. by pulling out the from-line in email being written). 1.44 - 09/02/98 - Added filename to the subject title line in full query 1.43r- 04/17/98 - Fixed up some header stuff left over from the yenta merge, and a bug where decode_char didn't handle numbers correctly. (Note: the "r" is rhodes -- merge this comment with the other 1.43 branches when checking in, and remember to update the VERSION, above). - 06/20/98 - Added keywords to the full query, event added better error handling, and malex changed the indexer to process and index in a single step instead of two batch jobs. (Version number changes are less often now that we're using CVS.) 1.42 - 04/03/98 - fullquery now includes a breakdown of how much a field contributes to the similarity as a whole. 1.41 - 04/02/98 - Fixed make_nice_date so won't coredump on Euro-format dates (mm/dd/yy) 1.40 - 03/29/98 - Adds the "fullquery" commmand, which gives lots of information as a query result, instead of just the nicely formatted, human readable stuff. Also fixed ra-index so not having a "-v" still works. Finally, the template system now only recognizes a file as a certain type if the "recognize" field appears in the first 500 characters (#define'ed in template.h). This keeps ra-index from thinking a text file is plain email, just because it has "From " at the start of a line somewhere. 1.39r- 03/19/98 - Fixed lots of problems with date & time indexing and lookup 1.38 - 03/16/98 - Re-fixed a problem with retrieval, an array bounds overread in wordvec/readwv_ra.c. 1.37 - 03/13/98 - Cleaned up build system again. 1.36 - 03/13/98 - Completely reconciled versions of index, retrieve and merge. This actually fixes some weird memory corruption bugs carried over from 1.34 as well. 1.35 - 02/19/98 - A semi-broken interim version; after the big merge stemming from v. 1.34, we had to go through and fix all the brokenness and inconsistency. The biggest problem was in wordvec, which had to be custom-modified to satisfy some needs of Yenta. Much of the directory structure was also rearranged. v. 1.35 features a mostly bug-free indexer and a mostly broken retriever. The code was frozen at this point to allow people to play with the indexer. 1.34 - 01/??/98 - Fixed merge_dvmags() so that auto-split-and-merge actually works correctly; also uncommented code to remove temp subdirs. For the record, this is the version from which the RA-Yenta merge was propagated. 1.33 - 01/21/98 - Separated merge.c into mmain.c and merge.c, patched merge.c routines into index.c to effect automatic split-and-merge 1.32 - 01/20/98 - Standardized types in database (DB_INT, etc.); Replaced calls to fwrite/fread with fwrite_big/fread_big, so that databases are in big-endian byte order; Fixed many warnings, a few memory leaks. Incorporated rhodes' div-by-0 bug fix in readwv.c Added -d command line option 1.31 - 01/15/98 - Made to work with GNU autoconf, courtesy of amu 1.30 - 01/13/98 - Code base for anticipated 2.0 release Includes new parsedate package, addition of "delimiter" field to templates, all the new field-type tags added for ISWC/DL, etc... 1.25 - 06/06/97 - Intermediate version; a merge of 1.22 and 1.23. 12/29/97 - Uses TFiDF instead of just term frequency. 1.23 - 06/04/97 - Not actually a descendent of 1.22 but a sibling; never released. Several small bugfixes - memory leaks, array bounds violations, etc. Fixed a some serious bugs in splitting documents by template and in the use of window maps during retrieval. Also added new "index_dotfiles" config variable and added new "Reject" keyword to templates. Also contains many preparations for the grafting-on of a latent-semantic indexing module to replace wordvec. 1.22 - 06/03/97 - Memory leak in writing database fixed, for a significant speedup. Brad added new "location" field to templates, as well as modifying the indexing to make use of fields other than "body" and "title" and modifying retrieval with options for different normalization schemes 1.2 - 03/16/97 - Separated savant into index and retrieve; widespread modularization of internals; new eigentext work begun 1.1 - 10/26/96 - Fixed two bugs: in common.c, fixed by_alpha() to actually sort strings correctly, as opposed to randomly mixing them up, and in inter.c, fixed update_matches() to not try to read index -1 of matches. 1.0 - 07/29/96 - First "mostly stable" public release remem-2.12/config.h.in0000644000076500001200000001102610012362724010237 /* config.h.in. Generated from configure.in by autoheader. */ /* Placate autoheader + automake */ #if 0 #undef PACKAGE #undef VERSION #endif /* signed version of size_t */ #undef ssize_t /* Define to 1 if you have the header file. */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the `bcopy' function. */ #undef HAVE_BCOPY /* Define to 1 if you have the `bzero' function. */ #undef HAVE_BZERO /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `isascii' function. */ #undef HAVE_ISASCII /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_PCRE_PCRE_H /* Define to 1 if you have the header file. */ #undef HAVE_PWD_H /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of a `double', as computed by sizeof. */ #undef SIZEOF_DOUBLE /* The size of a `float', as computed by sizeof. */ #undef SIZEOF_FLOAT /* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of a `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Version number of package */ #undef VERSION /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `long' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define to `int' if doesn't define. */ #undef uid_t remem-2.12/configure0000755000076500007650000072055107760625376010201 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="savutil/savutil.h" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE RANLIB ac_ct_RANLIB YACC EMACS lispdir CPP EGREP LEX LEXLIB LEX_OUTPUT_ROOT INCLUDES LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-lispdir Override the default lisp directory Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core core.* *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version="1.6" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # Define the identity of the package. PACKAGE=remem VERSION=2.12 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} AMTAR=${AMTAR-"${am_missing_run}tar"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Add the stamp file to the list of files AC keeps track of, # along with our hook. ac_config_headers="$ac_config_headers config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_CC_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_YACC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then echo "$as_me:$LINENO: result: $YACC" >&5 echo "${ECHO_T}$YACC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" # Check whether --with-lispdir or --without-lispdir was given. if test "${with_lispdir+set}" = set; then withval="$with_lispdir" lispdir="$withval" echo "$as_me:$LINENO: checking where .elc files should go" >&5 echo $ECHO_N "checking where .elc files should go... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $lispdir" >&5 echo "${ECHO_T}$lispdir" >&6 else # If set to t, that means we are running in a shell under Emacs. # If you have an Emacs named "t", then use the full path. test x"$EMACS" = xt && EMACS= for ac_prog in emacs xemacs do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_EMACS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$EMACS"; then ac_cv_prog_EMACS="$EMACS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_EMACS="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi EMACS=$ac_cv_prog_EMACS if test -n "$EMACS"; then echo "$as_me:$LINENO: result: $EMACS" >&5 echo "${ECHO_T}$EMACS" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$EMACS" && break done test -n "$EMACS" || EMACS="no" if test $EMACS != "no"; then if test x${lispdir+set} != xset; then echo "$as_me:$LINENO: checking where .elc files should go" >&5 echo $ECHO_N "checking where .elc files should go... $ECHO_C" >&6 if test "${am_cv_lispdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly # Some emacsen will start up in interactive mode, requiring C-x C-c to exit, # which is non-obvious for non-emacs users. # Redirecting /dev/null should help a bit; pity we can't detect "broken" # emacsen earlier and avoid running this altogether. { (echo "$as_me:$LINENO: \$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) \"\\n\")) (setq load-path (cdr load-path)))' conftest.out") >&5 ($EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' conftest.out) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } am_cv_lispdir=`sed -n \ -e 's,/$,,' \ -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' \ -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}' \ conftest.out` rm conftest.out if test -z "$am_cv_lispdir"; then am_cv_lispdir='${datadir}/emacs/site-lisp' fi fi echo "$as_me:$LINENO: result: $am_cv_lispdir" >&5 echo "${ECHO_T}$am_cv_lispdir" >&6 lispdir="$am_cv_lispdir" fi fi fi; ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in dir; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6 if test "$ac_cv_search_opendir" != no; then test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" fi else echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_opendir" = no; then for ac_lib in x; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char opendir (); int main () { opendir (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_opendir="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6 if test "$ac_cv_search_opendir" != no; then test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in pcre/pcre.h sys/time.h sys/stat.h unistd.h pwd.h sys/types.h alloca.h errno.h limits.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 if test "${ac_cv_type_uid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 echo "${ECHO_T}$ac_cv_type_uid_t" >&6 if test $ac_cv_type_uid_t = no; then cat >>confdefs.h <<\_ACEOF #define uid_t int _ACEOF cat >>confdefs.h <<\_ACEOF #define gid_t int _ACEOF fi echo "$as_me:$LINENO: checking for off_t" >&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6 if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((off_t *) 0) return 0; if (sizeof (off_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF #define off_t long _ACEOF fi echo "$as_me:$LINENO: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((pid_t *) 0) return 0; if (sizeof (pid_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6 if test $ac_cv_type_pid_t = yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((size_t *) 0) return 0; if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned _ACEOF fi echo "$as_me:$LINENO: checking for ssize_t" >&5 echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6 if test "${ac_cv_type_ssize_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((ssize_t *) 0) return 0; if (sizeof (ssize_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_ssize_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_ssize_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 echo "${ECHO_T}$ac_cv_type_ssize_t" >&6 if test $ac_cv_type_ssize_t = yes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then echo "$as_me:$LINENO: result: $LEX" >&5 echo "${ECHO_T}$LEX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test -z "$LEXLIB" then echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 if test "${ac_cv_lib_fl_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfl $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); int main () { yywrap (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_fl_yywrap=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fl_yywrap=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 if test $ac_cv_lib_fl_yywrap = yes; then LEXLIB="-lfl" else echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 if test "${ac_cv_lib_l_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ll $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); int main () { yywrap (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_l_yywrap=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_l_yywrap=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 if test $ac_cv_lib_l_yywrap = yes; then LEXLIB="-ll" fi fi fi if test "x$LEX" != "x:"; then echo "$as_me:$LINENO: checking lex output file root" >&5 echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 if test "${ac_cv_prog_lex_root+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # The minimal lex program is just a single line: %%. But some broken lexes # (Solaris, I think it was) want two %% lines, so accommodate them. cat >conftest.l <<_ACEOF %% %% _ACEOF { (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 (eval $LEX conftest.l) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 rm -f conftest.l LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS=$LIBS LIBS="$LIBS $LEXLIB" cat >conftest.$ac_ext <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_lex_yytext_pointer=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS rm -f "${LEX_OUTPUT_ROOT}.c" fi echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 if test $ac_cv_prog_lex_yytext_pointer = yes; then cat >>confdefs.h <<\_ACEOF #define YYTEXT_POINTER 1 _ACEOF fi fi if test "$LEX" = :; then LEX=${am_missing_run}flex fi echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # It does not; compile a test program. if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { _ascii (); _ebcdic (); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 echo "${ECHO_T}$ac_cv_c_bigendian" >&6 case $ac_cv_c_bigendian in yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; no) ;; *) { { echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac echo "$as_me:$LINENO: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6 if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((int *) 0) return 0; if (sizeof (int)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6 echo "$as_me:$LINENO: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6 if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_int" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (int)); } unsigned long ulongval () { return (long) (sizeof (int)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (int))) < 0) { long i = longval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_int=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF echo "$as_me:$LINENO: checking for short" >&5 echo $ECHO_N "checking for short... $ECHO_C" >&6 if test "${ac_cv_type_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((short *) 0) return 0; if (sizeof (short)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_short=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_short=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 echo "${ECHO_T}$ac_cv_type_short" >&6 echo "$as_me:$LINENO: checking size of short" >&5 echo $ECHO_N "checking size of short... $ECHO_C" >&6 if test "${ac_cv_sizeof_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_short" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (short)); } unsigned long ulongval () { return (long) (sizeof (short)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (short))) < 0) { long i = longval (); if (i != ((long) (sizeof (short)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (short)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_short=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 echo "${ECHO_T}$ac_cv_sizeof_short" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF echo "$as_me:$LINENO: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6 if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((long *) 0) return 0; if (sizeof (long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6 echo "$as_me:$LINENO: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (long)); } unsigned long ulongval () { return (long) (sizeof (long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (long))) < 0) { long i = longval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_long=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF echo "$as_me:$LINENO: checking for float" >&5 echo $ECHO_N "checking for float... $ECHO_C" >&6 if test "${ac_cv_type_float+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((float *) 0) return 0; if (sizeof (float)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_float=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_float=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_float" >&5 echo "${ECHO_T}$ac_cv_type_float" >&6 echo "$as_me:$LINENO: checking size of float" >&5 echo $ECHO_N "checking size of float... $ECHO_C" >&6 if test "${ac_cv_sizeof_float+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_float" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_float=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (float), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (float), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (float)); } unsigned long ulongval () { return (long) (sizeof (float)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (float))) < 0) { long i = longval (); if (i != ((long) (sizeof (float)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (float)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_float=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (float), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (float), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_float=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5 echo "${ECHO_T}$ac_cv_sizeof_float" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_FLOAT $ac_cv_sizeof_float _ACEOF echo "$as_me:$LINENO: checking for double" >&5 echo $ECHO_N "checking for double... $ECHO_C" >&6 if test "${ac_cv_type_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((double *) 0) return 0; if (sizeof (double)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_double=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_double=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_double" >&5 echo "${ECHO_T}$ac_cv_type_double" >&6 echo "$as_me:$LINENO: checking size of double" >&5 echo $ECHO_N "checking size of double... $ECHO_C" >&6 if test "${ac_cv_sizeof_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_double" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_double=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (double), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (double), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (double)); } unsigned long ulongval () { return (long) (sizeof (double)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (double))) < 0) { long i = longval (); if (i != ((long) (sizeof (double)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (double)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_double=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (double), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (double), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_double=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5 echo "${ECHO_T}$ac_cv_sizeof_double" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_DOUBLE $ac_cv_sizeof_double _ACEOF for ac_header in stdlib.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for working mmap" >&5 echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !STDC_HEADERS && !HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #if !HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ # if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # if HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; int i, pagesize; int fd; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) exit (1); for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) exit (1); if (write (fd, data, pagesize) != pagesize) exit (1); close (fd); /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) exit (1); data2 = (char *) malloc (2 * pagesize); if (!data2) exit (1); data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) exit (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) exit (1); /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) exit (1); if (read (fd, data3, pagesize) != pagesize) exit (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) exit (1); close (fd); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_mmap_fixed_mapped=no fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 if test $ac_cv_func_mmap_fixed_mapped = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 _ACEOF fi rm -f conftest.mmap for ac_func in bcopy bzero getcwd gettimeofday isascii strdup regcomp strerror strtol memmove do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done INCLUDES="$INCLUDES -I\$(top_srcdir) -I\$(top_srcdir)/savutil" INCLUDES="$INCLUDES -I\$(top_srcdir)/savutil/parsedate" # INCLUDES="$INCLUDES -I\$(top_srcdir)/savutil/pcre" # INCLUDES="$INCLUDES -I\$(top_srcdir)/savutil/zlib" INCLUDES="$INCLUDES -I\$(top_srcdir)/template" INCLUDES="$INCLUDES -I\$(top_srcdir)/plugins" INCLUDES="$INCLUDES -I\/usr/include/pcre" INCLUDES="$INCLUDES -I\/sw/include" # iostream and iostream2 commented-out from AC_OUTPUT below because # they force one to have a working C++ compiler, but aren't used in # the final binary. --- Foner 30 Jun 98. # savutil/zlib/contrib/iostream/Makefile # savutil/zlib/contrib/iostream2/Makefile ac_config_files="$ac_config_files Makefile savutil/Makefile savutil/parsedate/Makefile template/Makefile plugins/Makefile main/Makefile other/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "savutil/Makefile" ) CONFIG_FILES="$CONFIG_FILES savutil/Makefile" ;; "savutil/parsedate/Makefile" ) CONFIG_FILES="$CONFIG_FILES savutil/parsedate/Makefile" ;; "template/Makefile" ) CONFIG_FILES="$CONFIG_FILES template/Makefile" ;; "plugins/Makefile" ) CONFIG_FILES="$CONFIG_FILES plugins/Makefile" ;; "main/Makefile" ) CONFIG_FILES="$CONFIG_FILES main/Makefile" ;; "other/Makefile" ) CONFIG_FILES="$CONFIG_FILES other/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@YACC@,$YACC,;t t s,@EMACS@,$EMACS,;t t s,@lispdir@,$lispdir,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LEX@,$LEX,;t t s,@LEXLIB@,$LEXLIB,;t t s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t s,@INCLUDES@,$INCLUDES,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Run the commands associated with the file. case $ac_file in config.h ) # update the timestamp echo 'timestamp for config.h' >"./stamp-h1" ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi # savutil/pcre/Makefile \ # savutil/zlib/Makefile savutil/zlib/amiga/Makefile \ # savutil/zlib/contrib/Makefile savutil/zlib/contrib/asm386/Makefile \ # savutil/zlib/contrib/minizip/Makefile savutil/zlib/contrib/untgz/Makefile \ # savutil/zlib/msdos/Makefile savutil/zlib/nt/Makefile \ remem-2.12/configure.in0000644000076500007650000000542107760625115010562 dnl Process this file with autoconf to produce a configure script. AC_INIT(savutil/savutil.h) AM_INIT_AUTOMAKE(remem, 2.12) AM_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CC dnl We only need CXX if we're using C++, but only iostream/iostream2 in dnl zlib/contrib need that. Since C++ is often misconfigured and/or since dnl those programs' use of it may be broken (Linux gets fatal compiler warnings dnl using "egcs-2.90.27 980315 (egcs-1.0.2 release)", though HPUX compiles it dnl just fine using g++ 2.7.2.2), we'll just punt the whole issue and not compile dnl those programs. Hence, we don't need to check on C++ here, either. dnl AC_PROG_CXX AC_PROG_RANLIB AC_PROG_YACC AM_PATH_LISPDIR dnl Checks for libraries. dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS(pcre/pcre.h sys/time.h sys/stat.h unistd.h pwd.h sys/types.h alloca.h errno.h limits.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_UID_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_CHECK_TYPE(ssize_t, int) AM_PROG_LEX AC_HEADER_TIME AC_STRUCT_TM dnl Get byte-order and the sizes of these types AC_C_BIGENDIAN AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(float) AC_CHECK_SIZEOF(double) dnl Checks for library functions. AC_FUNC_MMAP AC_CHECK_FUNCS(bcopy bzero getcwd gettimeofday isascii strdup regcomp strerror strtol memmove) dnl Note that I added /usr/include/pcre because some installations keep dnl pcre header files there, while others keep them in /usr/include. This dnl makes sure I find it in either place. dnl I've also added /sw/include/ so Mac OS-X users who use Fink will dnl be able to find the PCRE libraries. INCLUDES="$INCLUDES -I\$(top_srcdir) -I\$(top_srcdir)/savutil" INCLUDES="$INCLUDES -I\$(top_srcdir)/savutil/parsedate" # INCLUDES="$INCLUDES -I\$(top_srcdir)/savutil/pcre" # INCLUDES="$INCLUDES -I\$(top_srcdir)/savutil/zlib" INCLUDES="$INCLUDES -I\$(top_srcdir)/template" INCLUDES="$INCLUDES -I\$(top_srcdir)/plugins" INCLUDES="$INCLUDES -I\/usr/include/pcre" INCLUDES="$INCLUDES -I\/sw/include" AC_SUBST(INCLUDES) # iostream and iostream2 commented-out from AC_OUTPUT below because # they force one to have a working C++ compiler, but aren't used in # the final binary. --- Foner 30 Jun 98. # savutil/zlib/contrib/iostream/Makefile # savutil/zlib/contrib/iostream2/Makefile AC_OUTPUT([Makefile savutil/Makefile \ savutil/parsedate/Makefile \ template/Makefile \ plugins/Makefile main/Makefile other/Makefile]) # savutil/pcre/Makefile \ # savutil/zlib/Makefile savutil/zlib/amiga/Makefile \ # savutil/zlib/contrib/Makefile savutil/zlib/contrib/asm386/Makefile \ # savutil/zlib/contrib/minizip/Makefile savutil/zlib/contrib/untgz/Makefile \ # savutil/zlib/msdos/Makefile savutil/zlib/nt/Makefile \ remem-2.12/COPYING0000644000076500007650000004311007760625115007301 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. remem-2.12/depcomp0000755000076500007650000003033507760625115007630 #! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. This file always lives in the current directory. # Also, the AIX compiler puts `$object:' at the start of each line; # $object doesn't have directory information. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. base=`echo "$object" | sed -e 's/\.o$//' -e 's/\.lo$//'` tmpdepfile1="$base.o.d" tmpdepfile2="$base.d" if test "$libtool" = yes; then "$@" -Wc,-MD else "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. test -z "$dashmflag" && dashmflag=-M ( IFS=" " case " $* " in *" --mode=compile "*) # this is libtool, let us make it quiet for arg do # cycle over the arguments case "$arg" in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) # X makedepend ( shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift;; -*) ;; *) set fnord "$@" "$arg"; shift;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 remem-2.12/elisp-comp0000755000076500007650000000365607760625115010257 #!/bin/sh # Copyright 1995 Free Software Foundation, Inc. # François Pinard , 1995. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This script byte-compiles all `.el' files which are part of its # arguments, using GNU Emacs, and put the resulting `.elc' files into # the current directory, so disregarding the original directories used # in `.el' arguments. # # This script manages in such a way that all Emacs LISP files to # be compiled are made visible between themselves, in the event # they require or load-library one another. if test $# = 0; then echo 1>&2 "No files given to $0" exit 1 else if test -z "$EMACS" || test "$EMACS" = "t"; then # Value of "t" means we are running in a shell under Emacs. # Just assume Emacs is called "emacs". EMACS=emacs fi tempdir=elc.$$ mkdir $tempdir cp $* $tempdir cd $tempdir echo "(setq load-path (cons nil load-path))" > script $EMACS -batch -q -l script -f batch-byte-compile *.el mv *.elc .. cd .. rm -fr $tempdir fi remem-2.12/INSTALL0000644000076500007650000001744107760625115007307 Contents -------- 1. Building the Remembrance Agent 2. Creating a database from a collection of text 3. Using the Remembrance Agent in Emacs 1. Building the Remembrance Agent ---------------------------------- The RA back-end has two executables, "ra-index" and "ra-retrieve", which together make the system called Savant. Since you are reading this file, I assume you've already uncompressed and untarred the RA distribution. To build Savant, cd to the RA directory type: ./configure; make This should analyze your system, and then make appropriate binaries of ra-index and ra-retrieve. If you have trouble, make sure you are using the GNU version of make ("make --version" should produce something sensible). It might also be called "gmake" on your system. Once the compilation is finished, the code you will need is: main/ra-index: Binary file for indexing documents main/ra-retrieve: Binary file for retrieving documents other/remem.el: Emacs interface to Savant Move ra-index and ra-retrieve to wherever you normally keep executables. Copy remem.el to wherever you keep emacs-lisp files. If you don't have a place for elisp files, you can just create a directory called "elisp" off of your main directory and put them there. You can then delete the source files if you like. 2. Creating a database from a collection of text ------------------------------------------------- Savant has two executables, one which indexes documents into databases, and one which performs interactive retrievals from these databases. To index, you must have a set of source text-files, and a directory Savant can put database files into. Usage: ra-index [-v] [-d] [-s] [] ... [-e [] ...] The arguments may be files or directories. If a directory is in the list, Savant will use all its contents, recursing into all subdirectories. Non-text files and backup files (those appended with ~ or prepended with #) are ignored. It also ignores dot-files (those starting with .) and unless you specify the "-s" flag it will also ignore symbolic links. Any files or directories specified after the optional -e flag will be excluded. Savant will use any files it finds to create a database in the specified base directory, which must already exist. The optional -v argument (verbose) will direct Savant to keep you updated on its progress. So for example, ra-index -v ~/RA-indexes/mail ~/RMAIL ~/Rmail-files -e ~/Rmail-files/Old-files will build a database in the ~/RA-indexes/mail directory, made up of emails from my RMAIL file plus all files and subdirectories of ~/Rmail-files, excluding files and directories in ~/Rmail-files/Old-files. The optional -d flag turns on debugging information. ***IMPORTANT***: Savant can build databases in any directory you like, but the emacs interface for the Remembrance Agent expects a particular structure. For each database you want to make, you should create a directory, and all these directories should live in the same parent directory. For example, for my own use I have a directory ~/RA-indexes/, and within that are the directories ~/RA-indexes/mail/, ~/RA-indexes/papers/, etc. which actually contain the database files. To see how Savant interacts with emacs while the remembrance agent is running, try running ra-retrieve with the command 'ra-retrieve -v ' after creating a database using index. You can use ra-retrieve as a simple search engine, but usually ra-retrieve is only called by the emacs front-end. 3. Using the Remembrance Agent in Emacs ---------------------------------------- You can load the Remembrance Agent automatically every time you run emacs by adding this line to your .emacs file in your homedir: (load "remem.el") This assumes that you put remem.el into a directory that is in your emacs load-path. To set that loadpath to include the directory ~/elisp/, you can use the line: (setq load-path (append (list (expand-file-name "~/elisp")) load-path)) Before the Remembrance Agent can be used, several variables must be configured. These are listed at the top of remem.el, and are documented there as well. You will either want to set these in your .emacs file or create a file called "remem-custom.el" and load that file after loading remem.el. You probably don't want to set them in remem.el, unless you are the only person using this copy of the remembrance agent. (setq remem-prog-dir ) (setq remem-database-dir ) (setq remem-scopes-list ) should be the full name of the directory where you put the ra-retrieve executable, enclosed in double quotes. This defaults to "/usr/local/bin". On some systems, you need to make sure not to end the directory with a slash ("/"). should be the full name of the directory which holds your database directories, enclosed in double quotes. Note that this is the name of a directory containing directories, not the directory containing the database files themselves. This defaults to "~/RA-indexes". On some systems, you need to make sure not to end the directory with a slash ("/"). remem-scopes-list: you can display several different "scopes," all with separate processes performing retrievals simultaneously. Scopes can have different databases, update frequencies, and ranges of words it uses for a "query." Each scope looks like this: (DIRN NUM-LINES UPDATE-TIME QUERY-RANGE) DIRN is the subdirectory of remem-database-dir with the desired database (This is the name of a sub-directory in remem-database-dir) NUM-LINES is the number of lines that you want the scope to show (initially) UPDATE-TIME is the time between scope updates (in seconds) QUERY-RANGE number of words around your cursor that you want the scope to query on For example, my own customization shows this: (setq remem-scopes-list '(("my-email" 6 5 500) ("my-notes" 2 10 500))) This sets up two scopes. The first displays six suggestions from the index directory "/home/rhodes/RA-indexes/my-email/", updated every five seconds, based on the last 500 words around my cursor (where a word is considered 5 characters, so that's really just the last 500 X 5 = 2500 characters). The second scope displays two lines from "/home/rhodes/RA-indexes/my-email/", updated every ten seconds, also based on 2500 characters. The rest of the customizations set colors, logging, display of suggestions, display thresholds and the prefix for RA commands. The default colors are set for a light background, but shift if you set hilit-background-mode to 'dark. They're all documented in remem.el -- play around with them. Okay! After these customizations are made, you can start the Remembrance Agent by typing C-c r t. It will create its window and after a moment or two begin to display suggestions like: 1 + rhodes RA presence paper stuff 04/14/97 papers suggestions, ra 2 tara Questions digest for IA class 09/15/97 agents-class remembrance, agent 3 ++ rhodes RA Projects Internal 03/09/99 ra-bugs-archive window, display This can be summarized as The rating is a measure from zero to two plus signs (0 to 1 if you set remem-print-exact-relevance-p to t) and indicate how relevant the document is to a sample of your current buffer. If you have remem-print-even-bad-relevance-p set to t then suggestions below the minimum threshold will print with a "-" sign, otherwise they'll show up as "No Sugestion." To see a suggested document, type C-c r . The keywords are the top five keywords that contributed to making this suggestion, in order. remem-2.12/install-sh0000744000076500007650000001272007760625115010253 #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # 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}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # 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 $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 remem-2.12/main/0000777000076500007650000000000010014272767007254 5remem-2.12/main/imain.c0000644000076500007650000003503707760625114010443 /* imain.c: This is the main for Savant 2.0, now with regexp parsing. It does all the indexing for savant. */ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "parsedoc.h" #include "conftemplates.h" #include "plugins.h" #include #include extern List_of_General_Templates *All_General_Templates; void instructions(void); void IndexError (int errcode, char *errstring); char **source_from_file(char *filename); int source_count(char *); int SavantVerbose = 0, SavantDebug = 0, SavantFollowSymlinks = 0; UserVars Config; /* Initialized in load_config */ /* IndexError is Index's error handler. SavantError will point to it. All it does is print the error string and exit. */ void instructions(void) { fprintf(stderr,"\nusage:\n"); fprintf(stderr," ra-index [--version] [-v] [-d] [-s] [-e ]\n"); fprintf(stderr," -v invokes savant indexing verbosely; -d provides debugging messages; -s means to follow symbolic links. \n"); fflush(stderr); } char **source_from_file(char *filename) { int i=0, j=0, *source_sizes, nsources; char *str, c, b, **result, file_path[PATHLEN+1]; FILE *ifp; if(filename[0] != '/') { #ifdef HAVE_GETCWD getcwd(file_path, PATHLEN); #else getwd(file_path); #endif strcat(file_path, "/"); strncat(file_path, filename, PATHLEN-strlen(file_path)); } else strncpy(file_path, filename, PATHLEN); file_path[PATHLEN-1] = '\0'; if((ifp = fopen(file_path,"r")) == NULL) { SavantError(ENOENT, "source_file: Unable to open file containing source filenames"); } fclose (ifp); nsources = source_count(file_path); result = (char **) malloc ((nsources+1) * (sizeof(char *))); source_sizes = (int *) malloc (nsources * (sizeof(int))); for (i = 0; i<(nsources+1); i++) result[i] = NULL; ifp = fopen(filename, "r"); c = getc(ifp); while ((signed char) c != EOF){ b = c; c = getc(ifp); if (isspace(c)) { if(isspace(b)) { continue; } else { source_sizes[j++] = ++i; i = 0; } } else { i++; } } for (i=0; i pre_process: process directories specified on command line -> file_search: recurse through directories, ignoring excludees and symbolic links -> process_file: recognize a file type (ignore binaries & rejected filetypes), and set processed structure for all the documents and their fields within this file (start & end locations) by calling match_pattern -> savant_index: reopen the file, call do_vector on the each document specified in the processed structure, and compute the title info (do_title). -> do_vector: Called once per document. Calls vectorize_file on each field type, merges them together, write some info to disk (DLOFF_FILE, WMAP_FILE, and BIAS_FILE), and call save_dv. If windowing is turned on, do the vectorize_file and save_dv multiple times, once for each window. -> vectorize_file: actually read from the file (based on offsets provided by do_vector), and call vectorize_buffer on the read-in text. Also keep track of where the windows are (in next_window) so we can be in the right place for next time. -> vectorize_buffer: actually encode the words, throw out stop words, stem, etc. Call dvtree_increment to store the code in the DV_Tree "tree" for this vector, and return that tree. --------------------------------------- New calling structure: main: handle all the command-line args and initialize variables -> get_filenames (pre_process): process directories specified on command line. Produce a linked-list of filenames. -> get_files_from_directory (file_search): recurse through directories, ignoring excludees and symbolic links for each file: -> recognize_file: recognize a file's type (ignore binaries & rejected filetypes). for each doc: -> find_next_doc: get the start & end point of the next document, put in some structure -> find_fields: find each field's data in the document and put into a growbuffer. -> parser: run the parser procedure, take the output (e.g. docvecs). -> index-store-method: run the index-store routine to convert the parsed output into an internal format. (e.g. from wordvecs to the sorted list of wordvecs). at the end, for each field-type we've got lying around: -> index-finalize-write: write out the various kinds of fields we've got. */ int main(int argc, char *argv[]) { List_of_Filenames *lof = NULL; List_of_Filenames *current_filename = NULL; int i, j, sources_done=0, nsources, fsources_done=0, start=0, end=0, numDocsInFile=0, totalNumDocs=0; char *config_name=NULL, *input_filename = NULL, **sources, **excludees, *db_name=NULL, db_dir[PATH_MAX+2], *short_name, ***file_sources; FILE *file; General_Template *template = NULL; List_of_General_Templates *lot = NULL; Doc_Info docInfo; /* info on each document as it's processed */ GBuffer *restDocumentText; /* Remaining text in document */ GBuffer *temp; /* Initialize stuff (damn but I want a real OO language!) */ docInfo.documentText = (GBuffer *)malloc(sizeof(GBuffer)); init_GBuffer(docInfo.documentText); for (i=0; i < MAX_NUMBER_FIELDS; i++) { docInfo.fields[i] = (GBuffer *)malloc(sizeof(GBuffer)); init_GBuffer(docInfo.fields[i]); } restDocumentText = (GBuffer *)malloc(sizeof(GBuffer)); init_GBuffer(restDocumentText); /* Set the error printing function to be IndexError */ SetSavantError(&IndexError); sources = (char **) malloc (argc*sizeof(char *)); /* argc is an upper bound */ excludees = (char **) malloc (argc*sizeof(char *)); file_sources = (char ***) malloc (argc*(sizeof(char **))); for (i=0; inext) { if ((strncmp(current_filename->filename, "http://", 7) == 0) || (strncmp(current_filename->filename, "ftp://", 6) == 0)) short_name = current_filename->filename; else short_name = strrchr(current_filename->filename, '/') + 1; if((file = fopen(current_filename->filename,"r")) == NULL) { if(SavantVerbose) { printf("%s: ", short_name); for(i=strlen(short_name); i<20; i++) { fputc(' ', stdout); } printf("cannot open file, ignoring.\n"); fflush(stdout); } continue; } else { if (is_bin_file_p(current_filename->filename)) { if(SavantVerbose) { printf(" %s:", short_name); for(i=strlen(short_name); i<20; i++) { fputc(' ', stdout); } printf("not text, ignoring.\n"); fflush(stdout); } fclose(file); continue; } } if(SavantVerbose) { printf(" %s:", short_name); for(i=strlen(short_name); i<30; i++) { fputc(' ', stdout); } fflush(stdout); } template = recognize_file(file, All_General_Templates); if (template != NULL) { if (SavantVerbose) { printf("%s: ", template->printname); fflush(stdout); } } else { if(SavantVerbose) { printf("not found, ignoring\n"); fflush(stdout); } fclose(file); continue; } if (template->action == REJECT_ACTION) { if (SavantVerbose) printf("rejecting\n"); fflush(stdout); fclose(file); continue; } rewind(file); /* So we undo the reading that recognize did */ strncpy_GBuffer(restDocumentText, "", 0); docInfo.filename = current_filename->filename; numDocsInFile = 0; while ((!feof(file)) || (restDocumentText->tail != 0)) { numDocsInFile++; totalNumDocs++; find_next_doc(restDocumentText, &docInfo, template, file); find_fields(&docInfo, template); filter_fields(&docInfo, template); parse_fields(&docInfo, template); if (SavantDebug) { printf("\n-------------------------NEXT DOC-------------------------\n"); print_doc_info(&docInfo, template); } write_doc_info(&docInfo, template, db_dir, 0); index_store_fields(&docInfo, template, db_dir, 0); cleanup_fields(&docInfo, template); } if (SavantVerbose) printf("%d\n", numDocsInFile); fflush(stdout); fclose(file); } /* Clean up */ if (SavantVerbose){ printf("%d documents total, finalizing write....", totalNumDocs); fflush(stdout); } write_doc_info(NULL, NULL, db_dir, 1); /* Close the doc & titles files */ /* Finalize write for each template */ for (lot = All_General_Templates; lot != NULL; lot = lot->next) { index_store_fields(NULL, lot->template, db_dir, 1); } /* Still need to free docInfo.parsedfields -- but not here */ /* for (i=0; i < MAX_NUMBER_FIELDS; i++) { free(docInfo.parsedfields[i]); } */ free(sources); free_GBuffer(restDocumentText); free(restDocumentText); for(i=0; file_sources[i] != NULL; i++) { /* file_sources are files containing a list of sources */ get_and_append_filenames(file_sources[i], excludees, &lof); free(file_sources[i]); } free(file_sources); SavantError(0, ""); } remem-2.12/main/Makefile.am0000644000076500007650000000624407760625114011234 bin_PROGRAMS=ra-index ra-retrieve # Yes, Virginia, order in the LDADD line -does- matter, because "ld" # is documented to only look for any symbols in a library if there are # already unresolved symbols. In particular, if you put savutil before # savantio, then, when compiling ra-merge, there -aren't- any unresolved # symbols when savutil is scanned, hence it's skipped. Then, when savantio # is scanned, it asks for symbols that are in savutil, but by then savutil # has already been scanned, and ld doesn't arrange to go back and look again. # This foolishness could be solved with either a table or a second pass, but # apparently it's considered a feature that ld doesn't do this. --- Foner. # # I've rearranged the -L's and the -l's to be in the same order relative to # each other, so it's easy to figure out who includes what from where; please # don't gratuitiously disrupt that order (i.e., if you change the ordering of # LDADD, then change LDFLAGS to match). --- Foner. # Note: I've added /sw/lib to the library directories so Mac OS-X people who use # fink can find pcre. This should almost certainly be moved into an autoconf # command, once I figure out how such things are done. -- Brad 9/21/03 ra_index_SOURCES=imain.c ra_index_LDADD=-ltemplate -lplugins -ldate -lm -lpcre -lsavutil # -lz ra_index_LDFLAGS=-L$(top_builddir)/template -L$(top_builddir)/plugins \ -L$(top_builddir)/savutil/parsedate \ -L/sw/lib \ -L$(top_builddir)/savutil # -L$(top_builddir)/savutil/pcre # -L$(top_builddir)/savutil/zlib ra_index_DEPENDENCIES=$(top_builddir)/savutil/libsavutil.a \ $(top_builddir)/savutil/parsedate/libdate.a \ $(top_builddir)/plugins/libplugins.a \ $(top_builddir)/template/libtemplate.a # $(top_builddir)/savutil/pcre/libpcreposix.a # $(top_builddir)/savutil/pcre/libpcre.a # $(top_builddir)/savutil/zlib/libz.a ra_retrieve_SOURCES=rmain.c ra_retrieve_LDADD=-ltemplate -lplugins -ldate -lm -lpcre -lsavutil # -lz ra_retrieve_LDFLAGS=-L$(top_builddir)/template -L$(top_builddir)/plugins \ -L$(top_builddir)/savutil/parsedate \ -L/sw/lib \ -L$(top_builddir)/savutil # -L$(top_builddir)/savutil/pcre # -L$(top_builddir)/savutil/zlib ra_retrieve_DEPENDENCIES=$(top_builddir)/savutil/libsavutil.a \ $(top_builddir)/savutil/parsedate/libdate.a \ $(top_builddir)/plugins/libplugins.a \ $(top_builddir)/template/libtemplate.a # $(top_builddir)/savutil/pcre/libpcreposix.a # $(top_builddir)/savutil/pcre/libpcre.a # $(top_builddir)/savutil/zlib/libz.a EXTRA_DIST=rmain.h $(top_builddir)/savutil/parsedate/libdate.a: cd $(top_builddir)/savutil/parsedate; make libdate.a #$(top_builddir)/savutil/pcre/libpcre.a: # cd $(top_builddir)/savutil/pcre; make libpcre.a #$(top_builddir)/savutil/pcre/libpcreposix.a: # cd $(top_builddir)/savutil/pcre; make libpcreposix.a #$(top_builddir)/savutil/zlib/libz.a: # cd $(top_builddir)/savutil/zlib; make libz.a $(top_builddir)/savutil/libsavutil.a: cd $(top_builddir)/savutil; make libsavutil.a $(top_builddir)/template/libtemplate.a: cd $(top_builddir)/template; make libtemplate.a $(top_builddir)/plugins/libplugins.a: cd $(top_builddir)/plugins; make libplugins.a remem-2.12/main/Makefile.in0000644000076500007650000003067607760626046011260 # Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ CC = @CC@ DEPDIR = @DEPDIR@ EMACS = @EMACS@ INCLUDES = @INCLUDES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ lispdir = @lispdir@ bin_PROGRAMS = ra-index ra-retrieve # Yes, Virginia, order in the LDADD line -does- matter, because "ld" # is documented to only look for any symbols in a library if there are # already unresolved symbols. In particular, if you put savutil before # savantio, then, when compiling ra-merge, there -aren't- any unresolved # symbols when savutil is scanned, hence it's skipped. Then, when savantio # is scanned, it asks for symbols that are in savutil, but by then savutil # has already been scanned, and ld doesn't arrange to go back and look again. # This foolishness could be solved with either a table or a second pass, but # apparently it's considered a feature that ld doesn't do this. --- Foner. # # I've rearranged the -L's and the -l's to be in the same order relative to # each other, so it's easy to figure out who includes what from where; please # don't gratuitiously disrupt that order (i.e., if you change the ordering of # LDADD, then change LDFLAGS to match). --- Foner. # Note: I've added /sw/lib to the library directories so Mac OS-X people who use # fink can find pcre. This should almost certainly be moved into an autoconf # command, once I figure out how such things are done. -- Brad 9/21/03 ra_index_SOURCES = imain.c ra_index_LDADD = -ltemplate -lplugins -ldate -lm -lpcre -lsavutil # -lz ra_index_LDFLAGS = -L$(top_builddir)/template -L$(top_builddir)/plugins \ -L$(top_builddir)/savutil/parsedate \ -L/sw/lib \ -L$(top_builddir)/savutil # -L$(top_builddir)/savutil/pcre # -L$(top_builddir)/savutil/zlib ra_index_DEPENDENCIES = $(top_builddir)/savutil/libsavutil.a \ $(top_builddir)/savutil/parsedate/libdate.a \ $(top_builddir)/plugins/libplugins.a \ $(top_builddir)/template/libtemplate.a # $(top_builddir)/savutil/pcre/libpcreposix.a # $(top_builddir)/savutil/pcre/libpcre.a # $(top_builddir)/savutil/zlib/libz.a ra_retrieve_SOURCES = rmain.c ra_retrieve_LDADD = -ltemplate -lplugins -ldate -lm -lpcre -lsavutil # -lz ra_retrieve_LDFLAGS = -L$(top_builddir)/template -L$(top_builddir)/plugins \ -L$(top_builddir)/savutil/parsedate \ -L/sw/lib \ -L$(top_builddir)/savutil # -L$(top_builddir)/savutil/pcre # -L$(top_builddir)/savutil/zlib ra_retrieve_DEPENDENCIES = $(top_builddir)/savutil/libsavutil.a \ $(top_builddir)/savutil/parsedate/libdate.a \ $(top_builddir)/plugins/libplugins.a \ $(top_builddir)/template/libtemplate.a # $(top_builddir)/savutil/pcre/libpcreposix.a # $(top_builddir)/savutil/pcre/libpcre.a # $(top_builddir)/savutil/zlib/libz.a EXTRA_DIST = rmain.h subdir = main mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = bin_PROGRAMS = ra-index$(EXEEXT) ra-retrieve$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) am_ra_index_OBJECTS = imain.$(OBJEXT) ra_index_OBJECTS = $(am_ra_index_OBJECTS) am_ra_retrieve_OBJECTS = rmain.$(OBJEXT) ra_retrieve_OBJECTS = $(am_ra_retrieve_OBJECTS) DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/imain.Po ./$(DEPDIR)/rmain.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ DIST_SOURCES = $(ra_index_SOURCES) $(ra_retrieve_SOURCES) DIST_COMMON = Makefile.am Makefile.in SOURCES = $(ra_index_SOURCES) $(ra_retrieve_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu main/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) ra-index$(EXEEXT): $(ra_index_OBJECTS) $(ra_index_DEPENDENCIES) @rm -f ra-index$(EXEEXT) $(LINK) $(ra_index_LDFLAGS) $(ra_index_OBJECTS) $(ra_index_LDADD) $(LIBS) ra-retrieve$(EXEEXT): $(ra_retrieve_OBJECTS) $(ra_retrieve_DEPENDENCIES) @rm -f ra-retrieve$(EXEEXT) $(LINK) $(ra_retrieve_LDFLAGS) $(ra_retrieve_OBJECTS) $(ra_retrieve_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imain.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmain.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `cygpath -w $<` CCDEPMODE = @CCDEPMODE@ uninstall-info-am: ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-binPROGRAMS install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-binPROGRAMS uninstall-info-am .PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic distclean distclean-compile distclean-depend \ distclean-generic distclean-tags distdir dvi dvi-am info \ info-am install install-am install-binPROGRAMS install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic tags uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-info-am $(top_builddir)/savutil/parsedate/libdate.a: cd $(top_builddir)/savutil/parsedate; make libdate.a #$(top_builddir)/savutil/pcre/libpcre.a: # cd $(top_builddir)/savutil/pcre; make libpcre.a #$(top_builddir)/savutil/pcre/libpcreposix.a: # cd $(top_builddir)/savutil/pcre; make libpcreposix.a #$(top_builddir)/savutil/zlib/libz.a: # cd $(top_builddir)/savutil/zlib; make libz.a $(top_builddir)/savutil/libsavutil.a: cd $(top_builddir)/savutil; make libsavutil.a $(top_builddir)/template/libtemplate.a: cd $(top_builddir)/template; make libtemplate.a $(top_builddir)/plugins/libplugins.a: cd $(top_builddir)/plugins; make libplugins.a # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: remem-2.12/main/rmain.c0000644000076500007650000010022607760625114010445 /* rmain.c: This is the main for Savant 2.0, now with regexp parsing. */ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "rmain.h" #include "parsedoc.h" #include "conftemplates.h" #include "plugins.h" #include #include #include #include extern List_of_General_Templates *All_General_Templates; extern Array_of_Field_Types *All_Fields; void instructions(void); void RetrieveError (int errcode, char *errstring); int SavantVerbose = 0, SavantDebug = 0, SavantFollowSymlinks = 0; UserVars Config; /* Initialized in load_config */ /* RetrieveError is Retrieve's error handler. SavantError will point to it. All it does is print the error string and exit. */ void RetrieveError (int errcode, char *errstring) { fprintf(stderr, "%s\n", errstring); exit(errcode); } void instructions(void) { fprintf(stderr,"%s\n", REMEM_VERSION); fprintf(stderr,"\nusage:\n"); fprintf(stderr," ra-retrieve [--version] [-v] [-d] [--docnum ]\n"); fprintf(stderr," -v invokes savant retrieval verbosely; -d provides debugging messages.\n"); fprintf(stderr," --docnum prints the specified docnum and exits (also doesn't use as much memory).\n"); fflush(stderr); } void print_menu(void) { printf("\n" "query [n] : Find n most relevant documents to a query. Default is 5.\n" "retrieve n : Retrieve and print the document with document number n.\n" "loc-retrieve n : Retrieve and print the document location for document\n" " number n.\n" "info : Display version and database info.\n" "quit : Quit.\n" /* These are advanced, and probably won't be used in interactive mode anyway. "print-biases : List the handset query biases for each field defined in the template structure.\n" "use-handset-biases : Use handset biases instead of those defined by the query templates.\n" "use-template-biases: Use template biases instead of those defined by hand (default).\n" "set-bias : set the value for an individual query bias.\n" */ "? : Display this help.\n" "\nCommand: "); fflush(stdout); } enum Retrieve_Command get_command (int *argint, char *argstring) { char command[129]; char *argptr=NULL; char *spacepos1, *spacepos2; *argint = 0; argstring[0]='\0'; if (feof(stdin)) return(QUIT_COMMAND); fgets(command,128,stdin); argptr = strstr(command, "query"); if (argptr != NULL) { *argint = atoi(argptr + 5); return(QUERY_COMMAND); } if ((argptr = strstr(command, "quit")) != NULL) { return(QUIT_COMMAND); } if ((argptr = strstr(command, "loc-retrieve")) != NULL) { *argint = atoi(argptr + 12); return(LOCRETRIEVE_COMMAND); } if ((argptr = strstr(command, "retrieve")) != NULL) { *argint = atoi(argptr + 8); return(RETRIEVE_COMMAND); } if (((argptr = strstr(command, "?")) != NULL) || ((argptr = strstr(command, "help")) != NULL)) { return(HELP_COMMAND); } if ((argptr = strstr(command, "print-biases")) != NULL) { return(PRINT_BIASES); } if ((argptr = strstr(command, "use-handset-biases")) != NULL) { return(USE_HANDSET_BIASES); } if ((argptr = strstr(command, "use-template-biases")) != NULL) { return(USE_TEMPLATE_BIASES); } if ((argptr = strstr(command, "set-bias")) != NULL) { spacepos1 = strchr(command, (int)' '); if (spacepos1 != NULL) { spacepos2 = strchr(spacepos1+1, (int)' '); if (spacepos2 != NULL) { strncpy(argstring, spacepos1+1, RA_MIN(MAX_FIELD_NAME_LENGTH, (spacepos2 - spacepos1 - 1))); argstring[RA_MIN(MAX_FIELD_NAME_LENGTH, (spacepos2 - spacepos1 - 1))] = '\0'; *argint = atoi(spacepos2 + 1); } } else { argstring[0] = '\0'; *argint = -1; } return(SET_BIAS_COMMAND); } if ((argptr = strstr(command, "info")) != NULL) { return(DB_INFO_COMMAND); } return(UNKNOWN_COMMAND); } void get_query(GBuffer *query) { char line[129]; if(SavantVerbose) { printf("Type your query now. End with a control-D or control-E on a line by itself.\n"); fflush(stdout); } while(fgets(line,128,stdin) && !(feof(stdin))) { if (strcmp(line,"\n") == 0) { break; } strncat_GBuffer(query, line, strlen(line)); } clearerr(stdin); } void resetTopContributors (Top_Contributors *tc) { int j; for (j=0; j < NUMBER_CONTRIBUTORS_TRACKED; j++) { tc[j].sim = 0.0; tc[j].printword[0] = '\0'; } } void resetDocSims(Remem_Hash_Table *docSims) { rememHashClear(docSims); } void resetDocSimsTotals(Remem_Hash_Table *docSims) { rememHashClear(docSims); } Remem_Hash_Table *initDocSims(int num_docs_total) { Remem_Hash_Table *return_value; int j; return_value = (Remem_Hash_Table *)rememHashCreateTable(65536 + 1); if (return_value == NULL) { SavantError(ENOMEM, "Can't allocate DocSims in rmain.c"); } return(return_value); } Remem_Hash_Table *initDocSimsTotal(int num_docs_total) { Remem_Hash_Table *return_value; int j; return_value = (Remem_Hash_Table *)rememHashCreateTable(65536 + 1); if (return_value == NULL) { SavantError(ENOMEM, "Can't allocate DocSimsTotal in rmain.c"); } return(return_value); } /* Return the number of documents in the database, judging by the size of the titles offset file */ int number_documents(char *db_dir) { FILE *TOFFS_FILE; int retval; TOFFS_FILE = open_or_die(db_dir, TOFFS_FNAME, "r"); retval = (int)(ftell_end(TOFFS_FILE) / sizeof(DB_INT)); fclose(TOFFS_FILE); return(retval); } /* For qsort. Note that we return -1 for docsim1 > docsim2, so that we get large-to-small ordering. */ int compareDocSims(const void *docsim1, const void *docsim2) { Doc_Sim *ds1, *ds2; ds1 = (Doc_Sim *)docsim1; ds2 = (Doc_Sim *)docsim2; if (ds1->sim > ds2->sim) return -1; else if (ds1->sim < ds2->sim) return 1; else return 0; } /* For qsort. Note that we return -1 for docsim1 > docsim2, so that we get large-to-small ordering. */ int compareDocSimsTotals(const void *docsim1, const void *docsim2) { Doc_Sim_Totals *ds1, *ds2; ds1 = (Doc_Sim_Totals *)docsim1; ds2 = (Doc_Sim_Totals *)docsim2; if (ds1->docsim.sim > ds2->docsim.sim) return -1; else if (ds1->docsim.sim < ds2->docsim.sim) return 1; else return 0; } /* Apply biases to these doc sims The query and index vectors each have associated biases attached to each of their fields, like so: Query biases = q1, q2, ..., q{num_fields} Index biases = i1, i2, ..., i{num_fields} Non-normalized biases = q1*i1, q2*i2, ... Normalized biases = q1*i1/M, q2*i2/M, ... where M = combined_bias_sum = q1*i1 + q2*i2 + ... Biased-sim = sim * normalized-bias */ void bias_sims(Remem_Hash_Table *all_sims, List_of_General_Templates *All_General_Templates, Field *thisfield, int *querybiases, Retrieval_Database_Info *rdi, int newquery_p) { static int **index_biases = NULL; /* Cached, computed once ever */ static int number_templates = -1; /* Cached, computed once ever */ static float **combined_biases = NULL; /* Cached, computed once per query (when newquery_p != 0) */ Doc_Sim *sim_element; General_Template *current_template = NULL; List_of_General_Templates *lotptr = NULL; Template_Field_Info *tfi = NULL; DB_UINT i; int T, F, bias; int combined_bias_magnitude = 0; /* A lot of info gets cached. Set it here, if not set yet. */ if (number_templates == -1) { number_templates = 0; for (lotptr = All_General_Templates; (lotptr != NULL); lotptr = lotptr->next) { number_templates++; } } /* index_biases is a 2D array of biases for the different kinds of index files: index_bias[T][F] = index bias for template-typenum T and field-typenum F */ if (index_biases == NULL) { index_biases = (int **)malloc(number_templates * sizeof(int *)); for (i=0; i < number_templates; i++) { index_biases[i] = (int *)calloc(MAX_NUMBER_FIELDS, sizeof(int)); } for (lotptr = All_General_Templates; (lotptr != NULL); lotptr = lotptr->next) { for (i=0; (lotptr->template->fields[i] != NULL) && (i < MAX_NUMBER_FIELDS); i++) { T = lotptr->template->typenum; F = lotptr->template->fields[i]->field->typenum; bias = lotptr->template->fields[i]->bias; index_biases[T][F] = bias; } } } if (combined_biases == NULL) { combined_biases = (float **)malloc(number_templates * sizeof(float *)); for (i=0; i < number_templates; i++) { combined_biases[i] = (float *)malloc(MAX_NUMBER_FIELDS * sizeof(float)); } } if (newquery_p) { for (T=0; T < number_templates; T++) { combined_bias_magnitude = 0; for (F=0; F < MAX_NUMBER_FIELDS; F++) { combined_biases[T][F] = (float)(querybiases[F] * index_biases[T][F]); combined_bias_magnitude += querybiases[F] * index_biases[T][F]; } if (combined_bias_magnitude > 0) { /* Sanity check -- might be a type "REJECT" template */ for (F=0; F < MAX_NUMBER_FIELDS; F++) { combined_biases[T][F] = combined_biases[T][F] / (float)combined_bias_magnitude; } } } } /* OK, so now all the (possibly cached) data is computed -- go through the docs and apply the bias */ for (sim_element = (Doc_Sim *)rememHashItterate(all_sims,1); sim_element != NULL; sim_element = (Doc_Sim *)rememHashItterate(all_sims,0)) { if (sim_element->sim < 0.0) { /* Sanity Check */ sim_element->sim = 0.0; } else { if (sim_element->sim > 1.0) { sim_element->sim = 1.0; } if (sim_element->sim > 0.0) { T = docloc_templateno(rdi, sim_element->docnum); F = thisfield->typenum; sim_element->sim = sim_element->sim * combined_biases[T][F]; } } } } /* Do a sort on the top M doc-sims from the hash table, returning an array of Doc_Sim_Totals of length M. First just find the top M in any order, then do a q-sort on them. */ Doc_Sim_Totals *sortDocSims(Remem_Hash_Table *docSims, int num_docs_total, int num_to_sort) { int i,j, minindex; volatile float maxsim, minsim; Doc_Sim_Totals tempDocSim; Doc_Sim_Totals *sim_total_element; Doc_Sim_Totals *topSims; topSims = (Doc_Sim_Totals *)malloc(sizeof(Doc_Sim_Totals) * num_to_sort); if (num_to_sort > num_docs_total) num_to_sort = num_docs_total; for (i=0;idocsim.sim > topSims[minindex].docsim.sim) { memcpy(&(topSims[minindex]), sim_total_element, sizeof(Doc_Sim_Totals)); for (i=1, minsim = topSims[0].docsim.sim, minindex=0; ifields[fieldnum] != NULL)); fieldnum++) { thisfield = query_template->fields[fieldnum]->field; nextword = thisfield->nextword; update_sims_word = thisfield->update_sims_word; /* Skip if don't have functions defined */ if ((nextword != NULL) && (update_sims_word != NULL)) { newword = nextword(queryInfo->parsedfields[fieldnum], 1); /* If no word at all, go on to next field */ if (newword != NULL) { while (newword != NULL) { update_sims_word(newword, all_sims, thisfield, rdi); free(newword); newword = nextword(queryInfo->parsedfields[fieldnum], 0); } /* modify the sims to handle index and query weights (biases) */ bias_sims(all_sims, All_General_Templates, thisfield, querybiases, rdi, newquery_p); newquery_p = 0; /* For each similarity of this field, add it to the total_sims hash table. */ for (sim_element = (Doc_Sim *)rememHashItterate(all_sims,1); sim_element != NULL; sim_element = (Doc_Sim *)rememHashItterate(all_sims,0)) { if (sim_element->sim > 0.0) { sim_total_element = (Doc_Sim_Totals *)rememHashGet(sim_element->docnum, total_sims); /* If not in the totals hash table yet, put it there */ if (sim_total_element == NULL) { sim_total_element = (Doc_Sim_Totals *)calloc(1,sizeof(Doc_Sim_Totals)); sim_total_element->docsim.docnum = sim_element->docnum; rememHashPut(sim_element->docnum, sim_total_element, total_sims); } sim_total_element->docsim.sim += sim_element->sim; sim_total_element->sim_breakdown[thisfield->typenum] += sim_element->sim; merge_top_contributors(sim_total_element->docsim.top_contributors, sim_element->top_contributors); sim_element->sim = 0.0; resetTopContributors(sim_element->top_contributors); } } } } } return(sortDocSims(total_sims, rdi->number_documents_total, number_docs_being_printed)); } /* Set querybiases to the defaults set in tfi */ void set_querybiases (int *querybiases, Template_Field_Info **tfi) { int i; for (i=0; i < MAX_NUMBER_FIELDS; i++) { querybiases[i] = 0; } for (i=0; ((tfi[i] != NULL) && (i < MAX_NUMBER_FIELDS)); i++) { querybiases[tfi[i]->field->typenum] = tfi[i]->bias; } } /* print a particular document. */ void document_name_and_offsets (int docnum, Retrieval_Database_Info *rdi, char *docfilename, DB_INT *doc_start, DB_INT *doc_end) { static FILE *DOCLOC_FILE = NULL; static FILE *DLOFFS_FILE = NULL; static long endDoclocFile = -1; DB_INT dloff_low, dloff_high, template_number; if (DOCLOC_FILE == NULL) DOCLOC_FILE = open_or_die(rdi->db_dir, DOCLOC_FNAME, "r"); if (DLOFFS_FILE == NULL) DLOFFS_FILE = open_or_die(rdi->db_dir, DLOFFS_FNAME, "r"); if (endDoclocFile == -1) endDoclocFile = ftell_end(DOCLOC_FILE); fseek(DLOFFS_FILE, docnum * sizeof(DB_INT) * 5, SEEK_SET); fread_big(&dloff_low, sizeof(DB_INT), 1, DLOFFS_FILE); fread_big(&dloff_high, sizeof(DB_INT), 1, DLOFFS_FILE); fread_big(doc_start, sizeof(DB_INT), 1, DLOFFS_FILE); fread_big(doc_end, sizeof(DB_INT), 1, DLOFFS_FILE); fread_big(&template_number, sizeof(DB_INT), 1, DLOFFS_FILE); fseek(DOCLOC_FILE, dloff_low, SEEK_SET); fread_big(docfilename, 1, dloff_high - dloff_low, DOCLOC_FILE); docfilename[dloff_high - dloff_low] = '\0'; } /* print the top n document titles. Doc_Sim is presumed sorted. */ void print_top_docs(Doc_Sim_Totals *all_sims, int numDocsToPrint, Retrieval_Database_Info *rdi) { static FILE *TITLES_FILE = NULL; static FILE *TOFFS_FILE = NULL; static long endTitlesFile = -1; char printbuf[TITLE_LENGTH_MAX + 1]; int i,j; DB_UINT docnum, toff_dbuint; float sim; long toff, toff_high; size_t length; if (TITLES_FILE == NULL) TITLES_FILE = open_or_die(rdi->db_dir, TITLES_FNAME, "r"); if (TOFFS_FILE == NULL) TOFFS_FILE = open_or_die(rdi->db_dir, TOFFS_FNAME, "r"); if (endTitlesFile == -1) endTitlesFile = ftell_end(TITLES_FILE); for (i=0; ((i < numDocsToPrint) && (i < rdi->number_documents_total) && (all_sims[i].docsim.sim > 0.0)); i++) { docnum = all_sims[i].docsim.docnum; sim = all_sims[i].docsim.sim; fseek(TOFFS_FILE, docnum * sizeof(DB_INT), SEEK_SET); fread_big((void *)&toff_dbuint, sizeof(DB_INT), 1, TOFFS_FILE); toff = toff_dbuint; if (docnum == rdi->number_documents_total - 1) length = endTitlesFile - toff - 1; /* the -1 is to remove the CR */ else { fread_big((void *)&toff_dbuint, sizeof(DB_INT), 1, TOFFS_FILE); toff_high = toff_dbuint; length = toff_high - toff - 1; /* the -1 is to remove the CR */ } fseek(TITLES_FILE, toff, SEEK_SET); fread_big(printbuf, 1, length, TITLES_FILE); printbuf[length] = '\0'; printf("%-4d%.2f | %d | %s", i+1, sim, docnum, printbuf); qsort(all_sims[i].docsim.top_contributors, NUMBER_CONTRIBUTORS_TRACKED, sizeof(Top_Contributors), &top_contributors_cmp_qsort); for (j=0; (j < NUMBER_CONTRIBUTORS_TRACKED); j++) { if (strlen(all_sims[i].docsim.top_contributors[j].printword) > 0) { if (j>0) printf(", "); printf("%s", all_sims[i].docsim.top_contributors[j].printword); } } printf(" | "); for (j=0; j < MAX_NUMBER_FIELDS; j++) { if (j>0) printf(", "); printf("%.2f", all_sims[i].sim_breakdown[j]); } printf("\n"); } printf("%s\n", RETRIEVAL_SEPERATOR_STRING); fflush(stdout); } /* Print the contents of the given docnum. Executed by a retrieve command or with the --docnum commandline arg */ void print_document_contents (int docnum, Retrieval_Database_Info *rdi) { FILE *RetrievedFile; char *retrievebuf; char docfilename[PATH_MAX]; int bytesread, i; List_of_General_Templates *templatelist; DB_INT templateno; /* Template number for this doc */ DB_INT doc_start, doc_end; if ((docnum < 0) || (docnum >= rdi->number_documents_total)) printf("Document numbers range from 0 to %d\n", rdi->number_documents_total - 1); else { document_name_and_offsets(docnum, rdi, docfilename, &doc_start, &doc_end); RetrievedFile = fopen(docfilename, "r"); if (RetrievedFile == NULL) { printf("Can't open file %s\n(Perhaps the index files are out of date?).\n", docfilename); } else { if (fseek(RetrievedFile, doc_start, SEEK_SET)) { printf("Can't find character offset %d in file %s\n(Perhaps the index files are out of date?).\n", doc_start, docfilename); } else { retrievebuf = (char *)malloc((doc_end - doc_start + 1) * sizeof(char)); bytesread = fread(retrievebuf, sizeof(char), doc_end - doc_start, RetrievedFile); retrievebuf[bytesread] = '\0'; templateno = docloc_templateno (rdi, docnum); for (i=0, templatelist = All_General_Templates; i < templateno; i++, templatelist = templatelist->next); printf("0\n%s\n%s", templatelist->template->printname, retrievebuf); printf("%s\n", RETRIEVAL_SEPERATOR_STRING); free(retrievebuf); } } } } int main(int argc, char *argv[]) { GBuffer *temp; int i; char *config_name=NULL, *db_name=NULL, db_dir[1024], errorstring[128]; enum Retrieve_Command retrieve_command; /* command entered in the command loop */ int command_arg; /* arg for the command entered in the command loop */ char command_argstring[MAX_FIELD_NAME_LENGTH]; General_Template *template = NULL; /* template for this query */ Doc_Info queryInfo; GBuffer query; /* the query entered */ Doc_Sim_Totals *sorted_sims_array; List_of_General_Templates *templatelist; DB_INT templateno; Remem_Hash_Table *all_sims; Remem_Hash_Table *total_sims; int override_query_biases = 0; int querybiases[MAX_NUMBER_FIELDS], handsetbiases[MAX_NUMBER_FIELDS]; char docfilename[PATH_MAX]; DB_INT doc_start, doc_end; Retrieval_Database_Info *rdi; Field *thisfield; char *tmp; long int docnumToLoad = -1; /* Set the error handler to be RetrieveError */ SetSavantError(&RetrieveError); for (i=1; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 'c': if (config_name == NULL) { config_name = argv[++i]; } else { instructions(); SavantError(EINVAL, ""); /* exit(-1); */ } break; case 'v': SavantVerbose = 1; break; case 'd': SavantDebug = 1; break; case '-': if (strcmp(argv[i], "--version")==0) { printf("%s\n", REMEM_VERSION); SavantError(EINVAL, ""); } else if (strcmp(argv[i], "--docnum")==0) { docnumToLoad = strtol(argv[++i], &tmp, 10); if (tmp==argv[i]) { sprintf(errorstring, "%s is not a valid docnum\n", argv[i]); SavantError(EINVAL, errorstring); } } break; default: instructions(); SavantError(EINVAL, ""); /* exit(-1); */ } } else if (db_name == NULL) { db_name = argv[i]; } else { instructions(); SavantError(EINVAL, ""); /* exit(-1); */ } } if(SavantVerbose || SavantDebug) { printf("%s\n",REMEM_VERSION); } if (db_name == NULL) { instructions(); SavantError(EINVAL, ""); /* exit(-1); */ } /* if not absolute pathname, tack it onto cwd */ /* if(db_name[0] != '/') { getcwd(db_dir, 510); strcat(db_dir, "/"); strcat(db_dir, db_name); } else { */ strcpy(db_dir, db_name); /* }*/ /* Initialize stuff (damn but I want a real OO language!) */ rdi = (Retrieval_Database_Info *)malloc(sizeof(Retrieval_Database_Info)); /* Now that that's set, we can find out how many docs we're looking at */ rdi->number_documents_total = number_documents(db_dir); rdi->db_dir = db_dir; if (SavantDebug) printf("rmain.c: About to load config\n"); load_config(); /* If they asked for a docnum on the command-line, just print and exit. No need to do memory-allocation for the similarity stuff or other query-type things. */ if (docnumToLoad >= 0) { print_document_contents(docnumToLoad, rdi); SavantError(EINVAL, ""); } /* Initialize query-stuff, 'cause we're going interactive */ queryInfo.filename = NULL; queryInfo.doc_start = 0; queryInfo.doc_end = 0; queryInfo.docnum = 0; queryInfo.documentText = NULL; for (i=0; i < MAX_NUMBER_FIELDS; i++) { queryInfo.fields[i] = (GBuffer *)malloc(sizeof(GBuffer)); init_GBuffer(queryInfo.fields[i]); } init_GBuffer(&query); all_sims = initDocSims(rdi->number_documents_total); total_sims = initDocSimsTotal(rdi->number_documents_total); /* OK, here's the old call-herarchy for retrieve. It's ugly. main: handle all the command-line args and initialize variables init_read: open all the index files, and read in all the docvec magnitudes. Also reads in the window map info. (this is basically stuff that is needed for each search, in theory at least). savant_retrieve: load in all the bias info. This is presumably also a one-shot (like the stuff loaded by init_read). Enter the main query loop for retrieve. get_query: parse the query, and break into types vectorize_buffer: actually encode the words, throw out stop words, stem, etc. Call dvtree_increment to store the code in the DV_Tree "tree" for this vector, and return that tree. merge_dvtrees: merge different fieldtypes into a single docvec find_matches: figures out the term weight for each word/term. Remember best matches so you can print the terms later update_matches: called once for each unique word in the query. It goes through the supplied wordvec and adds appropriate similarity contributions to the appropriate slots in all_sims. sim_contrib: takes a single doc-ID/word-frequency pair from a retrieved wordvec and, using some other extenuating information, deciding how much it will contribute to that document's similarity rating. Does the logs, chopping algorithm, & stuff like that. Also applies bias info here. print_suggestions: Print them out. ------------------------------------------------------------- New system: main: handle all the command-line args and initialize vars. Load config info, which includes a seperate retrieval template. (same fieldtypes as indexing, different templates & regexps.) command_loop: get the command (e.g. query, print, etc) get_query: read in the query itself into a GBuffer. No processing yet. recognize_query: recognize the query type. Like recognize_file, but with whole query. find_fields: find each field contents and put in a growbuffer. for each field: parser: run the parser procedure on the query, take the output (e.g. a docvec). rank_documents: given the parsed info, individual word similarity plugin, and multi-word sim. plugin rank each document and store in document order. Keep track of the top K words that are most relevant for this field. single-word-metric: compute the relevance of a single word weight in a query to that word's weight in a document. multi-word-metric: given a vector of similarities produced by the single-word-metric, what's the similarity between two vectors. Once for the query: merge_field_rankings: given several document rankings, merge them to a single one using query biases. print_suggestions: print the titles/info for the top N documents. Also print out the top K words that were most relevant for each suggested document being chosen. */ if(SavantVerbose || SavantDebug) { print_menu(); } override_query_biases = 0; for (i=0; i < MAX_NUMBER_FIELDS; i++) { handsetbiases[i] = 1; } while ((retrieve_command = get_command(&command_arg, command_argstring)) != QUIT_COMMAND) { switch (retrieve_command) { case QUERY_COMMAND: if (command_arg <= 0) command_arg = 5; /* if (command_arg > 999) command_arg = 999;*/ strncpy_GBuffer(&query, "", 0); /* clear from the last time */ get_query (&query); queryInfo.documentText = &query; template = recognize_query (query, All_General_Templates); if ((template == NULL) || (template->action == REJECT_ACTION)) { break; /* Shouldn't we print a "." or something? */ } if (!override_query_biases) { set_querybiases(querybiases, template->fields); } find_fields(&queryInfo, template); filter_fields(&queryInfo, template); parse_fields(&queryInfo, template); if (SavantDebug) print_doc_info(&queryInfo, template); sorted_sims_array = rank_docs_for_fields (total_sims, all_sims, &queryInfo, template, All_General_Templates, rdi, command_arg, (override_query_biases ? handsetbiases : querybiases)); print_top_docs(sorted_sims_array, command_arg, rdi); free(sorted_sims_array); cleanup_fields(&queryInfo, template); /* Clean it now so we don't have to later */ resetDocSimsTotals(total_sims); resetDocSims(all_sims); break; case LOCRETRIEVE_COMMAND: if ((command_arg < 0) || (command_arg >= rdi->number_documents_total)) printf("Document numbers range from 0 to %d\n", rdi->number_documents_total - 1); else { document_name_and_offsets(command_arg, rdi, docfilename, &doc_start, &doc_end); templateno = docloc_templateno (rdi, command_arg); for (i=0, templatelist = All_General_Templates; i < templateno; i++, templatelist = templatelist->next); printf("%d\n%d\n%s\n%s\n", doc_start, doc_end, docfilename, templatelist->template->printname); printf("%s\n", RETRIEVAL_SEPERATOR_STRING); } break; case RETRIEVE_COMMAND: print_document_contents (command_arg, rdi); break; case HELP_COMMAND: print_menu(); break; case SET_BIAS_COMMAND: thisfield = get_field_from_allfields(All_Fields, command_argstring); if (thisfield == NULL) printf("Can't find field named \"%s\"\n", command_argstring); else { handsetbiases[thisfield->typenum] = command_arg; if (SavantVerbose) { printf("Setting %s = %d\n", command_argstring, command_arg); } } break; case PRINT_BIASES: for (i=0; i < MAX_NUMBER_FIELDS; i++) { if (All_Fields->field[i] != NULL) printf("%s: %d\n", All_Fields->field[i]->printname, handsetbiases[i]); } if (override_query_biases) printf("Handset biases USED\n"); else printf("Handset biases INACTIVE (using template biases instead)\n"); break; case USE_HANDSET_BIASES: override_query_biases = 1; if (SavantVerbose) { printf("Handset biases USED\n"); } break; case USE_TEMPLATE_BIASES: override_query_biases = 0; if (SavantVerbose) { printf("Handset biases INACTIVE (using template biases instead)\n"); } break; case DB_INFO_COMMAND: printf("Version: %s, Number documents: %d\n", REMEM_VERSION_NUMBER, rdi->number_documents_total); break; case UNKNOWN_COMMAND: printf("Unknown command, type ? for help.\n"); break; } fflush(stdout); if(SavantVerbose || SavantDebug) { printf("\nCommand: "); } } /* Deinitialize stuff (damn but I want a real OO language!) */ for (i=0; i < MAX_NUMBER_FIELDS; i++) { free_GBuffer(queryInfo.fields[i]); free(queryInfo.fields[i]); } free(all_sims->listOfBuckets); free(total_sims->listOfBuckets); free(all_sims); free(total_sims); free(rdi); SavantError(0, ""); } /* void check_index_mod_for_reset (Retrieval_Database_Info *rdi) { struct stat statbuf; char doclocfile[512]; doclocfile[0] = '\0'; strcat(doclocfile, rdi->db_dir); strcat(doclocfile, "/"); strcat(doclocfile, DOCLOC_FNAME); stat(doclocfile, &statbuf); if (statbuf->st_mtime != rdi->modtime) { rdi->number_documents_total = number_documents(rdi->db_dir); } } */ remem-2.12/main/rmain.h0000644000076500007650000000602507760625114010454 #ifndef _RMAIN_ #define _RMAIN_ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gbuf.h" #include "conftemplates.h" #include "parsedoc.h" #include "hash.h" #define TITLE_LENGTH_MAX 1024 #define RETRIEVAL_SEPERATOR_STRING "." /* Commands that can be entered in the retrieve command loop */ enum Retrieve_Command {QUIT_COMMAND, QUERY_COMMAND, RETRIEVE_COMMAND, LOCRETRIEVE_COMMAND, HELP_COMMAND, SET_BIAS_COMMAND, PRINT_BIASES, USE_HANDSET_BIASES, USE_TEMPLATE_BIASES, DB_INFO_COMMAND, UNKNOWN_COMMAND}; enum Retrieve_Command get_command (int *argint, char *argstring); void get_query(GBuffer *query); void resetDocSims(Remem_Hash_Table *docSims); Remem_Hash_Table *initDocSims(int num_docs_total); /* Given a query and it's template, return a biased, sorted array */ Doc_Sim_Totals *rank_docs_for_fields(Remem_Hash_Table *total_sims, Remem_Hash_Table *all_sims, Doc_Info *queryInfo, General_Template *template, List_of_General_Templates *All_General_Templates, Retrieval_Database_Info *rdi, int number_docs_being_printed, int *querybiases); void bias_sims(Remem_Hash_Table *all_sims, List_of_General_Templates *All_General_Templates, Field *thisfield, int *querybiases, Retrieval_Database_Info *rdi, int newquery_p); void add_additional_to_doc_sim (Doc_Sim *thisSim, float additional, char *printname); #endif remem-2.12/Makefile.am0000644000076500007650000000026107760625115010302 SUBDIRS=savutil plugins template main other EXTRA_DIST= savant.h COPYING ChangeLog all: main/ra-index main/ra-retrieve main/ra-index: cd main; $(MAKE) ra-index ra-retrieve remem-2.12/Makefile.in0000644000076500007650000003214407760626045010323 # Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ CC = @CC@ DEPDIR = @DEPDIR@ EMACS = @EMACS@ INCLUDES = @INCLUDES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ lispdir = @lispdir@ SUBDIRS = savutil plugins template main other EXTRA_DIST = savant.h COPYING ChangeLog subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = DIST_SOURCES = RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ Makefile.in NEWS acconfig.h aclocal.m4 config.h.in configure \ configure.in depcomp elisp-comp install-sh missing \ mkinstalldirs DIST_SUBDIRS = $(SUBDIRS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): configure.in cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.h.in distclean-hdr: -rm -f config.h stamp-h1 uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = . distdir = $(PACKAGE)-$(VERSION) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } GZIP_ENV = --best distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist $(am__remove_distdir) GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/=build mkdir $(distdir)/=inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ && cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ find $$dc_install_base -type f -print ; \ exit 1; } >&2 ) \ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ && rm -f $(distdir).tar.gz \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @echo "$(distdir).tar.gz is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' distcleancheck: distclean if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf autom4te.cache maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-recursive dist dist-all dist-gzip distcheck \ distclean distclean-generic distclean-hdr distclean-recursive \ distclean-tags distcleancheck distdir dvi dvi-am dvi-recursive \ info info-am info-recursive install install-am install-data \ install-data-am install-data-recursive install-exec \ install-exec-am install-exec-recursive install-info \ install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive tags tags-recursive uninstall \ uninstall-am uninstall-info-am uninstall-info-recursive \ uninstall-recursive all: main/ra-index main/ra-retrieve main/ra-index: cd main; $(MAKE) ra-index ra-retrieve # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: remem-2.12/missing0000744000076500007650000001105207760625115007643 #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Franc,ois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison touch file \`y.tab.c' makeinfo touch the output file yacc touch file \`y.tab.c'" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing - GNU libit 0.0" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch config.h.in ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print \ | sed 's/^\(.*\).am$/touch \1.in/' \ | sh ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." touch y.tab.c ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 remem-2.12/mkinstalldirs0000744000076500007650000000133707760625115011057 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.1.1.1 2001/04/24 15:40:54 finagler Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here remem-2.12/NEWS0000644000076500007650000000101507760625115006743 Current Version: 2.11 See the file ChangeLog for the details of all changes Major changes from 2.10 to 2.11 * Removed pcre from the source distribution, so it won't conflict if users already have it installed. The minor downside is users now need to install it. * ra-index now indexes words with more than one punctuation mark after them (e.g. "doh!!!" or "really?!?" or "hmm..."). * Added files that GNU automake wants to see, like ChangeLog, NEWS, INSTALL and AUTHORS For major changes before 2.11, see ChangeLog remem-2.12/other/0000777000076500007650000000000010014272767007451 5remem-2.12/other/elisp-comp0000744000076500007650000000324207760625115011365 #!/bin/sh # Copyright (C) 1995 Free Software Foundation, Inc. # François Pinard , 1995. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # This script byte-compiles all `.el' files which are part of its # arguments, using GNU Emacs, and put the resulting `.elc' files into # the current directory, so disregarding the original directories used # in `.el' arguments. # # This script manages in such a way that all Emacs LISP files to # be compiled are made visible between themselves, in the event # they require or load-library one another. if test $# = 0; then echo 1>&2 "No files given to $0" exit 1 else if test -z "$EMACS" || test "$EMACS" = "t"; then # Value of "t" means we are running in a shell under Emacs. # Just assume Emacs is called "emacs". EMACS=emacs fi tempdir=elc.$$ mkdir $tempdir cp $* $tempdir cd $tempdir echo "(setq load-path (cons nil load-path))" > script $EMACS -q -batch -l script -f batch-byte-compile *.el mv *.elc .. cd .. rm -fr $tempdir fi remem-2.12/other/jimminy.el0000644000076500007650000004141207760625115011370 ;jimminy.el -- wearable computer extensions for remem.el ; ;All code included in versions up to and including 2.09: ; Copyright (C) 2001 Massachusetts Institute of Technology. ; ;All modifications subsequent to version 2.09 are copyright Bradley ;Rhodes or their respective authors. ; ;This program is free software; you can redistribute it and/or modify ;it under the terms of the GNU General Public License as published by ;the Free Software Foundation; either version 2 of the License, or (at ;your option) any later version. For commercial licensing under other ;terms, please consult the MIT Technology Licensing Office. ; ;This program may be subject to the following US and/or foreign ;patents (pending): "Method and Apparatus for Automated, ;Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If ;any of these patents are granted, royalty-free license to use this ;and derivative programs under the GNU General Public License are ;hereby granted. ; ;This program 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 ;General Public License for more details. ; ;You should have received a copy of the GNU General Public License ;along with this program; if not, write to the Free Software ;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;USA. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Jimminy is the wearable computer interface to Remem. ;; It allows you to set emacs variables describing your current context: ;; location, people in the room, subject of conversation and a timestamp. ;; These can be used to annotate notes currently being taken on the wearable, ;; and are also used as an automatic query to the RA. ;; In the full working system these emacs variables are set using Hive ;; http://www.hivecell.net ;; This should probably separate the note-taking header creation from the remem part, ;; but it works OK. It's also a good example of how one can use the hooks in ;; remem to operate it by other than the normal means. (provide 'jimminy) (require 'remem) (require 'time-stamp) (defvar jimminy-temporary-bias-offset 3 "Amount to temporarilly add to the hand-set bias when the field changes") (defvar jimminy-temporary-bias-lifetime 60 "Number of seconds to temporarilly add to a hand-set biase when the field changes") ;; Use this in remem-format-alist if you want -- it's good for smaller screens (setq remem-format-jimminy '((0 2 (field 0 mouse-face remem-hilite2) nil) ; Number (1 2 (face remem-even field 1) nil) ; sim (9 15 (face remem-odd field 9 mouse-face remem-hilite) nil) ; person (8 25 (face remem-even field 8 mouse-face remem-hilite) nil) ; subject (5 8 (face remem-odd field 5 mouse-face remem-hilite) remem-date-print-filter) ; date (28 50 (face remem-even field 28 mouse-face remem-hilite) nil))); keywords ;; For time stamps in the Jimminy header (setq time-stamp-format "%3a, %:d %3b %:y %02H:%02M:%02S %Z") (global-set-key "\C-ch" 'jimminy-update-header-info) (global-set-key "\C-ci" 'jimminy-insert-header-info) (global-set-key "\C-cl" 'jimminy-set-location-string) (global-set-key "\C-cs" 'jimminy-set-subject-string) (global-set-key "\C-cp" 'jimminy-set-person-string) (global-set-key "\C-cbl" 'jimminy-set-location-bias) (global-set-key "\C-cbs" 'jimminy-set-subject-bias) (global-set-key "\C-cbp" 'jimminy-set-person-bias) (global-set-key "\C-cbb" 'jimminy-set-body-bias) (global-set-key "\C-cjil" 'jimminy-increment-location-bias) (global-set-key "\C-cjip" 'jimminy-increment-person-bias) (global-set-key "\C-cjis" 'jimminy-increment-subject-bias) (global-set-key "\C-cjib" 'jimminy-increment-body-bias) (global-set-key "\C-cjdl" 'jimminy-decrement-location-bias) (global-set-key "\C-cjdp" 'jimminy-decrement-person-bias) (global-set-key "\C-cjds" 'jimminy-decrement-subject-bias) (global-set-key "\C-cjdb" 'jimminy-decrement-body-bias) (global-set-key "\C-cjcl" 'jimminy-clear-location-string) (global-set-key "\C-cjcp" 'jimminy-clear-person-string) (global-set-key "\C-cjcs" 'jimminy-clear-subject-string) (global-set-key "\C-cjca" 'jimminy-clear-all-string) (defvar jimminy-location-string "") (defvar jimminy-person-string "") (defvar jimminy-subject-string "") ;; Biases actually used by Savant (defvar jimminy-location-bias 1) (defvar jimminy-subject-bias 1) (defvar jimminy-person-bias 1) (defvar jimminy-body-bias 1) ;; Biases that are actually what the user set ;; These might differ from the biases used because ;; we temporarily add to features that have just changed (defvar jimminy-location-bias-setting 1) (defvar jimminy-subject-bias-setting 1) (defvar jimminy-person-bias-setting 1) (defvar jimminy-body-bias-setting 1) (defvar jimminy-location-timer nil "Timer for resetting location timer -- used to up priority when feature changes") (defvar jimminy-person-timer nil "Timer for resetting person timer -- used to up priority when feature changes") (defvar jimminy-subject-timer nil "Timer for resetting subject timer -- used to up priority when feature changes") (defvar jimminy-body-timer nil "Timer for resetting body timer -- used to up priority when feature changes") ;; Don't use the major-mode in the string, we want to use JIMMINY-QUERY-MODE (setq remem-use-major-mode-templates nil) ;; This sets the mode line for the *remem-display* mode, ;; So we don't need much info (we know the buffer name, and ;; time is displayed in other buffer mode lines) (defun jimminy-mode-line-update () (cond ((and (boundp 'remem-buffer-name) (get-buffer remem-buffer-name)) (save-excursion (set-buffer (get-buffer remem-buffer-name)) (setq mode-line-format (list ; "-" ; mode-line-modified " " ; mode-line-buffer-identification "[" ; global-mode-string ; "] " "-" (cond ((not (eq jimminy-location-bias-setting jimminy-location-bias)) " .")) (number-to-string jimminy-location-bias) (cond ((not (eq jimminy-location-bias-setting jimminy-location-bias)) ". ")) (cond ((not (eq jimminy-subject-bias-setting jimminy-subject-bias)) " .")) (number-to-string jimminy-subject-bias) (cond ((not (eq jimminy-subject-bias-setting jimminy-subject-bias)) ". ")) (cond ((not (eq jimminy-person-bias-setting jimminy-person-bias)) " .")) (number-to-string jimminy-person-bias) (cond ((not (eq jimminy-person-bias-setting jimminy-person-bias)) ". ")) (number-to-string jimminy-body-bias) "- " jimminy-location-string (if (equal jimminy-location-string "") "" " ") "|" jimminy-subject-string (if (equal jimminy-subject-string "") "" " ") "|" jimminy-person-string )))))) (defun jimminy-update-changes () (jimminy-mode-line-update) (setq remem-query-extra-text-string (concat "JIMMINY REMEMBRANCE QUERY MODE\n" "Jimminy-query-header <" jimminy-location-string "|" jimminy-person-string "|" jimminy-subject-string "|" (time-stamp-string) ">\n"))) ;; remem-query-oneshot-preamble-string is the string through which commands ;; are inserted into Savant. ;; Anything in this string is attached to the query command, then blanked ;; out so it only gets executed once. ;; With Jimminy we want to use our own biases rather than the template ;; defaults, so set that mode here. (defun jimminy-set-all-biases () (setq remem-query-oneshot-preamble-string (concat "use-handset-biases\n" "set-bias BODY " (number-to-string jimminy-body-bias) "\n" "set-bias LOCATION " (number-to-string jimminy-location-bias) "\n" "set-bias PERSON " (number-to-string jimminy-person-bias) "\n" "set-bias SUBJECT " (number-to-string jimminy-subject-bias) "\n")) (jimminy-update-changes)) (add-hook 'remem-start-hook 'jimminy-set-all-biases) (jimminy-set-all-biases) ;; In case the RA is already running (defun jimminy-set-location-string (string) (interactive "sLocation: ") (jimminy-set-location-bias (+ jimminy-temporary-bias-offset jimminy-location-bias-setting) t) (cond (jimminy-location-timer (remem-cancel-timer jimminy-location-timer))) (setq jimminy-location-timer (run-at-time jimminy-temporary-bias-lifetime nil 'jimminy-reset-location-bias)) (setq jimminy-location-string (downcase string)) (jimminy-update-changes)) (defun jimminy-set-person-string (string) (interactive "sPerson: ") (setq jimminy-person-string (downcase string)) (jimminy-set-person-bias (+ jimminy-temporary-bias-offset jimminy-person-bias-setting) t) (cond (jimminy-person-timer (remem-cancel-timer jimminy-person-timer))) (setq jimminy-person-timer (run-at-time jimminy-temporary-bias-lifetime nil 'jimminy-reset-person-bias)) (jimminy-update-changes)) (defun jimminy-set-subject-string (string) (interactive "sSubject: ") (setq jimminy-subject-string (downcase string)) (jimminy-set-subject-bias (+ jimminy-temporary-bias-offset jimminy-subject-bias-setting) t) (cond (jimminy-subject-timer (remem-cancel-timer jimminy-subject-timer))) (setq jimminy-subject-timer (run-at-time jimminy-temporary-bias-lifetime nil 'jimminy-reset-subject-bias)) (jimminy-update-changes)) (defun jimminy-set-location-bias (bias &optional bias-only) (interactive "nLocation bias: ") (if (< bias 0) (setq bias 0)) (setq jimminy-location-bias bias) (cond ((not bias-only) (setq jimminy-location-bias-setting bias))) (setq remem-query-oneshot-preamble-string (concat remem-query-oneshot-preamble-string "set-bias LOCATION " (number-to-string bias) "\n")) (jimminy-update-changes)) (defun jimminy-reset-location-bias () (jimminy-set-location-bias jimminy-location-bias-setting)) (defun jimminy-set-person-bias (bias &optional bias-only) (interactive "nPerson bias: ") (if (< bias 0) (setq bias 0)) (setq jimminy-person-bias bias) (cond ((not bias-only) (setq jimminy-person-bias-setting bias))) (setq remem-query-oneshot-preamble-string (concat remem-query-oneshot-preamble-string "set-bias PERSON " (number-to-string bias) "\n")) (jimminy-update-changes)) (defun jimminy-reset-person-bias () (jimminy-set-person-bias jimminy-person-bias-setting)) (defun jimminy-set-subject-bias (bias &optional bias-only) (interactive "nSubject bias: ") (if (< bias 0) (setq bias 0)) (setq jimminy-subject-bias bias) (cond ((not bias-only) (setq jimminy-subject-bias-setting bias))) (setq remem-query-oneshot-preamble-string (concat remem-query-oneshot-preamble-string "set-bias SUBJECT " (number-to-string bias) "\n")) (jimminy-update-changes)) (defun jimminy-reset-subject-bias () (jimminy-set-subject-bias jimminy-subject-bias-setting)) (defun jimminy-set-body-bias (bias &optional bias-only) (interactive "nBody bias: ") (if (< bias 0) (setq bias 0)) (setq jimminy-body-bias bias) (cond ((not bias-only) (setq jimminy-body-bias-setting bias))) (setq remem-query-oneshot-preamble-string (concat remem-query-oneshot-preamble-string "set-bias BODY " (number-to-string bias) "\n")) (jimminy-update-changes)) (defun jimminy-reset-body-bias () (jimminy-set-body-bias jimminy-body-bias-setting)) (defun jimminy-increment-location-bias () (interactive) (jimminy-set-location-bias (+ 1 jimminy-location-bias))) (defun jimminy-increment-person-bias () (interactive) (jimminy-set-person-bias (+ 1 jimminy-person-bias))) (defun jimminy-increment-subject-bias () (interactive) (jimminy-set-subject-bias (+ 1 jimminy-subject-bias))) (defun jimminy-increment-body-bias () (interactive) (jimminy-set-body-bias (+ 1 jimminy-body-bias))) (defun jimminy-decrement-location-bias () (interactive) (jimminy-set-location-bias (- jimminy-location-bias 1))) (defun jimminy-decrement-person-bias () (interactive) (jimminy-set-person-bias (- jimminy-person-bias 1))) (defun jimminy-decrement-subject-bias () (interactive) (jimminy-set-subject-bias (- jimminy-subject-bias 1))) (defun jimminy-decrement-body-bias () (interactive) (jimminy-set-body-bias (- jimminy-body-bias 1))) (defun jimminy-clear-location-string () (interactive) (setq jimminy-location-string "") (jimminy-set-location-bias jimminy-location-bias-setting)) (defun jimminy-clear-person-string () (interactive) (setq jimminy-person-string "") (jimminy-set-person-bias jimminy-person-bias-setting)) (defun jimminy-clear-subject-string () (interactive) (setq jimminy-subject-string "") (jimminy-set-subject-bias jimminy-subject-bias-setting)) (defun jimminy-clear-all-string () (interactive) (setq jimminy-person-string "") (setq jimminy-location-string "") (setq jimminy-subject-string "") (setq jimminy-location-bias 1) (setq jimminy-person-bias 1) (setq jimminy-subject-bias 1) (setq jimminy-body-bias 1) (setq jimminy-location-bias-setting 1) (setq jimminy-person-bias-setting 1) (setq jimminy-subject-bias-setting 1) (setq jimminy-body-bias-setting 1) (setq remem-query-oneshot-preamble-string (concat "set-bias BODY " (number-to-string jimminy-body-bias) "\n" "set-bias LOCATION " (number-to-string jimminy-location-bias) "\n" "set-bias PERSON " (number-to-string jimminy-person-bias) "\n" "set-bias SUBJECT " (number-to-string jimminy-subject-bias) "\n")) (jimminy-update-changes)) ;; I'm not sure that this context-stack stuff actually works ;; It's not being used, regardless (defvar jimminy-context-stack ()) (defun jimminy-push-context () (interactive) (setq jimminy-context-stack (cons (list jimminy-person-string jimminy-location-string jimminy-subject-string jimminy-location-bias jimminy-person-bias jimminy-subject-bias jimminy-body-bias) jimminy-context-stack))) (defun jimminy-pop-context () (interactive) (cond (jimminy-context-stack (let ((context (car jimminy-context-stack))) (setq jimminy-person-string (elt context 0)) (setq jimminy-location-string (elt context 1)) (setq jimminy-subject-string (elt context 2)) (setq jimminy-location-bias (elt context 3)) (setq jimminy-person-bias (elt context 4)) (setq jimminy-subject-bias (elt context 5)) (setq jimminy-body-bias (elt context 6))) (setq jimminy-context-stack (cdr jimminy-context-stack)) (setq remem-query-oneshot-preamble-string (concat "set-bias BODY " (number-to-string jimminy-body-bias) "\n" "set-bias LOCATION " (number-to-string jimminy-location-bias) "\n" "set-bias PERSON " (number-to-string jimminy-person-bias) "\n" "set-bias SUBJECT " (number-to-string jimminy-subject-bias) "\n")) (jimminy-update-changes)) ((message "No previous context.")))) (defun jimminy-exch-context () "Exchange the top two on the stack." (interactive) (cond ((> (length jimminy-context-stack) 1) (let ((c1 (car jimminy-context-stack)) (c2 (car (cdr jimminy-context-stack)))) (setq jimminy-context-stack (cons c2 (cons c1 (cdr (cdr jimminy-context-stack))))))) ((message "Not enough contexts.")))) (defun jimminy-swap-context () "Swap the current context with the top one on the stack." (interactive) (jimminy-push-context) (jimminy-exch-context) (jimminy-pop-context)) (defun jimminy-insert-header-info-at-top () "insert header info string at start of buffer" (interactive) (save-excursion (goto-char (point-min)) (let ((line-start (buffer-substring (point-min) (+ (point-min) 14)))) (message line-start) (cond ((string= line-start "Jimminy-header") (kill-line 1))) (jimminy-insert-header-info)))) (defun jimminy-update-header-info () "Update the header above point in the buffer, or insert one at point" (interactive) (let ((p (point))) (save-excursion (cond ((re-search-backward "------------------------\nJimminy-header" nil t) (beginning-of-line) (kill-line 2))) (beginning-of-line) (jimminy-insert-header-info)) (next-line 1) (goto-char p))) (defun jimminy-insert-header-info () (interactive) (let ((outstring (concat "------------------------\n" "Jimminy-header <" jimminy-location-string "|" jimminy-person-string "|" jimminy-subject-string "|" (time-stamp-string) ">\n"))) (insert outstring))) remem-2.12/other/Makefile.am0000644000076500007650000000054307760625115011426 lisp_LISP=remem.el ## don't compile jimminy.el, 'cause it relies on remem.el and when making that won't be in a path yet. ## I know there's a better way to do this with Emacs, but I haven't done it yet. EXTRA_DIST=remem.el jimminy.el ra-index.1 ra-retrieve.1 ## Grr. mostlyclean-lisp clean-lisp distclean-lisp maintainer-clean-lisp: rm -f $(ELCFILES) remem-2.12/other/Makefile.in0000644000076500007650000001543107760626046011445 # Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ CC = @CC@ DEPDIR = @DEPDIR@ EMACS = @EMACS@ INCLUDES = @INCLUDES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ lispdir = @lispdir@ lisp_LISP = remem.el EXTRA_DIST = remem.el jimminy.el ra-index.1 ra-retrieve.1 subdir = other mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = LISP = $(lisp_LISP) ELCFILES = remem.elc elisp_comp = $(top_srcdir)/elisp-comp DIST_COMMON = Makefile.am Makefile.in elisp-comp all: all-am .SUFFIXES: .SUFFIXES: .el .elc $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu other/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) uninstall-info-am: lispLISP_INSTALL = $(INSTALL_DATA) .el.elc: @echo 'WARNING: Warnings can be ignored. :-)' if test $(EMACS) != no; then \ EMACS=$(EMACS) $(SHELL) $(elisp_comp) $<; \ else : ; fi install-lispLISP: $(lisp_LISP) $(ELCFILES) @$(NORMAL_INSTALL) @if test -n "$(lispdir)"; then \ $(mkinstalldirs) $(DESTDIR)$(lispdir); \ list='$(lisp_LISP)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(lispLISP_INSTALL) $$d$$p $(DESTDIR)$(lispdir)/$$f"; \ $(lispLISP_INSTALL) $$d$$p $(DESTDIR)$(lispdir)/$$f; \ if test -f $${p}c; then \ echo " $(lispLISP_INSTALL) $${p}c $(DESTDIR)$(lispdir)/$${f}c"; \ $(lispLISP_INSTALL) $${p}c $(DESTDIR)$(lispdir)/$${f}c; \ else : ; fi; \ done; \ else : ; fi uninstall-lispLISP: @$(NORMAL_UNINSTALL) @if test -n "$(lispdir)"; then \ list='$(lisp_LISP)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(lispdir)/$$f $(DESTDIR)$(lispdir)/$${f}c"; \ rm -f $(DESTDIR)$(lispdir)/$$f $(DESTDIR)$(lispdir)/$${f}c; \ done; \ else : ; fi clean-lisp: -test -z "$(ELCFILES)" || rm -f $(ELCFILES) tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LISP) $(ELCFILES) installdirs: $(mkinstalldirs) $(DESTDIR)$(lispdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-lisp mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-lispLISP install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic uninstall-am: uninstall-info-am uninstall-lispLISP .PHONY: all all-am check check-am clean clean-generic clean-lisp \ distclean distclean-generic distdir dvi dvi-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-lispLISP \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic uninstall uninstall-am \ uninstall-info-am uninstall-lispLISP mostlyclean-lisp clean-lisp distclean-lisp maintainer-clean-lisp: rm -f $(ELCFILES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: remem-2.12/other/ra-index.10000644000076500007650000001445507760625115011172 .TH RA-INDEX 1 "REMEMBRANCE AGENT" "MIT Media Lab" .SH NAME ra-index - index files for use with remembrance agent software .SH SYNOPSIS .B ra-index [--version] [-v] [-d] [-s] \ \ [\] [\.\.\.] [-e \ [\] [\.\.\.]] .SH DESCRIPTION .B ra-index and .B ra-retrieve make up the Savant search engine, an information retrieval engine designed as a back-end for the Remembrance Agent (RA). Given a collection of the user's accumulated email, usenet news articles, papers, saved HTML files and other text notes, the RA attempts to find those documents which are most relevant to the user's current context. That is, it searches this collection of text for the documents which bear the highest word-for-word similarity to the text the user is currently editing, in the hope that they will also bear high conceptual similarity and thus be useful to the user's current work. With the Emacs front-end, these suggestions are continuously displayed in a small buffer at the bottom of the user's window. If a suggestion looks useful, the full text can be retrieved with a single command. The Remembrance Agent works in two stages. First, the user's collection of text documents is indexed into a database saved in a vector format. After the database is created, the other stage of the Remembrance Agent is run from emacs, where it periodically takes a sample of text from the working buffer and finds those documents from the collection that are most similar. It summarizes the top documents in a small emacs window and allows you to retrieve the entire text of any one with a keystroke. See the README file for information on using the Emacs front-end. .PP At its core Savant is a text-retrieval search-engine that uses a standard TF/iDF algorithm, but it also uses a template system to recognize different kinds of documents and extract various field information. For example, .B ra-index can recognize subject lines and address information from email files and file this information separately. It can also pull apart file archives into separate documents, e.g. RMAIL files are indexed as separate email documents. Finally, there are filters defined for many document types to remove extraneous information like HTML tags that might otherwise cause problems in retrieval. These are all precompiled in a template structure. It is not currently well documented, though if anyone wants to play with it is all defined in the source file templates/conftemplates.c. The RA is primarily designed as a proactive information provider that continually gives you information that might be relevant to your current environment, but Savant can also be used as a standard text and information retrieval search engine. .SS USAGE To index, you must have a set of source text-files, and a directory Savant can put database files into. The arguments may be files or directories. If a directory is in the list, Savant will use all its contents, recursing into all subdirectories. Non-text files and backup files (those appended with ~ or prepended with #) are ignored. It also ignores dot-files (those starting with .) and symbolic links. Any files or directories specified after the optional -e flag will be excluded. Savant will use any files it finds to create a database in the specified base directory, which must already exist. The optional -v argument (verbose) will direct Savant to keep you updated on its progress. So for example, .PP .RS 0.5i .PD 0 ra-index -v ~/RA-indexes/mail ~/RMAIL ~/Rmail-files -e ~/Rmail-files/Old-files .PP .PD 1 .PP .RE will build a database in the ~/RA-indexes/mail directory, made up of emails from my RMAIL file plus all files and subdirectories of ~/Rmail-files, excluding files and directories in ~/Rmail-files/Old-files. .B ra-index can build databases in any directory you like, but the emacs interface for the Remembrance Agent expects a particular structure. For each database you want to make, you should create a directory, and all these directories should live in the same parent directory. For example, for my own use I have a directory ~/RA-indexes/, and within that are the directories ~/RA-indexes/mail/, ~/RA-indexes/papers/, etc. which actually contain the database files. .SS OPTIONS .TP .I -v Verbose mode. Print useful information. .TP .I -d Debug mode. Print not-so-useful information. .TP .I -e Exclude all filenames and directories which follow .TP .I -s Follow symbolic links when indexing .TP .I --version Print version information. .SH SEE ALSO ra-retrieve(1) .SH AUTHOR Bradley Rhodes, MIT Media Lab. Please send comments and questions to ra-bugs@media.mit.edu. New versions and updates can be found at http://www.media.mit.edu/~rhodes/RA/ .SH COPYRIGHT All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .SH BUGS Dates are not currently indexed, so anything trying to do a date query gets no suggestion back. .PP Requires GNU make to compile. .PP The template structure isn't documented.remem-2.12/other/ra-retrieve.10000644000076500007650000001445007760625115011703 .TH RA-RETRIEVE 1 "REMEMBRANCE AGENT" "MIT Media Lab" .SH NAME ra-retrieve - retrieve files that match a query for use with remembrance agent software .SH SYNOPSIS .B ra-retrieve [--version] [-v] [-d] \ [--docnum \] .SH DESCRIPTION .B ra-index and .B ra-retrieve make up the Savant search engine, an information retrieval engine designed as a back-end for the Remembrance Agent (RA). Given a collection of the user's accumulated email, usenet news articles, papers, saved HTML files and other text notes, the RA attempts to find those documents which are most relevant to the user's current context. That is, it searches this collection of text for the documents which bear the highest word-for-word similarity to the text the user is currently editing, in the hope that they will also bear high conceptual similarity and thus be useful to the user's current work. With the Emacs front-end, these suggestions are continuously displayed in a small buffer at the bottom of the user's window. If a suggestion looks useful, the full text can be retrieved with a single command. The Remembrance Agent works in two stages. First, the user's collection of text documents is indexed into a database saved in a vector format. After the database is created, the other stage of the Remembrance Agent is run from emacs, where it periodically takes a sample of text from the working buffer and finds those documents from the collection that are most similar. It summarizes the top documents in a small emacs window and allows you to retrieve the entire text of any one with a keystroke. See the README file for information on using the Emacs front-end. .PP The RA is primarily designed as a proactive information provider that continually gives you information that might be relevant to your current environment. In this mode, .B ra-retrieve is run by a front end and its output is parsed into a more human-readable format. However, Savant can also be used as a standard text and information retrieval search engine. .SS USAGE The one argument to .B ra-retrieve is , which is the directory containing the index files created by .B ra-index. This starts an interactive process that handles queries and returns documents that most match that query. When running with the -v argument, a menu and other information is printed. Without the -v option it is assumed that .B ra-retrieve has been run from a front-end, and only minimal information is printed. The following commands are available: .PP .TP .I "query " Find the most relevant documents to a query. Default is 5. Enter the text of the query, followed by a ^D (ASCII 04). If the query matches a predefined template then fields are parsed and separately. For example, in emacs mail mode the from, subject, date and body of the message are all individually parsed. If no template matches, the query is assumed to be plain text. A query will output up to n summary lines followed by a period on a line by itself. Each summary line will contain a line number, relevance number, document number, and a series of fields describing the document. The final field is a comma-separated list of words from the query that most contributed to this document being chosen. .TP .I "retrieve " Retrieve and print the document with the given document number. Document number is the third field outputed by the query. The full text of the document is displayed. If the document is a part of a larger file, such as in an email in an archive file, only that one document is shown. .TP .I "loc-retrieve " Retrieve and print the location of the document with the given document number. Three values are displayed, each on their own separate line. The first is the character offset to where the beginning of the document is found. The second is the character offset for the end of the document. The third line contains the fully expanded filename for the document itself. This is primarily so front-ends can load the document and display them with their own formatting. .TP .I info Display version and database info. .TP .I quit Quit. .TP .I "?" Display menu. .PP .SS OPTIONS .TP .I -v Verbose mode. Print a menu and other info for running without a front-end. .TP .I -d Debug mode. Print not-so-useful information. .TP .I [--docnum \] Print the contents of the specified document number and exit. This option doesn't use as much memory as interactive mode, and is useful for scripts that call this program. .SH SEE ALSO ra-index(1) .SH AUTHOR Bradley Rhodes, MIT Media Lab. Please send comments and questions to ra-bugs@media.mit.edu. New versions and updates can be found at http://www.media.mit.edu/~rhodes/RA/ .SH COPYRIGHT All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .SH BUGS Dates are not currently indexed, so anything trying to do a date query gets no suggestion back. .PP Requires GNU make to compile. .PP The template structure isn't documented.remem-2.12/other/remem.el0000644000076500007650000031676207760625115011036 ;remem.el -- implements emacs front-end for the remembrance agent ; ;All code included in versions up to and including 2.09: ; Copyright (C) 2001 Massachusetts Institute of Technology. ; ;All modifications subsequent to version 2.09 are copyright Bradley ;Rhodes or their respective authors. ; ;Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, ;Massachusetts, with support from British Telecom and Merrill Lynch. ; ;This program is free software; you can redistribute it and/or modify ;it under the terms of the GNU General Public License as published by ;the Free Software Foundation; either version 2 of the License, or (at ;your option) any later version. For commercial licensing under other ;terms, please consult the MIT Technology Licensing Office. ; ;This program may be subject to the following US and/or foreign ;patents (pending): "Method and Apparatus for Automated, ;Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If ;any of these patents are granted, royalty-free license to use this ;and derivative programs under the GNU General Public License are ;hereby granted. ; ;This program 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 ;General Public License for more details. ; ;You should have received a copy of the GNU General Public License ;along with this program; if not, write to the Free Software ;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;USA. ;; Version info: ;; Num Date Who Comments ;; ------ -------- ----------------------- ----------------- ;; 2.10 3/15/01 rhodes@alum.mit.edu Fixed clobbering of C-xo bug that I introduced in ;; 2.09, plus fixed remem-query-extra-string-previous ;; bug (should be remem-query-extra-text-string-previous) ;; Thanks to Keith Amidon for these fixes. ;; 2.09 1/15/01 rhodes@alum.mit.edu Added stuff that lets other programs customize remem ;; (e.g. jimminy). This includes remem-start-hook, remem-stop-hook, ;; remem-query-oneshot-preamble-string, remem-query-preamble-string ;; Added check for whether scrollbar-width is defined in XEmacs. ;; Changed to GPL licence. ;; 2.08 2/29/00 rhodes@media.mit.edu Made *remem-document-output* read-only, added ;; major-mode and retrieved document type to rating log. ;; Toggling remem off and on while banging on the keys ;; used to cause emacs to wedge, presubably because of sit-for ;; instead of sleep-for. Fixed that (I think). ;; Finally, it now defaults to printing hash marks for how ;; relevant a hit is, rather than the numbers. Also can set it ;; to not show hits below a certain threshold. Added the ;; remem-mode-db-alist change database based on major mode. ;; Added better multi-frame support (only put *remem-display* in ;; one of them). Moved "C-cr" prefix to a customizable parameter. ;; 2.07 9/25/99 rhodes@media.mit.edu Added help function C-crh, fixed(?) it so getting rid of ;; remem window respawns it, while getting rid of buffer kills it. ;; Pop to *remem-display* after a field-query, so it won't update ;; on you while you're looking. Also added check for updated ;; index files -- restart ra-retrieve if the index files ;; have been modified. ;; 2.06 9/2/99 rhodes@media.mit.edu Sanity check for database subdir existing ;; Added remem-change-database, fixed remem-grab-query ;; for xemacs, added timestamping for logs, ;; added a full-page query mode, changed all the quick-keys ;; to start in C-cr, fixed "not leaving remem buffer" bug ;; 2.05 7/19/99 rhodes@media.mit.edu Fixed mouse left-click for Xemacs, added template type ;; output for savant, made a better date print format, ;; added the filename to the default output format, and ;; now allow a per-scope formatting through remem-format-alist ;; 2.04 6/16/99 rhodes@media.mit.edu Added a "require timer" and "remem-grab-query" (C-cf) ;; 2.03 5/20/99 rhodes@media.mit.edu Added some sanity checks ;; 2.02 4/8/99 rhodes@media.mit.edu Added logging ;; 2.01 3/10/99 rhodes@media.mit.edu Got rid of stupid "require jimminy" that broke it, ;; fixed it for xemacs, and got rid of remem-mouse.el ;; 2.00 3/6/99 rhodes@media.mit.edu Release 2.00 (provide 'remem) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; CUSTOMIZATIONS ;; These variables can (and probably should) be overridden for each user ;; in their own .emacs file, or in a remem-custom.el file which gets loaded ;; after remem.el does. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Required Customizations: ;; You must set remem-prog-dir, remem-database-dir, and remem-scopes-list. ;; The defaults given are probably not correct for your individual databases ;; and scopes. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;; ;; This is the directory where savant is located (fully expanded) (defvar remem-prog-dir (expand-file-name "/usr/local/bin") "This is the directory where savant is located (fully expanded)") ;;;;;;;;;;;;;;;; ;; This is the base directory containing all of the database directories (fully expanded) ;; NOTE: This is a directory containing *directories*, which in turn contain index files. (defvar remem-database-dir (expand-file-name "~/RA-indexes") "This is the base directory containing all of the database directories (fully expanded)") ;;;;;;;;;;;;;;;; ;; The scopes list... This is a list in the form: ;; ;; (scope1 scope2 scope3 ...) ;; ;; Where scope is of the form: ;; ;; (DIRN NUM-LINES UPDATE-TIME QUERY-RANGE) ;; ;; DIRN is the subdirectory of remem-database-dir with the desired database ;; This is the name of a sub-directory in remem-database-dir ;; NUM-LINES is the number of lines that you want the scope to return (initially) ;; UPDATE-TIME is the time between scope updates (in seconds) ;; QUERY-RANGE number of lines around point that you want the scope to query on (defvar remem-scopes-list '(("mail" 6 5 500) ("notes" 2 5 500)) "The list of scopes, where each scope is (DIRN NUM-LINES UPDATE-TIME QUERY-RANGE)") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Optional Customizations: ;; remem-log-original-suggestion, remem-terminal-mode, remem-logging-p, ;; remem-use-major-mode-templates, remem-non-r-number-keys and the font ;; customizations are set to reasonable defaults but can be overridden to fit ;; your tastes. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;; ;; Whether or not to retrieve the original document or to make a copy for viewing ;; Useful for email-style files (narrowed), and when you want to subsequently edit ;; the suggested file (defvar remem-load-original-suggestion nil "When seeing an entire suggestion, just go to the file rather than a copy") ;;;;;;;;;;;;;;;; ;; Turns on logging. The default log-file is ~/.remem-log-file (defvar remem-log-p t "If t, log when suggestions are followed to remem-logfile") (defvar remem-logfile (expand-file-name "~/.remem-log-file") "File where remembrance agent info gets logged") ;;;;;;;;;;;;;;;; ;; Set to t if you want to use the major-mode variable to automatically parse ;; fields from your document, based on the template structure defined in ;; Savant. (defvar remem-use-major-mode-templates t "If t, send major-mode info to Savant to help templates") ;;;;;;;;;;;;;;;; ;; Set remem-non-r-number-keys to t if you want C-c1 through C-c9 to bring up ;; a suggestion. These keys are already set to C-cr1 through C-cr9, but this ;; saves a keystroke. (defvar remem-non-r-number-keys nil "If t, set C-c1 through C-c9 to bring up suggestions just like C-cr1 through C-cr9 do now") ;;;;;;;;;;;;;;;; ;; Set remem-terminal-mode to t if you want the keywords to show up on the ;; screen rather than on mouse-click. Otherwise, set to nil. ;; Actually, I take it back. This option is like the "close door" button on ;; the elevator. You can play with it, but in reality it doesn't do a darned thing. (defvar remem-terminal-mode t "Set to t if you want keywords shown. Not implemented right now.") ;;;;;;;;;;;;;;;; ;; Set remem-print-exact-relevance-p to t if you want numbers instead of plus signs ;; for the relevance score. (defvar remem-print-exact-relevance-p nil) ;;;;;;;;;;;;;;;; ;; Set remem-print-even-bad-relevance-p to t if you want all suggestions shown, ;; regardless of how bad the relevance. (defvar remem-print-even-bad-relevance-p nil) ;;;;;;;;;;;;;;;; ;; Set remem-print-exact-relevance-p to t if you want numbers instead of plus signs ;; for the relevance score. (defvar remem-relevance-plus-plus-threshold 40) ;; Relevance score to get a "++" rating (defvar remem-relevance-plus-threshold 30) ;; Relevance score to get a "+" rating (defvar remem-relevance-normal-threshold 10) ;; Relevance score minimum before getting a "-" rating, ;; or no suggestion if remem-print-even-bad-relevance-p = nil ;;The Prefix used for RA commands. Default is control-c r (defvar remem-command-prefix "\C-cr") ;;;;;;;;;;;;;;;; ;; Keys We want to start with before running the RA (global-set-key (concat remem-command-prefix "t") 'remem-toggle) (global-set-key (concat remem-command-prefix "h") 'remem-create-help-page) ;;;;;;;;;;;;;;;; ;; Mode aware changing ;; These three variables let you automatically change mode based on the *major-mode* ;; variable. For example, you could set them to these values: ;; (setq remem-mode-aware-changing t) ;; (setq remem-mode-db-alist (list (cons 'mail-mode (("mail" 5 10 500))) ;; (cons 'rmail-mode (("mail" 5 10 500))) ;; (cons 'latex-mode (("inspec" 5 10 500))))) ;; (setq remem-buffname-db-alist (list (cons "my-diary" (("daily-notes" 5 10 500))) ;; (cons "my-homework" (("code" 5 10 500))))) ;; ;; The first value turns on mode-aware database selection. ;; The second specifies that when you visit a mail-mode or rmail-mode buffer, switch to the ;; "mail" database with the specified number of lines, seconds between updates and ;; number of words looked at. In latex-mode it switches to the "inspec" database. ;; Any other mode doesn't change. ;; The third line is for buffer-specific changes. Here, the buffer named "my-dairy" gets ;; "daily-notes" regardless of mode, and "my-homework" gets the database named "code". ;; If you change databases in a specific buffer, your new selection becomes sticky for ;; the rest of the session. ;; ;; Now that wasn't so bad, was it? (defvar remem-mode-aware-changing nil) (defvar remem-buffname-db-alist nil) ;;; Set in user customization if used (defvar remem-mode-db-alist nil) ;;; Set in user customization if used ;;;;;;;;;;;;;;;; ;; Font customizations. ;; Every odd column ;; Fonts ;; ;; These are the colour customizations ;; colour for every alternating column (make-empty-face 'remem-odd) (make-empty-face 'remem-even) (make-empty-face 'remem-hilite) ;; current line (make-empty-face 'remem-hilite2) ;; current field (make-empty-face 'remem-odd-scope) (make-empty-face 'remem-even-scope) (cond ((and (boundp 'hilit-background-mode) (equal hilit-background-mode 'dark)) (set-face-foreground 'remem-odd "Thistle") (set-face-foreground 'remem-even "MediumSeaGreen") ;; Every even column (set-face-foreground 'remem-odd-scope "Goldenrod") ;; Every odd scope (numbers) (set-face-foreground 'remem-even-scope "CornflowerBlue") ;; Every even scope (numbers) (set-face-foreground 'remem-hilite2 "OrangeRed") ;; Selected line (set-face-foreground 'remem-hilite "Aquamarine") ;; Current line (on mouse-over) ;; (set-face-font 'remem-hilite "-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1") ) (t ; (set-face-foreground 'remem-odd "ForestGreen") (set-face-foreground 'remem-odd "Black") (set-face-foreground 'remem-even "MediumBlue") ;; Every even column (set-face-foreground 'remem-odd-scope "Blue") ;; Every odd scope (numbers) (set-face-foreground 'remem-even-scope "DarkSlateGray") ;; Every even scope (numbers) (set-face-foreground 'remem-hilite2 "Red") ;; Selected line (set-face-foreground 'remem-hilite "Red") ;; Current line (on mouse-over) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; END OF CUSTOMIZATIONS ;; Beyond this point you're in the bowels of the ;; code and you're on your own :) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) ;; xemacs hacks (cond (running-xemacs (require 'itimer) (defun event-x-y (event) (cons (event-x event) (event-y event))) (defun run-at-time (time repeat function &rest args) (apply 'start-itimer "remem-timer" function time repeat nil t args)) (defun remem-cancel-timer (timer) (cond (timer (delete-itimer timer)))) (defun x-popup-menu (event list) (popup-menu list event)) (defun frame-first-window (&rest args) (frame-highest-window args)) ; (defun sit-for-nodist (seconds) ; (sit-for seconds t)) (defun marker-position-nonil (marker) (let ((mark (marker-position marker))) (cond (mark mark) (t 0)))) (require 'overlay)) (t (require 'timer) (defvar scrollbar-width) ;; To shut the compiler up (defvar scrollbar-height) ;; To shut the compiler up (defvar mouse-track-click-hook) ;; To shut the compiler up (defun remem-cancel-timer (timer) (cancel-timer timer)) (defun marker-position-nonil (marker) (let ((mark (marker-position marker))) (cond (mark mark) (t 0)))) (defun window-displayed-height (&optional window) (- (window-height window) 1)) ; (defun sit-for-nodist (seconds) ; (sit-for seconds 0 t)) (defun event-x-y (event) (posn-x-y (event-end event))) (defun event-window (event) (posn-window (event-end event))) (defun event-point (event) (posn-point (event-end event))))) ;;; -------------- ;;; GLOBAL OPTIONS ;;; -------------- ;; Other customizations ;; I've not tested remem-hide-display in awhile -- It might not work. (defvar remem-hide-display nil "If t, don't display the remem window (but keep updating it anyway)") (setq remem-hide-display nil) ;; I've not tested remem-autojump-suggestion in awhile -- It might not work. (defvar remem-autojump-suggestion nil "If a value, jump automatically to that lineno when it's updated") (setq remem-autojump-suggestion nil) (defvar remem-keyword-field-start-number 28 "Field where most relevant keywords are kept") (defvar remem-sim-breakdown-field-start-number 29 "Field where field similarity breakdown is kept") (defvar remem-query-preamble-string "" "String that gets catenated before every Savant query command. Change this to give special commands like setting biases and using hand-set biases.") (defvar remem-query-preamble-string-previous "" "Previous value of remem-query-preamble-string, used to keep track of when a query changes") (defvar remem-query-oneshot-preamble-string "" "Like remem-query-preamble-string, but gets reset to the empty string after every query.") (defvar remem-query-extra-text-string "" "String that gets catenated just before the query text (after the query command).") (defvar remem-query-extra-text-string-previous "" "Previous value of remem-query-extra-text-string, used to keep track of when a query changes") (defvar remem-query-oneshot-extra-text-string "" "Like remem-query-extra-text-string, but gets reset to the empty string after every query.") ;;; --------------------- ;;; DEFAULT LOCAL OPTIONS ;;; --------------------- (defvar remem-format-default '((0 2 (field 0 mouse-face remem-hilite2) nil) ; Number (1 2 (face remem-even field 1) nil) ; sim (9 12 (face remem-odd field 9 mouse-face remem-hilite) nil) ; person (8 30 (face remem-even field 8 mouse-face remem-hilite) nil) ; subject (5 8 (face remem-odd field 5 mouse-face remem-hilite) remem-date-print-filter) ; date (27 13 (face remem-even field 4 mouse-face remem-hilite) nil) ; filename ; (4 10 (face remem-even field 4 mouse-face remem-hilite) nil) ; location (28 50 (face remem-odd field 28 mouse-face remem-hilite) nil))); keywords (defvar remem-format-nokeys ;field-number field-width field-text-properties print-filter-function '((0 2 (field 0 mouse-face remem-hilite2) nil) ; Number (1 2 (face remem-even field 1) nil) ; sim (9 12 (face remem-odd field 9 mouse-face remem-hilite) nil) ; person (8 30 (face remem-even field 8 mouse-face remem-hilite) nil) ; subject (5 8 (face remem-odd field 5 mouse-face remem-hilite) remem-date-print-filter) ; date (4 50 (face remem-even field 4 mouse-face remem-hilite) nil))) ; location (defvar remem-format-inspec '((0 2 (field 0 mouse-face remem-hilite2) nil) ; Number (1 2 (face remem-even field 1) nil) ; sim (9 12 (face remem-odd field 9 mouse-face remem-hilite) nil) ; person (5 12 (face remem-even field 5 mouse-face remem-hilite) remem-date-print-filter) ; date (8 50 (face remem-odd field 8 mouse-face remem-hilite) nil) ; subject (28 50 (face remem-even field 28 mouse-face remem-hilite) nil))); keywords (defvar remem-format-jimminy '((0 2 (field 0 mouse-face remem-hilite2) nil) ; Number (1 2 (face remem-even field 1) nil) ; sim (9 12 (face remem-odd field 9 mouse-face remem-hilite) nil) ; person (8 24 (face remem-even field 8 mouse-face remem-hilite) nil) ; subject (5 8 (face remem-odd field 5 mouse-face remem-hilite) remem-date-print-filter) ; date (28 50 (face remem-even field 28 mouse-face remem-hilite) nil))); keywords (defvar remem-format remem-format-default) (defvar remem-format-mail remem-format-default) (defvar remem-format-alist nil) ;;; Set in user customization if used ;;format list for the keyword field (defvar remem-keyword-field '(28 40 (face remem-even field 28))) ;;If remem-mode-db-alist is t: ;; if buffname is in remem-buffname-db-alist, switch to scopes lists ;; elseif major-mode is in remem-mode-db-alist, switch to scopes lists ;; else don't change databases. ;; ;; current buffer is automatically added to remem-buffname-db-alist if remem-change-database is called. ;;; --------- ;;; INTERNALS ;;; --------- ;; Note: these are the fields that savant returns, with one exception: ;; since the line number that savant returns may not correspond with ;; the line number in the remem display (duplicate lines, multiple scopes ;; in the same buffer), lineno is tacked on by remem-render-processed ;; num-relevance contains the savant line number (as well as the relevance) ;; Also, we're labeling keywords as in the body for search purposes. ;; These are all used for doing searches on fields when they're clicked. (defvar remem-savant-field-names '(lineno num-relevance docnum "!BODY: " "!LOCATION: " "!DATE: " "!TIME: " "!DAY" "!SUBJECT: " "!PERSON: " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "!BODY:" )) ;; This is another helper list... to ensure that the interactive call asking for 1-5 returns a 1-5 in ;; the field choice (defvar remem-field-array '(("Body" . 3) ("Location" . 4) ("Date" . 5) ("Subject" . 8) ("Person" . 9) ("body" . 3) ("location" . 4) ("date" . 5) ("subject" . 8) ("person" . 9))) (defvar remem-total-scope-lines 0) (defvar remem-display-buffer-height 4) (defvar remem-docnum-field 2) ; the third (defvar remem-relevance-field 1) ; the second (defvar remem-waiting-for-query-return-timeout 10) (defvar remem-document-buffer-name "*remem-document-output*") (defvar remem-query-buffer-name "*remem-query*") (defvar remem-help-buffer-name "*remem-help*") (defvar remem-old-C-x1 nil) ; holds function bound to C-x-1 (defvar remem-old-C-xo nil) ; holds function bound to C-x-0 (defvar remem-kind-of-query nil) ; one of 'auto, 'mouse, 'manual-text, 'manual-page, 'manual-field, ; or 'bypass for what the last query was (defvar remem-versionstring-temp "") ; Temporary global storage for versionstring info (defvar remem-working-scope nil) ; Global storage for scope being worked on right now ;; Program Variables (defvar remem-buffer-name "*remem-display*" "The name of the remembrance display buffer.") (defvar remem-display-running nil "is the remem-display already running?") (defvar remem-scopes nil) (make-variable-buffer-local 'remem-scopes) ; each buffer has its own set of scopes (defvar remem-scope-percentages nil) (defvar remem-global-timer nil) (defvar remem-buffers nil) ; a list of all buffers containing remem scopes ;; this is necessary for the process filter ;; selection related (defvar remem-selection-line nil) (make-variable-buffer-local 'remem-selection-line) (defvar remem-selection-line-contents "") (make-variable-buffer-local 'remem-selection-line-contents) (defvar remem-selection-field nil) (make-variable-buffer-local 'remem-selection-field) (defvar remem-selection-line-overlay nil) (make-variable-buffer-local 'remem-selection-line-overlay) (defvar remem-selection-field-overlay nil) (make-variable-buffer-local 'remem-selection-field-overlay) (defvar remem-last-followed-docnum nil) ;; Docnum of document followed last ;;; ---------- ;;; SCOPE DATA ;;; ---------- ;; We keep the data about a remembrance agent together in ;; the scope data structure ; [dir, lines, update time, range, proc, history, query, processed, in progress?, ; timer, raw, buffer, querycounter, Database info, Database modtime] (defun remem-scope-directory (scope) (aref scope 0)) ; subdir of remem-database-dir (defun remem-scope-number-lines (scope) (aref scope 1)) ; number of lines to display for this scope (defun remem-scope-update-time (scope) ; how often to update (0 = never) (let ((ut (aref scope 2))) (cond ((eq ut 0) nil) (t ut)))) (defun remem-scope-range (scope) (aref scope 3)) ; how many words to look at (defun remem-scope-proc (scope) (aref scope 4)) ; the process running this agent (defun remem-scope-history (scope) (aref scope 5)) ; a list of past queries -- currently disabled since it grows without bound. (defun remem-scope-query (scope) (aref scope 6)) ; the current query -- also used to only initiate new queries (i.e. don't do anything when idle) (defun remem-scope-processed (scope) (aref scope 7)) ; the results of the last query (defun remem-scope-in-progress (scope) (aref scope 8)) ; is there a query in progress? How long until it times out? (defun remem-scope-timer (scope) (aref scope 9)) ; timer object for this scope (defun remem-scope-raw (scope) (aref scope 10)) ; the unprocessed results of the last query (defun remem-scope-buffer (scope) (aref scope 11)) ; the buffer which contains this scope (defun remem-scope-querycounter (scope) (aref scope 12)) ; number queries done in this scope since the last log checkpoint (defun remem-scope-dbinfo (scope) (aref scope 13)) ; info on the database queried in this scope (version # and num docs) (defun remem-scope-dbmodtime (scope) (aref scope 14)) ; modtime of the database queried in this scope (so we know to reset if it's been changed out from under us) (defun remem-set-scope-directory (scope value) (aset scope 0 value)) ; subdir of remem-database-dir (defun remem-set-scope-number-lines (scope value) (aset scope 1 value)) ; number of lines to display for this scope (defun remem-set-scope-update-time (scope value) (aset scope 2 value)) ; how often to update (0 = never) (defun remem-set-scope-range (scope value) (aset scope 3 value)) ; how many words to look at (defun remem-set-scope-proc (scope value) (aset scope 4 value)) ; the process running this agent (defun remem-set-scope-history (scope value) (aset scope 5 value)) ; a list of past queries -- currently disabled since it grows without bound. (defun remem-set-scope-query (scope value) (aset scope 6 value)) ; the current query -- also used to only initiate new queries (i.e. don't do anything when idle) (defun remem-set-scope-processed (scope value) (aset scope 7 value)) ; the results of the last query (defun remem-set-scope-in-progress (scope value) (aset scope 8 value)) ; is there a query in progress? How long until it times out? (defun remem-set-scope-timer (scope value) (aset scope 9 value)) ; timer object for this scope (defun remem-set-scope-raw (scope value) (aset scope 10 value)) ; the unprocessed results of the last query (defun remem-set-scope-buffer (scope value) (aset scope 11 value)) ; the buffer which contains this scope (defun remem-set-scope-querycounter (scope value) (aset scope 12 value)) ; number queries done in this scope since the last log checkpoint (defun remem-set-scope-dbinfo (scope value) (aset scope 13 value)) ; info on the database queried in this scope (version # and num docs) (defun remem-set-scope-dbmodtime (scope) (aset scope 14 value)) ; modtime of the database queried in this scope (so we know to reset if it's been changed out from under us) (defun remem-decrement-scope-in-progress (scope) (aset scope 8 (and (aref scope 8) (> (aref scope 8) 0) (- (aref scope 8) 1)))) ; if not nil or zero, subtract 1, else nil ;;; Debugging function ;;; (defun remem-break-here () nil) ;;; -------- ;;; QUERYING ;;; -------- ;;; all query functions should call this ; (defun remem-initiate-query (scope &optional query nomodep) ; (cond ((and (remem-scope-in-progress scope) ; (not (y-or-n-p ; "There is already a query in progress. Use this one instead? ")))) ; (t ;This was originally giving me the problem of destroying all minibuffer messages, so I ; ;blocked it out. ; ;(message nil) ; don't leave the y-or-n question hanging around ; (cond (query ; is there a new query here? then make a note of it ; (remem-set-scope-query scope query) ; ;;; (remem-set-scope-history scope (cons query (remem-scope-history scope))) ; )) ; (let ((query-text ; (concat ; "query " (format "%d" (+ 6 (* 2 (remem-scope-number-lines scope)))) "\n" ; (cond ((not nomodep) ; (concat "EMACS REMEMBRANCE QUERY MODE: " (format "%s" major-mode) "\n")) ; (t nil)) ; (remem-scope-query scope) "\n" ; "\004"))) ; (set-text-properties 0 (length query-text) nil query-text) ;; Get rid of emacsisms ; (if (get-buffer "*remem-log*") ; (print query-text (get-buffer "*remem-log*"))) ; (set-process-filter (remem-scope-proc scope) 'remem-process-filter) ; ; we may have set this to the display filter elsewhere ; (process-send-string (remem-scope-proc scope) ; query-text) ; (remem-set-scope-in-progress scope remem-waiting-for-query-return-timeout))))) ;;;Same thing as above without the yes or no questions and progress check (defun remem-initiate-query-nonverbose (scope &optional query use-modep use-preambles use-extra-text) (cond ((remem-restart-on-outdated-index scope)) (t (cond (query ; is there a new query here? then make a note of it (remem-set-scope-query scope query) (setq remem-query-extra-text-string-previous remem-query-extra-text-string) (setq remem-query-preamble-string-previous remem-query-preamble-string) ;; (remem-set-scope-history scope (cons query (remem-scope-history scope))) )) (let ((query-text (concat remem-query-oneshot-preamble-string remem-query-preamble-string "query " (format "%d" (+ 6 (* 2 (remem-scope-number-lines scope)))) "\n" (cond (use-modep (concat "EMACS REMEMBRANCE QUERY MODE: " (format "%s" major-mode) "\n"))) (cond (use-preambles remem-query-oneshot-extra-text-string)) (cond (use-extra-text remem-query-extra-text-string)) (remem-scope-query scope) "\n" "\004"))) (setq remem-last-query-mode (format "%s" major-mode)) (set-text-properties 0 (length query-text) nil query-text) ;; Get rid of emacsisms (if (get-buffer "*remem-log*") (print query-text (get-buffer "*remem-log*"))) (remem-set-scope-querycounter scope (+ (remem-scope-querycounter scope) 1)) ;; Count queries for logs (cond ((>= (remem-scope-querycounter scope) 25) (remem-log-checkpoint-scope scope 'at-25))) (set-process-filter (remem-scope-proc scope) 'remem-process-filter) ; we may have set this to the display filter elsewhere (process-send-string (remem-scope-proc scope) query-text) (remem-set-scope-in-progress scope remem-waiting-for-query-return-timeout)) (setq remem-query-oneshot-preamble-string "") (setq remem-query-oneshot-extra-text-string "")))) (defun remem-default-scope-list () "Returns the remem-scopes for the remem buffer that is currently defaulted" (or remem-scopes ; first one in the active buffer (and remem-buffers (buffer-live-p (car remem-buffers)) (save-excursion (set-buffer (car remem-buffers)) remem-scopes)))) (defun remem-default-scope () "Returns the scope that is currently defaulted" (let ((default-scopes (remem-default-scope-list))) (cond (default-scopes (car default-scopes)) nil))) (defun remem-all-scopes () "Return all scopes in all remem buffers" (apply 'append (mapcar '(lambda (buf) (cond ((buffer-live-p buf) (set-buffer buf) remem-scopes) ; a buffer local variable (t nil))) remem-buffers))) ;; run a query in the default scope ; (defun remem-query (query) ; (interactive "sQuery on text:") ; (let ((scope (remem-default-scope))) ; (cond (scope (remem-initiate-query scope query) ; (message "Query initiated.") ; (setq remem-kind-of-query 'manual-text)) ; (t (message "No active remembrance agent."))))) (defun remem-last-several-words (count) "String from count words back to current point. (word = 5 chars)" ;; If we're in a summary mode (e.g. RMAIL-summary, VM's "mailbox Summary", or ;; gnus "*Summary alt.sweedish.cheff.bork.bork.bork*)" then ;; grab the query from where we really should be. (let ((orig-window (get-buffer-window (current-buffer))) (end) (beg) (retval) (realbufname)) (save-excursion (cond ((string-match "-summary" (buffer-name (current-buffer))) (setq realbufname (substring (buffer-name (current-buffer)) 0 (string-match "-summary" (buffer-name (current-buffer)))))) ((string-match " Summary" (buffer-name (current-buffer))) (setq realbufname (substring (buffer-name (current-buffer)) 0 (string-match " Summary" (buffer-name (current-buffer)))))) ((string-match "*Summary " (buffer-name (current-buffer))) (setq realbufname "*Article*"))) (cond ((and realbufname (get-buffer-window realbufname)) (select-window (get-buffer-window realbufname)))) ; place start of sample count words before current position ; or as far back as possible (setq beg (- (point) (* 5 count))) (if (< beg (point-min)) (setq beg (point-min))) ; and place end of sample count words ahead of beginning (setq end (+ beg (* 5 count))) (if (> end (point-max)) (setq end (point-max))) (setq retval (concat " " (buffer-substring beg end))) ; (while (string-match "\n\\.\n" retval) ; (setq retval (replace-match "\n .\n" t t retval))) ) (select-window orig-window) (setq remem-debug-retval retval) retval)) (defun remem-query-now () "Updates the results shown by running a query NOW. Bypasses the timer" (interactive) (mapcar (lambda (scope) (cond ((not (remem-scope-proc scope))) ((string-match "^Minibuf" (buffer-name (current-buffer)))) ((get-buffer-window remem-buffer-name t) (cond ((string-match (buffer-name (current-buffer)) remem-query-buffer-name) (remem-log-checkpoint (remem-default-scope-list) 'manual-page-query) (setq remem-kind-of-query 'manual-page)) (t (setq remem-kind-of-query 'now))) (let ((exheight (window-displayed-height (get-buffer-window remem-buffer-name t)))) (remem-redistribute-scopes exheight) (remem-initiate-query-nonverbose scope (remem-last-several-words (remem-scope-range scope)) remem-use-major-mode-templates t ;; Use preambles t ;; Use extra text ))) (t (remem-initiate-query-nonverbose scope (remem-last-several-words (remem-scope-range scope)) remem-use-major-mode-templates t ;; Use preambles t ;; Use extra text )))) (remem-default-scope-list))) (defun remem-query-on-keywords (keywords) (mapcar (lambda (scope) (cond ((not (remem-scope-proc scope))) ((string-match "^Minibuf" (buffer-name (current-buffer)))) ((get-buffer-window remem-buffer-name t) (let ((exheight (window-displayed-height (get-buffer-window remem-buffer-name t)))) (remem-redistribute-scopes exheight) (remem-initiate-query-nonverbose scope keywords nil) (remem-cancel-timer (remem-scope-timer scope)) (remem-set-scope-timer scope (run-at-time 10 (remem-scope-update-time scope) 'remem-around-point scope)) )) (t (remem-initiate-query-nonverbose scope keywords nil) (remem-cancel-timer (remem-scope-timer scope)) (remem-set-scope-timer scope (run-at-time 10 (remem-scope-update-time scope) 'remem-around-point scope)) ))) (remem-default-scope-list))) ;;; This never seems to be called... ; (defun remem-query-on-field-mouse (field field-text) ; (let ((query ; (concat "EMACS REMEMBRANCE FIELD QUERY:\n" ; (elt remem-savant-field-names field) ; field-text))) ; (setq remem-kind-of-query 'mouse) ; (remem-log-checkpoint (remem-default-scope-list) 'mouse-field-query) ; (mapcar (lambda (scope) ; (cond ((not (remem-scope-proc scope))) ; ((string-match "^Minibuf" (buffer-name (current-buffer)))) ; ((get-buffer-window remem-buffer-name t) ; (let ((exheight (window-displayed-height (get-buffer-window remem-buffer-name t)))) ; (remem-redistribute-scopes exheight) ; (remem-initiate-query-nonverbose scope query nil) ; (remem-cancel-timer (remem-scope-timer scope)) ; (remem-set-scope-timer scope ; (run-at-time 10 (remem-scope-update-time scope) 'remem-around-point scope)) ; )) ; (t ; (remem-initiate-query-nonverbose scope query nil) ; (remem-cancel-timer (remem-scope-timer scope)) ; (remem-set-scope-timer scope ; (run-at-time 10 (remem-scope-update-time scope) 'remem-around-point scope)) ; ))) ; (remem-default-scope-list)))) (defun remem-query-on-field (field field-text query-type) (let ((query (concat "EMACS REMEMBRANCE FIELD QUERY:\n" (elt remem-savant-field-names field) field-text))) (setq remem-kind-of-query query-type) (remem-log-checkpoint (remem-default-scope-list) (concat (symbol-name query-type) "-query")) (mapcar (lambda (scope) (cond ((not (remem-scope-proc scope))) ((string-match "^Minibuf" (buffer-name (current-buffer)))) ((get-buffer-window remem-buffer-name t) (let ((exheight (window-displayed-height (get-buffer-window remem-buffer-name t)))) (remem-redistribute-scopes exheight) (remem-initiate-query-nonverbose scope query nil) (remem-cancel-timer (remem-scope-timer scope)) (remem-set-scope-timer scope (run-at-time 10 (remem-scope-update-time scope) 'remem-around-point scope)) )) (t (remem-initiate-query-nonverbose scope query nil) (remem-cancel-timer (remem-scope-timer scope)) (remem-set-scope-timer scope (run-at-time 10 (remem-scope-update-time scope) 'remem-around-point scope)) ))) (remem-default-scope-list)))) (defun remem-grab-query (fieldname field-text) "Run a query on a given field" (interactive (list (let (val) (setq val (completing-read "Which Field? (Body Location Date Subject Person): " remem-field-array 'consp t)) (cdr (assoc val remem-field-array))) (read-string "Enter Text: "))) (remem-query-on-field fieldname field-text 'manual-field) (pop-to-buffer remem-buffer-name)) (defun remem-insert-query-page-text (fieldstring) "Insert a string as the next field for a query page, with appropriate read-only font" (let ((len (length fieldstring))) (cond ((not running-xemacs) (add-text-properties 0 len '(read-only t face remem-odd-scope) fieldstring) (add-text-properties (- len 1) len '(rear-nonsticky t) fieldstring) (insert fieldstring)) (t ;; Xemacs has a broken rear-nonsticky, so we use extents instead. (let ((extent (make-extent (point) (progn (insert fieldstring) (point))))) (set-extent-face extent 'remem-odd-scope) (set-extent-property extent 'read-only t) (cond ((= (point-min) (point)) (set-extent-property extent 'start-open nil) (set-extent-property extent 'end-open t)) (t (set-extent-property extent 'start-open t) (set-extent-property extent 'end-open t)))))))) (defun remem-create-query-page () "Create a nice form-like buffer to fill in a manual remem query" (interactive) (remem-log-checkpoint (remem-default-scope-list) 'new-query-page) (cond ((get-buffer remem-query-buffer-name) (kill-buffer remem-query-buffer-name))) (pop-to-buffer (get-buffer-create remem-query-buffer-name)) ;; Make/get the query buffer (setq major-mode 'remem-query-mode) (kill-region (point-min) (point-max)) ;; Clear the buffer (remem-insert-query-page-text "Remem Query Form:\nEnter one or more fields below and hit C-crv to view the results\n\nSubject: ") (remem-insert-query-page-text "\nPerson: ") (remem-insert-query-page-text "\nLocation: ") (remem-insert-query-page-text "\nDate: ") (remem-insert-query-page-text "\nBody: ") (goto-char (point-min)) (end-of-line 4)) (defun remem-create-help-page () "Display the help page for the RA" (interactive) (let ((help-string (cond ((equal remem-command-prefix "\C-cr") "Remembrance Agent Commands:\n\nC-c r t (Control-c r t): Toggle Remem\nC-c r v (Control-c r v): View updated results\nC-c r # (Control-c r ): Show Suggestion\nC-c r r # (Control-c r r ): Rate this document\nC-c r f (Control-c r f): Field Search\nC-c r q (Control-c r q): Query\nC-c r d (Control-c r d): Database change\nLeft mouse-click on lineno: Show Suggestion\nLeft mouse-click on a field: Search field\nMiddle or Right mouse-click: Keywords\nResize window: Resize\n") (t (concat "Remembrance Agent Commands:\n\n" remem-command-prefix "t: Toggle Remem\n" remem-command-prefix "v: View updated results\n" remem-command-prefix "#: Show Suggestion number #\n" remem-command-prefix "r#: Rate document number #\n" remem-command-prefix "f: Field Search\n" remem-command-prefix "q: Query\n" remem-command-prefix "d: Database change\nLeft mouse-click on lineno: Show Suggestion\nLeft mouse-click on a field: Search field\nMiddle or Right mouse-click: Keywords\nResize window: Resize\n"))))) (pop-to-buffer (get-buffer-create remem-help-buffer-name)) (kill-region (point-min) (point-max)) (insert help-string) (goto-char (point-min)))) (defun remem-switch-to-mode-specific-db () "Switch database to the one specified in remem-mode-db-alist" (let ((new-remem-scopes-list (or (cdr (assoc (buffer-name (current-buffer)) remem-buffname-db-alist)) (cdr (assoc major-mode remem-mode-db-alist))))) (cond ((and new-remem-scopes-list (not (equal remem-scopes-list new-remem-scopes-list))) (setq remem-scopes-list new-remem-scopes-list) (remem))))) (defun remem-around-point (scope) (remem-decrement-scope-in-progress scope) (cond ((not (remem-scope-proc scope))) ; if the process is dead, abort ((remem-scope-in-progress scope)) ; if we're already running a query here, don't supercede ((string-match "^*remem-" (buffer-name (current-buffer)))) ; don't search results, the display area, or *remem-log* ((string-match "*Minibuf" (buffer-name (current-buffer)))) ; don't search the Minibuffer ((and remem-mode-aware-changing (remem-switch-to-mode-specific-db))) ;; Switch to new DB if major-mode change ((get-buffer-window remem-buffer-name t) (let ((exheight (window-displayed-height (get-buffer-window remem-buffer-name t))) (query (remem-last-several-words (remem-scope-range scope)))) (remem-redistribute-scopes exheight) ;; Handle resizes (cond ((or (not (string= query (remem-scope-query scope))) ;; Only query if things have changed (not (equal remem-query-oneshot-preamble-string "")) (not (equal remem-query-oneshot-extra-text-string "")) (not (string= remem-query-preamble-string remem-query-preamble-string-previous)) (not (string= remem-query-extra-text-string remem-query-extra-text-string-previous))) (setq remem-kind-of-query 'auto) (remem-initiate-query-nonverbose scope query remem-use-major-mode-templates t t))))) (t ; actually remem! (let ((query (remem-last-several-words (remem-scope-range scope)))) (cond ((or (not (string= query (remem-scope-query scope))) ;; Only query if things have changed (not (equal remem-query-oneshot-preamble-string "")) (not (equal remem-query-oneshot-extra-text-string "")) (not (string= remem-query-preamble-string remem-query-preamble-string-previous)) (not (string= remem-query-extra-text-string remem-query-extra-string-previous))) (setq remem-kind-of-query 'auto) (remem-initiate-query-nonverbose scope query remem-use-major-mode-templates t t))))))) ;;; Function to keep the number of lines displayed by each scope proportional to the original distribution (defun remem-redistribute-scopes (newtotal) "This function changes the number of display lines shown by each scope so that the remem window is filled. Makes use of the percentage property to retain the same proportions across scopes." (cond ((buffer-live-p (get-buffer remem-buffer-name)) (setq remem-total-scope-lines 0) (save-excursion (set-buffer remem-buffer-name) (remem-add-scope-lines remem-scopes) (cond ((not (eq remem-total-scope-lines newtotal)) (remem-log-checkpoint remem-scopes 'resizing) (mapcar (lambda (x) (remem-set-scope-number-lines x (round (* newtotal (cdr (assq (remem-scope-proc x) remem-scope-percentages)))))) remem-scopes))))))) ;;; The total number of lines displayed by all scope scopes in a list (defun remem-add-scope-lines (scope-list) (cond ((null (car scope-list))) (t (setq remem-total-scope-lines (+ (remem-scope-number-lines (car scope-list)) remem-total-scope-lines)) (remem-add-scope-lines (cdr scope-list))))) ;;; ------- ;;; DISPLAY ;;; ------- ;; accessors ;; get the format for column n (defun remem-column-format (n) (elt remem-format n)) ;; get the field number for column n (defun remem-column-field (n) (elt (remem-column-format n) 0)) ;; get the column width for column n (defun remem-column-width (n) (elt (remem-column-format n) 1)) ;; get the text properties for column n (defun remem-column-props (n) (elt (remem-column-format n) 2)) ;; get the print filter for column n (defun remem-column-printfilter (n) (elt (remem-column-format n) 3)) ;; return the column associated with a given field (defun remem-field-column (n) (let ((i 0)) (while (and (< i (length remem-format)) (not (= (remem-column-field i) n))) (setq i (+ 1 i))) i)) (defun remem-enlarge-remem-display (num-lines) (interactive "nNumber Lines to enlarge (negative to shrink): ") (let ((current-window (get-buffer-window (current-buffer)))) (select-window (get-buffer-window remem-buffer-name)) (enlarge-window num-lines) (select-window current-window))) (defun remem-enlarge-remem-display-by-1 () (remem-enlarge-remem-display 1)) (defun remem-shrink-remem-display-by-1 () (remem-enlarge-remem-display -1)) (defun remem-substring-equal (str1 start1 end1 str2 start2 end2 &optional ignore-case) (let ((compstr1 (substring str1 start1 end1)) (compstr2 (substring str2 start2 end2))) (cond (ignore-case (setq compstr1 (downcase compstr1)) (setq compstr2 (downcase compstr2)))) (string-equal compstr1 compstr2))) (defun remem-date-print-filter (datestring) (let ((monthname nil) (month nil) (day nil) (year nil)) ;; Wed, 20 Mar 1996 19:42:37 -0500 ;; Wed, 16 Jul 97 10:18:20 est (cond ((string-match "\\([0-9]+\\) +\\([A-Z][a-z][a-z]\\) +\\([0-9][0-9][0-9]?[0-9]?\\)" datestring) (setq day (substring datestring (match-beginning 1) (match-end 1))) (setq monthname (substring datestring (match-beginning 2) (match-end 2))) (setq year (substring datestring (match-beginning 3) (match-end 3)))) ;; Mon Dec 4 11:28:24 -0500 1995 ((string-match "[A-Z][a-z][a-z] +\\([A-Z][a-z][a-z]\\) +\\([0-9]+\\) +[0-9][0-9]?:[0-9][0-9]:[0-9][0-9] +[-0-9]* *\\([0-9][0-9][0-9][0-9]\\)" datestring) (setq monthname (substring datestring (match-beginning 1) (match-end 1))) (setq day (substring datestring (match-beginning 2) (match-end 2))) (setq year (substring datestring (+ (match-beginning 3) 2) (match-end 3)))) ;; September 3, 1985 ((string-match "\\([A-Z][a-z][a-z]\\)[a-z]* +\\([0-9]+\\) *, *\\([0-9][0-9][0-9][0-9]\\)" datestring) (setq monthname (substring datestring (match-beginning 1) (match-end 1))) (setq day (substring datestring (match-beginning 2) (match-end 2))) (setq year (substring datestring (+ (match-beginning 3) 2) (match-end 3))))) (cond (monthname (cond ((remem-substring-equal monthname 0 2 "Jan" 0 2 t) (setq month "01")) ((remem-substring-equal monthname 0 2 "Feb" 0 2 t) (setq month "02")) ((remem-substring-equal monthname 0 2 "Mar" 0 2 t) (setq month "03")) ((remem-substring-equal monthname 0 2 "Apr" 0 2 t) (setq month "04")) ((remem-substring-equal monthname 0 2 "May" 0 2 t) (setq month "05")) ((remem-substring-equal monthname 0 2 "Jun" 0 2 t) (setq month "06")) ((remem-substring-equal monthname 0 2 "Jul" 0 2 t) (setq month "07")) ((remem-substring-equal monthname 0 2 "Aug" 0 2 t) (setq month "08")) ((remem-substring-equal monthname 0 2 "Sep" 0 2 t) (setq month "09")) ((remem-substring-equal monthname 0 2 "Oct" 0 2 t) (setq month "10")) ((remem-substring-equal monthname 0 2 "Nov" 0 2 t) (setq month "11")) ((remem-substring-equal monthname 0 2 "Dec" 0 2 t) (setq month "12"))))) (cond ((and day month year) (cond ((= (length year) 4) (setq year (substring year 2 4)))) (cond ((< (length day) 2) (setq day (concat "0" day)))) (cond ((< (length month) 2) (setq month (concat "0" month)))) (concat month "/" day "/" year)) (t datestring)))) (defun remem-format-line (line format-list scope &optional extra-format) "takes a list of fields, extracts the desired ones (specified in format-list), and inserts them into the current buffer with the desired spacing. The point should be at the beginning of a line." ;(insert (format "%S " fields)) ; (print fields (get-buffer "*scratch*")) (let ((fields (car line)) (scope-marker (car (cdr (cdr line)))) (remem-relevance-score 100)) (if (stringp fields) (insert fields) (mapcar '(lambda (format) (let ((string (elt fields (elt format 0))) (width (elt format 1)) (printfilter (elt format 3)) (props (append (list 'scope scope 'docnum (string-to-int (elt fields remem-docnum-field)) 'relevance (elt fields remem-relevance-field) 'keywords (elt fields remem-keyword-field-start-number) 'sims-breakdown (elt fields remem-sim-breakdown-field-start-number) 'orig-source (elt fields (elt format 0))) (elt format 2))) (old-point (point))) ;;; This is specifically for the relevance field (cond ((= (elt format 0) 0) (if (= 0 scope-marker) (setq props (append (list 'face 'remem-even-scope) props)) (setq props (append (list 'face 'remem-odd-scope) props)))) ((= (elt format 0) 1) ;;;funny bug where the ;;;"lineno relevance" field looked like ;;;"^Jlineno relevance" This takes care of the newline (if (string-match "\n" string) (setq string (substring string 1))) ;;;show only the relevance part (setq string (substring string 6)) (setq remem-relevance-score (string-to-number string)) (cond ((not remem-print-exact-relevance-p) (setq string (cond ((or (> remem-relevance-score remem-relevance-plus-plus-threshold) (= remem-relevance-score 0)) ; if 0, it's actually 1.00 "++") ((> remem-relevance-score remem-relevance-plus-threshold) "+ ") ((> remem-relevance-score remem-relevance-normal-threshold) " ") (t "- "))))) )) ;;; Do the print filter, if there is one (cond ((or remem-print-even-bad-relevance-p (not (eq remem-kind-of-query 'auto)) (= remem-relevance-score 0) ; if 0, it's actually 1.00 (> remem-relevance-score remem-relevance-normal-threshold)) (cond (printfilter (setq string (eval (list printfilter string))))) (cond ((< width (length string)) (insert (substring string 0 width))) ; truncate (t (cond (string (insert string))) (insert-char ?\ (- width (length string))))) ; or pad (add-text-properties old-point (point) props) (insert-char ?\ 1)) ((= (elt format 0) 1) (insert "- No suggestion"))) )) format-list)) (insert-char ?\n 1 t))) ;; format the processed results from each scope, removing duplicate lines ;; Duplicate lines are only based on database document number ;; This function contains a hack: it assumes that the first field contains the lineno (defun remem-render-processed () (setq inhibit-read-only t) (erase-buffer) (let ((unique-lines nil) (overall 0) (scope-marker 0)) (mapcar '(lambda (scope) (let ((i 0) (used 0) (allotted (remem-scope-number-lines scope)) (available (length (remem-scope-processed scope))) (processed (remem-scope-processed scope))) (if (eq scope-marker 0) ;use 1's and 0's to colour scopes differently (setq scope-marker 1) (setq scope-marker 0)) (while (< used allotted) (cond ((>= i available) ; we've exhausted the responses (setq used (+ used 1)) (setq overall (+ overall 1)) (setq unique-lines (cons (list (format "%d No suggestion." overall) scope scope-marker) ; this assumes lines start with the lineno... unique-lines))) ((stringp (elt processed i)) ;; "" is not a valid response (setq i (+ i 1))) ( ; check for uniqueness using the docnum (not (member (elt (elt processed i) (- remem-docnum-field 1)) ;; this mapcar creates a list of all of the docnums of the lines in unique-lines ;; that are from the same database. Docnums from different databases are not ;; comparable (mapcar '(lambda (e) (cond ((stringp (car e)) nil) ; ignore "No Suggestion" lines ((not (equal (remem-scope-directory scope) (remem-scope-directory (elt e 1)))) nil) ; can't be the same if dif databases (t (elt (car e) remem-docnum-field)))) unique-lines))) ;; a new line, add it (setq used (+ used 1)) (setq overall (+ overall 1)) (setq unique-lines (cons (list (cons (int-to-string overall) (elt processed i)) scope scope-marker) ;; add the lineno to the beginning. see comments for remem-savant-field-names unique-lines)) (setq i (+ i 1))) (t ; a duplicate (setq i (+ i 1))))))) remem-scopes) (mapcar '(lambda (line) (let ((format-for-line (assoc (remem-scope-directory (car (cdr line))) remem-format-alist))) (cond ((not format-for-line) (setq format-for-line remem-format-default)) (t (setq format-for-line (car (cdr format-for-line))))) (remem-format-line line format-for-line (elt line 1)))) (reverse unique-lines))) (setq inhibit-read-only nil)) ;;; ------------------ ;;; PROCESSING RESULTS ;;; ------------------ (defun remem-double-newline (string) "looks for a double newline. Used to be used for finding end of a query result but now use remem-period-on-line-by-itself." (let* ((dn nil) (len (- (length string) 1)) (i len)) (while (> i 0) (cond ((not (= (aref string (- i 1)) 10)) (setq i (- i 2))) ((= (aref string i) 10) (setq dn t) (setq i 0)) (t (setq i (- i 1))))) dn)) (defun remem-period-on-line-by-itself (string) "looks for a period on a line by itself. used to delimit end of query result." (cond ((string-match "\n\\.\n" string)) ((string-match "^.\n" string)) (t nil))) (defun remem-split-string (string split-char eat) "splits a delimited string into a list of fields eats the delimiter if eat" (let ((i 1) (last-match 0) (fields nil)) (while (< i (length string)) (cond ((eq (elt string i) split-char) (setq fields (cons (substring string last-match (if eat i (+ i 1))) fields)) (setq last-match (+ i 1)))) (setq i (+ i 1))) ; the field after the last delimiter (setq fields (cons (substring string last-match) fields)) (reverse fields))) ; we cons'ed it up backwards (defun remem-split-savant-output (string) "Splits into lines and pipe-delimited fields" (delete nil (mapcar '(lambda (s) (if (or (string= s "") (string= s "\n") (string= s ".")) nil (remem-split-string s ?\| t))) (remem-split-string string ?\n t)))) ;; this should only be used in the buffer containing the scope to be sorted (defun remem-sort-scope (&optional field scope) (interactive) (if (not field) (setq field remem-selection-field)) (if (not scope) (setq scope (car remem-scopes))) ;; sort-columns eats text properties, so it's easier to rebuild ;; the whole thing from the split results (remem-set-scope-processed scope (sort (remem-scope-processed scope) (lambda (a b) (string< (elt a field) (elt b field))))) (remem-render-processed) ;; reselect the selected line if any (cond (remem-selection-line (goto-char (point-min)) (cond ((string= "" remem-selection-line-contents) (remem-selection-line-overlay-update 0)) ((re-search-forward (concat "^" remem-selection-line-contents "$") nil t) (remem-selection-line-overlay-update (count-lines 1 (point)))) (t (remem-selection-line-overlay-update 0))) ;; center the selected line on the screen (recenter)))) (defun remem-process-filter (process string) ;; first figure out which scope this is for (save-excursion (let ((flag t) ;; this is a list of all scopes in all buffers (scopes (remem-all-scopes)) (scope nil)) (while (and flag scopes) (cond ((eq process (remem-scope-proc (car scopes))) (setq scope (car scopes)) (setq flag nil)) (t (setq scopes (cdr scopes))))) (cond ((not flag) ; if it belongs to some scope... ;; tack the new string on to the rest of the results (if string (remem-set-scope-raw scope (concat (remem-scope-raw scope) string)) (message "Savant returned a nil response to query %s" (remem-scope-query scope))) ;; if we've got them all, go to work (cond ((remem-period-on-line-by-itself (remem-scope-raw scope)) (remem-set-scope-processed scope (remem-split-savant-output (remem-scope-raw scope))) (remem-set-scope-raw scope "") ;(remem-sort-scope scope) ; we're still in the right buffer (remem-render-processed) ; when sort works, this is unnecessary (remem-set-scope-in-progress scope nil) (force-mode-line-update)))))))) ;;; -------------- ;;; SELECTION LINE ;;; -------------- ;; these operate on buffer local variables, ;; so make sure they're in the right buffer ;;;keymap related (defvar remem-mode-map nil "Local keymap for remem display buffers.") (if remem-mode-map nil (let ((map (make-keymap))) (suppress-keymap map) (cond (running-xemacs ;(define-key map [button1up] 'remem-mouse-select) (define-key map [button2] 'remem-mouse-popup) (define-key map [button3] 'remem-mouse-popup) ) (t (define-key map [mouse-1] 'remem-mouse-select) (define-key map [down-mouse-2] 'remem-mouse-popup) (define-key map [down-mouse-3] 'remem-mouse-popup))) (setq remem-mode-map map))) (defvar remem-output-mode-map nil "Local keymap for remem output buffer (*remem-document-output*).") (defun remem-kill-output-buffer () (kill-buffer remem-document-buffer-name)) (if remem-output-mode-map nil (let ((map (make-keymap))) (suppress-keymap map) (define-key map "1" 'remem-log-rating-1) (define-key map "2" 'remem-log-rating-2) (define-key map "3" 'remem-log-rating-3) (define-key map "4" 'remem-log-rating-4) (define-key map "5" 'remem-log-rating-5) (define-key map " " 'scroll-up) (define-key map "d" 'remem-kill-output-buffer) (setq remem-output-mode-map map))) (defun remem-leave-remem-window () "Leave the remem-display window if you're there. This is especially for XEmacs, 'cause I can't figure out how to keep it from putting the cursor in that buffer. Good sanity check too." (interactive) (let ((buf (buffer-name (current-buffer)))) ;(setq remem-debug-bufname buf) (cond ((equal buf remem-buffer-name) ;;;; (print remem-buffer-name (get-buffer "*scratch*")) (select-window (frame-first-window)))))) (defun remem-selection-line-overlay-update (&optional n) (if n (setq remem-selection-line n)) (if remem-selection-line ; something selected (goto-line remem-selection-line) (let ((start (point))) (end-of-line) (cond ((not remem-selection-line-overlay) ; if no overlay, make one (setq remem-selection-line-overlay (make-overlay start (point))) (overlay-put remem-selection-line-overlay 'priority 2) (overlay-put remem-selection-line-overlay 'face 'remem-hilite)) (t ; the overlay exists already (move-overlay remem-selection-line-overlay start (point)))) ;; store the contents of the selection for the sort (setq remem-selection-line-contents (buffer-substring start (point)))) (remem-selection-field-overlay-update))) ; for ease of binding ;(defun remem-overview-selection-next-line (&optional n) ; (interactive) ; (let ((lines (or n 1))) ; (remem-overview-selection-line-overlay-update ; (+ lines remem-overview-selection-line)))) ;(defun remem-overview-selection-prev-line (&optional n) ; (interactive) ; (let ((lines (or n 1))) ; (remem-overview-selection-line-overlay-update ; (- remem-overview-selection-line lines)))) (defun remem-selection-field-overlay-update (&optional n) (if n (setq remem-selection-field n)) (cond ((and remem-selection-line remem-selection-field (> n 2)) ; queriable field selected (goto-line remem-selection-line) (let ((start (point))) (end-of-line) (let ((new-start (text-property-any start (point) 'field remem-selection-field))) (if new-start (let ((new-end (next-single-property-change new-start 'field))) (cond ((not new-end) nil) ((not remem-selection-field-overlay) (setq remem-selection-field-overlay (make-overlay new-start new-end)) (overlay-put remem-selection-field-overlay 'priority 1) (overlay-put remem-selection-field-overlay 'face 'remem-hilite2);) (remem-query-on-field (get-text-property new-start 'field) (get-text-property new-start 'orig-source) 'mouse)) (t ; already exists (move-overlay remem-selection-field-overlay new-start new-end);)))))) (remem-query-on-field (get-text-property new-start 'field) (get-text-property new-start 'orig-source) 'mouse)))))))) ((and remem-selection-line remem-selection-field (= n 0)) ; Selected the lineno (remem-retrieve-lineno (get-buffer remem-buffer-name) (+ 1 remem-selection-line))))) ; for ease of binding (defun remem-selection-next-field () (interactive) (if remem-selection-field-overlay (let ((new-start (next-single-property-change (overlay-start remem-selection-field-overlay) 'field))) (cond (new-start (remem-selection-line-overlay-update (count-lines 1 (+ new-start 1))) (remem-selection-field-overlay-update (get-text-property new-start 'field))))))) (defun remem-selection-prev-field () (interactive) (if remem-selection-field-overlay (save-excursion (let ((new-end (previous-single-property-change (overlay-end remem-selection-field-overlay) 'field))) (cond (new-end (remem-selection-line-overlay-update (count-lines 1 new-end)) (remem-selection-field-overlay-update (get-text-property (- new-end 1) 'field)))))))) (defun remem-mouse-select (event &optional clickcount) (interactive "e") (let* ((moused-window (event-window event)) (moused-buffer (cond (moused-window (window-buffer moused-window)) (t nil)))) (cond (moused-buffer (save-excursion (set-buffer moused-buffer) (remem-selection-line-overlay-update (count-lines 1 (event-point event))) (if (get-text-property (event-point event) 'field) (remem-selection-field-overlay-update (get-text-property (event-point event) 'field))) (remem-leave-remem-window)))))) (defun remem-mouse-popup (event &optional clickcount) (interactive "e") (let* ((moused-window (event-window event)) (moused-buffer (cond (moused-window (window-buffer moused-window)) (t nil)))) (cond (moused-buffer (set-buffer moused-buffer) (let ((keywords (get-text-property (event-point event) 'keywords)) (x-y (event-x-y event)) (nice-list nil)) (cond (running-xemacs (setq nice-list (list "Keywords" keywords))) (t (setq nice-list (list "KEYWORDS" (list "BLAH" (cons keywords nil)))))) (setcar x-y (+ 20 (car x-y))) (setcdr x-y (- (cdr x-y) 50)) (x-popup-menu event nice-list)))))) ;;; -------------- ;;; INITIALIZATION ;;; -------------- ; start a scope in the current buffer (defun remem-start-scope (directory number-lines update-time range) (let ((new-scope (vector directory number-lines update-time range nil ; we'll set up the process shortly nil ; no history (we aren't using history now anyway) nil ; no query (don't set to "", 'cause that matches with an empty query & we might not do the first one then) "" ; no processed nil ; no in-progress nil ; we can't set the timer until after we've made the scope "" ; no raw (current-buffer) 0 ; we haven't done any queries yet "" ; we don't know our version number or database info yet (nth 5 (file-attributes (concat (expand-file-name remem-database-dir) "/" directory "/doclocs"))) ; Modtime for the index )) (savant (start-process "remem" nil ;; No buffer for this process (concat (expand-file-name remem-prog-dir) "/ra-retrieve") (concat (expand-file-name remem-database-dir) "/" directory)))) (process-kill-without-query savant) (set-process-filter savant 'remem-process-filter) (remem-set-scope-proc new-scope savant) ;;; (remem-display-database-info new-scope) ;; Set version number (if (> update-time 0) (remem-set-scope-timer new-scope (run-at-time 1 update-time 'remem-around-point new-scope))) ; register this scope (setq remem-scopes (cons new-scope remem-scopes)) (if (member (current-buffer) remem-buffers) nil (setq remem-buffers (cons (current-buffer) remem-buffers))) new-scope)) (defun map-start-scopes (scopes-list) "maps the add-scope-to-buffer function to the list of scopes" (let ((current-scope (car scopes-list))) (cond ((null scopes-list) nil) (t (remem-add-scope-to-buffer remem-buffer-name (car current-scope) (car (cdr current-scope)) (car (cdr (cdr current-scope))) (car (cdr (cdr (cdr current-scope))))) (map-start-scopes (cdr scopes-list)))))) (defun map-scope-percentages (scopes-list) (let ((current-scope (car scopes-list))) (cond ((null scopes-list) nil) (t (setq remem-scope-percentages (cons (cons (remem-scope-proc current-scope) (float (/ (float (remem-scope-number-lines current-scope)) (float remem-total-scope-lines)))) remem-scope-percentages)) (map-scope-percentages (cdr scopes-list)))))) (defun remem-setup-buffer (buffer-name) (let ((buffer (get-buffer-create buffer-name))) (save-excursion (set-buffer buffer) (make-local-variable 'truncate-lines) (setq truncate-lines t) (setq mode-name "Remembrance Agent") (toggle-read-only t) (cond ((and running-xemacs (boundp 'scrollbar-width) (boundp 'scrollbar-height) (set-specifier scrollbar-width 0 (get-buffer "*remem-display*")) (set-specifier scrollbar-height 0 (get-buffer "*remem-display*"))))) (setq remem-selection-line 0) (setq remem-selection-line-contents "") (setq remem-selection-field 0)))) (defun remem-add-scope-to-buffer (buffer directory number-lines update-time range) (cond ((buffer-live-p (get-buffer buffer)) (save-excursion (set-buffer (get-buffer buffer)) (remem-start-scope directory number-lines update-time range) (toggle-read-only -1) (setq remem-total-scope-lines (+ number-lines remem-total-scope-lines)) (setq remem-display-buffer-height (if (< remem-total-scope-lines 4) 4 (+ 1 remem-total-scope-lines))) (insert-string "Reading Database...\n") (toggle-read-only t))))) (defun remem-display-buffer (buffer-name) (let ((orig-buffer (current-buffer)) (orig-window (get-buffer-window (current-buffer)))) (save-excursion (let ((w (if running-xemacs (frame-lowest-window) (window-at 1 (- (frame-height) 3)))) (buffer (get-buffer-create buffer-name))) (setq w (split-window w)) ;; w is now the lower of the two (set-window-buffer w buffer) (select-window w) (enlarge-window (- remem-display-buffer-height (window-displayed-height) 1)) (set-window-dedicated-p w t))) ;; (remem-leave-remem-window) (select-window orig-window))) (defun remem-kill-scope (scope) (if (remem-scope-timer scope) (remem-cancel-timer (remem-scope-timer scope))) (cond (remem-global-timer (remem-cancel-timer remem-global-timer) (setq remem-global-timer nil))) (if (eq (process-status (remem-scope-proc scope)) 'run) (process-send-string (remem-scope-proc scope) "quit\n")) ; ask it to quit (if (eq (process-status (remem-scope-proc scope)) 'run) (delete-process (remem-scope-proc scope))) ; if it doesn't... kill it ; deregister this scope (cond ((buffer-live-p (remem-scope-buffer scope)) (save-excursion (set-buffer (remem-scope-buffer scope)) (remem-set-scope-in-progress scope nil) (setq remem-scopes (delete scope remem-scopes)) (setq remem-total-scope-lines (- remem-total-scope-lines (remem-scope-number-lines scope))) (setq remem-display-buffer-height (if (< remem-total-scope-lines 4) 4 remem-total-scope-lines)) (if (null remem-scopes) (setq remem-buffers (delete (remem-scope-buffer scope) remem-buffers))))))) (defun remem-map-kill (some-list) (cond ((null some-list) nil) (t (remem-kill-scope (car some-list)) (remem-map-kill (cdr some-list))))) (defun remem-kill-all-scopes () "kills all the scopes by mapping remem-kill-scope on the list of scopes" (cond ((buffer-live-p (get-buffer remem-buffer-name)) (save-excursion (set-buffer (get-buffer remem-buffer-name)) (remem-log-checkpoint remem-scopes 'remem-killed) (remem-map-kill remem-scopes))))) (defun remem-kill-buffer (buffer-name) (let ((buffer (get-buffer buffer-name))) (cond (buffer (save-excursion (kill-buffer buffer)))))) (defun remem-change-database (scopename scopenum) "Change the remembrance agent database to one of the preset indexes" (interactive (list (let* ((dirlist (directory-files remem-database-dir nil "[^\.].*")) (scope-name-list (mapcar '(lambda (filename) (cons filename filename)) dirlist)) (dirprompt (mapconcat 'eval dirlist " ")) (val)) (setq val (completing-read (concat "Change to what database (" dirprompt "): ") scope-name-list 'consp t)) (cdr (assoc val scope-name-list))) (let ((rsl-len (length remem-scopes-list)) (val)) (cond ((> rsl-len 1) (setq val (string-to-number (read-string (concat "Enter scope number (1-" rsl-len "): "))))) (t (setq val 1))) val))) (setcar (car (nthcdr (- scopenum 1) remem-scopes-list)) scopename) (cond ((not (assoc (buffer-name (current-buffer)) remem-buffname-db-alist)) (let ((new-scopes-list (copy-alist remem-scopes-list))) (setq remem-buffname-db-alist (append remem-buffname-db-alist (list (cons (buffer-name (current-buffer)) new-scopes-list))))))) (remem)) ;;; ------------------------------------ ;;; SET VERSION STRING (FOR LOGGING) ;;; ------------------------------------ (defun remem-database-info-filter (proc string) (remem-set-scope-dbinfo remem-working-scope (concat (remem-scope-dbinfo remem-working-scope) string))) (defun remem-display-database-info (scope) "Display version info for a given scope" (let ((proc (remem-scope-proc scope)) (linestart)) (setq remem-versionstring-temp "") (cond ((remem-scope-in-progress scope) (message "Waiting for previous query to finish... (hit ^G to abort)") (while (remem-scope-in-progress scope) (sleep-for .2)))) ; (setq remem-document-buffer-name ; (concat "*remem-document-output: " ; (int-to-string lineno) "*")) (remem-set-scope-dbinfo scope "") (setq remem-working-scope scope) ;; As a message passed to remem-database-info-filter (save-excursion (set-process-filter proc 'remem-database-info-filter) (process-send-string proc "info\n") ;; Hang out for a second to let it work it's mojo (while (< (length (remem-scope-dbinfo scope)) 22) (sleep-for .05)) (if (string-match "info\n" (remem-scope-dbinfo scope)) (remem-set-scope-dbinfo scope (replace-match "" t t (remem-scope-dbinfo scope)))) (while (string-match "\n" (remem-scope-dbinfo scope)) (remem-set-scope-dbinfo scope (replace-match "" t t (remem-scope-dbinfo scope))))))) (defun remem-set-database-info-for-scopes (all-scopes) (cond (all-scopes (remem-display-database-info (car all-scopes)) (remem-set-database-info-for-scopes (cdr all-scopes))))) ;;; --------- ;;; RETRIEVAL ;;; --------- (defun remem-display-filter (proc string) (save-excursion (set-buffer (get-buffer-create remem-document-buffer-name)) (goto-char (marker-position-nonil (process-mark proc))) (toggle-read-only -1) (insert string) (set-marker (process-mark proc) (point)) (toggle-read-only t))) ;(defun remem-display-filter (proc string) ; (save-excursion ; (set-buffer remem-document-buffer-name) ; (goto-char (point-max)) ; (insert string) ; (goto-char (point-max)))) ;; called by remem-retrieve (defun remem-display-line-copy (scope docnum &optional lineno) "Display the output for the relevant document displayed in the given line" (let ((proc (remem-scope-proc scope))) (cond ((remem-scope-in-progress scope) (message "Waiting for previous query to finish... (hit ^G to abort)") (while (remem-scope-in-progress scope) (sleep-for .2)))) (message "Retrieving docnum %d" docnum) (cond ((or (not docnum) (< docnum 1)) (message "Improper docnum.")) ((not scope) (message "Improper scope.")) (t ; (setq remem-document-buffer-name ; (concat "*remem-document-output: " ; (int-to-string lineno) "*")) (select-window (frame-first-window)) ; (cond ((get-buffer remem-document-buffer-name) ;; Just to clear it out ; (kill-buffer remem-document-buffer-name))) (switch-to-buffer remem-document-buffer-name) (toggle-read-only -1) (erase-buffer) (toggle-read-only t) (set-marker (process-mark proc) (point) (get-buffer remem-document-buffer-name)) (set-process-filter proc 'remem-display-filter) (process-send-string proc (concat "retrieve " (int-to-string docnum) "\n")) ;; loop until ready (goto-char (point-min)) (while (< (marker-position-nonil (process-mark proc)) 22) (sleep-for .05)) (end-of-line) (setq doc-pos (string-to-int (buffer-substring (point-min) (point)))) (forward-char) (toggle-read-only -1) (delete-region (point-min) (point)) ;; Delete the character offset (end-of-line) (setq remem-last-followed-doctype (buffer-substring (point-min) (point))) (forward-char) (delete-region (point-min) (point)) ;; Delete the character offset (while (< (marker-position-nonil (process-mark proc)) doc-pos) (sleep-for .001)) (goto-char doc-pos) (beginning-of-line) (recenter 0) (setq remem-last-followed-docnum docnum) (message "Type number 1-5 to rate document: 1 = [Bad suggestion], 5 = [Great suggestion]") (use-local-map remem-output-mode-map) (while (let ((old-pos (marker-position-nonil (process-mark proc)))) ;; Wait till it stops moving (sleep-for .05) (< old-pos (marker-position-nonil (process-mark proc))))) (run-hooks 'remem-gotdoc-hook) (toggle-read-only t))))) ;; called by remem-retrieve (defun remem-display-line-original (scope docnum &optional lineno) "Load the file for the relevant document displayed in the given line" (let ((proc (remem-scope-proc scope))) (cond ((remem-scope-in-progress scope) (message "Waiting for previous query to finish... (hit ^G to abort)") (while (remem-scope-in-progress scope) (sleep-for .2)))) (message "Retrieving docnum %d" docnum) (cond ((or (not docnum) (< docnum 1)) (message "Improper docnum.")) ((not scope) (message "Improper scope.")) (t ; (setq remem-document-buffer-name ; (concat "*remem-document-output: " ; (int-to-string lineno) "*")) (select-window (frame-first-window)) ; (cond ((get-buffer remem-document-buffer-name) ;; Just to clear it out ; (kill-buffer remem-document-buffer-name))) (switch-to-buffer remem-document-buffer-name) (toggle-read-only -1) (erase-buffer) (toggle-read-only t) (set-marker (process-mark proc) (point) (get-buffer remem-document-buffer-name)) (set-process-filter proc 'remem-display-filter) (process-send-string proc (concat "loc-retrieve " (int-to-string docnum) "\n")) (goto-char (point-min)) (while (< (marker-position-nonil (process-mark proc)) 22) (sleep-for .05)) ; loop until ready (end-of-line) (setq doc-pos-start (string-to-int (buffer-substring (point-min) (point)))) (forward-char) (toggle-read-only -1) (delete-region (point-min) (point)) ; Get rid of first line -- the doc start (end-of-line) (setq doc-pos-end (string-to-int (buffer-substring (point-min) (point)))) (forward-char) (delete-region (point-min) (point)) ; Get rid of second line -- the doc end (end-of-line) (setq doc-loc (buffer-substring (point-min) (point))) (forward-char) (delete-region (point-min) (point)) ; Get rid of third line -- the doc loc (end-of-line) (setq remem-last-followed-doctype (buffer-substring (point-min) (point))) (print (concat "doc-pos-start: " doc-pos-start) (get-buffer "*remem-log*")) (print (concat "doc-pos-end: " doc-pos-end) (get-buffer "*remem-log*")) (print (concat "doc-loc: " doc-loc) (get-buffer "*remem-log*")) (bury-buffer remem-document-buffer-name) (find-file doc-loc) (if (string= major-mode "rmail-mode") ; in rmail mode, use the variable pointing to start of message (remem-rmail-goto-char (+ 2 doc-pos-start)) ; add two to skip the ^_^L delimiter (goto-char doc-pos-start)) (beginning-of-line) (recenter 0) (setq remem-last-followed-docnum docnum) (message (concat "Rate document: " remem-command-prefix "r , where is from 1 [Bad suggestion] to 5 [Great suggestion]")) (run-hooks 'remem-gotdoc-hook) (toggle-read-only t))))) ;;; retrieve an original or a copy ;;; with no arguments, tries to retrieve what's at point (defun remem-retrieve (&optional scop docn) (interactive) (save-excursion (let* ((scope (or scop ; pre-specified (get-text-property (point) 'scope) ; we're in one (and remem-buffers ; go to the first one in the list (default) (buffer-live-p (car remem-buffers)) (set-buffer (car remem-buffers)) (get-text-property (point) 'scope)))) (docnum (or docn (get-text-property (point) 'docnum))) ; note, we may be in the default buffer (relevance (get-text-property (point) 'relevance)) (lineno (count-lines 1 (point)))) (cond (scope (if remem-load-original-suggestion (remem-display-line-original scope docnum lineno) (remem-display-line-copy scope docnum lineno)))))) (remem-leave-remem-window)) ;;; retrieve from a given line (defun remem-retrieve-lineno (buffer lineno) (cond ((buffer-live-p buffer) (save-excursion (set-buffer buffer) (goto-line lineno) (let ((scope (get-text-property (point) 'scope)) (docnum (get-text-property (point) 'docnum)) (sims-breakdown (get-text-property (point) 'sims-breakdown)) (relevance (get-text-property (point) 'relevance))) (cond ((and scope docnum relevance lineno) (remem-log-checkpoint remem-scopes 'retrieval) (remem-log-suggestion-followed scope docnum relevance lineno sims-breakdown) (remem-retrieve scope docnum)))))))) (defun remem-display-line-1 (&optional args) (interactive "P") (remem-retrieve-lineno (get-buffer remem-buffer-name) 1)) (defun remem-display-line-2 (&optional args) (interactive "P") (remem-retrieve-lineno (get-buffer remem-buffer-name) 2)) (defun remem-display-line-3 (&optional args) (interactive "P") (remem-retrieve-lineno (get-buffer remem-buffer-name) 3)) (defun remem-display-line-4 (&optional args) (interactive "P") (remem-retrieve-lineno (get-buffer remem-buffer-name) 4)) (defun remem-display-line-5 (&optional args) (interactive "P") (remem-retrieve-lineno (get-buffer remem-buffer-name) 5)) (defun remem-display-line-6 (&optional args) (interactive "P") (remem-retrieve-lineno (get-buffer remem-buffer-name) 6)) (defun remem-display-line-7 (&optional args) (interactive "P") (remem-retrieve-lineno (get-buffer remem-buffer-name) 7)) (defun remem-display-line-8 (&optional args) (interactive "P") (remem-retrieve-lineno (get-buffer remem-buffer-name) 8)) (defun remem-display-line-9 (&optional args) (interactive "P") (remem-retrieve-lineno (get-buffer remem-buffer-name) 9)) (defun remem-display-other (lineno) (interactive "nLine Number:") (remem-retrieve-lineno (get-buffer remem-buffer-name) lineno)) (defun remem-log-rating-1 (&optional args) (interactive "P") (remem-log-rating 1)) (defun remem-log-rating-2 (&optional args) (interactive "P") (remem-log-rating 2)) (defun remem-log-rating-3 (&optional args) (interactive "P") (remem-log-rating 3)) (defun remem-log-rating-4 (&optional args) (interactive "P") (remem-log-rating 4)) (defun remem-log-rating-5 (&optional args) (interactive "P") (remem-log-rating 5)) ;;;;Starting up and killing the front end ;;;;basic initialization stuff (defun remem-fix-window-loss () "Makes sure that Remem dies when the buffer is gone, and respawns when window is no longer visible. This is because of that stupid resize-windows bug" (unless (window-live-p (get-buffer-window remem-buffer-name t)) (cond ((get-buffer remem-buffer-name) ;; if the buffer exists, respawn the window (remem-display-buffer remem-buffer-name)) (t (remem-cancel-timer remem-global-timer) (kill-remem))))) (defun remem-restart-on-outdated-index (scope) "If any of the index files we're looking at are newer than they were when we started up their processes, restart ra-retrieve." (let ((new-modtime (nth 5 (file-attributes (concat (expand-file-name remem-database-dir) "/" (remem-scope-directory scope) "/doclocs")))) (old-modtime (remem-scope-dbmodtime scope))) (setq remem-debug-old-modtime old-modtime) (setq remem-debug-new-modtime new-modtime) (cond ((not (equal new-modtime old-modtime)) (remem) (message "Remem index files have been updated... restarting.") t) (t nil)))) (defun start-remem () "starts the processes. essentially a bundling function" (save-excursion (cond (remem-display-running (message "Remembrance Agent already running")) (t (cond ((not (file-exists-p (concat (expand-file-name remem-prog-dir) "/ra-retrieve"))) (message (concat "Cannot find program file: " (expand-file-name remem-prog-dir) "/ra-retrieve"))) ((not (file-exists-p (concat (expand-file-name remem-database-dir) "/"))) (message (concat "Cannot find index directory: " (expand-file-name remem-database-dir)))) ((let ((notfound nil)) (mapcar '(lambda (scopeinfo) (cond ((not (file-exists-p (concat (expand-file-name remem-database-dir) "/" (car scopeinfo)))) (message (concat "Cannot find index-file subdirectory: " (expand-file-name remem-database-dir) "/" (car scopeinfo))) (setq notfound t)))) remem-scopes-list) notfound)) (t (setq remem-display-running t) (remem-setup-buffer remem-buffer-name) (map-start-scopes (reverse remem-scopes-list)) (save-excursion (set-buffer (get-buffer-create remem-buffer-name)) (map-scope-percentages remem-scopes) ;; This probably won't log anyway, since numqueries should == 0 (remem-log-checkpoint remem-scopes 'remem-started) (remem-set-database-info-for-scopes remem-scopes) (remem-log-dbinfo remem-scopes) (cond (running-xemacs (make-local-hook 'mouse-track-click-hook) (setq mouse-track-click-hook 'remem-mouse-select))) (use-local-map remem-mode-map)) (remem-display-buffer remem-buffer-name) (setq remem-hide-display nil) (setq remem-global-timer (run-at-time 5 3 'remem-fix-window-loss)) ;;to make the display stick! ;;; I don't like resetting C-xo, so I won't ;;; (setq remem-old-C-xo (global-key-binding "\C-xo")) ;;; (global-set-key "\C-xo" 'remem-other-window) ;;; But I'll make an exception for C-x1 'cause it's so useful (setq remem-old-C-x1 (global-key-binding "\C-x1")) (global-set-key "\C-x1" 'remem-delete-other-windows) (global-set-key (concat remem-command-prefix "v") 'remem-query-now) (global-set-key (concat remem-command-prefix "n") 'remem-display-other) (global-set-key (concat remem-command-prefix "f") 'remem-grab-query) (global-set-key (concat remem-command-prefix "d") 'remem-change-database) (global-set-key (concat remem-command-prefix "q") 'remem-create-query-page) ;;;set the key bindings for the retrieval (global-set-key (concat remem-command-prefix "1") 'remem-display-line-1) (global-set-key (concat remem-command-prefix "2") 'remem-display-line-2) (global-set-key (concat remem-command-prefix "3") 'remem-display-line-3) (global-set-key (concat remem-command-prefix "4") 'remem-display-line-4) (global-set-key (concat remem-command-prefix "5") 'remem-display-line-5) (global-set-key (concat remem-command-prefix "6") 'remem-display-line-6) (global-set-key (concat remem-command-prefix "7") 'remem-display-line-7) (global-set-key (concat remem-command-prefix "8") 'remem-display-line-8) (global-set-key (concat remem-command-prefix "9") 'remem-display-line-9) (cond (remem-non-r-number-keys (global-set-key "\C-c1" 'remem-display-line-1) (global-set-key "\C-c2" 'remem-display-line-2) (global-set-key "\C-c3" 'remem-display-line-3) (global-set-key "\C-c4" 'remem-display-line-4) (global-set-key "\C-c5" 'remem-display-line-5) (global-set-key "\C-c6" 'remem-display-line-6) (global-set-key "\C-c7" 'remem-display-line-7) (global-set-key "\C-c8" 'remem-display-line-8) (global-set-key "\C-c9" 'remem-display-line-9))) (global-unset-key (concat remem-command-prefix "r")) ; Just to be safe (global-set-key (concat remem-command-prefix "r1") 'remem-log-rating-1) (global-set-key (concat remem-command-prefix "r2") 'remem-log-rating-2) (global-set-key (concat remem-command-prefix "r3") 'remem-log-rating-3) (global-set-key (concat remem-command-prefix "r4") 'remem-log-rating-4) (global-set-key (concat remem-command-prefix "r5") 'remem-log-rating-5) (run-hooks 'remem-start-hook) (message "Remembrance Agent started"))))))) (defun kill-remem () "kills all the processes, closes the remem-buffer" (save-excursion (cond (remem-display-running (setq remem-display-running nil) (remem-kill-all-scopes) (setq remem-display-buffer-height 0) (setq remem-total-scope-lines 0) (if (or remem-hide-display (eq nil (get-buffer-window remem-buffer-name t))) nil (remem-delete-window remem-buffer-name)) (remem-kill-buffer remem-buffer-name) ;;to make the display stick! (global-set-key "\C-x1" remem-old-C-x1) ;;; (global-set-key "\C-xo" remem-old-C-xo) ;;;unset the key bindings (global-unset-key (concat remem-command-prefix "v")) (global-unset-key (concat remem-command-prefix "n")) (global-unset-key (concat remem-command-prefix "f")) (global-unset-key (concat remem-command-prefix "d")) (global-unset-key (concat remem-command-prefix "q")) (global-unset-key (concat remem-command-prefix "f")) (global-unset-key (concat remem-command-prefix "v")) (global-unset-key (concat remem-command-prefix "1")) (global-unset-key (concat remem-command-prefix "2")) (global-unset-key (concat remem-command-prefix "3")) (global-unset-key (concat remem-command-prefix "4")) (global-unset-key (concat remem-command-prefix "5")) (global-unset-key (concat remem-command-prefix "6")) (global-unset-key (concat remem-command-prefix "7")) (global-unset-key (concat remem-command-prefix "8")) (global-unset-key (concat remem-command-prefix "9")) (cond (remem-non-r-number-keys (global-unset-key "\C-c1") (global-unset-key "\C-c2") (global-unset-key "\C-c3") (global-unset-key "\C-c4") (global-unset-key "\C-c5") (global-unset-key "\C-c6") (global-unset-key "\C-c7") (global-unset-key "\C-c8") (global-unset-key "\C-c9"))) (run-hooks 'remem-start-hook) (message "Remembrance Agent stopped"))))) (defun remem-hide-display () (save-excursion (cond (remem-display-running (cond (remem-hide-display (message "Remembrance display already hidden")) (t (setq remem-hide-display t) (select-window (get-buffer-window (get-buffer remem-buffer-name))) (delete-window)))) (t (message "Remembrance Agent not running"))))) (defun remem-show-display () (save-excursion (cond (remem-display-running (cond (remem-hide-display (remem-display-buffer remem-buffer-name) (setq remem-hide-display nil)) (t (message "Remembrance display not hidden")))) (t (message "Remembrance Agent not running"))))) (defun remem-toggle () (interactive) (let ((w (selected-window))) (save-excursion (cond (remem-display-running (kill-remem)) ((not remem-display-running) (start-remem)))) (select-window w))) (defun remem () "Start the remembrance agent. If already running, kill it and restart it." (interactive) (let ((w (selected-window))) (save-excursion (cond (remem-display-running (kill-remem) (sleep-for 1) (start-remem)) ((not remem-display-running) (start-remem)))) (select-window w))) ;;; ------------------- ;;; ALTERNATE FUNCTIONS ;;; ------------------- (defun remem-other-window (&rest args) "Replacement for the C-xo key binding that takes the cursor remem-display window" (interactive) (let ((sw (selected-window)) (rw (get-buffer-window remem-buffer-name t)) (nw (next-window (selected-window) 1)) w) (cond ((eq nw rw) (other-window 2)) (t (other-window 1))) )) (defun remem-delete-window (buffer-name) (let ((buffer (get-buffer buffer-name))) (save-excursion (select-window (get-buffer-window buffer t)) (delete-window)))) (defun remem-delete-other-windows (&rest args) "Replacement for delete-other-windows that won't delete the *remem-buffer* window." (interactive) (let ((sw (selected-window)) (rw (get-buffer-window remem-buffer-name)) (nw (next-window (selected-window) 1)) w) (cond (rw (if (eq sw rw) (progn (other-window 1) (setq sw (selected-window)) (setq nw (next-window (selected-window) 1)))) (while (not (eq nw sw)) (setq w nw) (setq nw (next-window nw 1)) (or (eq w rw) (eq w sw) (delete-window w))) (message (concat "Use " remem-command-prefix "t to quit the Remembrance Agent"))) (t (delete-other-windows))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Specialty functions for handling wierd modes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun remem-rmail-what-message-at-point (n) (let ((where n) (low 1) (high rmail-total-messages) (mid (/ rmail-total-messages 2))) (while (> (- high low) 1) (if (>= where (rmail-msgbeg mid)) (setq low mid) (setq high mid)) (setq mid (+ low (/ (- high low) 2)))) (if (>= where (rmail-msgbeg high)) high low))) (defun remem-rmail-goto-char (n) "Jump to a given global char number in an rmail message" (interactive "nChar: ") (rmail-show-message (remem-rmail-what-message-at-point n)) (goto-char n)) ;;;;;;;;;;;;;;;;;;; ;; Logging ;; ;; Events that are logged (for each scope): ;; Following a suggestion ;; Docnum, relevance, scopename, lineno within scope, numlines shown, ;; whether was automatic / mouse-query / remem-query ;; kill-remem, start-remem, following a suggestion, resize, every ~500 queries since last log ;; Num queries done, update period for scopes, scopenames, numlines shown in scope, which event triggered ;; Rating a suggestion ;; Docnum, rating, rated document type, major-mode for this query ;; Making a mouse-query ;; Fieldno ;; Making a remem-query ;; just the event ;;;;;;;;;;;;;;;;;;; (defun remem-log-string (string) "Append string to the logfile" (cond (remem-log-p (write-region (concat (current-time-string) " -- " string) nil remem-logfile t 1)))) (defun remem-log-suggestion-followed (scope docnum relevance-and-line lineno sims-breakdown) (let ((numlines (remem-scope-number-lines scope)) (scopename (remem-scope-directory scope)) (relevance (substring relevance-and-line 4 8)) (scopeline (string-to-number (substring relevance-and-line 0 3)))) (remem-log-string (format "Followed: %d, %s, %s, %d, %d, %s, %s\n" docnum relevance scopename scopeline numlines remem-kind-of-query sims-breakdown)))) (defun remem-log-checkpoint-scope (scope why-check) (let ((num-queries (remem-scope-querycounter scope)) (update-period (remem-scope-update-time scope)) (scopename (remem-scope-directory scope)) (numlines (remem-scope-number-lines scope))) ;;; No cond, so it logs events even when no checkpoint is needed. ; (cond ((> num-queries 0) (remem-log-string (format "Checkpoint: %d, %s, %d, %d, %s\n" num-queries scopename update-period numlines why-check)) (remem-set-scope-querycounter scope 0))) ;)) (defun remem-log-checkpoint (scopes-left why-check) (cond (scopes-left (remem-log-checkpoint-scope (car scopes-left) why-check) (remem-log-checkpoint (cdr scopes-left) why-check)))) (defun remem-log-dbinfo-scope (scope) (let ((scopename (remem-scope-directory scope)) (dbinfo (remem-scope-dbinfo scope))) (remem-log-string (format "%s, %s\n" dbinfo scopename)))) (defun remem-log-dbinfo (scopes-left) (cond (scopes-left (remem-log-dbinfo-scope (car scopes-left)) (remem-log-dbinfo (cdr scopes-left))))) (defun remem-log-rating (rating) (cond (remem-last-followed-docnum (remem-log-string (format "Rating: %d, %d, %s, %s\n" remem-last-followed-docnum rating remem-last-followed-doctype remem-last-query-mode)) (cond ((eq rating 1) (message (format "Document rated: 1 [Bad suggestion]"))) ((eq rating 2) (message (format "Document rated: 2 [So-so suggestion]"))) ((eq rating 3) (message (format "Document rated: 3 [OK suggestion]"))) ((eq rating 4) (message (format "Document rated: 4 [Good suggestion]"))) ((eq rating 5) (message (format "Document rated: 5 [Great suggestion]"))))) (t (message (format "No document to rate or document already rated" rating)))) (setq remem-last-followed-docnum nil) (setq remem-last-followed-doctype nil) (setq remem-last-query-mode nil)) ;(defun remem-mail-hook () ; (save-excursion ; (goto-char (point-min)) ; (setq remem-mail-msg-start (search-forward "\n\n")))) ;(add-hook 'rmail-show-message-hook 'remem-mail-hook) 'remem-loaded remem-2.12/plugins/0000777000076500007650000000000010014272766010010 5remem-2.12/plugins/indexers-date.c0000644000076500007650000002352207760625114012633 /* indexers-date.c has all the (hopefully reusable) indexing functions for dates pointed to by entries in the template structure. */ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "parsedoc.h" #include "plugins-date.h" #include "plugins.h" #include "conftemplates.h" /* Write wordvec file to disk, in directory dbdir with filename fnames. If final_write_p == 1, close the files afterwards. Free dvtree as you go. write_text_index_file_and_free writes WORDVEC-OFFS and WORDVEC files, while index_store writes the DOCLEN file directly. File format: Format for WORDVEC_FILE: doc/weight pairs for the wordcode specified in the wordvec offset file. No wordcode is listed here since it's redundant. Docnums are listed in reverse docnum order, 'cause that's easier to deal with in the indexing. Weight is represented as DB_UINT instead of DB_USHORT because it allows us to more easilly load it all in one read, even when we're reading things in reverse network byte order. I think this will make the read faster, at the cost of wasting a couple bytes per weight. Not sure if this is a valid assumption, and it should probably be tested on various platforms at some point. (DB_UINT) (DB_UINT) (DB_UINT) (DB_UINT) ...(DB_UINT) (DB_UINT) DOCNUM-1, WEIGHT-1, DOCNUM-2, WEIGHT-2, ...DOCNUM-N1, WEIGHT-N1, DOCNUM-2, WEIGHT-1, DOCNUM-2, WEIGHT-2, ...DOCNUM-N2, WEIGHT-N2 ... Format for WVOFF_FILE: wordcode + offset into wordvec file. Offset is # of bytes from start that the first docnum for this wordvec appears. (width*DB_UINT) (DB_UINT) WORDCODE-1, OFFSET-1, WORDCODE-2, OFFSET-2, ... Format for DOCLEN_FILE: docnum followed by fieldtype and document length (number words), in docnum order followed by fieldtype order. Note that there might be missing document numbers or fields, since this is only for docs and fields with text-type. (DB_UINT) (DB_UINT) (DB_UINT) DOCNUM-1, FIELDTYPE-1, LENGTH-OF-DOC-1-FIELD-1, DOCNUM-1, FIELDTYPE-2, LENGTH-OF-DOC-1-FIELD-2, DOCNUM-2, FIELDTYPE-1, LENGTH-OF-DOC-2-FIELD-1, ... */ void write_date_index_file_and_free (Date_Tree *datetree, char *dbdir, char *date_fname, int final_write_p) { static FILE *DATE_FILE = NULL; Date_Doc_List *doc, *doc_next; if (DATE_FILE == NULL) DATE_FILE = open_or_die(dbdir, date_fname, "w"); if (datetree != NULL) { /* Write to the left */ write_date_index_file_and_free (datetree->left, dbdir, date_fname, 0); /* Write me */ doc = datetree->documents; while (doc != NULL) { fwrite_big(&(datetree->date), sizeof(DB_UINT), 1, DATE_FILE); fwrite_big(&(doc->docnum), sizeof(DB_UINT), 1, DATE_FILE); printf("Writing to %s: %d %d\n", date_fname, datetree->date, doc->docnum); doc_next = doc->next; free(doc); doc = doc_next; } /* Write to the right and fight fight fight */ write_date_index_file_and_free (datetree->right, dbdir, date_fname, 0); free(datetree); } if (final_write_p) { if (DATE_FILE != NULL) fclose(DATE_FILE); DATE_FILE = NULL; } } /* write checkpoint files. These are written as the filename with a .## after it, where ## is the number of this checkpoint. */ void checkpoint_date_index_file_and_free (Date_Tree *datetree, int checkpoint_number, char *dbdir) { char date_fname[100]; sprintf(date_fname, "%s.%.3d", DATES_FNAME, checkpoint_number); /* Write it out. Remember to always close it afterwards, 'cause you can't have more than one checkpoint dir open at a time the way we're doing it now. (the "1" as the last arg closes it) */ write_date_index_file_and_free (datetree, dbdir, date_fname, 1); } /* AUGH this one is bad */ /* this must be set up so it writes all the way down... */ /* merge_text_index_file: Take a series of checkpointed wordvec and wordvec-offset files, and merge them into one file (doing a merge sort). */ void merge_date_index_file (int checkpoints_written, char *dbdir) { DB_UINT *dates; DB_UINT docnum; DB_UINT min; FILE **IN_FILES; FILE *OUT_FILE; char date_fname[PATH_MAX]; int i, minindex; int all_files_empty = 0; dates = (DB_UINT *)malloc(sizeof(DB_UINT) * checkpoints_written); IN_FILES = (FILE **) malloc(sizeof(FILE *) * checkpoints_written); OUT_FILE = open_or_die(dbdir, DATES_FNAME, "w"); /* open the files and read in the first date from each */ for (i = 0; i < checkpoints_written; i++) { sprintf(date_fname, "%s.%.3d", DATES_FNAME, i); IN_FILES[i] = open_or_die(dbdir, date_fname, "r"); /* dates[i] = (DB_UINT *)malloc(sizeof(DB_UINT)); */ fread_big(&(dates[i]), sizeof(DB_UINT), 1, IN_FILES[i]); } while (1) { /* find the minimum date */ min = -1; minindex = 0; while ((min == -1) && (all_files_empty == 0)) { min = dates[minindex]; minindex++; if (minindex == checkpoints_written) all_files_empty = 1; } minindex--; if (all_files_empty = 1) break; for (i = minindex; i < checkpoints_written; i++) { if ((dates[i] != -1) && (dates[i] < min)) { min = dates[i]; minindex = i; } } fread_big(&(docnum), sizeof(DB_UINT), 1, IN_FILES[minindex]); fwrite_big(&(dates[minindex]), sizeof(DB_UINT), 1, OUT_FILE); fwrite_big(&(docnum), sizeof(DB_UINT), 1, OUT_FILE); printf("Writing to temp file %d: %d %d\n", minindex, dates[minindex], docnum); fread_big(&(dates[minindex]), sizeof(DB_UINT), 1, IN_FILES[minindex]); if (feof(IN_FILES[minindex])) { dates[minindex] = -1; fclose(IN_FILES[minindex]); /* delete the temp file here! */ } } fclose(OUT_FILE); } /* index_store: take whatever type is returned by the parser and stores it in the appropriate structure, for later writing to disk. It can also write some info to disk immediately if it needs to (e.g. for checkpointing so you don't run out of RAM). Store stuff statically so it can be used in subsequent calls. If last_write_p == 1, make sure everything gets written to disk. Assumes we get documents one at a time in docnum order. */ void index_store_date (void *parsedata, /* Type Date_Document_Field * */ char *dbdir, /* directory of the database we're writing to */ int last_write_p) /* last_write_p == 1 if we should finalize it to disk now */ { static Date_Tree *datetree = NULL; /* The Date Tree being added to */ static int checkpoints_written = 0; /* Number of checkpoint directories written so far */ static int mem_used_by_datetree = 0; /* Memory used by dvtree. If this gets too big we write to disk and merge later */ static int we_are_done = 0; /* Because we might be called to finalize our last write several times (once per template that uses this method in fact), we use this to insure we only do a merge and write once at the end. */ Date_Tree *tree = NULL; Date_Document_Field *pd; DB_UINT docnum; pd = (Date_Document_Field *)parsedata; if (pd != NULL) tree = pd->tree; else tree = NULL; if (!we_are_done) { mem_used_by_datetree += add_document_to_datetree(&datetree, tree); if (last_write_p) { /* Let's blow this thing and go home */ if (checkpoints_written > 0) { if (datetree != NULL) { /* write what's remaining */ checkpoint_date_index_file_and_free (datetree, checkpoints_written++, dbdir); } merge_date_index_file (checkpoints_written, dbdir); datetree = NULL; /* it just got freed */ } else { write_date_index_file_and_free (datetree, dbdir, DATES_FNAME, 1); datetree = NULL; } we_are_done = 1; } if (!last_write_p && datetree != NULL && (mem_used_by_datetree > MAX_DOC_MEMORY)) { checkpoint_date_index_file_and_free (datetree, checkpoints_written++, dbdir); mem_used_by_datetree = 0; /* it got freed */ datetree = NULL; } } } remem-2.12/plugins/indexers-text.c0000644000076500007650000003433607760625114012707 /* indexers.c has all the (hopefully reusable) indexing functions pointed to by entries in the template structure. */ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "parsedoc.h" #include "plugins-text.h" #include "plugins.h" #include "conftemplates.h" /* Write wordvec file to disk, in directory dbdir with filename fnames. If final_write_p == 1, close the files afterwards. Free dvtree as you go. write_text_index_file_and_free writes WORDVEC-OFFS and WORDVEC files, while index_store writes the DOCLEN file directly. File format: Format for WORDVEC_FILE: doc/weight pairs for the wordcode specified in the wordvec offset file. No wordcode is listed here since it's redundant. Docnums are listed in reverse docnum order, 'cause that's easier to deal with in the indexing. Weight is represented as DB_UINT instead of DB_USHORT because it allows us to more easilly load it all in one read, even when we're reading things in reverse network byte order. I think this will make the read faster, at the cost of wasting a couple bytes per weight. Not sure if this is a valid assumption, and it should probably be tested on various platforms at some point. (DB_UINT) (DB_UINT) (DB_UINT) (DB_UINT) ...(DB_UINT) (DB_UINT) DOCNUM-1, WEIGHT-1, DOCNUM-2, WEIGHT-2, ...DOCNUM-N1, WEIGHT-N1, DOCNUM-2, WEIGHT-1, DOCNUM-2, WEIGHT-2, ...DOCNUM-N2, WEIGHT-N2 ... Format for WVOFF_FILE: wordcode + offset into wordvec file. Offset is # of bytes from start that the first docnum for this wordvec appears. (width*DB_UINT) (DB_UINT) WORDCODE-1, OFFSET-1, WORDCODE-2, OFFSET-2, ... Format for DOCLEN_FILE: docnum followed by fieldtype and document length (number words), in docnum order followed by fieldtype order. Note that there might be missing document numbers or fields, since this is only for docs and fields with text-type. (DB_UINT) (DB_UINT) (DB_UINT) DOCNUM-1, FIELDTYPE-1, LENGTH-OF-DOC-1-FIELD-1, DOCNUM-1, FIELDTYPE-2, LENGTH-OF-DOC-1-FIELD-2, DOCNUM-2, FIELDTYPE-1, LENGTH-OF-DOC-2-FIELD-1, ... */ void write_text_index_file_and_free (DV_Tree *dvtree, char *dbdir, char *wordvec_fname, char *wvoff_fname, int final_write_p) { static FILE *WORDVEC_FILE = NULL; static FILE *WVOFF_FILE = NULL; DB_UINT wv_off; Doc_List *doc, *doc_next; if (WORDVEC_FILE == NULL) WORDVEC_FILE = open_or_die(dbdir, wordvec_fname, "w"); if (WVOFF_FILE == NULL) WVOFF_FILE = open_or_die(dbdir, wvoff_fname, "w"); if (dvtree != NULL) { /* Write to the left */ write_text_index_file_and_free (dvtree->left, dbdir, wordvec_fname, wvoff_fname, 0); /* Write me */ wv_off = (DB_UINT)ftell(WORDVEC_FILE); fwrite_big(dvtree->wordcode, sizeof(DB_UINT), 3, WVOFF_FILE); fwrite_big(&wv_off, sizeof(DB_UINT), 1, WVOFF_FILE); doc = dvtree->documents; while (doc != NULL) { fwrite_big(&(doc->docnum), sizeof(DB_UINT), 1, WORDVEC_FILE); fwrite_big(&(doc->weight), sizeof(DB_UINT), 1, WORDVEC_FILE); doc_next = doc->next; free(doc); doc = doc_next; } /* Write to the right and fight fight fight */ write_text_index_file_and_free (dvtree->right, dbdir, wordvec_fname, wvoff_fname, 0); free(dvtree); } if (final_write_p) { if (WORDVEC_FILE != NULL) fclose(WORDVEC_FILE); if (WVOFF_FILE != NULL) fclose(WVOFF_FILE); WORDVEC_FILE = NULL; WVOFF_FILE = NULL; } } /* write checkpoint files. These are written as the filename with a .## after it, where ## is the number of this checkpoint. */ void checkpoint_text_index_file_and_free (DV_Tree *dvtree, int checkpoint_number, char *dbdir) { char wordvec_fname[100]; char wvoff_fname[100]; sprintf(wordvec_fname, "%s.%.3d", WORDVEC_FNAME, checkpoint_number); sprintf(wvoff_fname, "%s.%.3d", WVOFF_FNAME, checkpoint_number); /* Write it out. Remember to always close it afterwards, 'cause you can't have more than one checkpoint dir open at a time the way we're doing it now. (the "1" as the last arg closes it) */ write_text_index_file_and_free (dvtree, dbdir, wordvec_fname, wvoff_fname, 1); } /* merge_text_index_file: Take a series of checkpointed wordvec and wordvec-offset files, and merge them into one file (doing a merge sort). */ void merge_text_index_file (int checkpoints_written, char *dbdir) { int i, minwc_index=0, starting=0, prev_minwc_written=0; size_t numwritten=0; short alldone=0, startedyet=0; FILE **IN_WORDVEC_FILES; FILE **IN_WVOFF_FILES; FILE *OUT_WORDVEC_FILE; FILE *OUT_WVOFF_FILE; DB_UINT in_offset, in_offset_next, out_offset; char wordvec_fname[PATH_MAX]; char wvoff_fname[PATH_MAX]; char errorstring[256]; DB_UINT **wordcodes; DB_UINT *in_offsets; DB_UINT minwc[WORD_ENCODE_WIDTH]; DB_UINT prev_minwc[WORD_ENCODE_WIDTH]; in_offsets = (DB_UINT *)malloc(sizeof(DB_UINT) * checkpoints_written); wordcodes = (DB_UINT **)malloc(sizeof(DB_UINT *) * checkpoints_written); IN_WORDVEC_FILES = (FILE **)malloc(sizeof(FILE *) * checkpoints_written); IN_WVOFF_FILES = (FILE **)malloc(sizeof(FILE *) * checkpoints_written); OUT_WORDVEC_FILE = open_or_die(dbdir, WORDVEC_FNAME, "w"); OUT_WVOFF_FILE = open_or_die(dbdir, WVOFF_FNAME, "w"); /* Open each input file and read in the first wordcode from the WVOFF files */ for (i=0; i < checkpoints_written; i++) { sprintf(wordvec_fname, "%s.%.3d", WORDVEC_FNAME, i); sprintf(wvoff_fname, "%s.%.3d", WVOFF_FNAME, i); IN_WORDVEC_FILES[i] = open_or_die(dbdir, wordvec_fname, "r"); IN_WVOFF_FILES[i] = open_or_die(dbdir, wvoff_fname, "r"); wordcodes[i] = (DB_UINT *)malloc(sizeof(DB_UINT) * WORD_ENCODE_WIDTH); fread_big (wordcodes[i], sizeof(DB_UINT), WORD_ENCODE_WIDTH, IN_WVOFF_FILES[i]); fread_big (&(in_offsets[i]), sizeof(DB_UINT), 1, IN_WVOFF_FILES[i]); } while(!alldone) { alldone = 1; /* we can always hope... */ startedyet = 0; /* Find out which wordcode is the minimum */ for (i=0; i < checkpoints_written; i++) { if (!feof(IN_WVOFF_FILES[i])) { alldone = 0; /* not everyone's at eof yet */ if (!startedyet || (wordcode_cmp(wordcodes[i], minwc) <= 0)) { /* new minimum word. We're doing the <= 0 instead of -1 so it'll still add in reverse doc order (which is what each individual file is in) */ startedyet = 1; minwc_index = i; wordcode_cpy(minwc, wordcodes[i]); /* copy it in */ } } } /* Write out another word */ if (startedyet) { in_offset = in_offsets[minwc_index]; /* compute offset to next entry and update wordcodes[minwc_index] with the next in line. (use minwc for this round's minimum from here on. On EOF we won't worry about the new wordvec (there isn't one), but want to make sure we get the end of the wordvec file as the next offset so we'll read in all the data. */ if (fread_big (wordcodes[minwc_index], sizeof(DB_UINT), WORD_ENCODE_WIDTH, IN_WVOFF_FILES[minwc_index]) < WORD_ENCODE_WIDTH) { if (ferror(IN_WVOFF_FILES[minwc_index])) { sprintf(errorstring, "merge_text_index_file: got a short read on wordcodes[%d], previous in_offset = 0x%x", minwc_index, in_offset); SavantError(EIO, errorstring); } } if (fread_big (&in_offsets[minwc_index], sizeof(DB_UINT), 1, IN_WVOFF_FILES[minwc_index]) < 1) { if (feof(IN_WVOFF_FILES[minwc_index])) { in_offset_next = (DB_UINT)ftell_end(IN_WORDVEC_FILES[minwc_index]); } else { sprintf(errorstring, "merge_text_index_file: got a short read on in_offsets[%d], previous in_offset = 0x%x", minwc_index, in_offset); SavantError(EIO, errorstring); } } else { in_offset_next = in_offsets[minwc_index]; } /* write data to output files */ /* No document will be in more than one checkpoint file, but the same word might span checkpoints. If so, just write the docs here. */ if (!prev_minwc_written || wordcode_cmp(prev_minwc, minwc)) { out_offset = (DB_UINT)ftell(OUT_WORDVEC_FILE); fwrite_big (minwc, sizeof(DB_UINT), WORD_ENCODE_WIDTH, OUT_WVOFF_FILE); fwrite_big (&out_offset, sizeof(DB_UINT), 1, OUT_WVOFF_FILE); } numwritten = fcpy_big (OUT_WORDVEC_FILE, 1, in_offset_next - in_offset, IN_WORDVEC_FILES[minwc_index]); if (numwritten != in_offset_next - in_offset) { sprintf(errorstring, "merge_text_index_file: only %d bytes written to wordvec file, should be %d", numwritten, in_offset_next - in_offset); SavantError(EIO, errorstring); } wordcode_cpy(prev_minwc, minwc); prev_minwc_written = 1; } } for (i=0; i < checkpoints_written; i++) { /* close & delete the checkpoint files */ fclose(IN_WORDVEC_FILES[i]); fclose(IN_WVOFF_FILES[i]); sprintf(wordvec_fname, "%s%s.%.3d", dbdir, WORDVEC_FNAME, i); sprintf(wvoff_fname, "%s%s.%.3d", dbdir, WVOFF_FNAME, i); if (unlink(wordvec_fname)) { sprintf(errorstring, "Error unlinking (deleting) file %s", wordvec_fname); SavantError(errno, errorstring); } if (unlink(wvoff_fname)) { sprintf(errorstring, "Error unlinking (deleting) file %s", wvoff_fname); SavantError(errno, errorstring); } } fclose(OUT_WORDVEC_FILE); fclose(OUT_WVOFF_FILE); for (i=0; i < checkpoints_written; i++) { free(wordcodes[i]); } free(wordcodes); free(in_offsets); free(IN_WORDVEC_FILES); free(IN_WVOFF_FILES); } /* index_store: take whatever type is returned by the parser and stores it in the appropriate structure, for later writing to disk. It can also write some info to disk immediately if it needs to (e.g. for checkpointing so you don't run out of RAM). Store stuff statically so it can be used in subsequent calls. If last_write_p == 1, make sure everything gets written to disk. Assumes we get documents one at a time in docnum order. */ void index_store_text (void *parsedata, /* Type Text_Document_Field * */ char *dbdir, /* directory of the database we're writing to */ int last_write_p) /* last_write_p == 1 if we should finalize it to disk now */ { static DV_Tree *dvtree = NULL; /* The DV Tree being added to */ static int checkpoints_written = 0; /* Number of checkpoint directories written so far */ static int mem_used_by_dvtree = 0; /* Memory used by dvtree. If this gets too big we write to disk and merge later */ static int we_are_done = 0; /* Because we might be called to finalize our last write several times (once per template that uses this method in fact), we use this to insure we only do a merge and write once at the end. */ static FILE *DOCLEN_FILE = NULL; DV_Tree *tree = NULL; Text_Document_Field *pd; DB_UINT docnum, fieldtypenum; pd = (Text_Document_Field *)parsedata; if (pd != NULL) tree = pd->tree; else tree = NULL; if (DOCLEN_FILE == NULL) DOCLEN_FILE = open_or_die(dbdir, DOCLEN_FNAME, "w"); /* Write DOCLEN_FILE info */ if (pd != NULL) { docnum = pd->docnum; fieldtypenum = pd->fieldtypenum; fwrite_big(&docnum, sizeof(DB_UINT), 1, DOCLEN_FILE); fwrite_big(&fieldtypenum, sizeof(DB_UINT), 1, DOCLEN_FILE); fwrite_big(&(pd->length), sizeof(DB_UINT), 1, DOCLEN_FILE); } if (!we_are_done) { mem_used_by_dvtree += add_document_to_dvtree(&dvtree, tree); if (last_write_p) { /* Let's blow this thing and go home */ if (checkpoints_written > 0) { if (dvtree != NULL) { /* write what's remaining */ checkpoint_text_index_file_and_free (dvtree, checkpoints_written++, dbdir); } merge_text_index_file (checkpoints_written, dbdir); dvtree = NULL; /* it just got freed */ } else { write_text_index_file_and_free (dvtree, dbdir, WORDVEC_FNAME, WVOFF_FNAME, 1); dvtree = NULL; } fclose(DOCLEN_FILE); we_are_done = 1; } if (!last_write_p && dvtree != NULL && (mem_used_by_dvtree > MAX_DOC_MEMORY)) { checkpoint_text_index_file_and_free (dvtree, checkpoints_written++, dbdir); mem_used_by_dvtree = 0; /* it got freed */ dvtree = NULL; } } } remem-2.12/plugins/Makefile.am0000644000076500007650000000034207760625115011763 lib_LIBRARIES=libplugins.a libplugins_a_SOURCES=parsers-text.c indexers-text.c retrievers-text.c \ stem.c parsers-date.c indexers-date.c EXTRA_DIST=plugins-text.h stem.h stops.h plugins-date.h plugins.h remem-2.12/plugins/Makefile.in0000644000076500007650000002367707760626046012020 # Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ CC = @CC@ DEPDIR = @DEPDIR@ EMACS = @EMACS@ INCLUDES = @INCLUDES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ lispdir = @lispdir@ lib_LIBRARIES = libplugins.a libplugins_a_SOURCES = parsers-text.c indexers-text.c retrievers-text.c \ stem.c parsers-date.c indexers-date.c EXTRA_DIST = plugins-text.h stem.h stops.h plugins-date.h plugins.h subdir = plugins mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(lib_LIBRARIES) libplugins_a_AR = $(AR) cru libplugins_a_LIBADD = am_libplugins_a_OBJECTS = parsers-text.$(OBJEXT) indexers-text.$(OBJEXT) \ retrievers-text.$(OBJEXT) stem.$(OBJEXT) parsers-date.$(OBJEXT) \ indexers-date.$(OBJEXT) libplugins_a_OBJECTS = $(am_libplugins_a_OBJECTS) DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/indexers-date.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/indexers-text.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/parsers-date.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/parsers-text.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/retrievers-text.Po ./$(DEPDIR)/stem.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ DIST_SOURCES = $(libplugins_a_SOURCES) DIST_COMMON = Makefile.am Makefile.in SOURCES = $(libplugins_a_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu plugins/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) AR = ar libLIBRARIES_INSTALL = $(INSTALL_DATA) install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f"; \ $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f; \ else :; fi; \ done @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(libdir)/$$p"; \ rm -f $(DESTDIR)$(libdir)/$$p; \ done clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) libplugins.a: $(libplugins_a_OBJECTS) $(libplugins_a_DEPENDENCIES) -rm -f libplugins.a $(libplugins_a_AR) libplugins.a $(libplugins_a_OBJECTS) $(libplugins_a_LIBADD) $(RANLIB) libplugins.a mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indexers-date.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indexers-text.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsers-date.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsers-text.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/retrievers-text.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stem.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `cygpath -w $<` CCDEPMODE = @CCDEPMODE@ uninstall-info-am: ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: $(mkinstalldirs) $(DESTDIR)$(libdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLIBRARIES mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-libLIBRARIES install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-info-am uninstall-libLIBRARIES .PHONY: GTAGS all all-am check check-am clean clean-generic \ clean-libLIBRARIES distclean distclean-compile distclean-depend \ distclean-generic distclean-tags distdir dvi dvi-am info \ info-am install install-am install-data install-data-am \ install-exec install-exec-am install-info install-info-am \ install-libLIBRARIES install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic tags uninstall uninstall-am \ uninstall-info-am uninstall-libLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: remem-2.12/plugins/parsers-date.c0000644000076500007650000002472607760625115012501 /* parsers-date.c has all the (hopefully reusable) parser and deparser functions for dates pointed to by entries in the template structure. */ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "parsedate.h" #include "plugins-date.h" #include "conftemplates.h" /* parse_date: fielddata contains a string representation of a date. this string is passed to a date parser which returns a unix timestamp value for that date. a Date_Document_Field is then returned which contains this timestamp and and document number associated with it. */ void *parse_date (char *fielddata, void *self, DB_INT docnum) { /* We are using DB_UINT for timestamps because maxint is 2^32 = 4294967296. Currently, our timestamp is 918681392 (from doing "date +%s"), so we're fine till ~2106. so: WARNING!!!! This software is not Year 2106 compliant. The crusty old C programmers in 2106 might want to change that :) EXTRA OTHER WARNING!!! this code assumes that if fielddata contains multiple dates, they are separated by a carriage return. the format must be as follows: ... */ Date_Tree *tree = NULL; Date_Document_Field *return_value = NULL; int p=0, q=0, cr=0, s=0; int r; GBuffer g; struct parsedate *pd; init_GBuffer(&g); /* figure out how many dates are in the fielddata */ while(fielddata[s] != '\0') { if (fielddata[s] == '\n') cr++; s++; } cr++; return_value = (Date_Document_Field *)malloc(sizeof(Date_Document_Field)); return_value->docnum = (DB_UINT)docnum; /* printf("Creating document[%d]\n", docnum); */ while(1) { if (fielddata[q] == '\n' || fielddata[q] == '\0') { pd = parsedate(strcast_GBuffer(&g)); strnchop_GBuffer(&g, strlen(strcast_GBuffer(&g))); datetree_add_word(&tree, 1, (DB_UINT)pd->unixtime, docnum); /* printf(" Date[%d]: %d\n", r, (DB_UINT)pd->unixtime); */ p++; if (fielddata[q] == '\0') break; } strncat_GBuffer(&g, &fielddata[q], 1); q++; } free_GBuffer(&g); return_value->tree = tree; return return_value; } /* deparse_text: looks at a parsed date field (a Date_Document_Field contained in fielddata) and returns a GBuffer with some printable text describing the dates. i think this code has some memory management issues regarding the freeing of the GBuffer s. not sure how to solve it though. */ GBuffer *deparse_date (void *fielddata, void *self) { GBuffer *s; char b[100]; int n=0; init_GBuffer(s); deparse_helper(((Date_Document_Field *)fielddata)->tree, s); if (s == NULL) { return(NULL); } return(s); } void deparse_helper(Date_Tree *tree, GBuffer *buf) { char temp[100]; if (tree->left != NULL) deparse_helper(tree->left, buf); sprintf(temp, "%d ", tree->date); strncat_GBuffer(buf, temp, strlen(temp)); if (tree->right != NULL) deparse_helper(tree->right, buf); } /* Return next date in a Date_Document_Field. If reset_p != 0, start over. Right now, we're just re-searching the tree every time to find the next date. Not a big deal since we're only using this for queries, and we expect those to be relatively small. We're bundling the date, into the Date_Word_Info. This will get freed by update_sims_word. */ void *nextword_date (void *fielddata, int reset_p) { static Date_Tree *stateptr=NULL; /* ptr to the previous word, so we can find the next. */ Date_Document_Field *fd; Date_Word_Info *dwi; if (fielddata == NULL) return(NULL); if (stateptr == NULL) reset_p = 1; fd = (Date_Document_Field *)fielddata; if (reset_p) stateptr = fd->tree; stateptr = date_greater_than(&(stateptr->date), fd->tree, reset_p); if (stateptr == NULL) return(NULL); dwi = (Date_Word_Info *)malloc(sizeof(Date_Word_Info)); /* Gets freed by update_sims_word */ dwi->date = stateptr->date; return(dwi); } /* Return node with the minimum date that's still > date. If return_smallest == 1, just return the minimum wordcode */ Date_Tree *date_greater_than(DB_UINT *date, Date_Tree *root, int return_smallest) { Date_Tree *potential_answer = NULL; int comparison; if (root == NULL) return(NULL); comparison = (return_smallest || (root->date < *date)) ? -1 : ((root->date > *date) ? 1 : 0); if (comparison > 0) { /* our node > date, so look for smaller */ potential_answer = date_greater_than(date, root->left, return_smallest); return((potential_answer == NULL) ? root : potential_answer); } else { /* our node <= wordcode, look for bigger */ return(date_greater_than(date, root->right, return_smallest)); } } void free_parsed_date (void *parseddata) { Date_Document_Field *df; if (parseddata == NULL) return; df = (Date_Document_Field *)parseddata; /*free(df->dates);*/ free(df); return; } /* Add a date to a Date_Tree NOTE: This assumes that we'll be adding a document at a time, and adding all dates for a particular document at once. If this isn't true, we'll need to actually scan the whole doclist for a docvec node. Return the number of bytes malloc'ed this call. (Jees, doing our own memory management and everything. Why not just get a real language and be done with it?) */ int datetree_add_word(Date_Tree **treeptr, DB_UINT date, DB_UINT docnum) { Date_Doc_List *doclist; Date_Tree *tree = *treeptr; int cmp; int i; if (tree==NULL) { /* create new node */ if ((tree = (Date_Tree *)malloc(sizeof(Date_Tree))) == NULL) SavantError(ENOMEM, "Unable to malloc *tree in parsers-date.c"); if ((tree->documents = (Date_Doc_List *)malloc(sizeof(Date_Doc_List))) == NULL) SavantError(ENOMEM, "Unable to malloc document list in parsers-date.c"); tree->date = date; tree->left = NULL; tree->right = NULL; tree->documents->next = NULL; tree->documents->docnum = docnum; *treeptr = tree; return(sizeof(Date_Tree) + sizeof(Date_Doc_List)); } /* TODO: fix this comment */ /* If we've already got a match for this wordcode AND this doc, just increment the weight. If we've got the wordcode but not the doc, prepend this document to the front. NOTE: This assumes that we'll be adding a document at a time, and adding all words for a particular document at once. If this isn't true, we'll need to actually scan the whole doclist for a docvec node. */ /* cmp = wordcode_cmp(code, tree->wordcode); */ if(date == tree->date) { /* then we are adding a date that is already in the tree... */ /* hmm... what to do here? */ /* Got the word but not doc, add the doc to list This adds in reverse-doc order, 'cause it's easier. */ if (tree->documents->docnum == docnum) { /* already have this date & doc */ return(0); /* Didn't alloc anything this round */ } else { if ((doclist = (Date_Doc_List *)malloc(sizeof(Date_Doc_List))) == NULL) SavantError(ENOMEM, "Unable to malloc doclist in parsers-date.c"); doclist->docnum = docnum; doclist->next = tree->documents; tree->documents = doclist; return(sizeof(Date_Doc_List)); } } else if(date < tree->date) { return(datetree_add_word(&(tree->left), date, docnum)); } else { return(datetree_add_word(&(tree->right), date, docnum)); } } /* add_document_to_datetree: merge the documentTree into target. documentTree is assumed to only contain a single document (one entry in the Date_Doc_List per word) -- otherwise we'd have to do more checking and scanning. NOTE: In this implementation, we're first throwing words into a binary tree (Date_Tree) when parsing data. This happens in parse_text, and is done so we can add up dates for duplicates. We then merge trees in add_document_dvtree when indexing (index_store_text). An alternate method would be to just collect documents in a linked list in parse_date, and only do the tree-search once instead of twice. The downside is we'd have to malloc more memory, 'cause we'd have a list entry for every occurence of a date whether it's duplicated or not. Return the number of bytes added to target this round, so we can keep track of memory usage. (There really should be a better way.) */ int add_document_to_datetree (Date_Tree **target, Date_Tree *documentTree) { int mem = 0; /* memory used */ if (documentTree == NULL) return(0); /* nothing to do */ /* Add everything to the left, add everything to the right */ if (documentTree->left != NULL) { mem += add_document_to_datetree(target, documentTree->left); } if (documentTree->right != NULL) { mem += add_document_to_datetree(target, documentTree->right); } /* I'm now a leaf node, so add & free myself */ mem += datetree_add_word(target, documentTree->date, documentTree->documents->docnum); /* We used to free things here, but now we're freeing in a top-level call in main. */ /*free(documentTree->documents); free(documentTree); */ return(mem); } remem-2.12/plugins/parsers-text.c0000644000076500007650000005671607760625115012554 /* parsers-text.c has all the (hopefully reusable) parser and deparser functions for text pointed to by entries in the template structure. */ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "plugins.h" #include "plugins-text.h" #include "conftemplates.h" #include "stem.h" #include "stops.h" /*###################################################################### TEXT PARSING MODULES: modules for parsing english prose. ######################################################################*/ int upper=0,power=0,num_words=0; char **comm = NULL; int by_alpha(const void *in1, const void *in2) { return(strcmp(*(char **)in1, *(char **)in2)); } /* Do some preprocessing for stop words stuff (comm_local is the list of stop words, from stops.h) */ int core_comm_local(void) { comm = comm_local; num_words = num_words_local; /* for safety's sake */ qsort(comm, num_words, sizeof(char *), by_alpha); upper = 1; power = 0; while(upper < num_words) { upper = upper*2 + 1; /* upper = one less than highest 2^n < num_words */ power++; /* power = log(upper+1)-1 */ } return(0); } /* Return 1 if the word is a common word (i.e. is in the stop-list), 0 otherwise */ int is_common(char *word) { int disp,loc,i,itr,step; if (comm == NULL) core_comm_local(); /* Init stopwords if necessary */ loc = 0; itr = power+1; step = (1<>1; loc += disp; if(loc>=num_words) loc = num_words - 1; i = strcmp(word,comm[loc]); if(i == 0) return(1); else if(i < 0) disp = -step; else disp = step; } return(0); } unsigned int encode_char(unsigned char c) { /* return a 6-bit packed representation of a char: a-z = 01-1A 0-9 = 1B-24 _ = 25 - = 26 ! = 27 anything else gets mapped to ascii(c) & 0x3F (lower 6 bits) */ if ((c >= 'a') && (c <= 'z')) { return ((int)c - (int)'a' + 1); } else if ((c >= '0') && (c <= '9')) { return ((int)c - (int)'0' + 0x1B); } else if (c == '_') { return (0x25); } else if (c == '-') { return (0x26); } else if (c == '!') { return (0x27); } else { return ((int)c & 0x3F); } } unsigned char decode_char (unsigned int code) { if ((code >= 0x1) && (code <= 0x1A)) { return ((char)(code + 'a' - 1)); } else if ((code >= 0x1B) && (code <= 0x24)) { return ((char)(code + '0' - 0x1B)); } else if (code == 0x25) { return ('_'); } else if (code == 0x26) { return ('-'); } else if (code == 0x27) { return ('!'); } else if (code == 0) { return ((char)0); /* so the rest of the string is printable */ } else { return ((char)(code - 1)); } } /* encode_text_word: encode a normal english word into a packed, 3-byte format. Encoding scheme: EXTENDED ENCODING SYSTEM (3 unsigned ints): In the 3-int system, each character is 6 bits, with the most significant 6-bits in the first int being the type field. Bits wrap to the next byte, as follows: tttttt 111111 222222 333333 444444 55 = 32 bits 5555 666666 777777 888888 999999 0000 00 111111 222222 333333 444444 555555 = 15 characters, 6-bits type The "type" is equal to the field-number, which is dependent on the order fields are inserted into the template structure. This means that different versions of Savant may be incompatible depending on what templates are added. */ void encode_text_word(unsigned char *s, unsigned int * code, DB_UINT field_type) { time_t timestamp; struct parsedate *pd; const time_t SECONDS_IN_DAY = 86400; const time_t SECONDS_IN_WEEK = 604800; unsigned int endstr; int i,j,k,offset; /* printf("encode_word: word = %s\n", s); */ for (k=0;k= 0) && (!endstr)) { if (!endstr && (s[i] == 0)) { endstr = 1; /* at end of the string, don't add more to the code */ } if (endstr == 0) { code[j] += (encode_char(s[i]) << offset); offset -= CHARACTER_ENCODE_WIDTH; i++; } } if (!endstr) { /* break this char up across int boundaries */ code[j] += (encode_char(s[i]) >> -offset); offset = sizeof(unsigned int)*8 + offset; } } } void decode_text_word(unsigned int *code, char *str, char *fieldname) { /* Fill str with a printable representation of code */ int i, j, offset; unsigned int d, carryoverd, type, mask; type = code[0] >> (sizeof(unsigned int)*8 - 6); d = code[0] & 0x3f; j = 0; carryoverd = 0; mask = 0xffffffff >> (8 * 4 - CHARACTER_ENCODE_WIDTH); /* a mask for one packed character width */ offset = sizeof(unsigned int)*8 - 6 - CHARACTER_ENCODE_WIDTH; for(i=0; i < WORD_ENCODE_WIDTH; i++) { while(offset >= 0) { d = ((code[i] >> offset) & mask) + carryoverd; carryoverd = 0; if (d) { str[j] = decode_char(d); j++; } offset -= CHARACTER_ENCODE_WIDTH; } carryoverd = ((code[i] << -offset) & mask); offset = sizeof(unsigned int)*8 + offset; } str[j] = 0; strcat (str, ": "); strcat (str, fieldname); } /* comparison function for wordcodes */ int wordcode_cmp(Wordcode code1, Wordcode code2) /* compare func for qsort */ { int j; for(j=0; j ((unsigned int *)code2)[j]) return 1; } return 0; } /* copy function for wordcodes */ int wordcode_cpy(Wordcode dest, Wordcode source) { int j; for(j=0; jdocuments = (Doc_List *)malloc(sizeof(Doc_List))) == NULL) SavantError(ENOMEM, "Unable to malloc document list in parsers.c"); for (i=0; iwordcode[i] = code[i]; } tree->documents->weight = weight; tree->left = NULL; tree->right = NULL; strncpy(tree->printword, printword, PRINTWORD_LENGTH); tree->documents->next = NULL; tree->documents->docnum = docnum; *treeptr = tree; return(sizeof(DV_Tree) + sizeof(Doc_List)); } /* If we've already got a match for this wordcode AND this doc, just increment the weight. If we've got the wordcode but not the doc, prepend this document to the front. NOTE: This assumes that we'll be adding a document at a time, and adding all words for a particular document at once. If this isn't true, we'll need to actually scan the whole doclist for a docvec node. */ cmp = wordcode_cmp(code, tree->wordcode); if(cmp==0) { if (tree->documents->docnum == docnum) { /* Got word & doc, increment */ tree->documents->weight += weight; return(0); /* Didn't alloc anything this round */ } else { /* Got the word but not doc, add the doc to list This adds in reverse-doc order, 'cause it's easier. */ if ((doclist = (Doc_List *)malloc(sizeof(Doc_List))) == NULL) SavantError(ENOMEM, "Unable to malloc doclist in parsers.c"); doclist->docnum = docnum; doclist->weight = weight; doclist->next = tree->documents; tree->documents = doclist; return(sizeof(Doc_List)); } } else if(cmp<0) { return(dvtree_add_word(&(tree->left), code, printword, weight, docnum)); } else { return(dvtree_add_word(&(tree->right), code, printword, weight, docnum)); } } /* add_document_to_dvtree: merge the documentTree into target. documentTree is assumed to only contain a single document (one entry in the Doc_List per word) -- otherwise we'd have to do more checking and scanning. NOTE: In this implementation, we're first throwing words into a binary tree (DV_Tree) when parsing data. This happens in parse_text, and is done so we can add up wordcounts for duplicates. We then merge trees in add_document_dvtree when indexing (index_store_text). An alternate method would be to just collect documents in a linked list in parse_text, and only do the tree-search once instead of twice. The downside is we'd have to malloc more memory, 'cause we'd have a list entry for every occurence of a word whether it's duplicated or not. Return the number of bytes added to target this round, so we can keep track of memory usage. (There really should be a better way.) */ int add_document_to_dvtree (DV_Tree **target, DV_Tree *documentTree) { int mem = 0; /* memory used */ if (documentTree == NULL) return(0); /* nothing to do */ /* Add everything to the left, add everything to the right */ if (documentTree->left != NULL) { mem += add_document_to_dvtree(target, documentTree->left); } if (documentTree->right != NULL) { mem += add_document_to_dvtree(target, documentTree->right); } /* I'm now a leaf node, so add & free myself */ mem += dvtree_add_word(target, documentTree->wordcode, documentTree->printword, documentTree->documents->weight, documentTree->documents->docnum); /* We used to free things here, but now we're freeing in a top-level call in main. */ /*free(documentTree->documents); free(documentTree); */ return(mem); } /*###################################################################*/ /* parse_text: Throws out stop words, stems remaining words, and returns a Text_Document_Field, which contains the field typenum, the length of this document, and a DV_Tree (DV_Tree = binary doc-vector tree sorted by word-code, with weights for this document). self is the field being parsed, which we need to figure out the type number to encode in each word. */ void *parse_text (char *fielddata, void *self, DB_UINT docnum) { static char word[16], printword[PRINTWORD_LENGTH]; char *bufptr, *start, *end; unsigned int code[WORD_ENCODE_WIDTH]; DV_Tree *tree = NULL; Text_Document_Field *return_value = NULL; int i, j; DB_UINT numwords = 0; /* number unique words in this text */ DB_UINT typenum; int punct=0, alpha = 0, midpunct=0; typenum = ((Field *)self)->typenum; bufptr = fielddata; /* fielddata gets freed by whoever calls us */ /* quit at the end of the fielddata, and don't go over the max number of words */ while((*bufptr != '\0') && ((numwords < MAX_NUMBER_WORDS_PER_INDEXED_FIELD) || !MAX_NUMBER_WORDS_PER_INDEXED_FIELD)) { i = 0; /* index into word, to keep from going over */ j = 0; /* number of characters in this word in the fielddata */ punct = 0; /* flag for whether we've got punctuation or other non-alnum chars (or -,_) in there */ midpunct = 0; /* flag for whether we have punctuation in the middle of the word (alphanumerics on either side of non "-" or "_" punctuation */ alpha = 0; /* flag for if the text has letters (i.e. it's a number, not a phone number / date) */ while(isspace(*bufptr) && (*bufptr != '\0')) { /* skip space at the beginning */ bufptr++; } start = bufptr; while(!isspace(*bufptr) && (*bufptr != '\0')) { /* skim to the next space */ if (!midpunct && punct && isalnum(*bufptr)) { midpunct = 1; } if (!punct && !isalnum(*bufptr) && (*bufptr != '_') && (*bufptr != '-') && !isspace(*(bufptr + 1))) { punct = 1; } if (isalpha(*bufptr) || (*bufptr == '_') || (*bufptr == '-')) { alpha = 1; } bufptr++; } end = bufptr; if (midpunct || !alpha || (end - start) > 30) { /* This is a bogus word (e.g. uuencode, email header/address, number only) -- clear it */ word[0] = '\0'; } else { while(!isalnum(*end) && (start < end)) { /* remove non-alpha-numerics from the end of the word */ end--; } end++; /* So that end still points to the character -after- the word */ while(!isalnum(*start) && (start < end)) { /* remove non-alpha-numerics from the start of the word */ start++; } for (i=0; ((start + i) < end) && (i < 15); i++) { /* Copy the word over */ word[i] = tolower(*(start + i)); } word[i] = '\0'; } if(!is_common(word)) { /* skip "stop" words */ strncpy(printword, word, PRINTWORD_LENGTH); Stem(word); if(word[0] != '\0') { /* Stem may stem word to nothing */ encode_text_word(word, code, typenum); /* dvtree_add_word returns the number of bytes allocated. If this is zero, it means we added a word that's already in the tree (not unique), so don't increment. Yes, it's confusing and ugly, but it works. */ if (dvtree_add_word(&tree, code, printword, 1, docnum)) { numwords++; } } } } return_value = (Text_Document_Field *)malloc(sizeof(Text_Document_Field)); return_value->docnum = docnum; return_value->length = numwords; return_value->fieldtypenum = typenum; return_value->tree = tree; return((void *)return_value); } /* parse_text_nostopstem: Returns a Text_Document_Field, which contains the field typenum, the length of this document, and a DV_Tree (DV_Tree = binary doc-vector tree sorted by word-code, with weights for this document). self is the field being parsed, which we need to figure out the type number to encode in each word. This version is the same as parse_text, but doesn't stem the word or throw out stop-words. */ void *parse_text_nostopstem (char *fielddata, void *self, DB_UINT docnum) { static char word[16], printword[PRINTWORD_LENGTH]; char *bufptr, *start, *end; unsigned int code[WORD_ENCODE_WIDTH]; DV_Tree *tree = NULL; Text_Document_Field *return_value = NULL; int i, j; DB_UINT numwords = 0; /* number unique words in this text */ DB_UINT typenum; int punct=0, alpha = 0; typenum = ((Field *)self)->typenum; bufptr = fielddata; /* fielddata gets freed by whoever calls us */ while(*bufptr != '\0') { /* quit at the end of the fielddata */ i = 0; /* index into word, to keep from going over */ j = 0; /* number of characters in this word in the fielddata */ punct = 0; /* flag for whether we've got punctuation or other non-alnum chars (or -,_) in there */ alpha = 0; /* flag for if the text has letters (i.e. it's a number, not a phone number / date) */ while(isspace(*bufptr) && (*bufptr != '\0')) { /* skip space at the beginning */ bufptr++; } start = bufptr; while(!isspace(*bufptr) && (*bufptr != '\0')) { /* skim to the next space */ if (!punct && !isalnum(*bufptr) && (*bufptr != '_') && (*bufptr != '-') && !isspace(*(bufptr + 1))) { punct = 1; } if (isalpha(*bufptr) || (*bufptr == '_') || (*bufptr == '-')) { alpha = 1; } bufptr++; } end = bufptr; if (punct || !alpha || (end - start) > 30) { /* This is a bogus word (e.g. uuencode, email header/address, number only) -- clear it */ word[0] = '\0'; } else { while(!isalnum(*end) && (start < end)) { /* remove non-alpha-numerics from the end of the word */ end--; } end++; /* So that end still points to the character -after- the word */ while(!isalnum(*start) && (start < end)) { /* remove non-alpha-numerics from the start of the word */ start++; } for (i=0; ((start + i) < end) && (i < 15); i++) { /* Copy the word over */ word[i] = tolower(*(start + i)); } word[i] = '\0'; } strncpy(printword, word, PRINTWORD_LENGTH); if(word[0] != '\0') { encode_text_word(word, code, typenum); /* dvtree_add_word returns the number of bytes allocated. If this is zero, it means we added a word that's already in the tree (not unique), so don't increment. Yes, it's confusing and ugly, but it works. */ if (dvtree_add_word(&tree, code, printword, 1, docnum)) { numwords++; } } } return_value = (Text_Document_Field *)malloc(sizeof(Text_Document_Field)); return_value->docnum = docnum; return_value->length = numwords; return_value->fieldtypenum = typenum; return_value->tree = tree; return((void *)return_value); } /* deparse_text: looks at a parsed text field (a Text_Document_Field contained in fielddata) and returns a GBuffer with some printable text describing that text. Right now we're assuming the DV_Tree only contains words from a single document. If this becomes not true, we'll have to actually check docnumbers and/or scan document lists. */ GBuffer *deparse_text_from_dvtree (DV_Tree *tree, void *self, int *total_weight, int *total_numwords) { GBuffer *left, *right; char decoded[100], word[60], codes[60], tempbuf[60]; int i; codes[0] = '\0'; word[0] = '\0'; decoded[0] = '\0'; tempbuf[0] = '\0'; if (tree == NULL) { return(NULL); } left = deparse_text_from_dvtree(tree->left, self, total_weight, total_numwords); right = deparse_text_from_dvtree(tree->right, self, total_weight, total_numwords); /* If we've got something to our left, just reuse it instead of using more memory. Otherwise, malloc it. */ if (left == NULL) { left = (GBuffer *)malloc(sizeof(GBuffer)); init_GBuffer(left); } /* Figure what to print & put it in the decoded string */ decode_text_word(tree->wordcode, word, ((Field *)self)->printname); for(i=0; iwordcode[i]); strcat(codes, tempbuf); } sprintf (decoded, "%s (%s): %d\n", codes, word, tree->documents->weight); *total_weight += tree->documents->weight; *total_numwords += 1; strncat_GBuffer(left, decoded, strlen(decoded)); if (right != NULL) { strncat_GBuffer(left, strcast_GBuffer(right), right->size); } free_GBuffer(right); free(right); return(left); } GBuffer *deparse_text (void *fielddata, void *self) { GBuffer *ret; int total_weight=0, total_numwords=0; char tmpstr[256]; Text_Document_Field *fd; DV_Tree *tree; fd = (Text_Document_Field *)fielddata; if (fd == NULL) { return(NULL); } tree = fd->tree; ret = deparse_text_from_dvtree(tree, self, &total_weight, &total_numwords); if (ret != NULL) { sprintf (tmpstr, "Total weight = %d, Total num words = %d\n", total_weight, total_numwords); strncat_GBuffer(ret, tmpstr, strlen(tmpstr)); } return(ret); } /* Return node with the minimum wordcode that's still > wordcode. If return_smallest == 1, just return the minimum wordcode */ DV_Tree *word_greater_than(unsigned int *wordcode, DV_Tree *root, int return_smallest) { DV_Tree *potential_answer = NULL; int comparison; if (root == NULL) return(NULL); comparison = return_smallest ? 1 : wordcode_cmp(root->wordcode, wordcode); if (comparison > 0) { /* our node > wordcode, look for smaller */ potential_answer = word_greater_than(wordcode, root->left, return_smallest); return((potential_answer == NULL) ? root : potential_answer); } else { /* our node <= wordcode, look for bigger */ return(word_greater_than(wordcode, root->right, return_smallest)); } } /* Free a DV_Tree */ void free_dvtree (DV_Tree *tree) { Doc_List *dl, *freeme; if (tree != NULL) { free_dvtree(tree->left); free_dvtree(tree->right); dl = tree->documents; while (dl != NULL) { freeme = dl; dl = dl->next; free(freeme); } free(tree); } } /* Free a parsed field (destructor) Takes a Text_Document_Field *, cast as a void * */ void free_parsed_text (void *parseddata) { Text_Document_Field *tdf; if (parseddata == NULL) return; tdf = (Text_Document_Field *)parseddata; free_dvtree(tdf->tree); free(tdf); } /* Return next word in a Text_Document_Field. If reset_p != 0, start over. Right now, we're just re-searching the tree every time to find the next word. Not a big deal since we're only using this for queries, and we expect those to be relatively small. We're bundling the word, weight, and length (for normalization) all into the Text_Word_Info. This will get freed by update_sims_word. */ void *nextword_text (void *fielddata, int reset_p) { static DV_Tree *stateptr=NULL; /* ptr to the previous word, so we can find the next. */ Text_Document_Field *fd; Text_Word_Info *twi; if (fielddata == NULL) return(NULL); if (stateptr == NULL) reset_p = 1; fd = (Text_Document_Field *)fielddata; if (reset_p) stateptr = fd->tree; stateptr = word_greater_than(stateptr->wordcode, fd->tree, reset_p); if (stateptr == NULL) return(NULL); twi = (Text_Word_Info *)malloc(sizeof(Text_Word_Info)); /* Gets freed by update_sims_word */ twi->weight = stateptr->documents->weight; twi->word = stateptr->wordcode; strncpy(twi->printword, stateptr->printword, PRINTWORD_LENGTH); twi->length = fd->length; return(twi); } remem-2.12/plugins/plugins-date.h0000644000076500007650000000455707760625115012510 #ifndef _DATE_PARSERS_H_ #define _DATE_PARSERS_H_ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "conftemplates.h" #define DATES_FNAME "dates" #define MAX_DOC_MEMORY 10000000 /* number bytes to use for document vectors before checkpointing to disk */ /* A list of documents, with weights for each. Used by Date_Tree structure, below. */ typedef struct _Date_Doc_List { DB_UINT docnum; struct _Date_Doc_List *next; } Date_Doc_List; typedef struct _Date_Tree { DB_UINT date; Date_Doc_List *documents; struct _Date_Tree *left; struct _Date_Tree *right; } Date_Tree; typedef struct _Date_Document_Field { DB_UINT docnum; /* Docnum for this particular document */ Date_Tree *tree; } Date_Document_Field; typedef struct _Date_Word_Info { DB_UINT date; } Date_Word_Info; void deparse_helper(Date_Tree *tree, GBuffer *buf); Date_Tree *date_greater_than(DB_UINT *date, Date_Tree *root, int return_smallest); #endif remem-2.12/plugins/plugins-text.h0000644000076500007650000001166407760625115012554 #ifndef _TEXT_H_ #define _TEXT_H_ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "conftemplates.h" /*** Wordcodes are unsigned int arrays of width WORD_ENCODE_WIDTH ****/ typedef DB_UINT * Wordcode; #define WORD_ENCODE_WIDTH 3 /* number bytes per word in a wordvec */ /* DO NOT CHANGE THIS FROM 6. It's not known if the algorithm actually -works- if this isn't 6, and there may be places in the code that use some knowledge of the fact that this is 6 without actually referring to CHARACTER_ENCODE_WIDTH. Eit. */ #define CHARACTER_ENCODE_WIDTH 6 /* number of bits per character in a packed wordvec */ /* maximum number of unique non-stop words (after filtering) that are looked at in indexing and retrieval in a given text field. This is counted from the beginning of the document, and is meant to get around the fact that super long documents both seem to come up too often (the weighting schemes aren't normalizing against doc length well enough) and if your query is relevant to something in the middle of the document that doesn't help you much anyway. If zero, there's no max. */ #define MAX_NUMBER_WORDS_PER_INDEXED_FIELD 500 /* A list of documents, with weights for each. Used by DV_Tree structure, below. */ typedef struct _Doc_List { DB_UINT docnum; DB_UINT weight; struct _Doc_List *next; } Doc_List; /* tree rep of a multi-document Vector, with wordcodes as sorting keys */ typedef struct _DV_Tree { unsigned int wordcode[WORD_ENCODE_WIDTH]; char printword[PRINTWORD_LENGTH + 1]; Doc_List *documents; struct _DV_Tree *left; struct _DV_Tree *right; } DV_Tree; /* rep for a single text document. This consists of a docvec containing the words plus agregate info like doc length */ typedef struct _Text_Document_Field { DB_UINT docnum; /* Docnum for this particular document */ DB_UINT length; /* Number of unique words in this field of this doc */ DB_UINT fieldtypenum; /* Field type number (same as used in the text-word's 6-bit type field */ DV_Tree *tree; /* The words in this field of this document */ } Text_Document_Field; /* Info on a specific word in a query (passed from nextword_text to update_sims_word_text) */ typedef struct _Text_Word_Info { Wordcode word; char printword[PRINTWORD_LENGTH]; /* printable string for this word (used for user feedback of a query) */ int weight; /* term frequency */ int length; /* Number unique terms in this document, used for normalization */ } Text_Word_Info; /* This contains all the info the text algorithm might need */ typedef struct _Text_Doc_Info { int number_documents; DB_UINT *document_lengths; /* Sparse array of document length document_length[(DOCNUM * MAX_NUMBER_FIELDS) + FIELDNUM] */ DB_UINT *avg_document_length; /* Sparse array of average document length avg_document_length[FIELDNUM] */ } Text_Doc_Info; #define MAX_DOC_MEMORY 10000000 /* number bytes to use for document vectors before checkpointing to disk */ #define WORDVEC_FNAME "wordvecs" #define WVOFF_FNAME "wvoffs" #define DOCLEN_FNAME "doclens" /* Some other prototypes, from parsers-text.c */ int wordcode_cpy(Wordcode dest, Wordcode source); int wordcode_cmp(Wordcode code1, Wordcode code2); int add_document_to_dvtree(DV_Tree **target, DV_Tree *documentTree); void encode_text_word(unsigned char *s, unsigned int * code, unsigned int field_type); #endif remem-2.12/plugins/plugins.h0000644000076500007650000000704607760625115011571 #ifndef _PLUGINS_H_ #define _PLUGINS_H_ /* plugins.h: This file contains all the externally available function prototypes for plugins. Add yours at the end, with appropriate comments as applicable. */ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "conftemplates.h" #include "hash.h" /************************************************************* TEXT plugins: Text includes various vector-based text retrieval algorithms. **************************************************************/ /* retrievers-text.c prototypes */ void update_sims_word_text_okapi(void *wordvoid, /* The word (type Text_Word_Info) */ Remem_Hash_Table *all_sims, void *fieldvoid, /* The field (type Field) */ Retrieval_Database_Info *rdi); void update_sims_word_text_tfidf(void *wordvoid, /* The word (type Text_Word_Info) */ Remem_Hash_Table *all_sims, void *fieldvoid, /* The field (type Field) */ Retrieval_Database_Info *rdi); /* indexers-text.c prototypes */ void index_store_text (void *parsedata, char *dbdir, int last_write_p); /* parsers-text.c prototypes */ void *parse_text (char *fielddata, void *self, DB_UINT docnum); void *parse_text_nostopstem (char *fielddata, void *self, DB_UINT docnum); GBuffer *deparse_text (void *fielddata, void *self); void *nextword_text (void *fielddata, int reset_p); void free_parsed_text (void *parseddata); /************************************************************* DATE plugins: Date parses groups of dates in the form: ... **************************************************************/ /* indexers-date.c prototypes */ void index_store_date (void *parsedata, char *dbdir, int last_write_p); /* parsers-date.c prototypes */ void *parse_date (char *fielddata, void *self, DB_UINT docnum); GBuffer *deparse_date (void *fielddata, void *self); void *nextword_date (void *fielddata, int reset_p); void free_parsed_date (void *parseddata); #endif remem-2.12/plugins/retrievers-text.c0000644000076500007650000005020307760625115013250 /* retrievers-text.c has all the (hopefully reusable) retrieval functions for text pointed to by entries in the template structure. */ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "parsedoc.h" #include "plugins-text.h" #include "plugins.h" #include "conftemplates.h" #include /* update_sims_word spec: All the update_sims_word routines take: void *word: a single element of the query vector (e.g. a single word) int weight: a weight for this word in the query (e.g. the term frequency) Doc_Sim *all_sims: Array of document similarities. This is what gets updated by the routine, one word at a time. It's a running total of similarities, so this might contain similarities already agregated from previous words. Any algorithm that can run in one pass over each field & word in the query can be used. The docnum is the index into all_sims. Field *field: a pointer to the field being updated. This might be used to get field type, or can be ignored. Retrieval_Database_Info *rdi: info about the index database. Currently this struct contains the total number of documents and the path to the index database directory. */ /* TEXT */ /* File format (comment copied from indexers-text.c): File format: Format for WORDVEC_FILE: doc/weight pairs for the wordcode specified in the wordvec offset file. No wordcode is listed here since it's redundant. Docnums are listed in reverse docnum order, 'cause that's easier to deal with in the indexing. Weight is represented as DB_UINT instead of DB_USHORT because it allows us to more easilly load it all in one read, even when we're reading things in reverse network byte order. I think this will make the read faster, at the cost of wasting a couple bytes per weight. Not sure if this is a valid assumption, and it should probably be tested on various platforms at some point. (DB_UINT) (DB_UINT) (DB_UINT) (DB_UINT) ...(DB_UINT) (DB_UINT) DOCNUM-1, WEIGHT-1, DOCNUM-2, WEIGHT-2, ...DOCNUM-N1, WEIGHT-N1, DOCNUM-2, WEIGHT-1, DOCNUM-2, WEIGHT-2, ...DOCNUM-N2, WEIGHT-N2 ... Format for WVOFF_FILE: wordcode + offset into wordvec file. Offset is # of bytes from start that the first docnum for this wordvec appears. (width*DB_UINT) (DB_UINT) WORDCODE-1, OFFSET-1, WORDCODE-2, OFFSET-2, ... Format for DOCLEN_FILE: docnum followed by fieldtype and document length (number words), in docnum order followed by fieldtype order. Note that there might be missing document numbers or fields, since this is only for docs and fields with text-type. (DB_UINT) (DB_UINT) (DB_UINT) DOCNUM-1, FIELDTYPE-1, LENGTH-OF-DOC-1-FIELD-1, DOCNUM-1, FIELDTYPE-2, LENGTH-OF-DOC-1-FIELD-2, DOCNUM-2, FIELDTYPE-1, LENGTH-OF-DOC-2-FIELD-1, ... */ /* Do a binary search of WVOFF_FILE. Assume word is between wvoff_low and wvoff_high (offsets into the file) if it exists at all. Return either: 0: The word is not in the file. 1: The word has been found, and wvoff_low points to it. wvoff_high points to one line higher. (this may be > end of file, so make sure the caller checks this) This should really be rewritten to be generalized (i.e. include the length of a line and a pointer to the comparison program ala qsort. */ int do_binary_search_wvoff (long *off_low_ptr, long *off_high_ptr, Wordcode word, FILE *WVOFF_FILE, int linelen) { DB_UINT testword[WORD_ENCODE_WIDTH]; long wvoff_point; int numlines; int cmp; int gotItp = -1; /* Are we there yet Pappa Smurf? */ long wvoff_low, wvoff_high; wvoff_low = *off_low_ptr; wvoff_high = *off_high_ptr; while (gotItp == -1) { /* Special case: We're at the last attempt, check boundaries */ if ((wvoff_high - wvoff_low) == linelen) { fseek(WVOFF_FILE, wvoff_low, SEEK_SET); fread_big(testword, sizeof(DB_UINT), WORD_ENCODE_WIDTH, WVOFF_FILE); cmp = wordcode_cmp(testword, word); if (cmp == 0) { wvoff_high = wvoff_low + linelen; gotItp = 1; } else { fseek(WVOFF_FILE, wvoff_high, SEEK_SET); fread_big(testword, sizeof(DB_UINT), WORD_ENCODE_WIDTH, WVOFF_FILE); cmp = wordcode_cmp(testword, word); if (cmp == 0) { wvoff_low = wvoff_high; wvoff_high = wvoff_low + linelen; gotItp = 1; } gotItp = 0; } } else { numlines = (int)((wvoff_high - wvoff_low) / linelen); wvoff_point = (long)(((long)(numlines / 2.0)) * linelen + wvoff_low); fseek(WVOFF_FILE, wvoff_point, SEEK_SET); fread_big(testword, sizeof(DB_UINT), WORD_ENCODE_WIDTH, WVOFF_FILE); cmp = wordcode_cmp(testword, word); if (cmp == 0) { wvoff_high = wvoff_point + linelen; wvoff_low = wvoff_point; gotItp = 1; } else if (cmp < 0) /* We shot low */ wvoff_low = wvoff_point; else /* We shot high */ wvoff_high = wvoff_point; } } *off_low_ptr = wvoff_low; *off_high_ptr = wvoff_high; return(gotItp); } /* Given a word, fill in an array of docnum, weight pairs associated with it, and return the number of docs in the array. The array will be freed by whoever calls us. */ int text_documents_containing_this_word (DB_UINT **docsAndWeights, Wordcode word, FILE *WVOFF_FILE, FILE *WORDVEC_FILE) { static long end_wvoff_file = -1; static long end_wordvec_file = -1; long wvoff_low = 0; long wvoff_high, wvoff_point; int length_line = (WORD_ENCODE_WIDTH * sizeof(DB_UINT)) + sizeof(DB_UINT); int gotItp=0; DB_UINT offset_low, offset_high; if (end_wvoff_file == -1) end_wvoff_file = ftell_end(WVOFF_FILE); if (end_wordvec_file == -1) end_wordvec_file = ftell_end(WORDVEC_FILE); wvoff_high = end_wvoff_file; /* Do a binary search to find this word's offset (An optimization might be to remember our last position, and use that as our next low, since the words are used in order anyway. Try this later maybe, not a big issue right now.) */ gotItp = do_binary_search_wvoff(&wvoff_low, &wvoff_high, word, WVOFF_FILE, length_line); if (!gotItp) { return(0); /* There wasn't a match */ } else { fseek(WVOFF_FILE, wvoff_low + WORD_ENCODE_WIDTH * sizeof(DB_UINT), SEEK_SET); fread_big(&offset_low, sizeof(DB_UINT), 1, WVOFF_FILE); if (wvoff_high > end_wvoff_file) { offset_high = end_wordvec_file; } else { fseek(WVOFF_FILE, wvoff_high + WORD_ENCODE_WIDTH * sizeof(DB_UINT), SEEK_SET); fread_big(&offset_high, sizeof(DB_UINT), 1, WVOFF_FILE); } *docsAndWeights = (DB_UINT *)malloc((offset_high - offset_low)); fseek(WORDVEC_FILE, offset_low, SEEK_SET); fread_big(*docsAndWeights, sizeof(DB_UINT), (size_t)((offset_high - offset_low) / sizeof(DB_UINT)), WORDVEC_FILE); return ((int)((offset_high - offset_low) / (2.0 * sizeof(DB_UINT)))); } } /* Load all the text doc info into memory for quick access later. This might give us a single-time speed hit on the first query due to disk access. */ Text_Doc_Info *load_text_doc_info (char *db_dir, int number_documents_total) { FILE *DOCLEN_FILE = NULL; DB_UINT *buffer, D, F; long filelen; int i, numentries; Text_Doc_Info *tdi; int numEntriesPerField[MAX_NUMBER_FIELDS]; DOCLEN_FILE = open_or_die(db_dir, DOCLEN_FNAME, "r"); filelen = ftell_end(DOCLEN_FILE); numentries = (int)(filelen / (sizeof(DB_INT) * 3)); buffer = (DB_UINT *)malloc(filelen); tdi = (Text_Doc_Info *)malloc(sizeof(Text_Doc_Info)); tdi->document_lengths = (DB_UINT *)calloc(number_documents_total * MAX_NUMBER_FIELDS, sizeof(DB_UINT)); tdi->avg_document_length = (DB_UINT *)calloc(MAX_NUMBER_FIELDS, sizeof(DB_UINT)); fread_big(buffer, sizeof(DB_UINT), (size_t)(numentries * 3), DOCLEN_FILE); tdi->number_documents = number_documents_total; for (i=0; i < MAX_NUMBER_FIELDS; i++) numEntriesPerField[i] = 0; for (i=0; i < numentries; i++) { D = buffer[3 * i]; F = buffer[3 * i + 1]; numEntriesPerField[F]++; tdi->document_lengths[(D * MAX_NUMBER_FIELDS) + F] = buffer[3 * i + 2]; tdi->avg_document_length[F] += buffer[3 * i + 2]; } for (F=0; F < MAX_NUMBER_FIELDS; F++) { if (numEntriesPerField[F] == 0) { tdi->avg_document_length[F] = 0; } else { tdi->avg_document_length[F] = (int)(tdi->avg_document_length[F] / numEntriesPerField[F]); } } free(buffer); return(tdi); } /* Algorithm: Find docs & wieghts associated with this word through WVOFF_FILE and WORDVEC_FILE. The weighting algorithm is essentially the one used in the City University Okapi BSS (Basic Search System). See Robertson, S.E. et al. "Okapi at TREC-3" in Overview of the Third Text REtrieval Conference (TREC-3). Edited by D.K. Harman. Gaithersburg, MD: NIST, 1995 Additional similarity = W * tf (k1 + 1) (k3 + 1) qtf ------------------------------ (K + tf) (k3 + qtf) Where: W = log(N - n + 0.5) - log(n + 0.5) N = total number of documents n = number of documents containing this word K = k1 ((1 - b) + b * dl / avdl) dl = document length (number of words) avdl = average document length (number of words, rounded off) tf = term frequency (weight) of this word in the document qtf = term frequency (weight) of this word in the query k1 = a knob: high k1 means tf is more important ( == 1.2 in City's TREC-6) k3 = a knob: high k3 means qtf is more important (== anywhere from 0 to 1000 in TREC-6) b = a knob: high b means penalize big documents more (== 0.75 in TREC-6) */ /* We've eliminated query-term-frequency as a seperate argument, and instead have nextword return ALL info that might be needed by the particular algorithm (as a void *). E.g. query term weight, number of terms in the query, or whatever. This also lets, e.g., a different algorithm use floats instead of ints for their qtf. */ void update_sims_word_text_okapi(void *wordvoid, /* The word (type Text_Word_Info) */ Remem_Hash_Table *all_sims, void *fieldvoid, /* This field (type Field) */ Retrieval_Database_Info *rdi) { static Text_Doc_Info *tdi = NULL; static FILE *WVOFF_FILE = NULL; static FILE *WORDVEC_FILE = NULL; static float partial_normalization_term = -1.0; /* Cacheable part of the normalization term */ Doc_Sim *sim_element; int numDocsForThisWord, i,j; float additionalSim = 0.0; DB_UINT docnum, weight; DB_UINT *docsAndWeights = NULL; float fudgefactor = 3.0; /* Constant multiplier for the whole thing -- to offset overnormalization. This sucks, but I haven't got a better way yet. */ /* Vars for the Okapi algorithm */ /* These have to be declared volatile because of a linux gcc (& others?) compiler bug that gets tickled if the optimizer tries to inline any of these things (or some of these things -- I didn't figure out which. */ volatile float W, K, k1, k3, b; volatile int N, n, dl, avdl, tf, qtf, query_length; volatile float Wmax, Kmax, normalization_factor; /* For computing normalizaton factor */ volatile int tfmax, qtfmax; /* For computing normalizaton factor */ N = rdi->number_documents_total; k1 = 1.2; k3 = 100.0; /* Set high, since we expect long queries and we want to exploit that fact */ b = 0.75; /* partial_normalization_term is only computed once, and doesn't change for a particular index database. We incorporate the query length in later. This is added to the Okapi algorithm to make sure the similarity doesn't go over 1.0 for a given field. */ if (partial_normalization_term < 0.0) { Wmax = (float)(log(N - 0.5) - log(1.5)); Kmax = (float)(k1 * (1.0 - b)); tfmax = 1; /* Assume this is a good max -- we pin it if we go over 1.0 similarity anyway */ qtfmax = 1; /* Assume this is a good max -- we pin it if we go over 1.0 similarity anyway */ partial_normalization_term = (float)((Wmax * tfmax * (k1 + 1) * (k3 + 1) * qtfmax) / (float)((Kmax + tfmax) * (k3 + qtfmax) * fudgefactor)); } if (tdi == NULL) tdi = load_text_doc_info(rdi->db_dir, rdi->number_documents_total); if (WVOFF_FILE == NULL) WVOFF_FILE = open_or_die(rdi->db_dir, WVOFF_FNAME, "r"); if (WORDVEC_FILE == NULL) WORDVEC_FILE = open_or_die(rdi->db_dir, WORDVEC_FNAME, "r"); /* For this word, find all the docs that contain it */ numDocsForThisWord = text_documents_containing_this_word(&docsAndWeights, ((Text_Word_Info *)wordvoid)->word, WVOFF_FILE, WORDVEC_FILE); if (numDocsForThisWord != 0) { /* Only do something if there were any hits */ n = numDocsForThisWord; avdl = tdi->avg_document_length[((Field *)fieldvoid)->typenum]; if (avdl < 1) avdl = 1; /* Sanity check */ for (i = 0; i < numDocsForThisWord; i++) { docnum = docsAndWeights[i * 2]; qtf = ((Text_Word_Info *)wordvoid)->weight; /* query_length = number of unique non-stopwords total */ query_length = ((Text_Word_Info *)wordvoid)->length; tf = docsAndWeights[i * 2 + 1]; dl = tdi->document_lengths[(docnum * MAX_NUMBER_FIELDS) + ((Field *)fieldvoid)->typenum]; K = (float)(k1 * ((1.0 - b) + b * (double)dl / (double)avdl)); W = (float)(log(N - n + 0.5) - log(n + 0.5)); /* this * query_length is serious black magic. There's no real reason to think that this will give a normalized value across several queries, which is what we want with thresholds. What we actually want is a normalized query that corelates well with how useful people find a suggestion. It makes sense (and preliminary experiments show) that longer queries will give better suggestions because they have more material / words. However, without normalization longer queries have a *much* higher return. We need to find a happy medium. */ normalization_factor = partial_normalization_term * (float)query_length; additionalSim = (float)((W * tf * (k1 + 1) * (k3 + 1) * qtf) / (float)((K + tf) * (k3 + qtf))); additionalSim = additionalSim / normalization_factor; /* Get doc's sim if there, add to hash if not */ sim_element = (Doc_Sim *)rememHashGet(docnum, all_sims); if (sim_element == NULL) { sim_element = (Doc_Sim *)calloc(1,sizeof(Doc_Sim)); sim_element->docnum = docnum; rememHashPut(docnum, sim_element, all_sims); } add_additional_to_doc_sim (sim_element, additionalSim, ((Text_Word_Info *)wordvoid)->printword); } } free(docsAndWeights); } /* Algorithm: Find docs & wieghts associated with this word through WVOFF_FILE and WORDVEC_FILE. There are several TFiDF algorithms, so this has a few choices. The three main components are: ntf: A normalized term frequency for the word within a particular document IDF: An inverse document frequency weighting, which favors rare words the similarity metric that combines them. There are several choices for each, several listed in: Harman, Donna. "Ranking Algorithms" in Frakes, WB and R Baewa-Yates (eds), "Information Retrieval: Data Structures and Algorithms." Prentice Hall, Upper Saddle River, NJ 92, pp. 373-376. Currently I'm using: IDF = log((N - n) / n); (Croft and Harper, 1979) ntf = log(tf + 1) / log(doclength); (Harman 1986) similarity = sum-over-query (ntf * IDF) (Harman 1986) */ void update_sims_word_text_tfidf(void *wordvoid, /* The word (type Text_Word_Info) */ Remem_Hash_Table *all_sims, void *fieldvoid, /* This field (type Field) */ Retrieval_Database_Info *rdi) { static Text_Doc_Info *tdi = NULL; static FILE *WVOFF_FILE = NULL; static FILE *WORDVEC_FILE = NULL; static float partial_normalization_term = -1.0; /* Cacheable part of the normalization term */ const int fudge_factor = 12; /* fudge factor to divide by so value is between 0 and 1. This is disgusting. */ Doc_Sim *sim_element; int numDocsForThisWord, i; float additionalSim = 0.0; DB_UINT docnum, weight; DB_UINT *docsAndWeights = NULL; /* Vars for TFiDF */ /* These have to be declared volatile because of a linux gcc (& others?) compiler bug that gets tickled if the optimizer tries to inline any of these things (or some of these things -- I didn't figure out which. */ volatile float IDF, ntf; volatile int N, n, dl, tf; N = rdi->number_documents_total; if (tdi == NULL) tdi = load_text_doc_info(rdi->db_dir, rdi->number_documents_total); if (WVOFF_FILE == NULL) WVOFF_FILE = open_or_die(rdi->db_dir, WVOFF_FNAME, "r"); if (WORDVEC_FILE == NULL) WORDVEC_FILE = open_or_die(rdi->db_dir, WORDVEC_FNAME, "r"); /* For this word, find all the docs that contain it */ numDocsForThisWord = text_documents_containing_this_word(&docsAndWeights, ((Text_Word_Info *)wordvoid)->word, WVOFF_FILE, WORDVEC_FILE); if (numDocsForThisWord != 0) { /* Only do something if there were any hits */ n = numDocsForThisWord; if (n < N) { /* Sanity check */ IDF = log((N - n) / n); for (i = 0; i < numDocsForThisWord; i++) { docnum = docsAndWeights[i * 2]; tf = docsAndWeights[i * 2 + 1]; dl = tdi->document_lengths[(docnum * MAX_NUMBER_FIELDS) + ((Field *)fieldvoid)->typenum]; if (dl > 2) /* More sanity check */ ntf = log(tf + 1) / log(dl); else ntf = tf; additionalSim = (float)(ntf * IDF / fudge_factor); /* Get doc's sim if there, add to hash if not */ sim_element = (Doc_Sim *)rememHashGet(docnum, all_sims); if (sim_element == NULL) { sim_element = (Doc_Sim *)calloc(1,sizeof(Doc_Sim)); sim_element->docnum = docnum; rememHashPut(docnum, sim_element, all_sims); } add_additional_to_doc_sim (sim_element, additionalSim, ((Text_Word_Info *)wordvoid)->printword); } } } free(docsAndWeights); } remem-2.12/plugins/stem.c0000644000076500007650000004411407760625115011050 /******************************* stem.c *********************************** Purpose: Implementation of the Porter stemming algorithm documented in: Porter, M.F., "An Algorithm For Suffix Stripping," Program 14 (3), July 1980, pp. 130-137. Provenance: Written by B. Frakes and C. Cox, 1986. Changed by C. Fox, 1990. - made measure function a DFA - restructured structs - renamed functions and variables - restricted function and variable scopes Changed by C. Fox, July, 1991. - added ANSI C declarations - branch tested to 90% coverage Notes: This code will make little sense without the the Porter article. The stemming function converts its input to lower case. **/ /************************ Standard Include Files *************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /*****************************************************************************/ /***************** Private Defines and Data Structures *******************/ #define FALSE 0 #define TRUE 1 #define EOS '\0' #define IsVowel(c) ('a'==(c)||'e'==(c)||'i'==(c)||'o'==(c)||'u'==(c)) typedef struct { int id; /* returned if rule fired */ char *old_end; /* suffix replaced */ char *new_end; /* suffix replacement */ int old_offset; /* from end of word to start of suffix */ int new_offset; /* from beginning to end of new suffix */ int min_root_size; /* min root word size for replacement */ int (*condition)(); /* the replacement test function */ } RuleList; static char LAMBDA[1] = ""; /* the constant empty string */ static char *end; /* pointer to the end of the word */ /*****************************************************************************/ /******************** Private Function Declarations **********************/ #ifdef __STDC__ static int WordSize( char *word ); static int ContainsVowel( char *word ); static int EndsWithCVC( char *word ); static int AddAnE( char *word ); static int RemoveAnE( char *word ); static int ReplaceEnd( char *word, RuleList *rule ); #else static int WordSize( /* word */ ); static int ContainsVowel( /* word */ ); static int EndsWithCVC( /* word */ ); static int AddAnE( /* word */ ); static int RemoveAnE( /* word */ ); static int ReplaceEnd( /* word, rule */ ); #endif /******************************************************************************/ /***************** Initialized Private Data Structures ********************/ static RuleList step1a_rules[] = { {101, "sses", "ss", 3, 1, -1, NULL}, {102, "ies", "i", 2, 0, -1, NULL}, {103, "ss", "ss", 1, 1, -1, NULL}, {104, "s", LAMBDA, 0, -1, -1, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; static RuleList step1b_rules[] = { {105, "eed", "ee", 2, 1, 0, NULL}, {106, "ed", LAMBDA, 1, -1, -1, ContainsVowel}, {107, "ing", LAMBDA, 2, -1, -1, ContainsVowel}, {000, NULL, NULL, 0, 0, 0, NULL} }; static RuleList step1b1_rules[] = { {108, "at", "ate", 1, 2, -1, NULL}, {109, "bl", "ble", 1, 2, -1, NULL}, {110, "iz", "ize", 1, 2, -1, NULL}, {111, "bb", "b", 1, 0, -1, NULL}, {112, "dd", "d", 1, 0, -1, NULL}, {113, "ff", "f", 1, 0, -1, NULL}, {114, "gg", "g", 1, 0, -1, NULL}, {115, "mm", "m", 1, 0, -1, NULL}, {116, "nn", "n", 1, 0, -1, NULL}, {117, "pp", "p", 1, 0, -1, NULL}, {118, "rr", "r", 1, 0, -1, NULL}, {119, "tt", "t", 1, 0, -1, NULL}, {120, "ww", "w", 1, 0, -1, NULL}, {121, "xx", "x", 1, 0, -1, NULL}, {122, LAMBDA, "e", -1, 0, -1, AddAnE}, {000, NULL, NULL, 0, 0, 0, NULL} }; static RuleList step1c_rules[] = { {123, "y", "i", 0, 0, -1, ContainsVowel}, {000, NULL, NULL, 0, 0, 0, NULL} }; static RuleList step2_rules[] = { {203, "ational", "ate", 6, 2, 0, NULL}, {204, "tional", "tion", 5, 3, 0, NULL}, {205, "enci", "ence", 3, 3, 0, NULL}, {206, "anci", "ance", 3, 3, 0, NULL}, {207, "izer", "ize", 3, 2, 0, NULL}, {208, "abli", "able", 3, 3, 0, NULL}, {209, "alli", "al", 3, 1, 0, NULL}, {210, "entli", "ent", 4, 2, 0, NULL}, {211, "eli", "e", 2, 0, 0, NULL}, {213, "ousli", "ous", 4, 2, 0, NULL}, {214, "ization", "ize", 6, 2, 0, NULL}, {215, "ation", "ate", 4, 2, 0, NULL}, {216, "ator", "ate", 3, 2, 0, NULL}, {217, "alism", "al", 4, 1, 0, NULL}, {218, "iveness", "ive", 6, 2, 0, NULL}, {219, "fulnes", "ful", 5, 2, 0, NULL}, {220, "ousness", "ous", 6, 2, 0, NULL}, {221, "aliti", "al", 4, 1, 0, NULL}, {222, "iviti", "ive", 4, 2, 0, NULL}, {223, "biliti", "ble", 5, 2, 0, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; static RuleList step3_rules[] = { {301, "icate", "ic", 4, 1, 0, NULL}, {302, "ative", LAMBDA, 4, -1, 0, NULL}, {303, "alize", "al", 4, 1, 0, NULL}, {304, "iciti", "ic", 4, 1, 0, NULL}, {305, "ical", "ic", 3, 1, 0, NULL}, {308, "ful", LAMBDA, 2, -1, 0, NULL}, {309, "ness", LAMBDA, 3, -1, 0, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; static RuleList step4_rules[] = { {401, "al", LAMBDA, 1, -1, 1, NULL}, {402, "ance", LAMBDA, 3, -1, 1, NULL}, {403, "ence", LAMBDA, 3, -1, 1, NULL}, {405, "er", LAMBDA, 1, -1, 1, NULL}, {406, "ic", LAMBDA, 1, -1, 1, NULL}, {407, "able", LAMBDA, 3, -1, 1, NULL}, {408, "ible", LAMBDA, 3, -1, 1, NULL}, {409, "ant", LAMBDA, 2, -1, 1, NULL}, {410, "ement", LAMBDA, 4, -1, 1, NULL}, {411, "ment", LAMBDA, 3, -1, 1, NULL}, {412, "ent", LAMBDA, 2, -1, 1, NULL}, {423, "sion", "s", 3, 0, 1, NULL}, {424, "tion", "t", 3, 0, 1, NULL}, {415, "ou", LAMBDA, 1, -1, 1, NULL}, {416, "ism", LAMBDA, 2, -1, 1, NULL}, {417, "ate", LAMBDA, 2, -1, 1, NULL}, {418, "iti", LAMBDA, 2, -1, 1, NULL}, {419, "ous", LAMBDA, 2, -1, 1, NULL}, {420, "ive", LAMBDA, 2, -1, 1, NULL}, {421, "ize", LAMBDA, 2, -1, 1, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; static RuleList step5a_rules[] = { {501, "e", LAMBDA, 0, -1, 1, NULL}, {502, "e", LAMBDA, 0, -1, -1, RemoveAnE}, {000, NULL, NULL, 0, 0, 0, NULL} }; static RuleList step5b_rules[] = { {503, "ll", "l", 1, 0, 1, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; /*****************************************************************************/ /******************** Private Function Declarations **********************/ /*FN*************************************************************************** WordSize( word ) Returns: int -- a weird count of word size in adjusted syllables Purpose: Count syllables in a special way: count the number vowel-consonant pairs in a word, disregarding initial consonants and final vowels. The letter "y" counts as a consonant at the beginning of a word and when it has a vowel in front of it; otherwise (when it follows a consonant) it is treated as a vowel. For example, the WordSize of "cat" is 1, of "any" is 1, of "amount" is 2, of "anything" is 3. Plan: Run a DFA to compute the word size Notes: The easiest and fastest way to compute this funny measure is with a finite state machine. The initial state 0 checks the first letter. If it is a vowel, then the machine changes to state 1, which is the "last letter was a vowel" state. If the first letter is a consonant or y, then it changes to state 2, the "last letter was a consonant state". In state 1, a y is treated as a consonant (since it follows a vowel), but in state 2, y is treated as a vowel (since it follows a consonant. The result counter is incremented on the transition from state 1 to state 2, since this transition only occurs after a vowel-consonant pair, which is what we are counting. **/ static int WordSize( word ) char *word; /* in: word having its WordSize taken */ { register int result; /* WordSize of the word */ register int state; /* current state in machine */ result = 0; state = 0; /* Run a DFA to compute the word size */ while ( EOS != *word ) { switch ( state ) { case 0: state = (IsVowel(*word)) ? 1 : 2; break; case 1: state = (IsVowel(*word)) ? 1 : 2; if ( 2 == state ) result++; break; case 2: state = (IsVowel(*word) || ('y' == *word)) ? 1 : 2; break; } word++; } return( result ); } /* WordSize */ /*FN************************************************************************** ContainsVowel( word ) Returns: int -- TRUE (1) if the word parameter contains a vowel, FALSE (0) otherwise. Purpose: Some of the rewrite rules apply only to a root containing a vowel, where a vowel is one of "aeiou" or y with a consonant in front of it. Plan: Obviously, under the definition of a vowel, a word contains a vowel iff either its first letter is one of "aeiou", or any of its other letters are "aeiouy". The plan is to test this condition. Notes: None **/ static int ContainsVowel( word ) char *word; /* in: buffer with word checked */ { if ( EOS == *word ) return( FALSE ); else return( IsVowel(*word) || (NULL != strpbrk(word+1,"aeiouy")) ); } /* ContainsVowel */ /*FN************************************************************************** EndsWithCVC( word ) Returns: int -- TRUE (1) if the current word ends with a consonant-vowel-consonant combination, and the second consonant is not w, x, or y, FALSE (0) otherwise. Purpose: Some of the rewrite rules apply only to a root with this characteristic. Plan: Look at the last three characters. Notes: None **/ static int EndsWithCVC( word ) char *word; /* in: buffer with the word checked */ { int length; /* for finding the last three characters */ if ( (length = strlen(word)) <= 2 ) return( FALSE ); else { end = word + length - 1; return( (NULL == strchr("aeiouwxy",*end--)) /* consonant */ && (NULL != strchr("aeiouy", *end--)) /* vowel */ && (NULL == strchr("aeiou", *end )) ); /* consonant */ } } /* EndsWithCVC */ /*FN************************************************************************** AddAnE( word ) Returns: int -- TRUE (1) if the current word meets special conditions for adding an e. Purpose: Rule 122 applies only to a root with this characteristic. Plan: Check for size of 1 and a consonant-vowel-consonant ending. Notes: None **/ static int AddAnE( word ) char *word; { return( (1 == WordSize(word)) && EndsWithCVC(word) ); } /* AddAnE */ /*FN************************************************************************** RemoveAnE( word ) Returns: int -- TRUE (1) if the current word meets special conditions for removing an e. Purpose: Rule 502 applies only to a root with this characteristic. Plan: Check for size of 1 and no consonant-vowel-consonant ending. Notes: None **/ static int RemoveAnE( word ) char *word; { return( (1 == WordSize(word)) && !EndsWithCVC(word) ); } /* RemoveAnE */ /*FN************************************************************************** ReplaceEnd( word, rule ) Returns: int -- the id for the rule fired, 0 is none is fired Purpose: Apply a set of rules to replace the suffix of a word Plan: Loop through the rule set until a match meeting all conditions is found. If a rule fires, return its id, otherwise return 0. Connditions on the length of the root are checked as part of this function's processing because this check is so often made. Notes: This is the main routine driving the stemmer. It goes through a set of suffix replacement rules looking for a match on the current suffix. When it finds one, if the root of the word is long enough, and it meets whatever other conditions are required, then the suffix is replaced, and the function returns. **/ static int ReplaceEnd( word, rule ) char *word; /* in/out: buffer with the stemmed word */ RuleList *rule; /* in: data structure with replacement rules */ { register char *ending; /* set to start of possible stemmed suffix */ char tmp_ch; /* save replaced character when testing */ while ( 0 != rule->id ) { ending = end - rule->old_offset; if ( word <= ending ) if ( 0 == strcmp(ending,rule->old_end) ) { tmp_ch = *ending; *ending = EOS; if ( rule->min_root_size < WordSize(word) ) if ( !rule->condition || (*rule->condition)(word) ) { (void)strcat( word, rule->new_end ); end = ending + rule->new_offset; break; } *ending = tmp_ch; } rule++; } return( rule->id ); } /* ReplaceEnd */ /*****************************************************************************/ /********************* Public Function Declarations **********************/ /*FN*************************************************************************** Stem( word ) Returns: int -- FALSE (0) if the word contains non-alphabetic characters and hence is not stemmed, TRUE (1) otherwise Purpose: Stem a word Plan: Part 1: Check to ensure the word is all alphabetic Part 2: Run through the Porter algorithm Part 3: Return an indication of successful stemming Notes: This function implements the Porter stemming algorithm, with a few additions here and there. See: Porter, M.F., "An Algorithm For Suffix Stripping," Program 14 (3), July 1980, pp. 130-137. Porter's algorithm is an ad hoc set of rewrite rules with various conditions on rule firing. The terminology of "step 1a" and so on, is taken directly from Porter's article, which unfortunately gives almost no justification for the various steps. Thus this function more or less faithfully refects the opaque presentation in the article. Changes from the article amount to a few additions to the rewrite rules; these are marked in the RuleList data structures with comments. **/ int Stem( word ) char *word; /* in/out: the word stemmed */ { int rule; /* which rule is fired in replacing an end */ /* Part 1: Check to ensure the word is all alphabetic */ for ( end = word; *end != EOS; end++ ) if ( !isalpha(*end) ) return( FALSE ); else *end = tolower( *end ); end--; /* Part 2: Run through the Porter algorithm */ (void)ReplaceEnd( word, step1a_rules ); rule = ReplaceEnd( word, step1b_rules ); if ( (106 == rule) || (107 == rule) ) (void)ReplaceEnd( word, step1b1_rules ); (void)ReplaceEnd( word, step1c_rules ); /* Don't do steps 2-5. Walker and Jones' 1987 study showed that weak stemming (step 1 only) tended to increase recall and doesn't significantly decrease precision, but strong stemming (all the rest of the steps) does hurt precision. Since we want good precision we don't want strong stemming. See William Frakes & Ricardo Baeza-Yates (eds) "Information Retrieval: Data Structures & Algorithms" 1992, p. 147 -- rhodes, 4/16/00 /* /* (void)ReplaceEnd( word, step2_rules ); (void)ReplaceEnd( word, step3_rules ); (void)ReplaceEnd( word, step4_rules ); (void)ReplaceEnd( word, step5a_rules ); (void)ReplaceEnd( word, step5b_rules ); */ /* Part 3: Return an indication of successful stemming */ return( TRUE ); } /* Stem */ remem-2.12/plugins/stem.h0000644000076500007650000000116507760625115011054 /******************************* stem.h *********************************** Purpose: Header file for an implementation of the Porter stemming algorithm. Notes: This module implemnts a fast stemming function whose results are about as good as any other. **/ #ifndef STEM_H #define STEM_H /******************************************************************************/ /**************************** Public Routines *****************************/ #ifdef __STDC__ extern int Stem( char *word ); /* returns 1 on success, 0 otherwise */ #else extern int Stem(); #endif #endif remem-2.12/plugins/stops.h0000644000076500007650000001356607760625115011264 static int num_words_local = 528; static char *comm_local[] = { "a", "able", "about", "above", "according", "accordingly", "across", "actually", "after", "afterwards", "again", "against", "all", "allow", "allows", "almost", "alone", "along", "already", "also", "although", "always", "am", "among", "amongst", "an", "and", "another", "any", "anybody", "anyhow", "anyone", "anything", "anyway", "anyways", "anywhere", "apart", "appear", "appreciate", "appropriate", "are", "around", "as", "aside", "ask", "asking", "associated", "at", "available", "away", "awfully", "b", "be", "became", "because", "become", "becomes", "becoming", "been", "before", "beforehand", "behind", "being", "believe", "below", "beside", "besides", "best", "better", "between", "beyond", "both", "brief", "but", "by", "c", "came", "can", "cannot", "cant", "cause", "causes", "certain", "certainly", "changes", "clearly", "co", "com", "come", "comes", "concerning", "consequently", "consider", "considering", "contain", "containing", "contains", "corresponding", "could", "course", "currently", "d", "definitely", "described", "despite", "did", "didn", "different", "do", "does", "doing", "don", "done", "down", "downwards", "during", "e", "each", "edu", "eg", "eight", "either", "else", "elsewhere", "enough", "entirely", "especially", "et", "etc", "even", "ever", "every", "everybody", "everyone", "everything", "everywhere", "ex", "exactly", "example", "except", "f", "far", "few", "fifth", "first", "five", "followed", "following", "follows", "for", "former", "formerly", "forth", "four", "from", "further", "furthermore", "g", "get", "gets", "getting", "given", "gives", "go", "goes", "going", "gone", "got", "gotten", "greetings", "h", "had", "happens", "hardly", "has", "have", "having", "he", "hello", "help", "hence", "her", "here", "hereafter", "hereby", "herein", "hereupon", "hers", "herself", "hi", "him", "himself", "his", "hither", "hopefully", "how", "howbeit", "however", "i", "ie", "if", "ignored", "immediate", "in", "inasmuch", "inc", "indeed", "indicate", "indicated", "indicates", "inner", "insofar", "instead", "into", "inward", "is", "it", "its", "itself", "j", "just", "k", "keep", "keeps", "kept", "know", "knows", "known", "l", "ll", "last", "lately", "later", "latter", "latterly", "least", "less", "lest", "let", "like", "liked", "likely", "little", "look", "looking", "looks", "ltd", "m", "mainly", "many", "may", "maybe", "me", "mean", "meanwhile", "merely", "might", "more", "moreover", "most", "mostly", "much", "must", "my", "myself", "n", "name", "namely", "nd", "near", "nearly", "necessary", "need", "needs", "neither", "never", "nevertheless", "new", "next", "nine", "no", "nobody", "non", "none", "noone", "nor", "normally", "not", "nothing", "novel", "now", "nowhere", "o", "obviously", "of", "off", "often", "oh", "ok", "okay", "old", "on", "once", "one", "ones", "only", "onto", "or", "other", "others", "otherwise", "ought", "our", "ours", "ourselves", "out", "outside", "over", "overall", "own", "p", "particular", "particularly", "per", "perhaps", "placed", "please", "plus", "possible", "presumably", "probably", "provides", "q", "que", "quite", "qv", "r", "rather", "rd", "re", "really", "reasonably", "regarding", "regardless", "regards", "relatively", "respectively", "right", "s", "said", "same", "saw", "say", "saying", "says", "second", "secondly", "see", "seeing", "seem", "seemed", "seeming", "seems", "seen", "self", "selves", "sensible", "sent", "serious", "seriously", "seven", "several", "shall", "she", "should", "since", "six", "so", "some", "somebody", "somehow", "someone", "something", "sometime", "sometimes", "somewhat", "somewhere", "soon", "sorry", "specified", "specify", "specifying", "still", "sub", "such", "sup", "sure", "t", "take", "taken", "tell", "tends", "th", "than", "thank", "thanks", "thanx", "that", "thats", "the", "their", "theirs", "them", "themselves", "then", "thence", "there", "thereafter", "thereby", "therefore", "therein", "theres", "thereupon", "these", "they", "think", "third", "this", "thorough", "thoroughly", "those", "though", "three", "through", "throughout", "thru", "thus", "to", "together", "too", "took", "toward", "towards", "tried", "tries", "truly", "try", "trying", "twice", "two", "u", "un", "under", "unfortunately", "unless", "unlikely", "until", "unto", "up", "upon", "us", "use", "used", "useful", "uses", "using", "usually", "uucp", "v", "value", "various", "ve", "very", "via", "viz", "vs", "w", "want", "wants", "was", "way", "we", "welcome", "well", "went", "were", "what", "whatever", "when", "whence", "whenever", "where", "whereafter", "whereas", "whereby", "wherein", "whereupon", "wherever", "whether", "which", "while", "whither", "who", "whoever", "whole", "whom", "whose", "why", "will", "willing", "wish", "with", "within", "without", "wonder", "would", "would", "x", "y", "yes", "yet", "you", "your", "yours", "yourself", "yourselves", "z", "zero" }; remem-2.12/README0000644000076500007650000004303007760625115007127 Remembrance Agent, version 2.12 Copyright (C) 1996-2003 Massachusetts Institute of Technology and Bradley Rhodes Released under the GNU General Public License (GPL) ---------------- Thank you for using the RA. If you have questions or comments, please send mail to ra-bugs@remem.org (or ra-maintainer@remem.org). If you would like to be added to an announcement mailing list for new versions (VERY low traffic) send mail to ra-announce-request@remem.org. Contents -------- 0. Introduction 1. Building the Remembrance Agent 2. Creating a database from a collection of text 3. Using the Remembrance Agent in Emacs 4. Commands (using the RA) 6. Savant's document template system and other customizations 7. What's New? 8. License information 0. Introduction ---------------- The Remembrance Agent is one of the projects being developed by the MIT Media Lab's software agents group. Given a collection of the user's accumulated email, usenet news articles, papers, saved HTML files and other text notes, it attempts to find those documents which are most relevant to the user's current context. That is, it searches this collection of text for the documents which bear the highest word-for-word similarity to the text the user is currently editing, in the hope that they will also bear high conceptual similarity and thus be useful to the user's current work. These suggestions are continuously displayed in a small buffer at the bottom of the user's emacs buffer. If a suggestion looks useful, the full text can be retrieved with a single command. The Remembrance Agent works in two stages. First, the user's collection of text documents is indexed into a database saved in a vector format. After the database is created, the other stage of the Remembrance Agent is run from emacs, where it periodically takes a sample of text from the working buffer and finds those documents from the collection that are most similar. It summarizes the top documents in a small emacs window and allows you to retrieve the entire text of any one with a keystroke. The Remembrance Agent is the PhD work of Bradley Rhodes, and includes long hours of coding by an great team of undergraduates. They can be reached with questions and comments about the Remembrance Agent via email at ra-bugs@remem.org, and new versions of the software can be found at http://www.remem.org/ Thanks for using the Remembrance Agent, and I hope you find it useful. 1. Building the Remembrance Agent ---------------------------------- The RA back-end has two executables, "ra-index" and "ra-retrieve", which together make the system called Savant. Since you are reading this file, I assume you've already uncompressed and untarred the RA distribution. To build Savant, cd to the RA directory type: ./configure; make This should analyze your system, and then make appropriate binaries of ra-index and ra-retrieve. If you have trouble, make sure you are using the GNU version of make ("make --version" should produce something sensible). It might also be called "gmake" on your system. Once the compilation is finished, the code you will need is: main/ra-index: Binary file for indexing documents main/ra-retrieve: Binary file for retrieving documents other/remem.el: Emacs interface to Savant Move ra-index and ra-retrieve to wherever you normally keep executables. Copy remem.el to wherever you keep emacs-lisp files. If you don't have a place for elisp files, you can just create a directory called "elisp" off of your main directory and put them there. You can then delete the source files if you like. 2. Creating a database from a collection of text ------------------------------------------------- Savant has two executables, one which indexes documents into databases, and one which performs interactive retrievals from these databases. To index, you must have a set of source text-files, and a directory Savant can put database files into. Usage: ra-index [-v] [-d] [-s] [] ... [-e [] ...] The arguments may be files or directories. If a directory is in the list, Savant will use all its contents, recursing into all subdirectories. Non-text files and backup files (those appended with ~ or prepended with #) are ignored. It also ignores dot-files (those starting with .) and unless you specify the "-s" flag it will also ignore symbolic links. Any files or directories specified after the optional -e flag will be excluded. Savant will use any files it finds to create a database in the specified base directory, which must already exist. The optional -v argument (verbose) will direct Savant to keep you updated on its progress. So for example, ra-index -v ~/RA-indexes/mail ~/RMAIL ~/Rmail-files -e ~/Rmail-files/Old-files will build a database in the ~/RA-indexes/mail directory, made up of emails from my RMAIL file plus all files and subdirectories of ~/Rmail-files, excluding files and directories in ~/Rmail-files/Old-files. The optional -d flag turns on debugging information. ***IMPORTANT***: Savant can build databases in any directory you like, but the emacs interface for the Remembrance Agent expects a particular structure. For each database you want to make, you should create a directory, and all these directories should live in the same parent directory. For example, for my own use I have a directory ~/RA-indexes/, and within that are the directories ~/RA-indexes/mail/, ~/RA-indexes/papers/, etc. which actually contain the database files. To see how Savant interacts with emacs while the remembrance agent is running, try running ra-retrieve with the command 'ra-retrieve -v ' after creating a database using index. You can use ra-retrieve as a simple search engine, but usually ra-retrieve is only called by the emacs front-end. 3. Using the Remembrance Agent in Emacs ---------------------------------------- You can load the Remembrance Agent automatically every time you run emacs by adding this line to your .emacs file in your homedir: (load "remem.el") This assumes that you put remem.el into a directory that is in your emacs load-path. To set that loadpath to include the directory ~/elisp/, you can use the line: (setq load-path (append (list (expand-file-name "~/elisp")) load-path)) Before the Remembrance Agent can be used, several variables must be configured. These are listed at the top of remem.el, and are documented there as well. You will either want to set these in your .emacs file or create a file called "remem-custom.el" and load that file after loading remem.el. You probably don't want to set them in remem.el, unless you are the only person using this copy of the remembrance agent. (setq remem-prog-dir ) (setq remem-database-dir ) (setq remem-scopes-list ) should be the full name of the directory where you put the ra-retrieve executable, enclosed in double quotes. This defaults to "/usr/local/bin". On some systems, you need to make sure not to end the directory with a slash ("/"). should be the full name of the directory which holds your database directories, enclosed in double quotes. Note that this is the name of a directory containing directories, not the directory containing the database files themselves. This defaults to "~/RA-indexes". On some systems, you need to make sure not to end the directory with a slash ("/"). remem-scopes-list: you can display several different "scopes," all with separate processes performing retrievals simultaneously. Scopes can have different databases, update frequencies, and ranges of words it uses for a "query." Each scope looks like this: (DIRN NUM-LINES UPDATE-TIME QUERY-RANGE) DIRN is the subdirectory of remem-database-dir with the desired database (This is the name of a sub-directory in remem-database-dir) NUM-LINES is the number of lines that you want the scope to show (initially) UPDATE-TIME is the time between scope updates (in seconds) QUERY-RANGE number of words around your cursor that you want the scope to query on For example, my own customization shows this: (setq remem-scopes-list '(("my-email" 6 5 500) ("my-notes" 2 10 500))) This sets up two scopes. The first displays six suggestions from the index directory "/home/rhodes/RA-indexes/my-email/", updated every five seconds, based on the last 500 words around my cursor (where a word is considered 5 characters, so that's really just the last 500 X 5 = 2500 characters). The second scope displays two lines from "/home/rhodes/RA-indexes/my-email/", updated every ten seconds, also based on 2500 characters. The rest of the customizations set colors, logging, display of suggestions, display thresholds and the prefix for RA commands. The default colors are set for a light background, but shift if you set hilit-background-mode to 'dark. They're all documented in remem.el -- play around with them. Okay! After these customizations are made, you can start the Remembrance Agent by typing C-c r t. It will create its window and after a moment or two begin to display suggestions like: 1 + rhodes RA presence paper stuff 04/14/97 papers suggestions, ra 2 tara Questions digest for IA class 09/15/97 agents-class remembrance, agent 3 ++ rhodes RA Projects Internal 03/09/99 ra-bugs-archive window, display This can be summarized as The rating is a measure from zero to two plus signs (0 to 1 if you set remem-print-exact-relevance-p to t) and indicate how relevant the document is to a sample of your current buffer. If you have remem-print-even-bad-relevance-p set to t then suggestions below the minimum threshold will print with a "-" sign, otherwise they'll show up as "No Sugestion." To see a suggested document, type C-c r . The keywords are the top five keywords that contributed to making this suggestion, in order. 4. Commands (using the RA) --------------------------- C-c r t (Control-c r t): Toggle Remem Toggle the remembrance agent on and off. You can also do this by evaluating the function (remem-toggle). C-c r v (Control-c r v): View Updates the suggestion list by running queries in all scopes now. Bypasses the timer. C-c r # (Control-c r ): Show Suggestion Bring up the full text of a suggested document. If you set remem-load-original-suggestion to t (the default), then the full file is loaded. Otherwise a copy is displayed. If your files are big and contain lots of documents (e.g. large mail archives), or if you don't want the buffers lying around then you might want to set this to nil. If you set remem-non-r-number-keys to t, the keys C-c # will also work, thus saving you a keystroke. C-c r r # (Control-c r r ): Rate Rate the last suggestion. This allows you to rate the last suggestion followed with a number from 1 (bad suggestion) to 5 (great suggestion). The rating information is currently used by me to evaluate the software and figure out how to improve it, though eventually it may be used to give feedback for a machine learning system that will improve future suggestions. C-c r f (Control-c r f): Field Search Perform a search on a particular field (Body, Location, Date, Subject, or Person). C-c r q (Control-c r q): Query Bring up a query buffer to do a manual search. This allows you to fill in several fields. When the data is entered, hit C-c r v to view the results. C-c r d (Control-c r d): Database change Prompt for a new database, from the indexes in remem-database-dir. If more than one scope is active, it will prompt for which scope to replace as well. Remem will restart with the new database(s) at the original size. Left mouse-click on lineno: Show Suggestion Clicking the middle mouse-button on a line number is the same as doing C-c r # for that number. Left mouse-click on a field: Search field Clicking the middle mouse button on a field does a search on that field. For example, if I middle-click on the subject field "RA presence paper stuff", a special query will be launched just on those words in other subject fields. This is field dependent -- if I middle click on the username "tara", it does a query for other documents associated with her username. Clicking on a date will work as soon as we start indexing dates, but it doesn't yet. Middle or Right mouse-click: Keywords Clicking with the middle or right mouse button pops up keywords associated with this particular suggestion. These are the top five words that led to the document being suggested, in order that they contributed. These words will also be on your display line if you set remem-terminal-mode to t. Resize window: Resize If you resize the *remem-display* window it will fill to the new size on the next update. If you resize it too small, it will stop the RA (same as performing a remem-toggle). 5. Logging ----------- Because this is a research project, the emacs front-end logs generic data such as how often queries are generated, how many suggestions are followed, and how you rate the usefulness of followed suggestions. Logging is on by default, to turn off logging add the following to your .emacs or remem-custom.el file: (setq remem-log-p nil) All logs are kept in the file ~/.remem-log-file, or wherever specified by the remem-logfile variable. Logs are kept local, though I will be sending out email asking for a copy of log-files so I can evaluate how the RA gets used. Such participation is voluntary, and I encourage you to use the RA even if you don't keep logging info. Here's the complete list of information that gets logged: RA Version number timestamp Number of documents indexed per scope Scope name (e.g. "notes") Number of unique suggestions proposed Number of lines per scope displayed Ratings of followed suggestions Number of suggestions followed, their relevance scores (broken down by field type), docnums, and whether it was an automatic, mouse, or manual query No information about the content of documents or suggestions is kept. 6. Savant's document template system and other customizations -------------------------------------------------------------- As of Savant v.2.00, the template structure is compiled instead of set in a file. It is much more powerful than previous versions and allows for Perl-style regular expressions to pull out fields, do filtering, etc. This still has to be documented. It's pretty cool though :). Feel free to check the comments in the source-code -- they're pretty good. All the template stuff happens in RA/templates/conftemplates.c. 7. What's New? --------------- This is release v2.0, which is a huge rewrite. Here are some changes: Back-end (Savant): Redesigned from the ground up and is much cleaner now. Now uses the Okapi algorithm for text Template-defined filters for different data types (e.g. simple heuristics to remove sigs from email) Templates to recognize different queries Setable biases (weights) for fields of different document and query types More robust Front-end (Emacs RA): Redesigned from the ground up and is much cleaner now. Pretty Colors! (And useful too -- they separate fields) Mouseable queries for different fields View keywords feedback More robust See savant.h for a full changelog (yes, I really should break that out into a "changelog" file). 8. License ----------- Some files and libraries in this distribution carry their own copyright (notably the parsedate and zlib directories and libraries in savutil). In the future some plugins might carry different copyrights and licenses as well as people write their own. All other files and code is under the following copyright and license: All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. remem-2.12/savant.h0000644000076500007650000000666010014272751007712 #ifndef _SAVANT_ #define _SAVANT_ /* All code included in versions up to and including 2.09: Copyright (C) 1996-2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ extern void SavantError(int errcode, char *errstring); #ifdef HAVE_SYS_TYPES_H #include #endif #include #include #ifdef HAVE_PWD_H #include #endif #include #include #include #ifdef HAVE_SYS_STAT_H #include #endif #include #ifdef HAVE_UNISTD_H #include #endif /* #ifdef HAVE_VALUES_H #include #endif */ #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen # ifdef HAVE_SYS_NDIR_H # include # endif # ifdef HAVE_SYS_DIR_H # include # endif # ifdef HAVE_NDIR_H # include # endif #endif typedef struct dirent savant_direct; /* The following is to try to maintain a standard size of the data types used in the on-disk databases. */ #if (SIZEOF_INT == 4) typedef int DB_INT; typedef unsigned int DB_UINT; #elif (SIZEOF_SHORT == 4) typedef short DB_INT; typedef unsigned short DB_UINT; #elif (SIZEOF_LONG == 4) typedef long DB_INT; typedef unsigned long DB_UINT; #else typedef int DB_INT; typedef unsigned int DB_UINT; #endif #if (SIZEOF_SHORT == 2) typedef short DB_SHORT; typedef unsigned short DB_USHORT; #elif (SIZEOF_INT == 2) typedef short DB_INT; typedef unsigned int DB_USHORT; #else typedef short DB_SHORT; typedef unsigned short DB_USHORT; #endif #if (SIZEOF_FLOAT == 4) typedef float DB_FLOAT; #elif (SIZEOF_DOUBLE == 4) typedef double DB_FLOAT; #else typedef float DB_FLOAT; #endif #ifdef RA_MIN #undef RA_MIN #endif #ifdef RA_MAX #undef RA_MAX #endif #if !defined(PATH_MAX) #define PATH_MAX 1024 #endif #define RA_MIN(a,b) (((a)<(b))?(a):(b)) #define RA_MAX(a,b) (((a)>(b))?(a):(b)) #define REMEM_VERSION "Savant relevance engine, ver. 2.12, 2/16/04\nCopyright 2004 MIT Media Lab and Bradley Rhodes" #define REMEM_VERSION_NUMBER "2.12, 2/16/04" #endif remem-2.12/savutil/0000777000076500007650000000000010014272765010015 5remem-2.12/savutil/big.c0000644000076500007650000000753607760625114010655 /* big.c: read and write to file in bigendian, regardless of the native format. */ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include size_t fwrite_big(void *ptr, size_t size, size_t num, FILE *stream) { #if (WORDS_BIGENDIAN == 0) unsigned char *big = malloc(size*num); int i, j; size_t out; if (big == NULL) SavantError(ENOMEM, "Unable to malloc big in big.c"); for(i=0; isize = GBUFF_INIT_SIZE; gbuf->value = (char *)malloc(GBUFF_INIT_SIZE * sizeof(char)); gbuf->value[0] = '\0'; gbuf->tail = 0; } /* Destructor for a growbuffer */ void free_GBuffer(GBuffer *gbuf) { if (gbuf != NULL) { free(gbuf->value); } return; } /* return copy of char * part of GrowBuffer */ char *strcast_GBuffer(GBuffer *src) { char *retvalue; if (src == NULL) { return(NULL); } else { src->value[src->tail] = '\0'; /* This should always be true anyway, I'm just sanity checking */ retvalue = src->value; /* A pointer to it, not the original. Potentially dangerous. */ /* retvalue = strdup(src->value); */ return(retvalue); } } /* Like strncat, but for growbuffers */ void strncat_GBuffer(GBuffer *dest, char *src, size_t n) { int i; if (n > strnlen(src,n)) n=strnlen(src,n); if ((dest->tail + n + 1) > dest->size) { dest->size = 2 * (RA_MAX(dest->size, (n + dest->tail + 1))); dest->value = realloc(dest->value, dest->size); } strncat(dest->value, src, n); dest->tail += n; dest->value[dest->tail] = '\0'; return; } /* Like strncpy, but for GBuffers, except that it will always null terminate. */ void strncpy_GBuffer(GBuffer *dest, char *src, size_t n) { int i; if (n > strnlen(src,n)) n=strnlen(src,n); if (n > dest->size) { dest->size = 2 * (RA_MAX(dest->size, n)); dest->value = realloc(dest->value, dest->size); } strncpy(dest->value, src, n); dest->tail = n; dest->value[dest->tail] = '\0'; return; } /* Chop out the first n characters of a growbuffer. So strnchop_GBuffer(gbuf, 4) changes gbuf from "Boogie Woogie" to "ie Woogie". */ void strnchop_GBuffer(GBuffer *dest, size_t n) { char *temp; if (n > dest->tail) { /* Cutting the whole thing */ strncpy_GBuffer(dest, "", 0); } else { temp = (char *)malloc(sizeof(char) * (dest->tail - n + 1)); strncpy(temp, (char *)(strcast_GBuffer(dest) + n), (dest->tail - n)); strncpy_GBuffer(dest, temp, (dest->tail - n)); free(temp); } } remem-2.12/savutil/gbuf.h0000644000076500007650000000505207760625114011033 #ifndef _BUFFER_H_ #define _BUFFER_H_ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #define GBUFF_MAX_SIZE 16777216 #define GBUFF_INIT_SIZE 256 /* num bytes in a new growbuffer */ typedef struct { char *value; int tail; /* location of null-termination, so this == strlen(value) */ int size; } GBuffer; /* after you definte a GrowBuffer, you should init_GBuffer it, to set up the vars initially. */ void init_GBuffer(GBuffer *gbuf); /* after you init_GBuffer a GrowBuffer, don't forget to free it. */ void free_GBuffer(GBuffer *gbuf); /* return char * part of GrowBuffer (don't modify this string -- it might screw up our internal idea of how big this GB is) */ char *strcast_GBuffer(GBuffer *src); /* writes n chars of src into dest */ void strncat_GBuffer(GBuffer *dest, char *src, size_t n); /* copy first n chars of src into the dest GrowBuffer */ void strncpy_GBuffer(GBuffer *dest, char *src, size_t n); /* Chop out the first n characters of a growbuffer. So strnchop_GBuffer(gbuf, 4) changes gbuf from "Boogie Woogie to "ie Woogie". */ void strnchop_GBuffer(GBuffer *dest, size_t n); #endif remem-2.12/savutil/hash.c0000644000076500007650000001075107760625114011030 /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hash.h" /* Yet another hash-table implementation. This one is probably not very good, but I'm in a hurry. Sigh. */ /* Return a key for a given element int. This is butt simple. */ long rememHashBucket (long key, Remem_Hash_Table *table) { return (key % table->numberBuckets); } Remem_Hash_Table *rememHashCreateTable(int numBuckets) { int i; Remem_Hash_Table *newTable; newTable = (Remem_Hash_Table *)malloc(sizeof(Remem_Hash_Table)); newTable->numberBuckets = numBuckets; newTable->listOfBuckets = (Remem_Bucket **)malloc(numBuckets * sizeof(Remem_Bucket *)); for (i=0; i < numBuckets; i++) { newTable->listOfBuckets[i] = NULL; } newTable->nextInList = NULL; newTable->nextBucketno = 0; return(newTable); } /* add an element to the hashtable with given key */ void rememHashPut (long key, void *element, Remem_Hash_Table *table) { Remem_Bucket *temp_bucket; long bucketno; bucketno = rememHashBucket(key, table); /* Prepend to the bucket list */ temp_bucket = table->listOfBuckets[bucketno]; table->listOfBuckets[bucketno] = (Remem_Bucket *)malloc(sizeof(Remem_Bucket)); table->listOfBuckets[bucketno]->key = key; table->listOfBuckets[bucketno]->element = element; table->listOfBuckets[bucketno]->next = temp_bucket; } /* get an element from a hashtable */ void *rememHashGet (long key, Remem_Hash_Table *table) { Remem_Bucket *nextElement; long bucketno; bucketno = rememHashBucket(key, table); for ((nextElement = table->listOfBuckets[bucketno]); ((nextElement != NULL) && (nextElement->key != key)); nextElement = nextElement->next); if (nextElement == NULL) return(NULL); else return(nextElement->element); } /* Itterate through all elements of a table */ /* If reset_p != 0, start over at first element */ void *rememHashItterate (Remem_Hash_Table *table, int reset_p) { void *elt; /* resetting? */ if (reset_p) { table->nextBucketno = -1; table->nextInList = NULL; } /* We were at the end of a bucket last time */ while ((table->nextInList == NULL) && (table->nextBucketno < (table->numberBuckets - 1))) { table->nextBucketno++; table->nextInList = table->listOfBuckets[table->nextBucketno]; } /* OK, now return it */ if ((table->nextBucketno >= table->numberBuckets) || (table->nextInList == NULL)) { return(NULL); } else { elt = table->nextInList->element; table->nextInList = table->nextInList->next; return(elt); } } /* Empty the hash table and free memory. Freeing a hash table object after doing a Clear will not leave memory leaks */ void rememHashClear(Remem_Hash_Table *table) { int i; Remem_Bucket *nextbucket, *tempbucket; for (i=0; i < table->numberBuckets; i++) { for (nextbucket = table->listOfBuckets[i]; nextbucket != NULL;) { free(nextbucket->element); tempbucket = nextbucket->next; free(nextbucket); nextbucket = tempbucket; } table->listOfBuckets[i] = NULL; } } remem-2.12/savutil/hash.h0000644000076500007650000000423507760625114011035 #ifndef _REMEM_HASH_H_ #define _REMEM_HASH_H_ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ typedef struct _Remem_Bucket { long key; void *element; struct _Remem_Bucket *next; } Remem_Bucket; typedef struct _Remem_Hash_Table { int numberBuckets; /* Use a prime, e.g. 2^16 + 1 */ Remem_Bucket *nextInList; /* Next bucket itteration */ int nextBucketno; /* Next Bucket number itteration */ Remem_Bucket **listOfBuckets; } Remem_Hash_Table; Remem_Hash_Table *rememHashCreateTable(int numBuckets); void rememHashPut (long key, void *element, Remem_Hash_Table *table); void *rememHashGet (long key, Remem_Hash_Table *table); void *rememHashItterate (Remem_Hash_Table *table, int reset_p); void rememHashClear(Remem_Hash_Table *table); #endif remem-2.12/savutil/Makefile.am0000644000076500007650000000022107760625114011764 SUBDIRS=parsedate lib_LIBRARIES=libsavutil.a libsavutil_a_SOURCES=big.c opendie.c gbuf.c saverror.c hash.c EXTRA_DIST=savutil.h gbuf.h hash.h remem-2.12/savutil/Makefile.in0000644000076500007650000003157407760626047012022 # Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ CC = @CC@ DEPDIR = @DEPDIR@ EMACS = @EMACS@ INCLUDES = @INCLUDES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ lispdir = @lispdir@ SUBDIRS = parsedate lib_LIBRARIES = libsavutil.a libsavutil_a_SOURCES = big.c opendie.c gbuf.c saverror.c hash.c EXTRA_DIST = savutil.h gbuf.h hash.h subdir = savutil mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(lib_LIBRARIES) libsavutil_a_AR = $(AR) cru libsavutil_a_LIBADD = am_libsavutil_a_OBJECTS = big.$(OBJEXT) opendie.$(OBJEXT) gbuf.$(OBJEXT) \ saverror.$(OBJEXT) hash.$(OBJEXT) libsavutil_a_OBJECTS = $(am_libsavutil_a_OBJECTS) DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/big.Po ./$(DEPDIR)/gbuf.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/hash.Po ./$(DEPDIR)/opendie.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/saverror.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ DIST_SOURCES = $(libsavutil_a_SOURCES) RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = Makefile.am Makefile.in DIST_SUBDIRS = $(SUBDIRS) SOURCES = $(libsavutil_a_SOURCES) all: all-recursive .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu savutil/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) AR = ar libLIBRARIES_INSTALL = $(INSTALL_DATA) install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f"; \ $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f; \ else :; fi; \ done @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(libdir)/$$p"; \ rm -f $(DESTDIR)$(libdir)/$$p; \ done clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) libsavutil.a: $(libsavutil_a_OBJECTS) $(libsavutil_a_DEPENDENCIES) -rm -f libsavutil.a $(libsavutil_a_AR) libsavutil.a $(libsavutil_a_OBJECTS) $(libsavutil_a_LIBADD) $(RANLIB) libsavutil.a mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/big.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gbuf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opendie.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/saverror.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `cygpath -w $<` CCDEPMODE = @CCDEPMODE@ uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LIBRARIES) installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(libdir) install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libLIBRARIES mostlyclean-am distclean: distclean-recursive distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-exec-am: install-libLIBRARIES install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-info-am uninstall-libLIBRARIES uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-libLIBRARIES clean-recursive distclean \ distclean-compile distclean-depend distclean-generic \ distclean-recursive distclean-tags distdir dvi dvi-am \ dvi-recursive info info-am info-recursive install install-am \ install-data install-data-am install-data-recursive \ install-exec install-exec-am install-exec-recursive \ install-info install-info-am install-info-recursive \ install-libLIBRARIES install-man install-recursive \ install-strip installcheck installcheck-am installdirs \ installdirs-am installdirs-recursive maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-recursive \ tags tags-recursive uninstall uninstall-am uninstall-info-am \ uninstall-info-recursive uninstall-libLIBRARIES \ uninstall-recursive # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: remem-2.12/savutil/opendie.c0000644000076500007650000000115407760625114011525 /* */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include FILE *open_or_die(char *base, char *filename, char *mode) { char pathname[256]; char errorstring[256]; FILE *file; strncpy(pathname, base, 250); if (pathname[strlen(pathname)-1] != '/') strcat(pathname,"/"); strncat(pathname, filename, 255-strlen(pathname)); if((file = fopen(pathname, mode)) == NULL) { /* fprintf(stderr, "Unable to open %s\n", pathname); exit(-1); */ sprintf(errorstring, "Unable to open filename %s", pathname); SavantError(ENOENT, errorstring); } else return(file); } remem-2.12/savutil/parsedate/0000777000076500007650000000000010014272765011765 5remem-2.12/savutil/parsedate/date.30000644000076500007650000001602007760625114012705 DDDDAAAATTTTEEEE((((3333)))) ((((UUUUCCCCLLLLAAAA)))) DDDDAAAATTTTEEEE((((3333)))) NNNNAAAAMMMMEEEE parsedate - interpret character strings representing dates SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS #include "parsedate.h" char date; struct parsedate *pd; pd = parsedate (date); compute_unixtime (pd); break_down_unixtime (pd); date = mail_date_string (pd); date = uucp_date_string (pd); DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN These routines manipulate character strings representing dates. _p_a_r_s_e_d_a_t_e returns a pointer to a structure of the following form (described in the include-file _p_a_r_s_e_d_a_t_e._h): struct parsedate { long unixtime; /* as returned by time(2) */ char *error; /* non-NULL = error */ int year; /* year (1600 on) */ int month; /* month (1-12) */ int day; /* day of month (1-31) */ int hour; /* hour (0-23) */ int minute; /* minute (0-59) */ int second; /* second (0-59) */ int zone; /* time zone offset */ int dst; /* daylight savings time */ int weekday; /* real day of week */ int c_weekday; /* claimed day of week */ }; Any field containing the value -1 (except for _e_r_r_o_r) indicates information which was either not supplied or was invalid. _u_n_i_x_t_i_m_e is the UNIX internal representation of the date (i.e., number of seconds since 1970). _e_r_r_o_r is NNNNUUUULLLLLLLL if the date string did not contain a syntax error; otherwise, it points to the position in the date string where a syntax error was discovered. _z_o_n_e indicates the time-zone offset in minutes from UTC. A positive value denotes a time zone east of Greenwich; a negative value denotes a zone west of Greenwich. _d_s_t is equal to 1 if the indicated time zone denotes ``daylight savings time'', or 0 if daylight savings Hewlett-Packard - 1 - (printed 3/14/85) DDDDAAAATTTTEEEE((((3333)))) ((((UUUUCCCCLLLLAAAA)))) DDDDAAAATTTTEEEE((((3333)))) time is not indicated. _w_e_e_k_d_a_y and _c__w_e_e_k_d_a_y indicate a day of the week via a value in the range 0-6 (0 = Sunday, 6 = Saturday). _c__w_e_e_k_d_a_y shows which day of the week was actually specified in the date string; _w_e_e_k_d_a_y is derived from _y_e_a_r, _m_o_n_t_h, and _d_a_y via a perpetual-calendar algorithm. _c_o_m_p_u_t_e__u_n_i_x_t_i_m_e takes a _s_t_r_u_c_t _p_a_r_s_e_d_a_t_e in which the _y_e_a_r, _m_o_n_t_h, _d_a_y, _h_o_u_r, _m_i_n_u_t_e, _s_e_c_o_n_d, and _z_o_n_e fields have been filled in, and fills in the _u_n_i_x_t_i_m_e and _w_e_e_k_d_a_y fields as appropriate. _b_r_e_a_k__d_o_w_n__u_n_i_x_t_i_m_e takes a _s_t_r_u_c_t _p_a_r_s_e_d_a_t_e in which the _u_n_i_x_t_i_m_e and _z_o_n_e fields have been filled in, and fills in the _y_e_a_r, _m_o_n_t_h, _d_a_y, _h_o_u_r, _m_i_n_u_t_e, _s_e_c_o_n_d, and _w_e_e_k_d_a_y fields as appropriate. _m_a_i_l__d_a_t_e__s_t_r_i_n_g returns a pointer to a RFC822 (ARPANET mail standard) format character string corresponding to a _s_t_r_u_c_t _p_a_r_s_e_d_a_t_e. Similarly, _u_u_c_p__d_a_t_e__s_t_r_i_n_g returns a pointer to a UUCP-mail format character string corresponding to a _s_t_r_u_c_t _p_a_r_s_e_d_a_t_e. In each case, the _y_e_a_r, _m_o_n_t_h, _d_a_y, _h_o_u_r, _m_i_n_u_t_e, _s_e_c_o_n_d, and _z_o_n_e fields should be set first. If only the _u_n_i_x_t_i_m_e and _z_o_n_e values are initially avaiable, then _b_r_e_a_k__d_o_w_n__u_n_i_x_t_i_m_e should be called before trying to generate a date string. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS If the character string supplied as an argument to _p_a_r_s_e_d_a_t_e contains a syntax error, the _e_r_r_o_r variables in the returned _s_t_r_u_c_t _p_a_r_s_e_d_a_t_e will be set to point to the place in the argument string where the error was discovered. Any field which is either unspecified or given an invalid value in a call to _p_a_r_s_e_d_a_t_e is set to -1. _c_o_m_p_u_t_e__u_n_i_x_t_i_m_e and _b_r_e_a_k__d_o_w_n__u_n_i_x_t_i_m_e also set the appropriate fields to -1 if they are unable to compute the requested values. _m_a_i_l__d_a_t_e__s_t_r_i_n_g and _u_u_c_p__d_a_t_e__s_t_r_i_n_g return NNNNUUUULLLLLLLL if the information required to generate the date string is missing or invalid. BBBBUUUUGGGGSSSS The returned value from a call to _p_a_r_s_e_d_a_t_e, _m_a_i_l__d_a_t_e__s_t_r_i_n_g, or _u_u_c_p__d_a_t_e__s_t_r_i_n_g points to a static area whose contents will be overwritten by the next call to the same routine. A time-zone offset of ``-0001'' (i.e., one minute west of Greenwich) results in a _z_o_n_e value of -1, and is thus indistinguishable from an invalid or missing time zone. Hewlett-Packard - 2 - (printed 3/14/85) DDDDAAAATTTTEEEE((((3333)))) ((((UUUUCCCCLLLLAAAA)))) DDDDAAAATTTTEEEE((((3333)))) Since this particular time-zone offset is not (and almost certainly never will be) used anywhere in the world, the fact that it cannot be distinguished from an invalid or missing value is probably unimportant. AAAAUUUUTTTTHHHHOOOORRRR Richard B. Wales UCLA Center for Experimental Computer Science Hewlett-Packard - 3 - (printed 3/14/85) remem-2.12/savutil/parsedate/datelex.c0000644000076500007650000002554607760625114013513 /*$Log: datelex.c,v $ /*Revision 1.1.1.1 2001/04/24 15:40:54 finagler /*New CVS import, starting with 2.09 (introduction of the GPL) /* *Revision 1.2 1999/03/25 02:32:28 event *This appears to be a working version of the date indexer. Work still needs to be done on the retrieval end... * * Revision 1.1 84/09/01 15:01:14 wales * Initial revision * * Copyright (c) 1984 by Richard B. Wales * * Purpose: * * Lexical analyzer for "parsedate" routine. This lexer was orig- * inally written in LEX, but rewriting it as an ad-hoc routine * resulted in an enormous savings in space and a significant * increase in speed. * * Usage: * * Called as needed by the YACC parser ("dateyacc.c"). Not intended * to be called from any other routine. * * Notes: * * Global contents: * * int date_lex () * Returns the token number (from the YACC grammar) of the next * token in the input string pointed to by the global variable * "date_inbuf". The global variable "date_lval" is set to the lexi- * cal value (if any) of the token. "date_inbuf" is set to point * to the first character in the input string which is not a * part of the token just recognized. * * Local contents: * * struct wordtable *find_word (word) char *word; * Returns a pointer to the entry in the "wordtable" array cor- * responding to the string "word". If "word" is not found, the * returned value is NULL. */ /* ajs * ajs Code added 850314 to allow NUM991231 and NUM99991231. * ajs All added/changed lines contain "ajs" for easy searching. * ajs */ #ifdef RCSIDENT static char rcsident[] = "$Header: /local/CVSROOT/RA/savutil/parsedate/datelex.c,v 1.1.1.1 2001/04/24 15:40:54 finagler Exp $"; #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #define yylval date_lval #include "dateyacc.h" #include "parsedate.h" /* pointer to the input string */ char *date_inbuf; /* "answer" structure */ struct parsedate date_ans; /* Binary-search word table. * Entries must be sorted in ascending order on "text" value, and the * total number of entries must be one less than a power of 2. "Filler" * entries (with "token" values of -1) are inserted at the beginning and * end of the table to pad it as necessary. */ #define WORDTABLE_SIZE 127 /* MUST be one less than power of 2 */ #define MAX_WORD_LENGTH 20 /* used to weed out overly long words * in "date_lex". Must be at least as long * as the longest word in "wordtable", * but may be longer. */ struct wordtable { char *text; int token; int lexval; } wordtable[WORDTABLE_SIZE] = {/* text token lexval */ { "", -1, 0 }, { "", -1, 0 }, { "", -1, 0 }, { "", -1, 0 }, { "", -1, 0 }, { "", -1, 0 }, { "", -1, 0 }, { "", -1, 0 }, { "", -1, 0 }, { "", -1, 0 }, { "", -1, 0 }, { "A", STD_ZONE, 60 }, /* UTC+1h */ { "ACSST", DST_ZONE, 630 }, /* Cent. Australia */ { "ACST", STD_ZONE, 570 }, /* Cent. Australia */ { "ADT", DST_ZONE, -180 }, /* Atlantic (Canada) */ { "AESST", DST_ZONE, 660 }, /* E. Australia */ { "AEST", STD_ZONE, 600 }, /* E. Australia */ { "AM", AMPM, 0 }, { "APR", MONTH_NAME, 4 }, { "APRIL", MONTH_NAME, 4 }, { "AST", STD_ZONE, -240 }, /* Atlantic (Canada) */ { "AT", 0, 0 }, /* "at" (throwaway) */ { "AUG", MONTH_NAME, 8 }, { "AUGUST", MONTH_NAME, 8 }, { "AWSST", DST_ZONE, 540 }, /* W. Australia */ { "AWST", STD_ZONE, 480 }, /* W. Australia */ { "B", STD_ZONE, 120 }, /* UTC+2h */ { "BST", DST_ZONE, 60 }, /* Great Britain */ { "C", STD_ZONE, 180 }, /* UTC+3h */ { "CDT", DST_ZONE, -300 }, { "CST", STD_ZONE, -360 }, { "D", STD_ZONE, 240 }, /* UTC+4h */ { "DEC", MONTH_NAME, 12 }, { "DECEMBER", MONTH_NAME, 12 }, { "DST", DST_SUFFIX, 0 }, { "E", STD_ZONE, 300 }, /* UTC+5h */ { "EDT", DST_ZONE, -240 }, { "EET", STD_ZONE, 120 }, /* Eastern Europe */ { "EETDST", DST_ZONE, 180 }, /* Eastern Europe */ { "EST", STD_ZONE, -300 }, { "F", STD_ZONE, 360 }, /* UTC+6h */ { "FEB", MONTH_NAME, 2 }, { "FEBRUARY", MONTH_NAME, 2 }, { "FRI", DAY_NAME, 5 }, { "FRIDAY", DAY_NAME, 5 }, { "G", STD_ZONE, 420 }, /* UTC+7h */ { "GMT", STD_ZONE, 0 }, { "H", STD_ZONE, 480 }, /* UTC+8h */ { "HDT", DST_ZONE, -540 }, /* Hawaii/Alaska */ { "HST", STD_ZONE, -600 }, /* Hawaii/Alaska */ { "I", STD_ZONE, 540 }, /* UTC+9h */ { "IST", STD_ZONE, 120 }, /* Israel */ { "JAN", MONTH_NAME, 1 }, { "JANUARY", MONTH_NAME, 1 }, { "JUL", MONTH_NAME, 7 }, { "JULY", MONTH_NAME, 7 }, { "JUN", MONTH_NAME, 6 }, { "JUNE", MONTH_NAME, 6 }, { "K", STD_ZONE, 600 }, /* UTC+10h */ { "L", STD_ZONE, 660 }, /* UTC+11h */ { "M", STD_ZONE, 720 }, /* UTC+12h */ { "MAR", MONTH_NAME, 3 }, { "MARCH", MONTH_NAME, 3 }, { "MAY", MONTH_NAME, 5 }, { "MDT", DST_ZONE, -360 }, { "MET", STD_ZONE, 60 }, /* Central Europe */ { "METDST", DST_ZONE, 120 }, /* Central Europe */ { "MON", DAY_NAME, 1 }, { "MONDAY", DAY_NAME, 1 }, { "MST", STD_ZONE, -420 }, { "N", STD_ZONE, -60 }, /* UTC-1h */ { "NDT", DST_ZONE, -150 }, /* Nfld. (Canada) */ { "NOV", MONTH_NAME, 11 }, { "NOVEMBER", MONTH_NAME, 11 }, { "NST", STD_ZONE, -210 }, /* Nfld. (Canada) */ { "O", STD_ZONE, -120 }, /* UTC-2h */ { "OCT", MONTH_NAME, 10 }, { "OCTOBER", MONTH_NAME, 10 }, { "ON", 0, 0 }, /* "on" (throwaway) */ { "P", STD_ZONE, -180 }, /* UTC-3h */ { "PDT", DST_ZONE, -420 }, { "PM", AMPM, 12 }, { "PST", STD_ZONE, -480 }, { "Q", STD_ZONE, -240 }, /* UTC-4h */ { "R", STD_ZONE, -300 }, /* UTC-5h */ { "S", STD_ZONE, -360 }, /* UTC-6h */ { "SAT", DAY_NAME, 6 }, { "SATURDAY", DAY_NAME, 6 }, { "SEP", MONTH_NAME, 9 }, { "SEPT", MONTH_NAME, 9 }, { "SEPTEMBER", MONTH_NAME, 9 }, { "SUN", DAY_NAME, 0 }, { "SUNDAY", DAY_NAME, 0 }, { "T", STD_ZONE, -420 }, /* UTC-7h */ { "THU", DAY_NAME, 4 }, { "THUR", DAY_NAME, 4 }, { "THURS", DAY_NAME, 4 }, { "THURSDAY", DAY_NAME, 4 }, { "TUE", DAY_NAME, 2 }, { "TUES", DAY_NAME, 2 }, { "TUESDAY", DAY_NAME, 2 }, { "U", STD_ZONE, -480 }, /* UTC-8h */ { "UT", STD_ZONE, 0 }, { "UTC", STD_ZONE, 0 }, { "V", STD_ZONE, -540 }, /* UTC-9h */ { "W", STD_ZONE, -600 }, /* UTC-10h */ { "WED", DAY_NAME, 3 }, { "WEDNESDAY", DAY_NAME, 3 }, { "WEDS", DAY_NAME, 3 }, { "WET", STD_ZONE, 0 }, /* Western Europe */ { "WETDST", DST_ZONE, 60 }, /* Western Europe */ { "X", STD_ZONE, -660 }, /* UTC-11h */ { "Y", STD_ZONE, -720 }, /* UTC-12h */ { "YDT", DST_ZONE, -480 }, /* Yukon */ { "YST", STD_ZONE, -540 }, /* Yukon */ { "Z", STD_ZONE, 0 }, /* UTC */ { "\177", -1, 0 }, { "\177", -1, 0 }, { "\177", -1, 0 }, { "\177", -1, 0 }, { "\177", -1, 0 }, { "\177", -1, 0 }, { "\177", -1, 0 }, { "\177", -1, 0 }, { "\177", -1, 0 }, { "\177", -1, 0 }, { "\177", -1, 0 } }; static struct wordtable *find_word(); /* int date_lex () * Return the next token for the YACC parser. */ int date_lex () { static char buffer[MAX_WORD_LENGTH+1]; register char *c, *d; register struct wordtable *wt; register int num, ndgts; restart: /* We will return here if an invalid input token is detected. */ c = buffer; d = date_inbuf; /* Skip over blanks, tabs, commas, and parentheses. */ do { *c = *d++; } while (*c == ' ' || *c == '\t' || *c == ',' || *c == '(' || *c == ')'); /* A zero (null) byte signals the end of the input. */ if (*c == 0) { date_inbuf = --d; /* stay put on the null */ return 0; } /* Process a word (looking it up in "wordtable"). */ if ((*c >= 'A' && *c <= 'Z') || (*c >= 'a' && *c <= 'z')) { if (*c >= 'a' && *c <= 'z') *c += 'A' - 'a'; while (c < buffer + MAX_WORD_LENGTH && ((*d >= 'A' && *d <= 'Z') || (*d >= 'a' && *d <= 'z'))) { *++c = *d++; if (*c >= 'a' && *c <= 'z') *c += 'A' - 'a'; } if ((*d >= 'A' && *d <= 'Z') || (*d >= 'a' && *d <= 'z')) { /* Word is too long (over MAX_WORD_LENGTH characters). */ do { d++; } while ((*d >= 'A' && *d <= 'Z') || (*d >= 'a' && *d <= 'z')); date_inbuf = d; goto error; } *++c = 0; date_inbuf = d; if ((wt = find_word (buffer)) == NULL) goto error; if (wt->token == 0) goto restart; /* ignore this word */ date_lval.IntVal = wt->lexval; return wt->token; } /* Process a number. */ if (*c >= '0' && *c <= '9') { num = *c - '0'; ndgts = 1; for (ndgts = 1; ndgts < 8 && *d >= '0' && *d <= '9'; ndgts++) /* ajs */ num = 10*num + (*d++ - '0'); if (*d >= '0' && *d <= '9') { /* Number is too long (over 8 digits). */ /* ajs */ do { d++; } while (*d >= '0' && *d <= '9'); date_inbuf = d; goto error; } date_inbuf = d; date_lval.IntVal = num; switch (ndgts) { case 1: return NUM9; case 2: if (num <= 23) return NUM23; if (num <= 59) return NUM59; /*otherwise*/ return NUM99; case 3: case 4: if (num/100 <= 23 && num%100 <= 59) return NUM2359; /*otherwise*/ return NUM9999; case 5: case 6: if (num/10000 <= 23 && (num%10000)/100 <= 59 && num%100 <= 59) return NUM235959; if ((((num % 10000) / 100) <= 12) /* ajs */ && ((num % 100) <= 31)) /* ajs */ return NUM991231; /* ajs */ goto error; case 8: if ((((num % 10000) / 100) <= 12) /* ajs */ && ((num % 100) <= 31)) /* ajs */ return NUM99991231; /* ajs */ goto error; /* ajs */ default: goto error; } } /* Pass back the following delimiter tokens verbatim.. */ if (*c == '-' || *c == '+' || *c == '/' || *c == ':' || *c == '.') { date_inbuf = d; return *c; } error: /* An unidentified character was found in the input. */ date_inbuf = d; if (date_ans.error == NULL) date_ans.error = date_inbuf; goto restart; } /* struct wordtable *find_word (word) char *word; * Look up a word in the "wordtable" array via a binary search. */ static struct wordtable * find_word (word) register char *word; { register int low, mid, high; register int comparison; low = -1; high = WORDTABLE_SIZE; while (low+1 < high) { mid = (low + high) / 2; comparison = strcmp (wordtable[mid].text, word); if (comparison == 0) return wordtable+mid; if (comparison > 0) high = mid; else low = mid; } return NULL; } remem-2.12/savutil/parsedate/dateyacc.c0000644000076500007650000010537107760625114013635 # line 38 "dateyacc.y" #ifdef RCSIDENT static char rcsident[] = "$Header: /local/CVSROOT/RA/savutil/parsedate/dateyacc.c,v 1.1.1.1 2001/04/24 15:40:54 finagler Exp $"; #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #define yymaxdepth date_maxdepth #define yyparse date_parse #define yylex date_lex #define yyerror date_error #define yylval date_lval #define yychar date_char #define yydebug date_debug #define yypact date_pact #define yyr1 date_r1 #define yyr2 date_r2 #define yydef date_def #define yychk date_chk #define yypgo date_pgo #define yyact date_act #define yyexca date_exca #define yyerrflag date_errflag #define yynerrs date_nerrs #define yyps date_ps #define yypv date_pv #define yys date_s #define yy_yys date_yys #define yystate date_state #define yytmp date_tmp #define yyv date_v #define yy_yyv date_yyv #define yyval date_val #define yylloc date_lloc #define yyreds date_reds #define yytoks date_toks #define yylhs date_yylhs #define yylen date_yylen #define yydefred date_yydefred #define yydgoto date_yydgoto #define yysindex date_yysindex #define yyrindex date_yyrindex #define yygindex date_yygindex #define yytable date_yytable #define yycheck date_yycheck #define yyans date_ans #define yyinbuf date_inbuf #include "parsedate.h" struct parsedate yyans; /* No error routine is needed here. */ #define date_error(s) # line 97 "dateyacc.y" typedef union #ifdef __cplusplus YYSTYPE #endif { int IntVal; } YYSTYPE; # define DAY_NAME 257 # define MONTH_NAME 258 # define NUM9 259 # define NUM23 260 # define NUM59 261 # define NUM99 262 # define NUM2359 263 # define NUM9999 264 # define NUM235959 265 # define NUM991231 266 # define NUM99991231 267 # define AMPM 268 # define STD_ZONE 269 # define DST_ZONE 270 # define DST_SUFFIX 271 // malloc.h also doesn't seem to be needed, and Mac OS-X has trouble finding it. // removed it. -- BJR 9/21/03 // #include #include #include // I'm not sure why values.h was ever included. It seems that commenting it out // works just fine though. -- BJR 1/18/01 // #include #ifdef __cplusplus #ifndef yyerror void yyerror(const char *); #endif #ifndef yylex extern "C" int yylex(void); #endif int yyparse(void); #endif #define yyclearin yychar = -1 #define yyerrok yyerrflag = 0 extern int yychar; extern int yyerrflag; YYSTYPE yylval; YYSTYPE yyval; typedef int yytabelem; #ifndef YYMAXDEPTH #define YYMAXDEPTH 150 #endif #if YYMAXDEPTH > 0 int yy_yys[YYMAXDEPTH], *yys = yy_yys; YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv; #else /* user does initial allocation */ int *yys; YYSTYPE *yyv; #endif static int yymaxdepth = YYMAXDEPTH; # define YYERRCODE 256 # line 410 "dateyacc.y" yytabelem yyexca[] ={ -1, 1, 0, -1, -2, 0, -1, 8, 0, 55, 268, 89, 269, 89, 270, 89, 45, 89, 43, 89, -2, 81, -1, 16, 268, 90, 269, 90, 270, 90, 45, 90, 43, 90, -2, 85, -1, 31, 268, 89, 269, 89, 270, 89, 45, 89, 43, 89, -2, 81, -1, 118, 0, 132, -2, 89, }; # define YYNPROD 133 # define YYLAST 436 yytabelem yyact[]={ 10, 15, 24, 22, 25, 27, 18, 8, 19, 26, 20, 21, 131, 185, 133, 15, 24, 49, 50, 27, 18, 48, 19, 184, 20, 21, 24, 22, 25, 27, 18, 31, 19, 26, 20, 21, 24, 49, 50, 27, 18, 48, 19, 56, 20, 21, 78, 179, 76, 78, 172, 76, 173, 174, 170, 171, 164, 165, 157, 158, 132, 155, 128, 50, 27, 15, 56, 32, 33, 15, 18, 31, 19, 26, 24, 22, 25, 27, 56, 36, 23, 26, 32, 33, 56, 18, 31, 19, 26, 15, 168, 32, 33, 73, 64, 36, 65, 26, 32, 33, 166, 67, 36, 68, 26, 32, 33, 15, 163, 118, 14, 26, 18, 48, 19, 18, 48, 19, 134, 135, 162, 68, 136, 15, 24, 49, 50, 27, 24, 49, 50, 27, 49, 50, 27, 161, 72, 65, 70, 137, 114, 115, 4, 60, 83, 28, 34, 160, 45, 51, 53, 169, 167, 55, 2, 59, 82, 81, 37, 43, 138, 139, 71, 140, 141, 80, 127, 111, 61, 58, 12, 69, 86, 17, 12, 12, 16, 79, 89, 6, 13, 62, 42, 9, 40, 46, 98, 99, 116, 103, 104, 1, 156, 92, 159, 106, 0, 110, 0, 100, 3, 0, 0, 0, 0, 38, 44, 107, 109, 12, 0, 0, 0, 0, 0, 12, 0, 0, 0, 94, 0, 0, 0, 0, 0, 102, 113, 62, 134, 135, 145, 0, 136, 0, 119, 121, 0, 0, 129, 130, 93, 175, 176, 177, 178, 0, 101, 180, 181, 182, 183, 147, 152, 15, 24, 22, 25, 27, 149, 36, 154, 26, 151, 0, 153, 0, 0, 0, 0, 0, 0, 74, 75, 77, 0, 75, 77, 24, 22, 25, 27, 0, 36, 0, 26, 0, 0, 0, 15, 24, 49, 50, 27, 0, 0, 24, 49, 50, 27, 0, 0, 0, 0, 0, 0, 0, 0, 24, 49, 50, 27, 0, 0, 0, 0, 49, 50, 27, 5, 0, 0, 29, 35, 39, 0, 52, 54, 57, 11, 0, 0, 0, 11, 11, 0, 0, 30, 7, 0, 63, 66, 41, 47, 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, 88, 0, 0, 90, 91, 0, 96, 97, 0, 0, 0, 0, 85, 87, 11, 0, 0, 105, 0, 108, 11, 0, 0, 95, 0, 0, 0, 117, 0, 95, 0, 112, 63, 66, 0, 0, 0, 0, 0, 120, 122, 0, 123, 124, 0, 0, 0, 0, 0, 0, 0, 143, 0, 125, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 142, 0, 144, 0, 0, 150, 146, 0, 0, 0, 0, 0, 0, 0, 148 }; yytabelem yypact[]={ -256,-10000000, -192, -168, -232, -242, -168, -4, 97, 122, -10000000, 49, 56, 126, 91, 116,-10000000, 3,-10000000,-10000000, -10000000,-10000000, 119,-10000000, 111, 98,-10000000,-10000000, -177, -150, -10000000, 97, 119, 98, -161, -188, 97, -177, -161, -222, -161, 19,-10000000, -150, -188, -222, -188, 31,-10000000,-10000000, -10000000, -161, -188, -184, -134,-10000000, -130, -130, -127, -197, -197, -154,-10000000,-10000000, -130, -130,-10000000, -127, -127, -147, -147,-10000000, 6,-10000000,-10000000, -209, -31,-10000000, -141, -197, -197,-10000000, -197, -197, -147, -161, -147, -188,-10000000,-10000000, -147,-10000000, -147,-10000000,-10000000, 37,-10000000, -130, -147,-10000000, -147,-10000000,-10000000,-10000000, -130,-10000000,-10000000, -161, -130, -188, -130,-10000000, 90, 74,-10000000,-10000000,-10000000, -188, 97,-10000000, -10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -210, -10000000, -141, -211, -141, 89, 62,-10000000, -213, 42, 106, 32, 105,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -215, -221,-10000000, -217, -197, -197, -197, -197, -224,-10000000, -197, -197, -197, -197, -248,-10000000,-10000000, -258,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -10000000,-10000000,-10000000,-10000000,-10000000,-10000000 }; yytabelem yypgo[]={ 0, 80, 327, 60, 191, 153, 142, 318, 336, 200, 179, 182, 188, 180, 110, 169, 176, 173, 136, 93 }; yytabelem yyr1[]={ 0, 1, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 9, 9, 9, 10, 10, 10, 11, 11, 5, 5, 5, 13, 13, 13, 14, 14, 14, 8, 8, 8, 15, 15, 7, 7, 7, 7, 17, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 3, 3, 3, 3, 3, 3, 3, 12 }; yytabelem yyr2[]={ 0, 2, 2, 2, 2, 2, 4, 6, 8, 6, 8, 4, 6, 8, 6, 8, 2, 4, 6, 4, 6, 4, 6, 8, 4, 6, 6, 6, 6, 4, 6, 8, 2, 4, 6, 8, 4, 6, 6, 6, 6, 4, 6, 8, 2, 4, 6, 4, 6, 6, 8, 8, 6, 8, 8, 3, 2, 6, 6, 8, 3, 3, 5, 4, 6, 6, 4, 6, 2, 3, 3, 5, 5, 5, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 5, 2, 4, 4, 6, 3, 2, 7, 7, 11, 11, 7, 7, 11, 11, 7, 7, 3, 3, 3, 5, 5, 7, 3, 5, 5, 7, 5, 7, 7, 9, 7, 9, 11, 9, 7, 9, 7, 9, 11, 9, 3, 7, 7, 3, 7, 7, 3, 3 }; yytabelem yychk[]={ -10000000, -4, -5, -9, -6, -7, -10, -8, 263, -11, 256, -2, -15, -13, -14, 257, -16, -17, 262, 264, 266, 267, 259, -1, 258, 260, 265, 261, -6, -7, -8, 263, 259, 260, -6, -7, 263, -5, -9, -7, -10, -8, -11, -5, -9, -6, -10, -8, 263, 259, 260, -6, -7, -6, -7, -5, 47, -2, -15, 58, 46, 46, -15, -2, 45, 47, -2, 45, 47, 45, 47, 46, -18, -19, 268, 269, 45, 270, 43, 58, 46, 46, 58, 46, -7, -8, -6, -8, -7, -6, -7, -7, -5, -9, -10, -8, -7, -7, -6, -6, -5, -9, -10, -6, -6, -7, -6, -5, -7, -5, -6, -14, -2, -15, -1, -1, -12, -7, 263, -15, -2, -15, -2, -2, -2, -8, -8, -19, 271, 269, 270, 43, -3, 45, 259, 260, 263, -3, -1, -1, -1, -1, -8, -7, -8, -6, -8, -5, -8, -5, -7, -5, -6, -5, -6, 271, -3, 269, 270, -3, 58, 46, 58, 46, 269, 270, 58, 46, 58, 46, 269, 270, 271, 269, 270, -1, -1, -1, -1, 271, -1, -1, -1, -1, 271, 271 }; yytabelem yydef[]={ 0, -2, 5, 16, 56, 32, 44, 0, -2, 68, 60, 0, 0, 0, 0, 61, -2, 0, 80, 82, 69, 70, 3, 4, 83, 1, 101, 2, 6, 11, 63, -2, 0, 0, 17, 19, 89, 21, 24, 0, 29, 0, 68, 33, 36, 0, 41, 0, 81, 3, 1, 45, 47, 0, 0, 66, 0, 0, 0, 0, 0, 0, 71, 73, 0, 0, 72, 0, 0, 0, 0, 62, 86, 87, 102, 103, 0, 107, 0, 0, 0, 84, 0, 0, 7, 9, 12, 14, 18, 20, 22, 25, 26, 27, 28, 0, 30, 0, 34, 37, 38, 39, 40, 42, 0, 46, 48, 49, 0, 52, 0, 67, 0, 0, 99, 100, 57, 58, -2, 74, 76, 77, 79, 75, 78, 64, 65, 88, 104, 105, 108, 0, 111, 0, 125, 128, 131, 109, 91, 92, 95, 96, 8, 10, 13, 15, 23, 31, 35, 43, 50, 51, 53, 54, 59, 106, 110, 119, 121, 112, 0, 0, 0, 0, 113, 115, 0, 0, 0, 0, 116, 118, 120, 122, 124, 126, 127, 129, 130, 114, 93, 94, 97, 98, 117, 123 }; typedef struct #ifdef __cplusplus yytoktype #endif { char *t_name; int t_val; } yytoktype; #ifndef YYDEBUG # define YYDEBUG 0 /* don't allow debugging */ #endif #if YYDEBUG yytoktype yytoks[] = { "DAY_NAME", 257, "MONTH_NAME", 258, "NUM9", 259, "NUM23", 260, "NUM59", 261, "NUM99", 262, "NUM2359", 263, "NUM9999", 264, "NUM235959", 265, "NUM991231", 266, "NUM99991231", 267, "AMPM", 268, "STD_ZONE", 269, "DST_ZONE", 270, "DST_SUFFIX", 271, "-unknown-", -1 /* ends search */ }; char * yyreds[] = { "-no such reduction-", "num59 : NUM23", "num59 : NUM59", "num : NUM9", "num : num59", "goal : date", "goal : date dayname", "goal : date dayname time", "goal : date dayname time year", "goal : date dayname year", "goal : date dayname year time", "goal : date time", "goal : date time dayname", "goal : date time dayname year", "goal : date time year", "goal : date time year dayname", "goal : date.year", "goal : date.year dayname", "goal : date.year dayname time", "goal : date.year time", "goal : date.year time dayname", "goal : dayname date", "goal : dayname date time", "goal : dayname date time year", "goal : dayname date.year", "goal : dayname date.year time", "goal : dayname time date", "goal : dayname time date.year", "goal : dayname time year.date", "goal : dayname year.date", "goal : dayname year.date time", "goal : dayname year time date", "goal : time", "goal : time date", "goal : time date dayname", "goal : time date dayname year", "goal : time date.year", "goal : time date.year dayname", "goal : time dayname date", "goal : time dayname date.year", "goal : time dayname year.date", "goal : time year.date", "goal : time year.date dayname", "goal : time year dayname date", "goal : year.date", "goal : year.date dayname", "goal : year.date dayname time", "goal : year.date time", "goal : year.date time dayname", "goal : year dayname date", "goal : year dayname date time", "goal : year dayname time date", "goal : year time date", "goal : year time date dayname", "goal : year time dayname date", "goal : NUM2359", "goal : dayname", "goal : yymmdd '.' time2359", "goal : yymmdd '.' time", "goal : yymmdd '.' time dayname", "goal : error", "dayname : DAY_NAME", "dayname : DAY_NAME '.'", "date.year : date year", "date.year : hyphen.date '-' year", "date.year : slash.date '/' year", "year.date : year date", "year.date : year '/' slash.date", "year.date : yymmdd", "yymmdd : NUM991231", "yymmdd : NUM99991231", "date : num month.name", "date : month.name num", "date : num num", "hyphen.date : num '-' month.name", "hyphen.date : month.name '-' num", "hyphen.date : num '-' num", "slash.date : num '/' month.name", "slash.date : month.name '/' num", "slash.date : num '/' num", "year : NUM99", "year : NUM2359", "year : NUM9999", "month.name : MONTH_NAME", "month.name : MONTH_NAME '.'", "time : hour.alone", "time : hour am.pm", "time : hour zone", "time : hour am.pm zone", "hour : NUM2359", "hour : hour.alone", "hour.alone : NUM9 ':' num59", "hour.alone : NUM9 '.' num59", "hour.alone : NUM9 ':' num59 ':' num59", "hour.alone : NUM9 '.' num59 '.' num59", "hour.alone : NUM23 ':' num59", "hour.alone : NUM23 '.' num59", "hour.alone : NUM23 ':' num59 ':' num59", "hour.alone : NUM23 '.' num59 '.' num59", "hour.alone : NUM2359 ':' num59", "hour.alone : NUM2359 '.' num59", "hour.alone : NUM235959", "am.pm : AMPM", "zone : STD_ZONE", "zone : STD_ZONE DST_SUFFIX", "zone : '-' STD_ZONE", "zone : '-' STD_ZONE DST_SUFFIX", "zone : DST_ZONE", "zone : '-' DST_ZONE", "zone : '+' zone.offset", "zone : '-' '+' zone.offset", "zone : '-' zone.offset", "zone : '-' '-' zone.offset", "zone : '+' zone.offset STD_ZONE", "zone : '+' zone.offset STD_ZONE DST_SUFFIX", "zone : '+' zone.offset DST_ZONE", "zone : '-' '+' zone.offset STD_ZONE", "zone : '-' '+' zone.offset STD_ZONE DST_SUFFIX", "zone : '-' '+' zone.offset DST_ZONE", "zone : '-' zone.offset STD_ZONE", "zone : '-' zone.offset STD_ZONE DST_SUFFIX", "zone : '-' zone.offset DST_ZONE", "zone : '-' '-' zone.offset STD_ZONE", "zone : '-' '-' zone.offset STD_ZONE DST_SUFFIX", "zone : '-' '-' zone.offset DST_ZONE", "zone.offset : NUM9", "zone.offset : NUM9 ':' num59", "zone.offset : NUM9 '.' num59", "zone.offset : NUM23", "zone.offset : NUM23 ':' num59", "zone.offset : NUM23 '.' num59", "zone.offset : NUM2359", "time2359 : NUM2359", }; #endif /* YYDEBUG */ /* * Copyright 1987 Silicon Graphics, Inc. - All Rights Reserved */ /* #ident "@(#)yacc:yaccpar 1.10" */ #ident "$Revision: 1.1.1.1 $" /* ** Skeleton parser driver for yacc output */ #include "stddef.h" /* ** yacc user known macros and defines */ #define YYERROR goto yyerrlab #define YYACCEPT return(0) #define YYABORT return(1) #ifdef __cplusplus #define YYBACKUP( newtoken, newvalue )\ {\ if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ {\ yyerror( gettxt("uxlibc:78", "syntax error - cannot backup") );\ goto yyerrlab;\ }\ yychar = newtoken;\ yystate = *yyps;\ yylval = newvalue;\ goto yynewstate;\ } #else #define YYBACKUP( newtoken, newvalue )\ {\ if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ {\ yyerror( gettxt("uxlibc:78", "Syntax error - cannot backup") );\ goto yyerrlab;\ }\ yychar = newtoken;\ yystate = *yyps;\ yylval = newvalue;\ goto yynewstate;\ } #endif #define YYRECOVERING() (!!yyerrflag) #define YYNEW(type) malloc(sizeof(type) * yynewmax) #define YYCOPY(to, from, type) \ (type *) memcpy(to, (char *) from, yynewmax * sizeof(type)) #define YYENLARGE( from, type) \ (type *) realloc((char *) from, yynewmax * sizeof(type)) #ifndef YYDEBUG # define YYDEBUG 1 /* make debugging available */ #endif /* ** user known globals */ int yydebug; /* set to 1 to get debugging */ /* ** driver internal defines */ #define YYFLAG (-10000000) /* ** global variables used by the parser */ YYSTYPE *yypv; /* top of value stack */ int *yyps; /* top of state stack */ int yystate; /* current state */ int yytmp; /* extra var (lasts between blocks) */ int yynerrs; /* number of errors */ int yyerrflag; /* error recovery flag */ int yychar; /* current input token number */ /* ** yyparse - return 0 if worked, 1 if syntax error not recovered from */ #if defined(__STDC__) || defined(__cplusplus) int yyparse(void) #else int yyparse() #endif { register YYSTYPE *yypvt; /* top of value stack for $vars */ /* ** Initialize externals - yyparse may be called more than once */ yypv = &yyv[-1]; yyps = &yys[-1]; yystate = 0; yytmp = 0; yynerrs = 0; yyerrflag = 0; yychar = -1; #if YYMAXDEPTH <= 0 if (yymaxdepth <= 0) { if ((yymaxdepth = YYEXPAND(0)) <= 0) { #ifdef __cplusplus yyerror(gettxt("uxlibc:79", "yacc initialization error")); #else yyerror(gettxt("uxlibc:79", "Yacc initialization error")); #endif YYABORT; } } #endif goto yystack; { register YYSTYPE *yy_pv; /* top of value stack */ register int *yy_ps; /* top of state stack */ register int yy_state; /* current state */ register int yy_n; /* internal state number info */ /* ** get globals into registers. ** branch to here only if YYBACKUP was called. */ yynewstate: yy_pv = yypv; yy_ps = yyps; yy_state = yystate; goto yy_newstate; /* ** get globals into registers. ** either we just started, or we just finished a reduction */ yystack: yy_pv = yypv; yy_ps = yyps; yy_state = yystate; /* ** top of for (;;) loop while no reductions done */ yy_stack: /* ** put a state and value onto the stacks */ #if YYDEBUG /* ** if debugging, look up token value in list of value vs. ** name pairs. 0 and negative (-1) are special values. ** Note: linear search is used since time is not a real ** consideration while debugging. */ if ( yydebug ) { register int yy_i; printf( "State %d, token ", yy_state ); if ( yychar == 0 ) printf( "end-of-file\n" ); else if ( yychar < 0 ) printf( "-none-\n" ); else { for ( yy_i = 0; yytoks[yy_i].t_val >= 0; yy_i++ ) { if ( yytoks[yy_i].t_val == yychar ) break; } printf( "%s\n", yytoks[yy_i].t_name ); } } #endif /* YYDEBUG */ if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ { int yynewmax; ptrdiff_t yys_off; /* The following pointer-differences are safe, since * yypvt, yy_pv, and yypv all are a multiple of * sizeof(YYSTYPE) bytes from yyv. */ ptrdiff_t yypvt_off = yypvt - yyv; ptrdiff_t yy_pv_off = yy_pv - yyv; ptrdiff_t yypv_off = yypv - yyv; int *yys_base = yys; #ifdef YYEXPAND yynewmax = YYEXPAND(yymaxdepth); #else yynewmax = 2 * yymaxdepth; /* double table size */ if (yymaxdepth == YYMAXDEPTH) /* first time growth */ { void *newyys = YYNEW(int); void *newyyv = YYNEW(YYSTYPE); if (newyys != 0 && newyyv != 0) { yys = YYCOPY(newyys, yys, int); yyv = YYCOPY(newyyv, yyv, YYSTYPE); } else yynewmax = 0; /* failed */ } else /* not first time */ { yys = YYENLARGE(yys, int); yyv = YYENLARGE(yyv, YYSTYPE); if (yys == 0 || yyv == 0) yynewmax = 0; /* failed */ } #endif if (yynewmax <= yymaxdepth) /* tables not expanded */ { #ifdef __cplusplus yyerror( gettxt("uxlibc:80", "yacc stack overflow") ); #else yyerror( gettxt("uxlibc:80", "Yacc stack overflow") ); #endif YYABORT; } yymaxdepth = yynewmax; /* reset pointers into yys */ yys_off = yys - yys_base; yy_ps = yy_ps + yys_off; yyps = yyps + yys_off; /* reset pointers into yyv */ yypvt = yyv + yypvt_off; yy_pv = yyv + yy_pv_off; yypv = yyv + yypv_off; } *yy_ps = yy_state; *++yy_pv = yyval; /* ** we have a new state - find out what to do */ yy_newstate: if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) goto yydefault; /* simple state */ #if YYDEBUG /* ** if debugging, need to mark whether new token grabbed */ yytmp = yychar < 0; #endif if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) ) yychar = 0; /* reached EOF */ #if YYDEBUG if ( yydebug && yytmp ) { register int yy_i; printf( "Received token " ); if ( yychar == 0 ) printf( "end-of-file\n" ); else if ( yychar < 0 ) printf( "-none-\n" ); else { for ( yy_i = 0; yytoks[yy_i].t_val >= 0; yy_i++ ) { if ( yytoks[yy_i].t_val == yychar ) break; } printf( "%s\n", yytoks[yy_i].t_name ); } } #endif /* YYDEBUG */ if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) goto yydefault; if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ { yychar = -1; yyval = yylval; yy_state = yy_n; if ( yyerrflag > 0 ) yyerrflag--; goto yy_stack; } yydefault: if ( ( yy_n = yydef[ yy_state ] ) == -2 ) { #if YYDEBUG yytmp = yychar < 0; #endif if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) ) yychar = 0; /* reached EOF */ #if YYDEBUG if ( yydebug && yytmp ) { register int yy_i; printf( "Received token " ); if ( yychar == 0 ) printf( "end-of-file\n" ); else if ( yychar < 0 ) printf( "-none-\n" ); else { for ( yy_i = 0; yytoks[yy_i].t_val >= 0; yy_i++ ) { if ( yytoks[yy_i].t_val == yychar ) { break; } } printf( "%s\n", yytoks[yy_i].t_name ); } } #endif /* YYDEBUG */ /* ** look through exception table */ { register int *yyxi = yyexca; while ( ( *yyxi != -1 ) || ( yyxi[1] != yy_state ) ) { yyxi += 2; } while ( ( *(yyxi += 2) >= 0 ) && ( *yyxi != yychar ) ) ; if ( ( yy_n = yyxi[1] ) < 0 ) YYACCEPT; } } /* ** check for syntax error */ if ( yy_n == 0 ) /* have an error */ { /* no worry about speed here! */ switch ( yyerrflag ) { case 0: /* new error */ #ifdef __cplusplus yyerror( gettxt("uxlibc:81", "syntax error") ); #else yyerror( gettxt("uxlibc:81", "Syntax error") ); #endif goto skip_init; yyerrlab: /* ** get globals into registers. ** we have a user generated syntax type error */ yy_pv = yypv; yy_ps = yyps; yy_state = yystate; yynerrs++; /* FALLTHRU */ skip_init: case 1: case 2: /* incompletely recovered error */ /* try again... */ yyerrflag = 3; /* ** find state where "error" is a legal ** shift action */ while ( yy_ps >= yys ) { yy_n = yypact[ *yy_ps ] + YYERRCODE; if ( yy_n >= 0 && yy_n < YYLAST && yychk[yyact[yy_n]] == YYERRCODE) { /* ** simulate shift of "error" */ yy_state = yyact[ yy_n ]; goto yy_stack; } /* ** current state has no shift on ** "error", pop stack */ #if YYDEBUG # define _POP_ "Error recovery pops state %d, uncovers state %d\n" if ( yydebug ) printf( _POP_, *yy_ps, yy_ps[-1] ); # undef _POP_ #endif yy_ps--; yy_pv--; } /* ** there is no state on stack with "error" as ** a valid shift. give up. */ YYABORT; case 3: /* no shift yet; eat a token */ #if YYDEBUG /* ** if debugging, look up token in list of ** pairs. 0 and negative shouldn't occur, ** but since timing doesn't matter when ** debugging, it doesn't hurt to leave the ** tests here. */ if ( yydebug ) { register int yy_i; printf( "Error recovery discards " ); if ( yychar == 0 ) printf( "token end-of-file\n" ); else if ( yychar < 0 ) printf( "token -none-\n" ); else { for ( yy_i = 0; yytoks[yy_i].t_val >= 0; yy_i++ ) { if ( yytoks[yy_i].t_val == yychar ) { break; } } printf( "token %s\n", yytoks[yy_i].t_name ); } } #endif /* YYDEBUG */ if ( yychar == 0 ) /* reached EOF. quit */ YYABORT; yychar = -1; goto yy_newstate; } }/* end if ( yy_n == 0 ) */ /* ** reduction by production yy_n ** put stack tops, etc. so things right after switch */ #if YYDEBUG /* ** if debugging, print the string that is the user's ** specification of the reduction which is just about ** to be done. */ if ( yydebug ) printf( "Reduce by (%d) \"%s\"\n", yy_n, yyreds[ yy_n ] ); #endif yytmp = yy_n; /* value to switch over */ yypvt = yy_pv; /* $vars top of value stack */ /* ** Look in goto table for next state ** Sorry about using yy_state here as temporary ** register variable, but why not, if it works... ** If yyr2[ yy_n ] doesn't have the low order bit ** set, then there is no action to be done for ** this reduction. So, no saving & unsaving of ** registers done. The only difference between the ** code just after the if and the body of the if is ** the goto yy_stack in the body. This way the test ** can be made before the choice of what to do is needed. */ { /* length of production doubled with extra bit */ register int yy_len = yyr2[ yy_n ]; if ( !( yy_len & 01 ) ) { yy_len >>= 1; yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + *( yy_ps -= yy_len ) + 1; if ( yy_state >= YYLAST || yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) { yy_state = yyact[ yypgo[ yy_n ] ]; } goto yy_stack; } yy_len >>= 1; yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + *( yy_ps -= yy_len ) + 1; if ( yy_state >= YYLAST || yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) { yy_state = yyact[ yypgo[ yy_n ] ]; } } /* save until reenter driver code */ yystate = yy_state; yyps = yy_ps; yypv = yy_pv; } /* ** code supplied by user is placed in this switch */ switch( yytmp ) { case 55: # line 179 "dateyacc.y" { yyans.hour = yypvt[-0].IntVal / 100; yyans.minute = yypvt[-0].IntVal % 100; yyans.second = -1; /* unspecified */ } break; case 60: # line 188 "dateyacc.y" { extern char *yyinbuf; if (yyans.error == NULL) yyans.error = yyinbuf; } break; case 61: # line 194 "dateyacc.y" { yyans.c_weekday = yypvt[-0].IntVal; } break; case 62: # line 196 "dateyacc.y" { yyans.c_weekday = yypvt[-1].IntVal; } break; case 69: # line 211 "dateyacc.y" { yyans.year = (yypvt[-0].IntVal / 10000) + 1900; /* ajs */ yyans.month = (yypvt[-0].IntVal % 10000) / 100; /* ajs */ yyans.day = (yypvt[-0].IntVal % 100); /* ajs */ } break; case 70: # line 217 "dateyacc.y" { yyans.year = (yypvt[-0].IntVal / 10000); /* ajs */ yyans.month = (yypvt[-0].IntVal % 10000) / 100; /* ajs */ yyans.day = (yypvt[-0].IntVal % 100); /* ajs */ } break; case 71: # line 224 "dateyacc.y" { yyans.day = yypvt[-1].IntVal; } break; case 72: # line 226 "dateyacc.y" { yyans.day = yypvt[-0].IntVal; } break; case 73: # line 228 "dateyacc.y" { yyans.month = yypvt[-1].IntVal; yyans.day = yypvt[-0].IntVal; } break; case 74: # line 232 "dateyacc.y" { yyans.day = yypvt[-2].IntVal; } break; case 75: # line 234 "dateyacc.y" { yyans.day = yypvt[-0].IntVal; } break; case 76: # line 236 "dateyacc.y" { yyans.month = yypvt[-2].IntVal; yyans.day = yypvt[-0].IntVal; } break; case 77: # line 240 "dateyacc.y" { yyans.day = yypvt[-2].IntVal; } break; case 78: # line 242 "dateyacc.y" { yyans.day = yypvt[-0].IntVal; } break; case 79: # line 244 "dateyacc.y" { yyans.month = yypvt[-2].IntVal; yyans.day = yypvt[-0].IntVal; } break; case 80: # line 248 "dateyacc.y" { yyans.year = 1900 + yypvt[-0].IntVal; } break; case 81: # line 250 "dateyacc.y" { yyans.year = yypvt[-0].IntVal; } break; case 82: # line 252 "dateyacc.y" { yyans.year = yypvt[-0].IntVal; } break; case 83: # line 256 "dateyacc.y" { yyans.month = yypvt[-0].IntVal; } break; case 84: # line 258 "dateyacc.y" { yyans.month = yypvt[-1].IntVal; } break; case 89: # line 268 "dateyacc.y" { yyans.hour = yypvt[-0].IntVal / 100; yyans.minute = yypvt[-0].IntVal % 100; yyans.second = -1; /* unspecified */ } break; case 91: # line 276 "dateyacc.y" { yyans.hour = yypvt[-2].IntVal; yyans.minute = yypvt[-0].IntVal; yyans.second = -1; /* unspecified */ } break; case 92: # line 281 "dateyacc.y" { yyans.hour = yypvt[-2].IntVal; yyans.minute = yypvt[-0].IntVal; yyans.second = -1; /* unspecified */ } break; case 93: # line 286 "dateyacc.y" { yyans.hour = yypvt[-4].IntVal; yyans.minute = yypvt[-2].IntVal; yyans.second = yypvt[-0].IntVal; } break; case 94: # line 291 "dateyacc.y" { yyans.hour = yypvt[-4].IntVal; yyans.minute = yypvt[-2].IntVal; yyans.second = yypvt[-0].IntVal; } break; case 95: # line 296 "dateyacc.y" { yyans.hour = yypvt[-2].IntVal; yyans.minute = yypvt[-0].IntVal; yyans.second = -1; /* unspecified */ } break; case 96: # line 301 "dateyacc.y" { yyans.hour = yypvt[-2].IntVal; yyans.minute = yypvt[-0].IntVal; yyans.second = -1; /* unspecified */ } break; case 97: # line 306 "dateyacc.y" { yyans.hour = yypvt[-4].IntVal; yyans.minute = yypvt[-2].IntVal; yyans.second = yypvt[-0].IntVal; } break; case 98: # line 311 "dateyacc.y" { yyans.hour = yypvt[-4].IntVal; yyans.minute = yypvt[-2].IntVal; yyans.second = yypvt[-0].IntVal; } break; case 99: # line 316 "dateyacc.y" { yyans.hour = yypvt[-2].IntVal / 100; yyans.minute = yypvt[-2].IntVal % 100; yyans.second = yypvt[-0].IntVal; } break; case 100: # line 321 "dateyacc.y" { yyans.hour = yypvt[-2].IntVal / 100; yyans.minute = yypvt[-2].IntVal % 100; yyans.second = yypvt[-0].IntVal; } break; case 101: # line 326 "dateyacc.y" { yyans.hour = yypvt[-0].IntVal / 10000; yyans.minute = (yypvt[-0].IntVal % 10000) / 100; yyans.second = yypvt[-0].IntVal % 100; } break; case 102: # line 333 "dateyacc.y" { if (yyans.hour < 1 || yyans.hour > 12) yyans.hour = -1; /* invalid */ else { if (yyans.hour == 12) yyans.hour = 0; yyans.hour += yypvt[-0].IntVal; /* 0 for AM, 12 for PM */ } } break; case 103: # line 342 "dateyacc.y" { yyans.zone = yypvt[-0].IntVal; yyans.dst = 0; } break; case 104: # line 344 "dateyacc.y" { yyans.zone = yypvt[-1].IntVal + 60; yyans.dst = 1; } break; case 105: # line 346 "dateyacc.y" { yyans.zone = yypvt[-0].IntVal; yyans.dst = 0; } break; case 106: # line 348 "dateyacc.y" { yyans.zone = yypvt[-1].IntVal + 60; yyans.dst = 1; } break; case 107: # line 350 "dateyacc.y" { yyans.zone = yypvt[-0].IntVal; yyans.dst = 1; } break; case 108: # line 352 "dateyacc.y" { yyans.zone = yypvt[-0].IntVal; yyans.dst = 1; } break; case 109: # line 354 "dateyacc.y" { yyans.zone = yypvt[-0].IntVal; yyans.dst = 0; } break; case 110: # line 356 "dateyacc.y" { yyans.zone = yypvt[-0].IntVal; yyans.dst = 0; } break; case 111: # line 358 "dateyacc.y" { yyans.zone = - yypvt[-0].IntVal; yyans.dst = 0; } break; case 112: # line 360 "dateyacc.y" { yyans.zone = - yypvt[-0].IntVal; yyans.dst = 0; } break; case 113: # line 363 "dateyacc.y" { yyans.zone = yypvt[-1].IntVal; yyans.dst = 0; } break; case 114: # line 365 "dateyacc.y" { yyans.zone = yypvt[-2].IntVal; yyans.dst = 0; } break; case 115: # line 367 "dateyacc.y" { yyans.zone = yypvt[-1].IntVal; yyans.dst = 0; } break; case 116: # line 369 "dateyacc.y" { yyans.zone = yypvt[-1].IntVal; yyans.dst = 0; } break; case 117: # line 371 "dateyacc.y" { yyans.zone = yypvt[-2].IntVal; yyans.dst = 0; } break; case 118: # line 373 "dateyacc.y" { yyans.zone = yypvt[-1].IntVal; yyans.dst = 0; } break; case 119: # line 375 "dateyacc.y" { yyans.zone = - yypvt[-1].IntVal; yyans.dst = 0; } break; case 120: # line 377 "dateyacc.y" { yyans.zone = - yypvt[-2].IntVal; yyans.dst = 0; } break; case 121: # line 379 "dateyacc.y" { yyans.zone = - yypvt[-1].IntVal; yyans.dst = 0; } break; case 122: # line 381 "dateyacc.y" { yyans.zone = - yypvt[-1].IntVal; yyans.dst = 0; } break; case 123: # line 383 "dateyacc.y" { yyans.zone = - yypvt[-2].IntVal; yyans.dst = 0; } break; case 124: # line 385 "dateyacc.y" { yyans.zone = - yypvt[-1].IntVal; yyans.dst = 0; } break; case 125: # line 389 "dateyacc.y" { yyval.IntVal = 60 * yypvt[-0].IntVal; } break; case 126: # line 391 "dateyacc.y" { yyval.IntVal = 60 * yypvt[-2].IntVal + yypvt[-0].IntVal; } break; case 127: # line 393 "dateyacc.y" { yyval.IntVal = 60 * yypvt[-2].IntVal + yypvt[-0].IntVal; } break; case 128: # line 395 "dateyacc.y" { yyval.IntVal = 60 * yypvt[-0].IntVal; } break; case 129: # line 397 "dateyacc.y" { yyval.IntVal = 60 * yypvt[-2].IntVal + yypvt[-0].IntVal; } break; case 130: # line 399 "dateyacc.y" { yyval.IntVal = 60 * yypvt[-2].IntVal + yypvt[-0].IntVal; } break; case 131: # line 401 "dateyacc.y" { yyval.IntVal = 60 * (yypvt[-0].IntVal / 100) | (yypvt[-0].IntVal % 100); } break; case 132: # line 405 "dateyacc.y" { yyans.hour = yypvt[-0].IntVal / 100; /* ajs */ yyans.minute = yypvt[-0].IntVal % 100; /* ajs */ yyans.second = -1; /* ajs */ } break; } goto yystack; /* reset registers in driver code */ } remem-2.12/savutil/parsedate/dateyacc.h0000644000076500007650000000064707760625114013642 typedef union #ifdef __cplusplus YYSTYPE #endif { int IntVal; } YYSTYPE; extern YYSTYPE yylval; # define DAY_NAME 257 # define MONTH_NAME 258 # define NUM9 259 # define NUM23 260 # define NUM59 261 # define NUM99 262 # define NUM2359 263 # define NUM9999 264 # define NUM235959 265 # define NUM991231 266 # define NUM99991231 267 # define AMPM 268 # define STD_ZONE 269 # define DST_ZONE 270 # define DST_SUFFIX 271 remem-2.12/savutil/parsedate/dateyacc.y0000644000076500007650000002243307760625114013660 /*$Log: dateyacc.y,v $ /*Revision 1.1.1.1 2001/04/24 15:40:54 finagler /*New CVS import, starting with 2.09 (introduction of the GPL) /* *Revision 1.2 1999/03/25 02:32:30 event *This appears to be a working version of the date indexer. Work still needs to be done on the retrieval end... * * Revision 1.1 84/09/01 15:01:22 wales * Initial revision * * Copyright (c) 1984 by Richard B. Wales * * Purpose: * * YACC parser for "parsedate" routine. * * Usage: * * Called as needed by the "parsedate" routine in "parsedate.c". * Not intended to be called from any other routine. * * Notes: * * Global contents: * * int yyparse () * Parses the date string pointed to by the global variable * "yyinbuf". Sets the appropriate fields in the global data * structure "yyans". The returned value is 1 if there was a * syntax error, 0 if there was no error. * * Local contents: * * None. */ /* ajs * ajs Code added on 850314 to allow goal := year.date '.' time * ajs and year.date := [CC]YYMMDD (YY > 23) * ajs All added lines contain "ajs" for easy searching. * ajs */ %{ #ifdef RCSIDENT static char rcsident[] = "$Header: /local/CVSROOT/RA/savutil/parsedate/dateyacc.y,v 1.1.1.1 2001/04/24 15:40:54 finagler Exp $"; #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #define yymaxdepth date_maxdepth #define yyparse date_parse #define yylex date_lex #define yyerror date_error #define yylval date_lval #define yychar date_char #define yydebug date_debug #define yypact date_pact #define yyr1 date_r1 #define yyr2 date_r2 #define yydef date_def #define yychk date_chk #define yypgo date_pgo #define yyact date_act #define yyexca date_exca #define yyerrflag date_errflag #define yynerrs date_nerrs #define yyps date_ps #define yypv date_pv #define yys date_s #define yy_yys date_yys #define yystate date_state #define yytmp date_tmp #define yyv date_v #define yy_yyv date_yyv #define yyval date_val #define yylloc date_lloc #define yyreds date_reds #define yytoks date_toks #define yylhs date_yylhs #define yylen date_yylen #define yydefred date_yydefred #define yydgoto date_yydgoto #define yysindex date_yysindex #define yyrindex date_yyrindex #define yygindex date_yygindex #define yytable date_yytable #define yycheck date_yycheck #define yyans date_ans #define yyinbuf date_inbuf #include "parsedate.h" struct parsedate yyans; /* No error routine is needed here. */ #define date_error(s) %} %union { int IntVal; } %token DAY_NAME %token MONTH_NAME %token NUM9 NUM23 NUM59 NUM99 NUM2359 NUM9999 NUM235959 %token NUM991231 NUM99991231 /* ajs */ %token AMPM %token STD_ZONE DST_ZONE DST_SUFFIX %type DAY_NAME %type MONTH_NAME %type NUM9 NUM23 NUM59 NUM99 NUM2359 NUM9999 NUM235959 %type NUM991231 NUM99991231 /* ajs */ %type AMPM %type STD_ZONE DST_ZONE %type num59 num zone.offset %start goal %% num59: NUM23 | NUM59 num: NUM9 | num59 goal: date | date dayname | date dayname time | date dayname time year | date dayname year | date dayname year time | date time | date time dayname | date time dayname year | date time year | date time year dayname | date.year | date.year dayname | date.year dayname time | date.year time | date.year time dayname | dayname date | dayname date time | dayname date time year | dayname date.year | dayname date.year time | dayname time date | dayname time date.year | dayname time year.date | dayname year.date | dayname year.date time | dayname year time date | time | time date | time date dayname | time date dayname year | time date.year | time date.year dayname | time dayname date | time dayname date.year | time dayname year.date | time year.date | time year.date dayname | time year dayname date | year.date | year.date dayname | year.date dayname time | year.date time | year.date time dayname | year dayname date | year dayname date time | year dayname time date | year time date | year time date dayname | year time dayname date | NUM2359 { yyans.hour = $1 / 100; yyans.minute = $1 % 100; yyans.second = -1; /* unspecified */ } | dayname | yymmdd '.' time2359 /* ajs */ | yymmdd '.' time /* ajs */ | yymmdd '.' time dayname /* ajs */ | error { extern char *yyinbuf; if (yyans.error == NULL) yyans.error = yyinbuf; } dayname: DAY_NAME { yyans.c_weekday = $1; } | DAY_NAME '.' { yyans.c_weekday = $1; } date.year: date year | hyphen.date '-' year | slash.date '/' year year.date: year date /* | year '-' hyphen.date (leads to parser conflict) */ | year '/' slash.date | yymmdd /* ajs */ /* ajs */ yymmdd: /* ajs */ NUM991231 /* ajs */ { yyans.year = ($1 / 10000) + 1900; /* ajs */ yyans.month = ($1 % 10000) / 100; /* ajs */ yyans.day = ($1 % 100); /* ajs */ } /* ajs */ /*| NUM235959 (leads to parser conflict) */ /* ajs */ | NUM99991231 /* ajs */ { yyans.year = ($1 / 10000); /* ajs */ yyans.month = ($1 % 10000) / 100; /* ajs */ yyans.day = ($1 % 100); /* ajs */ } /* ajs */ date: num month.name { yyans.day = $1; } | month.name num { yyans.day = $2; } | num num { yyans.month = $1; yyans.day = $2; } hyphen.date: num '-' month.name { yyans.day = $1; } | month.name '-' num { yyans.day = $3; } | num '-' num { yyans.month = $1; yyans.day = $3; } slash.date: num '/' month.name { yyans.day = $1; } | month.name '/' num { yyans.day = $3; } | num '/' num { yyans.month = $1; yyans.day = $3; } year: NUM99 /* precludes two-digit date before 1960 */ { yyans.year = 1900 + $1; } | NUM2359 { yyans.year = $1; } | NUM9999 { yyans.year = $1; } month.name: MONTH_NAME { yyans.month = $1; } | MONTH_NAME '.' { yyans.month = $1; } time: hour.alone | hour am.pm | hour zone | hour am.pm zone hour: NUM2359 { yyans.hour = $1 / 100; yyans.minute = $1 % 100; yyans.second = -1; /* unspecified */ } | hour.alone hour.alone: NUM9 ':' num59 { yyans.hour = $1; yyans.minute = $3; yyans.second = -1; /* unspecified */ } | NUM9 '.' num59 { yyans.hour = $1; yyans.minute = $3; yyans.second = -1; /* unspecified */ } | NUM9 ':' num59 ':' num59 { yyans.hour = $1; yyans.minute = $3; yyans.second = $5; } | NUM9 '.' num59 '.' num59 { yyans.hour = $1; yyans.minute = $3; yyans.second = $5; } | NUM23 ':' num59 { yyans.hour = $1; yyans.minute = $3; yyans.second = -1; /* unspecified */ } | NUM23 '.' num59 { yyans.hour = $1; yyans.minute = $3; yyans.second = -1; /* unspecified */ } | NUM23 ':' num59 ':' num59 { yyans.hour = $1; yyans.minute = $3; yyans.second = $5; } | NUM23 '.' num59 '.' num59 { yyans.hour = $1; yyans.minute = $3; yyans.second = $5; } | NUM2359 ':' num59 { yyans.hour = $1 / 100; yyans.minute = $1 % 100; yyans.second = $3; } | NUM2359 '.' num59 { yyans.hour = $1 / 100; yyans.minute = $1 % 100; yyans.second = $3; } | NUM235959 { yyans.hour = $1 / 10000; yyans.minute = ($1 % 10000) / 100; yyans.second = $1 % 100; } am.pm: AMPM { if (yyans.hour < 1 || yyans.hour > 12) yyans.hour = -1; /* invalid */ else { if (yyans.hour == 12) yyans.hour = 0; yyans.hour += $1; /* 0 for AM, 12 for PM */ } } zone: STD_ZONE { yyans.zone = $1; yyans.dst = 0; } | STD_ZONE DST_SUFFIX { yyans.zone = $1 + 60; yyans.dst = 1; } | '-' STD_ZONE { yyans.zone = $2; yyans.dst = 0; } | '-' STD_ZONE DST_SUFFIX { yyans.zone = $2 + 60; yyans.dst = 1; } | DST_ZONE { yyans.zone = $1; yyans.dst = 1; } | '-' DST_ZONE { yyans.zone = $2; yyans.dst = 1; } | '+' zone.offset { yyans.zone = $2; yyans.dst = 0; } | '-' '+' zone.offset { yyans.zone = $3; yyans.dst = 0; } | '-' zone.offset { yyans.zone = - $2; yyans.dst = 0; } | '-' '-' zone.offset { yyans.zone = - $3; yyans.dst = 0; } /* new stuff follows -cabbage */ | '+' zone.offset STD_ZONE { yyans.zone = $2; yyans.dst = 0; } | '+' zone.offset STD_ZONE DST_SUFFIX { yyans.zone = $2; yyans.dst = 0; } | '+' zone.offset DST_ZONE { yyans.zone = $2; yyans.dst = 0; } | '-' '+' zone.offset STD_ZONE { yyans.zone = $3; yyans.dst = 0; } | '-' '+' zone.offset STD_ZONE DST_SUFFIX { yyans.zone = $3; yyans.dst = 0; } | '-' '+' zone.offset DST_ZONE { yyans.zone = $3; yyans.dst = 0; } | '-' zone.offset STD_ZONE { yyans.zone = - $2; yyans.dst = 0; } | '-' zone.offset STD_ZONE DST_SUFFIX { yyans.zone = - $2; yyans.dst = 0; } | '-' zone.offset DST_ZONE { yyans.zone = - $2; yyans.dst = 0; } | '-' '-' zone.offset STD_ZONE { yyans.zone = - $3; yyans.dst = 0; } | '-' '-' zone.offset STD_ZONE DST_SUFFIX { yyans.zone = - $3; yyans.dst = 0; } | '-' '-' zone.offset DST_ZONE { yyans.zone = - $3; yyans.dst = 0; } zone.offset: NUM9 { $$ = 60 * $1; } | NUM9 ':' num59 { $$ = 60 * $1 + $3; } | NUM9 '.' num59 { $$ = 60 * $1 + $3; } | NUM23 { $$ = 60 * $1; } | NUM23 ':' num59 { $$ = 60 * $1 + $3; } | NUM23 '.' num59 { $$ = 60 * $1 + $3; } | NUM2359 { $$ = 60 * ($1 / 100) | ($1 % 100); } time2359: /* ajs */ NUM2359 /* ajs */ { yyans.hour = $1 / 100; /* ajs */ yyans.minute = $1 % 100; /* ajs */ yyans.second = -1; /* ajs */ } /* ajs */ %% remem-2.12/savutil/parsedate/Makefile.am0000644000076500007650000000042507760625114013742 # Produce a header file. YFLAGS=-d lib_LIBRARIES=libdate.a ## Grr, it's preformatted. ## man_MANS=date.3 libdate_a_SOURCES=dateyacc.c dateyacc.h datelex.c parsedate.c parsedate.h EXTRA_DIST=Makefile.dist date.3 dateyacc.y # dateyacc.y.orig datelex.c.orig parsedate.c.orig remem-2.12/savutil/parsedate/Makefile.dist0000644000076500007650000000212207760625114014304 # $Log: Makefile.dist,v $ # Revision 1.1.1.1 2001/04/24 15:40:54 finagler # New CVS import, starting with 2.09 (introduction of the GPL) # # Revision 1.2 1999/03/25 02:32:28 event # This appears to be a working version of the date indexer. Work still needs to be done on the retrieval end... # # Revision 1.1 84/09/01 15:00:58 wales # Initial revision # # $Header: /local/CVSROOT/RA/savutil/parsedate/Makefile.dist,v 1.1.1.1 2001/04/24 15:40:54 finagler Exp $ # # Makefile for "date" library routines # # Copyright (c) 1984 by Richard B. Wales DEFS = CFLAGS = -O $(DEFS) -DRCSIDENT all: libdate.a strip: libdate.a libdate.a: datelex.o dateyacc.o parsedate.o rm -f libdate.a ar rc libdate.a datelex.o dateyacc.o parsedate.o .c.o: cc -S $(CFLAGS) $*.c sed 's/_yy/_date_yy/g' $*.s | as -o $*.o rm -f $*.s dateyacc.c dateyacc.h: dateyacc.y yacc -d dateyacc.y mv y.tab.c dateyacc.c mv y.tab.h dateyacc.h clean: rm -f *.o *.s\ dateyacc.c dateyacc.h y.tab.c y.tab.h y.output\ libdate.a datelex.o: parsedate.h dateyacc.h dateyacc.o: parsedate.h parsedate.o: parsedate.h remem-2.12/savutil/parsedate/Makefile.in0000644000076500007650000002275607760626047013774 # Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ CC = @CC@ DEPDIR = @DEPDIR@ EMACS = @EMACS@ INCLUDES = @INCLUDES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ lispdir = @lispdir@ # Produce a header file. YFLAGS = -d lib_LIBRARIES = libdate.a libdate_a_SOURCES = dateyacc.c dateyacc.h datelex.c parsedate.c parsedate.h EXTRA_DIST = Makefile.dist date.3 dateyacc.y subdir = savutil/parsedate mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(lib_LIBRARIES) libdate_a_AR = $(AR) cru libdate_a_LIBADD = am_libdate_a_OBJECTS = dateyacc.$(OBJEXT) datelex.$(OBJEXT) \ parsedate.$(OBJEXT) libdate_a_OBJECTS = $(am_libdate_a_OBJECTS) DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/datelex.Po ./$(DEPDIR)/dateyacc.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/parsedate.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ DIST_SOURCES = $(libdate_a_SOURCES) DIST_COMMON = README Makefile.am Makefile.in SOURCES = $(libdate_a_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu savutil/parsedate/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) AR = ar libLIBRARIES_INSTALL = $(INSTALL_DATA) install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f"; \ $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f; \ else :; fi; \ done @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(libdir)/$$p"; \ rm -f $(DESTDIR)$(libdir)/$$p; \ done clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) libdate.a: $(libdate_a_OBJECTS) $(libdate_a_DEPENDENCIES) -rm -f libdate.a $(libdate_a_AR) libdate.a $(libdate_a_OBJECTS) $(libdate_a_LIBADD) $(RANLIB) libdate.a mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datelex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dateyacc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsedate.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `cygpath -w $<` CCDEPMODE = @CCDEPMODE@ uninstall-info-am: ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: $(mkinstalldirs) $(DESTDIR)$(libdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLIBRARIES mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-libLIBRARIES install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-info-am uninstall-libLIBRARIES .PHONY: GTAGS all all-am check check-am clean clean-generic \ clean-libLIBRARIES distclean distclean-compile distclean-depend \ distclean-generic distclean-tags distdir dvi dvi-am info \ info-am install install-am install-data install-data-am \ install-exec install-exec-am install-info install-info-am \ install-libLIBRARIES install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic tags uninstall uninstall-am \ uninstall-info-am uninstall-libLIBRARIES # dateyacc.y.orig datelex.c.orig parsedate.c.orig # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: remem-2.12/savutil/parsedate/parsedate.c0000644000076500007650000003254607760625114014033 /*LINTLIBRARY*/ /*$Log: parsedate.c,v $ /*Revision 1.1.1.1 2001/04/24 15:40:54 finagler /*New CVS import, starting with 2.09 (introduction of the GPL) /* *Revision 1.2 1999/03/25 02:32:30 event *This appears to be a working version of the date indexer. Work still needs to be done on the retrieval end... * * Revision 1.1 84/09/01 15:01:30 wales * Initial revision * * Copyright (c) 1984 by Richard B. Wales * * Purpose: * * Manipulate character strings representing dates. * * Usage: * * #include * * char date; * struct parsedate *pd; * * pd = parsedate (date); * * compute_unixtime (pd); * * break_down_unixtime (pd); * * date = mail_date_string (pd); * * date = uucp_date_string (pd); * * Notes: * * The returned value from "parsedate", "mail_date_string", or * "uucp_date_string" points to static data whose contents are * overwritten by the next call to the same routine. * * "compute_unixtime" is implicitly called by "parsedate". * * Global contents: * * struct parsedate *parsedate (date) char *date; * Parse a character string representing a date and time into * individual values in a "struct parsedate" data structure. * * compute_unixtime (pd) struct parsedate *pd; * Given a mostly filled-in "struct parsedate", compute the day * of the week and the internal UNIX representation of the date. * * break_down_unixtime (pd) struct parsedate *pd; * Compute the date and time corresponding to the "unixtime" and * "zone" values in a "struct parsedate". * * char *mail_date_string (pd) struct parsedate *pd; * Generate a character string representing a date and time in * the RFC822 (ARPANET mail standard) format. * * char *uucp_date_string (pd) struct parsedate *pd; * Generate a character string representing a date and time in * the UUCP mail format. * * Local contents: * * None. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "parsedate.h" #ifdef RCSIDENT static char rcsident[] = "$Header: /local/CVSROOT/RA/savutil/parsedate/parsedate.c,v 1.1.1.1 2001/04/24 15:40:54 finagler Exp $"; static char rcs_parsedate_hdr[] = RCS_PARSEDATE_HDR; #endif void compute_unixtime(); void break_down_unixtime(); int date_parse(); /* Number of seconds in various time intervals. */ #define SEC_PER_MIN 60 #define SEC_PER_HOUR (60*SEC_PER_MIN) #define SEC_PER_DAY (24*SEC_PER_HOUR) #define SEC_PER_YEAR (365*SEC_PER_DAY) /* Number of days in each month. */ static int monthsize[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 }; /* Three-letter abbreviations of month and day names. */ static char monthname[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; static char dayname[] = "SunMonTueWedThuFriSat"; /* struct parsedate *parsedate (date) char *date; * Analyze a character string representing a date and time. The * returned value points to a data structure with the desired * information. (NOTE: The returned value points to static data * whose contents are overwritten by each call.) */ struct parsedate * parsedate (date) register char *date; { register int year_save; extern struct parsedate date_ans; extern char *date_inbuf; /* extern char *sprintf(); */ /* Initialize the returned-value structure. */ date_ans.unixtime = -1; date_ans.year = -1; date_ans.month = -1; date_ans.day = -1; date_ans.hour = -1; date_ans.minute = -1; date_ans.second = -1; date_ans.zone = -1; date_ans.dst = -1; date_ans.weekday = -1; date_ans.c_weekday = -1; date_ans.error = NULL; /* Parse the argument string. */ date_inbuf = date; if (date_parse () != 0 && date_ans.error == NULL) date_ans.error = date_inbuf; /* Validate the day of the month, compute/validate the day of the * week, and compute the internal UNIX form of the time. See if * "compute_unixtime" found fault with the year or the day of the * month. (Note that we have to remember the original "year" value * because it might legitimately have been -1 to begin with.) */ year_save = date_ans.year; compute_unixtime (&date_ans); if (date_ans.error == NULL && (date_ans.year != year_save || (date_ans.month > 0 && date_ans.day < 0) || (date_ans.month < 0 && date_ans.day > 0))) date_ans.error = date_inbuf; return &date_ans; } /* compute_unixtime (pd) struct parsedate *pd; * Given a mostly filled-in "struct parsedate", compute the day of * the week and the internal UNIX representation of the date. * * A year before 1600 will be rejected and replaced with -1. A * date from 1600 on which falls outside the range representable in * internal UNIX form will still have the correct day of the week * computed. * * The day of the week is always computed on the assumption that the * Gregorian calendar is in use. Days of the week for dates in the * far future may turn out to be incorrect if any changes are made * to the calendar between now and then. */ void compute_unixtime (pd) register struct parsedate *pd; { register int weekday, n, l, a; /* Validate the year. */ if (pd->year >= 0 && pd->year < 1600) pd->year = -1; /* Validate the day of the month. Also calculate the number of days * in February (even if this is not February, we will need the num- * ber of days in February later on when computing the UNIX time). */ if (pd->month > 0) { if (pd->year < 0) monthsize[2] = 29; else if (pd->year % 4 != 0) monthsize[2] = 28; else if (pd->year % 100 != 0) monthsize[2] = 29; else if (pd->year % 400 != 0) monthsize[2] = 28; else monthsize[2] = 29; if (pd->day <= 0 || pd->day > monthsize[pd->month]) pd->day = -1; } /* Compute the day of the week. The next several lines constitute a * perpetual-calendar formula. Note, of course, that the "claimed" * day of the week (pd->c_weekday) is ignored here. */ if (pd->year > 0 && pd->month > 0 && pd->day > 0) { if (pd->month >= 3) n = pd->year / 100, l = pd->year % 100; else n = (pd->year-1) / 100, l = (pd->year-1) % 100; a = (26 * ((pd->month+9)%12 + 1) - 2) / 10; weekday = (a+(l>>2)+(n>>2)+l-(n+n)+pd->day); while (weekday < 0) weekday += 7; pd->weekday = weekday % 7; } /* Figure out the internal UNIX form of the date. */ if (pd->year >= 1969 && pd->year <= 2038 && pd->month > 0 && pd->day > 0 && pd->hour >= 0 && pd->minute >= 0 && pd->zone != -1 && pd->zone > -1440 && pd->zone < 1440) { pd->unixtime = SEC_PER_YEAR * (pd->year - 1970) + SEC_PER_DAY * ((pd->year - 1969) / 4) /* month is taken care of later */ + SEC_PER_DAY * (pd->day - 1) + SEC_PER_HOUR * pd->hour + SEC_PER_MIN * pd->minute /* seconds are taken care of later */ - SEC_PER_MIN * pd->zone; if (pd->second >= 0) pd->unixtime += pd->second; for (n = pd->month - 1; n > 0; n--) pd->unixtime += SEC_PER_DAY * monthsize[n]; if (pd->unixtime < 0) pd->unixtime = -1; } else pd->unixtime = -1; } /* break_down_unixtime (pd) struct parsedate *pd; * Given the "unixtime" and "zone" fields of a "struct parsedate", * compute the values of the "year", "month", "day", "hour", "min- * ute", "second", and "weekday" fields. The "dst" and "error" * fields of the structure are not used or modified. */ void break_down_unixtime (pd) register struct parsedate *pd; { register unsigned long timevalue; register int m, n; /* Validate the "unixtime" and "zone" fields. */ if (pd->unixtime < 0 || pd->zone == -1 || pd->zone <= -1440 || pd->zone >= 1440) { /* Sorry, can't do it. */ pd->year = -1; pd->month = -1; pd->day = -1; pd->hour = -1; pd->minute = -1; pd->second = -1; pd->weekday = -1; return; } /* Even though "pd->unixtime" must be non-negative, and thus cannot * indicate a time earlier than 1970, a negative "pd->zone" could * cause the local date to be Wednesday, 31 December 1969. Such a * date requires special handling. * * A local date earlier than 31 December 1969 is impossible because * "pd->zone" must represent a time-zone shift of less than a day. */ if (pd->zone < 0 && pd->unixtime + SEC_PER_MIN * pd->zone < 0) { pd->year = 1969; pd->month = 12; pd->day = 31; pd->weekday = 3; /* Wednesday */ timevalue = pd->unixtime + SEC_PER_MIN * pd->zone + SEC_PER_DAY; /* Note: 0 <= timevalue < SEC_PER_DAY */ pd->hour = timevalue / SEC_PER_HOUR; pd->minute = (timevalue % SEC_PER_HOUR) / SEC_PER_MIN; pd->second = timevalue % SEC_PER_MIN; return; } /* Handle the general case (local time is 1970 or later). */ timevalue = pd->unixtime + SEC_PER_MIN * pd->zone; /* day of the week (1 January 1970 was a Thursday) . . . */ pd->weekday = (timevalue/SEC_PER_DAY + 4 /* Thursday */) % 7; /* year (note that the only possible century year here is 2000, * a leap year -- hence no special tests for century years are * needed) . . . */ for (m = 1970; ; m++) { n = (m%4==0) ? SEC_PER_YEAR+SEC_PER_DAY : SEC_PER_YEAR; if (n > timevalue) break; timevalue -= n; } pd->year = m; monthsize[2] = (m%4==0) ? 29 : 28; /* month . . . */ for (m = 1; ; m++) { n = SEC_PER_DAY * monthsize[m]; if (n > timevalue) break; timevalue -= n; } pd->month = m; /* day, hour, minute, and second . . . */ pd->day = (timevalue / SEC_PER_DAY) + 1; pd->hour = (timevalue % SEC_PER_DAY) / SEC_PER_HOUR; pd->minute = (timevalue % SEC_PER_HOUR) / SEC_PER_MIN; pd->second = timevalue % SEC_PER_MIN; } /* char *mail_date_string (pd) struct parsedate *pd; * Generate a character string representing a date and time in the * RFC822 (ARPANET mail standard) format. A value of NULL is re- * turned if "pd" does not contain all necessary data fields. * (NOTE: The returned value points to static data whose contents * are overwritten by each call.) */ char * mail_date_string (pd) register struct parsedate *pd; { register char *c; static char answer[50]; /* Check the day of the month and compute the day of the week. */ compute_unixtime (pd); /* Make sure all required fields are present. */ if (pd->year < 0 || pd->month < 0 || pd->day < 0 || pd->hour < 0 || pd->minute < 0 || pd->zone == -1 || pd->zone <= -1440 || pd->zone >= 1440) return NULL; /* impossible to generate string */ /* Generate the answer string. */ sprintf (answer, "%.3s, %d %.3s %d %02d:%02d", dayname + 3*pd->weekday, pd->day, monthname + 3*(pd->month-1), (pd->year >= 1960 && pd->year <= 1999) ? pd->year - 1900 : pd->year, pd->hour, pd->minute); c = answer + strlen (answer); if (pd->second >= 0) sprintf (c, ":%02d", pd->second), c += 3; *c++ = ' '; switch (pd->zone) { /* NOTE: Only zone abbreviations in RFC822 are used here. */ case 0: strcpy (c, pd->dst ? "+0000" : "GMT"); break; case -240: strcpy (c, pd->dst ? "EDT" : "-0400"); break; case -300: strcpy (c, pd->dst ? "CDT" : "EST"); break; case -360: strcpy (c, pd->dst ? "MDT" : "CST"); break; case -420: strcpy (c, pd->dst ? "PDT" : "MST"); break; case -480: strcpy (c, pd->dst ? "-0800" : "PST"); break; default: if (pd->zone >= 0) sprintf (c, "+%02d%02d", pd->zone/60, pd->zone%60); else sprintf (c, "-%02d%02d", -pd->zone/60, -pd->zone%60); } return answer; } /* char *uucp_date_string (pd) struct parsedate *pd; * Generate a character string representing a date and time in the * UUCP mail format. A value of NULL is returned if "pd" does not * contain all necessary data fields. (NOTE: The returned value * points to static data whose contents are overwritten by each * call.) */ char * uucp_date_string (pd) register struct parsedate *pd; { register char *c; static char answer[50]; /* Check the day of the month and compute the day of the week. */ compute_unixtime (pd); /* Make sure all required fields are present. */ if (pd->year < 0 || pd->month < 0 || pd->day < 0 || pd->hour < 0 || pd->minute < 0 || pd->zone == -1 || pd->zone <= -1440 || pd->zone >= 1440) return NULL; /* impossible to generate string */ /* Generate the answer string. */ sprintf (answer, "%.3s %.3s %d %02d:%02d", dayname + 3*pd->weekday, monthname + 3*(pd->month-1), pd->day, pd->hour, pd->minute); c = answer + strlen (answer); if (pd->second >= 0) sprintf (c, ":%02d", pd->second), c += 3; switch (pd->zone) { /* NOTE: Only zone abbreviations in RFC822 are used here. */ case 0: strcpy (c, pd->dst ? "+0000" : "-GMT"); break; case -240: strcpy (c, pd->dst ? "-EDT" : "-0400"); break; case -300: strcpy (c, pd->dst ? "-CDT" : "-EST"); break; case -360: strcpy (c, pd->dst ? "-MDT" : "-CST"); break; case -420: strcpy (c, pd->dst ? "-PDT" : "-MST"); break; case -480: strcpy (c, pd->dst ? "-0800" : "-PST"); break; default: if (pd->zone >= 0) sprintf (c, "+%02d%02d", pd->zone/60, pd->zone%60); else sprintf (c, "-%02d%02d", -pd->zone/60, -pd->zone%60); } c = answer + strlen (answer); sprintf (c, " %d", pd->year); return answer; } remem-2.12/savutil/parsedate/parsedate.h0000644000076500007650000000360707760625114014034 /* $Log: parsedate.h,v $ /* Revision 1.1.1.1 2001/04/24 15:40:54 finagler /* New CVS import, starting with 2.09 (introduction of the GPL) /* * Revision 1.2 1999/03/25 02:32:31 event * This appears to be a working version of the date indexer. Work still needs to be done on the retrieval end... * * Revision 1.1 84/09/01 15:01:38 wales * Initial revision * * Copyright (c) 1984 by Richard B. Wales * */ #ifdef RCSIDENT #define RCS_PARSEDATE_HDR "$Header: /local/CVSROOT/RA/savutil/parsedate/parsedate.h,v 1.1.1.1 2001/04/24 15:40:54 finagler Exp $" #endif /* Data structure returned by "parsedate". * * A value of NULL for "error" means that no syntax errors were detected * in the argument value. A non-NULL value points to the byte position * within the argument string at which it was discovered that an error * existed. * * A value of -1 means that the field was never given a value, or that * the value supplied was invalid. (A side effect of this convention is * that a time zone offset of -1 -- i.e., one minute west of GMT -- is * indistinguishable from an invalid or unspecified time zone offset. * Since the likelihood of "-0001" being a legitimate time zone is nil, * banning it is a small price to pay for the uniformity of using -1 as * a "missing/invalid" indication for all fields.) */ struct parsedate { long unixtime; /* UNIX internal representation of time */ char *error; /* NULL = OK; non-NULL = error */ int year; /* year (1600 on) */ int month; /* month (1-12) */ int day; /* day of month (1-31) */ int hour; /* hour (0-23) */ int minute; /* minute (0-59) */ int second; /* second (0-59) */ int zone; /* time zone offset in minutes -- "+" or "-" */ int dst; /* daylight savings time (0 = no, 1 = yes) */ int weekday; /* real day of week (0-6; 0 = Sunday) */ int c_weekday; /* claimed day of week (0-6; 0 = Sunday) */ }; struct parsedate *parsedate(); remem-2.12/savutil/parsedate/README0000644000076500007650000000062207760625114012565 This directory contains source to the parsedate library included in the 'xjot' source code. Some of the source files have been modified to eliminate warnings when compiling with 'gcc -Wall'. In addition, dateyacc.y was modified to accept a few more variations on timezone specification. The original source files have been included with the suffix '.orig'. Jan Nelson, cabbage@media.mit.edu 1/19/97remem-2.12/savutil/saverror.c0000644000076500007650000000031307760625114011741 #include static void (*SE)(int, char *); void SavantError(int errcode, char *errstring) { (*SE)(errcode, errstring); } void SetSavantError(void (*newSEp)(int, char *)) { SE = newSEp; } remem-2.12/savutil/savutil.h0000644000076500007650000000375107760625114011603 /* savutil.h - types and externs for libsavutil.a */ #ifndef _SAVUTIL_H_ #define _SAVUTIL_H_ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include extern int SavantVerbose, SavantDebug; /*** Misc ***/ /*** Extern declarations ***/ /*from big.c */ extern size_t fread_big(void *, size_t, size_t, FILE *); extern size_t fwrite_big(void *, size_t, size_t, FILE *); size_t fcpy_big(FILE *dest_stream, size_t size, size_t num, FILE *stream); long ftell_end (FILE *stream); /* from opendie.c */ extern FILE *open_or_die(char *, char *, char *); #endif /* #ifndef _SAVUTIL_H_ */ remem-2.12/template/0000777000076500007650000000000010014272766010142 5remem-2.12/template/conftemplates.c0000644000076500007650000014324507760625115013103 /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "conftemplates.h" #include "plugins.h" /* Function definitions*/ /* these are shortcut macros to make definitions easier down below */ #define atfi(arg1, arg2, arg3, arg4, arg5) add_template_field_info(current_template, arg1, arg2, arg3, arg4, arg5) #define atfn(arg1, arg2, arg3, arg4, arg5, arg6) add_template_field_name(current_template, arg1, arg2, arg3, arg4, arg5, arg6) #define caf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) create_and_add_field(All_Fields, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) #define attl add_template_to_list(All_General_Templates, current_template); /* Global variables All_General_Templates is *the* List_of_General_Templates which contains all the templates in the system. All_Fields contain all the fields in the system. */ List_of_General_Templates *All_General_Templates; Array_of_Field_Types *All_Fields; /* Pull a field out by name instead of index */ Field *get_field_from_allfields(Array_of_Field_Types *aft, char *pname) { int i; for (i=0; i < aft->num_fields; i++) { if (strcmp(aft->field[i]->printname, pname) == 0) { return(aft->field[i]); } } return(NULL); } /* Create a new template, with an empty Template_Field_Info array. Make sure to strcpy all strings into malloced buffers */ General_Template *create_template (char *printname, char *recognize, char *delimiter, enum Action_Types action, enum Template_Types templatetype) { int i; General_Template *result; result = (General_Template *) malloc (sizeof(General_Template)); result->printname = strdup(printname); if (recognize != NULL) result->recognize = strdup(recognize); else result->recognize = NULL; if (delimiter != NULL) result->delimiter = strdup(delimiter); else result->delimiter = NULL; result->action = action; result->templatetype = templatetype; result->fields = (Template_Field_Info **) malloc(MAX_NUMBER_FIELDS * sizeof(Template_Field_Info *)); for (i=0; ifields[i] = NULL; } return result; } /* Print configuration (for debugging) */ void print_config () { int i; List_of_General_Templates *t; printf("All_Fields: \n"); for (i=0;i > All_Fields->num_fields; i++) { print_field(All_Fields->field[i]); } printf("All_General_Templates: \n"); for (t=All_General_Templates; t != NULL; t = t->next) { print_template(t->template); } } void print_field(Field *f) { printf ("...%s\n", f->printname); } void print_template(General_Template *t) { int i; Template_Field_Info **f; printf ("...%s\n", t->printname); printf ("......REC: %s\n", t->recognize); printf ("......DEL: %s\n", t->delimiter); printf ("......FIELDS: \n"); for (i=0, f=t->fields; (i < MAX_NUMBER_FIELDS) && (f[i] != NULL); i++) { print_template_field_info(f[i]); } } void print_template_field_info(Template_Field_Info *tfi) { printf (".........FIELD: %s\n", tfi->field->printname); printf ("............IDRXP: \"%s\"\n", tfi->id_regexp); printf ("............IDIND: %d\n", tfi->id_index); printf ("............BIAS: %d\n", tfi->bias); } /* This returns a template field info, given a template to search and the printname for that template. Returns NULL if not found. */ Template_Field_Info *tfi_from_name (General_Template *template, char *fieldname) { char errorstring[256]; int i=0; Template_Field_Info *current_info; while ((template->fields[i] != NULL) && (strcmp(template->fields[i]->field->printname, fieldname))) { i++; if (i>=MAX_NUMBER_FIELDS) { sprintf(errorstring, "maximum number of fields already reached"); SavantError (EOVERFLOW, errorstring); } } return(template->fields[i]); } /* This returns a field, given an array to search and the printname for that template. Returns NULL if not found. Pulls fields from the global "All_Fields". */ Field *field_from_name (char *fieldname) { int i; for (i=0; i < All_Fields->num_fields; i++) { if (!strcmp(All_Fields->field[i]->printname, fieldname)) { return (All_Fields->field[i]); } } return NULL; } /* Add a new template field info line, given a field name it's just a wrapper, really*/ void add_template_field_name (General_Template *template, char *fieldname, char *id_regexp, int id_index, char **filter_regexp, int bias, int title_length) { char errorstring[256]; Field *field; field = field_from_name (fieldname); if (field == NULL) { sprintf(errorstring, "add_template_field_name: No field %s found in All_Fields", fieldname); SavantError (EINVAL, errorstring); } add_template_field_info (template, field, id_regexp, id_index, filter_regexp, bias, title_length); } /* Add a new Template_Field_Info line to a template */ void add_template_field_info (General_Template *template, Field *field, char *i_regexp, int i_index, char **f_regexp, int b, int title_length) { int i=0; Template_Field_Info *current_info; char errorstring[256]; /*find the first open spot to insert the field info*/ while (template->fields[i] != NULL) { i++; /*safety check*/ if (i>=MAX_NUMBER_FIELDS) { sprintf(errorstring, "maximum number of fields already reached"); SavantError (EOVERFLOW, errorstring); } } current_info = (Template_Field_Info *) malloc(sizeof (Template_Field_Info)); current_info->field = field; current_info->id_regexp = i_regexp; current_info->id_index = i_index; current_info->filter_regexp = f_regexp; current_info->bias = b; current_info->title_length = title_length; template->fields[i] = current_info; } /* Take a template and tack it onto the end of a pre-existing list of templates*/ void add_template_to_list(List_of_General_Templates *list, General_Template *template) { List_of_General_Templates *tail; if (list->template == NULL){ template->typenum = 0; list->template = template; list->next = NULL; return; } else { for (tail=list; tail->next != NULL; tail = tail->next); template->typenum = (tail->template->typenum + 1); tail->next = (List_of_General_Templates *)(List_of_General_Templates *)malloc(sizeof(List_of_General_Templates)); tail->next->template = template; tail->next->next = NULL; return; } } /* creates the array of filter regexps. fills it with nulls*/ char **create_filter_regexp() { char **result; int i; if ((result = (char **) malloc (MAX_FILTER_REGEXPS*sizeof(char *))) == NULL) SavantError(ENOMEM, "Unable to malloc filter regexps in conftemplates.c"); for (i=0; i=MAX_FILTER_REGEXPS) { SavantError(ENOMEM, "maximum number of filter regexps already reached"); } } filter_array[i] = strdup(filter_regexp); } void free_template_field_info(Template_Field_Info *current_info ) { int i; free(current_info->id_regexp); for (i=0; current_info->filter_regexp[i] != NULL; i++) { free(current_info->filter_regexp[i]); } } /* Free memory pointed to by template (including all sub-fields and strings in the data struct) */ void free_template (General_Template *template) { int i; free(template->printname); free(template->recognize); free(template->delimiter); for(i=0; template->fields[i]!=NULL; i++) { free_template_field_info(template->fields[i]); } free(template); } /* conftemplates.h says that parser wants a pointer to self as well. Note: self (in parser) is a pointer to the field being parsed. We need it 'cause the encoder needs to know the field's typenum [Isn't taking in a pointer to the Array_of_Field_Types kind of redundant, since won't AoFT be global anyway? -- event] */ /* Create a field and add it to fieldArray, choosing the next fieldnum from the array and updating the Array's num_fields */ void create_and_add_field (Array_of_Field_Types *fieldArray, char *printname, enum Title_Defaults_Type titleDefault, void *(*parser)(char *fielddata, void *self, DB_UINT docnum), GBuffer *(*deparser)(void *parseddata, void *self), void (*index_store)(void *parseddata,/* Whatever is returned by parser */ char *dbdir, /* database directory */ int last_write_p),/* last_write_p == 1 if this is the end and we just want to finalize the write */ void *(*nextword)(void *parseddata, int reset_p), void (*update_sims_word)(void *word, Remem_Hash_Table *all_sims, void *self, Retrieval_Database_Info *rdi), void (*cleanup_parsed)(void *parseddata)) { Field *new_field; char errorstring[256]; if (fieldArray->num_fields >= MAX_NUMBER_FIELDS) { sprintf(errorstring, "create_and_add_field: already hit max number of fields (%d) when creating %s", MAX_NUMBER_FIELDS, printname); SavantError(ENOBUFS, errorstring); } new_field = (Field *) malloc(sizeof(Field)); new_field->typenum = fieldArray->num_fields; new_field->printname = printname; new_field->titleDefault = titleDefault; new_field->parser = parser; new_field->deparser = deparser; new_field->index_store = index_store; new_field->nextword = nextword; new_field->update_sims_word = update_sims_word; new_field->cleanup_parsed = cleanup_parsed; fieldArray->field[(fieldArray->num_fields)++] = new_field; } List_of_General_Templates *create_template_list() { List_of_General_Templates *result; result = (List_of_General_Templates *) malloc (sizeof(List_of_General_Templates)); result->template = NULL; result->next = NULL; return result; } Array_of_Field_Types *create_field_array() { int i; Array_of_Field_Types *result; result = (Array_of_Field_Types *)malloc (sizeof(Array_of_Field_Types)); result->num_fields = 0; result->field = (Field **) malloc (MAX_NUMBER_FIELDS * sizeof (Field *)); for(i=0; ifield[i] = NULL; } return result; } /* Create the templates, and point the global variable All_General_Templates at it. This procedure replaces the work that used to be done by loading .savantrc */ void load_config() { int i; General_Template *current_template; Field **fields; char **current_filter_regexps; char **email_body_filter_regexps; char **email_subject_filter_regexps; char **html_filter_regexps; char **latex_filter_regexps; char **email_from_filter_regexps; char **inspec_author_filter_regexps; char **globe_author_filter_regexps; char **globe_body_filter_regexps; /*Initializing the field and template stuff */ All_Fields = create_field_array(); All_General_Templates = create_template_list(); /* Initialize Configuration stuff */ Config.ellipses = 1; Config.source_field_width = 20; Config.index_dotfiles = 0; /*Initializing the template stuff*/ /* Add in all the fields */ /* printname parser deparser index_store nextword word_similarity cleanup_parsed */ /* PLUG-IN API: ------------------------ parser: void *parser (char *fielddata, void *self, DB_UINT docnum) Parse a field from an indexed document or from a query. Turn it into machine readable format. fielddata: a string of data for a field as it comes from the document (after filtering). E.g. the raw text from the body of an email message. self: actually of type (Field *). This can be used to encode different fields differently, or ignored. E.g. in text we encode the top 6 bits as a typenum, so we don't compare BODY text with SUBJECT text. docnum: The document number. This is a serial number, one per doc. RETURNS: the parser returns a void *, which contains some machine readable structure used by deparser, index_store, nextword, and cleanup_parsed. ------------------------ deparser: GBuffer *deparser (void *parsedata, void *self) Take field data output from the parser and turn it into printabe text (for debugging / feedback). parsedata: a pointer to parsed data. This is of the type returned by parser. self: actually of type (Field *). This is the field of this data (and can be ignored if not needed). RETURNS: a GBuffer (growable string type) containing human-readable text representing this parsed field data. This is mainly used for debugging strings (printed with the -d option). ------------------------ index_store: void index_store (void *parsedata, char *dbdir, int last_write_p) Take field data output from the parser and store it to disk. parsedata: a pointer to parsed data. This is of the type returned by parser, and contains the info to be indexed. dbdir: a string containing the fully expanded directory name of the index files. This is the directory where all the files should be written. Temporary scratch files can be written here as well, though they should be deleted after the final write. last_write_p: this is set to 1 if this is the final write (allowing you to close files, merge checkpoint files, delete scratch files, etc). RETURNS: nothing. However, this function should write this field info to disk in whatever format is most suited for fast later retrieval. ------------------------ nextword: void *nextword (void *parsedata, int reset_p) An iterator: Take field data output from the parser and return the next "word" from the parsed output. Word is loosly defined as a single element, e.g. a single word, GPS location, date, person's name, etc. nextword is only called on a query field during retrieval, not on indexed document fields. parsedata: a pointer to parsed data. This is of the type returned by parser. reset_p: if reset_p == 1, start with the first word of this parsed data. Otherwise, return the next one. nextword is responsible for keeping it's own place (via static memory, presumably). Yes, it's icky, but it works. RETURNS: The word type includes any info that might be needed by the retrieval system, e.g. word weight, machine readable version of the word, normalization info, etc. The word might also contain a human-readable version of the word, for filling into the top contributors keyword list by update_sims_word. The return value is used by update_sims_word during retrieval. Return NULL when there are no more "words." ------------------------ update_sims_word: void update_sims_word (void *word, Remem_Hash_Table *all_sims, void *field, Retrieval_Database_Info *rdi) A proceedure that takes a word at a time and updates (adds to) an array of document similarities. This proceedure can be any algorithm so long as it can handle updating a document similarity one word at a time, without seeing all the other words. (This is for the interests of speed. If you actually need global knowledge, like say the length of a query or document for normalization, you can squirrel it away either in the index files format for this type or in the value returned by nextword.) Called during query retrieval, not indexing. update_sims_word also needs to update the Top_Contributors list, which contains the similarity and printname of each word that contributed the most to choosing this document. word: the single word that is potentially adding weight to a document. Of the type returned by nextword. all_sims: an array of similarities, indexed by docnum. Similarities include an array of "top contributors" to a document being chosen (used for user feedback of why this document was chosen). field: actually of type (Field *). This is the field of this data (and can be ignored if not needed). This might be useful to grab other function pointers. rdi: Document info that might be useful to an information-retrieval algorithm. Things like total number of documents plus the expanded path for the index files so they can be opened. ------------------------ cleanup_parsed: void cleanup_parsed (void *parseddata) Free all the memory allocated by the parser routine. parsedata: a pointer to parsed data. This is of the type returned by parser. */ caf("BODY", BLANK_TITLE, &parse_text, &deparse_text, &index_store_text, &nextword_text, &update_sims_word_text_okapi, &free_parsed_text); /* caf("BODY", BLANK_TITLE, &parse_text, &deparse_text, &index_store_text, &nextword_text, &update_sims_word_text_tfidf, &free_parsed_text); */ caf("LOCATION", BLANK_TITLE, &parse_text_nostopstem, &deparse_text, &index_store_text, &nextword_text, &update_sims_word_text_tfidf, &free_parsed_text); /* caf("DATE", MODTIME_TITLE, &parse_date, &deparse_date, &index_store_date, &nextword_date, NULL, &free_parsed_date);*/ /* caf("DATE", MODTIME_TITLE, NULL, NULL, NULL, NULL, NULL, NULL); */ caf("DATE", BLANK_TITLE, NULL, NULL, NULL, NULL, NULL, NULL); caf("TIME", MODTIME_TITLE, NULL, NULL, NULL, NULL, NULL, NULL); caf("DAY", BLANK_TITLE, NULL, NULL, NULL, NULL, NULL, NULL); caf("SUBJECT", FILENAME_TITLE, &parse_text, &deparse_text, &index_store_text, &nextword_text, &update_sims_word_text_okapi, &free_parsed_text); caf("PERSON", OWNER_TITLE, &parse_text_nostopstem, &deparse_text, &index_store_text, &nextword_text, &update_sims_word_text_tfidf, &free_parsed_text); /* Make a nice alias for the actual array of fields */ fields = All_Fields->field; /* Template definition: current_template = create_template(, , , , ); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, ); add_filter_regexp(current_filter_regexps, ); ... add_filter_regexp(current_filter_regexps, ); atfn(, , , current_filter_regexps, ); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, ); add_filter_regexp(current_filter_regexps, ); ... add_filter_regexp(current_filter_regexps, ); atfn(, , , current_filter_regexps, ); attl; ... next template current_template = create_template(, , , , ); ... etc ... */ /* the following comment might be useful in some location or other */ /* Field id_regexp id_index filter_regexp bias*/ /* Make the templates*/ /*******************************/ /* RMAIL template */ /*******************************/ current_template = create_template("RMAIL", "BABYL OPTIONS", "(^|\n) ", ACCEPT_ACTION, INDEX_TYPE); email_body_filter_regexps = create_filter_regexp(); /* Filters for email bodies */ /* Included headers in forwarded email */ /* Note the {0,100} at the end -- this sanity check keeps pcre from blowing up if, say, you're given an email body with thousands of lines of code all indented so it thinks it's all one header */ add_filter_regexp(email_body_filter_regexps, "(^|\n)(\\ |\\t|\\>)*[a-zA-Z]+[a-zA-Z\\-\\;]*:([^\n]*)(\n(\\ |\\t|\\>)([^\n]*)){0,100}"); /* Signature files. The standard is "\n-- \n". I'm including forwards-indented versions as well, plus some non-standards like a line of 5+ non-text, followed by 1-5 lines whatever, followed by another line of non-text */ add_filter_regexp(email_body_filter_regexps, "(^|\n)--( ){0,1}\n([^\n]*(\n|$)){1,8}([^\n]*$)"); add_filter_regexp(email_body_filter_regexps, "(^|\n)[>\\s]+--( ){0,1}\n([^\n]*(\n|$)){1,8}([^\n]*$)"); add_filter_regexp(email_body_filter_regexps, "(^|\n)[^a-zA-Z0-9\n]{5,}\n([^\n]*(\n|$)){1,8}([^a-zA-Z0-9\n]{5,}\n)"); add_filter_regexp(email_body_filter_regexps, "(^|\n)[^a-zA-Z0-9\n]{5,}\n([^\n]*(\n|$)){1,8}([^\n]*$)"); /* A few specific useless phrases */ add_filter_regexp(email_body_filter_regexps, "^EMACS REMEMBRANCE QUERY MODE:.*?($|\n)"); add_filter_regexp(email_body_filter_regexps, "(^|\n)(\\W)*Unsent message follows(\\W)*?\n"); add_filter_regexp(email_body_filter_regexps, "(^|\n)(\\W)*This is a multi-part message in MIME format\\.(\\W)*?\n"); add_filter_regexp(email_body_filter_regexps, "(^|\n)[^a-zA-Z0-9\n]*(B|b)egin (F|f)orwarded[^\n]*\n"); add_filter_regexp(email_body_filter_regexps, "(^|\n)[^a-zA-Z0-9\n]*(E|e)nd (F|f)orwarded[^\n]*\n"); add_filter_regexp(email_body_filter_regexps, "(^|\n)This message is in MIME format. Since your mail reader does not understand\nthis format, some or all of this message may not be legible."); /* ------ headers ------ */ /* and */ /* -----------94C4424FBB52619DF028A003 */ /* and */ /* *** EOOH *** */ add_filter_regexp(email_body_filter_regexps, "(^|\n)(\\ |\\t|\\>)*(\\-|\\*)+([\\w|\\ |\\t]*)([^a-zA-Z0-9\n])*?\n"); add_filter_regexp(email_body_filter_regexps, "(^|\n)(\\ |\\t|\\>)*(\\-|\\*|\\+|\\=){3,}([\\w|\\ |\\t]*)([a-zA-Z0-9])*[\\ |\\t|\\-|\\*|\\+|\\=]*\n"); /* And any other sort of headers that start: Path: here or X-Bla-Bla: do do do */ add_filter_regexp(email_body_filter_regexps, "(^|\n)[A-Z]([a-zA-Z\\-])*: [^\n]*"); atfn("BODY", "\n\n(.*)$", 1, email_body_filter_regexps, 4, 0); email_subject_filter_regexps = create_filter_regexp(); add_filter_regexp(email_subject_filter_regexps, "^(\\ )*\\[[\\ a-zA-Z0-9\\.]*?\\@[a-zA-Z0-9\\.]*?\\: "); add_filter_regexp(email_subject_filter_regexps, "^\\{.*?\\} "); atfn("SUBJECT", "(^|\n)Subject:\\s*(.*?\n)\\S", 2, email_subject_filter_regexps, 1, 90); email_from_filter_regexps = create_filter_regexp(); add_filter_regexp(email_from_filter_regexps, "^[^<]*<"); add_filter_regexp(email_from_filter_regexps, "@[^@]*"); atfn("PERSON", "(^|\n)From:\\s*(.*?\n)\\S", 2, email_from_filter_regexps, 1, 50); atfn("DATE", "(^|\n)Date:\\s*(.*?\n)\\S", 2, NULL, 1, 40); attl; /**********************/ /* GLOBE */ /**********************/ current_template = create_template("Globe", "^Title: ", NULL, ACCEPT_ACTION, INDEX_TYPE); atfn("SUBJECT", "^Title:\\s+(.*?)\n", 1, NULL, 2, 90); globe_author_filter_regexps = create_filter_regexp(); add_filter_regexp(globe_author_filter_regexps, "By "); add_filter_regexp(globe_author_filter_regexps, "Globe Staff"); add_filter_regexp(globe_author_filter_regexps, "\\("); add_filter_regexp(globe_author_filter_regexps, "\\)"); add_filter_regexp(globe_author_filter_regexps, "Associated Press"); atfn("PERSON", "\nSource:\\s+(.*?)\n", 1, globe_author_filter_regexps, 1, 50); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, " \\d{9,9}"); atfn("DATE", "\nDate:\\s+(.*?)\n", 1, current_filter_regexps, 1, 15); globe_body_filter_regexps = create_filter_regexp(); add_filter_regexp(globe_body_filter_regexps, "Title:.*?\n"); add_filter_regexp(globe_body_filter_regexps, "Date:.*?\n"); add_filter_regexp(globe_body_filter_regexps, "SOURCE:.*?\n"); add_filter_regexp(globe_body_filter_regexps, "KEYWORDS:.*?\n"); atfn("BODY", "(.*)", 1, globe_body_filter_regexps, 2, 0); attl; /* add_template_to_list */ /********************************************/ /* Tech article HTML template */ /********************************************/ current_template = create_template("tech_article", "\n", NULL, ACCEPT_ACTION, INDEX_TYPE); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, "<[^>]*>"); /* HTML Tags (, mostly */ add_filter_regexp(current_filter_regexps, "&(\\x23\\d+|\\w+);"); /*   and the like */ atfn("SUBJECT", "(|<TITLE>)(.*?)(|)(.*)", 2, current_filter_regexps, 1, 90); atfn("PERSON", "^$", 1, NULL, 1, 20); /* Never matches, but forces the title to use a default */ current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, "Monday\\s*,\\s*"); add_filter_regexp(current_filter_regexps, "Tuesday\\s*,\\s*"); add_filter_regexp(current_filter_regexps, "Wednesday\\s*,\\s*"); add_filter_regexp(current_filter_regexps, "Thursday\\s*,\\s*"); add_filter_regexp(current_filter_regexps, "Friday\\s*,\\s*"); add_filter_regexp(current_filter_regexps, "Saturday\\s*,\\s*"); add_filter_regexp(current_filter_regexps, "Sunday\\s*,\\s*"); add_filter_regexp(current_filter_regexps, "Monday\\s*\\.\\s*"); add_filter_regexp(current_filter_regexps, "Tuesday\\s*\\.\\s*"); add_filter_regexp(current_filter_regexps, "Wednesday\\s*\\.\\s*"); add_filter_regexp(current_filter_regexps, "Thursday\\s*\\.\\s*"); add_filter_regexp(current_filter_regexps, "Friday\\s*\\.\\s*"); add_filter_regexp(current_filter_regexps, "Saturday\\s*\\.\\s*"); add_filter_regexp(current_filter_regexps, "Sunday\\s*\\.\\s*"); add_filter_regexp(current_filter_regexps, "^ "); atfn("DATE", "This (story||comic||photograph) was( originally||) published on (.*?)\\.", 3, current_filter_regexps, 1, 20); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, "Copyright [^\n]*The Tech. All rights reserved.*"); add_filter_regexp(current_filter_regexps, "This (story||comic||photograph) was( originally||) published on.*"); add_filter_regexp(current_filter_regexps, ""); /* Comments */ add_filter_regexp(current_filter_regexps, "<[^>]*>"); /* Tags */ add_filter_regexp(current_filter_regexps, "&(\\x23\\d+|\\w+);"); /*   and the like */ /* We can't rely on valid HTML with a body tag, so just do the whole thing and throw out the tags */ atfn("BODY", "(.*)", 1, current_filter_regexps, 1, 0); attl; /*******************************/ /* HTML template */ /*******************************/ current_template = create_template("HTML", "|<TITLE>|<html>|<HTML>|<a href=|<A HREF=|<p>|<P>", NULL, ACCEPT_ACTION, INDEX_TYPE); html_filter_regexps = create_filter_regexp(); add_filter_regexp(html_filter_regexps, "<!--.*?-->"); /* Comments */ add_filter_regexp(html_filter_regexps, "<[^>]*>"); /* Tags */ add_filter_regexp(html_filter_regexps, "&(\\x23\\d+|\\w+);"); /*   and the like */ add_filter_regexp(html_filter_regexps, "(^|\n)EMACS REMEMBRANCE QUERY MODE:.*?($|\n)"); add_filter_regexp(html_filter_regexps, "(^|\n)WEBRA REMEMBRANCE QUERY MODE.*?($|\n)"); atfn("SUBJECT", "(<title>|<TITLE>)(.*?)(|)(.*)", 2, html_filter_regexps, 1, 90); atfn("PERSON", "^$", 1, NULL, 1, 20); /* Never matches, but forces the title to use a default */ /* We can't rely on valid HTML with a body tag, so just do the whole thing and throw out the tags */ atfn("BODY", "(.*)", 1, html_filter_regexps, 1, 0); attl; /************************************/ /* Unix Email template */ /************************************/ current_template = create_template("unix_email", "(^|\n)From ", "(^|\n)From ", ACCEPT_ACTION, INDEX_TYPE); /* mime, html, pgp, vcard (ie? Netscape?), attachement */ atfn("BODY", "(\r\n\r\n|\n\n)(.*)$", 2, email_body_filter_regexps, 4, 0); /* \r's so it can handle DOS-files */ atfn("SUBJECT", "\nSubject:\\s*(.*?\n)\\S", 1, email_subject_filter_regexps, 1, 90); atfn("PERSON", "\nFrom:\\s*(.*?)\n\\S", 1, email_from_filter_regexps, 1, 50); atfn("DATE", "(^|\n)From \\S*\\s*(.*?\n)", 2, NULL, 1, 40); attl; /************************************/ /* Athena Email template */ /************************************/ current_template = create_template("athena_email", "Received: from", NULL, ACCEPT_ACTION, INDEX_TYPE); atfn("DATE", "\nDate: (.*?)(\\s*?)\n", 1, NULL, 1, 50); atfn("PERSON", "\nFrom:(.*?)\n", 1, NULL, 1, 50); atfn("SUBJECT", "Subject:(.*?)\n", 1, email_subject_filter_regexps, 1, 50); atfn("BODY", "\n\n(.*)$", 1, email_body_filter_regexps, 4, 0); attl; /*******************************/ /* Jimminy template */ /*******************************/ current_template = create_template("Jimminy", "------------------------(^|\n)Jimminy-header <", "(^|\n)Jimminy-header <", ACCEPT_ACTION, INDEX_TYPE); atfn("LOCATION", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 2, NULL, 1, 20); atfn("PERSON", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 3, NULL, 1, 50); atfn("SUBJECT", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 4, NULL, 1, 50); atfn("DATE", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 5, NULL, 1, 40); atfn("DAY", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 5, NULL, 1, 0); atfn("TIME", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 5, NULL, 1, 0); atfn("BODY", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>(.*)$", 6, NULL, 1, 20); attl; /* add_template_to_list */ /*******************************/ /* Edupage Archive template */ /*******************************/ current_template = create_template("Edupage-Archive", "Edupage|<TITLE>EDUCAUSE", "<A NAME=\\\".*?\\\">", ACCEPT_ACTION, INDEX_TYPE); atfn("SUBJECT", "<B>(.*?)</B>", 1, NULL, 1, 50); atfn("DATE", "(\\d+ [A-Z][a-z][a-z] \\d+)", 1, NULL, 1, 12); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, "<!--.*?-->"); add_filter_regexp(current_filter_regexps, "<[^>]*>"); add_filter_regexp(current_filter_regexps, "&(\\x23\\d+|\\w+);"); add_filter_regexp(current_filter_regexps, "Edupage is written by.*"); atfn("BODY", "(.*)", 1, current_filter_regexps, 1, 0); attl; /**********************/ /* LaTeX */ /**********************/ current_template = create_template("LaTeX", "\\\\documentstyle|\\\\documentclass", NULL, ACCEPT_ACTION, INDEX_TYPE); atfn("SUBJECT", "\\\\title\\{(.*?)\\}", 1, NULL, 1, 20); latex_filter_regexps = create_filter_regexp(); add_filter_regexp(latex_filter_regexps, "\\\\(\\S*?)\{(.*?)\\}"); add_filter_regexp(latex_filter_regexps, "^\\%\n"); add_filter_regexp(latex_filter_regexps, "(^|\n)EMACS REMEMBRANCE QUERY MODE:.*?($|\n)"); atfn("BODY", "\\\\begin\\{document\\}(.*)\\\\end\\{document\\}", 1, latex_filter_regexps, 1, 0); attl; /**********************/ /* INSPEC */ /**********************/ current_template = create_template("INSPEC", "^<\\d+>\nAccession Number", "(^|\n)<\\d+>\n", ACCEPT_ACTION, INDEX_TYPE); /* Remove initials (commented out right now) */ inspec_author_filter_regexps = create_filter_regexp(); add_filter_regexp(inspec_author_filter_regexps, " [^\\s]+[;.,]"); atfn("PERSON", "\nAuthor\n (.*?)\n\\S", 1, inspec_author_filter_regexps, 1, 50); atfn("SUBJECT", "\nTitle\n (.*?)\n\\S", 1, NULL, 1, 90); atfn("LOCATION", "\nSource\n (.*?)\n\\S", 1, NULL, 1, 0); atfn("DATE", "\n(Conference Information|Source)\n (.*?)(Jan\\S*\\s+[12][90]\\d\\d|Feb\\S*\\s+[12][90]\\d\\d|Mar\\S*\\s+[12][90]\\d\\d|Apr\\S*\\s+[12][90]\\d\\d|May\\S*\\s+[12][90]\\d\\d|Jun\\S*\\s+[12][90]\\d\\d|Jul\\S*\\s+[12][90]\\d\\d|Aug\\S*\\s+[12][90]\\d\\d|Sep\\S*\\s+[12][90]\\d\\d|Oct\\S*\\s+[12][90]\\d\\d|Nov\\S*\\s+[12][90]\\d\\d|Dec\\S*\\s+[12][90]\\d\\d)(.*?)\n\\S", 3, NULL, 1, 15); atfn("BODY", "\nAbstract\n (.*)", 1, NULL, 4, 0); attl; /* add_template_to_list */ /**********************/ /* ACM */ /**********************/ current_template = create_template("ACM", "^ACM Electronic Guide to Computing Literature April 1998\n\n", "(^|\n)Type: ", ACCEPT_ACTION, INDEX_TYPE); atfn("PERSON", "\nAuthor:\\s+(.*?)\n", 1, NULL, 1, 50); atfn("SUBJECT", "\nTitle:\\s+(.*?)\n", 1, NULL, 1, 90); atfn("BODY", "\n(Keywords|Title):\\s+(.*?)\n", 2, NULL, 1, 0); atfn("DATE", "\nDate:\\s+(.*?)\n", 1, NULL, 1, 15); attl; /* add_template_to_list */ /**********************/ /* PostScript */ /**********************/ current_template = create_template("PostScript", "^\\%\\!PS", NULL, REJECT_ACTION, INDEX_TYPE); attl; /**********************/ /* Framemaker */ /**********************/ current_template = create_template("FrameMaker", "^<MIFFile ", NULL, REJECT_ACTION, INDEX_TYPE); attl; /**********************/ /* PDF */ /**********************/ current_template = create_template("PDF", "^\\%PDF-", NULL, REJECT_ACTION, INDEX_TYPE); attl; /**********************/ /* HQX */ /**********************/ current_template = create_template("HQX", "^\\(This file must be converted with BinHex ", NULL, REJECT_ACTION, INDEX_TYPE); attl; /**********************/ /* RCS-CONTROL */ /**********************/ current_template = create_template("RCS-Control", "^head(.*?)\naccess(.*?)\n(.*)symbols(.*)\n", NULL, REJECT_ACTION, INDEX_TYPE); attl; /***************************/ /* Plain Text (default) */ /***************************/ current_template = create_template("plain_text", ".", /* Always recognize (default) */ NULL, /* No delimiter */ ACCEPT_ACTION, INDEX_TYPE); atfn("BODY", "(.*)", 1, NULL, 1, 20); atfn("SUBJECT", "^$", 1, NULL, 1, 20); /* Never matches, but forces the title to use a default */ atfn("DATE", "^$", 1, NULL, 1, 20); /* Never matches, but forces the title to use a default */ atfn("PERSON", "^$", 1, NULL, 1, 20); /* Never matches, but forces the title to use a default */ attl; /***************** Query Templates *******************/ /*********************************************/ /* RMAIL / VM Query Template */ /*********************************************/ current_template = create_template("RmailorVMQuery", "^EMACS REMEMBRANCE QUERY MODE: (rmail|vm)", NULL, ACCEPT_ACTION, QUERY_TYPE); atfn("BODY", "(.*)", 1, email_body_filter_regexps, 4, 10); /* Grab it all, 'cause we might not be at the top anyway */ atfn("SUBJECT", "Subject:(.*?)\n", 1, email_subject_filter_regexps, 1, 50); atfn("PERSON", "From:(.*?)\n", 1, email_from_filter_regexps, 1, 50); atfn("DATE", "Date:(.*?)\n", 1, NULL, 1, 40); attl; /*********************************************/ /* MAIL Query Template */ /*********************************************/ current_template = create_template("MailQuery", "^EMACS REMEMBRANCE QUERY MODE: mail", NULL, ACCEPT_ACTION, QUERY_TYPE); atfn("BODY", "(.*)", 1, email_body_filter_regexps, 4, 10); atfn("SUBJECT", "Subject:(.*?)\n", 1, email_subject_filter_regexps, 1, 50); atfn("DATE", "Date:(.*?)\n", 1, NULL, 1, 40); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, "@[^@ \\,\n]*"); add_filter_regexp(current_filter_regexps, "\\(.*?\\)"); add_filter_regexp(current_filter_regexps, "[^<\\,\n]*<"); atfn("PERSON", "To:(.*?)\n\\S", 1, current_filter_regexps, 1, 50); attl; /*********************************************/ /* GNUS Query Template */ /*********************************************/ current_template = create_template("GnusQuery", "^EMACS REMEMBRANCE QUERY MODE: gnus", NULL, ACCEPT_ACTION, QUERY_TYPE); atfn("BODY", "(.*)", 1, email_body_filter_regexps, 4, 10); /* Grab it all, 'cause we might not be at the top anyway */ atfn("SUBJECT", "Subject:(.*?)\n", 1, email_subject_filter_regexps, 1, 50); atfn("PERSON", "From:(.*?)\n", 1, email_from_filter_regexps, 1, 50); atfn("DATE", "Date:(.*?)\n", 1, NULL, 1, 40); attl; /*************************************/ /* Webra HTML Query template */ /*************************************/ current_template = create_template("WebraHTMLQuery", "^WEBRA REMEMBRANCE QUERY MODE", NULL, ACCEPT_ACTION, QUERY_TYPE); /* These might be partial HTML (i.e. one section), so section headers count for "subject" */ /* However, since sub-headers tend to be mundain things like "project list" instead of useful info, we're only looking at title and h1's. */ current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, "[Hh]ome"); /* "Home page" are stop words for this domain */ add_filter_regexp(current_filter_regexps, "[Pp]age"); /* "Home page" are stop words for this domain */ atfn("SUBJECT", "(<title>|<TITLE>|<h1>|<H1>|<h2>|<H2>)(.*?)(|||||)", 2, current_filter_regexps, 1, 20); /* If there's a mailto, grab the email address. Of course, we're running into an ontology problem here -- person might mean email address, or it might mean a full name (like in the INSPEC database). If query and indexed file mismatch it doesn't work. Proper thing to do is have a translator like with ZWrap -- I'm just punting. */ atfn("PERSON", "(mailto:)(\\s*)([\\w\\.]*?)(@[^@\\s]*)", 3, NULL, 1, 10); /* We can't rely on valid HTML with a body tag, so just do the whole thing and throw out the tags */ /* As with email, body is more important than other fields because it's a fuzzier match. Subject is also not a real good match for web pages, as the title often is incomplete. */ atfn("BODY", "(.*)", 1, html_filter_regexps, 5, 0); attl; /*************************************/ /* HTML Query template */ /*************************************/ current_template = create_template("HTMLQuery", "^EMACS REMEMBRANCE QUERY MODE: html-mode", NULL, ACCEPT_ACTION, QUERY_TYPE); atfn("SUBJECT", "(|<TITLE>)(.*?)(|)(.*)", 2, NULL, 1, 20); /* We can't rely on valid HTML with a body tag, so just do the whole thing and throw out the tags */ atfn("BODY", "(.*)", 1, html_filter_regexps, 1, 0); attl; /************************************/ /* LaTeX Query template */ /************************************/ current_template = create_template("LaTeXQuery", "^EMACS REMEMBRANCE QUERY MODE: latex-mode", NULL, ACCEPT_ACTION, QUERY_TYPE); atfn("SUBJECT", "(\\\\title|\\\\section|\\\\subsection)\\{(.*?)\\}", 2, NULL, 1, 20); atfn("BODY", "(.*)", 1, latex_filter_regexps, 1, 0); /* Grab it all, 'cause we might not be at the top anyway */ attl; /***************************/ /* INSPEC Query */ /***************************/ current_template = create_template("INSPECQuery", "^<\\d+>\nAccession Number", NULL, ACCEPT_ACTION, QUERY_TYPE); atfn("PERSON", "\nAuthor\n (.*?)\n\\S", 1, NULL, 1, 50); atfn("SUBJECT", "\nTitle\n (.*?)\n\\S", 1, NULL, 1, 90); atfn("LOCATION", "\nSource\n (.*?)\n\\S", 1, NULL, 1, 0); atfn("DATE", "\n(Conference Information|Source)\n (.*?)(Jan\\S*\\s+[12][90]\\d\\d|Feb\\S*\\s+[12][90]\\d\\d|Mar\\S*\\s+[12][90]\\d\\d|Apr\\S*\\s+[12][90]\\d\\d|May\\S*\\s+[12][90]\\d\\d|Jun\\S*\\s+[12][90]\\d\\d|Jul\\S*\\s+[12][90]\\d\\d|Aug\\S*\\s+[12][90]\\d\\d|Sep\\S*\\s+[12][90]\\d\\d|Oct\\S*\\s+[12][90]\\d\\d|Nov\\S*\\s+[12][90]\\d\\d|Dec\\S*\\s+[12][90]\\d\\d)(.*?)\n\\S", 3, NULL, 1, 15); atfn("BODY", "\nAbstract\n (.*)", 1, NULL, 4, 0); attl; /* add_template_to_list */ /*************************************/ /* Jimminy Query template */ /*************************************/ current_template = create_template("JimminyQuery", "^JIMMINY REMEMBRANCE QUERY MODE", NULL, ACCEPT_ACTION, QUERY_TYPE); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, "(^|\n)Jimminy-header <.*?\n"); add_filter_regexp(current_filter_regexps, "(^|\n)Jimminy-query-header <.*?\n"); add_filter_regexp(current_filter_regexps, "^JIMMINY REMEMBRANCE QUERY MODE"); atfn("LOCATION", "(^|\n)Jimminy-query-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 2, NULL, 1, 20); atfn("PERSON", "(^|\n)Jimminy-query-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)", 3, NULL, 1, 20); atfn("SUBJECT", "(^|\n)Jimminy-query-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 4, NULL, 1, 50); atfn("DATE", "(^|\n)Jimminy-query-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 5, NULL, 1, 40); atfn("DAY", "(^|\n)Jimminy-query-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 5, NULL, 1, 0); atfn("TIME", "(^|\n)Jimminy-query-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 5, NULL, 1, 0); atfn("BODY", "(.*)", 1, current_filter_regexps, 4, 20); attl; /* This is the old query format using just the normal jimminy header. Now if you're using Jimminy you should be using the special hacks that put the current physical context in a unique format, so it can be different than the header of whatever you're reading. */ /* current_template = create_template("JimminyQuery", "------------------------(^|\n)Jimminy-header <", NULL, ACCEPT_ACTION, QUERY_TYPE); atfn("LOCATION", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 2, NULL, 1, 20); atfn("PERSON", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 3, NULL, 1, 20); atfn("SUBJECT", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 4, NULL, 1, 50); atfn("DATE", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 5, NULL, 1, 40); atfn("DAY", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 5, NULL, 1, 0); atfn("TIME", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>", 5, NULL, 1, 0); atfn("BODY", "(^|\n)Jimminy-header <(.*?)\\|(.*?)\\|(.*?)\\|(.*?)>(.*?)($|\nJimminy-header)", 6, NULL, 4, 20); attl; */ /*********************************************/ /* Emacs Manual Query */ /*********************************************/ current_template = create_template("Emacs_Manual_Query", "^EMACS REMEMBRANCE QUERY MODE: remem-query-mode", NULL, /* No delimiter */ ACCEPT_ACTION, QUERY_TYPE); atfn("SUBJECT", "(^|\n)Subject: (.*?)(\nPerson: )", 2, NULL, 1, 10); atfn("PERSON", "(^|\n)Person: (.*?)(\nLocation: )", 2, NULL, 1, 10); atfn("LOCATION", "(^|\n)Location: (.*?)(\nDate: )", 2, NULL, 1, 10); atfn("DATE", "(^|\n)Date: (.*?)(\nBody: )", 2, NULL, 1, 10); atfn("TIME", "(^|\n)Date: (.*?)(\nBody: )", 2, NULL, 1, 10); atfn("DAY", "(^|\n)Date: (.*?)(\nBody: )", 2, NULL, 1, 10); atfn("BODY", "(^|\n)Body: (.*)", 2, NULL, 4, 10); attl; /*********************************************/ /* Emacs Field Query */ /*********************************************/ current_template = create_template("Emacs_Field_Query", "^EMACS REMEMBRANCE FIELD QUERY:", NULL, /* No delimiter */ ACCEPT_ACTION, QUERY_TYPE); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, "(^|\n)EMACS REMEMBRANCE FIELD QUERY:"); atfn("BODY", "(^|\n)\\!BODY:(.*)($|\n\\!)", 2, current_filter_regexps, 4, 10); atfn("LOCATION", "(^|\n)\\!LOCATION:(.*)($|\n\\!)", 2, current_filter_regexps, 1, 10); atfn("DATE", "(^|\n)\\!DATE:(.*)($|\n\\!)", 2, current_filter_regexps, 1, 10); atfn("TIME", "(^|\n)\\!TIME:(.*)($|\n\\!)", 2, current_filter_regexps, 1, 10); atfn("DAY", "(^|\n)\\!DAY:(.*)($|\n\\!)", 2, current_filter_regexps, 1, 10); atfn("SUBJECT", "(^|\n)\\!SUBJECT:(.*)($|\n\\!)", 2, current_filter_regexps, 1, 10); atfn("PERSON", "(^|\n)\\!PERSON:(.*)($|\n\\!)", 2, current_filter_regexps, 1, 10); attl; /***************************************************/ /* Generic Emacs Text Query Template */ /***************************************************/ current_template = create_template("Unknown_Emacs_Query", "^EMACS REMEMBRANCE QUERY MODE: ", NULL, /* No delimiter */ ACCEPT_ACTION, QUERY_TYPE); current_filter_regexps = create_filter_regexp(); add_filter_regexp(current_filter_regexps, "(^|\n)EMACS REMEMBRANCE QUERY MODE:.*?\n"); atfn("BODY", "(.*)", 1, current_filter_regexps, 4, 10); attl; /*********************************************/ /* Generic Text Query Template */ /*********************************************/ current_template = create_template("TextQuery", ".", /* Always recognize (default) */ NULL, /* No delimiter */ ACCEPT_ACTION, QUERY_TYPE); atfn("BODY", "(.*)", 1, NULL, 1, 10); attl; } remem-2.12/template/conftemplates.h0000644000076500007650000002462007760625115013103 #ifndef _CONFTEMPLATES_H_ #define _CONFTEMPLATES_H_ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include "gbuf.h" #include "hash.h" extern int SavantVerbose, SavantDebug; #define RECOGNIZE_LIMIT 500 /* num characters to look for recognition in */ #ifndef EOVERFLOW #define EOVERFLOW E2BIG #endif /* config stuff */ #define MAX_NUMBER_FIELDS 24 /* Max number of distinct field, and max number fields per template */ #define MAX_FIELD_NAME_LENGTH 30 /* Number of characters max in a field printname */ #define MAX_FILTER_REGEXPS 50 #define NUMBER_CONTRIBUTORS_TRACKED 5 /* Number of contributors kept track of for user feedback */ #define PRINTWORD_LENGTH 15 /* number of characters to use for a printable version of a "word" in feedback */ /* Title default information: what should we use for a field entry in a title if the field is blank? */ enum Title_Defaults_Type {BLANK_TITLE, FILENAME_TITLE, OWNER_TITLE, MODTIME_TITLE}; /* Contains the elements ("words") that contributed the most to a single contributor */ typedef struct _Top_Contributors { float sim; /* Similarity this contributed */ char printword[PRINTWORD_LENGTH]; /* What is this word anyway? */ } Top_Contributors; /* Mentioned in Field typedef -- used in retrieval */ typedef struct _Doc_Sim { DB_UINT docnum; float sim; /* number between 0.0 and 1.0 */ float sim_breakdown[MAX_NUMBER_FIELDS]; Top_Contributors top_contributors[NUMBER_CONTRIBUTORS_TRACKED]; } Doc_Sim; /* The docsim, plus a breakdown of how each field contributed */ typedef struct _Doc_Sim_Totals { Doc_Sim docsim; float sim_breakdown[MAX_NUMBER_FIELDS]; } Doc_Sim_Totals; /* This is all the info about the index database that you might want to compute once and pass to updaters. Generic info only (no fieldtype specific stuff) */ typedef struct _Retrieval_Database_Info { int number_documents_total; /* Total number of documents */ char *db_dir; /* Expanded path of index files */ } Retrieval_Database_Info; /* All the user-preferance variables (1 = true, 0 = false) */ typedef struct { int source_field_width; int ellipses; int index_dotfiles; } UserVars; extern UserVars Config; /* Field: info on a generic field (independent of what file type it's in) */ typedef struct Field { DB_UINT typenum; /* Number used in 6-bit type field, and index into Array_of_Field_Types */ char *printname; /* Printable name of field, e.g. "BODY" */ enum Title_Defaults_Type titleDefault; /* what to do in title if blank */ /* Parser is a function that takes field data (e.g. a string of words) and returns a parsed, machine storable version (e.g. a wordvec). The parser may also do other pre-processing, like stemming words and removing stop-words. Self is this field (necessary so the encoder can figure out the typenum). (it's void instead of Field 'cause of stupid C not doing forward references right.) */ void *(*parser)(char *fielddata, void *self, DB_UINT docnum); GBuffer *(*deparser)(void *parseddata, void *self); /* Function that takes the output of the parser program and returns a human-readable version of the data */ void (*index_store)(void *parseddata, char *filename, int last_write_p); /* Function that takes whatever type is returned by the parser and stores it in the appropriate structure, for later writing to disk. doc_start is the file offset for the start of this particular doc, doc_end is the end of this doc. */ void *(*nextword)(void *parseddata, int reset_p); /* ittorator that takes type returned by parser and returns the next "word" in the series. If reset_p != 0, restart at the beginning of the list. */ void (*update_sims_word)(void *word, Remem_Hash_Table *all_sims, void *self, Retrieval_Database_Info *rdi); /* Function that takes a word (returned by nextword) and its weight and updates all_sims with the new similarities. self is of type Field * */ void (*cleanup_parsed)(void *parseddata); /* free memory any other cleanup that has to happen. Takes whatever was returned by parser. */ } Field; /* Template_Field_Info: info on a field specific to a type of file (e.g. HTML) */ typedef struct _Template_Field_Info { Field *field; /* Pointer to the generic field info */ char *id_regexp; /* Regexp to find this field in a document */ int id_index; /* Index to actually get the data out of the find regexp */ char **filter_regexp; /* Regexp for post-filtering on the field data, before parsing */ int bias; /* The bias number for this field in this kind of document */ int filter_count; /* Add integer for current size of filter array*/ int title_length; /* Number of characters to print out in the titles file for this field */ } Template_Field_Info; /* Actions: What to do with a template (currently only "Reject" and "Accept") */ enum Action_Types {REJECT_ACTION, ACCEPT_ACTION}; /* Template types: When is this template used? (currently only "index" and "retrieve") */ enum Template_Types {INDEX_TYPE, QUERY_TYPE}; /* Template: all the info on how to parse a particular kind of file (e.g. "HTML") */ typedef struct { DB_INT typenum; /* A template number so we can id a filetype in docloc_offs, and index into All_General_Templates */ char *printname; /* Printable name for this kind of file (e.g. "RMAIL") */ char *recognize; /* Regexp to recognize this document type */ char *delimiter; /* Regexp to recognize the delimiter for this document */ Template_Field_Info **fields; /* Array pointers to the field-info used by this template, NULLs for the rest */ enum Action_Types action; enum Template_Types templatetype; /* index or retrieve? */ } General_Template; typedef struct _List_of_General_Templates { General_Template *template; struct _List_of_General_Templates *next; } List_of_General_Templates; typedef struct _Array_of_Field_Types { int num_fields; /* Number of fields currently populating the array */ Field **field; /* Array of MAX_NUMBER_FIELDS pointers to type Field */ } Array_of_Field_Types; /* Prototypes */ /* Create a new template, with an empty Template_Field_Info array. Make sure to strcpy all strings into malloced buffers */ General_Template *create_template (char *printname, char *recognize, char *delimiter, enum Action_Types action, enum Template_Types templatetype); /* Return the template_field_info pointer that has the included pointer */ Template_Field_Info *tfi_from_name (General_Template *template, char *fieldname); /* Return the field pointer (from the global "All_Fields") that has the included pointer */ Field *field_from_name (char *fieldname); /* Add a new Template_Field_Info line to a template */ void add_template_field_info (General_Template *template, Field *field, char *id_regexp, int id_index, char **filter_regexp, int bias, int title_length); /* Free memory pointed to by template (including all sub-fields and strings in the data struct) */ void free_template (General_Template *template); /* Create a field and add it to fieldArray, choosing the next fieldnum from the array and updating the Array's num_fields */ void create_and_add_field (Array_of_Field_Types *fieldArray, char *printname, enum Title_Defaults_Type titleDefault, void *(*parser)(char *fielddata, void *self, DB_UINT docnum), GBuffer *(*deparser)(void *parseddata, void *self), void (*index_store)(void *parseddata, char *filename, int last_write_p), void *(*nextword)(void *parseddata, int reset_p), void (*update_sims_word)(void *word, Remem_Hash_Table *all_sims, void *self, Retrieval_Database_Info *rdi), void (*cleanup_parsed)(void *parseddata)); /* Print configuration stuff (mainly for debugging) */ void print_config (); void print_field (Field *f); void print_template (General_Template *t); void print_template_field_info (Template_Field_Info *tfi); Field *get_field_from_allfields(Array_of_Field_Types *aft, char *pname); #endif remem-2.12/template/Makefile.am0000644000076500007650000000020707760625115012115 lib_LIBRARIES=libtemplate.a libtemplate_a_SOURCES=conftemplates.c parsedoc.c regex.c EXTRA_DIST=conftemplates.h regex.h parsedoc.h remem-2.12/template/Makefile.in0000644000076500007650000002266107760626047012143 # Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ CC = @CC@ DEPDIR = @DEPDIR@ EMACS = @EMACS@ INCLUDES = @INCLUDES@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ lispdir = @lispdir@ lib_LIBRARIES = libtemplate.a libtemplate_a_SOURCES = conftemplates.c parsedoc.c regex.c EXTRA_DIST = conftemplates.h regex.h parsedoc.h subdir = template mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(lib_LIBRARIES) libtemplate_a_AR = $(AR) cru libtemplate_a_LIBADD = am_libtemplate_a_OBJECTS = conftemplates.$(OBJEXT) parsedoc.$(OBJEXT) \ regex.$(OBJEXT) libtemplate_a_OBJECTS = $(am_libtemplate_a_OBJECTS) DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/conftemplates.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/parsedoc.Po ./$(DEPDIR)/regex.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ DIST_SOURCES = $(libtemplate_a_SOURCES) DIST_COMMON = Makefile.am Makefile.in SOURCES = $(libtemplate_a_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu template/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) AR = ar libLIBRARIES_INSTALL = $(INSTALL_DATA) install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f"; \ $(libLIBRARIES_INSTALL) $$p $(DESTDIR)$(libdir)/$$f; \ else :; fi; \ done @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(libdir)/$$p"; \ rm -f $(DESTDIR)$(libdir)/$$p; \ done clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) libtemplate.a: $(libtemplate_a_OBJECTS) $(libtemplate_a_DEPENDENCIES) -rm -f libtemplate.a $(libtemplate_a_AR) libtemplate.a $(libtemplate_a_OBJECTS) $(libtemplate_a_LIBADD) $(RANLIB) libtemplate.a mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conftemplates.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsedoc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `cygpath -w $<` CCDEPMODE = @CCDEPMODE@ uninstall-info-am: ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: $(mkinstalldirs) $(DESTDIR)$(libdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLIBRARIES mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-libLIBRARIES install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-info-am uninstall-libLIBRARIES .PHONY: GTAGS all all-am check check-am clean clean-generic \ clean-libLIBRARIES distclean distclean-compile distclean-depend \ distclean-generic distclean-tags distdir dvi dvi-am info \ info-am install install-am install-data install-data-am \ install-exec install-exec-am install-info install-info-am \ install-libLIBRARIES install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic tags uninstall uninstall-am \ uninstall-info-am uninstall-libLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: remem-2.12/template/parsedoc.c0000644000076500007650000010466307760625115012040 /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "regex.h" #include "gbuf.h" #include "conftemplates.h" #include "parsedoc.h" #include #include #define READ_BUFFER_AMOUNT 20000 /* num chars we read in one gulp */ #define MAX_DELIMIT_WINDOW 1023 /* Max window of characters we search for a doc delimiter */ /* Is this file a binary file? */ int is_bin_file_p(char *filename) { /* For now, just read in a few K and see if 95% is printable (there may be a better way, but this is fast) */ char buf[2048]; FILE *file; int i, max, printables=0; if((file = fopen(filename,"r")) == NULL) { sprintf(buf, "is_bin_file_p: Cannot open file: %s", filename); SavantError(ENOENT, buf); } max=fread(&buf, sizeof(char), 2048, file); fclose(file); for(i=0;i 0) && (100*printables/max > 95)) return(0); else return(1); } int string_present_p(char *string, char **strings) { int i; for(i=0; strings[i] != NULL; i++) { if (strcmp(string, strings[i]) == 0) return(1); } return(0); } /* For each source directory/file (or file_source directory/file, specified with a -f), expand out from the command line and call file_search, which then indexes recursively all the files in all the directories below that point. */ void get_and_append_filenames(char *sources[], char *excludees[], List_of_Filenames **lof) { int i, isurl=0; char cwd[PATH_MAX+2], command[MAX_STRING], *cur_dir, *temp_excl; List_of_Filenames *current_filename = NULL; #ifdef HAVE_GETCWD getcwd(cwd, PATH_MAX); #else getwd(cwd); #endif strcat(cwd, "/"); /* expand excludee pathnames */ for(i=0; excludees[i] != NULL; i++) { if(!((strncmp(excludees[i], "http://", 7) == 0) || (strncmp(excludees[i], "ftp://", 6) == 0))) { if(excludees[i][0] != '/') { temp_excl = excludees[i]; if ((excludees[i] = (char *)malloc(strlen(temp_excl) + strlen(cwd) + 2)) == NULL) SavantError(ENOMEM, "Unable to malloc excludees in imain.c."); strcpy(excludees[i], cwd); strcat(excludees[i], temp_excl); } if (excludees[i][strlen(excludees[i])-1] == '/') { excludees[i][strlen(excludees[i])-1] = '\0'; } } } /* assign each expanded pathname to cur_dir and find some files */ for(i=0; sources[i] != NULL; i++) { if((strncmp(sources[i], "http://", 7) != 0) && (strncmp(sources[i], "ftp://", 6) != 0)) { /* It's not a URL -- put the filename or directory name into cannonical form */ if(sources[i][0] == '/') { cur_dir = sources[i]; } else { /* It's a relative filename -- add cwd */ if ((cur_dir = (char *)malloc(strlen(sources[i]) + strlen(cwd) + 2)) == NULL) SavantError(ENOMEM, "Unable to malloc cur_dir in parsedoc.c."); strcpy(cur_dir, cwd); strcat(cur_dir, sources[i]); } if (sources[i][strlen(sources[i])-1] == '/') { /* Remove trailing "/" */ sources[i][strlen(sources[i])-1] = '\0'; } } /* Find end of the list of files given (lof), and append the result of get_files_from_directory */ if (*lof == NULL) { *lof = get_files_from_directory(cur_dir, excludees); } else { for (current_filename = *lof; (current_filename->next != NULL); current_filename = current_filename->next); current_filename->next = get_files_from_directory(cur_dir, excludees); } /* Free up memory */ if(cur_dir != sources[i]) { free(cur_dir); } free(sources[i]); } } /* Recursively go down directories specified, excluding directories/files on the excludies list, and avoiding symbolic links. When you get to a real file (as opposed to a directory), call process_file. file_search is called by pre_process. */ List_of_Filenames *get_files_from_directory(char *sourcename, char **excludees) { int i, isurl=0; char filename[256], *shortname; struct stat buf; DIR *directory; savant_direct *entry; List_of_Filenames *list_of_filenames = NULL; List_of_Filenames *current_filename = NULL; /* initialize filename lists */ list_of_filenames = (List_of_Filenames *) malloc (sizeof(List_of_Filenames)); list_of_filenames->next = NULL; filename[sizeof(filename)-1] = '\0'; if ((strncmp(sourcename, "http://", 7) == 0) || (strncmp(sourcename, "ftp://", 6)==0)) { /* It's a URL, so it it's not excluded then just return the URL itself */ isurl=1; if(string_present_p(sourcename, excludees)) { if(SavantVerbose) { printf("Excluding %s.\n", sourcename); fflush(stdout); } free(list_of_filenames); return NULL; } else { list_of_filenames->next = NULL; list_of_filenames->is_url_p = 1; list_of_filenames->filename = (char *) malloc (sizeof(char) * (strlen(sourcename) + 1)); strcpy(list_of_filenames->filename, sourcename); return list_of_filenames; } } else { /* it's not a URL */ if(string_present_p(sourcename, excludees)) { if(SavantVerbose) { printf("Excluding %s.\n", sourcename); fflush(stdout); } free(list_of_filenames); return NULL; } shortname = strrchr(sourcename, '/')+1; if((shortname[0] == '#') || /* ignore *~ and #*, possibly .* */ (shortname[strlen(shortname)-1] == '~') || (shortname[0] == '.' && !Config.index_dotfiles)) { if(SavantVerbose) { printf(" Ignoring %s.\n", shortname); fflush(stdout); } free(list_of_filenames); return NULL; } /*check to see if the directory/file is a symlink*/ lstat(sourcename, &buf); if (!SavantFollowSymlinks && (S_ISLNK(buf.st_mode))) { /*ignore symbolic links*/ if(SavantVerbose) { printf(" Ignoring symbolic link: %s.\n", shortname); fflush(stdout); } free(list_of_filenames); return NULL; } if (NULL == (directory = opendir (sourcename))) { /* sourcename is a file, process it */ list_of_filenames->next = NULL; list_of_filenames->is_url_p = 1; list_of_filenames->filename = (char *) malloc (sizeof(char) * (strlen(sourcename) + 1)); strcpy(list_of_filenames->filename, sourcename); return list_of_filenames; } /* sourcename is a directory, recurse */ /* (note that the first one returned is going to be a dummy) */ if(SavantVerbose) { printf("Searching %s:\n", sourcename); fflush(stdout); } entry = readdir(directory); while (entry != NULL) { shortname = entry->d_name; if(strcmp(shortname,".") && strcmp(shortname,"..")) { strncpy(filename, sourcename, sizeof(filename)-2); filename[sizeof(filename)-1] = '\0'; if (filename[strlen(filename)-1] != '/') strcat(filename, "/"); strncat(filename, shortname, sizeof(filename)-1); /* find the end of the chain of filenames, and recursively append */ for (current_filename = list_of_filenames; (current_filename->next != NULL); current_filename = current_filename->next); current_filename->next = get_files_from_directory (filename, excludees); } entry = readdir(directory); } /* Get rid of the dummy entry */ current_filename = list_of_filenames; list_of_filenames = list_of_filenames->next; free(current_filename); if(SavantVerbose) { printf("Finished %s.\n", sourcename); fflush(stdout); } closedir(directory); return list_of_filenames; } } /* Recognize what kind of file this is. Target is a string containing the first several lines of the file. Find the first template that matches the current file. Note: This only applies to INDEX_TYPE templates. Ignore QUERY_TYPE. */ General_Template *recognize_file(FILE *file, List_of_General_Templates *current_template) { int start, end, max; char target[RECOGNIZE_LIMIT +1]; max=fread(&target, sizeof(char), RECOGNIZE_LIMIT, file); target[max] = '\0'; while(current_template != NULL) { if (current_template->template->templatetype == INDEX_TYPE) { regex_find(current_template->template->recognize, target, max, &start, &end); if(start >= 0) return current_template->template; } current_template = current_template->next; } return NULL; } /* Recognize what kind of query this is. query is a GBuffer containing the query. Find the first template that matches it.. Note: This only applies to QUERY_TYPE templates. Ignore INDEX_TYPE. */ General_Template *recognize_query(GBuffer query, List_of_General_Templates *current_template) { int start, end, max; char *target; max = query.tail; target = strcast_GBuffer(&query); while(current_template != NULL) { if (current_template->template->templatetype == QUERY_TYPE) { regex_find(current_template->template->recognize, target, max, &start, &end); if(start >= 0) return current_template->template; } current_template = current_template->next; } return NULL; } /* Find the next doc in a file. documentText is the text from this current doc. target_template is the template for this particular file's type. file_ptr is the pointer to the file in question. start will be the character offset in the file of the first character of the delimiter, and end will be the character offset of the character just before the dilimiter starting the next document. */ void find_next_doc(GBuffer *documentText, /* The text read in from the document. Modified to eat docs each run. */ Doc_Info *document, /* we fill in this document into document->documentText */ General_Template *target_template, /* Which template is this file? */ FILE *file_ptr) { /* pointer to the doc file */ static DB_UINT docnum = 0; /* The next docnum to assign, starting at 0 */ int first_start, first_end, second_start, second_end, i, j, dt_len, dt_interim_len, window_start; char *dt, *dt_interim; char buffer[READ_BUFFER_AMOUNT + 1]; size_t numbytes; /* num bytes actually read */ long fposition; /* Set & increment the static document number (find_next_doc is called once per document, so it's easy */ document->docnum = docnum++; /* load the contents of the documentText into dt */ dt = strcast_GBuffer(documentText); /* find the first delimiter */ regex_find(target_template->delimiter, dt, documentText->tail, &first_start, &first_end); /* if there is no delimiter in however much is initially passed to find_next_doc in documentText->value, then first_start will be set to -1 by regex_find, and so we have to read in some more from the file, and then search again for the delimiter. if at any time we hit an eof, then just set the whole file to be the document and return. */ while (first_start == -1) { if (feof(file_ptr) || (documentText->tail > MAX_DOC_LENGTH)) { /* It's all one file, so just copy it all in */ strncpy_GBuffer(document->documentText, strcast_GBuffer(documentText), strlen(strcast_GBuffer(documentText))); fposition = ftell(file_ptr); if (fposition == -1) SavantError(errno, "Error with ftell in find_next_doc"); document->doc_end = fposition; document->doc_start = fposition - document->documentText->tail; if (!feof(file_ptr) && SavantVerbose) { printf("", MAX_DOC_LENGTH); /* Force EOF */ fseek(file_ptr, 0, SEEK_END); numbytes = fread((void *)buffer, sizeof(char), 1, file_ptr); fposition = ftell(file_ptr); if (fposition == -1) SavantError(errno, "Error with ftell in find_next_doc"); document->doc_end = fposition; } /* Clear documentText so we don't think there's more to read */ strncpy_GBuffer(documentText, "", 0); return; } if (ferror(file_ptr)) { SavantError(ferror(file_ptr), "Error reading file in find_next_doc"); } numbytes = fread((void *)buffer, sizeof(char), READ_BUFFER_AMOUNT, file_ptr); buffer[numbytes] = '\0'; /* I'm pretty sure I'm relying on C string manipulation somewhere in GBuffers, so any nulls in the middle of the string screw things up. The right thing to do is to not mind having nulls in the middle since GBuffers have the length anyway, but in the meantime I'm just replacing nulls with ^A's */ while (strlen(buffer) < numbytes) { buffer[strlen(buffer)]='\1'; } strncat_GBuffer(documentText, buffer, numbytes); dt = strcast_GBuffer(documentText); /* Not necessary, but a good reminder */ /* Look again, starting with the last MAX_DELIMIT_WINDOW characters we just tried*/ dt_len = documentText->tail; window_start = dt_len - numbytes - MAX_DELIMIT_WINDOW; if (window_start < 0) { window_start = 0; } /* if ((dt_len - numbytes) > MAX_DELIMIT_WINDOW) { dt_interim = &dt[(dt_len - MAX_DELIMIT_WINDOW - numbytes)]; dt_interim_len = MAX_DELIMIT_WINDOW + numbytes; } else { dt_interim = dt; dt_interim_len = dt_len; } */ regex_find(target_template->delimiter, &dt[window_start], (dt_len - window_start), &first_start, &first_end); if (first_start != -1) { first_start = first_start + window_start; } if (first_end != -1) { first_end = first_end + window_start; } } /* find the second delimiter -- we want to search the area that starts just *after* the end of the first delimiter. */ regex_find(target_template->delimiter, &(dt[first_end + 1]), documentText->tail - first_end, &second_start, &second_end); /* second_start and second_end should be relative to the start of dt */ if (second_start != -1) { second_start += (first_end + 1); second_end += (first_end + 1); } /* if the second delimiter isn't there, then we need to read in more. if at any point we hit an eof, then that means we just want the document from the beginning of the first delimiter to the end of the file (i.e. we include the delimiter). */ while (second_start == -1) { if (feof(file_ptr) || (documentText->tail > MAX_DOC_LENGTH)) { /* Return from first_start to eof */ strncpy_GBuffer(document->documentText, (char *)(dt + first_start), (documentText->tail - first_start)); fposition = ftell(file_ptr); if (fposition == -1) { SavantError(errno, "Error with fseek in find_next_doc"); } document->doc_end = fposition; document->doc_start = fposition - document->documentText->tail; if (!feof(file_ptr) && SavantVerbose) { printf("", MAX_DOC_LENGTH); /* Force EOF */ fseek(file_ptr, 0, SEEK_END); numbytes = fread((void *)buffer, sizeof(char), 1, file_ptr); fposition = ftell(file_ptr); if (fposition == -1) SavantError(errno, "Error with ftell in find_next_doc"); document->doc_end = fposition; } /* Clear documentText so we don't think there's more to read */ strncpy_GBuffer(documentText, "", 0); return; } numbytes = fread((void *)buffer, sizeof(char), READ_BUFFER_AMOUNT, file_ptr); buffer[numbytes] = '\0'; strncat_GBuffer(documentText, buffer, numbytes); dt = strcast_GBuffer(documentText); if (ferror(file_ptr)) { SavantError(ferror(file_ptr), "Error reading file in find_next_doc"); } /* Look again, starting with the last MAX_DELIMIT_WINDOW characters we just tried*/ dt_len = documentText->tail; window_start = dt_len - numbytes - MAX_DELIMIT_WINDOW; if (window_start < (first_end + 1)) { window_start = first_end + 1; } /* if ((dt_len - numbytes) > MAX_DELIMIT_WINDOW) { dt_interim = &dt[(dt_len - MAX_DELIMIT_WINDOW - numbytes)]; dt_interim_len = MAX_DELIMIT_WINDOW + numbytes; } else { dt_interim = &dt[first_end + 1]; dt_interim_len = dt_len - (first_end + 1); } */ regex_find(target_template->delimiter, &dt[window_start], (dt_len - window_start), &second_start, &second_end); if (second_start != -1) { second_start = second_start + window_start; } if (second_end != -1) { second_end = second_end + window_start; } } /* if we get to this point without hitting any of the return markers, then just return pointers to the start of the first delimiter and the point just *before* the start of the second delimiter. Chop out this document in documentText, so we won't read it next round. */ /* NOTE: second_start & second_end are NOT relative to first_end+1, but are */ /* rather relative to the start of dt */ strncpy_GBuffer(document->documentText, (char *)(dt + first_start), (second_start - first_start)); strnchop_GBuffer(documentText, second_start - first_start); fposition = ftell(file_ptr); if (fposition == -1) { SavantError(errno, "Error with fseek in find_next_doc"); } document->doc_end = fposition - documentText->tail + first_start; document->doc_start = document->doc_end - document->documentText->tail; return; } void find_fields(Doc_Info *docInfo, General_Template *target_template) { char *dt, *errptr, space_delimiter[2]; int vector[256], error_offset, group_begin, group_end, i=0, errcode; size_t sizedt; char errortext[256]; GBuffer good_bits; pcre *pattern; init_GBuffer(&good_bits); strcpy(space_delimiter, " "); /* each template has an associated set of fields. loop through each field, pulling them out of the documentText. */ for (i=0; (ifields[i] != NULL); i++) { strncpy_GBuffer(&good_bits, "", 0); /* clear out the good bits */ /* compile the id_regex */ /* The version for pcre-1.09 if (NULL == (pattern = pcre_compile(target_template->fields[i]->id_regexp, PCRE_DOTALL, (const char **)&errptr, &error_offset))) { */ if (NULL == (pattern = pcre_compile(target_template->fields[i]->id_regexp, PCRE_DOTALL, (const char **)&errptr, &error_offset, NULL))) { sprintf(errortext, "find_and_index_fields: pcre error %s at location %d", errptr, error_offset); SavantError(ENOEXEC, errortext); } dt = strcast_GBuffer(docInfo->documentText); sizedt = strlen(dt); /* loop while there are still matches... */ /* For pcre-1.09 while ((sizedt > 0) && (errcode = pcre_exec(pattern, NULL, dt, sizedt, 0, vector, 256)) > 0) { */ while ((sizedt > 0) && (errcode = pcre_exec(pattern, NULL, dt, sizedt, 0, 0, vector, 256)) > 0) { /* see pcre documentation for info on how vector works but suffice it to say that group_begin and group end will contain offsets to the good bits. */ group_begin = vector[2 * target_template->fields[i]->id_index]; group_end = vector[2 * target_template->fields[i]->id_index + 1]; /* It's possible to match the pattern, but not this particular field. If so, just go on to the next one. */ if ((group_begin == -1) && (group_end == -1)) { break; } if ((group_begin > docInfo->documentText->size) || (group_end > docInfo->documentText->size)) { sprintf(errortext, "find_fields: vector out of range for finding fielddata: %s (is id_index correct?)", target_template->fields[i]->field->printname); SavantError(ENOEXEC, errortext); } /* put the string described by the group_begin and group_end offsets into a GrowBuffer called good_bits. Delimit with a CR if there's already text in it. */ if (strlen(strcast_GBuffer(&good_bits)) > 0) strncat_GBuffer(&good_bits, "\n", 1); strncat_GBuffer(&good_bits, &(dt[group_begin]), group_end - group_begin); /* move the head of the string we are examining to the *end of the last group found */ dt = dt + (group_end * sizeof(char)); sizedt -= (group_end * sizeof(char)) ; } /* now dump all the good_bits found into the docinfo structure */ strncpy_GBuffer (docInfo->fields[i], strcast_GBuffer(&good_bits), good_bits.size); free(pattern); } free_GBuffer(&good_bits); return; } void filter_fields(Doc_Info *docInfo, General_Template *target_template) { char errortext[256]; int i; for (i=0; ((ifields[i] != NULL)); i++) { if (SavantDebug) printf("filter_fields: i = %d, docnum = %d\n", i, docInfo->docnum); regex_filter(target_template->fields[i]->filter_regexp, docInfo->fields[i]); } } void cleanup_fields(Doc_Info *docInfo, General_Template *target_template) { int i; /* The cleanup function */ void (*cleanup_parsed)(void *parseddata) = NULL; for (i=0; ((ifields[i] != NULL)); i++) { cleanup_parsed = target_template->fields[i]->field->cleanup_parsed; if (cleanup_parsed != NULL) { cleanup_parsed((void *)(docInfo->parsedfields[i])); } } } void parse_fields(Doc_Info *docInfo, General_Template *target_template) { int i; /* The parser function */ void *(*parser)(char *fielddata, void *self, DB_UINT docnum) = NULL; for (i=0; ((ifields[i] != NULL)); i++) { parser = target_template->fields[i]->field->parser; if (parser != NULL) { docInfo->parsedfields[i] = parser((void *)(strcast_GBuffer(docInfo->fields[i])), target_template->fields[i]->field, docInfo->docnum); } else { docInfo->parsedfields[i] = NULL; } } } /* Write the index info to disk. If final_write_p is 0, close up the files. WARNING: This frees docInfo->parsedfields[i] as it goes. */ void index_store_fields(Doc_Info *docInfo, General_Template *target_template, char *dbdir, int final_write_p) { int i; void (*index_store)(void *parsedata, char *dbdir, int last_write_p) = NULL; for (i=0; ((ifields[i] != NULL)); i++) { index_store = target_template->fields[i]->field->index_store; if (index_store != NULL) { if (docInfo != NULL) { index_store(docInfo->parsedfields[i], dbdir, final_write_p); } else { index_store(NULL, dbdir, final_write_p); } } } } /* Return the template number for a particular document number. Get the info from cache. The whole cache is loaded from the DLOFFS file in one load, to avoid multiple seeks. This is memory intensive (30 * num docs bytes total), so we may have to do this in chunks if it becomes a problem */ DB_INT docloc_templateno (Retrieval_Database_Info *rdi, DB_UINT docnum) { static DB_INT *template_number_cache = NULL; FILE *DLOFFS_FILE = NULL; DB_INT *template_precache_storage = NULL; int i; if (template_number_cache == NULL) { DLOFFS_FILE = open_or_die(rdi->db_dir, DLOFFS_FNAME, "r"); template_number_cache = (DB_INT *)malloc(sizeof(DB_INT) * rdi->number_documents_total); template_precache_storage = (DB_INT *)malloc(sizeof(DB_INT) * rdi->number_documents_total * 5); if ((template_precache_storage == NULL) || (template_number_cache == NULL)) { SavantError(ENOMEM, "Unable to malloc docloc_templateno cache in parsedoc.c."); } fread_big(template_precache_storage, sizeof(DB_INT), rdi->number_documents_total * 5, DLOFFS_FILE); for (i=0; i < rdi->number_documents_total; i++) { template_number_cache[i] = template_precache_storage[5 * i + 4]; } free(template_precache_storage); fclose(DLOFFS_FILE); } return(template_number_cache[docnum]); } /* Write the document position info (doc_start and doc_end), doc filename, and docloc offset info to file. This is the same regardless of file type or fields. Also write title info, which is dependent on the file template. File format: doc_locs (DOCLOC_OFFS): ascii string representation of full expanded filename, one line per unique file, in document order. docloc_offs (DLOFFS_FILE): Four ints per document. (DB_INT) (DB_INT) (DB_INT) (DB_INT) (DB_INT) offset end_offset doc_start doc_end template number (repeat) offset = file offset into doc_locs for this file. We can do multiple docs with the same offset, since multiple docs can be in one file. end_offset = file offset into doc_locs for the end of the filename. doc_start = number of characters from the start of the file that this doc starts. Beginning of file = 0. doc_end = number of characters from the start of the file that this doc ends. template number = template typenum (also = the order in All_General_Templates) titles: plaintext summary of a document. The contents are template-specific. title_offs: offsets into the titles file. One int per doc, for the start of the title. (DB_INT) offset-low */ void write_doc_info(Doc_Info *docInfo, General_Template *target_template, char *db_dir, int final_write_p) { static FILE *DOCLOC_FILE = NULL; static FILE *DLOFFS_FILE = NULL; static FILE *TITLES_FILE = NULL; static FILE *TOFFS_FILE = NULL; static char previous_filename[PATH_MAX] = ""; static long dl_fpos = 0; DB_INT dl_fpos_writeme = 0; DB_INT dl_fpos_end = 0; int typenum; char *titlearray[MAX_NUMBER_FIELDS]; int titlelengtharray[MAX_NUMBER_FIELDS]; enum Title_Defaults_Type titledefaultsarray[MAX_NUMBER_FIELDS]; char errortext[256]; GBuffer *fieldtext = NULL; int i; char *titlestring; DB_INT titles_fpos = 0; struct stat statbuf; struct passwd *passbuf; if (DOCLOC_FILE == NULL) DOCLOC_FILE = open_or_die(db_dir, DOCLOC_FNAME, "w"); if (DLOFFS_FILE == NULL) DLOFFS_FILE = open_or_die(db_dir, DLOFFS_FNAME, "w"); if (TITLES_FILE == NULL) TITLES_FILE = open_or_die(db_dir, TITLES_FNAME, "w"); if (TOFFS_FILE == NULL) TOFFS_FILE = open_or_die(db_dir, TOFFS_FNAME, "w"); if (docInfo != NULL) { /* If we've got a new file, update DOCLOC_FILE & our offset into it */ if (strcmp(previous_filename, docInfo->filename)) { strcpy(previous_filename, docInfo->filename); dl_fpos = ftell(DOCLOC_FILE); if (dl_fpos == -1) { sprintf(errortext, "write_doc_info: error %d doing ftell on file %s%s", errno, db_dir, DOCLOC_FILE); SavantError(EIO, errortext); } fprintf(DOCLOC_FILE, "%s\n", docInfo->filename); } dl_fpos_writeme = (DB_INT)dl_fpos; dl_fpos_end = dl_fpos_writeme + strlen(docInfo->filename); fwrite_big(&(dl_fpos_writeme), sizeof(DB_INT), 1, DLOFFS_FILE); fwrite_big(&(dl_fpos_end), sizeof(DB_INT), 1, DLOFFS_FILE); fwrite_big(&(docInfo->doc_start), sizeof(DB_UINT), 1, DLOFFS_FILE); fwrite_big(&(docInfo->doc_end), sizeof(DB_UINT), 1, DLOFFS_FILE); fwrite_big(&(target_template->typenum), sizeof(DB_INT), 1, DLOFFS_FILE); /* Handle Titles stuff. This is a placeholder right now. */ titlestring = (char *)malloc(sizeof(char) * MAX_NUMBER_FIELDS * Config.source_field_width + 1); titlestring[0] = '\0'; for (i=0; ifields[i] != NULL); i++) { typenum = target_template->fields[i]->field->typenum; titlearray[typenum] = strcast_GBuffer(docInfo->fields[i]); titlelengtharray[typenum] = target_template->fields[i]->title_length; titledefaultsarray[typenum] = target_template->fields[i]->field->titleDefault; } for (i=0; i 0) { if (strlen(titlearray[i]) > 0) { strncat(titlestring, titlearray[i], titlelengtharray[i]); } else if (titledefaultsarray[i] == FILENAME_TITLE) { if (rindex(docInfo->filename, '/') != NULL) strncat(titlestring, rindex(docInfo->filename, '/')+1, titlelengtharray[i]); else strncat(titlestring, docInfo->filename, titlelengtharray[i]); } else if (titledefaultsarray[i] == OWNER_TITLE) { stat(docInfo->filename, &statbuf); passbuf = getpwuid(statbuf.st_uid); if(passbuf != NULL) { strncat(titlestring, passbuf->pw_name, titlelengtharray[i]); } } else if (titledefaultsarray[i] == MODTIME_TITLE) { stat(docInfo->filename, &statbuf); strncat(titlestring, ctime(&statbuf.st_mtime), titlelengtharray[i]); } } strcat(titlestring, "|"); } /* Include the filename in the title sequence, at the end */ if (rindex(docInfo->filename, '/') != NULL) strncat(titlestring, rindex(docInfo->filename, '/')+1, titlelengtharray[i]); else strncat(titlestring, docInfo->filename, titlelengtharray[i]); strcat(titlestring, "|"); for (i=0; titlestring[i] != '\0'; i++) { /* Get rid of CR/LF */ if (titlestring[i] == '\n') { titlestring[i] = ' '; } } titles_fpos = (DB_INT)ftell(TITLES_FILE); if (titles_fpos == -1) { sprintf(errortext, "write_doc_info: error %d doing ftell on file %s%s", errno, db_dir, TITLES_FILE); SavantError(EIO, errortext); } fprintf(TITLES_FILE, "%s\n", titlestring); fwrite_big(&(titles_fpos), sizeof(DB_INT), 1, TOFFS_FILE); /* Not sure why I have to do this -- might be because of the static storage. Purify compiains if I don't though. */ free(titlestring); } if (final_write_p) { if (DOCLOC_FILE != NULL) fclose(DOCLOC_FILE); if (DLOFFS_FILE != NULL) fclose(DLOFFS_FILE); if (TITLES_FILE != NULL) fclose(TITLES_FILE); if (TOFFS_FILE != NULL) fclose(TOFFS_FILE); DOCLOC_FILE = DLOFFS_FILE = TITLES_FILE = TOFFS_FILE = NULL; } } /* Print parsed document info (mainly for debugging purposes) */ void print_doc_info (Doc_Info *docInfo, General_Template *template) { GBuffer *deparsed = NULL; int i; printf("Template Type: %s\n", template->printname); if (template->templatetype == INDEX_TYPE) { printf("Document #%d, file %s, char position %d to %d\n\n", docInfo->docnum, docInfo->filename, docInfo->doc_start, docInfo->doc_end); } for (i=0; (ifields[i] != NULL); i++) { printf("\n********* Field %s:\n%s\n", template->fields[i]->field->printname, strcast_GBuffer(docInfo->fields[i])); if ((docInfo->parsedfields[i] != NULL) && (template->fields[i]->field->deparser != NULL)) { deparsed = template->fields[i]->field->deparser(docInfo->parsedfields[i], (void *)(template->fields[i]->field)); printf("Deparsed:\n%s\n", strcast_GBuffer(deparsed)); fflush(stdout); free_GBuffer(deparsed); free(deparsed); } } } /* Comparison function for top_contributors (for qsort) (sort high-to-low) */ int top_contributors_cmp(Top_Contributors *tl1, Top_Contributors *tl2) { if (tl1->sim > tl2->sim) return(-1); if (tl1->sim < tl2->sim) return(1); return(0); } int top_contributors_cmp_qsort(const void *tl1, const void *tl2) { return(top_contributors_cmp((Top_Contributors *)tl1, (Top_Contributors *)tl2)); } /* Update a top_contributors with a potential replacement */ void add_potential_top_contributor (Top_Contributors *topList, float additional, char *printname) { int i, minIndex=0; float minSim = 0.0; for (i=0; ((i < NUMBER_CONTRIBUTORS_TRACKED) && (topList[i].sim > 0.0)); i++) { if ((i==0) || (minSim > topList[i].sim)) { minSim = topList[i].sim; minIndex = i; } } if (i < NUMBER_CONTRIBUTORS_TRACKED) { minIndex = i; minSim = 0.0; } if (minSim < additional) { /* We've got someone to replace */ topList[minIndex].sim = additional; strncpy(topList[minIndex].printword, printname, PRINTWORD_LENGTH); } } /* Add additional similarity to a Doc_Sim, and update the top_contributors list if this is a big contributer */ void add_additional_to_doc_sim (Doc_Sim *thisSim, float additional, char *printname) { thisSim->sim += additional; add_potential_top_contributor (thisSim->top_contributors, additional, printname); } /* Add additional similarity to a Doc_Sim, and update the top_contributors list if this is a big contributer */ void add_maximum_to_doc_sim (Doc_Sim *thisSim, float newsim, char *printname) { if (thisSim->sim < newsim) { thisSim->sim = newsim; add_potential_top_contributor (thisSim->top_contributors, newsim, printname); } } /* Merge two top contributor lists, giving the best hits of both. Modifies list #1 */ void merge_top_contributors (Top_Contributors *tc1, Top_Contributors *tc2) { int i; for (i=0; i < NUMBER_CONTRIBUTORS_TRACKED; i++) { add_potential_top_contributor (tc1, tc2[i].sim, tc2[i].printword); } } remem-2.12/template/parsedoc.h0000644000076500007650000001252207760625115012035 #ifndef _PARSEDOC_H_ #define _PARSEDOC_H_ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "savant.h" #if !defined(MAX_STRING) #define MAX_STRING 1024 #endif #if !defined(PATH_MAX) || (PATH_MAX < 1024) #define PATHLEN 1023 #else #define PATHLEN PATH_MAX #endif #define DOCLOC_FNAME "doclocs" #define DLOFFS_FNAME "doclocs_offs" #define TITLES_FNAME "titles" #define TOFFS_FNAME "titles_offs" #define MAX_DOC_LENGTH 10000000 /* Max length of a doc before we assume we goofed */ #include "conftemplates.h" #include "gbuf.h" extern int SavantVerbose, SavantDebug, SavantFollowSymlinks; typedef struct _List_of_Filenames { char *filename; short is_url_p; /* = 1 if this is a URL, 0 if it's a file */ struct _List_of_Filenames *next; } List_of_Filenames; /* Doc_Info contains all the info you might want about a document or query. When used on a query, docnum, doc_start, doc_end, and filename are meaningless and are ignored */ typedef struct _Doc_Info { DB_UINT docnum; /* The docnum for this document. Numbers are assigned serially starting at 0. */ unsigned int doc_start; /* The offset from the start of the file for the start of this doc (0 = from start) */ unsigned int doc_end; /* The offset from the start of the file for the end of this doc */ char *filename; /* The expanded filename for this particular file */ GBuffer *documentText; /* The document itself */ GBuffer *fields[MAX_NUMBER_FIELDS]; /* The text in each field, in order specified in the template */ void *parsedfields[MAX_NUMBER_FIELDS]; /* Parsed info for each field (from calling the parser for this field) */ } Doc_Info; int is_bin_file_p(char *); int string_present_p(char *string, char **strings); void get_filenames(char *sources[], char *excludees[]); List_of_Filenames *get_files_from_directory(char *sourcename, char **excludees); void get_and_append_filenames(char *sources[], char *excludees[], List_of_Filenames **lof); General_Template *recognize_file (FILE *file, List_of_General_Templates *current_template); General_Template *recognize_query(GBuffer query, List_of_General_Templates *current_template); /* Find the next doc in a file. documentText is the text from this current doc. target_template is the template for this particular file's type. file_ptr is the pointer to the file in question. start and end will be filled with the start and end offsets in documentText */ void find_next_doc(GBuffer *documentText, /* The text read in from the document. Modified to eat docs each run. */ Doc_Info *document, /* we fill in this document into document->documentText */ General_Template *target_template, /* Which template is this file? */ FILE *file_ptr); /* pointer to the doc file */ void find_fields(Doc_Info *docInfo, General_Template *target_template); void parse_fields(Doc_Info *docInfo, General_Template *target_template); DB_INT docloc_templateno (Retrieval_Database_Info *rdi, DB_UINT docnum); void write_doc_info(Doc_Info *docInfo, General_Template *target_template, char *db_dir, int final_write_p); void index_store_fields(Doc_Info *docInfo, General_Template *target_template, char *dbdir, int final_write_p); void print_doc_info (Doc_Info *docInfo, General_Template *template); void add_potential_top_contributor (Top_Contributors *topList, float additional, char *printname); void merge_top_contributors (Top_Contributors *tc1, Top_Contributors *tc2); void add_additional_to_doc_sim (Doc_Sim *thisSim, float additional, char *printname); void add_maximum_to_doc_sim (Doc_Sim *thisSim, float newsim, char *printname); int top_contributors_cmp_qsort(const void *tl1, const void *tl2); #endif remem-2.12/template/regex.c0000644000076500007650000001044007760625115011337 /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include /* takes in a regular expression regexp, a string target, and an integer length_to_search. scans the first length_to_search characters of target, and attempts to match regexp to them. if regexp is found, sets start and end equal to the first character of the match and the last character of the match, respectively. */ void regex_find(char *regexp, char *target, int length_to_search, int *start, int *end) { const char *errptr; char errortext[256]; int vector[256], error_offset; pcre *pattern; if (regexp == NULL) { *start = -1; *end = -1; return; } /* For pcre-1.09 if (NULL == (pattern = pcre_compile(regexp, PCRE_DOTALL, &errptr, &error_offset))) { */ if (NULL == (pattern = pcre_compile(regexp, PCRE_DOTALL, &errptr, &error_offset, NULL))) { sprintf(errortext, "regex_find: pcre error %s at location %d", errptr, error_offset); SavantError(ENOEXEC, errortext); } /* For pcre-1.09 pcre_exec(pattern, NULL, target, length_to_search, 0, vector, 256); */ pcre_exec(pattern, NULL, target, length_to_search, 0, 0, vector, 256); *start = vector[0]; *end = vector[1]; free(pattern); return; } /* at some point, code should be introduced to utilize the pcre_study command */ /* because it will give us a little speed bonus... */ /* takes in an array of regexps and a GBuffer target. scans through target and removes every occurrance of every regexp from target. */ void regex_filter(char **regexps, GBuffer *target) { const char *errptr; char *temp_string, *ptr, errortext[512]; int vector[256], error_offset, i=0, groups_matched; pcre *pattern; if (regexps == NULL) return; if ((temp_string = (char *)malloc(sizeof(char) * (target->size + 1))) == NULL) { SavantError(ENOMEM, "Unable to malloc temp_string in regex.c\n"); } for(i=0; ((i= 0) { /* For pcre version 1.09 groups_matched = pcre_exec(pattern, NULL, ptr, strlen(ptr), 0, vector, 256); */ groups_matched = pcre_exec(pattern, NULL, ptr, strlen(ptr), 0, 0, vector, 256); if (vector[0] >= 0) { strncat(temp_string, ptr, vector[0]); ptr = ptr + vector[1] * sizeof(char); } } strcat(temp_string, ptr); strncpy_GBuffer(target, temp_string, strlen(temp_string)); pcre_free(pattern); } free(temp_string); return; } remem-2.12/template/regex.h0000644000076500007650000000446707760625115011360 #ifndef _REGEX_H_ #define _REGEX_H_ /* All code included in versions up to and including 2.09: Copyright (C) 2001 Massachusetts Institute of Technology. All modifications subsequent to version 2.09 are copyright Bradley Rhodes or their respective authors. Developed by Bradley Rhodes at the Media Laboratory, MIT, Cambridge, Massachusetts, with support from British Telecom and Merrill Lynch. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For commercial licensing under other terms, please consult the MIT Technology Licensing Office. This program may be subject to the following US and/or foreign patents (pending): "Method and Apparatus for Automated, Context-Dependent Retrieval of Information," MIT Case No. 7870TS. If any of these patents are granted, royalty-free license to use this and derivative programs under the GNU General Public License are hereby granted. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define MAX_NUMBER_FILTERS 512 #include #include #include #include /* regex_filter: char **regexps - array of regex strings, each of which will be used as a filter. char *target - string from which all regex matches will be be removed. */ void regex_filter(char **regexps, GBuffer *target); /* regex_find: char *regexp - the first occurance of this regex will be identified... char *target - ...in this string. int length_to_search - distance into target to search int start - return value of start of regex match int end - return value of end of regex match */ void regex_find(char *regexp, char *target, int length_to_search, int *start, int *end); #endif