apparix-07-261/0000777002600400000120000000000010673731737010264 500000000000000apparix-07-261/README0000664002600400000120000000024010322266205011036 00000000000000 See LICENSE for copyright and licensing, see THANKS for contributors, see INSTALL for generic installation instructions, see doc/ for documentation. apparix-07-261/configure.ac0000664002600400000120000000273310673731736012474 00000000000000# configure.ac - generated from configure.ac.in by setversion. do not edit # configure.ac, but edit the master. # configure.ac - generated from configure.ac.in by setversion. do not edit # configure.ac, but edit the master. # $Id: configure.ac.in,v 1.2 2005/10/10 17:53:19 flux Exp $ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) AC_INIT(apparix, 07-261, mcx-devel@lists.micans.org) AM_CONFIG_HEADER(config.h) PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION AC_CONFIG_SRCDIR([src/apparix.c]) AM_INIT_AUTOMAKE($PACKAGE, $VERSION) # AM_CONFIG_HEADER(config.h) # AC_CONFIG_HEADERS([config.h]) # add a `--enable-maintainer-mode' option to `configure'; `maintainer-only' rules turned off by # default in Makefile.in's AM_MAINTAINER_MODE AC_SUBST(PACKAGE) AC_SUBST(VERSION) # Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB # Checks for libraries. # FIXME: Replace `main' with a function in `-lm': AC_CHECK_LIB([m], [main]) # Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([fcntl.h float.h limits.h stdlib.h string.h ]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T # Checks for library functions. AC_FUNC_VPRINTF AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_MEMCMP # AC_FUNC_REALLOC AC_CHECK_FUNCS([dup2 floor memset pow regcomp sqrt strchr strrchr strstr]) # AC_CONFIG_FILES([]) AC_OUTPUT([ Makefile util/Makefile src/Makefile doc/Makefile ]) apparix-07-261/aclocal.m40000664002600400000120000011777110673721152012046 00000000000000# generated automatically by aclocal 1.9 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # 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. # -*- Autoconf -*- # Copyright (C) 2002, 2003 Free Software Foundation, Inc. # Generated from amversion.in; do not edit by hand. # 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.9"]) # 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.9])]) # AM_AUX_DIR_EXPAND # Copyright (C) 2001, 2003 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. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004 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 6 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl 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])]) # serial 7 -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 # 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 # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub 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 # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # 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. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/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=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi 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_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --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 (C) 1999, 2000, 2001, 2002, 2003, 2004 # 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 # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. 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 " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/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"]) ]) # Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003 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 7 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # 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 (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # 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 11 # 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_PREREQ([2.58])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl 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 # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # 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_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # 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 AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _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 ]) ]) # 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. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. # Copyright (C) 2001, 2003 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)]) # -*- Autoconf -*- # Copyright (C) 2003 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 1 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 # 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_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003 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_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit 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 | grep -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 ]) # -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003 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_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. # Copyright (C) 2003, 2004 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. # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). # This was a mistake. There are at least two reasons why we must not # use `-m 0755': # - it causes special bits like SGID to be ignored, # - it may be too restrictive (some setups expect 775 directories). # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. # # We cannot accept any implementation of `mkdir' that recognizes `-p'. # Some implementations (such as Solaris 8's) are not thread-safe: if a # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' # concurrently, both version can detect that a/ is missing, but only # one can create it and the other will error out. Consequently we # restrict ourselves to GNU make (using the --version option ensures # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi fi AC_SUBST([mkdir_p])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003 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 (C) 1996, 1997, 2000, 2001, 2003 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)]) # AM_PROG_INSTALL_STRIP # Copyright (C) 2001, 2003 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])]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004 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 1 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR apparix-07-261/Makefile.am0000644002600400000120000000060010322315204012202 00000000000000## Process this file with automake to produce Makefile.in ## $Id: Makefile.am,v 1.1 2005/10/09 22:32:36 flux Exp $ ## stuff in shtest should get distributed but not installed SUBDIRS = . util src doc VERSION: ChangeLog NEWS ./setversion VERSION = @VERSION@ EXTRA_DIST = \ LICENSE VERSION README COPYING THANKS INSTALL AUTHORS \ bootstrap \ configure.ac \ setversion apparix-07-261/Makefile.in0000644002600400000120000004361510673721154012246 00000000000000# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ THANKS TODO depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = . util src doc EXTRA_DIST = \ LICENSE VERSION README COPYING THANKS INSTALL AUTHORS \ bootstrap \ configure.ac \ setversion all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ 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 ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done 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 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$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; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ 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 "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_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 tags distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ 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"; \ $(mkdir_p) "$(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='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (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 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | 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 case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac 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 | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && 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 \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 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 in build directory 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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive 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 $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-recursive ctags \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ dist-tarZ dist-zip distcheck distclean distclean-generic \ distclean-hdr distclean-recursive distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-info-am VERSION: ChangeLog NEWS ./setversion # 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: apparix-07-261/config.h.in0000664002600400000120000000641110673722035012216 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the `dup2' function. */ #undef HAVE_DUP2 /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H /* Define to 1 if you have the `floor' function. */ #undef HAVE_FLOOR /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the `pow' function. */ #undef HAVE_POW /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP /* Define to 1 if you have the `sqrt' function. */ #undef HAVE_SQRT /* 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 `strchr' function. */ #undef HAVE_STRCHR /* 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 `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* 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_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* 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 /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `int' if does not define. */ #undef pid_t /* Define as `fork' if `vfork' does not work. */ #undef vfork apparix-07-261/configure0000775002600400000120000060147710673721155012121 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for apparix 07-261. # # Report bugs to . # # Copyright (C) 2003 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 DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/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 -z "`(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 test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval 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="eval 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='apparix' PACKAGE_TARNAME='apparix' PACKAGE_VERSION='07-261' PACKAGE_STRING='apparix 07-261' PACKAGE_BUGREPORT='mcx-devel@lists.micans.org' ac_unique_file="src/apparix.c" # 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 CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S RANLIB ac_ct_RANLIB CPP EGREP 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 apparix 07-261 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 case $ac_init_help in short | recursive ) echo "Configuration of apparix 07-261:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors 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. Report bugs to . _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 # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac 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 apparix configure 07-261 generated by GNU Autoconf 2.59 Copyright (C) 2003 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 apparix $as_me 07-261, which was generated by GNU Autoconf 2.59. 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 && 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 ac_config_headers="$ac_config_headers config.h" PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION am__api_version="1.9" 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" # OS/2's system install, which has a completely different semantic # ./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/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /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 if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # We used to keeping the `.' as first argument, in order to # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) # where $(somedir) is conditionally defined. However this is wrong # for two reasons: # 1. if the package is installed by a user who cannot write `.' # make install will fail, # 2. the above comment should most certainly read # $(mkdir_p) $(DESTDIR)$(somedir) # so it does not work when $(somedir) is undefined and # $(DESTDIR) is not. # To support the latter case, we have to write # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), # so the `.' trick is pointless. mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. for d in ./-p ./--version; do test -d $d && rmdir $d done # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. if test -f "$ac_aux_dir/mkinstalldirs"; then mkdir_p='$(mkinstalldirs)' else mkdir_p='$(install_sh) -d' fi 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 rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # 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 # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=$PACKAGE VERSION=$VERSION 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"} 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. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # AM_CONFIG_HEADER(config.h) # AC_CONFIG_HEADERS([config.h]) # add a `--enable-maintainer-mode' option to `configure'; `maintainer-only' rules turned off by # default in Makefile.in's echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi; echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Checks for programs. 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 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 /* 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 file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $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 /* 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 /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 /* 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; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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 \ '' \ '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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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.err 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 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit 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 | grep -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 # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub 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 # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # 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. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/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=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi 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 "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # 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" # OS/2's system install, which has a completely different semantic # ./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/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /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 ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi 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 # Checks for libraries. # FIXME: Replace `main' with a function in `-lm': echo "$as_me:$LINENO: checking for main in -lm" >&5 echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6 if test "${ac_cv_lib_m_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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_m_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_main=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5 echo "${ECHO_T}$ac_cv_lib_m_main" >&6 if test $ac_cv_lib_m_main = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" fi # Checks for header files. 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 /* 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 ac_cpp_err=$ac_cpp_err$ac_c_werror_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 /* 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 ac_cpp_err=$ac_cpp_err$ac_c_werror_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 /* 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 ac_cpp_err=$ac_cpp_err$ac_c_werror_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 /* 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 ac_cpp_err=$ac_cpp_err$ac_c_werror_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 /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 /* 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 /* 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 /* 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 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 echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 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 /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 fcntl.h float.h limits.h stdlib.h string.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 /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 /* 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 ac_cpp_err=$ac_cpp_err$ac_c_werror_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:$ac_c_preproc_warn_flag 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 compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; 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: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------------- ## ## Report this to mcx-devel@lists.micans.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 # Checks for typedefs, structures, and compiler characteristics. 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 /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 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 /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 # Checks for library functions. for ac_func in vprintf 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* 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 #undef $ac_func /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 echo "$as_me:$LINENO: checking for _doprnt" >&5 echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 if test "${ac_cv_func__doprnt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define _doprnt to an innocuous variant, in case declares _doprnt. For example, HP-UX 11i declares gettimeofday. */ #define _doprnt innocuous__doprnt /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef _doprnt /* 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 _doprnt (); /* 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__doprnt) || defined (__stub____doprnt) choke me #else char (*f) () = _doprnt; #endif #ifdef __cplusplus } #endif int main () { return f != _doprnt; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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_func__doprnt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 echo "${ECHO_T}$ac_cv_func__doprnt" >&6 if test $ac_cv_func__doprnt = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DOPRNT 1 _ACEOF fi fi done for ac_header in unistd.h vfork.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 /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 /* 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 ac_cpp_err=$ac_cpp_err$ac_c_werror_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:$ac_c_preproc_warn_flag 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 compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; 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: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------------- ## ## Report this to mcx-devel@lists.micans.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 fork vfork 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* 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 #undef $ac_func /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 if test "x$ac_cv_func_fork" = xyes; then echo "$as_me:$LINENO: checking for working fork" >&5 echo $ECHO_N "checking for working fork... $ECHO_C" >&6 if test "${ac_cv_func_fork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_fork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* By Ruediger Kuhlmann. */ #include #if HAVE_UNISTD_H # include #endif /* Some systems only have a dummy stub for fork() */ int main () { if (fork() < 0) exit (1); 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_fork_works=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_fork_works=no fi rm -f 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_fork_works" >&5 echo "${ECHO_T}$ac_cv_func_fork_works" >&6 else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then echo "$as_me:$LINENO: checking for working vfork" >&5 echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 if test "${ac_cv_func_vfork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_vfork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ #include #include #include #include #include #if HAVE_UNISTD_H # include #endif #if HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; exit( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 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_vfork_works=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_vfork_works=no fi rm -f 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_vfork_works" >&5 echo "${ECHO_T}$ac_cv_func_vfork_works" >&6 fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_VFORK 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define vfork fork _ACEOF fi if test "x$ac_cv_func_fork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_FORK 1 _ACEOF fi for ac_header in stdlib.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 /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 /* 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 ac_cpp_err=$ac_cpp_err$ac_c_werror_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:$ac_c_preproc_warn_flag 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 compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; 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: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------------------- ## ## Report this to mcx-devel@lists.micans.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 GNU libc compatible malloc" >&5 echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6 if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_malloc_0_nonnull=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if STDC_HEADERS || HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { exit (malloc (0) ? 0 : 1); ; 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_func_malloc_0_nonnull=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_malloc_0_nonnull=no fi rm -f 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_malloc_0_nonnull" >&5 echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6 if test $ac_cv_func_malloc_0_nonnull = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MALLOC 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define HAVE_MALLOC 0 _ACEOF case $LIBOBJS in "malloc.$ac_objext" | \ *" malloc.$ac_objext" | \ "malloc.$ac_objext "* | \ *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac cat >>confdefs.h <<\_ACEOF #define malloc rpl_malloc _ACEOF fi echo "$as_me:$LINENO: checking for working memcmp" >&5 echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 if test "${ac_cv_func_memcmp_working+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_memcmp_working=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = 0x40, c1 = 0x80, c2 = 0x81; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) exit (1); /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) exit (1); } exit (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_func_memcmp_working=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_memcmp_working=no fi rm -f 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_memcmp_working" >&5 echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 test $ac_cv_func_memcmp_working = no && case $LIBOBJS in "memcmp.$ac_objext" | \ *" memcmp.$ac_objext" | \ "memcmp.$ac_objext "* | \ *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac # AC_FUNC_REALLOC for ac_func in dup2 floor memset pow regcomp sqrt strchr strrchr strstr 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* 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 #undef $ac_func /* 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>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); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (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); }; } && { 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.err 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 # AC_CONFIG_FILES([]) ac_config_files="$ac_config_files Makefile util/Makefile src/Makefile doc/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 "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi 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 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" 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 DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/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 -z "`(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 test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval 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="eval 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 apparix $as_me 07-261, which was generated by GNU Autoconf 2.59. 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="\\ apparix config.status 07-261 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 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" ;; "util/Makefile" ) CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/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,@CYGPATH_W@,$CYGPATH_W,;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,@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,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;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,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@LN_S@,$LN_S,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;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 # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac 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; }; } # Do quote $f, to prevent DOS paths from being IFS'd. 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 # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(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'`/stamp-h$_am_stamp_count 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'` { 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 # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { 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 # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. 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 " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/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 apparix-07-261/AUTHORS0000664002600400000120000000014610322441377011240 00000000000000 apparix was written by Stijn van Dongen apparix's build environment was created by Joost van Baal. apparix-07-261/COPYING0000644002600400000120000010451310642151107011216 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 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 state 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 3 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, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program 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, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU 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 Lesser General Public License instead of this License. But first, please read . apparix-07-261/ChangeLog0000664002600400000120000001732010673731716011754 00000000000000 Tue 18 Sep 2007 * apparix-07-261 released. * --squash-mark and --squash-dest have gone. They are now replaced by -sm and -sd . Squashing can no longer be applied globally but must be targeted at a specific bookmark or its destination. This is more in line with expected use. See further below. * apparix -sd MARK squashes all the *other* marks that point to the destination bookmarked under MARK. Only MARK is kept for this destination. * apparix -ld MARK lists all bookmarks MARK (noting that the same bookmark is allowed to point to multiple locations) and additionally lists all other bookmarks that share the destination with one of the MARK bookmarks. This allows one to predict the effect of issuing 'apparix -sd MARK'. * apparix -sm MARK squashes all the distinct destinations under the same bookmark MARK. By default the last destination is taken. * apparix -lm MARK lists all the distinct destinations under the same bookmark MARK. * Apparix squash and purge options now output the dumped bookmarks as command-line statements ready to reimport, rather than the format used in the apparix rc file. A cut and paste will reinstate unwanted removals. Set APPARIXPURGE to 1 to have dumped bookmarks in the apparixrc file format. * The environment variable APPARIXTAG, if set, is incorporated into the names of the apparix resource files. By default these are .apparixrc and .apparixexpand. When APPARIXTAG is set to they become .apparixrc and .apparixexpand. This can be used e.g. to have different resource files on different host machines. * If the environment APPARIXLOG is set its value is interpreted as a log file that has all newly created jumps and portals appended to it. Wed 3 Jul 2007 * apparix-07-184 released. * Apparix is now licensed under the GNU General Public License version 3. * Added --quiet-jump option. By default apparix will emit an error message and set the exit status to 1 when looking up a mark and not finding it. With this option, it is silent. It will still exit with status 1. * For portal expansion apparix would exclude the destination 'CVS', and this was hardcoded. Exclusion behaviour is now specified using the environment variable APPARIXEXCLUDE. This variable has the following syntax: <[:,][]>+ That is, a list of names with each name preceded by a colon or a comma. A colon indicates that triggers exclusion of directory names for which the trailing component is identical to . A comma indicates that triggers exclusion of directory names for which the trailing component contains as a substring. Example: export APPARIXEXCLUDE=:CVS:lib,tmp Curiosity: export APPARIXEXCLUDE=, will exclude everything from expansion, as it specifies the empty string. Fri 10 Nov 2006 * apparix-06-314 released. * Fixed Yet Another Bug that Boggles the Mind. In the last two releases bookmarks could not be added at all, due to the addition of a status check that triggers an erroneous status initialization. This was a bad month. Wed 8 Nov 2006 * apparix-06-312 released. * Fix dumb realloc-related apparix crash (n_old and n_new were in the wrong order) that manifests itself with bookmark nr 100. Fri 20 Oct 2006 * apparix-06-293 released. * Fix dumb apparix crash when .apparixrc is not present. (This bug would occur only once as apparix created .apparixrc before crashing). * Warn when commas are found in mark or target. Tue 23 May 2006 * apparix-06-142 released. * --squash-mark was badly implemented and would generally not work. It now works and preserves newer entries (those occurring later in the file .apparixrc) over older entries by default. To change this behaviour use -favour . * If a new bookmark already exists either as a regular bookmark or as a portal destination apparix will emit a short message when the bookmark is created. * Added -l option for paragraph listing of all available jumps. * Added -d option for dumping the resource file to STDOUT. * Added -u option for undoing the last k bookmarks. * The -favour default in to() functions/macros is set to rOl, implying: 1) regular bookmarks are prefered over expansions 2) younger bookmarks are prefered over older bookmarks 3) paths with fewer components are prefered. With this setting 3) is never reached as 2) will never be a tie. * Added alias -sm for -squash-mark * The -favour default with --squash-mark and -sm is set to Olr implying that younger bookmarks will be preserved. * Squashing and purging currently only works on regular style bookmarks due to finally specified semantics. Edit .apparixrc to do things to portals. They are 'special' and quite likely you have only few. * The output format when simply listing bookmarks has slightly changed. There are now three consecutive sections: portals, expansions, bookmarks. * --add-portal uses the same getcwd/pwd code as --add-jump does (rather than unconditionally using getcwd). * Changed -rid to -purge, -rid-mark to -purge-mark. Thu 5 Jan 2006 * apparix-06-005 released. * Documentation changes. Added GETTING STARTED paragraph. Thu, 10 Nov 2005 * apparix-05-314 released - major new features. * NOTE It is necessary to update your functions or aliases; issue apparix --shell-examples to find the up-to-date default versions. * Integrated bash completion code contributed by Sitaram Chamarty. It is now possible to tab-complete on subdirectories of the directory identified by a mark. Thus to myfoo will give you a menu of or cycle through the subdirectories of the myfoo target directory, depending on your completion settings. It is also possible to do to myfoo PAT This will only select those subdirectories that match the shell-pattern PAT. As a reminder, to to PAT do the same but then on apparix bookmarks. * The to() function/alias reads its input directly from apparix without requiring an intermediate file. So .apparixresult is no longer created. * Fixed stupid copy-code bug in bash bm() and portal(). They would initiate a jump. * The -quo / --quo options were dropped. Simply use apparix without arguments to get the list of bookmarks. * added -favour option to resolve duplicate bookmarks. It is needed in the bash completion code. Typical usage (in the wrapper functions): -favour lro l level (shorter paths prefered) r regular bookmarks prefered (not expansions) o older bookmarks prefered LRO do the opposite. * Added --bu and -bu backup options. * Significant documentation updates. Wed, 2 Nov 2005 * apparix-05-306 released. * apparix --add-jump without any arguments will take the trailing component of the current directory as the bookmark, with the directory itself as the destination. With the shorthand alias/function bm that means simply entering bm does the trick. * The bash to() function was wrongly documented. It would not pass through subdirectory specification. Now updated. * added -v option to show version information. * more documentation. Mon, 10 Oct 2005 * apparix-05-283 released * initial release. apparix-07-261/INSTALL0000644002600400000120000002203010340613035011203 00000000000000Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. apparix-07-261/NEWS0000664002600400000120000000000010322036240010641 00000000000000apparix-07-261/THANKS0000664002600400000120000000061010435541754011104 00000000000000 Thanks to: Joost van Baal author of the build environment. Stefan Kamphausen for writing cdargs which begat apparix. Sitaram Chamarty contributed the bash completion mechanism for apparix. It was first modelled after the cdargs equivalent, but then took on a life of its own as it acquired completion on subdirectory names of the bookmark target. apparix-07-261/TODO0000664002600400000120000000235410673326214010664 00000000000000 $ change to tab separated resource files. - make backup mechanism where date tag is automatically added. - [src] it would be neater to have the shell examples in a separate file and have code that incorporates it into the C source (a la clmformat). - enable sorting with 'apparix -l', 'apparix', possibly 'apparix -d' - sorting for jumping can first grep the bookmark into a mini-folder. ? when a subdirectory is given it could be used to resolve multiple hits (bit too fancy though). ? portal: option to prepend prefix to all bookmarks. This would require change of rc format (because of rehashing) ? for a portal, optionally add a bookmark for the portal itself. could do this with a two-argument invocation. # read from $APPARIXRC (to support different file systems / machines) # make a mode (maybe -a) to simply list all matching occurrences without going into the menu if multiple matches. hum ho, that's what grep is for. note that simply 'apparix' lists all the bookmarks. # if no exact match, make menu for strstr occurrences. (e.g. strcmp/strstr callback to attempt_jump) bash tab completion does this nicely. # a 'rename' option. apparix -r foo bar difficult with duplicates: use editor. apparix-07-261/depcomp0000755002600400000120000003554510340613035011546 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2004-05-31.23 # Copyright (C) 1999, 2000, 2003, 2004 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 . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit 0 ;; -v | --v*) echo "depcomp $scriptversion" exit 0 ;; esac 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 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 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. In older versions, 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. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # 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" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" 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. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # Dependencies are output in .lo.d with libtool 1.4. # With libtool 1.5 they are output both in $dir.libs/$base.o.d # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the # latter, because the former will be cleaned when $dir.libs is # erased. tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir$base.o.d" tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" elif test -f "$tmpdepfile2"; then tmpdepfile="$tmpdepfile2" else tmpdepfile="$tmpdepfile3" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space 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 preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 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) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # 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 ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 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 preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" 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 preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " 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" 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 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: apparix-07-261/install-sh0000775002600400000120000001302710322036240012163 00000000000000#!/bin/sh # # $Id: install-sh,v 1.1 2004/08/18 16:32:53 flux Exp $ # # 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=: chmodcmd="" 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 apparix-07-261/missing0000755002600400000120000002466610340613035011572 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2003-09-02.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois 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. # 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. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. 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 --run try to run the given command, and emulate it if it fails 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 create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 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$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. 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." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. 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 ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. 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 prerequisites 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 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: apparix-07-261/LICENSE0000664002600400000120000000132210330374751011172 00000000000000 These programs are free software; you can redistribute and/or modify them 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. These programs are distributed in the hope that they 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. apparix-07-261/VERSION0000664002600400000120000000000710673731736011246 0000000000000007-261 apparix-07-261/bootstrap0000755002600400000120000000155410322315204012122 00000000000000#!/bin/sh -e # $Id: bootstrap,v 1.1 2005/10/09 22:32:36 flux Exp $ # # bootstrap - script to bootstrap the distribution rolling engine # # to build a tarball, ready for distribution, from fresh checked out # cvs sources, do # # automake --add-missing && ./bootstrap && ./configure && make distcheck # # this will yield a tarball, e.g. zoem-20020109.tar.gz . Once this has been # run, one can, after e.g. editing sources, run just # # make distcheck # # to generate a new tarball. (No need to run ./bootstrap again in this case.) # After downloading, users do # # tar zxf mcl-20020109.tar.gz # cd mcl-20020109 # ./configure && make # make install # set -x if test ! -f VERSION then ./setversion fi if test ! -L util/Makefile.am then ./mkutil fi aclocal \ && autoheader \ && automake --verbose --gnu --add-missing \ && autoconf apparix-07-261/setversion0000755002600400000120000000131710434550673012322 00000000000000#!/bin/sh -e # $Id: setversion,v 1.4 2006-05-23 09:11:23 flux Exp $ # called in bootstrap # be verbose set -x TAG=1.003 VERSION=`date '+%y-%j'` echo $VERSION > VERSION cat > configure.ac <> configure.ac # echo '#include "version.h"' > src/version.c echo 'const char *apxDateTag = "'$VERSION'";' > src/version.c echo 'const char *apxNumTag = "'$TAG'";' >> src/version.c echo $TAG > doc/stamp.tag date '+%y-%j' > doc/stamp.stamp date '+%e' > doc/stamp.day date '+%b' > doc/stamp.month date '+%Y' > doc/stamp.year apparix-07-261/util/0000777002600400000120000000000010673731737011241 500000000000000apparix-07-261/util/Makefile.am0000644002600400000120000000136310345612300013170 00000000000000## Process this file with automake to produce Makefile.in ## $Id: Makefile.am-assimilate,v 1.3 2005-12-07 16:58:40 flux Exp $ INCLUDES = -I$(top_srcdir) noinst_LIBRARIES = libutil.a libutil_a_SOURCES = alloc.c array.c rand.c equate.c opt.c io.c \ err.c hash.c heap.c let.c list.c gralloc.c tok.c ting.c ding.c \ tr.c EXTRA_DIST = alloc.h array.h rand.h equate.h hash.h heap.h let.h io.h \ opt.h err.h tok.h ting.h ding.h list.h gralloc.h tok.h \ compile.h getpagesize.h types.h inttypes.h minmax.h tr.h apparix-07-261/util/Makefile.in0000644002600400000120000003142210673721154013214 00000000000000# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ SOURCES = $(libutil_a_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = util DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libutil_a_AR = $(AR) $(ARFLAGS) libutil_a_LIBADD = am_libutil_a_OBJECTS = alloc.$(OBJEXT) array.$(OBJEXT) rand.$(OBJEXT) \ equate.$(OBJEXT) opt.$(OBJEXT) io.$(OBJEXT) err.$(OBJEXT) \ hash.$(OBJEXT) heap.$(OBJEXT) let.$(OBJEXT) list.$(OBJEXT) \ gralloc.$(OBJEXT) tok.$(OBJEXT) ting.$(OBJEXT) ding.$(OBJEXT) \ tr.$(OBJEXT) libutil_a_OBJECTS = $(am_libutil_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libutil_a_SOURCES) DIST_SOURCES = $(libutil_a_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ INCLUDES = -I$(top_srcdir) noinst_LIBRARIES = libutil.a libutil_a_SOURCES = alloc.c array.c rand.c equate.c opt.c io.c \ err.c hash.c heap.c let.c list.c gralloc.c tok.c ting.c ding.c \ tr.c EXTRA_DIST = alloc.h array.h rand.h equate.h hash.h heap.h let.h io.h \ opt.h err.h tok.h ting.h ding.h list.h gralloc.h tok.h \ compile.h getpagesize.h types.h inttypes.h minmax.h tr.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu util/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu util/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libutil.a: $(libutil_a_OBJECTS) $(libutil_a_DEPENDENCIES) -rm -f libutil.a $(libutil_a_AR) libutil.a $(libutil_a_OBJECTS) $(libutil_a_LIBADD) $(RANLIB) libutil.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ding.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/equate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gralloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/let.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ting.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tok.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tr.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: 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 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; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(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 "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_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 tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ 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"; \ $(mkdir_p) "$(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: 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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am 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 pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-info-am # 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: apparix-07-261/util/alloc.c0000644002600400000120000000704610642147132012404 00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* include include include include */ #include #include #include "alloc.h" #include "err.h" static dim mcx_alloc_maxchunksize = 1048576; static long mcx_alloc_maxtimes = -1; static mcxbool mcx_alloc_limit = FALSE; void mcxAllocLimits ( long maxchunksize , long maxtimes ) { if (maxchunksize > 0) mcx_alloc_maxchunksize = maxchunksize ; if (maxtimes > 0) mcx_alloc_maxtimes = maxtimes ; mcx_alloc_limit = TRUE; ; } void* mcxRealloc ( void* object , dim new_size , mcxOnFail ON_FAIL ) { void* mblock = NULL ; mcxstatus status = STATUS_OK ; if (!new_size) { if (object) mcxFree(object) ; } else { if ( mcx_alloc_limit && (!mcx_alloc_maxtimes-- || new_size > mcx_alloc_maxchunksize) ) mblock = NULL ; else mblock = object ? realloc(object, new_size) : malloc(new_size) ; } if (new_size && (!mblock)) mcxMemDenied(stderr, "mcxRealloc", "byte", new_size) , status = 1 ; if (status) { if (ON_FAIL == SLEEP_ON_FAIL) { mcxTell("mcxRealloc", "pid %ld, entering sleep mode", (long) getpid()) ; while(1) sleep(1000) ; } if (ON_FAIL == EXIT_ON_FAIL) { mcxTell("mcxRealloc", "going down") ; exit(1) ; } } return mblock ; } void mcxNFree ( void* base , dim n_elem , dim elem_size , void (*obRelease) (void *) ) { if (n_elem && obRelease) { char *ob = base ; while (n_elem-- > 0) obRelease(ob) , ob += elem_size ; } mcxFree(base) ; } void* mcxNAlloc ( dim n_elem , dim elem_size , void* (*obInit) (void *) , mcxOnFail ON_FAIL ) { return mcxNRealloc(NULL, n_elem, 0, elem_size, obInit, ON_FAIL) ; } void* mcxNRealloc ( void* mem , dim n_elem , dim n_elem_prev , dim elem_size , void* (*obInit) (void *) , mcxOnFail ON_FAIL ) { char* ob ; mem = mcxRealloc(mem, n_elem * elem_size, ON_FAIL) ; if (!mem) return NULL ; if (obInit && n_elem > n_elem_prev) { ob = ((char*) mem) + (elem_size * n_elem_prev) ; while (n_elem-- > n_elem_prev) /* careful with unsignedness */ { obInit(ob) ; ob += elem_size ; } } return mem ; } void mcxMemDenied ( FILE* channel , const char* requestee , const char* unittype , dim n ) { mcxErrf ( channel , requestee , "memory shortage: could not alloc [%lu] instances of [%s]" , (ulong) n , unittype ) ; } void mcxFree ( void* object ) { if (object) free(object) ; } void* mcxAlloc ( dim size , mcxOnFail ON_FAIL ) { return mcxRealloc(NULL, size, ON_FAIL) ; } apparix-07-261/util/array.c0000644002600400000120000002014010642147132012416 00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include "array.h" #include "alloc.h" #include "types.h" #include "err.h" #include "minmax.h" mcxstatus mcxSplice ( void* base1pptr , const void* base2ptr , dim size /* size of base1 and base2 members */ , dim *pn_base1 /* # base1 elements currently in use */ , dim *pN_base1 /* # base1 elements for which is malloced */ , ofs O_base1 /* splice relative to this element */ , dim d_base1 /* delete this number of elements */ , dim c_base2 /* number of elements to copy */ ) { char **ppr1 = (char **) base1pptr ; char* dummy ; const char *ptr2 = (const char *) base2ptr ; dim n_base1 = *pn_base1 ; dim N_base1 = *pN_base1 ; dim m_base1, o_base1 ; const char *errMsg = "" ; mcxstatus stat = STATUS_FAIL ; while (1) { if (n_base1 > N_base1) { errMsg = "integer arguments not consistent" ; break ; } if (n_base1 + c_base2 < d_base1) { errMsg = "overly deleterious" ; break ; } m_base1 = (n_base1 + c_base2) - d_base1 /* new size */ ; if (O_base1 >= 0) o_base1 = O_base1 ; else { if ((dim) -O_base1 > n_base1 + 1) { errMsg = "offset specification out of bounds" ; break ; } o_base1 = (n_base1 + 1) + O_base1 ; } if (o_base1 > n_base1) { errMsg = "computed splice offset not in bounds" ; break ; } if (*ppr1 == NULL && ptr2 == NULL) { errMsg = "source and destination both void" ; break ; } if (o_base1 + d_base1 > n_base1) { errMsg = "not that many elements to delete" ; break ; } stat = STATUS_OK ; break ; } if (stat != STATUS_OK) { mcxErr("[mcxSplice PBD]", "%s", errMsg) ; mcxErr ( "[mcxSplice PBD]" , "[n1, %lu] [N1, %lu] [o1, %lu] [d1, %lu] [c2, %lu]" , (ulong) n_base1, (ulong) N_base1 , (ulong) O_base1 , (ulong) d_base1, (ulong) c_base2 ) ; return STATUS_FAIL ; } if (m_base1 > N_base1) { if (!(dummy = mcxRealloc(*ppr1, size*m_base1, RETURN_ON_FAIL))) { mcxMemDenied(stderr, "mcxSplice", "void", m_base1) ; return STATUS_FAIL ; } *pN_base1 = N_base1 = m_base1 ; *ppr1 = dummy ; } if (o_base1 < n_base1) memmove ( *ppr1 + size*(o_base1 + c_base2) , *ppr1 + size*(o_base1 + d_base1) , size*(n_base1 - o_base1 - d_base1) ) ; if (c_base2) memcpy ( *ppr1 + size * (o_base1) , ptr2 , size*(c_base2) ) ; *pn_base1 = m_base1 ; return STATUS_OK ; } dim mcxDedup ( void* base , dim nmemb , dim size , int (*cmp)(const void *, const void *) , void (*merge)(void *, const void *) ) { dim k = 0 ; dim l = 0 ; while (l < nmemb) { if (k != l) memcpy(((char*)base) + k * size, ((char*)base) + l * size, size) ; while ( ++l < nmemb && ( cmp ? (!cmp(((char*)base) + k * size, ((char*)base) + l * size)) : (!memcmp(((char*)base) + k*size, ((char*)base) + l*size, size)) ) ) { if (merge) merge(((char*)base) + k * size, ((char*)base) + l * size) ; } k++ ; } return k ; } mcxstatus mcxResize ( void* mempp , dim size , dim* ct , dim newct , mcxOnFail ON_FAIL ) { char **pp = (char **) mempp ; char* ptr = *pp ; if (newct && !(ptr = mcxRealloc(ptr, size*newct, ON_FAIL))) return STATUS_FAIL ; *pp = ptr ; *ct = newct ; return STATUS_OK ; } mcxstatus mcxBufInit ( mcxBuf* buf , void* mempptr , dim size , dim n_alloc ) { char **usrpptr = (char **) mempptr ; char* dummy ; buf->mempptr = mempptr ; buf->size = size ; buf->n = 0 ; buf->bFinalized = 0 ; buf->factor = 1.41 ; dummy = mcxRealloc ( *usrpptr , n_alloc * size , RETURN_ON_FAIL ) ; if (n_alloc && !dummy) { mcxMemDenied(stderr, "mcxBufInit", "char", n_alloc * size) ; buf->n_alloc = 0 ; return STATUS_FAIL ; } buf->n_alloc = n_alloc ; *usrpptr = dummy ; return STATUS_OK ; } void* mcxBufExtend ( mcxBuf* buf , dim n_request , mcxOnFail ON_FAIL ) { dim oldsize = buf->n ; char **usrpptr = (char **) buf->mempptr ; char* dummy ; if (buf->bFinalized) mcxErr("mcxBufExtend PBD", "extending finalized buffer") ; if (buf->n_alloc < buf->n + n_request) { dim n_new = MAX ( (dim) (buf->n_alloc * buf->factor + 8) , (dim) (buf->n + n_request) ) ; dummy = mcxRealloc(*usrpptr, n_new * buf->size, ON_FAIL) ; if (n_new && !dummy) { mcxMemDenied(stderr,"mcxBufExtend","char",buf->n*buf->size) ; return NULL ; } buf->n_alloc = n_new ; *usrpptr = dummy ; } buf->n += n_request ; return *usrpptr + (oldsize * buf->size) ; } dim mcxBufFinalize ( mcxBuf* buf ) { char **usrpptr = (char **) buf->mempptr ; char* dummy ; if (buf->bFinalized) mcxErr("mcxBufFinalize PBD", "extending finalized buffer") ; else buf->bFinalized = 1 ; dummy = mcxRealloc ( *usrpptr , buf->n * buf->size , RETURN_ON_FAIL ) ; if (buf->n && !dummy) { mcxMemDenied(stderr, "mcxBufFinalize", "char", buf->n * buf->size) ; errno = ENOMEM ; return buf->n ; } *usrpptr = dummy ; buf->n_alloc = buf->n ; return buf->n ; } void mcxBufReset ( mcxBuf* buf , void* mempptr ) { if (!buf->bFinalized) mcxErr("mcxBufReset PBD", "buffer not finalized") ; buf->mempptr = mempptr ; buf->n = 0 ; buf->n_alloc = 0 ; buf->bFinalized = 0 ; } void* mcxBsearchCeil ( const void *key , const void *base , dim nmemb , dim size , int (*cmp)(const void *, const void *) ) { ofs lft /* fixme (consider -1 initialization) */ ; dim bar, rgt ; if (!nmemb || cmp(key, ((char*)base) + (nmemb-1) * size) > 0) return NULL ; if (cmp(key, base) <= 0) ; lft = -1 ; rgt = nmemb ; bar = nmemb / 2 ; while (lft < 0 || bar < (dim) rgt) { if (cmp(key, ((char*) base) + bar*size) > 0) lft = bar ; else rgt = bar ; bar = rgt - (rgt-lft) / 2; ; } return (((char*) base) + bar * size) ; } void* mcxBsearchFloor ( const void *key , const void *base , dim nmemb , dim size , int (*cmp)(const void *, const void *) ) { ofs lft ; dim bar, rgt ; if (!nmemb || cmp(key, base) < 0) return NULL ; lft = -1 ; rgt = nmemb ; bar = nmemb / 2 ; while (lft < 0 || bar > (dim) lft) { if (cmp(key, ((char*) base) + bar*size) < 0) rgt = bar ; else lft = bar ; bar = lft + (rgt-lft) / 2; ; } return (((char*) base) + bar * size) ; } apparix-07-261/util/rand.c0000644002600400000120000002372210642147132012235 00000000000000/* (C) Copyright 2004, 2005, 2006, 2007 Stijn van Dongen * * (C) Ziggurat method Copyright 2005 Jochen Voss. * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include "rand.h" #include "math.h" #include "types.h" unsigned long mcxSeed ( unsigned long i ) { pid_t p = getpid() ; pid_t pp = getppid() ; time_t t = time(NULL) ; unsigned long s = (p ^ p << 4 ^ p << 16 ^ p << 28) ^ (pp ^ pp << 8 ^ pp << 24) ^ (t ^ t << 12 ^ t << 20) ^ (i ^ i << 3 ^ i << 23 ^ i << 26) /* I have no solid evidence backing up the usefulness of the xors. * They won't increase entropy anyway of course. * Anyway, the xors do seem useful in order to spread input * bits out over the output space, as seen from some hashing * experiments. */ ; return s ; } /* Box-Muller transform */ double mcxNormalBoxMuller ( void ) { double a = 1.0 - (random() * 1.0) / (RAND_MAX + 1.0) ; double b = 1.0 - (random() * 1.0) / (RAND_MAX + 1.0) ; return sqrt( -2.0 * log(a)) * cos(2*3.14159265358979323846*b) ; } double mcxNormal ( void ) { return mcxNormalZiggurat() ; } double mcxNormalCut ( double radius , double stddev ) { dim d ; if (radius < 0) radius = -radius ; for (d=0;d<256;d++) { double r = stddev * mcxNormal() ; if (r >= -radius && r <= radius) return r ; } return 0.0 ; } double mcxNormalSample ( double radius , double stddev ) { int n_try = 0 ; double r = 2 * radius * (((1.0 * random()) / RAND_MAX) - 0.5) ; while (n_try++ < 1000) { double n = exp( - (r * r) / (2 * stddev * stddev)) / (2.5066282746 * stddev) ; double p = (1.0 * random()) / RAND_MAX ; if (n >= p) break ; r = 2 * radius * (((1.0 * random()) / RAND_MAX) - 0.5) ; } return r ; } /* Ziggurat method * * Copyright (C) 2005 Jochen Voss. * * For details see the following article. * * George Marsaglia, Wai Wan Tsang * The Ziggurat Method for Generating Random Variables * Journal of Statistical Software, vol. 5 (2000), no. 8 * http://www.jstatsoft.org/v05/i08/ */ /* position of right-most step */ #define PARAM_R 3.44428647676 /* tabulated values for the heigt of the Ziggurat levels */ static const double ytab[128] = { 1.000000000000 , 0.963598623011 , 0.936280813353 , 0.913041104253 , 0.892278506696 , 0.873239356919 , 0.855496407634 , 0.838778928349 , 0.822902083699 , 0.807732738234 , 0.793171045519 , 0.779139726505 , 0.765577436082 , 0.752434456248 , 0.739669787677 , 0.727249120285 , 0.715143377413 , 0.703327646455 , 0.691780377035 , 0.680482768910 , 0.669418297233 , 0.658572339120 , 0.647931876189 , 0.637485254896 , 0.627221991450 , 0.617132611532 , 0.607208517467 , 0.597441877296 , 0.587825531465 , 0.578352913803 , 0.569017984198 , 0.559815170911 , 0.550739320877 , 0.541785656682 , 0.532949739145 , 0.524227434628 , 0.515614886373 , 0.507108489253 , 0.498704867478 , 0.490400854812 , 0.482193476986 , 0.474079936010 , 0.466057596125 , 0.458123971214 , 0.450276713467 , 0.442513603171 , 0.434832539473 , 0.427231532022 , 0.419708693379 , 0.412262232120 , 0.404890446548 , 0.397591718955 , 0.390364510382 , 0.383207355816 , 0.376118859788 , 0.369097692334 , 0.362142585282 , 0.355252328834 , 0.348425768415 , 0.341661801776 , 0.334959376311 , 0.328317486588 , 0.321735172063 , 0.315211514970 , 0.308745638367 , 0.302336704338 , 0.295983912320 , 0.289686497571 , 0.283443729739 , 0.277254911560 , 0.271119377649 , 0.265036493387 , 0.259005653912 , 0.253026283183 , 0.247097833139 , 0.241219782932 , 0.235391638239 , 0.229612930649 , 0.223883217122 , 0.218202079518 , 0.212569124201 , 0.206983981709 , 0.201446306496 , 0.195955776745 , 0.190512094256 , 0.185114984406 , 0.179764196185 , 0.174459502324 , 0.169200699492 , 0.163987608600 , 0.158820075195 , 0.153697969964 , 0.148621189348 , 0.143589656295 , 0.138603321143 , 0.133662162669 , 0.128766189309 , 0.123915440582 , 0.119109988745 , 0.114349940703 , 0.109635440230 , 0.104966670533 , 0.100343857232 , 0.0957672718266 , 0.0912372357329 , 0.0867541250127 , 0.082318375932 , 0.0779304915295 , 0.0735910494266 , 0.0693007111742 , 0.065060233529 , 0.0608704821745 , 0.0567324485840 , 0.0526472709800 , 0.0486162607163 , 0.0446409359769 , 0.0407230655415 , 0.0368647267386 , 0.0330683839378 , 0.0293369977411 , 0.0256741818288 , 0.0220844372634 , 0.0185735200577 , 0.0151490552854 , 0.0118216532614 , 0.00860719483079, 0.00553245272614, 0.00265435214565 } ; /* tabulated values for 2^24 times x[i]/x[i+1], * used to accept for U*x[i+1]<=x[i] * without any floating point operations */ static const unsigned long ktab[128] = { 0 , 12590644 , 14272653 , 14988939 , 15384584 , 15635009 , 15807561 , 15933577 , 16029594 , 16105155 , 16166147 , 16216399 , 16258508 , 16294295 , 16325078 , 16351831 , 16375291 , 16396026 , 16414479 , 16431002 , 16445880 , 16459343 , 16471578 , 16482744 , 16492970 , 16502368 , 16511031 , 16519039 , 16526459 , 16533352 , 16539769 , 16545755 , 16551348 , 16556584 , 16561493 , 16566101 , 16570433 , 16574511 , 16578353 , 16581977 , 16585398 , 16588629 , 16591685 , 16594575 , 16597311 , 16599901 , 16602354 , 16604679 , 16606881 , 16608968 , 16610945 , 16612818 , 16614592 , 16616272 , 16617861 , 16619363 , 16620782 , 16622121 , 16623383 , 16624570 , 16625685 , 16626730 , 16627708 , 16628619 , 16629465 , 16630248 , 16630969 , 16631628 , 16632228 , 16632768 , 16633248 , 16633671 , 16634034 , 16634340 , 16634586 , 16634774 , 16634903 , 16634972 , 16634980 , 16634926 , 16634810 , 16634628 , 16634381 , 16634066 , 16633680 , 16633222 , 16632688 , 16632075 , 16631380 , 16630598 , 16629726 , 16628757 , 16627686 , 16626507 , 16625212 , 16623794 , 16622243 , 16620548 , 16618698 , 16616679 , 16614476 , 16612071 , 16609444 , 16606571 , 16603425 , 16599973 , 16596178 , 16591995 , 16587369 , 16582237 , 16576520 , 16570120 , 16562917 , 16554758 , 16545450 , 16534739 , 16522287 , 16507638 , 16490152 , 16468907 , 16442518 , 16408804 , 16364095 , 16301683 , 16207738 , 16047994 , 15704248 , 15472926 } ; /* tabulated values of 2^{-24}*x[i] */ static const double wtab[128] = { 1.62318314817e-08 , 2.16291505214e-08 , 2.54246305087e-08, 2.84579525938e-08 , 3.10340022482e-08 , 3.33011726243e-08 , 3.53439060345e-08, 3.72152672658e-08 , 3.89509895720e-08 , 4.05763964764e-08 , 4.21101548915e-08, 4.35664624904e-08 , 4.49563968336e-08 , 4.62887864029e-08 , 4.75707945735e-08, 4.88083237257e-08 , 5.00063025384e-08 , 5.11688950428e-08 , 5.22996558616e-08, 5.34016475624e-08 , 5.44775307871e-08 , 5.55296344581e-08 , 5.65600111659e-08, 5.75704813695e-08 , 5.85626690412e-08 , 5.95380306862e-08 , 6.04978791776e-08, 6.14434034901e-08 , 6.23756851626e-08 , 6.32957121259e-08 , 6.42043903937e-08, 6.51025540077e-08 , 6.59909735447e-08 , 6.68703634341e-08 , 6.77413882848e-08, 6.86046683810e-08 , 6.94607844804e-08 , 7.03102820203e-08 , 7.11536748229e-08, 7.19914483720e-08 , 7.28240627230e-08 , 7.36519550992e-08 , 7.44755422158e-08, 7.52952223703e-08 , 7.61113773308e-08 , 7.69243740467e-08 , 7.77345662086e-08, 7.85422956743e-08 , 7.93478937793e-08 , 8.01516825471e-08 , 8.09539758128e-08, 8.17550802699e-08 , 8.25552964535e-08 , 8.33549196661e-08 , 8.41542408569e-08, 8.49535474601e-08 , 8.57531242006e-08 , 8.65532538723e-08 , 8.73542180955e-08, 8.81562980590e-08 , 8.89597752521e-08 , 8.97649321908e-08 , 9.05720531451e-08, 9.13814248700e-08 , 9.21933373471e-08 , 9.30080845407e-08 , 9.38259651738e-08, 9.46472835298e-08 , 9.54723502847e-08 , 9.63014833769e-08 , 9.71350089201e-08, 9.79732621669e-08 , 9.88165885297e-08 , 9.96653446693e-08 , 1.00519899658e-07, 1.01380636230e-07 , 1.02247952126e-07 , 1.03122261554e-07 , 1.04003996769e-07, 1.04893609795e-07 , 1.05791574313e-07 , 1.06698387725e-07 , 1.07614573423e-07, 1.08540683296e-07 , 1.09477300508e-07 , 1.10425042570e-07 , 1.11384564771e-07, 1.12356564007e-07 , 1.13341783071e-07 , 1.14341015475e-07 , 1.15355110887e-07, 1.16384981291e-07 , 1.17431607977e-07 , 1.18496049514e-07 , 1.19579450872e-07, 1.20683053909e-07 , 1.21808209468e-07 , 1.22956391410e-07 , 1.24129212952e-07, 1.25328445797e-07 , 1.26556042658e-07 , 1.27814163916e-07 , 1.29105209375e-07, 1.30431856341e-07 , 1.31797105598e-07 , 1.33204337360e-07 , 1.34657379914e-07, 1.36160594606e-07 , 1.37718982103e-07 , 1.39338316679e-07 , 1.41025317971e-07, 1.42787873535e-07 , 1.44635331499e-07 , 1.46578891730e-07 , 1.48632138436e-07, 1.50811780719e-07 , 1.53138707402e-07 , 1.55639532047e-07 , 1.58348931426e-07, 1.61313325908e-07 , 1.64596952856e-07 , 1.68292495203e-07 , 1.72541128694e-07, 1.77574279496e-07 , 1.83813550477e-07 , 1.92166040885e-07 , 2.05295471952e-07, 2.22600839893e-07 } ; double mcxNormalZiggurat ( void ) { unsigned long U, sign, i, j ; double x = 0.0, y ; while (1) { U = random() ; i = U & 0x0000007F /* 7 bit to choose the step */ ; sign = U & 0x00000080 /* 1 bit for the sign */ ; j = random() & 0x00FFFFFF /* 24 bit for the x-value */ ; x = j*wtab[i] ; if (j < ktab[i]) break ; if (i<127) { double y0, y1 ; y0 = ytab[i] ; y1 = ytab[i+1] ; y = y1+(y0-y1) * mcxUniform0 ; } else { x = PARAM_R - log(mcxUniform1)/PARAM_R ; y = exp(-PARAM_R*(x-0.5*PARAM_R)) * mcxUniform0 ; } if (y < exp(-0.5*x*x)) break ; } return sign ? x : -x ; } apparix-07-261/util/equate.c0000644002600400000120000000547410642147132012601 00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include "equate.h" int dblCmp ( const void* f1 , const void* f2 ) { return ( *((double*)f1) < *((double*)f2) ? -1 : *((double*)f1) > *((double*)f2) ? 1 : 0 ) ; } int dblRevCmp ( const void* f1 , const void* f2 ) { return ( *((double*)f1) > *((double*)f2) ? 1 : *((double*)f1) < *((double*)f2) ? -1 : 0 ) ; } int fltCmp ( const void* f1 , const void* f2 ) { return ( *((float*)f1) < *((float*)f2) ? -1 : *((float*)f1) > *((float*)f2) ? 1 : 0 ) ; } int fltRevCmp ( const void* f1 , const void* f2 ) { return ( *((float*)f1) > *((float*)f2) ? 1 : *((float*)f1) < *((float*)f2) ? -1 : 0 ) ; } int intCmp ( const void* i1 , const void* i2 ) { return ( *((int*)i1) - *((int*)i2)) ; } int intRevCmp ( const void* i1 , const void* i2 ) { return ( *((int*)i2) - *((int*)i1)) ; } int intnCmp ( const int* i1 , const int* i2 , int n ) { const int* i1max = i1+n ; while (i1 *((int*) i2) ); ; } int intGq ( const void* i1 , const void* i2 ) { return ( *((int*) i1) >= *((int*) i2) ); ; } int fltLt ( const void* f1 , const void* f2 ) { return ( *((float*) f1) < *((float*) f2) ); ; } int fltLq ( const void* f1 , const void* f2 ) { return ( *((float*) f1) <= *((float*) f2) ); ; } int fltGt ( const void* f1 , const void* f2 ) { return ( *((float*) f1) > *((float*) f2) ); ; } int fltGq ( const void* f1 , const void* f2 ) { return ( *((float*) f1) >= *((float*) f2) ); ; } apparix-07-261/util/opt.c0000644002600400000120000005777410673277032012140 00000000000000/* (C) Copyright 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO * does display skip account for hidden options? */ #include #include #include #include "opt.h" #include "alloc.h" #include "types.h" #include "ding.h" #include "err.h" #include "equate.h" #include "minmax.h" #include "compile.h" static int strcmp_void ( const void* s1 , const void* s2 ) { return strcmp(s1, s2) ; } mcxHash* mcxOptHash ( mcxOptAnchor* opts , mcxHash* hash ) { mcxOptAnchor* anch = opts ? opts+0 : NULL ; hash = hash ? hash : mcxHashNew ( 100 , mcxStrHash , strcmp_void ) ; if (!hash) return NULL ; while (anch && anch->tag) { mcxKV* kv = mcxHashSearch(anch->tag, hash, MCX_DATUM_INSERT) ; if (!kv) { mcxHashFree(&hash, NULL, NULL) ; return NULL ; } if (kv->val) mcxErr ( "mcxOptHash" , "warning: option <%s> already present" , anch->tag ) ; kv->val = anch ; anch++ ; } return hash ; } void mcxOptHashFree ( mcxHash** hashpp ) { mcxHashFree(hashpp, NULL, NULL) ; } void* mcxOptInit ( void* opt ) { mcxOption* option = opt ; option->anch = NULL ; option->val = NULL ; return option ; } mcxOptAnchor* mcxOptFind ( char* tag , mcxHash* hopts ) { mcxKV* kv = mcxHashSearch(tag, hopts, MCX_DATUM_FIND) ; return kv ? (mcxOptAnchor*) kv->val : NULL ; } mcxOption* mcxOptParse__ ( mcxHash* opthash , char** argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , int* n_elems_read , mcxstatus* status ) { char** argp = argv+prefix ; char** argl = argv+argc-suffix /* arg last */ ; mcxbool do_exhaust = n_elems_read ? TRUE : FALSE /* fixme: very ugly internal iface*/ ; mcxOption* opts = mcxNAlloc (argc+1, sizeof(mcxOption), mcxOptInit, RETURN_ON_FAIL) ; mcxOption* opt = opts ; if (!opts) { *status = MCX_OPT_STATUS_NOMEM ; return NULL ; } *status = MCX_OPT_STATUS_OK ; if (do_exhaust) *n_elems_read = 0 ; while (argp < argl) { char* arg = *argp ; const char* embedded_val = NULL ; mcxKV* kv = mcxHashSearch(arg, opthash, MCX_DATUM_FIND) ; mcxOptAnchor* anch = kv ? (mcxOptAnchor*) kv->val : NULL ; const char* eq = strchr(arg, '=') ; if (!kv && eq) { char argcpy[501] ; if (eq - arg < 500) { strncpy(argcpy, arg, (eq-arg)) ; argcpy[eq-arg] = '\0' ; if ( (kv = mcxHashSearch(argcpy, opthash, MCX_DATUM_FIND)) && (anch = (mcxOptAnchor*) kv->val) && (anch->flags & MCX_OPT_EMBEDDED) ) embedded_val = eq+1 ; else if ( !strncmp(argcpy, "--", 2) && (kv = mcxHashSearch(argcpy+1, opthash, MCX_DATUM_FIND)) && (anch = (mcxOptAnchor*) kv->val) ) embedded_val = eq+1 ; else kv = NULL ; } else { /* fimxe do sth */ } } ; if (kv) { opt->anch = anch ; if (do_exhaust) (*n_elems_read)++ ; if (embedded_val) opt->val = embedded_val ; else if ( anch->flags & MCX_OPT_HASARG && anch->flags & MCX_OPT_EMBEDDED /* fixme: embedded is stale? */ ) { mcxErr("mcxOptParse", "option <%s> takes =value", anch->tag) ; *status = MCX_OPT_STATUS_NOARG ; break ; } else if (anch->flags & MCX_OPT_HASARG) { argp++ ; if (argp >= argl) { mcxErr("mcxOptParse", "option <%s> takes value", anch->tag) ; *status = MCX_OPT_STATUS_NOARG ; break ; } opt->val = *argp /* mq note: shallow copy */ ; if (do_exhaust) (*n_elems_read)++ ; } } else { if (do_exhaust) break ; else { mcxErr("mcxOptParse", "unsupported option <%s>", arg) ; *status = MCX_OPT_STATUS_UNKNOWN ; break ; } } argp++ ; opt++ ; } if (*status) mcxOptFree(&opts) ; return opts ; } mcxOption* mcxOptExhaust ( mcxOptAnchor *anch , char **argv , int argc , int prefix /* skip these */ , int *n_elems_read , mcxstatus *status ) { mcxHash* opthash = mcxOptHash(anch, NULL) ; mcxOption* opts = mcxOptParse__ (opthash, argv, argc, prefix, 0, n_elems_read, status) ; mcxOptHashFree(&opthash) ; return opts ; } mcxOption* mcxOptParse ( mcxOptAnchor *anch , char **argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , mcxstatus *status ) { mcxHash* opthash = mcxOptHash(anch, NULL) ; mcxOption* opts = mcxOptParse__(opthash, argv, argc, prefix, suffix, NULL, status) ; mcxOptHashFree(&opthash) ; return opts ; } mcxOption* mcxHOptExhaust ( mcxHash *opthash , char **argv , int argc , int prefix /* skip these */ , int *n_elems_read , mcxstatus *status ) { return mcxOptParse__ (opthash, argv, argc, prefix, 0, n_elems_read, status) ; } mcxOption* mcxHOptParse ( mcxHash *opthash , char **argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , mcxstatus *status ) { return mcxOptParse__(opthash, argv, argc, prefix, suffix, NULL, status) ; } void mcxOptFree ( mcxOption** optpp ) { if (*optpp) mcxFree(*optpp) ; *optpp = NULL ; } void mcxUsage ( FILE* fp , const char* caller , const char** lines ) { int i = 0 ; while(lines[i]) { fprintf(fp, "%s\n", lines[i]) ; i++ ; } fprintf(fp, "[%s] Printed %d lines\n", caller, i+1) ; } static int (*rltFunctions[8])(const void* f1, const void* f2) = { intGt , intGq , fltGt, fltGq , intLt , intLq , fltLt, fltLq } ; int mcxOptPrintDigits = 5; const char* rltSigns[8] = { "(", "[", "(", "[" , ")", "]", ")", "]" } ; /* * todo: NULL lftbound argument & non-NULL lftRelate argument * idem for rgt */ static int checkBoundsUsage ( unsigned char type , void* var cpl__unused , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) { int i ; const char* me = "checkBoundsUsage PBD" ; if (type != 'f' && type != 'i') { mcxErr(me, "unsupported checkbound type <%c>", type) ; return 1 ; } if ((lftRlt && !lftBound)||(!lftRlt && lftBound)) { mcxErr(me, "abusive lftRlt lftBound combination") ; return 1 ; } if ((rgtRlt && !rgtBound)||(!rgtRlt && rgtBound)) { mcxErr(me, "abusive rgtRlt rgtBound combination") ; return 1 ; } if (lftRlt) { for(i=0;i<4;i++) if (lftRlt == rltFunctions[i]) break ; if (i == 4) { mcxErr(me, "lftRlt should use gt or gq arg") ; return 1 ; } ; } if (rgtRlt) { for(i=4;i<8;i++) if (rgtRlt == rltFunctions[i]) break ; if (i==8) { mcxErr(me, "rgtRlt should use lt or lq arg") ; return 1 ; } ; } return 0 ; } /* returns * STATUS_OK for matching bounds * STATUS_FAIL for non-matching bounds * STATUS_CB_PBD for internal error. */ enum { STATUS_CB_PBD = STATUS_UNUSED + 1 } ; static mcxstatus checkBounds ( unsigned char type , void* var , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) { int lftOk, rgtOk ; if (checkBoundsUsage(type, var, lftRlt, lftBound, rgtRlt, rgtBound)) { mcxErr("checkBounds PBD", "internal error -- cannot validate") ; return STATUS_CB_PBD ; } lftOk = !lftRlt || lftRlt(var, lftBound) ; rgtOk = !rgtRlt || rgtRlt(var, rgtBound) ; return (lftOk && rgtOk) ? STATUS_OK : STATUS_FAIL ; } static mcxTing* checkBoundsRange ( unsigned char type , void* var cpl__unused , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) { mcxTing* textRange = mcxTingEmpty(NULL, 40) ; char* lftToken = (char *) "" ; int i ; if (!textRange) return NULL ; if (lftRlt) { for(i=0;i<4;i++) if (lftRlt == rltFunctions[i]) break ; if (i<4) lftToken = (char *) rltSigns[i] ; } else lftToken = (char *) "(" ; mcxTingPrint(textRange, "%s", lftToken) /* * This might fail due to mem shortage; * we ignore and simply keep plodding on with more mcxTingPrint-s * below. It's actually pretty inconceivable, since we alloced * 40 bytes - it depends on mcxOptPrintDigits. */ ; if (lftBound) { if (type == 'f') mcxTingPrintAfter (textRange, "%.*f", mcxOptPrintDigits, *((float*)lftBound)) ; else if (type == 'i') mcxTingPrintAfter(textRange, "%d", *((int*)lftBound)) ; } else mcxTingPrintAfter(textRange, "%s", "<-") ; mcxTingPrintAfter(textRange, "%s", ",") ; if (rgtBound) { if (type == 'f') mcxTingPrintAfter (textRange, "%.*f", mcxOptPrintDigits, *((float*)rgtBound)) ; else if (type == 'i') mcxTingPrintAfter(textRange, "%d", *((int*)rgtBound)) ; } else mcxTingPrintAfter(textRange, "%s", "->") ; if (rgtRlt) { for(i=4;i<8;i++) if (rgtRlt == rltFunctions[i]) break ; if (i<8) rgtToken = (char *) rltSigns[i] ; } else rgtToken = (char *) ")" ; mcxTingPrintAfter(textRange, "%s", rgtToken) ; return textRange ; } mcxbool mcxOptCheckBounds ( const char* caller , const char* flag , unsigned char type , void* var , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) { mcxTing* textRange ; mcxstatus stat = checkBounds(type, var, lftRlt, lftBound, rgtRlt, rgtBound) ; if (stat == STATUS_CB_PBD) { mcxErr("mcxOptCheckBounds", "cannot validate option %s", flag) ; return FALSE ; } else if (stat == STATUS_FAIL) { if (! ( textRange = checkBoundsRange ( type , var , lftRlt , lftBound , rgtRlt , rgtBound ) ) ) return FALSE ; mcxErr ( caller , "%s argument to %s should be in range %s" , type == 'i' ? "integer" : type == 'f' ? "float" : "MICANS" , flag , textRange->str ) ; mcxTingFree(&textRange) ; return FALSE ; } return TRUE ; } int mcxOptAnchorCmpId ( const void *a1 , const void *a2 ) { const mcxOptAnchor* A1 = a1 ; const mcxOptAnchor* A2 = a2 ; return A1->id < A2->id ? -1 : A1->id - A2->id ; } int mcxOptAnchorCmpTag ( const void *a1 , const void *a2 ) { const mcxOptAnchor* A1 = a1 ; const mcxOptAnchor* A2 = a2 ; return A1->tag && A2->tag ? strcmp(A1->tag, A2->tag) : A1->tag ? -1 : 1 ; } void mcxOptAnchorSortByTag ( mcxOptAnchor *anchors , dim n_anchors ) { if (n_anchors) qsort(anchors, n_anchors, sizeof(mcxOptAnchor), mcxOptAnchorCmpTag) ; } void mcxOptAnchorSortById ( mcxOptAnchor *anchors , dim n_anchors ) { if (n_anchors) qsort(anchors, n_anchors, sizeof(mcxOptAnchor), mcxOptAnchorCmpId) ; } void parse_descr ( const char* field , const char** descrp , const char** markp , int* mark_width ) { const char* m = strstr(field, "\tM") ; const char* n = m ? strstr(m+2, "\t") : NULL ; const char* d = strstr(field, "\tD") ; if (m && n) *mark_width = n - m - 2 /* truncintok */ , *markp = m + 2 ; else *markp = "" , *mark_width = 0 ; *descrp = d ? d + 2 : field ; } void mcxOptApropos ( FILE* fp , const char* me cpl__unused , const char* syntax , int width , mcxbits display , const mcxOptAnchor opt[] ) { const mcxOptAnchor *baseopt = opt ; mcxTing* scr = mcxTingEmpty(NULL, 100) ; int id_prev = -1 ; const char* descr_usage, *descr_mark ; int mark_width = 0, mark_width_max = 0 ; int mywidth = 0 ; if (syntax) fprintf(fp, "%s\n\n", syntax) ; for (opt = baseopt; opt->tag; opt++) { int thislen = strlen(opt->tag) /* truncintok */ ; if (opt->descr_arg) thislen += 1 + strlen(opt->descr_arg) /* truncintok */ ; if ( !(opt->flags & MCX_OPT_HIDDEN) || display & MCX_OPT_DISPLAY_HIDDEN ) mywidth = MAX(mywidth, thislen) ; if (opt->descr_usage) { parse_descr (opt->descr_usage, &descr_usage, &descr_mark, &mark_width) ; mark_width_max = MAX(mark_width_max, mark_width) ; } } if (!width) width = mywidth ; for (opt = baseopt; opt->tag; opt++) { const char* skip = "" ; if ( opt->flags & MCX_OPT_HIDDEN && !(display & MCX_OPT_DISPLAY_HIDDEN) ) { id_prev = opt->id ; continue ; } if (display & MCX_OPT_DISPLAY_SKIP && opt->id - id_prev > 1) skip = "\n" ; id_prev = opt->id ; if ( ( opt->flags & MCX_OPT_HASARG || opt->flags & MCX_OPT_EMBEDDED ) && opt->descr_arg ) mcxTingPrint ( scr , "%s%c%s" , opt->tag , opt->flags & MCX_OPT_EMBEDDED ? '=' : ' ' , opt->descr_arg ) ; else mcxTingPrint(scr, "%s", opt->tag) ; fputs(skip, fp) ; if (!opt->descr_usage) { fprintf(fp, "%s\n", scr->str) ; continue ; } if (mark_width_max) { parse_descr (opt->descr_usage, &descr_usage, &descr_mark, &mark_width) ; fprintf(fp, "%-*s", width, scr->str) ; fprintf(fp, " %-*.*s ",(int) mark_width_max,mark_width, descr_mark) ; fprintf(fp, "%s\n", descr_usage) ; } else { fprintf(fp, "%-*s", width, scr->str) ; fprintf(fp, " %s\n", opt->descr_usage) ; } } } char** mcxOptParseString ( char* src , int* argc , unsigned char delim ) { dim srclen = strlen(src) ; dim n_delim = mcxStrCountChar(src, delim, srclen) ; dim n_args = 0 ; char** argv ; char *z = src + srclen ; char *p = src, *os ; *argc = 0 ; if (!srclen) return NULL ; if (!(argv = mcxAlloc(sizeof(char*) * (n_delim+1), RETURN_ON_FAIL))) return NULL ; while (p=z) break ; os = p ; if (!(p = strchr(os, delim))) p = z ; *p = '\0' ; argv[n_args++] = os ; p++ ; } *argc = n_args ; return argv ; } mcxbool mcxOptIsInfo ( const char* arg , mcxOptAnchor* options ) { mcxOptAnchor* opt ; for (opt = options; opt->tag; opt++) if (!strcmp(opt->tag, arg)) break ; return (opt->tag && opt->flags & MCX_OPT_INFO) ? TRUE : FALSE ; } char* mcxOptArgLine ( const char** argv , int argc , int quote ) { mcxTing* cl = mcxTingEmpty(NULL, 80) ; int i ; const char* ql = "*", *qr = "*" ; if (quote == '[') ql = "[", qr = "]" ; else if (quote == '{') ql = "{", qr = "}" ; else if (quote == '<') ql = "<", qr = ">" ; else if (quote == '(') ql = "(", qr = ")" ; else if (quote == '"') ql = "\"", qr = "\"" ; else if (quote == '\'') ql = "'", qr = "'" ; if (argc) mcxTingPrint(cl, "%s%s%s", ql, argv[0], qr) ; for (i=1;i" , "set debug level or bits" } , { "-set" , MCX_OPT_HASARG , MCX_DISP_GIRAFFE_SET , "key=val" , "set key to val in ENV" } , { "--nop" , MCX_OPT_DEFAULT , MCX_DISP_GIRAFFE_NOP , NULL , "this option has no affect but changing the argument count" } , { "-h" , MCX_OPT_DEFAULT , MCX_DISP_GIRAFFE_HELP , NULL , "this" } , { "--apropos" , MCX_OPT_DEFAULT , MCX_DISP_GIRAFFE_APROPOS , NULL , "this" } , { "--amoixa" , MCX_OPT_HIDDEN , MCX_DISP_GIRAFFE_AMOIXA , NULL , "show hidden options too" } , { NULL , 0 , 0 , NULL, NULL} } ; dim mcxDispGiraffeCount = sizeof(mcxDispGiraffe) / sizeof(mcxOptAnchor) -1; mcxbits mcx_disp_giraffe_debug = 0; mcxbool mcx_disp_giraffe_test = FALSE; int mcxDispatch ( int argc , const char* argv[] , const char* me , const char* syntax , mcxOptAnchor* dispatcher_options , dim n_options , mcxDispEntry* entry_dir , void (*report_version)(const char* me) ) { const char* mode_str ; mcxDispHook* hk = NULL ; mcxOption* opts, *opt ; int n_arg_read = 0 ; mcxstatus parseStatus = STATUS_FAIL ; mcxHash *clmOpts, *delgOpts, *mergedOpts ; mcxTing* me_and_it ; mcxDispEntry* entry ; int help = argc <= 1 || !strcmp(argv[1], "-h") ? 1 : 0 ; int delg_id_max ; int a ; mcxOptAnchorSortById(dispatcher_options, n_options) ; clmOpts = mcxOptHash(dispatcher_options, NULL) ; delg_id_max = dispatcher_options[n_options-1].id ; if (argc > 1 && !strcmp(argv[1], "--amoixa")) help = 2 ; if (help) { entry = entry_dir+0 ; fprintf(stdout, "%s\n\n", syntax) ; while(entry->id >= 0) { hk = entry->get_hk() ; if ((hk->flags & MCX_DISP_HIDDEN) && help < 2) NOTHING ; else fprintf(stdout, "%s %s\n", me, hk->syntax) ; entry++ ; } exit(0) ; } else if (!strcmp(argv[1], "--version")) report_version(me) , exit(0) ; mode_str = argv[1] /* Find the mode in which we are invoked */ ; { const char* name ; entry = entry_dir+0 ; while (entry->id >= 0) { hk = entry->get_hk() ; name = hk->name ; if (!strcmp(name, mode_str)) break ; entry++ ; } if (entry->id < 0) mcxDie(1, me, "unknown mode <%s>", mode_str) ; } me_and_it = mcxTingPrint(NULL, "%s %s", me, hk->syntax) ; mcxOptAnchorSortById(hk->options, hk->n_options) ; if (delg_id_max >= hk->options[0].id) mcxDie(1, me, "PBD option merge is pointless") ; delgOpts = mcxOptHash(hk->options, NULL) ; mergedOpts = mcxHashMerge(clmOpts, delgOpts, NULL, NULL) ; opts = mcxHOptExhaust (mergedOpts, (char**) argv, argc, 2, &n_arg_read, &parseStatus) ; if (parseStatus != STATUS_OK) { mcxErr(me, "initialization failed") ; exit(1) ; } if (hk->init()) mcxDie(1, me, "initialization failed for <%s>", hk->name) ; for (opt=opts;opt->anch;opt++) { mcxOptAnchor* anch = opt->anch ; switch(anch->id) { case MCX_DISP_GIRAFFE_HELP : case MCX_DISP_GIRAFFE_APROPOS : case MCX_DISP_GIRAFFE_AMOIXA : mcxOptApropos ( stdout , hk->name , me_and_it->str , 15 , 0 , dispatcher_options ) ; mcxOptApropos ( stdout , hk->name , NULL , 15 , MCX_OPT_DISPLAY_SKIP | ( anch->id == MCX_DISP_GIRAFFE_AMOIXA ? MCX_OPT_DISPLAY_HIDDEN : 0 ) , hk->options ) ; mcxExit(0) ; break ; case MCX_DISP_GIRAFFE_VERSION : report_version(me) ; mcxExit(0) ; break ; case MCX_DISP_GIRAFFE_NOP : NOTHING ; break ; case MCX_DISP_GIRAFFE_TEST : mcx_disp_giraffe_test = TRUE ; break ; case MCX_DISP_GIRAFFE_DEBUG : mcx_disp_giraffe_debug = atoi(opt->val) ; break ; case MCX_DISP_GIRAFFE_SET : mcxSetenv(opt->val) ; break ; default : if (hk->arg_cb(anch->id, opt->val)) mcxDie(1, me, "curtains") ; break ; } } #if 0 { mcxOptAnchor* anch = opt->anch ; if ( anch->id == MCX_DISP_GIRAFFE_HELP || anch->id == MCX_DISP_GIRAFFE_APROPOS || anch->id == MCX_DISP_GIRAFFE_AMOIXA ) { mcxOptApropos ( stdout , hk->name , me_and_it->str , 15 , 0 , dispatcher_options ) ; mcxOptApropos ( stdout , hk->name , NULL , 15 , MCX_OPT_DISPLAY_SKIP | ( anch->id == MCX_DISP_GIRAFFE_AMOIXA ? MCX_OPT_DISPLAY_HIDDEN : 0 ) , hk->options ) ; mcxExit(0) ; } else if (anch->id == MCX_DISP_GIRAFFE_VERSION) report_version(me) , mcxExit(0) ; else if (anch->id == MCX_DISP_GIRAFFE_NOP) NOTHING ; else if (anch->id == MCX_DISP_GIRAFFE_TEST) mcx_disp_giraffe_test = TRUE ; else if (anch->id == MCX_DISP_GIRAFFE_DEBUG) mcx_disp_giraffe_debug = atoi(opt->val) ; else if (anch->id == MCX_DISP_GIRAFFE_SET) mcxSetenv(opt->val) ; else if (hk->arg_cb(anch->id, opt->val)) mcxDie(1, me, "curtains") ; } #endif a = 2 + n_arg_read ; if (argc == 2) mcxOptApropos ( stdout , hk->name , me_and_it->str , 15 , 0 , hk->options ) , mcxExit(0) ; if ( a + hk->n_at_least > argc || (hk->n_at_most >= 0 && a + hk->n_at_most < argc) ) { mcxTing* t = mcxTingPrint ( NULL , "mode %s needs %s %d trailing arguments" , mode_str , hk->n_at_least == hk->n_at_most ? "exactly" : "at least" , hk->n_at_least ) ; if (hk->n_at_most > hk->n_at_most) mcxTingPrintAfter(t, " and at most %d", hk->n_at_most) ; mcxDie(1, me, t->str) ; } return hk->main(argc-a, argv+a) ; return 0 ; } apparix-07-261/util/io.c0000644002600400000120000005517010642147132011722 00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO * very few routines should be allowed to touch buffer. * create/free routines, and step and stepBack. * currently many routines ignore the buffer (but warn * when doing so). */ #include #include #include #include #include #include #include #include #include "io.h" #include "types.h" #include "ting.h" #include "ding.h" #include "err.h" #include "alloc.h" #include "compile.h" #include "getpagesize.h" #define buffaro(xf) (xf->buffer_consumed < xf->buffer->len) static void buffer_empty ( mcxIO* xf ) { mcxTingEmpty(xf->buffer, getpagesize()) ; xf->buffer_consumed = 0 ; } static void buffer_spout ( mcxIO* xf , const char* me ) { mcxErr ( "mcxIO" , "warning: reader %s in file <%s> discards buffered input <%.*s>" , me , xf->fn->str , (int) (xf->buffer->len - xf->buffer_consumed) , xf->buffer->str+xf->buffer_consumed ) ; buffer_empty(xf) ; } int begets_stdio ( const char* name , const char* mode ) { if ( ( strstr(mode, "r") && !strcmp(name, "-") ) || ( (strstr(mode, "w") || strstr(mode, "a")) && !strcmp(name, "-") ) || (!strcmp(name, "stderr")) ) return 1 ; return 0 ; } static int mcxIOwarnOpenfp ( mcxIO* xf , const char* who ) { if (xf->fp && !xf->stdio) { mcxIOerr(xf, who, "has open file pointer") ; return 1 ; } return 0 ; } mcxstatus mcxIOclose ( mcxIO* xf ) { fflush(xf->fp) ; if (xf->fp && !xf->stdio) { fclose(xf->fp) ; xf->fp = NULL ; } else if (xf->fp && xf->stdio) { int fe = ferror(xf->fp) /* fixme why not in branch above? */ ; if (fe) mcxErr("mcxIOclose", "error [%d] for [%s] stdio", fe, xf->mode) ; if (xf->ateof || feof(xf->fp)) clearerr(xf->fp) ; } return mcxIOreset(xf) ; } /* note: does not touch all members, notably * usr * fn * mode * fp */ mcxstatus mcxIOreset ( mcxIO* xf ) { xf->lc = 0 ; xf->lo = 0 ; xf->lo_ = 0 ; xf->bc = 0 ; xf->ateof = 0 /* regardless of read/write */ ; buffer_empty(xf) /* xf->fp not touched; promote user care */ ; if (xf->usr && xf->usr_reset) return xf->usr_reset(xf->usr) ; return STATUS_OK ; } void mcxIOerr ( mcxIO* xf , const char *complainer , const char *complaint ) { if (!xf) return ; mcxErr ( complainer , "%s stream <%s> %s" , xf->mode , xf->fn->str , complaint ) ; } mcxIO* mcxIOnew ( const char* str , const char* mode ) { if (!str || !mode) { mcxErr("mcxIOnew PBD", "void string or mode argument") ; return NULL ; } return mcxIOrenew(NULL, str, mode) ; } /* fixme: the code below is very muddy. * The ->stdio decision (for new streams) might best be made * at open time? */ mcxIO* mcxIOrenew ( mcxIO* xf , const char* name , const char* mode ) { mcxbool twas_stdio = xf && xf->stdio ; if ( mode && !strstr(mode, "w") && !strstr(mode, "r") && !strstr(mode, "a") ) { mcxErr ("mcxIOrenew PBD", "unsupported open mode <%s>", mode) ; return NULL ; } if (!xf) { if (!name || !mode) { mcxErr("mcxIOrenew PBD", "too few arguments") ; return NULL ; } if (!(xf = (mcxIO*) mcxAlloc(sizeof(mcxIO), RETURN_ON_FAIL))) return NULL ; if (!(xf->fn = mcxTingEmpty(NULL, 20))) { mcxFree(xf) ; return NULL ; } ; if (!(xf->buffer = mcxTingEmpty(NULL, getpagesize()))) { mcxFree(xf) ; return NULL ; } xf->fp = NULL ; xf->mode = NULL ; xf->usr = NULL ; xf->usr_reset = NULL ; xf->buffer_consumed = 0 ; } else if (xf->stdio) NOTHING ; else if (mcxIOwarnOpenfp(xf, "mcxIOrenew")) mcxIOclose(xf) ; mcxIOreset(xf) ; if (name && !mcxTingWrite(xf->fn, name)) return NULL /* fixme; shd clean up */ ; if (mode) { if (xf->mode) mcxFree(xf->mode) ; xf->mode = mcxStrDup(mode) ; } xf->stdio = begets_stdio(xf->fn->str, xf->mode) /* fixme: no longer necessary? */ ; if (twas_stdio && !xf->stdio) xf->fp = NULL ; return xf ; } mcxstatus mcxIOopen ( mcxIO* xf , mcxOnFail ON_FAIL ) { const char* fname = xf->fn->str ; if (!xf) { mcxErr("mcxIOnew PBD", "received void object") ; if (ON_FAIL == RETURN_ON_FAIL) return STATUS_FAIL ; exit(1) ; } if (mcxIOwarnOpenfp(xf, "mcxIOopen PBD")) return STATUS_OK ; if (!strcmp(fname, "-")) { if (strchr(xf->mode, 'r')) xf->fp = stdin ; else if (strchr(xf->mode, 'w') || strchr(xf->mode, 'a')) xf->fp = stdout ; } else if ( !strcmp(fname, "stderr") && (strchr(xf->mode, 'w') || strchr(xf->mode, 'a')) ) xf->fp = stderr ; else if ((xf->fp = fopen(fname, xf->mode)) == NULL) { if (ON_FAIL == RETURN_ON_FAIL) return STATUS_FAIL ; mcxIOerr(xf, "mcxIOopen", "can not be opened") ; mcxExit(1) ; } return STATUS_OK ; } mcxstatus mcxIOtestOpen ( mcxIO* xf , mcxOnFail ON_FAIL ) { if (!xf->fp && mcxIOopen(xf, ON_FAIL) != STATUS_OK) { mcxErr ("mcxIO", "cannot open file <%s> in mode %s", xf->fn->str, xf->mode) ; return STATUS_FAIL ; } return STATUS_OK ; } void mcxIOrelease ( mcxIO* xf ) { if (xf) { mcxIOclose(xf) ; if (xf->fn) mcxTingFree(&(xf->fn)) ; if (xf->mode) mcxFree(xf->mode) ; } } mcxstatus mcxIOappendName ( mcxIO* xf , const char* suffix ) { if (xf->fp && !xf->stdio) mcxErr ( "mcxIOappendName PBD" , "stream open while request for name change from <%s> to <%s>" , xf->fn->str , suffix ) ; else if (!mcxTingAppend(xf->fn, suffix)) return STATUS_FAIL ; xf->stdio = begets_stdio(xf->fn->str, "-") ; return STATUS_OK ; } mcxstatus mcxIOnewName ( mcxIO* xf , const char* newname ) { if (!mcxTingEmpty(xf->fn, 0)) return STATUS_FAIL ; return mcxIOappendName(xf, newname) ; } int mcxIOstepback ( int c , mcxIO* xf ) { if (c == EOF) return EOF ; else { if (buffaro(xf) && xf->buffer_consumed > 0) c = xf->buffer->str[--xf->buffer_consumed] ; else if (ungetc(c, xf->fp) == EOF) { mcxErr ( "mcxIOstepback" , "failed to push back <%d> on stream <%s>\n" , c , xf->fn->str ) ; return EOF ; } xf->bc-- ; if (c == '\n') xf->lc-- , xf->lo = xf->lo_ , xf->lo_ = 0 ; else xf->lo-- ; } return c ; } int mcxIOstep ( mcxIO* xf ) { int c #if 0 ;if (xf->buffer) fprintf(stderr, "buffer [%s]\n", xf->buffer->str) ;else fprintf(stderr, "nobuffer\n") #endif ; if (xf->ateof) c = EOF ; else if (buffaro(xf)) { c = xf->buffer->str[xf->buffer_consumed++] ; if (!buffaro(xf)) buffer_empty(xf) ; } else c = fgetc(xf->fp) ; switch(c) { case '\n' : xf->lc++ ; xf->bc++ ; xf->lo_ = xf->lo ; xf->lo = 0 ; break ; case EOF : xf->ateof = 1 ; break ; default : xf->bc++ ; xf->lo++ ; break ; } return c ; } /* fixme todo * * look at bc; substract it from sz (we might have read a part already). * * support growing files. and look at other items in the grep source code. */ mcxstatus mcxIOreadFile ( mcxIO *xf , mcxTing *filetxt ) { struct stat mystat ; size_t sz = 4096 ; ssize_t r ; const char* me = "mcxIOreadFile" ; mcxTingEmpty(filetxt, 0) ; if (buffaro(xf)) buffer_spout(xf, me) ; if (!xf->stdio) { if (stat(xf->fn->str, &mystat)) mcxIOerr(xf, me, "can not stat file") ; else sz = mystat.st_size ; } if (!xf->fp && mcxIOopen(xf, RETURN_ON_FAIL)) { mcxIOerr(xf, me, "can not open file") ; return STATUS_FAIL ; } if (xf->ateof) return STATUS_OK /* fixme; ting count overflow */ ; if (!(filetxt = mcxTingEmpty(filetxt, sz))) return STATUS_NOMEM ; while ((r = mcxIOappendChunk(xf, filetxt, sz, 0)) > 0 && !xf->ateof) ; if (r <0) return STATUS_FAIL /* fixme; look closer at error */ ; return STATUS_OK ; } static dim mcxIO__rl_fillbuf__ ( mcxIO* xf , char* buf , dim size , int* last ) { int a = 0 ; dim ct = 0 ; while(ctateof = 1 ; return z #undef MCX_IORL_BSZ ; } dim mcxIOdiscardLine ( mcxIO *xf ) { int a ; dim ct = 0 ; if (!xf->fp) { mcxIOerr(xf, "mcxIOdiscardLine", "is not open") ; return 0 /* fixme; set errno? */ ; } while(((a = mcxIOstep(xf)) != '\n') && a != EOF) ct++ ; if (buffaro(xf)) /* fixme/design check buffer for line */ buffer_spout(xf, "mcxIOdiscardLine") ; return ct ; } ofs mcxIOappendChunk ( mcxIO *xf , mcxTing *dst , dim sz , mcxbits flags cpl__unused ) { unsigned long psz = getpagesize() ; dim k = sz / psz /* fixme: size checks? */ ; dim rem = sz % psz ; ofs r = 1 /* pretend in case k == 0 */ /* mcxbool account = flags & MCX_CHUNK_ACCOUNT ? TRUE : FALSE */ ; dim offset = dst->len ; char* p ; if (!dst || !xf->fp || !mcxTingEnsure(dst, dst->len + sz)) return -1 /* fixme set some (new) errno */ ; if (k) while (k-- > 0 && (r = read(fileno(xf->fp), dst->str+dst->len, psz)) > 0) dst->len += r /* careful with unsignedness */ ; if ( r > 0 && rem > 0 && (r = read(fileno(xf->fp), dst->str+dst->len, rem)) > 0 ) dst->len += r ; dst->str[dst->len] = '\0' ; xf->bc += dst->len - offset ; for (p = dst->str+offset; pstr+dst->len; p++) { if (*p == '\n') { xf->lc++ ; xf->lo_ = xf->lo ; xf->lo = 0 ; } else xf->lo++ ; } /* fixme; what if k == 0, rem == 0 ? */ if (!r) /* fixme; other possibilities? */ xf->ateof = 1 ; return dst->len ; } mcxstatus mcxIOreadLine ( mcxIO *xf , mcxTing *dst , mcxbits flags ) { int a ; dim ll ; mcxbool chomp = flags & MCX_READLINE_CHOMP ? TRUE : FALSE ; mcxbool skip = flags & MCX_READLINE_SKIP_EMPTY ? TRUE : FALSE ; mcxbool par = flags & MCX_READLINE_PAR ? TRUE : FALSE ; mcxbool dot = flags & MCX_READLINE_DOT ? TRUE : FALSE ; mcxbool bsc = flags & MCX_READLINE_BSC ? TRUE : FALSE ; mcxbool repeat = dot || par || bsc ? TRUE : FALSE ; mcxbool continuation = FALSE ; mcxTing* line ; mcxstatus stat = STATUS_OK ; if (!xf->fp && mcxIOopen(xf, RETURN_ON_FAIL)) { mcxIOerr(xf, "mcxIOreadLine", "is not open") ; return STATUS_FAIL ; } if (xf->ateof) return STATUS_DONE ; if (!dst || !mcxTingEmpty(dst, 1)) return STATUS_NOMEM ; if (skip || par) { while((a = mcxIOstep(xf)) == '\n') NOTHING ; if (xf->ateof) return STATUS_DONE ; else mcxIOstepback(a, xf) ; } if (!(line = repeat ? mcxTingEmpty(NULL, 1) : dst)) return STATUS_NOMEM ; while (1) { ofs d = mcxIO__rl_rl__(xf, line) ; if (IO_MEM_ERROR == d) { stat = STATUS_NOMEM /* fixme grainify error/status */ ; break ; } ll = line->len ; if (!repeat) break ; else /* must append line to dst */ { if ( dot && !continuation && line->str[0] == '.' && ( ll == 2 || (ll == 3 && line->str[1] == '\r') ) /* fixme still not fully covering */ ) break /* do not attach the single-dot-line */ ; if (par && !continuation && ll == 1) break /* do not attach the second newline */ ; if (!mcxTingNAppend(dst, line->str, line->len)) { stat = STATUS_NOMEM ; break ; } continuation = bsc && (ll > 1 && *(line->str+ll-2) == '\\') ; if (continuation) mcxTingShrink(dst, -2) ; if (!par && !dot && (bsc && !continuation)) break ; if (xf->ateof) break ; } } if (repeat) mcxTingFree(&line) ; if (stat) return stat /* fixme; should we not check chomp first ? */ /* fixme _: \n\r ? */ ; if (chomp && dst->len && *(dst->str+dst->len-1) == '\n') mcxTingShrink(dst, -1) ; if (xf->ateof && !dst->len) return STATUS_DONE ; return STATUS_OK ; } void mcxIOlistParmodes ( void ) { fprintf ( stdout , "%5d vanilla mode, fetch next line\n" , MCX_READLINE_DEFAULT ) ; fprintf(stdout, "%5d chomp trailing newline\n", MCX_READLINE_CHOMP) ; fprintf(stdout, "%5d skip empty lines\n", MCX_READLINE_SKIP_EMPTY) ; fprintf(stdout, "%5d paragraph mode\n", MCX_READLINE_PAR) ; fprintf(stdout, "%5d backslash escapes newline\n", MCX_READLINE_BSC) ; fprintf ( stdout , "%5d section mode, ended by singly dot on a single line\n" , MCX_READLINE_DOT ) ; } void mcxIOpos ( mcxIO* xf , FILE* channel ) { const char* ateof = xf->ateof ? "at EOF in " : "" ; fprintf ( channel , "[mcxIO] %sstream <%s>, line <%ld>, character <%ld>\n" , ateof , xf->fn->str , (long) xf->lc , (long) xf->lo ) ; } void mcxIOfree_v ( void* xfpp ) { mcxIOfree((mcxIO**) xfpp) ; } void mcxIOfree ( mcxIO** xfpp ) { if (*xfpp) { mcxIO* xf = *xfpp ; mcxIOrelease(xf) ; mcxTingFree(&(xf->buffer)) ; if (xf->usr && xf->usr_free) xf->usr_free(xf->usr) ; mcxFree(xf) ; *xfpp = NULL ; } } mcxstatus mcxIOexpectReal ( mcxIO* xf , double* dblp , mcxOnFail ON_FAIL ) { int n_read = 0 ; int n_conv = 0 ; if (buffaro(xf)) buffer_spout(xf, "mcxIOexpectReal") ; mcxIOskipSpace(xf) /* keeps accounting correct */ ; n_conv = fscanf(xf->fp, " %lf%n", dblp, &n_read) ; xf->bc += n_read /* fixme do fscanf error handling */ ; xf->lo += n_read ; if (1 != n_conv) { if (ON_FAIL == EXIT_ON_FAIL) { mcxIOpos(xf, stderr) ; mcxErr("parseReal", "parse error: expected to find real") ; mcxExit(1) ; } return STATUS_FAIL ; } return STATUS_OK ; } mcxstatus mcxIOexpectNum ( mcxIO* xf , long* lngp , mcxOnFail ON_FAIL ) { int n_read = 0 ; int n_conv = 0 ; mcxstatus status = STATUS_OK ; if (buffaro(xf)) buffer_spout(xf, "mcxIOexpectNum") ; mcxIOskipSpace(xf) /* keeps accounting correct */ ; n_conv = fscanf(xf->fp, "%ld%n", lngp, &n_read) ; xf->bc += n_read /* fixme do fscanf error handling */ ; xf->lo += n_read ; if (1 != n_conv) mcxErr("mcxIOexpectNum", "parse error: expected to find integer") , status = STATUS_FAIL ; else if (errno == ERANGE) mcxErr("mcxIOexpectNum", "range error: not in allowable range") , status = STATUS_FAIL ; if (status) { mcxIOpos(xf, stderr) ; if (ON_FAIL == EXIT_ON_FAIL) mcxExit(1) ; } return status ; } int mcxIOskipSpace ( mcxIO* xf ) { int c ; while ((c = mcxIOstep(xf)) != EOF && isspace(c)) ; return mcxIOstepback(c, xf) ; } mcxbool mcxIOtryCookie ( mcxIO* xf , const unsigned char abcd[4] ) { unsigned char efgh[5] ; int n_read = fread(efgh, sizeof efgh[0], 4, xf->fp) ; int error = ferror(xf->fp) ; dim i = 0 ; if (n_read == 4) for (i=0; i<4 && abcd[i] == efgh[i]; i++) NOTHING #if 0 ;fprintf(stderr, "IN %d %d %d %d %d %d\n", i, n_read, (int) efgh[0], (int) efgh[1], (int) efgh[2], (int) efgh[3]) ;fprintf(stderr, "IN %d %d %d %d %d %d\n", i, n_read, (int) abcd[0], (int) abcd[1], (int) abcd[2], (int) abcd[3]) #endif ; if (i == 4) { xf->bc += 4 ; return TRUE ; } if (!fseek(xf->fp, -n_read, SEEK_CUR)) xf->bc += (4-n_read) ; else { mcxTingNAppend(xf->buffer, (char*) efgh, n_read) ; xf->bc += n_read ; if (!error) clearerr(xf->fp) ; } return FALSE ; } mcxbool mcxIOwriteCookie ( mcxIO* xf , const unsigned char abcd[4] ) { dim n_written = fwrite(abcd, sizeof abcd[0], 4, xf->fp) ; if (n_written != 4) { mcxErr("mcxIOwriteCookie", "failed to write <%.4s>", abcd) ; return FALSE ; } return TRUE ; } /* fixme: newlines in str thrash correct lc/lo counting */ int mcxIOexpect ( mcxIO *xf , const char *str , mcxOnFail ON_FAIL ) { const char* s = str ; int c = 0 ; int d = 0 ; int n_trailing /* * no functional behaviour yet attached to this state change * fixme: semantics for STDIN agree between stdlib and us? */ ; while ( c = (unsigned char) s[0] , ( c && ( d = mcxIOstep(xf) , c == d ) ) ) s++ ; n_trailing = strlen(s) /* truncintok */ ; if (c && ON_FAIL == EXIT_ON_FAIL) { mcxErr("mcxIOexpect", "parse error: expected to see <%s>", str) ; mcxIOpos(xf, stderr) ; mcxExit(1) ; } return n_trailing ; } typedef struct { int tbl[256] ; int* circle /* circular buffer */ ; int circle_last /* circle bumper */ ; const char* pat ; int patlen ; } mcxIOpat ; static void mcxio_newpat ( mcxIOpat* md , const char* pattern ) { int i ; int *tbl = md->tbl ; const char* pat ; int patlen = strlen(pattern) /* truncintok */ ; md->circle = mcxAlloc(patlen * sizeof(int), EXIT_ON_FAIL) ; md->pat = pattern ; md->patlen = patlen ; pat = md->pat /* initialize */ ; for (i = 0; i < 256; i ++) tbl[i] = patlen ; for (i = 0; i < patlen-1; i++) tbl[(unsigned char) pat[i]] = patlen -i -1 #if 0 ; for (i=0; icircle_last = patlen -1 ; } static void mcxIOcleanpat ( mcxIOpat* md ) { mcxFree(md->circle) ; } static int fillpatbuf ( mcxIO* xfin , int shift , mcxIOpat* md ) { int c = 0 ; int z = 0 ; int patlen = md->patlen ; while (z < shift && (c = mcxIOstep(xfin)) != EOF) { int q = (md->circle_last+z+1) % patlen ; md->circle[q] = c ; z++ ; } md->circle_last = (md->circle_last+shift) % patlen ; return c ; } mcxstatus mcxIOfind ( mcxIO* xfin , const char* pat , mcxOnFail ON_FAIL ) { int j, k ; int shift, patlen ; int* tbl ; int* circle ; mcxIOpat md ; int found = 0 ; mcxio_newpat(&md, pat) ; patlen = md.patlen ; tbl = md.tbl ; circle = md.circle ; shift = patlen /* * hum. This means that empty pattern matches on empty string .. * Need to fix fillpatbuf if this should be reversed. */ ; if (!patlen) found = 1 ; else do { if (EOF == fillpatbuf(xfin, shift, &md)) break ; for ( j=md.circle_last+patlen, k=patlen-1 ; j>md.circle_last && circle[j%patlen] == (unsigned char) pat[k] ; j--, k-- ) ; ; if (j == md.circle_last) { found = 1 ; break ; } /* * if more matches are needed, do something in this branch * and then simply continue. */ shift = tbl[circle[md.circle_last % patlen]] #if 0 ; fprintf ( stderr , "___ last[%d] index[%d] pivot[%d] shift[%d]\n" , (int) md.circle_last , (int) md.circle_last % patlen , (int) circle[md.circle_last % patlen] , (int) shift ) #endif ; } while (1) ; mcxIOcleanpat(&md) ; if (!found && ON_FAIL == RETURN_ON_FAIL) return STATUS_FAIL ; else if (!found) exit(EXIT_FAILURE) ; return STATUS_OK ; } dim mcxIOdiscard ( mcxIO* xf , dim amount ) { dim bsz = xf->buffer->mxl ; char* buf = xf->buffer->str ; dim n_read = 0 ; dim n_chunk = amount / bsz ; dim rem = amount - bsz * n_chunk ; dim i, n ; if (buffaro(xf)) buffer_spout(xf, "mcxIOdiscard") ; for (i=0;ifp) ; n_read += n ; xf->bc += n ; if (n != bsz) break ; } if (i < n_chunk) return n_read ; if (rem) n = fread(buf, 1, rem, xf->fp) , n_read += n , xf->bc += n ; return n_read ; } apparix-07-261/util/err.c0000644002600400000120000001662510642147132012105 00000000000000/* (C) Copyright 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include #include "err.h" #include "types.h" /* TODO unify code. */ FILE* mcxLogFILE = NULL; static FILE* mcx_fperr = NULL; static FILE* mcx_fpwarn = NULL; static FILE* mcx_fptell = NULL; mcxbits mcxLogLevel = 0; void mcx_err_f ( FILE* fp , const char *caller , const char *fmt , va_list *args ) { if (caller) fprintf(fp, "___ [%s] ", caller) ; else fprintf(fp, "___ ") ; vfprintf(fp, fmt, *args) ; fprintf(fp, "\n") ; return ; } void mcxFail ( void ) { while(1) sleep(1000) ; } void mcxDie ( int status , const char* caller , const char* fmt , ... ) { va_list args ; va_start(args, fmt) ; mcx_err_f(stderr, caller, fmt, &args) ; va_end(args) ; mcxExit(status) ; } void mcxExit ( int val ) { exit(val) ; } void mcxErrorFile ( FILE* fp ) { mcx_fperr = fp ; } void mcxTellFile ( FILE* fp ) { mcx_fptell = fp ; } void mcxLogSetFILE ( FILE* fp , mcxbool ENV_LOG ) { mcxLogFILE = fp ; if (ENV_LOG) mcxLogLevelSetByString(getenv("TINGEA_LOG_TAG")) ; } FILE* mcxLogGetFILE ( void ) { return mcxLogFILE ? mcxLogFILE : stderr ; } void mcxWarnFile ( FILE* fp ) { mcx_fpwarn = fp ; } void mcxErrf ( FILE* fp , const char *caller , const char *fmt , ... ) { va_list args ; va_start(args, fmt) ; mcx_err_f(fp, caller, fmt, &args) ; va_end(args) ; } void mcxErr ( const char *caller , const char *fmt , ... ) { FILE* fp = mcx_fperr ? mcx_fperr : stderr ; va_list args ; va_start(args, fmt) ; mcx_err_f(fp, caller, fmt, &args) ; va_end(args) ; } void mcxWarn ( const char *caller , const char *fmt , ... ) { va_list args ; if (caller) fprintf(stderr, "[%s] ", caller) ; va_start(args, fmt) ; vfprintf(stderr, fmt, args) ; fprintf(stderr, "\n") ; va_end(args) ; return ; } static void mcx_write_f ( FILE* fp , const char *caller , const char *fmt , va_list *args , ... ) { if (caller) fprintf(fp, "[%s] ", caller) ; vfprintf(fp, fmt, *args) ; fprintf(fp, "\n") ; return ; } void mcxTellf ( FILE* fp , const char *caller , const char *fmt , ... ) { va_list args ; va_start(args, fmt) ; mcx_write_f(fp, caller, fmt, &args) ; va_end(args) ; } void mcxTell ( const char *caller , const char *fmt , ... ) { FILE* fp = mcx_fptell ? mcx_fptell : stderr ; va_list args ; va_start(args, fmt) ; mcx_write_f(fp, caller, fmt, &args) ; va_end(args) ; } struct mcx_log_class_annotated { int type ; mcxbits class ; mcxbits low ; } ; struct mcx_log_class_annotated mcx_log_class_list[] = { { 'd' , MCX_LOG_DATA , MCX_LOG_DATA0 } , { 'f' , MCX_LOG_FUNC , MCX_LOG_FUNC0 } , { 'g' , MCX_LOG_GAUGE , MCX_LOG_GAUGE } , { 'i' , MCX_LOG_IO , MCX_LOG_IO } , { 'm' , MCX_LOG_MON , MCX_LOG_MON0 } , { 'n' , MCX_LOG_NETWORK , MCX_LOG_NETWORK } , { 'p' , MCX_LOG_IP , MCX_LOG_IP } , { 't' , MCX_LOG_THREAD , MCX_LOG_THREAD } , { 'A' , MCX_LOG_SLOT1 , MCX_LOG_SLOT1 } , { 'B' , MCX_LOG_SLOT2 , MCX_LOG_SLOT2 } , { 'C' , MCX_LOG_SLOT3 , MCX_LOG_SLOT3 } } ; mcxbool mcxLogGet ( mcxbits level_programmer ) { dim i ; mcxbool ok = FALSE ; for (i=0;i= (mcxLogLevel & mcx_log_class_list[i].class)) ) ; if (mcxLogLevel & MCX_LOG_OR) { if (ok) return TRUE ; } else if (!ok) /* AND, implicit or not */ return FALSE ; } return ok ; } void mcxLog2 ( const char* tag , const char* fmt , ... ) { FILE* fp = mcxLogFILE ? mcxLogFILE : stderr ; va_list args ; va_start(args, fmt) ; mcx_write_f(fp, tag, fmt, &args) ; va_end(args) ; } void mcxLog ( mcxbits level_programmer , const char* tag , const char* fmt , ... ) { FILE* fp = mcxLogFILE ? mcxLogFILE : stderr ; va_list args ; if (!mcxLogLevel || mcxLogLevel & MCX_LOG_NULL) return ; if (mcxLogGet(level_programmer)) { va_start(args, fmt) ; mcx_write_f(fp, tag, fmt, &args) ; va_end(args) ; } } /* dependency with mcx_level_setnum */ static int mcx_level_parsenum ( int T , int c ) { int r = -1 ; if (c == 'x') r = 0 ; else if (c >= '1' && c <= '9') r = ((int) c) - '0' ; else mcxErr ( "mcxLogLevelSetByString" , "%c axis level [%c] parse error" , (int) T , (int) c ) ; return r ; } /* covers val -1 mcx_level_parsenum case */ static int mcx_level_setnum ( int val , mcxbits CLASS , mcxbits CLASS0 ) { mcxbits new = 0 ; if (val > 0) { new = (1 << (val-1)) * CLASS0 /* below we know that new is simply too high: e.g. new == 6 * but there are only 5 classes. * We then set new to the highest class member */ ; if (!(new & CLASS)) new = CLASS ^ (CLASS >> 1) ^ (CLASS0 >> 1) ; } return new ; } volatile int mcxLogSigGuard = 0; void mcxLogSig ( int sig ) { mcxLogSigGuard = 1; ; } void mcxLogLevelSetByString ( const char* str ) { dim i ; u8 str0 = str ? str[0] : 0 ; if (!str) return ; if (str0 == 'x') mcxLogLevel = 0 ; else if (str0 == '1') mcxLogLevel = MCX_LOG_VERBOSE ; else if (str0 == '8') mcxLogLevel = MCX_LOG_TERSE ; else if (str0 == '9') mcxLogLevel = MCX_LOG_TERSER ; if (strchr(str, 'V')) mcxLogLevel |= MCX_LOG_OR ; if (strchr(str, '#')) mcxLogLevel |= MCX_LOG_NULL ; if (strchr(str, '%')) BIT_OFF(mcxLogLevel, MCX_LOG_NULL) ; for (i=0;i #include #include #include #include #include "hash.h" #include "minmax.h" #include "types.h" #include "inttypes.h" #include "ting.h" #include "err.h" #include "alloc.h" #include "gralloc.h" #include "compile.h" #include "list.h" /* the distribution of bit counts over all 32-bit keys */ int promilles[32] = { 0, 0, 0, 0, 0, 0, 0, 0 , 2, 7, 15, 30, 53, 81,110,131 ,140,131,110, 81, 53, 30, 15, 7 , 2, 0, 0, 0, 0, 0, 0, 0 } ; #ifndef TINGEA_HASH_CACHE # define TINGEA_HASH_CACHE 0 #endif typedef struct hash_link { struct hash_link* next ; mcxKV kv #if TINGEA_HASH_CACHE ; u32 hv #endif ; } hash_link ; typedef struct bucket { hash_link* base ; } mcx_bucket ; /* For further optimization work, options * options * load * cmp * hash * src_link * can be shared between different hashes (e.g. * with multidimensional hashes). Consider * making src_link file static variable. */ struct mcxHash { dim n_buckets /* 2^n_bits */ ; mcx_bucket *buckets ; dim n_entries ; mcxbits options ; int (*cmp) (const void *a, const void *b) ; u32 (*hash) (const void *a) ; mcxGrim* src_link ; float load ; } ; struct mcxHashWalk { mcxHash* hash ; dim i_bucket ; hash_link* link ; } ; void* mcx_bucket_init ( void* buck ) { ((mcx_bucket*) buck)->base = NULL ; return NULL ; } void bitprint ( u32 key , FILE* fp ) ; int bitcount ( u32 key ) ; mcxHash* mcxHashNew ( dim n_buckets , u32 (*hash)(const void *a) , int (*cmp) (const void *a, const void *b) ) { mcxHash *h ; mcxbool ok = FALSE ; u8 n_bits = 0 ; if (!n_buckets) { mcxErr("mcxHashNew strange", "void alloc request") ; n_buckets = 2 ; } if (!(h = mcxAlloc(sizeof(mcxHash), RETURN_ON_FAIL))) return NULL ; while(n_buckets) { n_buckets >>= 1 ; n_bits++ ; } h->load = 0.5 ; h->n_entries = 0 ; h->n_buckets = n_buckets = (1 << n_bits) ; h->cmp = cmp ; h->hash = hash ; h->options = MCX_HASH_OPT_DEFAULTS ; h->src_link = NULL ; while (1) /* fixme 2nd arg below, have better choice? */ { h->src_link = mcxGrimNew(sizeof(hash_link), h->n_buckets, MCX_GRIM_ARITHMETIC) ; if (!h->src_link) break ; if (! ( h->buckets = mcxNAlloc ( h->n_buckets , sizeof(mcx_bucket) , mcx_bucket_init , RETURN_ON_FAIL ) ) ) break ; ok = TRUE ; break ; } if (!ok) { mcxGrimFree(&h->src_link) ; mcxFree(h) ; return NULL ; } return h ; } dim mcxHashMemSize ( mcxHash* hash ) { return mcxGrimMemSize(hash->src_link) + sizeof(mcx_bucket) * hash->n_buckets ; } void mcxHashGetSettings ( mcxHash* hash , mcxHashSettings* settings ) { settings->n_buckets = hash->n_buckets ; settings->load = hash->load ; settings->n_entries = hash->n_entries ; settings->options = hash->options ; } static dim hash_link_size ( hash_link* link ) { dim s = 0 ; while(link) link = link->next , s++ ; return(s) ; } void mcxHashStats ( FILE* fp , mcxHash* h ) { dim buckets = h->n_buckets ; dim buckets_used = 0 ; float ctr = 0.0 ; float cb = 0.0 ; dim max = 0 ; dim entries = 0 ; const char* me = "mcxHashStats" ; int j, k, distr[32] ; mcx_bucket *buck ; for (j=0;j<32;j++) distr[j] = 0 ; for (buck=h->buckets; buckbuckets + h->n_buckets; buck++) { dim d = hash_link_size(buck->base) ; hash_link* this= buck->base ; if (d) { buckets_used++ ; entries += d ; ctr += (float) d * d ; cb += (float) d * d * d ; max = MAX(max, d) ; } while(this) { u32 u = (h->hash)(this->kv.key) ; int ct = bitcount(u) ; this = this->next ; distr[ct]++ ;if (0) fprintf(stderr, "bucket [%d] key [%s]\n", (int)d, ((mcxTing*) this->kv.key)->str) ; } } ctr = ctr / MAX(1, entries) ; cb = sqrt(cb / MAX(1, entries)) ; if (buckets && buckets_used) mcxTellf ( fp , me , "%4.2f bucket usage (%ld available, %ld used, %ld entries)" , (double) ((double) buckets_used) / buckets , (long) buckets , (long) buckets_used , (long) entries ) , mcxTellf ( fp , me , "bucket average: %.2f, center: %.2f, cube: %.2f, max: %ld" , (double) entries / ((double) buckets_used) , (double) ctr , (double) cb , (long) max ) ; mcxTellf(fp, me, "bit distribution (promilles):") ; fprintf ( fp , " %-37s %s\n" , "Current bit distribution" , "Ideally random distribution" ) ; for (k=0;k<4;k++) { for (j=k*8;j<(k+1)*8;j++) fprintf(fp, "%3.0f ", (1000 * (float)distr[j]) / entries) ; fprintf(fp, " "); ; for (j=k*8;j<(k+1)*8;j++) fprintf(fp, "%3d ", promilles[j]) ; fprintf(fp, "\n") ; } mcxTellf(fp, me, "link count: %ld", (long) (mcxGrimCount(h->src_link))) ; mcxTellf(fp, me, "link mem count: %ld", (long) (mcxGrimMemSize(h->src_link))) ; mcxTellf(fp, me, "done") ; } void mcxHashSetOpts ( mcxHash* h , double load , int options ) { if (options >= 0) h->options |= options /* fixme; are there states in which either of these can be corrupting ? */ ; h->load = load ; } void mcxHashFreeScalar ( void* scalar cpl__unused ) { /* this triggers freeing of kv.key or kv.val */ ; } void mcxHashFree ( mcxHash** hpp , void freekey(void* key) , void freeval(void* key) ) { mcxHash* h = *hpp ; mcx_bucket* buck = h ? h->buckets : NULL ; dim d = h ? h->n_buckets : 0 ; if (!h) return ; if (freekey || freeval) { while (d-- > 0) /* careful with unsignedness */ { hash_link* link = (buck++)->base ; while(link) { void* key = link->kv.key ; void* val = link->kv.val ; if (freekey && key) freekey(key) , mcxFree(key) ; if (freeval && val) freeval(val) , mcxFree(val) ; link = link->next ; } } } mcxGrimFree(&h->src_link) ; mcxFree(h->buckets) ; mcxFree(h) ; *hpp = NULL ; } #define MCX_HASH_DOUBLING MCX_HASH_OPT_UNUSED #if TINGEA_HASH_CACHE static hash_link* mcx_bucket_search ( mcxHash* h , void* ob , mcxmode ACTION , u32* hashval ) { u32 thishash = hashval ? *hashval : (h->hash)(ob) ; mcx_bucket *buck = h->buckets + (thishash & (h->n_buckets-1)) ; hash_link* link = buck->base, *prev = NULL, *new ; int delta = 0 ; while ( link && ( link->hv != thishash || h->cmp(ob, link->kv.key) ) ) prev = link , link = link->next ; if (link && ACTION == MCX_DATUM_DELETE) { if (buck->base == link) buck->base = link->next ; else prev->next = link->next ; delta = -1 ; mcxGrimLet(h->src_link, link) /* we return link below though */ ; } else if (!link) { if (ACTION == MCX_DATUM_FIND || ACTION == MCX_DATUM_DELETE) link = NULL ; else if (ACTION == MCX_DATUM_INSERT) { new = mcxGrimGet(h->src_link) ; new->next = NULL ; new->kv.val = NULL ; new->kv.key = ob ; new->hv = thishash ; if (!buck->base) buck->base = new /* in TINGEA_HASH_CACHE case we always append */ ; else new->next = prev->next , prev->next = new ; delta = 1 ; link = new ; } } h->n_entries += delta ; return link ; } #else static hash_link* mcx_bucket_search ( mcxHash* h , void* ob , mcxmode ACTION , u32* hashval ) { u32 thishash = hashval ? *hashval : (h->hash)(ob) ; mcx_bucket *buck = h->buckets + (thishash & (h->n_buckets-1)) ; hash_link* link = buck->base, *prev = NULL, *new ; int c = 1 ; int delta = 0 ; while ( link && (c = h->cmp(ob, link->kv.key)) > 0 ) prev = link , link = link->next ; if (!c && ACTION == MCX_DATUM_DELETE) { if (buck->base == link) buck->base = link->next ; else prev->next = link->next ; delta = -1 ; mcxGrimLet(h->src_link, link) /* we return link below though */ ; } else if (!link || c < 0) { if (ACTION == MCX_DATUM_FIND || ACTION == MCX_DATUM_DELETE) link = NULL ; else if (ACTION == MCX_DATUM_INSERT) { new = mcxGrimGet(h->src_link) ; new->next = NULL ; new->kv.val = NULL ; new->kv.key = ob ; if (!buck->base) buck->base = new ; else if (link == buck->base) new->next = buck->base , buck->base = new ; else new->next = prev->next , prev->next = new ; delta = 1 ; link = new ; } } h->n_entries += delta ; return link ; } #endif static mcxstatus mcx_hash_double ( mcxHash* h ) ; mcxKV* mcxHashSearchx ( void* key , mcxHash* h , mcxmode ACTION , int* delta ) { hash_link *link ; dim n_entries = h->n_entries ; if ( h->load * h->n_buckets < h->n_entries && !(h->options & (MCX_HASH_OPT_CONSTANT | MCX_HASH_DOUBLING)) && mcx_hash_double(h) ) mcxErr("mcxHashSearch", "cannot double hash") ; link = mcx_bucket_search(h, key, ACTION, NULL) ; if (delta) *delta = h->n_entries < n_entries ? -1 : h->n_entries - n_entries ; return link ? &link->kv : NULL ; } enum { ARRAY_OF_KEY , ARRAY_OF_KV } ; void mcxHashApply ( mcxHash* hash , void (*cb)(const void* key, void* val, void* data) , void* data ) { mcxHashWalk* walk = mcxHashWalkInit(hash) ; mcxKV* kv ; dim i_bucket ; while ((kv = mcxHashWalkStep(walk, &i_bucket))) cb(kv->key, kv->val, data) ; mcxHashWalkFree(&walk) ; } static void** hash_array ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) , mcxbits opts cpl__unused , mcxenum mode ) { void** obs = mcxAlloc(sizeof(void*) * hash->n_entries, RETURN_ON_FAIL) ; dim d = 0 ; mcxKV* kv ; const char* me = mode == ARRAY_OF_KEY ? "mcxHashKeys" : "mcxHashKVs" ; mcxHashWalk* walk = mcxHashWalkInit(hash) ; if (!walk || !obs) return NULL ; while ((kv = mcxHashWalkStep(walk, NULL))) /* fixme extract */ { if (d >= hash->n_entries) { mcxErr ( me , "PANIC inconsistent state (n_entries %ld)" , (long) hash->n_entries ) ; break ; } obs[d] = mode == ARRAY_OF_KEY ? kv->key : kv ; d++ ; } if (d != hash->n_entries) mcxErr(me, "PANIC inconsistent state (n_entries %d)", hash->n_entries) ; qsort(obs, d, sizeof(void*), cmp) ; mcxHashWalkFree(&walk) ; *n_entries = d ; return obs ; } void** mcxHashKeys ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) , mcxbits opts /* unused yet */ ) { return hash_array(hash, n_entries, cmp, opts, ARRAY_OF_KEY) ; } void** mcxHashKVs ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) , mcxbits opts /* unused yet */ ) { return hash_array(hash, n_entries, cmp, opts, ARRAY_OF_KV) ; } mcxKV* mcxHashWalkStep ( mcxHashWalk *walk , dim *i_bucket ) { hash_link* step = walk->link ; while (!step && ++walk->i_bucket < walk->hash->n_buckets) step = (walk->hash->buckets+walk->i_bucket)->base ; if (step) { walk->link = step->next ; if (i_bucket) *i_bucket = walk->i_bucket ; return &step->kv ; } return NULL ; } mcxHashWalk* mcxHashWalkInit ( mcxHash *h ) { mcxHashWalk* walk = mcxAlloc(sizeof *walk, RETURN_ON_FAIL) ; if (!walk) return NULL ; walk->hash = h ; if (!h || !h->buckets) { mcxFree(walk) ; return NULL ; } walk->i_bucket = 0 ; walk->link = (h->buckets+0)->base ; return walk ; } void mcxHashWalkFree ( mcxHashWalk **walkpp ) { mcxFree(*walkpp) ; *walkpp = NULL ; } mcxHash* mcxHashMerge ( mcxHash* h1 , mcxHash* h2 , mcxHash* hd /* hash destination */ , void* merge(void* val1, void* val2) ) { mcxHash* ha[2] /* hash array */ ; mcxHash* h ; int i ; if (!h1 || !h2) mcxDie(1, "mcxHashMerge FATAL", "clone functionality not yet supported") /* * fixme/note I am comparing fie pointers here, is that ok? */ ; if (h1->hash != h2->hash || h1->cmp != h2->cmp) mcxErr("mcxHashMerge WARNING", "non matching hash or cmp fie") ; if (merge) mcxErr("mcxHashMerge WARNING", "merge functionality not yet supported") ; hd = hd ? hd : mcxHashNew ( h1->n_entries + h2->n_entries , h1->hash , h1->cmp ) ; if (!hd) return NULL ; ha[0] = h1 ; ha[1] = h2 ; for (i=0;i<2;i++) { h = ha[i] ; if (h != hd) { mcx_bucket* buck ; for (buck = h->buckets; buckbuckets + h->n_buckets; buck++) { hash_link* this = buck->base ; while(this) { mcxKV* kv = mcxHashSearch(this->kv.key, hd, MCX_DATUM_INSERT) ; if (!kv) return NULL /* note/fixme: cannot free hd, don't have key/val free functions */ ; if (!kv->val) kv->val = this->kv.val ; this = this->next ; } } } } return hd ; } static mcxstatus mcx_hash_double ( mcxHash* h ) { mcx_bucket* ole_bucket = h->buckets ; mcx_bucket* ole_buckets = h->buckets ; dim d = h->n_buckets ; dim n_fail = 0 ; if (h->options & MCX_HASH_DOUBLING) /* called before */ { mcxErr("mcx_hash_double PANIC", "double trouble") ; return STATUS_FAIL ; } h->options |= MCX_HASH_DOUBLING ; if (! ( h->buckets = mcxNAlloc ( 2 * h->n_buckets , sizeof(mcx_bucket) , mcx_bucket_init , RETURN_ON_FAIL ) ) ) { h->options ^= MCX_HASH_DOUBLING ; h->buckets = ole_buckets ; return STATUS_FAIL ; } h->n_buckets *= 2 ; h->n_entries = 0 ; while(d-- > 0) /* careful with unsignedness */ { hash_link* this = ole_bucket->base ; while(this) { hash_link* next = this->next, *clone ; void* val = this->kv.val ; void* key = this->kv.key ; mcxGrimLet(h->src_link, this) /* will be used immediately */ #if TINGEA_HASH_CACHE ; clone = mcx_bucket_search(h, key, MCX_DATUM_INSERT, &this->hv) #else ; clone = mcx_bucket_search(h, key, MCX_DATUM_INSERT, NULL) #endif ; if (clone) clone->kv.val = val ; else n_fail++ ; this = next ; } ole_bucket++ ; } if (n_fail) mcxErr ( "mcx_hash_double PANIC" , "<%ld> reinsertion failures in hash with <%ld> entries" , (long) n_fail , (long) h->n_entries ) ; mcxFree(ole_buckets) ; h->options ^= MCX_HASH_DOUBLING ; return STATUS_OK ; } #define BJmix(a,b,c) \ { \ a -= b; a -= c; a ^= (c>>13); \ b -= c; b -= a; b ^= (a<< 8); \ c -= a; c -= b; c ^= (b>>13); \ a -= b; a -= c; a ^= (c>>12); \ b -= c; b -= a; b ^= (a<<16); \ c -= a; c -= b; c ^= (b>> 5); \ a -= b; a -= c; a ^= (c>> 3); \ b -= c; b -= a; b ^= (a<<10); \ c -= a; c -= b; c ^= (b>>15); \ } /* * Thomas Wang says Robert Jenkins says this is a good integer hash function: *unsigned int inthash(unsigned int key) *{ * key += (key << 12); * key ^= (key >> 22); * key += (key << 4); * key ^= (key >> 9); * key += (key << 10); * key ^= (key >> 2); * key += (key << 7); * key ^= (key >> 12); * return key; *} */ /* created by Bob Jenkins */ u32 mcxBJhash ( register const void* key , register u32 len ) { register u32 a, b, c, l ; const char* k = key ; l = len ; a = b = 0x9e3779b9u ; c = 0xabcdef01u ; while (l >= 12) { a += k[0] + (k[1]<<8) + (k[2]<<16) + (k[3]<<24) ; b += k[4] + (k[5]<<8) + (k[6]<<16) + (k[7]<<24) ; c += k[8] + (k[9]<<8) + (k[10]<<16)+ (k[11]<<24) ; BJmix(a,b,c) ; k += 12 ; l -= 12 ; } c += len ; switch(l) /* all the case statements fall through */ { case 11: c+= k[10]<<24 ; case 10: c+= k[9]<<16 ; case 9 : c+= k[8]<<8 /* the first byte of c is reserved for the length */ ; case 8 : b+= k[7]<<24 ; case 7 : b+= k[6]<<16 ; case 6 : b+= k[5]<<8 ; case 5 : b+= k[4] ; case 4 : a+= k[3]<<24 ; case 3 : a+= k[2]<<16 ; case 2 : a+= k[1]<<8 ; case 1 : a+= k[0] /* case 0: nothing left to add */ ; } BJmix(a,b,c) ; return c ; } /* created by Chris Torek */ u32 mcxCThash ( const void *key , u32 len ) #define ctHASH4a h = (h << 5) - h + *k++; #define ctHASH4b h = (h << 5) + h + *k++; #define ctHASH4 ctHASH4b { u32 h = 0 ; const unsigned char *k = key ; if (len > 0) { unsigned loop = (len + 8 - 1) >> 3 /* loop >= 1 */ ; switch (len & (8 - 1)) { case 0: do { /* All fall through */ ctHASH4 case 7: ctHASH4 case 6: ctHASH4 case 5: ctHASH4 case 4: ctHASH4 case 3: ctHASH4 case 2: ctHASH4 case 1: ctHASH4 } while (--loop) /* unsignedcmpok */ ; } } ; return h ; } /* All 3 hash fies below play on a similar theme. Interesting: as long as only * << >> and ^ are used, a hash function does a partial homogeneous fill of all * 2^k different strings of length k built out of two distinct characters -- * not all buckets need be used. E.g. for k=15, such a hash function might fill * 2^13 buckets with 4 entries each, or it might fill 2^10 buckets with 32 * entries each. This was observed, not proven. */ u32 mcxSvDhash ( const void *key , u32 len ) { u32 h = 0x7cabd53e /* 0x7cabd53e */ ; const char* k = key ; h = 0x0180244a ; while (len--) { u32 g = *k ; u32 gc = 0xff ^ g ; u32 hc = 0xffffffffu ; hc ^= h ; h = ( (h << 2) + h + (h >> 3)) ^ ( (g << 25) + (gc << 18) + (g << 11) + (g << 5) + g ) ; k++ ; } ; return h ; } /* created by me */ u32 mcxSvD2hash ( const void *key , u32 len ) { u32 h = 0x7cabd53e /* 0x7cabd53e */ ; const char* k = key ; while (len--) { u32 g = *k ; u32 gc = 0xff ^ g ; h = ( (h << 3) ^ h ^ (h >> 5) ) ^ ( (g << 25) ^ (gc << 18) ^ (g << 11) ^ (gc << 5) ^ g ) ; k++ ; } ; return h ; } /* created by me */ u32 mcxSvD1hash ( const void *key , u32 len ) { u32 h = 0xeca96537u ; const char* k = key ; while (len--) { u32 g = *k ; h = ( (h << 3) ^ h ^ (h >> 5) ) ^ ( (g << 21) ^ (g << 12) ^ (g << 5) ^ g ) ; k++ ; } ; return h ; } /* created by Daniel Phillips */ u32 mcxDPhash ( const void *key , u32 len ) { u32 h0 = 0x12a3fe2du , h1 = 0x37abe8f9u ; const char* k = key ; while (len--) { u32 h = h1 + (h0 ^ (*k++ * 71523)) ; h1 = h0 ; h0 = h ; } return h0 ; } /* "GNU Emacs" hash (from m4) */ u32 mcxGEhash ( const void* key , u32 len ) { const char* k = key ; u32 hash = 0 ; int t ; while (len--) { if ((t = *k++) >= 0140) t -= 40 ; hash = ((hash << 3) + (hash >> 28) + t) ; } return hash ; } /* Fowler Noll Vo hash */ u32 mcxFNVhash ( const void *buf , u32 len ) { u32 hval = 0x811c9dc5 ; const char *bp = buf ; while (len--) { #if 0 /* other branch supposedly optimizes gcc */ hval *= 0x01000193 #else hval += (hval<<1) + (hval<<4) + (hval<<7) + (hval<<8) + (hval<<24) #endif ; hval ^= *bp++; ; } return hval ; } /* Berkely Database hash */ u32 mcxBDBhash ( const void *key , u32 len ) { const char* k = key ; u32 hash = 0 ; while (len--) { hash = *k++ + (hash << 6) + (hash << 16) - hash ; } return hash ; } /* One at a time hash, Bob Jenkins/Colin Plumb */ u32 mcxOAThash ( const void *key , u32 len ) { const char* k = key ; u32 hash = 0 ; while (len--) { hash += *k++ ; hash += (hash << 10) ; hash ^= (hash >> 6) ; } hash += (hash << 3); ; hash ^= (hash >> 11); ; hash += (hash << 15); ; return hash ; } /* by Dan Bernstein */ u32 mcxDJBhash ( const void *key , u32 len ) { const char* k = key ; u32 hash = 5381 ; while (len--) { hash = *k++ + (hash << 5) + hash ; } return hash ; } /* UNIX ELF hash */ u32 mcxELFhash ( const void *key , u32 len ) { const char* k = key ; u32 hash = 0 ; u32 g ; while (len--) { hash = *k++ + (hash << 4) ; if ((g = (hash & 0xF0000000u))) hash ^= g >> 24 ; hash &= ~g ; } return hash ; } u32 mcxStrHash ( const void* s ) { dim l = strlen(s) ; return(mcxDPhash(s, l)) ; } int mcxStrCmp ( const void* a , const void* b ) { return strcmp(a, b) ; } void bitprint ( u32 key , FILE* fp ) { do { fputc(key & 1 ? '1' : '0', fp) ; } while ((key = key >> 1)) ; } int bitcount ( u32 key ) { int ct = 0 ; do { if (key & 1) ct++ ; } while ((key = key >> 1)) ; return ct ; } apparix-07-261/util/heap.c0000644002600400000120000001112310642147132012216 00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include "alloc.h" #include "heap.h" #include "types.h" #include "err.h" mcxHeap* mcxHeapInit ( void* h ) { mcxHeap* heap = (mcxHeap*) h ; if (!heap && !(heap = mcxAlloc(sizeof(mcxHeap), RETURN_ON_FAIL))) return NULL ; heap->base = NULL ; heap->heapSize = 0 ; heap->elemSize = 0 ; heap->cmp = NULL ; heap->n_inserted = 0 ; heap->type = 0 ; return heap ; } mcxHeap* mcxHeapNew ( mcxHeap* h , dim heapSize , dim elemSize , int (*cmp) (const void* lft, const void* rgt) , mcxenum type /* MCX_MIN_HEAP or MCX_MAX_HEAP */ ) { mcxHeap* heap = mcxHeapInit(h) ; char* base ; mcxstatus status = STATUS_FAIL ; while (1) { if (!heap) break ; if (type != MCX_MIN_HEAP && type != MCX_MAX_HEAP) { mcxErr("mcxHeapNew PBD", "unknown heap type") ; break ; } if ( !heap || !(heap->base = mcxAlloc (heapSize*elemSize, RETURN_ON_FAIL)) ) { mcxHeapFree(&heap) ; break ; } status = STATUS_OK ; break ; } if (status) { mcxHeapFree(&heap) ; return NULL ; } heap->heapSize = heapSize ; heap->elemSize = elemSize ; heap->cmp = cmp ; heap->type = type ; heap->n_inserted = 0 ; base = (char*) heap->base ; return heap ; } void mcxHeapClean ( mcxHeap* heap ) { heap->n_inserted = 0 ; } void mcxHeapRelease ( void* heapv ) { mcxHeap* heap = (mcxHeap*) heapv ; if (heap->base) mcxFree(heap->base) ; heap->base = NULL ; heap->heapSize = 0 ; } void mcxHeapFree ( mcxHeap** heap ) { if (*heap) { if ((*heap)->base) mcxFree((*heap)->base) ; mcxFree(*heap) ; *heap = NULL ; } } void mcxHeapInsert ( mcxHeap* heap , void* elem ) { char* heapRoot = heap->base ; char* elemch = elem ; dim elsz = heap->elemSize ; dim hpsz = heap->heapSize ; int (*cmp)(const void *, const void*) = heap->cmp ; if (heap->type == MCX_MIN_HEAP) { if (heap->n_inserted < hpsz) { dim i = heap->n_inserted ; while (i != 0 && (cmp)(heapRoot+elsz*((i-1)/2), elemch) > 0) { memcpy(heapRoot + i*elsz, heapRoot + elsz*((i-1)/2), elsz) ; i = (i-1)/2 ; } memcpy(heapRoot + i*elsz, elemch, elsz) ; heap->n_inserted++ ; } else if ((cmp)(elemch, heapRoot) > 0) { dim root = 0 ; dim d ; while ((d = 2*root+1) < hpsz) { if ( (d+1 < hpsz) && (cmp)(heapRoot + d*elsz, heapRoot + (d+1)*elsz) > 0 ) d++ ; if ((cmp)(elemch, heapRoot + d*elsz) > 0) { memcpy(heapRoot+root*elsz, heapRoot+d*elsz, elsz) ; root = d ; } else break ; } memcpy(heapRoot+root*elsz, elemch, elsz) ; } } else if (heap->type == MCX_MAX_HEAP) { if (heap->n_inserted < hpsz) { dim i = heap->n_inserted ; while (i != 0 && (cmp)(heapRoot+elsz*((i-1)/2), elemch) < 0) { memcpy(heapRoot + i*elsz, heapRoot + elsz*((i-1)/2), elsz) ; i = (i-1)/2 ; } memcpy(heapRoot + i*elsz, elemch, elsz) ; heap->n_inserted++ ; } else if ((cmp)(elemch, heapRoot) < 0) { dim root = 0 ; dim d ; while ((d = 2*root+1) < hpsz) { if ( (d+1 #include #include #include #include "let.h" #include "ting.h" #include "ding.h" #include "alloc.h" #include "minmax.h" #include "err.h" #include "types.h" #include "ding.h" #include "compile.h" /* ************************************************************************** * * ** Implementation notes (a few). * * Features * All of C's operators in a revised precedence scheme, with exponentiation * added. The groups of logical operators, bitwise operators, comparison * operators have equal precedence internally (but changing this is a * matter of editing a single table). Unsigned integers are not supported * (so bitwise complement behaves funnily). Ternary operator behaves as * should; evaluates only one of its branches. Boolean logical operators * do shortcircuit. All mathematical functions from math.h and some * additional ones (e.g. abs, round, sign). Variables can be parsed and * evaluated using user-supplied functions. Currently, variables must be * recognizable by a special lead character. Todos * I may want to pass raam along to compute and flatten after all. * This brings back in the tokids, which are nice to have. * It also means that global callbacks can be localized. * * Right now, inf is not caught. isinf() seems not portable though :( * * getatoken could be equipped with more error handling facilities now that * user_parse is inserted. The current behaviour is that parsing control * is transfered to native parsing if user parsing does not succeed. This * can be used for overloading the special character, e.g. setting it to * '!' -> user parsing could require a !<..> sequence; if not found, '!' * would be seen as the negation operator. * * user_parse and user_eval need to be global in scope as long * as raam is not passed along in compute and flatten, * but that is actually not a problem (apart from .so libs). * * Hashing of function names. * * Audit overflow, exceptions, long/double mixing. * * Should min(1,2.0) be 1 rather than 1.0 ? in that case, need special * behaviour for twoary max and min just like now for oneary abs. * * Make int overflow -> double promotion a trmInit option. * * on STATUS_FAIL for parse, write error message in telraam. * * allow functions with empty arguments (e.g. rand()). * * add some of the funny stuff provided by fv, f? * * tn toktype is used both in lexing/parsing stage and in reduction stage. * not scalable. Future idea: * Implement an intermediate layer between parsing and evaluation. * E.g. convert the result of trmParse() to a stack. Done * Errors cascade back. For parse errors all memory seems to be reclaimed * (for all cases tried so far). * After parsing, no other errors should be possible I believe. * * made real type, which could be long double. Tis not however, * because long double math does not seem widespread and/or standard. * made num type, which could be long long. Tis not however, * because long long math seems to be C99 (not widespread etc). * * enabled user callbacks for variable and function interpolation. Integers/Floats * It is tracked which operations result in integers and which do * not. If integer overflow occurs the result is promoted to double. * The internal logic implementing this behaviour dictates that * as long as (flags & TN_ISINT) it must be true that fval ==~ ival. * TODO: make this customizable. * NOTE: doubles pbb can capture all 32-bit integers, but not so for * 64-bit integers. May make subtle difference. Apology * It's lame to write your own parser rather than lex and yacc but scriptor * wanted to do it one more time than zero. * * The result is pretty ad hoc and not generic, what it's got going for it * is that it works. Also, trmParse() is not that bad I believe, although * it is not very scalable either. compute() is the trickiest. Some * provisions were made to get short-circuiting and the ternary op working. * The same data structure is used for tokenization, parsing, and * evaluation. Ugly! Implementation notes * . Parse tree is implicitly stored as a linked list. * . Evaluation is done by compute/flatten; precedence and branching are done * during evaluation, rather than (partly) precomputed (which would much be * cleaner). precedence is done in flatten; branching in compute. * . tn's (token nodes) are used both by lexer, parser, and interpreter, * which is not the nicest way of doing it. * . Could push and convert all tokens to a stack (format), which would unify * operators and functions to some extent, and separate interpretation from * parsing and braching. Errors * Currently we have arithmetic error only. * TODO: * Overflow error -- but isinf does not seem portable :( Caveat * tnFree/tnDup should not be applied to a TOKEN_CLOSE node, dupwise * speaking. This is because compute currently has a sanity check for * pointer identity before and after its main loop. * * tricky spots, unfinished thoughts, future ideas, and omitted assertions * are marked with the sequence 'mq' (or even 'mqmq'), but not all of them. * Some reminders * routines that must be checked (malloc dependent) * tnDup * tnNewToken * tnPushToken * tnPushThis * routines that need be checked for other reason * tnUser * flatten * compute * getatom * getexpression * trmParse */ typedef double real; /* but we always use double arithmetic */ /* i.e. never use long double */ #ifdef LET99 typedef long long num; # define NUM_MIN LLONG_MIN /* this branch has not been tested! */ # define NUM_MAX LLONG_MAX /* and requires modifiation of trmEval */ #else typedef long num; # define NUM_MIN LONG_MIN # define NUM_MAX LONG_MAX #endif static int debug_g = 0; static int (*user_parse_g)(mcxTing* txt, int offset) = NULL; static mcxenum (*user_eval_g)(const char* token, long *ival, double *fval) = NULL; static char user_char_g = 0; typedef struct tn /* the lex/parse/interpret one stop-shop */ { mcxTing* token ; i32 toktype ; i32 optype ; i32 opid ; real fval ; num ival ; struct tn* prev ; struct tn* next ; i32 flags ; } tn; /* token node, or whatever */ struct telRaam { mcxTing *text ; mcxTing *token /* current token */ ; char* p ; mcxbool buffered /* should use buffer (pushed back token)? */ ; tn* node ; tn* start ; real fval ; num ival ; i32 flags ; i32 toktype ; i32 depth ; } ; typedef enum { TOKEN_EXH = -1 , TOKEN_START = 0 /* special start symbol */ , TOKEN_UNIOP = 1 /* unary, 1 */ , TOKEN_BINOP = 2 /* binary, 2 */ , TOKEN_FUN = 69 /* can be fun, but I mean 6 = ( 9 = ) */ , TOKEN_TRIOP = 3333 /* ternary, let's stress the fact */ , TOKEN_TRICATCH = 6667 /* complement of a number wrt another number */ , TOKEN_CMP = 12321 /* hum, dunnow really */ , TOKEN_OR = 11 /* || */ , TOKEN_AND = 88 /* && */ , TOKEN_OPEN = 6 /* like fun, 6 = ( */ , TOKEN_CLOSE = 9 /* like fun, 9 = ) */ , TOKEN_COMMA = 13579 /* gaps */ , TOKEN_CONST = 31415 /* PI */ , TOKEN_USER = 981 /* G, variable */ } tokentype ; #define OP_UNI_NEG 1 << 0 /* - */ #define OP_UNI_NOT 1 << 1 /* ! */ #define OP_UNI_COMPL 1 << 2 /* ~ */ #define OP_EXP_EXP 1 << 3 /* ** */ #define OP_MUL_MUL 1 << 4 /* * */ #define OP_MUL_FRAC 1 << 5 /* / */ #define OP_MUL_DIV 1 << 6 /* // */ #define OP_MUL_MOD 1 << 7 /* % */ #define OP_ADD_ADD 1 << 8 /* + */ #define OP_ADD_SUB 1 << 9 /* - */ #define OP_BIT_LSHIFT 1 << 10 /* << */ #define OP_BIT_RSHIFT 1 << 11 /* >> */ #define OP_BIT_AND 1 << 12 /* & */ #define OP_BIT_OR 1 << 13 /* | */ #define OP_BIT_XOR 1 << 14 /* ^ */ #define OP_CMP_LT 1 << 15 /* < */ #define OP_CMP_LQ 1 << 16 /* <= */ #define OP_CMP_GQ 1 << 17 /* >= */ #define OP_CMP_GT 1 << 18 /* > */ #define OP_CMP_EQ 1 << 19 /* == */ #define OP_CMP_NE 1 << 20 /* != */ #define OP_TRI_START 1 << 21 /* ! */ #define OPTYPE_UNI (OP_UNI_NEG | OP_UNI_NOT | OP_UNI_COMPL) #define OPTYPE_EXP OP_EXP_EXP #define OPTYPE_MUL (OP_MUL_MUL | OP_MUL_FRAC | OP_MUL_DIV | OP_MUL_MOD) #define OPTYPE_ADD (OP_ADD_ADD | OP_ADD_SUB) #define OPTYPE_BIT (OP_BIT_LSHIFT | OP_BIT_RSHIFT \ | OP_BIT_AND | OP_BIT_OR | OP_BIT_XOR) #define OPTYPE_CMP (OP_CMP_LT | OP_CMP_LQ | OP_CMP_GT | OP_CMP_GQ \ | OP_CMP_EQ | OP_CMP_NE) #define OPTYPE_TRI OP_TRI_START typedef struct opHook { char* opname ; i32 opid ; i32 optype ; } opHook ; double sign (double f ) { return f > 0 ? 1.0 : f < 0 ? -1.0 : 0.0 ; } double letround (double f ) { return f > 0 ? floor(f+0.5) : ceil(f-0.5) ; } double letlog2 (double f) { return f > 0 ? log(f) / log(2.0) : 0.0 ; } typedef struct fun1Hook { char* funname ; double (*funcd)(double a) ; i32 funflags ; } fun1Hook ; #define FUN_SPECIAL 1 #define FUN_INTRESULT 2 #define FUN_OVERLOADED 4 double show_bits(double a) { return a; } static fun1Hook fun1HookDir[] = { { "sin", sin , 0 } , { "cos", cos , 0 } , { "tan", tan , 0 } , { "exp", exp , 0 } , { "log", log , 0 } , { "log10", log10 , 0 } , { "log2", letlog2 , 0 } , { "asin", asin , 0 } , { "acos", cos , 0 } , { "atan", atan , 0 } , { "sqrt", sqrt , 0 } , { "abs", fabs , FUN_SPECIAL } , { "floor", floor , FUN_INTRESULT } , { "ceil", ceil , FUN_INTRESULT } , { "round", letround , FUN_INTRESULT } , { "int", letround , FUN_INTRESULT } , { "sign", sign , FUN_INTRESULT } , { "bits", show_bits , FUN_SPECIAL } , { NULL, NULL , 0 } } ; double max ( double a, double b ) { return a > b ? a : b ; } double min ( double a, double b ) { return a < b ? a : b ; } num maxl ( num a, num b ) { return a > b ? a : b ; } num minl ( num a, num b ) { return a < b ? a : b ; } typedef struct fun2Hook { char* funname ; double (*funcd)(double a, double b) ; num (*funcl)(num a, num b) ; i32 funflags ; } fun2Hook ; static fun2Hook fun2HookDir[] = { { "max", max , maxl, 0 } , { "min", min , minl, 0 } , { NULL, NULL , NULL, 0 } } ; /* mq if (tn_isint(lft) && tn_isint(rgt) && hook->funcl) */ static opHook opHookDir[] = { { "-", OP_UNI_NEG, OPTYPE_UNI } , { "!", OP_UNI_NOT, OPTYPE_UNI } , { "~", OP_UNI_COMPL, OPTYPE_UNI } , { "**", OP_EXP_EXP, OPTYPE_EXP } , { "*", OP_MUL_MUL, OPTYPE_MUL } , { "/", OP_MUL_FRAC, OPTYPE_MUL } , { "//", OP_MUL_DIV, OPTYPE_MUL } , { "%", OP_MUL_MOD, OPTYPE_MUL } , { "+", OP_ADD_ADD, OPTYPE_ADD } , { "-", OP_ADD_SUB, OPTYPE_ADD } , { "<<", OP_BIT_LSHIFT, OPTYPE_BIT } , { ">>", OP_BIT_RSHIFT, OPTYPE_BIT } , { "&", OP_BIT_AND, OPTYPE_BIT } , { "|", OP_BIT_OR, OPTYPE_BIT } , { "^", OP_BIT_XOR, OPTYPE_BIT } , { "<", OP_CMP_LT, OPTYPE_CMP } , { "<=", OP_CMP_LQ, OPTYPE_CMP } , { ">=", OP_CMP_GQ, OPTYPE_CMP } , { ">", OP_CMP_GT, OPTYPE_CMP } , { "==", OP_CMP_EQ, OPTYPE_CMP } , { "!=", OP_CMP_NE, OPTYPE_CMP } , { "?", OP_TRI_START, OPTYPE_TRI } , { NULL, 0, 0, } } ; enum { EXPECT_ANY = 1 , EXPECT_ATOM = 2 } ; #define TN_ISINT 1 /* tn token node, object used everywhere */ #define TN_NOINT 2 #define TN_ISNAN 4 #define TN_ISINF 8 #define tn_isint(a) (a->flags & TN_ISINT) mcxbool trmIsNan ( int flags ) { return flags & TN_ISNAN ; } mcxbool trmError ( int flags ) { return flags & (TN_ISNAN | TN_ISINF) ; } mcxbool trmIsInf ( int flags ) { return flags & TN_ISINF ; } mcxbool trmIsNum ( int flags ) { return flags & TN_ISINT ; } mcxbool trmIsReal ( int flags ) { return !(flags & (TN_ISINT | TN_ISNAN | TN_ISINF)) ; } mcxstatus getexpression ( telRaam *raam ) ; mcxstatus getatom ( telRaam* raam ) ; void dump ( tn* node , i32 times , const char* msg ) ; void trmDump ( telRaam* raam , const char* msg ) { dump(raam->start, 0, msg) ; } tn* tnNewToken ( const char* token , i32 toktype , real fval , num ival ) { tn* node = mcxAlloc(sizeof(tn), RETURN_ON_FAIL) ; if (!node) return NULL ; if (!(node->token = mcxTingNew(token ? token : "_<>_"))) { mcxFree(node) ; return NULL ; } node->toktype = toktype ; node->optype = 0 ; node->opid = 0 ; node->ival = ival ; node->fval = fval ; node->next = NULL ; node->prev = NULL ; node->flags = 0 ; if (debug_g) dump(node, 1, "new node") ; return node ; } tn* tnDup ( tn* this , const char* str ) { tn* new = tnNewToken ( str , this->toktype , this->fval , this->ival ) ; if (!new) return NULL ; new->optype = this->optype ; new->next = this->next ; new->prev = this->prev ; new->flags = this->flags ; return new ; } mcxstatus tnFree ( tn* lft , tn* rgt ) { tn* cur = lft, *next ; while (cur) { mcxTingFree(&(cur->token)) ; if (debug_g) fprintf(stderr, "___ [telraam] freeing node <%p>\n", (void*) cur) ; if (cur == rgt) { mcxFree(cur) ; break ; } if (cur->next && cur->next->prev != cur) { mcxErr("tnFree", "free encountered spaghetti") ; return STATUS_FAIL ; } next = cur->next ; mcxFree(cur) ; cur = next ; } return STATUS_OK ; } void tnLink2 ( tn* one , tn* two ) { if (one) one->next = two ; if (two) two->prev = one ; } void tnLink3 ( tn* one , tn* two , tn* three ) { if (one) one->next = two ; if (three) three->prev = two ; two->prev = one ; two->next = three ; } mcxstatus tnPushToken ( telRaam* raam ) { i32 toktype = raam->toktype ; tn* new = tnNewToken(raam->token->str, toktype, 0.0, 0) ; if (!new) return STATUS_FAIL ; if (toktype == TOKEN_CONST) new->fval = raam->fval , new->ival = raam->ival , new->flags = raam->flags ; else if ( toktype == TOKEN_BINOP || toktype == TOKEN_UNIOP ) { opHook* oh = raam->toktype == TOKEN_BINOP ? opHookDir+3 : opHookDir+0 /* bigg phat ugly hack */ /* (need to overcome '-' uni/bin ambiguity */ ; while (oh->opname) { if (!strcmp(oh->opname, raam->token->str)) { new->optype = oh->optype ; new->opid = oh->opid ; break ; } oh++ ; } if (!oh->opname) { mcxErr("tnPushToken", "no such operator: <%s>", raam->token->str) ; tnFree(new, NULL) ; return STATUS_FAIL ; } } else if (raam->toktype == TOKEN_FUN) { /* mq: move name resolution to here ? mm, needs arity */ ; } tnLink3(raam->node, new, NULL) ; raam->node = new ; return STATUS_OK ; } mcxstatus tnPushThis ( telRaam* raam , const char* token , i32 toktype ) { tn* new = tnNewToken(token, toktype, 0.0, 0) ; if (!new) return STATUS_FAIL ; tnLink3(raam->node, new, NULL) ; raam->node = new ; return STATUS_OK ; } void trmDebug ( void ) { debug_g = 1 ; } telRaam* trmInit ( const char* str ) { telRaam* raam= mcxAlloc(sizeof(telRaam), RETURN_ON_FAIL) ; if (!raam) return NULL ; raam->text = mcxTingNew(str) ; raam->token = mcxTingEmpty(NULL, 30) ; raam->p = raam->text->str ; raam->buffered = FALSE ; raam->node = tnNewToken("_start_", TOKEN_START, 0.0, 0) ; raam->start = raam->node ; raam->fval = 0.0 ; raam->ival = 0 ; raam->flags = 0 ; raam->depth = 1 ; raam->toktype= 0 ; if (!raam->text || !raam->token || !raam->node) mcxFree(raam) , raam = NULL ; return raam ; } mcxstatus trmExit ( telRaam* raam ) { if (tnFree(raam->start, raam->node)) return STATUS_FAIL ; mcxTingFree(&(raam->text)) ; mcxTingFree(&(raam->token)) ; mcxFree(raam) ; return STATUS_OK ; } void untoken ( telRaam* raam ) { raam->buffered = TRUE ; } void dump ( tn* node , i32 times , const char* msg ) { tn* prev = NULL ; printf("______ %s\n", msg ? msg : "dumping dumping dumping") ; printf ("%8s" "%10s" "%10s" "%10s" "%12s" "%10s" "%6s\n" ,"toktype","optype","opclass","token","fval","ival","flags" ) ; while (node) { printf ("%8d" "%10d" "%10d" "%10s" "%12.4f""%10ld""%6d\n" , node->toktype , node->opid , node->optype , node->token ? node->token->str : "<>" , node->fval , (long) node->ival , node->flags ) ; prev = node ; node = node->next ; if (node && (node->prev->next != node || node->prev != prev)) fprintf ( stderr , "_____ [telraam] PANICK incorrect linking" " <%p> n<%p> np<%p> npn<%p>\n" , (void*) prev , (void*) node , (void*) node->prev , (void*) node->prev->next ) ; if (!--times) break ; } } int getatoken ( telRaam* raam , i32 mode ) { char* p = raam->p ; i32 toktype = 0 ; int len ; while (isspace((unsigned char) *p)) p++ ; raam->p = p ; if (!*p) { mcxTingWrite(raam->token, "EOF") ; return TOKEN_EXH ; } else if ( mode == EXPECT_ATOM && ( *p == '-' || *p == '!' || *p == '~' ) ) { toktype = TOKEN_UNIOP ; p = p+1 ; } else if (*p == ':') { toktype = TOKEN_TRICATCH ; p = p+1 ; } else if (*p == '&' && *(p+1) == '&') { toktype = TOKEN_AND ; p = p+2 ; } else if (*p == '|' && *(p+1) == '|') { toktype = TOKEN_OR ; p = p+2 ; } else if (*p == '?') { toktype = TOKEN_TRIOP ; p = p+1 ; } else if (*p == ',') { toktype = TOKEN_COMMA ; p = p+1 ; } else if (isdigit((unsigned char) *p)) { int l ; double f ; sscanf(p, "%lf%n", &f, &l) /* mq need error checking */ ; toktype = TOKEN_CONST ; raam->fval = f ; raam->ival = 0 ; if (raam->fval < NUM_MIN || raam->fval > NUM_MAX) raam->flags = TN_NOINT ; else { raam->flags = mcxStrChrAint(p, isdigit, l) ? 0 : TN_ISINT ; raam->ival = f > 0 ? f + 0.5 : f - 0.5 ; } p = p+l ; } else if (isalpha((unsigned char) *p) || *p == '_') { char* q = p ; while(isalpha((unsigned char) *q) || *q == '_' || isdigit((unsigned char) *q)) q++ ; p = q ; toktype = TOKEN_FUN ; } else if (*p == '(' || *p == ')') { toktype = *p == '(' ? TOKEN_OPEN : TOKEN_CLOSE ; p = p+1 ; } else if ( user_char_g == *p && (len = user_parse_g(raam->text, p-raam->text->str)) > 0 ) /* ^truncintok */ { p += len ; toktype = TOKEN_USER ; } else { char* q = p ; while (*q == *p || *q == '=') /* hack */ q++ ; toktype = TOKEN_BINOP ; p = q ; } mcxTingNWrite(raam->token, raam->p, (dim) (p-raam->p)) ; raam->p = p ; return toktype ; } i32 gettoken ( telRaam* raam , i32 mode ) { if (raam->buffered) raam->buffered = FALSE ; else raam->toktype = getatoken(raam, mode) ; return raam->toktype ; } tn* findop ( tn* end ) { tn* node = end->prev, *max = NULL ; while (node->toktype != TOKEN_OPEN) { if ( node->toktype == TOKEN_UNIOP || node->toktype == TOKEN_BINOP || node->toktype == TOKEN_TRIOP ) { if ( !max || node->optype <= max->optype ) max = node ; } node = node->prev ; } return max ; } tn* finduser ( tn* start ) { tn* node = start->next ; while (node->toktype != TOKEN_CLOSE) { if (node->toktype == TOKEN_USER) return node ; node = node->next ; } return NULL ; } mcxstatus tnUser ( tn* usr ) { mcxenum stat = user_eval_g(usr->token->str, &usr->ival, &usr->fval) ; if (stat == TRM_ISNUM) { usr->flags = TN_ISINT ; usr->fval = usr->ival ; } else if (stat == TRM_ISREAL) usr->flags = 0 ; else if (stat == TRM_ISNAN) { usr->flags = TN_ISNAN ; return STATUS_FAIL ; } else if (stat == TRM_FAIL) { usr->flags = TN_ISNAN ; return STATUS_FAIL ; } usr->toktype = TOKEN_CONST ; return STATUS_OK ; } /* * Flattens a bunch of leafs interspersed with operators. * Leaves received start and corresponding end alone. */ mcxstatus flatten ( tn* start , tn* end ) { tn* new, *op, *usr ; real fval = 0.0 ; num ival = 0 ; const char* me = "flatten" ; if ( start->toktype != TOKEN_OPEN || end->toktype != TOKEN_CLOSE ) { mcxErr ( me , "wrong toktype - ids (%p, %p)" , (void*) start, (void*) end ) ; dump(start, 0, NULL) ; return STATUS_FAIL ; } new = start->next ; while ((usr = finduser(start))) { if (tnUser(usr)) return STATUS_FAIL ; } while ((op = findop(end))) { tn* lft = op->prev ; tn* rgt = op->next /* ugly in case of UNIOP */ ; int err = 0 ; i32 flags = 0 ; if (op->toktype == TOKEN_UNIOP) { real frgt = rgt->fval ; num irgt = rgt->ival ; switch(op->opid) { case OP_UNI_NOT : ival = (tn_isint(rgt) && irgt) ? 0 : frgt ? 0 : 1 ; fval = ival ; flags |= TN_ISINT ; break ; case OP_UNI_NEG : fval = -frgt ; ival = -irgt ; break ; case OP_UNI_COMPL : ival = ~irgt ; fval = ival ; flags |= TN_ISINT ; break ; default : err = 1 ; } lft = op ; flags |= tn_isint(rgt) /* mq fval=ival assignment ugly, need overflow check as well :) */ ; } else if (op->toktype == TOKEN_BINOP) { real flft = lft->fval ; real frgt = rgt->fval ; num ilft = lft->ival ; num irgt = rgt->ival ; if (op->opid & OPTYPE_BIT) { if (!tn_isint(lft)) ilft = lft->fval /* fixme: why the reassign? */ ; if (!tn_isint(rgt)) irgt = rgt->fval /* fixme: why the reassign? */ ; if (!tn_isint(rgt) || !tn_isint(lft)) mcxErr ( "let" , "[flatten][bitop %s] forcing real operands to number" , op->token->str ) ; } if (lft->toktype != TOKEN_CONST || rgt->toktype != TOKEN_CONST) { mcxErr(me, "this bifoo is not the right foo") ; dump(start, 0, NULL) ; return STATUS_FAIL ; } switch(op->opid) { case OP_MUL_MUL : fval = flft * frgt ; ival = ilft * irgt ; break ; case OP_EXP_EXP : if (flft < 0 && !(rgt->flags & TN_ISINT)) fval = 0.0 , flags |= TN_ISNAN ; else fval = pow(flft,frgt) ; ival = letround(fval) ; break ; case OP_ADD_ADD : fval = flft + frgt ; ival = ilft + irgt ; break ; case OP_MUL_FRAC : fval = frgt ? (flft / frgt) : 0.0 ; ival = irgt ? (ilft / irgt) : 0 ; if (tn_isint(lft) && tn_isint(rgt) && ival * irgt == ilft) flags |= TN_ISINT ; else flags |= TN_NOINT ; if (!frgt) flags |= TN_ISNAN ; break ; case OP_MUL_DIV : fval = frgt ? floor(flft/frgt) : 0.0 ; ival = irgt ? (ilft / irgt) : 0 ; if (!frgt) flags |= TN_ISNAN ; break ; case OP_MUL_MOD : fval = frgt ? frgt * (flft/frgt-floor(flft/frgt)) : 0.0 ; ival = irgt ? (ilft % irgt) : 0.0 ; if (!frgt) flags |= TN_ISNAN ; break ; case OP_ADD_SUB : fval = flft - frgt ; ival = ilft - irgt ; break ; case OP_CMP_LT : ival = tn_isint(lft) && tn_isint(rgt) && (ilft < irgt) ? 1 : flft < frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_LQ : ival = tn_isint(lft) && tn_isint(rgt) && (ilft <= irgt) ? 1 : flft <= frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_GQ : ival = tn_isint(lft) && tn_isint(rgt) && (ilft >= irgt) ? 1 : flft >= frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_GT : ival = tn_isint(lft) && tn_isint(rgt) && (ilft > irgt) ? 1 : flft > frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_EQ : ival = tn_isint(lft) && tn_isint(rgt) && (ilft == irgt) ? 1 : flft == frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_CMP_NE : ival = tn_isint(lft) && tn_isint(rgt) && (ilft != irgt) ? 1 : flft != frgt ? 1 : 0 ; flags |= TN_ISINT ; break ; case OP_BIT_LSHIFT : ival = ilft << irgt ; flags |= TN_ISINT ; break ; case OP_BIT_RSHIFT : ival = ilft >> irgt ; flags |= TN_ISINT ; break ; case OP_BIT_AND : ival = ilft & irgt ; flags |= TN_ISINT ; break ; case OP_BIT_OR : ival = ilft | irgt ; flags |= TN_ISINT ; break ; case OP_BIT_XOR : ival = ilft ^ irgt ; flags |= TN_ISINT ; break ; default : err = 1 ; } /* this rule implements implicit behaviour with overruling: * two integers result in an integer unless overruled * with the TN_NOINT attribute. */ if (!(flags & TN_NOINT)) flags |= tn_isint(lft) & tn_isint(rgt) /* next we check whether overflow occurred. If so, discard the * integer attribute. This depends on i) fval follows ival as * long as the integer attribute is set and ii) in that pursuit, * fval is computed to be similar to ival. */ ; if ((fval > NUM_MAX || fval < NUM_MIN) && (flags & TN_ISINT)) flags ^= TN_ISINT /* make fval follow ival, otherwise, give ival special * value. *Never* should float->int conversion happen * in this code; it should be user-enforced. * Setting ival to 0 may help show any such behaviour as a bug. */ ; if (flags & TN_ISINT) fval = ival ; else ival = 0 ; } else { mcxErr(me, "panicking at toktype <%ld>", (long) op->toktype) ; return STATUS_FAIL ; } if (err) { mcxErr ( me , "op <%s> id <%ld> class <%ld> not yet supported" , op->token->str , (long) op->opid , (long) op->optype ) ; return STATUS_FAIL ; } if (flags & TN_ISNAN) { mcxErr(me, "arithmetic exception for op <%s>", op->token->str) ; return STATUS_FAIL ; } if (!(new = tnNewToken("_eval_", TOKEN_CONST, fval, ival))) return STATUS_FAIL ; new->flags = flags /* mq need overflow check, nan check etc */ ; tnLink3(lft->prev, new, rgt->next) ; if (tnFree(lft, rgt)) return STATUS_FAIL ; } return STATUS_OK ; } fun1Hook* getfun1id ( tn* start ) { fun1Hook *fh = fun1HookDir+0 ; while (fh->funname && strcmp(fh->funname, start->token->str)) fh++ ; return fh->funname ? fh : NULL ; } fun2Hook* getfun2id ( tn* start ) { fun2Hook *fh = fun2HookDir+0 ; while (fh->funname && strcmp(fh->funname, start->token->str)) fh++ ; return fh->funname ? fh : NULL ; } tn* funcx ( tn* start , tn* end ) { tn *new, *arg = end->prev ; real fval = 0.0 ; num ival = 0 ; i32 flags = 0 ; int n_args = arg->toktype == TOKEN_CONST ; int err = 0 ; const char* me = "funcx" ; const char* fn = "_init_" ; if ( start->toktype != TOKEN_FUN || start->next->toktype != TOKEN_OPEN || end->toktype != TOKEN_CLOSE ) { mcxErr(me, "wrong toktype - ids (%p, %p)", (void*) start, (void*) end) ; dump(start, 0, NULL) ; return NULL ; } while ( arg->toktype == TOKEN_CONST && arg->prev->toktype == TOKEN_COMMA ) arg = arg->prev->prev , n_args++ ; if (arg->prev != start->next) { mcxErr(me, "this function foo is not the right foo") ; dump(start, 0, NULL) ; return NULL ; } if (n_args == 1) { tn* op1 = arg ; fun1Hook* fh = getfun1id(start) ; if (fh) { fn = fh->funname ; if (fh->funflags & FUN_SPECIAL) { if (!strcmp(fn, "abs")) { if (tn_isint(op1)) { ival = op1->ival > 0 ? op1->ival : -op1->ival ; flags |= TN_ISINT ; } else fval = op1->fval > 0 ? op1->fval : -op1->fval ; } else if (!strcmp(fn, "bits")) { if (tn_isint(op1)) { ival = op1->ival ; flags |= TN_ISINT /* mq show the damn bits */ ; } else fval = op1->fval /* mq show the damn bits */ ; } else err = 1 ; } else { fval = (fh->funcd)(op1->fval) ; if ( fh->funflags & FUN_INTRESULT && fval <= NUM_MAX && fval >= NUM_MIN ) { flags |= TN_ISINT ; ival = (num) fval > 0 ? fval+0.5 : fval - 0.5 ; } } } else err = 1 ; } else if (n_args == 2) { tn* op1 = arg, *op2 = op1->next->next ; fun2Hook* fh = getfun2id(start) ; if (fh) { fn = fh->funname ; if (tn_isint(op1) && tn_isint(op2) && fh->funcl) { ival = (fh->funcl)(op1->ival, op2->ival) ; flags |= TN_ISINT ; } else fval = (fh->funcd)(op1->fval, op2->fval) ; } else err = 1 ; } else err = 1 ; if (err) { mcxErr ( me , "<%s> [%d] not supported" , start->token->str , n_args ) ; return NULL ; } else { if (!(new = tnNewToken(fn, TOKEN_CONST, fval, ival))) return NULL ; new->flags = flags ; } return new ; } tn* match ( tn* start ) { int depth = 1 ; if (start->toktype != TOKEN_OPEN) { mcxErr("match", "node <%p> has wrong toktype", (void*) start) ; return NULL ; } while (start->next) { start = start->next ; if (start->toktype == TOKEN_OPEN) depth++ ; else if (start->toktype == TOKEN_CLOSE) { depth-- ; if (!depth) break ; } } return depth ? NULL : start ; } /* * must leave received start and corresponding end alone */ mcxstatus compute ( tn* start ) { tn* ptr, *new, *end ; const char* me = "compute" ; if (start->toktype != TOKEN_OPEN) { mcxErr(me, "node <%p> has wrong toktype", (void*) start) ; return(STATUS_FAIL) ; } if (!(end = match(start))) { mcxErr(me, "node <%p> has no match", (void*) start) ; return(STATUS_FAIL) ; } ptr = start->next ; while (ptr) /* ok by the naming police? */ { tn* eosc, *val ; if (ptr->toktype == TOKEN_FUN) { if (compute(ptr->next)) return STATUS_FAIL /* now:: LPT op CM [op CM]* RPT */ ; eosc = match(ptr->next) ; if (!eosc || !(val = funcx(ptr, eosc))) return STATUS_FAIL /* now:: fun LPT val RPT */ ; tnLink3(ptr->prev, val, eosc->next) ; if (tnFree(ptr, eosc)) return STATUS_FAIL ; ptr = val->next ; } else if (ptr->toktype == TOKEN_OPEN) { if (compute(ptr)) return STATUS_FAIL ; if (!(eosc = match(ptr))) /* should check singularity */ return STATUS_FAIL ; if (!(val = tnDup(eosc->prev, "_scope_"))) return STATUS_FAIL ; tnLink3(ptr->prev, val, eosc->next) ; if (tnFree(ptr, eosc)) return STATUS_FAIL ; ptr = val->next ; } /* should check presence TRICATCH */ else if (ptr->toktype == TOKEN_TRIOP) { tn* br1 = ptr->next, *br2, *eobr1, *eobr2 /* branches */ ; if (!(eobr1 = match(br1))) return STATUS_FAIL ; if (!(br2 = eobr1->next->next)) return STATUS_FAIL ; eobr2 = match(br2) ; if (ptr->prev->fval) /* mqmq! logic by fval */ { if (compute(br1)) return STATUS_FAIL ; if (!(new = tnDup(br1->next, "triop1"))) return STATUS_FAIL ; tnLink3(ptr->prev->prev, new, eobr2->next) ; if (tnFree(ptr->prev, eobr2)) return STATUS_FAIL ; } else { if (compute(br2)) return STATUS_FAIL ; if (!(new = tnDup(br2->next, "triop2"))) return STATUS_FAIL ; tnLink3(ptr->prev->prev, new, eobr2->next) ; if (tnFree(ptr->prev, eobr2)) return STATUS_FAIL ; } ptr = new->next ; } else if (ptr->toktype == TOKEN_AND) /* now:: val AND LPT any RPT */ { tn* pivot = ptr->prev, *clause=ptr->next, *after ; if (pivot->fval) { if (compute(clause)) return STATUS_FAIL /* should check singularity of result */ /* lpt val rpt ? */ ; after = clause->next->next->next /* oops, ugly dugly */ ; pivot->fval = clause->next->fval /* mqmq! logic by fval */ ; if (tnFree(pivot->next, after->prev)) return STATUS_FAIL ; tnLink2(pivot, after) ; ptr = after ; } else { tn* eoclause = match(clause) ; tn* any = eoclause ? eoclause->next : NULL ; if (!eoclause || tnFree(pivot->next, eoclause)) return STATUS_FAIL ; tnLink2(pivot, any) ; ptr = any ; } pivot->ival = pivot->fval ? 1 : 0 ; pivot->flags |= TN_ISINT ; } else if (ptr->toktype == TOKEN_OR) { tn* pivot = ptr->prev, *clause=ptr->next, *after ; if (pivot->fval) { tn* eoclause = match(clause) ; tn* any = eoclause ? eoclause->next : NULL ; if (!eoclause || tnFree(pivot->next, eoclause)) return STATUS_FAIL ; tnLink2(pivot, any) ; ptr = any ; } else { if (compute(clause)) return STATUS_FAIL /* should check singularity of result */ ; after = clause->next->next->next /* oops, ugly dugly */ ; pivot->fval = clause->next->fval /* mqmq! logic by fval */ ; if (tnFree(pivot->next, after->prev)) return STATUS_FAIL ; tnLink2(pivot, after) ; ptr = after ; } pivot->ival = pivot->fval ? 1 : 0 ; pivot->flags |= TN_ISINT ; } else if (ptr->toktype == TOKEN_CLOSE) break ; else ptr = ptr->next ; } if (ptr->toktype != TOKEN_CLOSE || ptr != end) { mcxErr(me, "ptr does not close") ; dump(ptr->prev, 0, NULL) ; return STATUS_FAIL ; } if (flatten(start, ptr)) return STATUS_FAIL ; return STATUS_OK ; } mcxstatus getatom ( telRaam* raam ) { i32 toktype = gettoken(raam, EXPECT_ATOM) ; const char* me = "getatom" ; if (toktype < 0) { mcxErr(me, "unexpected token <%s>", raam->token->str) ; return STATUS_FAIL ; } ; if (toktype == TOKEN_UNIOP) { if (tnPushToken(raam)) return STATUS_FAIL ; if (getatom(raam)) return STATUS_FAIL ; } else if (toktype == TOKEN_OPEN) { if (getexpression(raam)) return STATUS_FAIL ; if ((toktype = gettoken(raam, EXPECT_ANY)) != TOKEN_CLOSE) { mcxErr(me, "no close (token <%ld>)", (long) toktype) ; return STATUS_FAIL ; } if (raam->depth < 0) { mcxErr(me, "spurious rpth (atom I)") ; return STATUS_FAIL ; } } else if (toktype == TOKEN_FUN) { if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; if ((toktype = gettoken(raam, EXPECT_ANY)) != TOKEN_OPEN) { mcxErr(me, "expect '(' after function symbol") ; return STATUS_FAIL ; } while(1) { if (getexpression(raam)) return STATUS_FAIL ; if (gettoken(raam, EXPECT_ANY) == TOKEN_COMMA) { if (tnPushToken(raam)) return STATUS_FAIL ; } else { untoken(raam) ; break ; } } if ((toktype = gettoken(raam, EXPECT_ANY)) != TOKEN_CLOSE) { mcxErr(me, "expect ')' closing function symbol") ; return STATUS_FAIL ; } if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; } else if (toktype == TOKEN_CONST) { if (tnPushToken(raam)) return STATUS_FAIL ; } else if (toktype == TOKEN_CLOSE) { mcxErr(me, "empty group not allowed") ; return STATUS_FAIL ; } else if (toktype == TOKEN_USER) { if (tnPushToken(raam)) return STATUS_FAIL ; } else { mcxErr(me, "unexpected token <%s> (atom)", raam->token->str) ; return STATUS_FAIL ; } return STATUS_OK ; } mcxstatus getexpression ( telRaam* raam ) { i32 toktype ; const char* me = "getexpression" ; raam->depth++ ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; while (1) { if (getatom(raam)) return STATUS_FAIL ; toktype = gettoken(raam, EXPECT_ANY) ; if (toktype == TOKEN_BINOP) { if (tnPushToken(raam)) return STATUS_FAIL ; } else if (toktype == TOKEN_AND) { if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; } else if (toktype == TOKEN_OR) { if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; } else if (toktype == TOKEN_TRIOP) { if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; if (getexpression(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; toktype = gettoken(raam, EXPECT_ANY) ; if (toktype != TOKEN_TRICATCH) { mcxErr ( me , "unexpected token <%s> (expression)" , raam->token->str ) ; return STATUS_FAIL ; } if (tnPushToken(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; } else if ( toktype == TOKEN_COMMA || toktype == TOKEN_CLOSE || toktype == TOKEN_EXH || toktype == TOKEN_TRICATCH ) { untoken(raam) ; break ; } else { mcxErr ( me , "unexpected token <%s> <%ld> (expression)" , raam->token->str , (long) toktype ) ; return STATUS_FAIL ; } } if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; raam->depth-- ; return STATUS_OK ; } mcxstatus trmParse ( telRaam* raam ) { if (tnPushThis(raam, "_open_", TOKEN_OPEN)) return STATUS_FAIL ; if (getexpression(raam)) return STATUS_FAIL ; if (tnPushThis(raam, "_close_", TOKEN_CLOSE)) return STATUS_FAIL ; if (gettoken(raam, EXPECT_ANY) != TOKEN_EXH) { mcxErr("trmParse", "spurious token <%s>", raam->token->str) ; return STATUS_FAIL ; } return STATUS_OK ; } void trmRegister ( telRaam* raam cpl__unused , int (user_parse)(mcxTing* txt, int offset) , mcxenum (user_eval)(const char* token, long *ival, double *fval) , char user_char ) { user_parse_g = user_parse ; user_eval_g = user_eval ; user_char_g = user_char ; } int trmEval ( telRaam* raam , long* lp , double* fp ) { tn* result ; mcxstatus stat = compute(raam->start->next) ; result = stat ? NULL : (raam->start->next->next) ; if (result) { *lp = result->ival ; *fp = result->fval ; return result->flags ; } return -1 ; } apparix-07-261/util/list.c0000644002600400000120000001105110642147132012254 00000000000000/* (C) Copyright 2004, 2005, 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include "list.h" #include "alloc.h" #include "gralloc.h" #include "compile.h" #define DEBUG 0 /* TODO. very funny interface. in flux. * * ! allow null argument for linkdelete. * * ! * little support for corruption checking. * is the spawn thing a good idea ? * ! * interface with list object, or not? * not requires hidden list pointer everywhere (have that now). * perhaps supply separate interface with list handle .. ?] * ! * how to unify FLink, BLink, and link (forward/backward/bidi) * optify hidden list pointer, next xor prev pointer. * * - Add triple sanity checks for user supplied data (?) * - implement val freeing. * - with deleting, should warn if no handle remains .. * and can check grim count. */ /* Note. * We very much do not want to define (as previously thought) next and prev * as const pointers (with the goal of keeping chain consistency up * to this interface). * This interface provides some convenience interfaces, but * the integrity and life-cycle of the chains built with the links * is entirely up to the caller. So tie-rap away with them links. * * So we do not keep track of list characteristics, * e.g. first, last, count. That would be something for a higher layer. */ typedef struct { mcxGrim* grim ; } mcx_list ; typedef struct lsptr { mcx_list* ls ; } lsptr ; #define mcx_list_find(lk) ((lsptr*)((void*)((char*) lk - sizeof(lsptr))))->ls void mcx_link_init ( mcxLink* lk , void* val ) { lk->next = NULL ; lk->prev = NULL ; lk->val = val ; } mcxLink* mcx_list_shift ( mcx_list* ls , void* val ) { void* mem ; mcxLink* lk ; if (!(mem = mcxGrimGet(ls->grim))) return NULL ; lk = (void*) ((char*) mem + sizeof(lsptr)) ; ((lsptr*) mem)->ls = ls ; mcx_link_init(lk, val) ; return lk ; } mcxLink* mcxListSource ( dim capacity_start , mcxbits options ) { mcx_list* ls ; if (!(ls = mcxAlloc(sizeof(mcx_list), RETURN_ON_FAIL))) return NULL #if DEBUG ; fprintf (stderr, "new list ptr <%p> capacity <%ld>\n", (void*) ls, (long) capacity_start) #endif ; if (! (ls->grim = mcxGrimNew(sizeof(lsptr) + sizeof(mcxLink), capacity_start, options) ) ) return NULL ; return mcx_list_shift(ls, NULL) ; } mcxLink* mcxLinkSpawn ( mcxLink* lk , void* val ) { mcx_list* ls = mcx_list_find(lk) ; return mcx_list_shift(ls, val) ; } void mcxLinkClose ( mcxLink* left , mcxLink* right ) { if (left) left->next = right ; if (right) right->prev = left ; } mcxLink* mcxLinkBefore ( mcxLink* next , void* val ) { mcx_list* ls = mcx_list_find(next) ; mcxLink* new = mcx_list_shift(ls, val) ; if (!new) return NULL ; new->next = next ; new->prev = next->prev ; next->prev = new ; if (new->prev) new->prev->next = new ; return new ; } mcxLink* mcxLinkAfter ( mcxLink* prev , void* val ) { mcx_list* ls = mcx_list_find(prev) ; mcxLink* new #if DEBUG ; fprintf(stderr, "list ptr <%p>\n", (void*) ls) #endif ; new = mcx_list_shift(ls, val) ; if (!new) return NULL ; new->prev = prev ; new->next = prev->next ; prev->next = new ; if (new->next) new->next->prev = new ; return new ; } void mcxLinkRemove ( mcxLink* lk ) { mcx_list* ls = mcx_list_find(lk) ; mcxGrimLet(ls->grim, ((char*) lk) - sizeof(lsptr)) ; } mcxLink* mcxLinkDelete ( mcxLink* lk ) { mcx_list* ls = mcx_list_find(lk) ; mcxLink* prev = lk->prev ; mcxLink* next = lk->next ; if (prev) prev->next = next ; if (next) next->prev = prev ; mcxGrimLet(ls->grim, ((char*) lk) - sizeof(lsptr)) ; return lk ; } mcxGrim* mcxLinkGrim ( mcxLink* lk ) { mcx_list* ls = mcx_list_find(lk) ; return ls->grim ; } void mcxListFree ( mcxLink** lkp , void freeval(void* valpp) cpl__unused /* (yourtype1** valpp) */ ) { if (*lkp) { mcx_list* ls = mcx_list_find(*lkp) ; mcxGrimFree(&(ls->grim)) ; mcxFree(ls) ; *lkp = NULL ; } ; } #undef DEBUG apparix-07-261/util/gralloc.c0000644002600400000120000000776110642147132012741 00000000000000/* (c) Copyright 2004, 2005 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include "alloc.h" #include "gralloc.h" /* TODO * calloc stuff. * implement arithmetic capacity strategy. */ #define DEBUG 0 typedef struct memnext { struct memnext* next ; } memnext ; /* future idea; use higher bita as perbytage style coefficients. duh. */ #define n1(grim) ((grim->flags >> 16) & 0xFF) #define n2(grim) ((grim->flags >> 24) & 0xFF) typedef struct grim_buf { char* units /* n_units * (sizeof(memnext) + sz_unit) */ ; dim n_units /* number of units available for this struct */ ; struct grim_buf* prev ; } grim_buf ; struct mcxGrim { grim_buf* buf ; dim sz_unit /* size of one unit */ ; memnext* na /* next available */ ; dim ct /* number in use */ ; mcxbits flags /* allocation strategy, numbers */ ; } ; grim_buf* grim_buf_new ( dim sz_unit , dim n_units ) { dim i ; grim_buf* buf ; char* units ; dim sz_load = sizeof(memnext) + sz_unit ; if (!(buf = mcxAlloc(sizeof(grim_buf), RETURN_ON_FAIL))) return NULL ; if ( !(buf->units = units = mcxAlloc(n_units * sz_load, RETURN_ON_FAIL) ) ) { mcxFree(buf) ; return NULL ; } buf->prev = NULL ; buf->n_units = n_units #if DEBUG ; fprintf (stderr, "Extending grim with <%lu> units\n", (ulong) n_units); #endif ; for (i=0;inext = (memnext*) (units + (i+1) * sz_load) ; ((memnext*) (buf->units + (n_units-1) * sz_load))->next = NULL ; return buf ; } mcxGrim* mcxGrimNew ( dim sz_unit , dim n_units , mcxbits options ) { mcxGrim* src = mcxAlloc(sizeof(mcxGrim), RETURN_ON_FAIL) ; if (!src) return NULL ; if (!(src->buf = grim_buf_new(sz_unit, n_units))) { mcxFree(src) ; return NULL ; } src->buf->prev = NULL ; src->flags = options ; src->na = (void*) src->buf->units ; src->ct = 0 ; src->sz_unit = sz_unit ; return src ; } dim mcxGrimMemSize ( mcxGrim* src ) { grim_buf *buf = src->buf, *this = buf->prev ; dim n = buf->n_units ; while (this) n += this->n_units , this = this->prev ; return n ; } mcxbool mcx_grim_extend ( mcxGrim* src ) { grim_buf* prevbuf = src->buf->prev ; dim n_units = prevbuf ? 2 * prevbuf->n_units : src->buf->n_units #if DEBUG ; dim t = mcxGrimMemSize(src) ; fprintf(stderr, "have %lu units\n", (ulong) t) #endif ; grim_buf* newbuf = grim_buf_new(src->sz_unit, n_units) ; if (!newbuf) return FALSE ; newbuf->prev = src->buf->prev ; src->buf->prev = newbuf ; src->na = (void*) newbuf->units /* fixme cast */ ; return TRUE ; } void mcxGrimFree ( mcxGrim** srcp ) { grim_buf *this = (*srcp)->buf ; while (this) { grim_buf* tmp = this->prev ; mcxFree(this->units) ; mcxFree(this) ; this = tmp ; } mcxFree(*srcp) ; *srcp = NULL ; } void mcxGrimLet ( mcxGrim* src , void* mem ) { memnext* na = (void*) ((char*) mem - sizeof(memnext)) ; na->next = src->na ; src->na = na ; src->ct-- ; } void* mcxGrimGet ( mcxGrim* src ) { void* mem ; if (!src->na && !mcx_grim_extend(src)) return NULL ; mem = ((char*) src->na) + sizeof(memnext) ; src->na = src->na->next ; src->ct++ ; return mem ; } dim mcxGrimCount ( mcxGrim* src ) { return src->ct ; } #undef DEBUG apparix-07-261/util/tok.c0000644002600400000120000001517210642147132012106 00000000000000/* (C) Copyright 2005, 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO allow empty args () */ #include #include #include #include "tok.h" #include "types.h" #include "ting.h" #include "ding.h" #include "err.h" #include "alloc.h" #include "compile.h" #ifndef DEBUG # define DEBUG 0 #else # define DEBUG_DEFINED #endif char* mcxTokSkip ( const char* offset , int (*fbool)(int c) , ofs len ) { return mcxStrChrAint(offset, fbool, len) ; } /* * Accounts for nesting. * Will do '}', ')', ']', '>', assuming one of several conventions. */ mcxstatus mcxTokMatch ( const char* str_search , char** endptr , mcxbits mode , ofs len /* considered if >= 0 */ ) { const char* offset= str_search ; unsigned char c = *offset ; mcxstatus status = STATUS_OK ; mcxTing* stack ; const char* z ; *endptr = NULL ; if (len < 0) len = strlen(offset) ; z = offset + len ; switch(c) { case '{' : case '(' : case '[' : break ; default : mcxErr("mcxTokMatch", "not my coal of char <%c>", (int) c) ; return STATUS_FAIL ; } if (!(stack = mcxTingEmpty(NULL, 80))) return STATUS_FAIL ; do { unsigned char m = '\0' ; c = *offset ; switch(c) { case '{' : case '(' : case '[' : status = mcxTingTackc(stack, c) ; break ; case ')' : m = '(' ; break ; case '}' : m = '{' ; break ; case ']' : m = '[' ; break ; } if (m) status = mcxTingTickc(stack, m) ; if (status) break ; if (!stack->len) break ; offset++ ; } while (offset < z) ; if (stack->len) status = STATUS_FAIL ; else if (!status) *endptr = (char* )offset ; if (status) mcxErr ( "mcxTokMatch" , "stacklen <%lu>, offset <%ld>, char <%c>" , (ulong) stack->len , (long) (offset - str_search) , (int) *offset ) ; mcxTingFree(&stack) ; return status ; } mcxstatus mcxTokFind ( const char* offset , char* tok /* Only tok[0] considered for now! */ , char** pos , mcxbits mode cpl__unused , ofs len /* considered if >= 0 */ ) { mcxstatus status = STATUS_OK ; const char* x = offset, *z ; char *y = NULL ; if (len < 0) len = strlen(offset) ; z = offset + len ; *pos = NULL ; while (x < z) { if (*x == tok[0]) break ; switch(*x) { case '(' : case '{' : case '[' : if (!(status = mcxTokMatch(x, &y, 0, z-x))) x = y+1 ; break ; default : x++ ; break ; } if (status) break ; } if (!status) { *pos = (char*) x ; return *x == tok[0] ? STATUS_OK : STATUS_DONE ; } return STATUS_FAIL ; } void mcxTokFuncFree ( mcxTokFunc* tf ) { mcxTingFree(&(tf->key)) ; mcxListFree(&(tf->args), mcxTingFree_v) ; } mcxstatus mcxTokExpectFunc ( mcxTokFunc* tf , const char* str , dim str_len , char** z_pp , int n_min , int n_max , int *n_args ) { const char *z = str + str_len ; char *x = mcxTokSkip(str, isspace, str_len) /* signed issue */ ; char *y ; const char* me = "mcxTokExpectFunc" ; mcxTing* key = mcxTingEmpty(NULL, 20) ; mcxTing* args = mcxTingEmpty(NULL, 40) ; mcxstatus status = STATUS_FAIL ; mcxLink* src = NULL ; int ct = 0 ; *z_pp = NULL ; tf->key = NULL ; tf->args = NULL ; if (n_args) *n_args = 0 ; while (1) { if (!x) { mcxErr(me, "no identifier at EOS") ; break ; } y = mcxStrChrAint(x, isalpha, z-x) ; if (y==x) { mcxErr(me, "expect identifier: <%s>", x) ; break ; } if (!y) { mcxErr(me, "lost identifier: <%s>", x) ; break ; } mcxTingNWrite(key, x, y-x) ; x = mcxTokSkip(y, isspace, z-y) ; if (!x || *x != '(') { mcxErr(me, "expect parenthesis: <%s>", x ? x : "EOS") ; break ; } if (mcxTokMatch(x, &y, 0, z-x)) { mcxErr(me, "error parsing <%s>", x) ; break ; } mcxTingNWrite(args, x+1, y-x-1) ; if (!(src = mcxTokArgs(args->str, args->len, &ct, tf->opts))) break ; if ( ( n_min >= 0 && ct < n_min ) || ( n_max >= 0 && ct > n_max ) ) { mcxErr ( me , "for key <%s>, arg count %d conflicts min/max %d/%d" , key->str , ct, n_min, n_max ) ; break ; } *z_pp = y+1 ; status = STATUS_OK ; break ; } mcxTingFree(&args) ; if (status) { mcxTingFree(&key) ; mcxListFree(&src, mcxTingFree_v) ; } else { tf->key = key ; tf->args = src ; if (n_args) *n_args = ct ; } return status ; } mcxLink* mcxTokArgs ( const char* str , long str_len , int* n_args , mcxbits opts ) { mcxLink* src = mcxListSource(8, MCX_GRIM_ARITHMETIC) ; mcxLink* lk = src ; const char* x = str ; char* y = NULL ; const char* z = str + str_len ; mcxTing* arg = NULL ; int ct = 0 ; mcxstatus status = STATUS_FAIL ; while ((status = mcxTokFind(x, ",", &y, 0, z-x)) == STATUS_OK || y) { const char* l = x, *r = y ; if (opts & MCX_TOK_DEL_WS) { l = mcxStrChrAint(x, isspace, y-x) ; r = mcxStrRChrAint(x, isspace, y-x) ; if (l && r && l<=r) r++ ; else r = l = x ; } arg = mcxTingNNew(l, r-l) #if DEBUG ;fprintf(stderr, "adding <%s> [%d/ /%s]\n", arg->str, status, y) #endif ; lk = mcxLinkAfter(lk, arg) ; x = y+1 ; ct++ ; if (status) break ; } if (!y) { mcxErr("mcxTokArgs", "error occurred") ; mcxListFree(&src, mcxTingFree_v) ; return NULL ; } *n_args = ct ; return src ; } #ifndef DEBUG_DEFINED # undef DEBUG #else # undef DEBUG_DEFINED #endif apparix-07-261/util/ting.c0000664002600400000120000004466010673276160012270 00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include "ting.h" #include "ding.h" #include "minmax.h" #include "alloc.h" #include "array.h" #include "hash.h" #include "types.h" #include "err.h" #include "tr.h" void mcxTingRelease ( void* tingv ) { if (tingv && ((mcxTing*)tingv)->str) mcxFree(((mcxTing*)tingv)->str) ; } void mcxTingFree ( mcxTing **tingpp ) { mcxTing* ting = *tingpp ; if (ting) { if (ting->str) mcxFree(ting->str) ; mcxFree(ting) ; *tingpp = NULL ; } } void mcxTingFree_v ( void *tingpp ) { mcxTingFree((mcxTing**) tingpp) ; } #if 0 void mcxTingAbandon ( void *tingpp ) { mcxTing* ting = *((mcxTing**) tingpp) ; mcxFree(ting) ; } #endif mcxTing* mcxTingShrink ( mcxTing* ting , ofs offset ) { if (offset < 0) offset = ting->len + offset /* fixme conversion? */ ; if (offset < 0 || (dim) offset > ting->len) { mcxErr ( "mcxTingShrink" , "funny offset <%lu> newlen <%ld> combo" , (ulong) ting->len , (long) offset ) ; return ting ; } else { *(ting->str+offset) = '\0' ; ting->len = offset; ; } return ting ; } mcxTing* mcxTingEnsure ( mcxTing* ting , dim len ) { if (!ting && !(ting = (mcxTing*) mcxTingInit(NULL))) return NULL ; if (len <= ting->mxl) ; else { char* t = mcxRealloc(ting->str, len+1, RETURN_ON_FAIL) ; if (!t) return NULL ; ting->str = t ; ting->mxl = len ; if (1) *(ting->str+ting->mxl) = '\0' /* there should be no need to do this; * and for large allocations this may fail. */ ; } return ting ; } static mcxTing* mcx_ting_print ( mcxTing* dst , const char* fmt , va_list *args ) #define PRINT_BUF_SIZE 200 { char buf[PRINT_BUF_SIZE], *src ; mcxTing* txtbuf = NULL ; dim m = PRINT_BUF_SIZE ; int npf ; npf = vsnprintf(buf, PRINT_BUF_SIZE, fmt, *args) /* from reading standards it seems that npf >= PRINT_BUF_SIZE * should be sufficient. However, alpha OSF1 provides * a counterexample. And from reading standard annotations * it also seems that vsnprintf is widely ill-implemented */ ; if (npf < 0 || npf+1 >= PRINT_BUF_SIZE) { m = ((dim) npf) >= PRINT_BUF_SIZE ? ((dim) npf) : 2 * m ; while (1) { if (!(txtbuf = mcxTingEmpty(txtbuf, m))) { mcxTingFree(&txtbuf) ; return NULL ; } npf = vsnprintf(txtbuf->str, m+1, fmt, *args) ; if (npf < 0 || (dim) (npf+1) > m) m *= 2 ; else break ; } src = txtbuf->str ; } else src = buf ; dst = mcxTingWrite(dst, src) ; mcxTingFree(&txtbuf) ; return dst #undef PRINT_BUF_SIZE ; } mcxTing* mcxTingPrintSplice ( mcxTing* dst , ofs offset , ofs delete , const char* fmt , ... ) { va_list args ; mcxTing *infix = NULL ; va_start(args, fmt) ; infix = mcx_ting_print(NULL, fmt, &args) ; va_end(args) ; if (!infix) return NULL ; if (!dst) return infix ; if ( mcxTingSplice(dst, infix->str, offset, delete, infix->len) != STATUS_OK ) { mcxTingFree(&infix) ; return NULL ; } mcxTingFree(&infix) ; return dst ; } mcxTing* mcxTingPrint ( mcxTing* dst , const char* fmt , ... ) { va_list args ; va_start(args, fmt) ; dst = mcx_ting_print(dst, fmt, &args) ; va_end(args) ; return dst ; } mcxTing* mcxTingPrintAfter ( mcxTing* dst , const char* fmt , ... ) { va_list args ; mcxTing *affix = NULL ; va_start(args, fmt) ; affix = mcx_ting_print(affix, fmt, &args) ; va_end(args) ; if (!dst) return affix ; if (!affix) /* presumably malloc failure */ return NULL ; if (!mcxTingAppend(dst, affix->str)) { mcxTingFree(&affix) ; return NULL ; } mcxTingFree(&affix) ; return dst ; } static const char* roman[40] = { "" , "i" , "ii", "iii", "iv" , "v" , "vi", "vii", "viii", "ix" , "" , "x" , "xx", "xxx", "xl" , "l" , "lx", "lxx", "lxxx", "xc" , "" , "c" , "cc", "ccc", "cd" , "d" , "dc", "dcc", "dccc", "cm" , "" , "m" , "mm", "mmm", "mmmm", "" , "" , "", "", "" } ; mcxTing* mcxTingRoman ( mcxTing* dst , long a , mcxbool ucase ) { long i, x, c, m ; char* p ; if (a >= 5000 || a <= 0) return mcxTingWrite(dst, "-") ; i = a % 10 ; a /= 10 ; x = a % 10 ; a /= 10 ; c = a % 10 ; a /= 10 ; m = a ; dst = mcxTingPrint ( dst , "%s%s%s%s" , roman[30+m] , roman[20+c] , roman[10+x] , roman[ 0+i] ) ; if (dst && ucase) for (p=dst->str;pstr+dst->len;p++) *p += 'A' - 'a' ; return dst ; } mcxTing* mcxTingDouble ( mcxTing* dst , double x , int decimals ) { char num[500] ; char* p ; int len = snprintf(num, 500, "%.*f", decimals, x) ; if (decimals < 0) { mcxErr("mcxTingDouble PBD", "negative decimals arg") ; decimals = 6 ; } if (len < 0 || len >= 500) return mcxTingWrite(dst, "[]") ; p = num+len-1 /* GNU libcx bug workaround */ /* it returns 2 for length of 'inf' */ ; if (decimals && strcmp(num, "inf")) { while (*p == '0') p-- ; if (*p == '.') *++p = '0' ; *++p = '\0' ; } return mcxTingWrite(dst, num) ; } mcxTing* mcxTingInteger ( mcxTing* dst , long x ) { char num[128] ; int len = snprintf(num, 128, "%ld", x) ; if (len < 0 || len >= 128) return mcxTingWrite(dst, "[]") ; return mcxTingWrite(dst, num) ; } void* mcxTingInit ( void * tingv ) { mcxTing *ting = tingv ; if (!ting) { if (!(ting = mcxAlloc(sizeof(mcxTing), RETURN_ON_FAIL))) return NULL ; } if (!(ting->str = (char*) mcxAlloc(sizeof(char), RETURN_ON_FAIL))) return NULL ; *(ting->str+0) = '\0' ; ting->len = 0 ; ting->mxl = 0 ; return ting ; } /* * Take string into an existing ting or into a new ting */ mcxTing* mcxTingInstantiate ( mcxTing* ting , const char* string ) /* strnotice strlen */ { dim length = string ? strlen(string) : 0 /* ensure handles ting==NULL and/or length==0 cases */ ; if (!(ting = mcxTingEnsure(ting, length))) return NULL /* strnotice strncpy */ ; if (string) { strncpy(ting->str, string, length) ; *(ting->str+length) = '\0' ; } ting->len = length ; return ting ; } int mcxTingRevCmp ( const void* t1 , const void* t2 ) { return (strcmp(((mcxTing*)t2)->str, ((mcxTing*)t1)->str)) ; } int mcxTingCmp ( const void* t1 , const void* t2 ) { return (strcmp(((mcxTing*)t1)->str, ((mcxTing*)t2)->str)) ; } int mcxTingPCmp ( const void* t1 , const void* t2 ) { return (strcmp(((mcxTing**)t1)[0]->str, ((mcxTing**)t2)[0]->str)) ; } int mcxTingPRevCmp ( const void* t1 , const void* t2 ) { return (strcmp(((mcxTing**)t2)[0]->str, ((mcxTing**)t1)[0]->str)) ; } int mcxPKeyTingCmp ( const void* k1 , const void* k2 ) { return strcmp ( ((mcxTing*) ((mcxKV**)k1)[0]->key)->str , ((mcxTing*) ((mcxKV**)k2)[0]->key)->str ) ; } int mcxPKeyTingRevCmp ( const void* k1 , const void* k2 ) { return strcmp ( ((mcxTing*) ((mcxKV**)k2)[0]->key)->str , ((mcxTing*) ((mcxKV**)k1)[0]->key)->str ) ; } mcxstatus mcxTingSplice ( mcxTing* ting , const char* pstr , ofs offset , ofs n_delete , dim n_copy ) { dim newlen ; if (!ting) { mcxErr("mcxTingSplice PBD", "void ting argument") ; return STATUS_FAIL ; } /* offset -1 denotes appending at the end, * offset -2 denotes inserting at the last-but-one position. * etc */ if (offset < 0) { if ((dim) -offset > ting->len + 1) offset = 0 ; else offset = ting->len + offset + 1 ; } else if ((dim) offset > ting->len) offset = ting->len ; if (n_delete == TING_INS_CENTER) { n_delete = MIN(ting->len, n_copy) ; offset = (ting->len - n_delete) / 2 /* n_delete <= ting->len */ ; } else if (n_delete == TING_INS_OVERWRITE) n_delete = MIN(ting->len - offset, n_copy) /* offset <= ting->len */ ; else if (n_delete == TING_INS_OVERRUN || n_delete < 0) n_delete = ting->len - offset /* offset <= ting->len */ ; else if (n_delete < 0) { mcxErr ( "mcxTingSplice PBD" , "unsupported delete mode %ld" , (long) n_delete ) ; return STATUS_FAIL ; } else if ((dim) (offset + n_delete) > ting->len) n_delete = ting->len - offset ; if (ting->len + n_copy < (dim) n_delete) /* now spurious? */ { mcxErr("mcxTingSplice PBD", "arguments result in negative length") ; return STATUS_FAIL ; } /* * essential: mcxSplice does not know to allocate room for '\0' */ newlen = ting->len - n_delete + n_copy ; if (!mcxTingEnsure(ting, newlen)) return STATUS_FAIL ; if ( mcxSplice ( &(ting->str) , pstr , sizeof(char) , &(ting->len) , &(ting->mxl) , offset , (dim) n_delete , n_copy ) != STATUS_OK ) return STATUS_FAIL /* * essential: mcxSplice might have realloced, so has to be done afterwards. */ ; *(ting->str+newlen) = '\0' ; if (ting->len != newlen) { mcxErr("mcxTingSplice panic", "mcxSplice gives unexpected result") ; return STATUS_FAIL ; } return STATUS_OK ; } mcxTing* mcxTingNew ( const char* str ) { return mcxTingInstantiate(NULL, str) ; } mcxTing* mcxTingNNew ( const char* str , dim sz ) { mcxTing* ting = mcxTingEnsure(NULL, sz) ; if (!ting) return NULL /* strnotice memcpy */ ; if (str && sz) memcpy(ting->str, str, sz) ; *(ting->str+sz) = '\0' ; ting->len = sz ; return ting ; } mcxTing* mcxTingEmpty ( mcxTing* ting , dim len ) { if (!(ting = mcxTingEnsure(ting, len))) return NULL ; *(ting->str+0) = '\0' , ting->len = 0 ; return ting ; } mcxTing* mcxTingWrite ( mcxTing* ting , const char* str ) { return mcxTingInstantiate(ting, str) ; } mcxTing* mcxTingNWrite ( mcxTing* ting , const char* str , dim sz ) { if (!(ting = mcxTingEnsure(ting, sz))) return NULL /* strnotice strncpy */ ; memcpy(ting->str, str, sz) ; *(ting->str+sz) = '\0' ; ting->len = sz ; return ting ; } char* mcxTingSubStr ( const mcxTing* ting , ofs offset , ofs length ) { char* str ; if (offset < 0 || (dim) offset > ting->len) offset = ting->len ; if (length < 0 || (dim) (offset+length) > ting->len) length = ting->len - offset ; if (!(str = mcxAlloc((dim) (length+1), RETURN_ON_FAIL))) return NULL ; if (length) memcpy(str, ting->str+offset, (dim) length) ; *(str+length) = '\0' ; return str ; } mcxTing* mcxTingify ( char* str ) { mcxTing* ting = mcxAlloc(sizeof(mcxTing), RETURN_ON_FAIL) ; ting->str = str /* strnotice strlen; ? tingify2 */ ; ting->len = strlen(str) ; return ting ; } char* mcxTinguish ( mcxTing* ting ) { char* str = ting->str ; mcxFree(ting) ; return str ; } char* mcxTingStr ( const mcxTing* ting ) { ofs slen = ting->len ; return mcxTingSubStr(ting, 0, slen) ; } mcxTing* mcxTingAppend ( mcxTing* ting , const char* str ) { if (!ting) return mcxTingNew(str) /* strnotice strlen */ ; if ( mcxTingSplice ( ting , str , -1 /* splice offset */ , 0 /* delete nothing */ , str? strlen(str) : 0 /* string length */ ) != STATUS_OK ) return NULL ; return ting ; } mcxTing* mcxTingKAppend ( mcxTing* ting , const char* str , dim sz ) { dim len = strlen(str) ; if (!ting && !sz) return mcxTingEmpty(NULL, 0) ; if (!sz) return ting ; while (sz-- > 0) /* careful with unsignedness */ if (!(ting = mcxTingNAppend(ting, str, len))) return NULL ; return ting ; } mcxTing* mcxTingNAppend ( mcxTing* ting , const char* str , dim sz ) { if (!ting) return mcxTingNWrite(NULL, str, sz) ; if ( mcxTingSplice ( ting , str , -1 /* splice offset */ , 0 /* delete nothing */ , sz ) != STATUS_OK ) return NULL ; return ting ; } mcxTing* mcxTingInsert ( mcxTing* ting , const char* str , ofs offset ) { if (!ting) return mcxTingNew(str) /* strnotice strlen */ ; if ( mcxTingSplice ( ting , str , offset /* splice offset */ , 0 /* delete nothing */ , str ? strlen(str) : 0 /* string length */ ) != STATUS_OK ) return NULL ; return ting ; } mcxTing* mcxTingNInsert ( mcxTing* ting , const char* str , ofs offset , dim length ) { if (!ting) return mcxTingNWrite(NULL, str, length) ; if ( mcxTingSplice ( ting , str , offset /* splice offset */ , 0 /* delete nothing */ , length /* length of str */ ) != STATUS_OK ) return NULL ; return ting ; } mcxTing* mcxTingDelete ( mcxTing* ting , ofs offset , dim width ) { ofs swidth = width ; if (!ting) return NULL ; if ( mcxTingSplice ( ting , NULL , offset /* splice offset */ , swidth /* delete width */ , 0 /* string length */ ) != STATUS_OK ) return NULL ; return ting ; } u32 mcxTingDJBhash ( const void* ting ) { return(mcxBJhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingBDBhash ( const void* ting ) { return(mcxBDBhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingBJhash ( const void* ting ) { return(mcxBJhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingCThash ( const void* ting ) { return(mcxCThash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingDPhash ( const void* ting ) { return(mcxDPhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingGEhash ( const void* ting ) { return(mcxGEhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingOAThash ( const void* ting ) { return(mcxOAThash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingELFhash ( const void* ting ) { return(mcxELFhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingFNVhash ( const void* ting ) { return(mcxFNVhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 (*mcxTingHFieByName(const char* id))(const void* ting) { if (!strcmp(id, "dp")) return mcxTingDPhash ; else if (!strcmp(id, "bj")) return mcxTingBJhash ; else if (!strcmp(id, "elf")) return mcxTingELFhash ; else if (!strcmp(id, "djb")) return mcxTingDJBhash ; else if (!strcmp(id, "bdb")) return mcxTingBDBhash ; else if (!strcmp(id, "ge")) return mcxTingGEhash ; else if (!strcmp(id, "oat")) return mcxTingOAThash ; else if (!strcmp(id, "svd")) return mcxTingSvDhash ; else if (!strcmp(id, "svd2")) return mcxTingSvD2hash ; else if (!strcmp(id, "svd1")) return mcxTingSvD1hash ; else if (!strcmp(id, "ct")) return mcxTingCThash ; else if (!strcmp(id, "fnv")) return mcxTingFNVhash ; else return NULL ; } u32 mcxTingSvDhash ( const void* ting ) { return(mcxSvDhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingSvD2hash ( const void* ting ) { return(mcxSvD2hash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingSvD1hash ( const void* ting ) { return(mcxSvD1hash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } u32 mcxTingHash ( const void* ting ) { return(mcxDPhash(((mcxTing*) ting)->str, ((mcxTing*) ting)->len)) ; } /* Fails only for memory reason */ mcxstatus mcxTingTackc ( mcxTing* ting , unsigned char c ) { if (!ting || !mcxTingEnsure(ting, ting->len+1)) return STATUS_FAIL ; ting->str[ting->len] = c ; ting->str[ting->len+1] = '\0' ; ting->len += 1 ; return STATUS_OK ; } /* Fails if last char is not the same as c */ mcxstatus mcxTingTickc ( mcxTing* ting , unsigned char c ) { if (!ting || !ting->len) return STATUS_FAIL ; if ((unsigned char) ting->str[ting->len-1] == c) { mcxTingShrink(ting, -1) ; return STATUS_OK ; } return STATUS_FAIL ; } apparix-07-261/util/ding.c0000644002600400000120000002127110673276170012240 00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #include #include #include #include #include "ding.h" #include "types.h" #include "alloc.h" #include "minmax.h" char* mcxStrDup ( const char* str ) { return mcxStrNDup(str, strlen(str)) ; } char* mcxStrNDup ( const char* str , dim n ) { char* rts = mcxAlloc(n+1, RETURN_ON_FAIL) ; if (rts) memcpy(rts, str, n) , rts[n] = '\0' ; return rts ; } dim mcxStrCountChar ( const char* p , char c , ofs len ) { const char* z = p ; dim ct = 0 ; z += (len >= 0) ? len : strlen(p) ; while (p= 0 ? p+offset : p + strlen(p) ; while (--z >= p && !fbool((unsigned char) *z)) ; return (char*) (z >= p ? z : NULL) ; } char* mcxStrRChrAint ( const char* p , int (*fbool)(int c) , ofs offset ) { const char* z = offset >= 0 ? p+offset : p + strlen(p) ; while (--z >= p && fbool((unsigned char) *z)) ; return (char*) (z >= p ? z : NULL) ; } const char* bit8[256] = { "00000000" , "00000001" , "00000010" , "00000011" , "00000100" , "00000101" , "00000110" , "00000111" , "00001000" , "00001001" , "00001010" , "00001011" , "00001100" , "00001101" , "00001110" , "00001111" , "00010000" , "00010001" , "00010010" , "00010011" , "00010100" , "00010101" , "00010110" , "00010111" , "00011000" , "00011001" , "00011010" , "00011011" , "00011100" , "00011101" , "00011110" , "00011111" , "00100000" , "00100001" , "00100010" , "00100011" , "00100100" , "00100101" , "00100110" , "00100111" , "00101000" , "00101001" , "00101010" , "00101011" , "00101100" , "00101101" , "00101110" , "00101111" , "00110000" , "00110001" , "00110010" , "00110011" , "00110100" , "00110101" , "00110110" , "00110111" , "00111000" , "00111001" , "00111010" , "00111011" , "00111100" , "00111101" , "00111110" , "00111111" , "01000000" , "01000001" , "01000010" , "01000011" , "01000100" , "01000101" , "01000110" , "01000111" , "01001000" , "01001001" , "01001010" , "01001011" , "01001100" , "01001101" , "01001110" , "01001111" , "01010000" , "01010001" , "01010010" , "01010011" , "01010100" , "01010101" , "01010110" , "01010111" , "01011000" , "01011001" , "01011010" , "01011011" , "01011100" , "01011101" , "01011110" , "01011111" , "01100000" , "01100001" , "01100010" , "01100011" , "01100100" , "01100101" , "01100110" , "01100111" , "01101000" , "01101001" , "01101010" , "01101011" , "01101100" , "01101101" , "01101110" , "01101111" , "01110000" , "01110001" , "01110010" , "01110011" , "01110100" , "01110101" , "01110110" , "01110111" , "01111000" , "01111001" , "01111010" , "01111011" , "01111100" , "01111101" , "01111110" , "01111111" , "10000000" , "10000001" , "10000010" , "10000011" , "10000100" , "10000101" , "10000110" , "10000111" , "10001000" , "10001001" , "10001010" , "10001011" , "10001100" , "10001101" , "10001110" , "10001111" , "10010000" , "10010001" , "10010010" , "10010011" , "10010100" , "10010101" , "10010110" , "10010111" , "10011000" , "10011001" , "10011010" , "10011011" , "10011100" , "10011101" , "10011110" , "10011111" , "10100000" , "10100001" , "10100010" , "10100011" , "10100100" , "10100101" , "10100110" , "10100111" , "10101000" , "10101001" , "10101010" , "10101011" , "10101100" , "10101101" , "10101110" , "10101111" , "10110000" , "10110001" , "10110010" , "10110011" , "10110100" , "10110101" , "10110110" , "10110111" , "10111000" , "10111001" , "10111010" , "10111011" , "10111100" , "10111101" , "10111110" , "10111111" , "11000000" , "11000001" , "11000010" , "11000011" , "11000100" , "11000101" , "11000110" , "11000111" , "11001000" , "11001001" , "11001010" , "11001011" , "11001100" , "11001101" , "11001110" , "11001111" , "11010000" , "11010001" , "11010010" , "11010011" , "11010100" , "11010101" , "11010110" , "11010111" , "11011000" , "11011001" , "11011010" , "11011011" , "11011100" , "11011101" , "11011110" , "11011111" , "11100000" , "11100001" , "11100010" , "11100011" , "11100100" , "11100101" , "11100110" , "11100111" , "11101000" , "11101001" , "11101010" , "11101011" , "11101100" , "11101101" , "11101110" , "11101111" , "11110000" , "11110001" , "11110010" , "11110011" , "11110100" , "11110101" , "11110110" , "11110111" , "11111000" , "11111001" , "11111010" , "11111011" , "11111100" , "11111101" , "11111110" , "11111111" } ; mcxTing* mcxMemPrint ( mcxTing* ting , void* p , dim n_bytes , mcxbits flags ) { char* m = p ; mcxbool space = !(flags & MCX_MEMPRINT_NOSPACE) ; mcxbool rev = flags & MCX_MEMPRINT_REVERSE ; dim i ; ting = mcxTingEmpty(ting, 32) ; for (i=0;i best) best = TBL(i+1,j+1) ; } *lcs = best ; } free(tbl) ; return min_val ; } int mcxSetenv ( const char* kv ) { mcxTing* tv = mcxTingNew(kv) ; if (!strchr(kv, '=')) mcxTingAppend(tv, "=1") ; return putenv(mcxTinguish(tv)) ; } apparix-07-261/util/tr.c0000644002600400000120000005640410642147132011741 00000000000000/* (C) Copyright 2005, 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO * - xtr_get_token does not check repeat pointer. crashable? * - something that translates \012 to the byte value. * - write regression test. * - More error codes * - Have a magic repeat operator that does not stop on boundaries. * - Do sane things to implicit \0 (e.g. as result of complement) and * characters outside ascii range. * - [*a*256] leads to count 0. * # tr a-z A-C[*#*]X-Z will not (now nor ever) lookahead * - what about alpha tr(1) capabilities? * 6. In the POSIX locale, to translate all ASCII characters that are not * specified, enter: * tr -c '[ -~]' '[A-_]' newfile */ /* NOTE - only room for 256 classes including sentinels C_CLASSSTART C_CLASSEND - during tlt phase delete and squash bits are ignored and not respected */ /* randomly located documentation of intermediate and final tbl formats * * css class start sentinel * ces class end sentinel * rps repeat sentinel * rss range start sentinel * res range end sentinel * * Class: * css | class , i1, i2, i3, .. , ces | class * where i1 etc are to be mapped * * Repeat: * rss | value, count * * Range * rss | _ , i, i+1, i+2, i+3, .. , res | _ * * Final tbl format: value stored in lower 8 bits. * Higher bits may contain MCX_TR_TRANSLATE, MCX_TR_DELETE MCX_TR_SQUASH */ #include #include #include #include #include "tr.h" #include "ting.h" #include "types.h" #include "ding.h" #include "err.h" const char* X_REPEAT_UNEXPECTED = "repeat unexpected"; const char* X_REPEAT_SYNTAX = "repeat syntax"; const char* X_CLASS_UNKNOWN = "class unknown"; const char* X_CLASS_UNEXPECTED = "class unexpected"; const char* X_OCTAL_RANGE = "octal range"; const char* X_OCTAL_SYNTAX = "octal syntax"; const char* X_HEX_RANGE = "hex range"; const char* X_HEX_SYNTAX = "hex syntax"; const char* X_RANGE_INVERTED = "inverted range"; const char* mcx_tr_err = NULL; mcxbool mcx_tr_debug = FALSE; #define MAX_SPEC_INDEX 511 #define error_break break #define UC(c) ((unsigned char) *(c)) static const char* us = "tr"; enum { C_CLASSSTART = 1u , C_ALNUM , C_ALPHA , C_CNTRL , C_DIGIT , C_GRAPH , C_LOWER , C_PRINT , C_PUNCT , C_SPACE , C_UPPER , C_XDIGIT , C_CLASSEND /* 13 */ , C_RANGESTART , C_RANGEEND , C_REPEAT /* next token encodes repeat (stops on boundary)*/ , C_FLOOD /* next token encodeѕ flood (floods all) */ , C_EOF } ; #define ISCLASS(cl) ((cl) > C_CLASSSTART && (cl) < C_CLASSEND) #define ISREPEAT(cl) ((cl) == C_REPEAT || (cl) == C_FLOOD) #define ISUCHARRANGE(i) \ ( (i) >= 0 && (i) < 256 ) #define ISBOUNDARY(cl) \ ( (cl) == C_CLASSSTART || (cl) == C_CLASSEND \ || (cl) == C_RANGESTART || (cl) == C_RANGEEND ) #define ISSTART(cl) \ ( (cl) == C_CLASSSTART || (cl) == C_RANGESTART ) #define ISEND(cl) \ ( (cl) == C_CLASSEND || (cl) == C_RANGEEND ) #define ISUPPERSTART(tok) \ ( tok == ((C_CLASSSTART << 8) | C_UPPER) ) #define ISLOWERSTART(tok) \ ( tok == ((C_CLASSSTART << 8) | C_LOWER) ) int (*isit[13])(int c) = { NULL /* so C_CLASSVAL - C_CLASSSTART gives an index */ , isalnum , isalpha , iscntrl , isdigit , isgraph , islower , isprint , ispunct , isspace , isupper , isxdigit } ; mcxTing* mcxTRsplash ( mcxTR* tr , mcxbits bits ) { int i,j ; u32* tbl = tr->tlt ; mcxTing* splash = mcxTingEmpty(NULL, 256) ; for (i=1,j=0;i<256;i++) /* NOTE: \000 excluded */ { u32 tok = tbl[i] ; u32 meta = tok >> 8 ; if ( ((bits & MCX_TR_SOURCE) && (meta & MCX_TR_TRANSLATE)) || ((bits & MCX_TR_SOURCE_C) && ! (meta & MCX_TR_TRANSLATE)) || ((bits & MCX_TR_SQUASH) && (meta & MCX_TR_SQUASH)) || ((bits & MCX_TR_SQUASH_C) && ! (meta & MCX_TR_SQUASH)) || ((bits & MCX_TR_DELETE) && (meta & MCX_TR_DELETE)) || ((bits & MCX_TR_DELETE_C) && ! (meta & MCX_TR_DELETE)) ) splash->str[j++] = i ; } splash->str[j] = '\0' ; return splash ; } ofs mcxTRtranslate ( char* src , mcxTR* tr ) { dim i,j ; int prev = INT_MAX /* only relevant for squash case */ ; dim len = strlen(src) ; u32* tbl = tr->tlt ; for (i=0,j=0;i> 8) & MCX_TR_TRANSLATE ? idxmap : idx ; if ((tbl[val] >> 8) & MCX_TR_DELETE) continue ; if (!((tbl[val] >> 8) & MCX_TR_SQUASH) || val != prev) { *(src+j++) = (char) val ; prev = val ; } } *(src+j) = '\0' ; return (ofs) j ; } ofs mcxTingTranslate ( mcxTing* src , mcxTR* tr ) { src->len = mcxTRtranslate(src->str, tr) ; return src->len ; } /* fixme conceivably mcxTRtranslate could return -1 as * error condition. hum ho. */ ofs mcxTingTr ( mcxTing* txt , const char* src , const char* dst , const char* set_delete , const char* set_squash , mcxbits modes ) { mcxTR tr ; if (mcxTRloadTable(&tr, src, dst, set_delete, set_squash, modes)) return -1 ; txt->len = mcxTRtranslate(txt->str, &tr) ; return txt->len ; } static const char* xtr_get_token ( const char *p , const char *z , u8* classp , u8* valuep , int *repeat ) #define MCX_HEX(c) ( (c>='0' && c<='9') ? c-'0'\ : (c>='a' && c<='f') ? c-'a'+10\ : (c>='A' && c<='F') ? c-'A'+10\ : 0\ ) { int c = UC(p), d = 0, np = 0 ; mcxstatus status = STATUS_FAIL ; i32 value = 0, class = 0 /* need to be able to check overflow */ ; const char* me = "xtr_" "get_token" ; mcxbool class_ok = classp ? TRUE : FALSE ; if (classp) *classp = 0 ; if (valuep) *valuep = 0 ; if (repeat) *repeat = -1 ; while (1) { if (p >= z) break /*************************************************************************/ ; if (c == '\\') { if (p+1 >= z) error_break ; d = UC(p+1) ; if (strchr("0123", d)) { if ( p+3 >=z || !isdigit(UC(p+2)) || !isdigit(UC(p+3)) /* fixme 009 */ ) { mcx_tr_err = X_OCTAL_SYNTAX ; error_break ; } value = 64*(d-'0') + 8*(UC(p+2)-'0') + (UC(p+3)-'0') ; if (value > 0377) { mcx_tr_err = X_OCTAL_RANGE ; error_break ; } np = 4 ; } else if (d == 'x') { if ( p+3 >= z || !isxdigit(UC(p+2)) || !isxdigit(UC(p+3)) ) { mcx_tr_err = X_HEX_SYNTAX ; error_break ; } value = 16 * MCX_HEX(UC(p+2)) + MCX_HEX(UC(p+3)) ; np = 4 ; } else if (strchr("\\abfnrtv", d)) { np = 2 ; switch(d) { case 'a' : value = 07 ; break ; case 'b' : value = 010 ; break ; case 'f' : value = 014 ; break ; case 'n' : value = 012 ; break ; case 'r' : value = 015 ; break ; case 't' : value = 011 ; break ; case 'v' : value = 013 ; break ; case '\\': value = 0134; break ; default : value = '?' ; break /* impossible */ ; } } else { value= d ; np = 2 ; } } /* case '\\' */ /*************************************************************************/ else if (c == '[') { if (!class_ok) /* fixme: could just accept '[' */ { mcx_tr_err = X_CLASS_UNEXPECTED ; error_break ; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ else if (p+1 < z && UC(p+1) == ':') { if (!strncmp(p+2, "alpha:]", 7)) class = C_ALPHA, np = 4+ 5 ; else if (!strncmp(p+2, "alnum:]", 7)) class = C_ALNUM, np = 4+ 5 ; else if (!strncmp(p+2, "digit:]", 7)) class = C_DIGIT, np = 4+ 5 ; else if (!strncmp(p+2, "cntrl:]", 7)) class = C_CNTRL, np = 4+ 5 ; else if (!strncmp(p+2, "graph:]", 7)) class = C_GRAPH, np = 4+ 5 ; else if (!strncmp(p+2, "lower:]", 7)) class = C_LOWER, np = 4+ 5 ; else if (!strncmp(p+2, "print:]", 7)) class = C_PRINT, np = 4+ 5 ; else if (!strncmp(p+2, "punct:]", 7)) class = C_PUNCT, np = 4+ 5 ; else if (!strncmp(p+2, "space:]", 7)) class = C_SPACE, np = 4+ 5 ; else if (!strncmp(p+2, "upper:]", 7)) class = C_UPPER, np = 4+ 5 ; else if (!strncmp(p+2, "xdigit:]", 8)) class = C_XDIGIT, np = 4+ 6 ; else { mcx_tr_err = X_CLASS_UNKNOWN ; break ; } } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ else if (p+1 < z && UC(p+1) == '*') { int num = 0 ; u8 value2 = 0 ; const char* q = NULL ; if (p+2 >= z) { mcx_tr_err = X_REPEAT_SYNTAX ; error_break ; } if (!(q = xtr_get_token(p+2, z, NULL, &value2, NULL))) error_break ; if (UC(q) == '*' && UC(q+1) == ']') class = C_FLOOD ; else if ( (UC(q) == '#' && UC(q+1) == ']') || (UC(q) == '*') ) class = C_REPEAT ; else { mcx_tr_err = X_REPEAT_SYNTAX ; error_break ; } if (UC(q+1) == ']') { *repeat = 0 ; q++ ; } else { if (sscanf(q+1, "%d]", &num) != 1) break ; if (!(q = strchr(q, ']'))) break ; if (num < 0 || num > 256) break ; *repeat = num ; if (!num) class = C_FLOOD ; } /* q[0] should be ']' now */ value = value2 ; np = (q+1) - p /* truncintok */ ; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ else break ; } /*************************************************************************/ else { value = c ; np = 1 ; } status = STATUS_OK ; break ; } if (status) { mcxErr(me, "error at char (%c)", UC(p)) ; return NULL ; } if (mcx_tr_debug) fprintf(stdout, "xtr_get_token (%d | %d)\n", (int) value, (int) class) ; if (classp) *classp = class ; if (valuep) *valuep = value ; return p + np ; } char* mcxStrEscapedValue ( const char* p , const char* z , int *value ) { u8 val = p[0] ; const char* q = NULL ; if (val != '\\') { *value = val ; return (char*) (p+1) ; } if (!(q = xtr_get_token(p, z, NULL, &val, NULL))) return NULL ; *value = val ; return (char*) q ; } /* Sets either * value to something in the range 0-255 and length * to something >= 1 * or * value to one of the constants C_ALPHA etc and length to 0. * * Returns the next parsable character or NULL for failure. */ static const char* xtr_get_set ( const char *p , const char *z , u8 *classp , u8 *valuep , int *countp ) { const char* q = xtr_get_token(p, z, classp, valuep, countp) ; if (!q) return NULL ; if (!*classp && *q == '-') { u8 range_top = 0 ; q = xtr_get_token(q+1, z, NULL, &range_top, NULL) ; if (!q) return NULL ; if (range_top < *valuep) { mcx_tr_err = X_RANGE_INVERTED ; return NULL ; } *countp = range_top - *valuep + 1 ; } else if (!*classp) *countp = 1 /* else it is a repeat class or .. */ ; return q ; } static void mcx_tr_enc_dump ( u32* enc , const char* tag ) { int i = 0 ; fprintf(stdout, "(dumping %s\n", tag) ; while (i> 8 ; int val = enc[i] & 0377 ; fprintf(stdout, "%6d%6d%6d\n", i, meta, val) ; if (meta == C_EOF) break ; i++ ; } fprintf(stdout, ")\n") ; } static mcxstatus xtr_get_spec ( const char* spec , u32* tbl /* size MAX_SPEC_INDEX+1 */ , mcxbool repeat_ok /* doubles as true for dst, false for src, ugly! */ ) { const char* p = spec ; const char* z = spec + strlen(spec) ; int offset=0, i=0 ; mcxstatus status = STATUS_FAIL ; while (1) { u8 value = 0 ; u8 class = 0 ; int count = -1 ; status = STATUS_OK ; if (p >= z) break ; status = STATUS_FAIL /* space for 1 token; check anything longer. * (reserve space for EOF token) */ ; if (offset >= MAX_SPEC_INDEX) break ; if (!(p = xtr_get_set(p, z, &class, &value, &count))) break ; if (ISREPEAT(class) && count >= 0) { if (!repeat_ok) { mcx_tr_err = X_REPEAT_UNEXPECTED ; break ; } tbl[offset++] = (class << 8) | value ; if (offset >= MAX_SPEC_INDEX) break ; tbl[offset++] = count & 0377 ; } else if (ISCLASS(class)) { int (*innit)(int) = isit[class - C_CLASSSTART] ; tbl[offset++] = (C_CLASSSTART << 8 ) | class ; for (i=0;i<256;i++) { if (innit(i)) { if (offset >= MAX_SPEC_INDEX) break ; tbl[offset++] = i ; } } if (i != 256) break ; if (offset >= MAX_SPEC_INDEX) break ; tbl[offset++] = (C_CLASSEND << 8) | class ; } else if (count > 1) { tbl[offset++] = (C_RANGESTART << 8) ; for (i=value;i= MAX_SPEC_INDEX) break ; tbl[offset++] = i ; } if (i != value+count) break ; if (offset >= MAX_SPEC_INDEX) break ; tbl[offset++] = C_RANGEEND << 8 ; } else tbl[offset++] = value ; status = STATUS_OK ; } tbl[offset++] = C_EOF << 8 ; if (status || p!=z) { mcxErr(us, "error!") ; return STATUS_FAIL ; } return STATUS_OK ; } static mcxstatus mcx_tr_encode_boolean ( mcxTR* tr , u32* enc , mcxbits bit ) { int i ; for (i=0;i> 8 ; int value = enc[i] & 0377 ; if (class == C_EOF) break ; if (class) continue ; tr->tlt[value] |= bit << 8 ; } return STATUS_OK ; } static mcxstatus mcx_tr_translate_encode ( mcxTR* tr , u32* srcenc , u32* dstenc ) { int X = -1, Y = -1 ; int s = 0, d = 0 ; int star_count = 0 ; mcxbool star_fill = FALSE , flood_fill = FALSE , src_end = FALSE , dst_end = FALSE , to_lower = FALSE , to_upper = FALSE , src_class_end = FALSE ; while (1) { u32 src_tok = 0 ; u32 src_cls = 0 ; u32 src_val = 0 ; u32 dst_tok = 0 ; u32 dst_cls = 0 ; u32 dst_val = 0 ; src_class_end = FALSE ; if (s >= MAX_SPEC_INDEX || d >= MAX_SPEC_INDEX) { mcxErr(us, "panic off the rails") ; break ; } if (X >= 0 && Y >= 0) { tr->tlt[X] = Y | (MCX_TR_TRANSLATE << 8) ;if (mcx_tr_debug) fprintf(stdout, "map %d to %d\n", X, Y) ; X = -1 ; if (star_count) star_count-- ; if (!star_count && !star_fill && !flood_fill) Y = -1 ; } else if (s || d) mcxErr(us, "fimbly feeling") /* skip ends, unset star_fill if necessary */ ; src_tok = srcenc[s++] ; src_cls = src_tok >> 8 ; src_val = src_tok & 0377 /* consider both * tring -x 'abcdef[:digit:]' -y '[*_#][*##]' (magic ends with f) * tring -x '[:digit:]abcdef' -y '[*##][*_#]' (magic ends before a) */ ; if (ISBOUNDARY(src_cls)) star_fill = FALSE ; if (ISEND(src_cls)) src_tok = srcenc[s++] , src_cls = src_tok >> 8 , src_val = src_tok & 0377 , src_class_end = TRUE ; if (!star_count && !star_fill && !flood_fill) { dst_tok = dstenc[d++] ; dst_cls = dst_tok >> 8 ; dst_val = dst_tok & 0377 ; if (ISEND(dst_cls)) dst_tok = dstenc[d++] , dst_cls = dst_tok >> 8 , dst_val = dst_tok & 0377 ; } ;if (mcx_tr_debug) fprintf(stdout, "have %3d %3d %3d %3d\n", (int) src_cls, (int) src_val, (int) dst_cls, (int) dst_val); /* check class/range conditions. */ if (ISLOWERSTART(src_tok) && ISUPPERSTART(dst_tok)) to_upper = TRUE ; else if (ISUPPERSTART(src_tok) && ISLOWERSTART(dst_tok)) to_lower = TRUE ; else if ((to_upper || to_lower) && src_class_end) to_lower = FALSE , to_upper = FALSE /* check repeat */ ; if (ISREPEAT(dst_cls)) { Y = dst_val ; star_count = dstenc[d++] ; if (dst_cls == C_FLOOD) flood_fill = TRUE ; else if (!star_count) star_fill = TRUE ;if (mcx_tr_debug) fprintf(stdout, "star count/fill/flood %d %d %d\n", star_count, star_fill, flood_fill) ; } ;if (mcx_tr_debug && (to_upper || to_lower)) fprintf(stdout, "case mapping\n") ; if (!star_count && !star_fill && !flood_fill) { if (ISSTART(dst_cls)) Y = dstenc[d++] ; else Y = dst_val ; } if (ISSTART(src_cls)) X = srcenc[s++] ; else X = src_val ; if (!ISUCHARRANGE(X) || !ISUCHARRANGE(Y)) mcxErr(us, "panic %d %d", X, Y) , X = 0 , Y = 0 ; if (to_lower) { if (!isupper(X)) { mcxErr(us, "panic %d not lower", X) ; X = 0, Y = 0 ; } else Y = tolower(X) ; } else if (to_upper) { if (!islower(X)) { mcxErr(us, "panic %d not upper", X) ; X = 0, Y = 0 ; } else Y = toupper(X) ; } src_end = src_cls == C_EOF ; dst_end = dst_cls == C_EOF ; if (src_end || dst_end) break ; } if (!src_end) mcxErr(us, "trailing spunk in src") ; if (!dst_end && !((star_fill || flood_fill) && dstenc[d] >> 8 == C_EOF)) mcxErr(us, "trailing spunk in dst") ; return STATUS_OK /* specs parsed alright, just ignore spurious stuff */ ; } static void mcx_tr_complement ( u32* enc ) { u32 tmp[256] ; int i = 0 ; int j = 0 ; int delta = 1 ; for (i=0;i<256;i++) tmp[i] = 0 ; for (i=0;i<=MAX_SPEC_INDEX;i+=delta) { int class = enc[i] >> 8 ; int value = enc[i] & 0377 ; if (ISREPEAT(class)) { delta = 2 ; mcxErr(us, "value taken but repeat ignored in complement") ; tmp[value] = 1 ; continue ; } else if (ISBOUNDARY(class)) /* nada */ ; else tmp[value] = 1 ; delta = 1 ; } for (i=0;i<256;i++) if (!tmp[i]) enc[j++] = i ; enc[j++] = C_EOF << 8 ; while (j<=MAX_SPEC_INDEX) enc[j++] = C_EOF << 8 ; } /* * the enc arrays use stop and end tokens for ranges and classes. both are * required to have more than 1 element. No more than MAX_SPEC_INDEX+1 * positions are allocated for either specification, which also cater for * start and end and EOF tokens - the +1 is for the EOF token. * * carryon */ static mcxstatus mcx_tr_encode ( mcxTR* tr , const char* src , const char* dst , const char* set_delete , const char* set_squash ) { u32 srcenc[MAX_SPEC_INDEX+1] ; u32 dstenc[MAX_SPEC_INDEX+1] ; int i ; if (src && dst) { for (i=0;i<=MAX_SPEC_INDEX;i++) srcenc[i] = 0 , dstenc[i] = 0 ; if (xtr_get_spec(src, srcenc, FALSE)) return STATUS_FAIL ; if (mcx_tr_debug) mcx_tr_enc_dump(srcenc, "source") ; if (tr->modes & MCX_TR_SOURCE_C) mcx_tr_complement(srcenc) ; if (xtr_get_spec(dst, dstenc, TRUE)) return STATUS_FAIL ; if (mcx_tr_debug) mcx_tr_enc_dump(dstenc, "destination") ; if (tr->modes & MCX_TR_DEST_C) mcx_tr_complement(dstenc) ; if (mcx_tr_translate_encode(tr, srcenc, dstenc)) return STATUS_FAIL ; } if (set_delete) { for (i=0;i<=MAX_SPEC_INDEX;i++) srcenc[i] = 0 ; if (xtr_get_spec(set_delete, srcenc, FALSE)) return STATUS_FAIL ; if (mcx_tr_debug) mcx_tr_enc_dump(srcenc, "delete") ; if (tr->modes & MCX_TR_DELETE_C) mcx_tr_complement(srcenc) ; mcx_tr_encode_boolean(tr, srcenc, MCX_TR_DELETE) ; } if (set_squash) { for (i=0;i<=MAX_SPEC_INDEX;i++) srcenc[i] = 0 ; if (xtr_get_spec(set_squash, srcenc, FALSE)) return STATUS_FAIL ; if (mcx_tr_debug) mcx_tr_enc_dump(srcenc, "squash") ; if (tr->modes & MCX_TR_SQUASH_C) mcx_tr_complement(srcenc) ; mcx_tr_encode_boolean(tr, srcenc, MCX_TR_SQUASH) ; } return STATUS_OK ; } mcxstatus mcxTRloadTable ( mcxTR* tr , const char* src , const char* dst , const char* set_delete , const char* set_squash , mcxbits modes ) { const char* me = "mcxTRloadTable" ; int i ; mcx_tr_err = NULL ; if (src && UC(src) == '^') src++ , modes |= MCX_TR_SOURCE_C ; if (dst && UC(dst) == '^') dst++ , modes |= MCX_TR_DEST_C ; if (src && dst) modes |= MCX_TR_TRANSLATE ; if (set_delete) { if (UC(set_delete) == '^') set_delete++ , modes |= MCX_TR_DELETE_C ; modes |= MCX_TR_DELETE ; } ; if (set_squash) { if (UC(set_squash) == '^') set_squash++ , modes |= MCX_TR_SQUASH_C ; modes |= MCX_TR_SQUASH ; } tr->modes = modes ; for (i=0;i<256;i++) tr->tlt[i] = 0 ; if (src && !dst) { mcxErr(me, "src requires dst") ; return STATUS_FAIL ; } return mcx_tr_encode(tr, src, dst, set_delete, set_squash) ; } apparix-07-261/util/alloc.h0000644002600400000120000000363610642147132012412 00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_alloc_h #define tingea_alloc_h #include /* ========================================================================= * * * mcxRealloc is notable, for it *frees* memory and returns a NULL pointer * if the newly requested block has size 0. This must be so in order to * allow routines to do their math and housekeeping. If they register the * new block as having 0 bytes, then they need not and must not attempt to * free it thereafter. * * ========================================================================= * */ #include "types.h" void* mcxAlloc ( dim size , mcxOnFail ON_FAIL ) ; void* mcxRealloc ( void* object , dim new_size , mcxOnFail ON_FAIL ) ; void mcxFree ( void* object ) ; void mcxNFree ( void* base , dim n_elem , dim elem_size , void (*obRelease) (void *) ) ; void* mcxNAlloc ( dim n_elem , dim elem_size , void* (*obInit) (void *) , mcxOnFail ON_FAIL ) ; void* mcxNRealloc ( void* mem , dim n_elem , dim n_elem_prev , dim elem_size , void* (*obInit) (void *) , mcxOnFail ON_FAIL ) ; void mcxMemDenied ( FILE* channel , const char* requestee , const char* unittype , dim n ) ; void mcxAllocLimits ( long maxchunksize , long maxtimes ) ; #endif apparix-07-261/util/array.h0000644002600400000120000000705410642147132012434 00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_array_h #define tingea_array_h #include "types.h" mcxstatus mcxSplice ( void* base1pp /* _address_ of pointer to elements */ , const void* base2p /* pointer to elements */ , dim size /* size of base1 and base2 members */ , dim *n_base1 /* total length of elements after base1 */ , dim *N_base1 /* number of alloc'ed elements for base1 */ , ofs o_base1 /* splice relative to this ofset */ , dim d_base1 /* delete this number of elements */ , dim c_base2 /* number of elements to copy */ ) ; dim mcxDedup ( void* base , dim nmemb , dim size , int (*cmp)(const void *, const void *) , void (*merge)(void *, const void *) ) ; mcxstatus mcxResize ( void* mempp , dim size , dim* ct , dim newct , mcxOnFail ON_FAIL ) ; /* Return largest element smaller than or equal to key. * return NULL if no element is smaller than key. * Returns rightmost element in case entries sort identically, * (note: mcxBsearchCeil will then return the leftmost element) * * base should be sorted according to cmp */ void* mcxBsearchFloor ( const void *key , const void *base , dim nmemb , dim size , int (*cmp)(const void *, const void *) ) ; /* Return smallest element larger than or equal to key. * return NULL if no element is larger than key. * Returns leftmost element in case entries sort identically, * (note: mcxBsearchFloor will then return the rightmost element) * * base should be sorted according to cmp */ void* mcxBsearchCeil ( const void *key , const void *base , dim nmemb , dim size , int (*cmp)(const void *, const void *) ) ; typedef struct { void* mempptr ; dim size ; dim n ; dim n_alloc ; float factor ; mcxbool bFinalized ; } mcxBuf ; /* * *mempptr should be peekable; NULL or valid memory pointer. */ mcxstatus mcxBufInit ( mcxBuf* buf , void* mempptr , dim size , dim n ) ; /* * Extends the buffer by n_request unitialized chunks and returns a pointer * to this space. It is the caller's responsibility to treat this space * consistently. The counter buf->n is increased by n_request. * * If we cannot extend (realloc), a NULL pointer is returned; * the original space is left intact. * * Returns NULL on (alloc) failure */ void* mcxBufExtend ( mcxBuf* buf , dim n_request , mcxOnFail ON_FAIL ) ; /* * Make superfluous memory reclaimable by system, * prepare for discarding buf (but not *(buf->memptr)!) * * If for some bizarre reason we cannot shrink (realloc), * errno is set to ENOMEM. * the original space is left intact. Its size is in buf.n . */ dim mcxBufFinalize ( mcxBuf* buf ) ; /* * Make buffer refer to a new variable. Size cannot be changed, * so variable should be of same type as before. */ void mcxBufReset ( mcxBuf* buf , void* mempptr ) ; #endif apparix-07-261/util/rand.h0000644002600400000120000000225110642147132012234 00000000000000/* (C) Copyright 2004, 2005, 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_rand_h #define tingea_rand_h #include #define MCX_RAND_MAX RAND_MAX #define mcxUniform0 ((1.0 * random()) / ((double) RAND_MAX + 1.0)) #define mcxUniform1 (1.0 - ((1.0 * random()) / ((double) RAND_MAX + 1.0))) /* This is for weak seeding, to obtain fresh seeds which will definitely * *not* be suitable for cryptographic needs */ unsigned long mcxSeed ( unsigned long seedlet ) ; double mcxNormal ( void ) ; double mcxNormalCut ( double radius , double stddev ) ; double mcxNormalZiggurat ( void ) ; double mcxNormalBoxMuller ( void ) ; /* Generate numbers in the interval [-outer, outer] according * to the normal distribution with standard deviation sigma. * Use e.g. outer = 2.0 sigma = 0.5 */ double mcxNormalSample ( double radius , double stddev ) ; #endif apparix-07-261/util/equate.h0000644002600400000120000000300610642147132012573 00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef equate_h #define equate_h int intCmp ( const void* i1 , const void* i2 ) ; int intRevCmp ( const void* i1 , const void* i2 ) ; int intnCmp ( const int* i1 , const int* i2 , int n ) ; int fltCmp ( const void* f1 , const void* f2 ) ; int fltRevCmp ( const void* f1 , const void* f2 ) ; int dblCmp ( const void* f1 , const void* f2 ) ; int dblRevCmp ( const void* f1 , const void* f2 ) ; int intLt ( const void* i1 , const void* i2 ) ; int intLq ( const void* i1 , const void* i2 ) ; int intGt ( const void* i1 , const void* i2 ) ; int intGq ( const void* i1 , const void* i2 ) ; int fltLt ( const void* f1 , const void* f2 ) ; int fltLq ( const void* f1 , const void* f2 ) ; int fltGt ( const void* f1 , const void* f2 ) ; int fltGq ( const void* f1 , const void* f2 ) ; #endif apparix-07-261/util/hash.h0000644002600400000120000002501310671723005012235 00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_hash_h #define tingea_hash_h /* TODO: make sort routines for keys and values by key or value criteria. * make interface for storing integers, preferably without objectifying them. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** Implementation notes (a few). * * * This hash interface is very powerful. It gives you more than enough * rope to hang yourself and then some. It can be used as is, or wrappers * can be made around it that restrict a caller's ability to err. * * The danger lies in the fact that this interface only does retrieval * and storage of pointers (both for keys and values), and does not clone * anything. Anything happening with the objects pointed to during the * lifetime of the hash is the responsibility of the caller. * * What the interface cannot do currently is hash integers by value (rather * than by reference). This functionality will probably be added someday. * Features: * o Searching, inserting, and deletion are all done by * mcxHashSearch. It returns a pointer to mcxKV. In all modes, the * caller can use the returned mcxKV* structure to obtain * the 'val' and 'key' members. * * o Hashes grow automatically once the average load per bucket * exceeds a settable threshold and if the hash was not declared * constant. * * o Caller supplies both the hash function and the compare function. * This interface provides several hash functions operating on a * (void* base, int len) combo, where base is cast to char by the * hash function. These functions can be used in creating custom hash * functions for your custom objects. * * o You can (of course) have multiple hashes. This is not really * a feature - however, since the idiotic does not offer * this I thought I'd mention it. * * o Witness mcxHashWalkInit, mcxHashWalkStep. * * o There is mcxHashMerge. * * o mcxHashKeys, mcxHashKVs. * * Enjoy. * Notes * There is a utility hashfile.c (distributed in a separate package) * that can be used to stress-test this module. It allows customization * of several aspects, including the hash function that should be used. */ #include "types.h" #include "list.h" /* The hash struct is hidden. Use mcxHashGetSettings if you need * to peek into the interior. Or read hash.c */ typedef struct mcxHash mcxHash; typedef struct { void* key ; void* val ; } mcxKV ; mcxHash* mcxHashNew ( dim n_buckets , u32 (*hash) (const void *a) , int (*cmp) (const void *a, const void *b) ) ; #define MCX_HASH_OPT_DEFAULTS 0 #define MCX_HASH_OPT_CONSTANT 1 #define MCX_HASH_OPT_UNUSED 2 void mcxHashSetOpts ( mcxHash* hash , double load , int option /* negative values will be ignored (feature) */ ) ; dim mcxHashMemSize ( mcxHash* hash ) ; typedef struct mcxHashSettings { dim n_buckets ; dim n_entries ; float load ; mcxbits options ; } mcxHashSettings ; void mcxHashGetSettings ( mcxHash* hash , mcxHashSettings* settings ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** mcxHashSearch * * action returns * * MCX_DATUM_DELETE -> deleted mcxKV* or NULL if not present * MCX_DATUM_INSERT -> new or present mcxKV* * MCX_DATUM_FIND -> mcxKV* if present NULL otherwise. * * usage: * * Values have to be inserted by the caller into the returned KV struct. * Make sure that keys point to objects that are constant * (with respect to the cmp function) during the lifetime of the hash. * YOU have to ensure the integrity of both keys and values. * This enables you to do whatever suits you, such as appending to * values. * * When inserting, check whether kv->key != key (where kv is returned value) * if this is the case, an identically comparing key is already present. * You may want to destroy one of the two keys and decide what to do * with the value. * * When deleting, the key-value pair is removed from the hash * *AND RETURNED TO CALLER* - you have to decide yourself what to do * with it. If the key was not present, a value of NULL is returned. * You have to fetch the val and key members of the returned mcxKV * object immediately: Subsequent inserts in the hash may reuse it. * * When finding, life is simple. NULL if absent, matching kv otherwise. * * note: * * memory management of keys and values is totally up to caller. * If usage is clean, you can use mcxHashFree for disposal of hash. */ #define mcxHashSearch(key, hash, ACTION) mcxHashSearchx(key, hash, ACTION, NULL) mcxKV* mcxHashSearchx ( void* key , mcxHash* hash , mcxmode ACTION , int* delta ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** mcxHashMerge * * this one COPIES OBJECT POINTERS and DOES NOT CLONE. * so after the merge, hash1 and hash2 keys and values should not be freed. * In case there are equivalent keys in hash1 and hash2, this may * cause trouble when the caller wants to do cleaning afterwards. * This interface is still under development. * * hashd may be equal to hash1 or hash2, and it may also be NULL. */ mcxHash* mcxHashMerge ( mcxHash* hash1 , mcxHash* hash2 , mcxHash* hashd , void* merge(void* val1, void* val2) ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** mcxHashFree * * This only works if all keys are of the same type and/or all values * are of the same type, and if your objects were created as expected by * the free routines (presumably malloced heap memory) - be careful with * constant objects like constant strings. * * freekey and freeval may not free their argument. This is because * tingea does not allow routines that leave arguments in an * inconsistent state, and free routines in tingea generally accept * an argument of the form ** pptr. * In the case of mcxHashFree this means that the interface may * feel slighly more cumbersome. * A way out would have been to make the callbacks of signature * * void freemem(void** mempp) * * The caller could access *mempp, cast it to the expected type, * and later set *mempp to NULL. However, this would require * new free routines for lots of types. With the current interface * existing Release routines can be used: * * The type of free routine expected by mcxHashFree is generally * called Release or Release_v, e.g. mcxTingRelease. * Release routines release all memory of a composite object except the * memory which holds the outer struct. * * If one of key or val is *not* a composite type or is a composite type * that does not contain malloced memory, use mcxHashFreeScalar. * * Both freekey and freeval may be NULL. When NULL, the corresponding * KV member is not loooked at. This is useful e.g. when hashing objects * owned by someone else. */ void mcxHashFree ( mcxHash** hashpp , void freekey(void* keypp) /* (yourtype1** keypp) */ , void freeval(void* valpp) /* (yourtype2** valpp) */ ) ; void mcxHashFreeScalar ( void* scalar ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * It copies the pointers stored in the hash */ void** mcxHashKeys ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) , mcxbits opts /* unused yet */ ) ; /* Future options: SORT, SORT_DESC */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * It copies the pointers stored in the hash */ void** mcxHashKVs ( mcxHash* hash , dim* n_entries , int (*cmp)(const void*, const void*) , mcxbits opts /* unused yet */ ) ; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Prints some information to stdout. */ void mcxHashStats ( FILE* fp , mcxHash* hash ) ; typedef struct mcxHashWalk mcxHashWalk; mcxHashWalk* mcxHashWalkInit ( mcxHash *hash ) ; mcxKV* mcxHashWalkStep ( mcxHashWalk* walk , dim *i_bucket ) ; void mcxHashWalkFree ( mcxHashWalk **walkpp ) ; void mcxHashApply ( mcxHash* hash , void (*cb)(const void* key, void* val, void* data) , void* data ) ; /* UNIX ELF hash */ /* POOR! */ u32 mcxELFhash ( const void *key , u32 len ) ; /* created by Bob Jenkins */ u32 mcxBJhash ( const void* key , u32 len ) ; /* One at a time hash, Bob Jenkins/Colin Plumb */ u32 mcxOAThash ( const void *key , u32 len ) ; /* created by Daniel Phillips */ u32 mcxDPhash ( const void* key , u32 len ) ; /* "Berkely Database" hash (from Ozan Yigit's page) */ /* POOR! */ u32 mcxBDBhash ( const void *key , u32 len ) ; /* Dan Bernstein hash (from Ozan Yigit's page) */ u32 mcxDJBhash ( const void *key , u32 len ) ; /* created by Chris Torek */ u32 mcxCThash ( const void* key , u32 len ) ; /* "GNU Emacs" hash (from m4) */ /* not among the best */ u32 mcxGEhash ( const void* key , u32 len ) ; /* Fowler Noll Vo hash */ u32 mcxFNVhash ( const void *buf , u32 len ) ; /* All experimental with weak points. */ u32 mcxSvDhash ( const void *key , u32 len ) ; u32 mcxSvD2hash ( const void *key , u32 len ) ; u32 mcxSvD1hash ( const void *key , u32 len ) ; /* uses mcxDPhash */ u32 mcxStrHash ( const void* s ) ; int mcxStrCmp ( const void* a , const void* b ) ; #endif apparix-07-261/util/heap.h0000644002600400000120000000350010642147132012223 00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO * interface that copies old element someplace. * interface that copies new element destination someplace. * heap merges (for mcxdiameter application [binomial heaps]) * removal by key. * key lookup/increment. */ #ifndef tingea_heap_h #define tingea_heap_h /* With a min-heap the parents are smaller than the children. * Use a min-heap to compute the K largest elements. * (notice that a new element only has to be compared with the root (when * the heap is at full capacity) to know whether it should enter the heap * and evict the root. * * Vice versa, compute K smallest elements with a max-heap. */ enum { MCX_MIN_HEAP = 10000 /* find large elements */ , MCX_MAX_HEAP /* find small elements */ } ; typedef struct { void *base ; dim heapSize ; dim elemSize ; int (*cmp)(const void* lft, const void* rgt) ; mcxenum type ; dim n_inserted ; } mcxHeap ; mcxHeap* mcxHeapInit ( void* heap ) ; mcxHeap* mcxHeapNew ( mcxHeap* heap , dim heapSize , dim elemSize , int (*cmp)(const void* lft, const void* rgt) , mcxenum HEAPTYPE /* MCX_MIN_HEAP or MCX_MAX_HEAP */ ) ; void mcxHeapFree ( mcxHeap** heap ) ; void mcxHeapRelease ( void* heapv ) ; void mcxHeapClean ( mcxHeap* heap ) ; void mcxHeapInsert ( mcxHeap* heap , void* elem ) ; #endif apparix-07-261/util/let.h0000644002600400000120000000236710642147132012104 00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_let #define tingea_let #include "types.h" #include "ting.h" #define TRM_FAIL 0 #define TRM_ISNUM 1 #define TRM_ISREAL 2 #define TRM_ISINF 3 #define TRM_ISNAN 4 typedef struct telRaam telRaam; telRaam* trmInit ( const char* str ) ; mcxstatus trmExit ( telRaam* raam ) ; mcxstatus trmParse ( telRaam* raam ) ; int trmEval ( telRaam* raam , long* lp , double* fp ) ; void trmRegister ( telRaam* raam , int (user_parse)(mcxTing* txt, int offset) , mcxenum (user_eval)(const char* token, long *ival, double *fval) , char user_char ) ; mcxbool trmError ( int flags ) ; mcxbool trmIsReal ( int flags ) ; mcxbool trmIsNum ( int flags ) ; mcxbool trmIsNan ( int flags ) ; mcxbool trmIsInf ( int flags ) ; void trmDump ( telRaam* raam , const char* msg ) ; void trmDebug ( void ) ; #endif apparix-07-261/util/io.h0000644002600400000120000002156110642147132011724 00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* STATUS: * usable: yes * tested: yes, stress-tested in zoem and mcl * ad hoc: somewhat * quirks: probably a few * support: limited * * AIMS * - Provide convenient and efficient wrappers for reading lines, files, searching. * - Within these wrappers, account bytes and lines read. * It is explicitly not an aim to be an all-encompassing interface, wrapping * everything provided by stdio.h. The type is not opaque and you are * encouraged to inspect its fp member. * - The open modes are inspected to infer some knowledge, * then passed on directly to fopen. * - File "-" is interpreted as either STDIN or STDOUT depending on the open mode. * * BUGS * - leader framework is very fragile. * ================================= * mcxIOfind is the only one consuming the leader, so if * leader contains the pattern and more there is no one * else to consume the remainder in leader. * [ The leader framework was primarily created to support * cookies for unseekable streams. ] * * - Should incorporate more (f)error checking. * * TODO: * - document interfaces. * - document which routines corrupt the counts. * - make sure that buffer treats \0 bytes correctly. Should be * pretty close. * - buffered reads (problematic: mcxIOexpectNum and friends). * - design {reset,close} framework, esp related to usr member. * ? support for pipes */ #ifndef tingea_file_h #define tingea_file_h #include #include #include "ting.h" #include "types.h" /* The thing below seems a reasonable test for seekability. * Let's agree that the main thing is the encapsulation. * */ #define mcxFPisSeekable(fp) (!fseek(fp, 0, SEEK_CUR)) /* Possibly more stringent check: * int had_error = ferror(file); * long curpos = ftell(file); * bool seekable = (curpos != -1L && fseek(file, curpos, SEEK_SET) == 0); * if (!had_error) * clearerr(file); */ /* ************************************************************************** * * ** Implementation notes. * * * This is meant to be a lightweight layer for file operations. * It is so lightweight that the pivotal data structure is not hidden. * * Basic usage: * mcxIO* xf = mcxIOnew(somestr, "r"); * mcxIOopen(xf, EXIT_ON_FAIL); * * * Searching: * mcxIOfind(xf, pattern, ON_FAIL) * * * Reading lines: * mcxIOreadLine(xf, txt, mode) * modes (xor'ed bits): * MCX_READLINE_CHOMP * MCX_READLINE_SKIP_EMPTY * MCX_READLINE_PAR (read a paragraph) * MCX_READLINE_BSC (backslash continues line) * MCX_READLINE_DOT (single dot on single line ends paragraph) * Reading files: * mcxIOreadFile(xf, txt) * * * Reading bytes: * int c = mcxIOstep(xf) * mcxIOstepback(c, xf) * * These keep track of byte count, line count, and ofset within line. * * * Reset attributes for file name object - change name or mode. * mcxIOrenew(xf, name, mode) * * * There are some more small utility functions. * ************************************************************************** * * * * TODO: * much todo about everything. * * mcxIOdiscardLine * mcxIOskipSpace * Change to instance of sth more general. * */ #define mcxIOateof(xf) (xf->ateof) #define mcxIOstdio(xf) (xf->stdio) #define mcxIOlc(xf) ((long) ((xf->lc) + (xf->lo ? 1 : 0))) /* this also takes care of EOF * not preceded by a newline */ /* As long as you did not use mcxIOopen, feel free to do anything with the fn * member, especially right after mcxIOnew. */ typedef struct { mcxTing* fn ; char* mode ; FILE* fp ; dim lc /* line count */ ; dim lo /* line offset */ ; dim lo_ /* line offset backup, only valid when lo == 0 */ ; dim bc /* byte count */ ; int ateof ; int stdio ; mcxTing* buffer /* e.g. when tryCookie fails and unseekable stream */ ; dim buffer_consumed ; void* usr /* user object */ ; mcxstatus (*usr_reset)(void*) /* function to reset user object */ ; void (*usr_free)(void*) /* function to free user object */ ; } mcxIO ; /* * mcxIOrenew does *not* support callback for resetting the usr object */ mcxIO* mcxIOrenew ( mcxIO* xf , const char* name , const char* mode ) ; mcxIO* mcxIOnew ( const char* name , const char* mode ) ; mcxstatus mcxIOopen ( mcxIO* xf , mcxOnFail ON_FAIL ) ; mcxstatus mcxIOtestOpen ( mcxIO* xf , mcxOnFail ON_FAIL ) ; /* * mcxIOfree does *not* support callback for freeing the usr object */ void mcxIOfree ( mcxIO** xf ) ; void mcxIOfree_v ( void* xfpp ) ; void mcxIOrelease ( mcxIO* xf ) ; void mcxIOerr ( mcxIO* xf , const char *complainer , const char *complaint ) ; /* Currently, for stdin/stdout/stderr clearerr is issued if necessary. * This makes e.g. repeated reads from STDIN possible. * * usr_reset is called if present. */ mcxstatus mcxIOclose ( mcxIO *xf ) ; mcxstatus mcxIOreset ( mcxIO *xf ) ; mcxstatus mcxIOreadFile ( mcxIO *xf , mcxTing *fileTxt ) ; #define MCX_READLINE_DEFAULT 0 #define MCX_READLINE_CHOMP 1 #define MCX_READLINE_SKIP_EMPTY 2 #define MCX_READLINE_PAR 4 #define MCX_READLINE_BSC 8 #define MCX_READLINE_DOT 16 mcxstatus mcxIOreadLine ( mcxIO *xf , mcxTing *lineTxt , mcxbits flags ) ; ofs mcxIOappendChunk ( mcxIO *xf , mcxTing *dst , dim sz , mcxbits flags ) ; /* Returns the number of bytes that could be discarded. */ dim mcxIOdiscardLine ( mcxIO *xf ) ; /* Returns the number of bytes that could be discarded. * ONLY keeps the xf->bc counter up to date. */ dim mcxIOdiscard ( mcxIO *xf , dim amount ) ; /* OK to call this after mcxIOnew, before mcxIOopen */ mcxstatus mcxIOnewName ( mcxIO* xf , const char* newname ) ; /* OK to call this after mcxIOnew, before mcxIOopen */ mcxstatus mcxIOappendName ( mcxIO* xf , const char* suffix ) ; int mcxIOstep ( mcxIO* xf ) ; int mcxIOstepback ( int c , mcxIO* xf ) ; void mcxIOpos ( mcxIO* xf , FILE* channel ) ; void mcxIOlistParmodes ( void ) ; /* * Returns count of trailing characters in str not matching. */ int mcxIOexpect ( mcxIO* xf , const char* str , mcxOnFail ON_FAIL ) ; mcxstatus mcxIOexpectReal ( mcxIO* xf , double* dblp , mcxOnFail ON_FAIL ) ; mcxstatus mcxIOexpectNum ( mcxIO* xf , long* lngp , mcxOnFail ON_FAIL ) ; /* * Returns next non-white space char, * which is pushed back onto stream after reading. */ int mcxIOskipSpace ( mcxIO* xf ) ; /* * Purpose: find str in file. If str is found file pointer is set at the end * of match (fgetc or mcxIOstep would retrieve the next byte), otherwise, * the stream is at EOF. * * Internally this uses Boyer Moore Horspool (bmh) search. * It processes the stream with fgetc, so the input file need not be * seekable. This means that finding is relatively slow. * * An improvement would be to implement faster input munging for seekable * streams, (using reads of size pagesize) and then reposition the stream * after searching. * */ mcxstatus mcxIOfind ( mcxIO* xf , const char* str , mcxOnFail ON_FAIL ) ; /* * NOTE * When the cookie is not found this routine does * 1) It tries to fseek to the point of departure * 2) If that fails, it stores the bytes it could not rewind * in xfin->buffer * * + mcxIOstep * + mcxIOfind * + mcxIOskipSpace * + mcxIOexpect * + mcxIOreadLine * * will access this buffer, but certain other routines will not, e.g. * * - mcxIOreadFile * - mcxIOexpectNum * - mcxIOexpectReal * - all stdio routines (fread, fgetc) * * For all mcxIO routines this is an open bug. * */ mcxbool mcxIOtryCookie ( mcxIO* xfin , const unsigned char abcd[4] ) ; mcxbool mcxIOwriteCookie ( mcxIO* xfout , const unsigned char abcd[4] ) ; #endif apparix-07-261/util/opt.h0000644002600400000120000002053410660055601012115 00000000000000/* (C) Copyright 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ /* TODO * support Giraffe options for non-dispatching programs as well. */ #ifndef tingea_opt_h #define tingea_opt_h #include "types.h" #include "ting.h" #include "hash.h" /* ************************************************************************** * * ** Implementation notes (a few). * * This interface munges and parses text presented to it, and creates * arrays and optionally hashes from them. It does so by simply storing * pointers to the data presented to it, and does not copy anything at all. * * It is the callers job to make sure that the data scrutinized by this * interface stays constant during interface usage. * * Tentatively, this interface treats -I 3 and --I=3 as equivalent * syntax. It is possible to define -I and --I= as separate options. * (by defining -I with MCX_OPT_HASARG and --I with MCX_OPT_EMBEDDED). * * TODO: * implement newline/indent magic in option descriptions. * * The prefix thing, is it necessary? caller could pass argv+prefix .. */ #define MCX_OPT_DEFAULT 0 /* -a, xyz */ #define MCX_OPT_HASARG 1 /* -a 10, xyz foo */ #define MCX_OPT_REQUIRED 2 #define MCX_OPT_INFO 4 #define MCX_OPT_EMBEDDED 8 /* --a=b, xyz or xyz=foo, NOT xyz foo */ #define MCX_OPT_HIDDEN 16 #define MCX_OPT_UNUSED 32 enum { MCX_OPT_STATUS_OK = 0 , MCX_OPT_STATUS_NOARG , MCX_OPT_STATUS_UNKNOWN , MCX_OPT_STATUS_NOMEM } ; /* struct mcxOptAnchor * * id * When using mcxOptApropos, if the option MCX_OPT_DISPLAY_SKIP is used, * an increment larger then one between successive ids (from the structs * in the array presented to mcxOptApropos) causes an additional newline * to be output before the option synopsis. * This enables the creation of paragraphs in a simple manner. * * descr_usage * By default, this just contains the description of what the option does * It is possible to specify a mark to be printed in front of that * description. This requires both the mark and the description * (which are joined in the same string) to be proceded by a special * sequence. For the mark this is "\tM" and for the description * this is "\tD". The description string should be last. A valid entry is * thus * "\tM!\tDset the resource scheme" * This will print the marker '!' inbetween the option tag and its * description. * * Presumably, the legend to such markers is explained by the caller. */ typedef struct mcxOptAnchor { char* tag /* '-foo' or '--expand-only' etc */ ; int flags /* MCX_OPT_HASARG etc */ ; int id /* ID */ ; char* descr_arg /* "" or "", NULL ok */ ; char* descr_usage /* NULL allowed */ ; mcxbits usr_bits /* not used here */ ; } mcxOptAnchor ; void mcxOptAnchorSortByTag ( mcxOptAnchor *anchors , dim n_anchors ) ; void mcxOptAnchorSortById ( mcxOptAnchor *anchors , dim n_anchors ) ; /* * An array of these is returned by parse routines below. * An entry with .anch == NULL indicates end-of-array. */ typedef struct mcxOption { mcxOptAnchor* anch ; const char* val ; } mcxOption ; /* * these routines only use status MCX_OPT_NOARG. The interface * is not yet frozen. */ /* This tries to find as many arguments as it can, and reports the * number of array elements it skipped. */ mcxOption* mcxOptExhaust ( mcxOptAnchor* anch , char** argv , int argc , int prefix /* skip these */ , int* n_elems_read , mcxstatus* status ) ; /* This will never read past the last arguments (suffix of them). * It does currently not enforce that the number of arguments left * is exactly equal to suffix (fixme?). */ mcxOption* mcxOptParse ( mcxOptAnchor* anch , char** argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , mcxstatus* status ) ; void mcxOptFree ( mcxOption** optpp ) ; mcxbool mcxOptIsInfo ( const char* arg , mcxOptAnchor* options ) ; #define MCX_OPT_DISPLAY_DEFAULT 0 #define MCX_OPT_DISPLAY_BREAK_HARD 1 << 4 /* break overly long lines */ #define MCX_OPT_DISPLAY_BREAK_SOFT 1 << 6 /* break overly long lines */ #define MCX_OPT_DISPLAY_CAPTION 1 << 10 /* break after option */ #define MCX_OPT_DISPLAY_PAR 1 << 12 /* ? useful ? paragraph mode */ #define MCX_OPT_DISPLAY_SKIP 1 << 14 /* display enum skips as pars */ #define MCX_OPT_DISPLAY_HIDDEN 1 << 16 /* do that */ void mcxOptApropos ( FILE* fp , const char* me /* unused currently */ , const char* syntax , int width , mcxbits display , const mcxOptAnchor opt[] ) ; /* The ones below are for spreading responsibility for parsing * argument over different modules. * See the mcl implementation for an example. */ mcxOption* mcxHOptExhaust ( mcxHash* opthash , char** argv , int argc , int prefix /* skip these */ , int* n_elems_read , mcxstatus* status ) ; mcxOption* mcxHOptParse ( mcxHash* opthash , char** argv , int argc , int prefix /* skip these */ , int suffix /* skip those too */ , mcxstatus* status ) ; /* * Creates a hash where the tag string is key, and the mcxOptAnchor is value. */ mcxHash* mcxOptHash ( mcxOptAnchor* opts , mcxHash* hash ) ; void mcxOptHashFree ( mcxHash** hashpp ) ; mcxOptAnchor* mcxOptFind ( char* tag , mcxHash* hopts ) ; void mcxUsage ( FILE* fp , const char* caller , const char** lines ) ; extern int mcxOptPrintDigits; mcxbool mcxOptCheckBounds ( const char* caller , const char* flag , unsigned char type , void* var , int (*lftRlt) (const void*, const void*) , void* lftBound , int (*rgtRlt) (const void*, const void*) , void* rgtBound ) ; /* TODO * provide escape mechanisms for delim; * e.g. mcx tilde, UNIX backslash, or SGML percent sign based. * * NOTE * src is modified ('\0' are written throughout). * the char* members 'char* argv[]' all point to within src. */ char** mcxOptParseString ( char* src , int* argc , unsigned char delim ) ; char* mcxOptArgLine ( const char** argv , int argc , int quote /* '[' or '"' */ ) ; /* * * * */ #define MCX_DISP_DEFAULT 0 #define MCX_DISP_HIDDEN 1 typedef struct { const char* name ; const char* syntax ; mcxOptAnchor* options ; int n_options ; mcxstatus (*arg_cb)(int optid, const char* val) ; mcxstatus (*init)( void ) ; mcxstatus (*main)(int argc, const char* argv[]) ; int n_at_least /* trailing arguments */ ; int n_at_most /* trailing arguments */ ; mcxbits flags ; } mcxDispHook ; typedef struct { int id ; mcxDispHook* (*get_hk)(void) ; } mcxDispEntry ; int mcxDispatch ( int argc , const char* argv[] , const char* me , const char* syntax , mcxOptAnchor* dispatcher_options , dim n_options , mcxDispEntry* entry_dir , void (*report_version)(const char* me) ) ; /* These are one particular set of default/shared options * called the Giraffe options */ enum { MCX_DISP_GIRAFFE_HELP = 0 , MCX_DISP_GIRAFFE_APROPOS , MCX_DISP_GIRAFFE_VERSION , MCX_DISP_GIRAFFE_TEST , MCX_DISP_GIRAFFE_DEBUG , MCX_DISP_GIRAFFE_SET , MCX_DISP_GIRAFFE_NOP , MCX_DISP_GIRAFFE_AMOIXA , MCX_DISP_GIRAFFE_UNUSED = MCX_DISP_GIRAFFE_AMOIXA + 2 } ; extern mcxOptAnchor mcxDispGiraffe[]; extern dim mcxDispGiraffeCount; extern mcxbits mcx_disp_giraffe_debug; extern mcxbool mcx_disp_giraffe_test; #endif apparix-07-261/util/err.h0000644002600400000120000001665210642147132012112 00000000000000/* (C) Copyright 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_err_h #define tingea_err_h #include #include "types.h" /* Experimental scheme for logging * Contains * Three axes that have scales: * - data 1 2 3 * CELL * LIST * AGGR * - function/code 1 2 3 4 * LINE * FUNCTION * MODULE * APP * - monitoring 1 2 3 4 5 * DEBUG * INFO * WARN * ERR * PANIC * * These scales correspond with * * what (data, what are its parameters) * how (function, what is changing) * pulse (anything) * * Several axes that are radio buttons: * - IO * - Thread * - gauge progress bars * - IP inter (process) * - SLOT1 custom * - SLOT2 custom * - SLOT3 custom * * The programmer associates one or more logging levels with a logging * statement. The user sets logging levels in terms of quietness. * Quietness is quantified as shown in the list below. It may be applied * to a single axis or to several axes simultaneously. * * x is silent * 5 is tersest monitoring level * 4 is tersest function/code level * 3 is tersest data level * 9 is tersest level possible, may exceed actual upper bound * 1 is yappiest level. * * Only those statements for which the quiet level is quieter than the * user-specified level will be printed. If the programmer combines several * axes generally all the corresponding levels are checked and all have to be * OK, unless the user has specified that she is happy if at least one level is * OK. This is done by including a literal 'V' in the MCXLOGTAG string or in * the corresponding command-line option (usually -q). * * MCXLOGTAG is of the following form: * * []<[dfgimstABC][0-9]>+[V] * * The optional is one of [19x] as described above. The rest are * pairs consisting of an indicator * * d data * f function * g gauge/progress * i IO * m monitoring * n network * t thread * A custom axis 1 * B custom axis 1 * C custom axis 1 * * followed by a level. Each indicator specifies an axis; each axis has its * own scale and number of steps on the scale (see above). Finally, a 'V' * occurring anywhere signifies that OR logic is applied to loggin clauses * rather than AND logic. * * The lead tag sets a logging level for all axes simultaneously as follows: * 1 MCX_LOG_ALL * 9 MCX_LOG_TERSER * 8 MCX_LOG_TERSE * x MCX_LOG_NONE */ extern mcxbits mcxLogLevel; /* When called this one optionally checks environment variable * MCXLOGTAG to set the logging levels mcxLogLevelSetByString */ void mcxLogSetFILE ( FILE* fp , mcxbool ENV_LOG ) ; /* When writing to this file embed the print statement in an if statement * that checks whether your priority is ok with mcxLogGet. * This is paramount with GAUGE type logging as a GAUGE = x setting * may indicate that the user is logging to a shared stream. */ FILE* mcxLogGetFILE ( void ) ; extern volatile int mcxLogSigGuard ; void mcxLogSig ( int sig ) ; /* ******************** data */ #define MCX_LOG_CELL 1 << 0 /* node, point, scalar */ #define MCX_LOG_LIST 1 << 1 /* list, tree, hash */ #define MCX_LOG_AGGR 1 << 2 /* everything else */ #define MCX_LOG_DATA (MCX_LOG_CELL | MCX_LOG_LIST | MCX_LOG_AGGR) #define MCX_LOG_DATA0 MCX_LOG_CELL /* ******************** function */ #define MCX_LOG_LINE 1u << 3 #define MCX_LOG_FUNCTION 1u << 4 #define MCX_LOG_MODULE 1u << 5 #define MCX_LOG_APP 1u << 6 #define MCX_LOG_FUNC (MCX_LOG_LINE | MCX_LOG_FUNCTION | MCX_LOG_MODULE | MCX_LOG_APP) #define MCX_LOG_FUNC0 MCX_LOG_LINE /* ******************** monitoring */ #define MCX_LOG_DEBUG 1u << 7 #define MCX_LOG_INFO 1u << 8 #define MCX_LOG_WARN 1u << 9 #define MCX_LOG_ERR 1u << 10 #define MCX_LOG_PANIC 1u << 11 #define MCX_LOG_MON ( MCX_LOG_DEBUG| MCX_LOG_INFO | MCX_LOG_WARN | MCX_LOG_ERR| MCX_LOG_PANIC ) #define MCX_LOG_MON0 MCX_LOG_DEBUG /* ********************* unimodal axes */ #define MCX_LOG_IO 1u << 12 #define MCX_LOG_IP 1u << 13 #define MCX_LOG_THREAD 1u << 15 #define MCX_LOG_NETWORK 1u << 16 #define MCX_LOG_ASPECTS ( MCX_LOG_IO | MCX_LOG_IP | MCX_LOG_THREAD | MCX_LOG_GAUGE | MCX_LOG_NETWORK ) /* ********************* miscellaneous*/ #define MCX_LOG_GAUGE 1u << 17 /* ********************* control */ #define MCX_LOG_AND 1u << 18 #define MCX_LOG_OR 1u << 19 #define MCX_LOG_NULL 1u << 20 /* turns of logging */ /* ********************* unspecified */ #define MCX_LOG_SLOT1 1u << 22 #define MCX_LOG_SLOT2 1u << 22 #define MCX_LOG_SLOT3 1u << 23 #define MCX_LOG_SLOT ( MCX_LOG_SLOT1 | MCX_LOG_SLOT2 | MCX_LOG_SLOT3 ) /* ********************* all / terse */ #define MCX_LOG_NONE 0 #define MCX_LOG_VERBOSE ( MCX_LOG_CELL | MCX_LOG_LINE | MCX_LOG_DEBUG | MCX_LOG_SLOT | MCX_LOG_ASPECTS ) #define MCX_LOG_TERSER ( MCX_LOG_PANIC | MCX_LOG_AGGR | MCX_LOG_APP ) #define MCX_LOG_TERSE ( MCX_LOG_TERSER | MCX_LOG_ASPECTS ) #define MCX_LOG_UNIVERSE ( MCX_LOG_DATA | MCX_LOG_FUNC | MCX_LOG_MON | MCX_LOG_SLOT | MCX_LOG_ASPECTS ) /* ********************* unused */ #define MCX_LOG_UNUSED 1u << 24 void mcxLogLevelSetByString ( const char* str ) ; void mcxLog ( mcxbits level_programmer , const char* tag , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif ; mcxbool mcxLogGet ( mcxbits level_programmer ) ; void mcxLog2 ( const char* tag , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void mcxTell ( const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void mcxTellf ( FILE* fp , const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif ; void mcxWarn ( const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void mcxErr ( const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; void mcxErrf ( FILE* fp , const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif ; void mcxDie ( int status , const char *caller , const char *fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif ; void mcxTellFile ( FILE* fp ) ; void mcxWarnFile ( FILE* fp ) ; void mcxErrorFile ( FILE* fp ) ; void mcxFail ( void ) ; void mcxExit ( int val ) ; #endif apparix-07-261/util/tok.h0000644002600400000120000000462510642147132012114 00000000000000/* (C) Copyright 2005, 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_tok #define tingea_tok #include #include "inttypes.h" #include "types.h" #include "list.h" #include "ting.h" /* This is a first sketchy attempt at some parse/tokenize routines. * The scope is not very well defined yet. Should it do basic constructs * only, or aim for more power, possibly aided by callbacks, and * god forbid, a state description? * * TODO * quoted strings not yet implemented! * SGML not yet implemented! * * unify with mcxIOExpect, possibly stuff from ding.h * wide chars? */ #define MCX_TOK_MODE_UNIX 1 /* Unix escapes, including esc newlines */ #define MCX_TOK_MODE_QUOTED 2 /* Quotes delimit tokens, hide brackets */ #define MCX_TOK_MODE_PLAIN 4 #define MCX_TOK_MODE_SGML 8 /* &code; other? */ #define MCX_TOK_DEL_WS 16 /* only delimiting whitespace */ /* Returns first character not matching fbool, NULL if none. */ char* mcxTokSkip ( const char* offset , int (*fbool)(int c) , ofs len ) ; /* * Accounts for nesting. * Will do '}', ')', ']', '>', assuming one of several conventions. */ mcxstatus mcxTokMatch ( const char* offset , char** end , mcxbits mode , ofs len /* considered if >= 0 */ ) ; /* * Find some token, skipping over expressions. * Either *pos == NULL and retval == STATUS_FAIL * or *pos != NULL and retval == STATUS_OK * or *pos != NULL and retval == STATUS_DONE */ mcxstatus mcxTokFind ( const char* offset , char* tok /* Only tok[0] considered for now! */ , char** pos , mcxbits mode , ofs len /* considered if >= 0 */ ) ; mcxLink* mcxTokArgs ( const char* str , long str_len , int* n_args , mcxbits opts ) ; typedef struct { mcxTing* key ; mcxLink* args ; mcxbits opts ; } mcxTokFunc ; void mcxTokFuncFree ( mcxTokFunc* tf ) ; mcxstatus mcxTokExpectFunc ( mcxTokFunc* tf , const char* str , dim str_len , char** z , int n_min , int n_max , int *n_args ) ; #endif apparix-07-261/util/ting.h0000644002600400000120000002706410642147132012262 00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_ting #define tingea_ting #include "types.h" typedef struct { char *str ; dim len ; dim mxl ; } mcxTing ; /* ************************************************************************** * * ** Implementation notes (a few). * * Synopsis * This little module provides an objectified C-string compatible interface * to strings. * Some philosophy * Do not mind the overhead of 2*sizeof(int) bytes per ting. * If you have humongous amounts of small strings, use C-strings. Optionally * you can do the needed char manipulation in a ting used as scratch-space * using the ting interface, then create a normal string once you are done. * Use mcxTinguish to avoid copying if needed. * Feel free to use the str member with routines from * or perhaps from ding.h. Just remember to treat it as a const object * when doing so. * Applications * Zoem is the macro processor that processes the zoem language. It is very * string-heavy and its string operations are entirely based on the ting * module. * Caveat * Nearly all routines return a NULL pointer to indicate malloc failure. * Data structure * str: array of chars * * len: length of string in str (excluding '\0') * *(str+len) == '\0' * * mxl: current allocated number of writable char's (excluding '\0') * Allocated amount is mxl+1 * *(str+mxl) == '\0' - but don't count on that. * Notes * mcxTingEnsure is the only routine allowed to fiddle with mxl. * (apart from mcxTingInit which sets it to zero). * * Future idea * mcxTingFinalize, (realloc to length) * * Routines marked `!' will NOT accept ting==NULL argument. * Routines marked `#' should not be called other than by ting routines * * _ #Init _ * / \ * Ensure <--- #Instantiate * / \ \ * Empty !Splice New,Write,Print,PrintAfter * NWrite | * | * Append,Insert,Delete,PrintSplice */ /* ************************************************************************** * * ** Various instantiation routines. */ /* Accepts NULL argument. * void arguments so that it can be used * as callback. * * Should ordinarily *not* be used, unless * you want to initialize a ting allocated * on the frame stack. */ void* mcxTingInit ( void* ting ) ; /* Accepts NULL argument. * Should ordinarily *not* be used. */ mcxTing* mcxTingInstantiate ( mcxTing* dst_ting , const char* str ) ; /* Accepts NULL argument. Does not affect * ting->str. used for preallocing, e.g. to * prepare for successive calls of Append. (see * also Empty). */ mcxTing* mcxTingEnsure ( mcxTing* ting , dim length ) ; /* Accepts NULL argument. The string part is * set to the empty string. * Can be used for preallocing. */ mcxTing* mcxTingEmpty ( mcxTing* ting , dim length ) ; /* ************************************************************************** * * ** Some freeing routines. */ /* Free members and shell struct * You pass the address of a variable, * loosely speaking. */ void mcxTingFree ( mcxTing **tingpp ) ; /* Free members and shell struct * Use with callbacks, e.g. * for freeing hash with tings in one go. */ void mcxTingFree_v ( void *tingpp ) ; /* Free members * Use for freeing array of ting; * e.g. as callback in mcxNFree. */ void mcxTingRelease ( void *ting ) ; /* ************************************************************************** * * ** A bunch of user-land creation routines. */ /* accepts NULL argument, maps to empty string. */ mcxTing* mcxTingNew ( const char* str ) ; /* accepts NULL argument, maps to empty string. */ mcxTing* mcxTingNNew ( const char* str , dim n ) ; /* accepts NULL argument. */ mcxTing* mcxTingWrite ( mcxTing* ting , const char* str ) ; /* accepts NULL argument. */ mcxTing* mcxTingNWrite ( mcxTing* ting , const char* str , dim n ) ; /* usurps argument. */ mcxTing* mcxTingify ( char* str ) ; /* destroys argument, returns str member. */ char* mcxTinguish ( mcxTing* ting ) ; /* ************************************************************************** * * ** Appending, inserting, deleting, shrinking. * Some can be used as creation routine (e.g. append). */ #define TING_INS_CENTER -3 #define TING_INS_OVERRUN -4 #define TING_INS_OVERWRITE -5 /* * The offset argument can be negative, for subscripting from the end. * * The n_delete argument can be nonnegative, or one of * TING_INS_CENTER center, (try to) overwrite without changing length. * TING_INS_OVERRUN overwrite till the end. * TING_INS_OVERWRITE (try to) overwrite without changing length. * * The n_copy argument is not magical like the previous two. * */ /* does NOT accept NULL argument. */ mcxstatus mcxTingSplice ( mcxTing* ting , const char* pstr , ofs d_offset /* negative offset refers to end */ , ofs n_delete /* special modes as documented above */ , dim n_copy ) ; /* accepts NULL argument. */ mcxTing* mcxTingInsert ( mcxTing* ting , const char* str , ofs offset ) ; /* accepts NULL argument. */ mcxTing* mcxTingNInsert ( mcxTing* ting , const char* str , ofs offset /* of ting->str */ , dim length /* of str */ ) ; /* accepts NULL argument. */ mcxTing* mcxTingAppend ( mcxTing* ting , const char* str ) ; /* accepts NULL argument. */ mcxTing* mcxTingKAppend ( mcxTing* ting , const char* str , dim n ) ; /* accepts NULL argument. */ mcxTing* mcxTingNAppend ( mcxTing* ting , const char* str , dim n ) ; /* accepts NULL argument. */ mcxTing* mcxTingDelete ( mcxTing* ting , ofs offset , dim width ) ; /* accepts NULL argument. */ mcxTing* mcxTingShrink ( mcxTing* ting , ofs length ) ; /* Fails only for memory reason */ mcxstatus mcxTingTackc ( mcxTing* ting , unsigned char c ) ; /* Fails if last char is not the same as c */ mcxstatus mcxTingTickc ( mcxTing* ting , unsigned char c ) ; /* ************************************************************************** * * ** A bunch of printf like routines. */ /* Accepts NULL argument. */ mcxTing* mcxTingPrint ( mcxTing* ting , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; /* Accepts NULL argument. */ mcxTing* mcxTingPrintAfter ( mcxTing* dst , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; /* Accepts NULL argument. * same offset and delete interface as * mcxTingSplice. */ mcxTing* mcxTingPrintSplice ( mcxTing* dst , ofs offset , ofs n_delete /* count of chars to delete, special modes */ , const char* fmt , ... ) #ifdef __GNUC__ __attribute__ ((format (printf, 4, 5))) #endif ; /* ************************************************************************** * * ** Miscellaneous. */ char* mcxTingStr ( const mcxTing* ting ) ; char* mcxTingSubStr ( const mcxTing* ting , ofs offset , ofs length /* use -1 to indicate remainder of string */ ) ; /* accepts NULL argument. */ mcxTing* mcxTingRoman ( mcxTing* dst , long x , mcxbool ucase ) ; /* accepts NULL argument. */ mcxTing* mcxTingInteger ( mcxTing* dst , long x ) ; /* accepts NULL argument. */ mcxTing* mcxTingDouble ( mcxTing* dst , double x , int decimals ) ; /* ************************************************************************** * * ** Comparing. */ /* compare two mcxTing* pointers */ int mcxTingCmp ( const void* t1 , const void* t2 ) ; /* compare two mcxTing* pointers */ int mcxTingRevCmp ( const void* t1 , const void* t2 ) ; /* compare two mcxTing** pointers */ int mcxTingPCmp ( const void* t1 , const void* t2 ) ; /* compare two mcxTing** pointers */ int mcxTingPRevCmp ( const void* t1 , const void* t2 ) ; /* compare two mcxKV** pointers by key as mcxTing* */ int mcxPKeyTingCmp ( const void* k1 , const void* k2 ) ; /* compare two mcxKV** pointers by key as mcxTing* */ int mcxPKeyTingRevCmp ( const void* k1 , const void* k2 ) ; /* ************************************************************************** * * ** Hashing. */ u32 (*mcxTingHFieByName(const char* id))(const void* ting) ; u32 mcxTingELFhash ( const void* ting ) ; u32 mcxTingHash ( const void* ting ) ; u32 mcxTingBJhash ( const void* ting ) ; u32 mcxTingCThash ( const void* ting ) ; u32 mcxTingDPhash ( const void* ting ) ; u32 mcxTingBDBhash ( const void* ting ) ; u32 mcxTingGEhash ( const void* ting ) ; u32 mcxTingOAThash ( const void* ting ) ; u32 mcxTingFNVhash ( const void* ting ) ; u32 mcxTingSvDhash ( const void* ting ) ; u32 mcxTingSvD2hash ( const void* ting ) ; u32 mcxTingSvD1hash ( const void* ting ) ; u32 mcxTingDJBhash ( const void* ting ) ; #endif apparix-07-261/util/ding.h0000644002600400000120000000322410673276153012244 00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_ding #define tingea_ding #include #include "types.h" #include "ting.h" char* mcxStrDup ( const char* str ) ; char* mcxStrNDup ( const char* str , dim n ) ; /* * if len < 0, strlen(p) is used. */ dim mcxStrCountChar ( const char* p , char c , ofs len /* -1 for don't know */ ) ; char* mcxStrChrIs ( const char* src , int (*fbool)(int c) , ofs len /* -1 for don't know */ ) ; char* mcxStrChrAint ( const char* src , int (*fbool)(int c) , ofs len /* -1 for don't know */ ) ; char* mcxStrRChrIs ( const char* src , int (*fbool)(int c) , ofs offset /* -1 for don't know */ ) ; char* mcxStrRChrAint ( const char* src , int (*fbool)(int c) , ofs offset /* -1 for don't know */ ) ; #define MCX_MEMPRINT_REVERSE 1 #define MCX_MEMPRINT_NOSPACE 2 /* Strides in char units, treats/truncates each unit * as/to an 8-bit entity. */ mcxTing* mcxMemPrint ( mcxTing* ting , void* p , dim n_bytes , mcxbits flags ) ; int mcxEditDistance ( const char* s1 , const char* s2 , int* lcs ) ; int mcxSetenv ( const char* kv ) ; #endif apparix-07-261/util/list.h0000644002600400000120000000636010642147132012270 00000000000000/* (C) Copyright 2004, 2005, 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_list_h #define tingea_list_h #include "gralloc.h" #include "types.h" /* TODO: * - linkDelete linkRemove semantics interface documentation. * - make prev xor next link optional. * - make hidden pointer optional. * - provide interface that uses list struct. * - convenience interface for tying two chains together. * - list-to-array interface. */ /* * History. * The data structure used is similar to that by Jan van der Steen's pool.c * code, which used to be part of this library. So kudos to Jan. The * present implementation, which is a bit different, was not directly copied * nor modified. It descended from a botched linked list implementation * having it's own buffered storage. Only at that time I realized that the * right solution for lists and hashes is to have a private pool of gridmem, * rather than deriving it from a global pool (so that we still can defer * thread-safety to malloc). Right? * The present implementation was then derived from the botched linked list * and sanitized afterwards. The linked list.c is still slightly botched. */ /* Description * This provides a doubly linked list/link interface with buffered storage * (invisible to the user). The current interface operates entirely via * links, the commanding structure is hidden. Other interface types may * arise later. * * You can create a number of chains drawing memory from the same pool. * * It only provides basic link insertions and deletions as a convenience * interface, and does not maintain consistency checks, neither on links, * nor on storage. */ typedef struct mcxLink { struct mcxLink* next ; struct mcxLink* prev ; void* val ; } mcxLink ; /* Options: * same as for mcxGrimNew */ mcxLink* mcxListSource ( dim capacity_start , mcxbits options ) ; /* * This removes all links that have the same mother link as lk. * ! freeval doesn't do anything yet */ void mcxListFree ( mcxLink** lk , void freeval(void* valpp) /* (yourtype1** valpp) */ ) ; /* Creates new chain, that can later be tied to other chains. */ mcxLink* mcxLinkSpawn ( mcxLink* lk , void* val ) ; /* * This inspects prev and next and links them if possible. * * You can use the val pointer, immediately after deleting. * That makes it unsafe in threads (but you need locking anyway). * The feature is used in the hash library. */ mcxLink* mcxLinkDelete ( mcxLink* lk ) ; /* * This just deallocates the link. */ void mcxLinkRemove ( mcxLink* lk ) ; mcxLink* mcxLinkAfter ( mcxLink* prev , void* val ) ; mcxLink* mcxLinkBefore ( mcxLink* prev , void* val ) ; void mcxLinkClose ( mcxLink* left , mcxLink* right ) ; /* * Get the grim that serves this list */ mcxGrim* mcxLinkGrim ( mcxLink* lk ) ; #endif apparix-07-261/util/gralloc.h0000644002600400000120000000165610642147132012743 00000000000000/* (C) Copyright 2004, 2005, 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_gralloc_h #define tingea_gralloc_h #include "types.h" /* * gralloc; grid memory allocation; allocation of equally sized chunks */ typedef struct mcxGrim mcxGrim; #define MCX_GRIM_GEOMETRIC 1 #define MCX_GRIM_ARITHMETIC 2 mcxGrim* mcxGrimNew ( dim sz_unit , dim n_units /* initial capacity */ , mcxbits options ) ; void* mcxGrimGet ( mcxGrim* src ) ; void mcxGrimLet ( mcxGrim* src , void* mem ) ; dim mcxGrimCount ( mcxGrim* src ) ; dim mcxGrimMemSize ( mcxGrim* src ) ; void mcxGrimFree ( mcxGrim** src ) ; #endif apparix-07-261/util/compile.h0000644002600400000120000000444710651660536012761 00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_compile_h #define tingea_compile_h #ifndef TINGEA__TYPED_MINMAX # define TINGEA__TYPED_MINMAX 0 #endif #ifndef __GNUC__ # define MCX_GNUC_OK 0 # define inline /* no inline */ # define cpl__pure /* no pure */ # define cpl__const /* no const */ # define cpl__noreturn /* no noreturn */ # define cpl__malloc /* no malloc */ # define cpl__must_check /* no warn_unused_result */ # define cpl__deprecated /* no deprecated */ # define cpl__used /* no used */ # define cpl__unused /* no unused */ # define cpl__packed /* no packed */ # define likely(x) (x) # define unlikely(x) (x) #else #define MCX_GNUC_OK 1 #if __GNUC__ >= 3 # define inline __inline__ __attribute__ ((always_inline)) # define cpl__pure __attribute__ ((pure)) # define cpl__const __attribute__ ((const)) # define cpl__noreturn __attribute__ ((noreturn)) # define cpl__malloc __attribute__ ((malloc)) # define cpl__must_check __attribute__ ((warn_unused_result)) # define cpl__deprecated __attribute__ ((deprecated)) # define cpl__used __attribute__ ((used)) # define cpl__unused __attribute__ ((unused)) # define cpl__packed __attribute__ ((packed)) # define likely(x) __builtin_expect (!!(x), 1) # define unlikely(x) __builtin_expect (!!(x), 0) #else # define inline /* no inline */ # define cpl__pure /* no pure */ # define cpl__const /* no const */ # define cpl__noreturn /* no noreturn */ # define cpl__malloc /* no malloc */ # define cpl__must_check /* no warn_unused_result */ # define cpl__deprecated /* no deprecated */ # define cpl__used /* no used */ # define cpl__unused /* no unused */ # define cpl__packed /* no packed */ # define likely(x) (x) # define unlikely(x) (x) #endif #endif #endif apparix-07-261/util/getpagesize.h0000644002600400000120000000154010642147132013617 00000000000000/* Emulate getpagesize on systems that lack it. */ #ifndef HAVE_GETPAGESIZE #if !defined getpagesize && defined __BEOS__ # include # define getpagesize() B_PAGE_SIZE #endif #ifdef HAVE_UNISTD_H # include #endif #if !defined getpagesize && defined _SC_PAGESIZE # if !(defined VMS && __VMS_VER < 70000000) # define getpagesize() sysconf (_SC_PAGESIZE) # endif #endif #if !defined getpagesize && defined VMS # ifdef __ALPHA # define getpagesize() 8192 # else # define getpagesize() 512 # endif #endif #ifndef getpagesize # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else # ifdef NBPG # ifndef CLSIZE # define CLSIZE 1 # endif # define getpagesize() (NBPG * CLSIZE) # else # ifdef NBPC # define getpagesize() NBPC # endif # endif # endif #endif #endif /* not HAVE_GETPAGESIZE */ apparix-07-261/util/types.h0000644002600400000120000000455210642147132012462 00000000000000/* (C) Copyright 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef types_h #define types_h #include "inttypes.h" typedef unsigned long mcxbits ; typedef unsigned long mcxmode ; typedef unsigned long mcxenum ; /* mcxstatus defined below */ /* mcxbool defined below */ #define BIT_ON(var,bits) (var) |= (bits) #define BIT_OFF(var, bits) do { (var) |= (bits); (var) ^= (bits); } while (0) #define ALL_BITS_OFF 0 #define VOID_TO_UINT (unsigned) #define UINT_TO_VOID (void*) #define NOTHING do { } while (0) /* ************************************************************************** * * ** Implementation notes (a few). * * * The intent is that routines that return mcxstatus can define their own * values, so one must check the interface of a given routine as to what kind * of symbolic values it may return. * * For example, the opt library defines MCX_OPT_OK, MCX_OPT_NOARG, and * MCX_OPT_UNKNOWN. * * The intent is also that the OK value is always defined as zero -- it's * not the zero that counts but the fact that all OK values (e.g. STATUS_OK, * MCX_OPT_OK etc) are equal. One should be able to count on this. * If multiple ok values are possible, use one of mcxenum, mcxbits, mcxmode. * */ typedef enum { STATUS_OK = 0 , STATUS_FAIL , STATUS_DONE /* for iterator type interfaces (e.g. readLine) */ , STATUS_IGNORE /* for iterator type interfaces (line parser) */ , STATUS_NOMEM , STATUS_ABORT /* e.g. user response */ , STATUS_UNUSED /* use this as lower bound for new statuses */ } mcxstatus ; #ifndef FALSE typedef enum { FALSE = 0 , TRUE = 1 } mcxbool ; #else typedef int mcxbool ; #endif typedef enum { RETURN_ON_FAIL = 1960 , EXIT_ON_FAIL , SLEEP_ON_FAIL } mcxOnFail ; #define MCX_DATUM_THREADING 1 #define MCX_DATUM_FIND 2 #define MCX_DATUM_INSERT 4 #define MCX_DATUM_DELETE 8 #endif apparix-07-261/util/inttypes.h0000644002600400000120000000334710642147132013176 00000000000000/* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef tingea_inttypes_h #define tingea_inttypes_h #include #include #if UINT_MAX >= 4294967295 # define MCX_UINT32 unsigned int # define MCX_INT32 int #else # define MCX_UINT32 unsigned long # define MCX_INT32 long #endif typedef MCX_UINT32 u32 ; /* at least 32 bits */ typedef MCX_INT32 i32 ; /* at least 32 bits */ typedef unsigned char u8 ; /* at least 8 bits */ #ifndef ulong # define ulong unsigned long #endif /* dim is garantueed to be an unsigned type. * ofs is garantueed to be the corresponding signed type. */ #if 0 # define dim size_t # define ofs ssize_t #else typedef size_t dim; typedef ssize_t ofs; #endif #ifdef SIZE_MAX # define DIM_MAX SIZE_MAX #else # define DIM_MAX ((size_t)-1) #endif #ifdef SSIZE_MAX # define OFS_MAX SSIZE_MAX #else # define OFS_MAX LONG_MAX /* lame, reasonable stopgap */ #endif #ifdef SSIZE_MIN # define OFS_MIN SSIZE_MIN #else # define OFS_MIN LONG_MIN /* lame, reasonable stopgap */ #endif /* annotate 'unsigned due to prototype' * and related messages */ #define different_sign #define different_width #endif apparix-07-261/util/minmax.h0000644002600400000120000000412210642147132012600 00000000000000/* (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Stijn van Dongen * (C) Copyright 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with tingea, in the file COPYING. */ #ifndef minmax_h #define minmax_h #include "compile.h" #if MCX_GNUC_OK && TINGEA__TYPED_MINMAX /* these buggers do not nest, which I dislike */ # define MAX(x,y) \ ( { const typeof(x) _x = x; \ const typeof(y) _y = y; \ (void) (&_x == &_y); \ _x > _y ? _x : _y; \ } ) # define MIN(x,y) \ ( { const typeof(x) _x = x; \ const typeof(y) _y = y; \ (void) (&_x == &_y); \ _x < _y ? _x : _y; \ } ) #else /* The usual brain-damaged min and max, which do nest though. */ # define MAX(a,b) ((a)>(b) ? (a) : (b)) # define MIN(a,b) ((a)<(b) ? (a) : (b)) #endif #define ABS(x) (x) > 0 ? (x) : (x) < 0 ? (-(x)) : 0 /* The first version cannot be used recursively. * I don't like this at all I think, which is why I turned it off. */ #if 0 && MCX_GNUC_OK # define SIGN(a) \ __extension__ \ ( { typedef _ta = (a) \ ; _ta _a = (a) \ ; _a > 0 \ ? 1 \ : _a < 0 \ ? -1 \ : 0 \ ; } \ ) #else # define SIGN(a) \ ((a) > 0 ? 1 : !(a) ? 0 : -1) #endif #endif apparix-07-261/util/tr.h0000644002600400000120000001035710642147132011743 00000000000000/* (C) Copyright 2005, 2006, 2007 Stijn van Dongen * * This file is part of tingea. You can redistribute and/or modify tingea under * the terms of the GNU General Public License; either version 3 of the License * or (at your option) any later version. You should have received a copy of * the GPL along with tingea, in the file COPYING. */ #ifndef tingea_tr #define tingea_tr #include #include "ting.h" #include "types.h" #include "inttypes.h" /* * README * This interface is not POSIX compliant. It might evolve to * optionally be indeed. * However, given some of the braindeadliness of POSIX tr compliance, * I don't think the worlds needs another tr implementation. * My gripe is mainly about derailed syntax such as '[:alpha:0'. * It should go down in a ball of flames, not happily parse. * To be honest, I don't know for sure whether this is a POSIX * lack of requirement or an implementation choice. * * I did choose to follow most of the POSIX syntax. It is probably * a sign of weakness. * This interface should be able to do everything a POSIX interface can, * possibly more. * * - It allows separate specification of src, dst, del and squash sets. * - Provisionally we accept "^spec" to indicate complement, * for any of src dst del squash sets. * - It uses [*c*20] to denote repeats, rather than [c*20]. * rationale: do not slam door shut on new syntax. * - It does not recognize '[a-z]' ranges, only 'a-z'. * rationale: none. If ever, notation will be [-a-z] or similar. * - The magic repeat operator [*c#] stops on boundaries * rationale: I like it. * A boundary is introduced by stop/start of ranges and classes. * - The magic repeat operator [*c*] does not stop on boundaries. * - For now, the interface does 1) deletion, 2) translation, 3) squashing. * in the future it may provide a custom order of doing things. * * * Apart from the fact that you cannot have '\0' in C strings, everything * here should work for '\0' as well - specifically the mcxTrTable structure. * However, the current interface uses C strings for dst and src and C strings * for data. * * More documentation to follow. * */ extern const char* mcx_tr_err; extern mcxbool mcx_tr_debug; typedef struct { u32 tlt[256] ; mcxbits modes ; } mcxTR ; #define MCX_TR_DEFAULT 0 #define MCX_TR_TRANSLATE 1 << 1 #define MCX_TR_SOURCE 1 << 2 #define MCX_TR_DEST 1 << 3 #define MCX_TR_SQUASH 1 << 4 #define MCX_TR_DELETE 1 << 5 #define MCX_TR_SOURCE_C 1 << 6 #define MCX_TR_DEST_C 1 << 7 #define MCX_TR_DELETE_C 1 << 8 #define MCX_TR_SQUASH_C 1 << 9 #define MCX_TR_COMPLEMENT 1 << 10 mcxstatus mcxTRloadTable ( mcxTR* tr , const char* src , const char* dst , const char* set_delete , const char* set_squash , mcxbits modes ) ; /* returns new length of string. * fixme: document map/squash semantics. */ ofs mcxTRtranslate ( char* src , mcxTR* tr ) ; ofs mcxTingTranslate ( mcxTing* src , mcxTR* tr ) ; ofs mcxTingTr ( mcxTing* txt , const char* src , const char* dst , const char* set_delete , const char* set_squash , mcxbits flags ) ; /* Accepts e.g. \012 and sets *value to 10. * idem \xa0 and \n (\t, \r, \b etc) * Does *not* yet accept \0xa0 * * Returns next parsable character. * * This interface should be moved to ding. */ char* mcxStrEscapedValue ( const char* p , const char* z , int *value ) ; /* * returns a ting containing all the characters according to bits. * bits accept * MCX_TR_SOURCE * MCX_TR_SOURCE_C * MCX_TR_SQUASH * MCX_TR_SQUASH_C * MCX_TR_DELETE * MCX_TR_DELETE_C * * NOTE * MCX_TR_DEST * MCX_TR_DEST_C * are not yet implemented. * * NOTE DANGER SIGN * tr no longer contains information on complements that were * used in constructing it. * The complements that bits refer to is simply the information * present in tr. * So a source of "^a-z" given to mcxTRloadTable * and MCX_TR_SOURCE_C given to mcxTRsplash * result in a string containing all of a-z. */ mcxTing* mcxTRsplash ( mcxTR* tr , mcxbits bits ) ; #endif apparix-07-261/src/0000777002600400000120000000000010673731737011053 500000000000000apparix-07-261/src/Makefile.am0000644002600400000120000000040110332242370012774 00000000000000## Process this file with automake to produce Makefile.in ## $Id: Makefile.am,v 1.3 2005/11/02 23:00:08 flux Exp $ INCLUDES = -I$(top_srcdir) bin_PROGRAMS = apparix apparix_SOURCES = apparix.c version.c EXTRA_DIST = version.h LDADD = ../util/libutil.a apparix-07-261/src/Makefile.in0000644002600400000120000003056110673721154013031 00000000000000# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ SOURCES = $(apparix_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = apparix$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_apparix_OBJECTS = apparix.$(OBJEXT) version.$(OBJEXT) apparix_OBJECTS = $(am_apparix_OBJECTS) apparix_LDADD = $(LDADD) apparix_DEPENDENCIES = ../util/libutil.a DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(apparix_SOURCES) DIST_SOURCES = $(apparix_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ INCLUDES = -I$(top_srcdir) apparix_SOURCES = apparix.c version.c EXTRA_DIST = version.h LDADD = ../util/libutil.a all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(mkdir_p) "$(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" || exit 1; \ 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) apparix$(EXEEXT): $(apparix_OBJECTS) $(apparix_DEPENDENCIES) @rm -f apparix$(EXEEXT) $(LINK) $(apparix_LDFLAGS) $(apparix_OBJECTS) $(apparix_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apparix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: 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 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; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(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 "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_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 tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ 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"; \ $(mkdir_p) "$(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: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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 -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-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 -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-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 pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-info-am # 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: apparix-07-261/src/apparix.c0000644002600400000120000011410710673731165012576 00000000000000/* (c) Copyright 2005, 2006, 2007 Stijn van Dongen * * This file is part of apparix. You can redistribute and/or modify apparix * under the terms of the GNU General Public License; either version 3 of the * License or (at your option) any later version. You should have received a * copy of the GPL along with apparix, in the file COPYING. */ /* This file is largish, mostly because it was spaceously written. * NOTE * we do not do hash lookup of mark, because just building the hash * takes longer then a sequential search. * TODO * j/J is a bit of a kludge. On disk is always j. */ #include #include #include #include #include #include #include #include #include "version.h" #include "util/io.h" #include "util/alloc.h" #include "util/opt.h" #include "util/err.h" #include "util/tok.h" #include "util/ding.h" #include "util/ting.h" #include "util/types.h" enum { MY_OPT_ADD_JUMP , MY_OPT_ADD_PORTAL , MY_OPT_REHASH , MY_OPT_GREP , MY_OPT_DUMP , MY_OPT_LIST , MY_OPT_UNDO , MY_OPT_FAVOUR , MY_OPT_QUIETJUMP , MY_OPT_SQUASH_MARK , MY_OPT_SQUASH_DEST , MY_OPT_LIST_MARK , MY_OPT_LIST_DEST , MY_OPT_PURGE_DEST , MY_OPT_PURGE_MARK , MY_OPT_BACKUP , MY_OPT_BACKUP_NAMED , MY_OPT_CWD , MY_OPT_SHELL , MY_OPT_VERSION , MY_OPT_HELP , MY_OPT_APROPOS } ; static mcxbool quietjump = FALSE; static const char* us = "apparix"; static mcxbool use_cwd = FALSE; #define MY_PATH_MAX 1024 const char* shell_examples[] = { "BASH-style functions\n---" , "function to () {" , " if test \"$2\"; then" , " cd \"$(apparix \"$1\" \"$2\" || echo .)\";" , " else" , " cd \"$(apparix \"$1\" || echo .)\";" , " fi" , " pwd" , "}" , "function bm () {" , " if test \"$2\"; then" , " apparix --add-mark \"$1\" \"$2\";" , " elif test \"$1\"; then" , " apparix --add-mark \"$1\";" , " else" , " apparix --add-mark;" , " fi" , "}" , "function portal () {" , " if test \"$1\"; then" , " apparix --add-portal \"$1\";" , " else" , " apparix --add-portal;" , " fi" , "}" , "# function to generate list of completions from .apparixrc" , "function _apparix_aliases ()" , "{ cur=$2" , " dir=$3" , " COMPREPLY=()" , " if [ \"$1\" == \"$3\" ]" , " then" , " COMPREPLY=( $( cat $HOME/.apparix{rc,expand} | \\" , " grep \"j,.*$cur.*,\" | cut -f2 -d, ) )" , " else" , " dir=`apparix -favour rOl $dir 2>/dev/null` || return 0" , " eval_compreply=\"COMPREPLY=( $(" , " cd \"$dir\"" , " \\ls -d *$cur* | while read r" , " do" , " [[ -d \"$r\" ]] &&" , " [[ $r == *$cur* ]] &&" , " echo \\\"${r// /\\\\ }\\\"" , " done" , " ) )\"" , " eval $eval_compreply" , " fi" , " return 0" , "}" , "# command to register the above to expand when the 'to' command's args are" , "# being expanded" , "complete -F _apparix_aliases to" , "---\nCSH-style aliases\n---" , "alias to 'cd `(apparix -favour rOl \\!* || echo -n .)` && pwd'" , "alias bm 'apparix --add-mark \\!*'" , "alias portal 'apparix --add-portal \\!*'" , "---" , NULL } ; const char* syntax = "apparix [--add-mark|--add-portal] bookmark (...)"; mcxOptAnchor options[] = { { "--apropos" , MCX_OPT_DEFAULT | MCX_OPT_INFO , MY_OPT_APROPOS , NULL , "print this help" } , { "--version" , MCX_OPT_DEFAULT | MCX_OPT_INFO , MY_OPT_VERSION , NULL , "print version and exit" } , { "--bu" , MCX_OPT_DEFAULT , MY_OPT_BACKUP , NULL , "copy .apparixrc to .apparixrc.bu" } , { "-l" , MCX_OPT_DEFAULT , MY_OPT_LIST , NULL , "list all bookmarks" } , { "-d" , MCX_OPT_DEFAULT , MY_OPT_DUMP , NULL , "dump resource file to STDOUT" } , { "-u" , MCX_OPT_HASARG , MY_OPT_UNDO , "" , "undo last additions" } , { "-bu" , MCX_OPT_HASARG , MY_OPT_BACKUP_NAMED , "fname" , "copy .apparixrc to fname" } , { "--quiet-jump" , MCX_OPT_DEFAULT , MY_OPT_QUIETJUMP , NULL , "be quiet when jump fails" } , { "-v" , MCX_OPT_DEFAULT | MCX_OPT_INFO , MY_OPT_VERSION , NULL , "print version and exit" } , { "-h" , MCX_OPT_DEFAULT | MCX_OPT_INFO , MY_OPT_HELP , NULL , "print this help" } , { "--add-mark" , MCX_OPT_DEFAULT , MY_OPT_ADD_JUMP , NULL , "add jump bookmark, accepts trailing [mark [destination]]" } , { "--add-portal" , MCX_OPT_DEFAULT , MY_OPT_ADD_PORTAL , NULL , "add portal bookmark, accepts trailing [destination]" } , { "-sm" , MCX_OPT_HASARG , MY_OPT_SQUASH_MARK , "" , "take the first occurring destination for (cf -lm)" } , { "-sd" , MCX_OPT_HASARG , MY_OPT_SQUASH_DEST , "" , "remove other marks with the same destination (cf -ld)" } , { "-lm" , MCX_OPT_HASARG , MY_OPT_LIST_MARK , "" , "list all marks " } , { "-ld" , MCX_OPT_HASARG , MY_OPT_LIST_DEST , "" , "list all marks/destinations sharing destination with " } , { "-purge-dest" , MCX_OPT_HASARG , MY_OPT_PURGE_DEST , "" , "delete bookmarks where destination matches " } , { "-purge-mark" , MCX_OPT_HASARG , MY_OPT_PURGE_MARK , "" , "delete bookmarks where mark matches " } , { "-favour" , MCX_OPT_HASARG , MY_OPT_FAVOUR , "[lroLRO]*" , "(level, order, regular) duplicate resolution" } , { "--rehash" , MCX_OPT_DEFAULT , MY_OPT_REHASH , NULL , "re-expand portal bookmarks" } , { "--cwd" , MCX_OPT_DEFAULT , MY_OPT_CWD , NULL , "use getcwd(3) rather than reading pwd(1) output" } , { "--shell-examples" , MCX_OPT_DEFAULT , MY_OPT_SHELL , NULL , "output example macros for tcsh and bash" } , { NULL , 0 , 0 , NULL , NULL } } ; void show_version ( void ) { fprintf ( stdout , "apparix %s, %s\n" "(c) Copyright 2005, 2006 Stijn van Dongen. apparix comes with NO WARRANTY\n" "to the extent permitted by law. You may redistribute copies of apparix under\n" "the terms of the GNU General Public License.\n" , apxNumTag , apxDateTag ) ; } #define BIT_PURGE 1 #define BIT_LIST_DEST 2 typedef struct { int type /* 'j', 'e', 'J' */ ; mcxTing* mark ; mcxTing* dest ; mcxbits info ; int ord ; } bookmark ; typedef struct { bookmark* bms ; int bm_n ; int bm_N ; } folder ; static mcxTing* favour = NULL; int bookmark_cmp_j_over_J ( const void* bm1 , const void* bm2 ) { const bookmark* b1 = bm1 ; const bookmark* b2 = bm2 ; return b2->type - b1->type ; } int bookmark_cmp_ord ( const void* bm1 , const void* bm2 ) { return ((bookmark*)bm1)->ord - ((bookmark*)bm2)->ord ; } int bookmark_cmp_level ( const void* bm1 , const void* bm2 ) { const bookmark* b1 = bm1 ; const bookmark* b2 = bm2 ; return ( mcxStrCountChar(b1->dest->str, '/', b1->dest->len) - mcxStrCountChar(b2->dest->str, '/', b2->dest->len) ) ; } int bookmark_cmp_mark_favour ( const void* bm1 , const void* bm2 ) { int i=0 ; int cmp_result = 0 ; int c = strcmp(((bookmark*) bm1)->mark->str, ((bookmark*) bm2)->mark->str) ; if (c) return c ; for (i=0;ilen;i++) { int mode = (unsigned char) favour->str[i] ; switch(mode) { case 'l' : cmp_result = bookmark_cmp_level(bm1, bm2) ; break ; case 'L' : cmp_result = bookmark_cmp_level(bm2, bm1) ; break ; case 'o' : cmp_result = bookmark_cmp_ord(bm1, bm2) ; break ; case 'O' : cmp_result = bookmark_cmp_ord(bm2, bm1) ; break ; case 'r' : cmp_result = bookmark_cmp_j_over_J(bm1, bm2) ; break ; case 'R' : cmp_result = bookmark_cmp_j_over_J(bm2, bm1) ; break ; } if (cmp_result) break ; } return cmp_result ; } int bookmark_cmp_mark ( const void* bm1 , const void* bm2 ) { return strcmp(((bookmark*)bm1)->mark->str,((bookmark*)bm2)->mark->str) ; } int bookmark_cmp_dest ( const void* bm1 , const void* bm2 ) { const bookmark* mk1 = bm1 ; const bookmark* mk2 = bm2 ; int res ; if ((res = strcmp(mk1->dest->str,mk2->dest->str))) return res ; if ((res = (((int) mk2->info & BIT_LIST_DEST) - ((int) mk1->info & BIT_LIST_DEST)))) return res ; return strcmp(mk1->mark->str,mk2->mark->str) ; } void* bookmark_init ( void* bm_v ) { bookmark* bm = bm_v ; bm->type = 0 ; bm->mark = mcxTingEmpty(NULL, 12) ; bm->dest = mcxTingEmpty(NULL, 40) ; bm->info = 0 ; bm->ord = 0 ; return bm ; } folder* folder_new ( int bm_N ) { folder* fl = mcxAlloc(sizeof *fl, EXIT_ON_FAIL) ; bookmark* bms = mcxNAlloc (bm_N, sizeof *bms, bookmark_init, EXIT_ON_FAIL) ; fl->bm_n = 0 ; fl->bm_N = bm_N ; fl->bms = bms ; return fl ; } void folder_add ( folder* fl , int type , mcxbits info , const mcxTing* mark , const mcxTing* dest , int ord ) { int bm_n = fl->bm_n ; int bm_N = fl->bm_N ; bookmark* bm = NULL ; if (bm_n >= bm_N) { fl->bms = mcxNRealloc ( fl->bms , 2*bm_N , bm_N , sizeof fl->bms[0] , bookmark_init , EXIT_ON_FAIL ) ; bm_N = 2*bm_N ; } bm = fl->bms+bm_n++ ; bm->type = type ; bm->info = info ; mcxTingWrite(bm->dest, dest->str) ; if (mark) mcxTingWrite(bm->mark, mark->str) ; bm->ord = ord ; fl->bm_n = bm_n ; fl->bm_N = bm_N ; } #if 0 /* not used */ int folder_dups ( folder* fl_any ) { bookmark* bm = fl_any->bms+1 ; int n_dup = 0 ; while (bmbms + fl_any->bm_n) { if (!strcmp(bm[0].mark->str, bm[-1].mark->str)) n_dup++ ; bm++ ; } return n_dup ; } /* this is broken when both contain same mark multiple times */ int folder_dups2 ( folder* fl_uniq /* assume/pretend uniq */ , folder* fl_any ) { bookmark* bmu = fl_uniq->bms ; bookmark* bma = fl_any->bms ; int n_dup = 0 ; while (bmubms+fl_uniq->bm_n && bmabms+fl_any->bm_n) { int c = strcmp(bmu->mark->str, bma->mark->str) ; if (!c) { n_dup++ ; bma++ ; } else if (c < 0) bmu++ ; else bma++ ; } return n_dup ; } #endif void folder_addto ( folder* flall , folder* fl , mcxbool reuse_ord ) { bookmark* bm = fl->bms ; int ord = 0 ; while (bmbms+fl->bm_n) { folder_add(flall, bm->type, bm->info, bm->mark, bm->dest, reuse_ord ? bm->ord : ord++) ; bm++ ; } } /* warning: does not merge in the sense of preserving sort. */ folder* folder_merge ( folder* fl1 , folder* fl2 , mcxbool reuse_ord ) { folder* fl3 = folder_new(fl1->bm_n+fl2->bm_n) ; folder_addto(fl3, fl1, reuse_ord) ; folder_addto(fl3, fl2, reuse_ord) ; return fl3 ; } folder* expand_portal ( mcxIO* xfport , const char* dest ) { DIR * dir = opendir(dest) ; struct dirent *de ; mcxstatus status = STATUS_FAIL ; mcxTing* fqname = mcxTingEmpty(NULL, 512) ; mcxTing* dname = mcxTingEmpty(NULL, 512) ; folder* fl = folder_new(20) ; const char* s_exclude = getenv("APPARIXEXCLUDE") ; int ct = 0 ; while (1) { mcxbool syntaxerror = FALSE ; if (!dir) { mcxErr(us, "cannot open directory %s", dest) ; break ; } while ((de = readdir(dir))) { struct stat fstat ; mcxTingWrite(dname, de->d_name) ; mcxTingPrint(fqname, "%s/%s", dest, de->d_name) ; if ((unsigned char) dname->str[0] == '.') continue ; if (s_exclude && !syntaxerror) { const char* p = s_exclude ; mcxTing* check = mcxTingEmpty(NULL, 20) ; while (p) { const char* pp = strpbrk(p+1, ":,") ; unsigned char t = p[0] ; if (pp) mcxTingNWrite(check, p+1, pp-1-p) ; else mcxTingWrite(check, p+1) ; if (t == ':' && !strcmp(check->str, dname->str)) break ; else if (t == ',' && strstr(dname->str, check->str)) break ; else if (t != ':' && t != ',') { mcxErr(us, "syntax error in APPARIXEXCLUDE") ; syntaxerror = TRUE ; break ; } p = pp ; } mcxTingFree(&check) ; if (!syntaxerror && p) /* we hit an APPARIXEXCLUDE match */ continue ; } if (lstat(fqname->str, &fstat) < 0) { mcxErr(us, "error accessing node %s", fqname->str) ; break ; } if (!S_ISDIR(fstat.st_mode)) continue ; fprintf(xfport->fp, "j,%s,%s\n", dname->str, fqname->str) ; folder_add(fl, 'J', 0, dname, fqname, ct++) ; } closedir(dir) ; if (de) break ; status = STATUS_OK ; break ; } mcxTingFree(&fqname) ; mcxTingFree(&dname) ; return fl ; } mcxstatus bookmark_resync_portal ( folder* flport , mcxIO* xfport ) { int i ; const char* portname = xfport->fn->str ; int ct_expansion = 0 ; int ct_portal = 0 ; mcxIOclose(xfport) ; { struct stat fstat ; if (lstat(portname, &fstat) < 0) { if (errno == ENOENT) mcxTell(us, "portal file %s will be newly created", portname) ; else mcxErr(us, "cannot access %s, fingers crossed", portname) ; } } mcxIOrenew(xfport, NULL, "w") ; if (mcxIOopen(xfport, EXIT_ON_FAIL)) { mcxErr(us, "panic - portal file is gone, try --rehash") ; return STATUS_FAIL ; } for (i=0;ibm_n;i++) { folder* fl = expand_portal(xfport, flport->bms[i].dest->str) ; if (fl) ct_expansion += fl->bm_n , ct_portal++ ; } /* fixme fl memleak */ mcxTell (us, "expanded %d portals to %d destinations", ct_portal, ct_expansion) ; return STATUS_OK ; } mcxstatus bookmark_backup_rcfile ( const char* name , const char* dest ) { mcxTing* target = dest ? mcxTingPrint(NULL, "%s", dest) : mcxTingPrint(NULL, "%s.bu", name) ; mcxTing* cmd = !strcmp(target->str, "-") ? mcxTingPrint(NULL, "cat %s", name) : mcxTingPrint(NULL, "cp %s %s", name, target->str) ; int cpstat = system(cmd->str) ; if (cpstat) { mcxErr(us, "panic cannot write file %s", target->str) ; return STATUS_FAIL ; } return STATUS_OK ; } void bookmark_report ( const char* kind , folder* fl , const char* mark ) { int i ; for (i=0;ibm_n;i++) { bookmark* bm = fl->bms+i ; if (!strcmp(bm->mark->str, mark)) fprintf(stderr, "%s %s exists -> %s\n", kind, mark, bm->dest->str) ; } } mcxstatus bookmark_resync_rc ( folder* flreg , folder* flport , mcxIO* xfrc ) { int i ; const char* rcname = xfrc->fn->str ; folder* flmerge ; int n_purged = 0 ; const char* echo_s = getenv("APPARIXPURGE") ; mcxenum echo_mode = echo_s ? atoi(echo_s) : 0 ; mcxIOclose(xfrc) ; if (bookmark_backup_rcfile(xfrc->fn->str, NULL)) return STATUS_FAIL ; mcxIOrenew(xfrc, NULL, "w") ; if (mcxIOopen(xfrc, EXIT_ON_FAIL)) { mcxErr(us, "panic - rc file is gone, backup in %s.bu", rcname) ; return STATUS_FAIL ; } flmerge = flport ? folder_merge(flreg, flport, TRUE) : flreg ; qsort(flmerge->bms, flmerge->bm_n, sizeof flmerge->bms[0], bookmark_cmp_ord) ; for (i=0;ibm_n;i++) { bookmark* bm = flmerge->bms+i ; mcxbool purge = bm->info & BIT_PURGE ; FILE* fp = purge ? stdout : xfrc->fp ; int type = bm->type ; if (type == 'j' || type == 'J') (echo_mode == 0 && purge) ? fprintf(fp, "apparix --add-mark %s %s\n", bm->mark->str, bm->dest->str) : fprintf(fp, "j,%s,%s\n", bm->mark->str, bm->dest->str) ; else if (bm->type == 'e') (echo_mode == 0 && purge) ? fprintf(fp, "apparix --add-portal %s\n", bm->dest->str) : fprintf(fp, "e,%s\n", bm->dest->str) ; if (purge) n_purged++ ; } fprintf(stderr, "purged a flock of %d\n", n_purged) ; return STATUS_OK ; } void bookmark_squash ( folder* flreg , mcxIO* xfrc , const char* mark , mcxbool dest ) { int j ; const char* target_dest = NULL ; const char* target_mark = NULL ; if (!flreg->bm_n) return ; if (dest) { for (j=0;jbm_n;j++) { if (!strcmp(flreg->bms[j].mark->str, mark)) { if (target_mark) { mcxErr(us, "multiple targets for mark <%s>", mark) ; return ; } target_dest = flreg->bms[j].dest->str ; target_mark = mark ; } } } else target_mark = mark ; if (!target_mark) return ; if (!favour) favour = mcxTingNew("OLr") /* younger entries before older entries (keep latest & greatest) * deeper levels over shallower levels (irrelevant due to o) * regular before expansions (irrelevant due to o) */ ; qsort(flreg->bms, flreg->bm_n, sizeof flreg->bms[0], bookmark_cmp_mark_favour) ; if (dest) for (j=0;jbm_n;j++) { bookmark* bmj = flreg->bms+j ; if ( !strcmp(bmj->dest->str, target_dest) && strcmp(bmj->mark->str, target_mark) ) bmj->info |= BIT_PURGE ; } else for (j=1;jbm_n;j++) { bookmark* bmj = flreg->bms+j ; bookmark* bmi = bmj - 1 ; if (bmj->type == 'e') mcxErr(us, "internal error e-in-rc-folder") ; if ( !strcmp(bmi->mark->str, target_mark) && !strcmp(bmj->mark->str, target_mark) ) bmj->info |= BIT_PURGE ; } qsort(flreg->bms, flreg->bm_n, sizeof flreg->bms[0], bookmark_cmp_ord) ; } folder* bookmark_undo ( folder* flreg , folder* flport , int num ) { folder* flall = folder_merge(flreg, flport, TRUE) ; int i = flall->bm_n ; qsort(flall->bms, flall->bm_n, sizeof flall->bms[0], bookmark_cmp_ord) ; while (--num >= 0 && --i >= 0) flall->bms[i].info |= BIT_PURGE ; return flall ; } void bookmark_ungrep ( folder* flreg , mcxIO* xfrc , const char* destpat , const char* markpat ) { int i ; for (i=0;ibm_n;i++) { bookmark* bm = flreg->bms+i ; if ( (destpat && strstr(bm->dest->str, destpat)) || (markpat && strstr(bm->mark->str, markpat)) ) bm->info |= BIT_PURGE ; } } void bookmark_list ( const char* what , folder* fl ) { int i ; int n_mark, n_char ; fprintf(stdout, "--- %s\n", what) ; if (!fl->bm_n) return ; fputs(fl->bms[0].mark->str, stdout) ; n_mark = 1 ; n_char = fl->bms[0].mark->len ; for (i=1;ibm_n;i++) { bookmark* bm = fl->bms+i ; int len = strlen(bm->mark->str) ; if (n_char + 1 + len <= 70) fputc(' ', stdout) , n_char += 1 + len ; else fputc('\n', stdout) , n_char = 0 ; fputs(bm->mark->str, stdout) ; } fputc('\n', stdout) ; } mcxstatus bookmark_show ( folder* fl ) { int i ; for (i=0;ibm_n;i++) { bookmark* bm = fl->bms+i ; if (bm->type == 'j' || bm->type == 'J') fprintf ( stdout , "j %-12s %s\n" , bm->mark->str , bm->dest->str ) ; else if (bm->type == 'e') fprintf ( stdout , "%c %-12s %s\n" , bm->type , "" , bm->dest->str ) ; } return STATUS_OK ; } void logit ( const char* line ) { const char* logfile = getenv("APPARIXLOG") ; if (logfile) { mcxIO* xflog = mcxIOnew(logfile, "a") ; if (!mcxIOopen(xflog, RETURN_ON_FAIL)) fputs(line, xflog->fp) ; mcxIOclose(xflog) ; mcxIOfree(&xflog) ; } } mcxstatus bookmark_write_jump ( mcxIO* xfrc , const char* mark , const char* dest ) { mcxTing* line = mcxTingPrint(NULL, "j,%s,%s\n", mark, dest) ; fputs(line->str, xfrc->fp) ; fprintf(stderr, "added: %s -> %s\n", mark, dest) ; logit(line->str) ; mcxTingFree(&line) ; return STATUS_OK ; } folder* bookmark_parse ( mcxIO* xf , mcxbool expansion , folder** flportpp ) { mcxTing* line = mcxTingEmpty(NULL, 512) ; folder* flreg = folder_new(100) ; folder* flport = NULL ; mcxstatus status = STATUS_OK ; int lct = 0 ; int ord = 0 ; if (flportpp) flport = folder_new(10) ; while ( STATUS_OK == (status = mcxIOreadLine(xf, line, MCX_READLINE_CHOMP)) ) { mcxTing* typeting = NULL, *mark = NULL, *dest = NULL ; int n_args = 0 ; char* sth = NULL ; mcxLink* lk = NULL, *root = NULL ; unsigned char type = 0 ; lct++ ; if ( (sth = mcxStrChrAint(line->str, isspace, line->len)) && (unsigned char) sth[0] == '#' ) continue ; if (!(root = mcxTokArgs(line->str, line->len, &n_args, MCX_TOK_DEL_WS))) { mcxErr(us, "parse error at line %d (empty line?)\n", lct) ; break ; } lk = root->next ; typeting = lk->val ; if (typeting->len != 1) { mcxErr(us, "syntax error at line %d token %s", lct, typeting->str) ; continue ; } type = typeting->str[0] ; lk = lk->next ; if (type == 'j' && n_args == 3) { mark = lk->val ; dest = lk->next->val ; } else if (type == 'e' && n_args == 2) { mark = NULL ; dest = lk->val ; } else if (n_args > 3) { mcxErr(us, "comma in destination at line %d - skipping", lct) ; continue ; } else { mcxErr(us, "syntax error at line %d - skipping", lct) ; continue ; } if (type == 'j' && expansion) type = 'J' ; if (type == 'e' && flport) folder_add(flport, type, 0, mark, dest, ord++) ; else folder_add(flreg, type, 0, mark, dest, ord++) ; mcxTingFree(&typeting) ; root->val = NULL ; mcxListFree(&root, mcxTingFree_v) ; } if (flportpp) *flportpp = flport ; return flreg ; } /* - creates if not exists * - sets file pointer at EOF * - returns folder on success, NULL otherwise. */ folder* resource_prepare ( mcxIO* xf , folder** flportpp ) { mcxbool expansion = flportpp ? FALSE : TRUE ; const char* type = expansion ? "expansion" : "bookmark" ; folder* fl = NULL ; if (STATUS_OK == mcxIOopen(xf, RETURN_ON_FAIL)) fl = bookmark_parse(xf, expansion, flportpp) /* xf now positioned at EOF */ ; else { mcxIOrenew(xf, NULL, "w") ; if (mcxIOopen(xf, RETURN_ON_FAIL)) mcxErr(us, "cannot create %s file %s", type, xf->fn->str) ; else { mcxTell(us, "created %s file %s", type, xf->fn->str) ; fl = folder_new(0) ; if (flportpp) *flportpp = folder_new(0) ; } } return fl ; } int resolve_user ( bookmark* bmx , int n_same , bookmark* bmz ) { mcxTing* ans = mcxTingEmpty(NULL, 10) ; mcxIO* xfin = mcxIOnew("-", "r") ; int n_chosen = 0 ; int i ; FILE* fask = stderr ; mcxIOopen(xfin, EXIT_ON_FAIL) ; fprintf ( fask , "multiple hits for mark %s - please choose (abort with x)\n" , bmx->mark->str ) ; for (i=0;istr) ; fprintf(fask, "> ") ; fflush(NULL) ; mcxIOreadLine(xfin, ans, MCX_READLINE_CHOMP) ; if (ans->len && sscanf(ans->str, "%d", &n_chosen) == 1) { if (n_chosen <= 0 || n_chosen > n_same) n_chosen = -2 ; else n_chosen-- ; } else if (!strcmp(ans->str, "x")) n_chosen = -1 ; else n_chosen = -2 ; return n_chosen ; } mcxstatus attempt_jump ( folder* flreg , folder* flexp , mcxTing* mark , mcxTing* sub ) { mcxTing* dest = NULL ; folder* flall = folder_merge(flreg, flexp, FALSE) ; bookmark* bmx = NULL ; bookmark* bmz = flall->bms+flall->bm_n ; bookmark* bm = flall->bms ; mcxstatus status = STATUS_FAIL ; qsort(flall->bms, flall->bm_n, sizeof flall->bms[0], bookmark_cmp_mark) ; while (bm < bmz) { if ( (bm->type == 'j' || bm->type == 'J') && !strcmp(bm->mark->str, mark->str) ) { bmx = bm ; break ; } bm++ ; } while (1) { if (!bmx) break ; if ( bmx < bmz-1 && !strcmp(bmx->mark->str, bmx[1].mark->str) ) { int n_same = 2 ; bm = bmx+1 ; while (bmmark->str, bm[1].mark->str)) n_same++ , bm++ ; if (!favour) { int ans = resolve_user(bmx, n_same, bmz) ; if (ans < 0) { if (ans == -1) status = STATUS_ABORT ; break ; } else dest = bmx[ans].dest ; } else /* WARNING changed ordering in this segment */ { qsort(bmx, n_same, sizeof bmx[0], bookmark_cmp_mark_favour) ; dest = bmx->dest ; } } else dest = bmx->dest ; if (!dest) break ; if (sub) mcxTingPrintAfter(dest, "/%s", sub->str) ; fprintf(stdout, "%s\n", dest->str) ; status = STATUS_OK ; break ; } /* noteme: flall memleak */ return status ; } mcxTing* get_cwd ( void ) { char buf[MY_PATH_MAX+1] ; mcxTing* ret = NULL ; if (use_cwd) { if (!getcwd(buf, MY_PATH_MAX + 1)) mcxErr(us, "cannot get current directory") ; else ret = mcxTingNew(buf) ; } else { mcxIO* xfpipe = mcxIOnew("dummy-file-name", "r") ; FILE* p = popen("pwd", "r") ; if (p) { mcxTing *pwd = mcxTingEmpty(NULL, 256) ; xfpipe->fp = p /* its a hack */ ; mcxIOreadLine(xfpipe, pwd, MCX_READLINE_CHOMP) /* xfpipe: (donot) fixme (yet) warning danger sign todo */ /* readline: fixme check status */ ; if (!ferror(p)) { pclose(p) ; xfpipe->fp = NULL ; mcxIOfree(&xfpipe) ; ret = pwd ; } else mcxErr(us, "pwd does not want to play") ; } else mcxErr(us, "cannot execute pwd") ; } return ret ; } mcxstatus bookmark_add_jump ( folder* flreg , folder* flexp , mcxIO* xfrc , const char* argv[] , int argc , int n_arg_trailing ) { mcxTing* pwd = NULL ; const char* newmark ; const char* dest ; mcxstatus status = STATUS_OK ; dest = n_arg_trailing >= 2 ? argv[argc-1] : NULL ; if (n_arg_trailing > 2) mcxErr(us, "ignoring trailing arguments") ; newmark = dest ? argv[argc-2] : n_arg_trailing == 1 ? argv[argc-1] : NULL ; if (!dest) { if (!(pwd = get_cwd())) { mcxErr(us, "cannot get current directory") ; return STATUS_FAIL ; } dest = pwd->str ; } if (!newmark) { const char* sep = strrchr(dest, '/') ; if (!sep) mcxErr(us, "strange - no separator in %s", dest) , newmark = dest ; else newmark = sep+1 ; } if (strchr(newmark, ',')) { mcxErr(us, "I cannot handle commas in mark") ; status = STATUS_FAIL ; } if (!status) status = bookmark_write_jump(xfrc, newmark, dest) ; if (!status) { bookmark_report("bookmark", flreg, newmark) ; bookmark_report("expansion", flexp, newmark) ; } mcxTingFree(&pwd) ; return status ; } /* sets bits in flreg->bms */ /* sorts bookmarks */ mcxstatus bookmark_list_query ( folder* flreg , const char* mark , mcxbool target_dest ) { dim j ; for (j=0;jbm_n;j++) if (!strcmp(flreg->bms[j].mark->str, mark)) flreg->bms[j].info |= BIT_LIST_DEST ; if (target_dest) qsort(flreg->bms, flreg->bm_n, sizeof flreg->bms[0], bookmark_cmp_dest) ; for (j=0;jbm_n;j++) { bookmark* bm = flreg->bms+j ; if ( bm->info & BIT_LIST_DEST || ( target_dest && (j > 0 && !strcmp(bm->dest->str, (bm-1)->dest->str) && (bm-1)->info & BIT_LIST_DEST ) ) ) fprintf(stdout, "j,%s,%s\n", bm->mark->str, bm->dest->str) , bm->info |= BIT_LIST_DEST ; } return STATUS_OK ; } mcxstatus bookmark_add_portal ( mcxIO* xfrc , mcxIO* xfport , const char* argv[] , int argc , int n_arg_trailing ) { const char* dest= n_arg_trailing == 1 ? argv[argc-1] : NULL ; folder* fl = NULL ; mcxTing* pwd = NULL ; if (n_arg_trailing > 1) { mcxErr(us, "expecting [dest] trailing argument") ; return STATUS_FAIL ; } if (!dest) { if (!(pwd = get_cwd())) { mcxErr(us, "cannot get current directory") ; return STATUS_FAIL ; } dest = pwd->str ; } if ((fl = expand_portal(xfport, dest))) { mcxTing* line = mcxTingPrint(NULL, "e,%s\n", dest) ; fputs(line->str, xfrc->fp) ; fprintf(stderr, "added flock of %d in portal %s\n", fl->bm_n, dest) ; logit(line->str) ; mcxTingFree(&line) ; } else return STATUS_FAIL ; return STATUS_OK ; } mcxstatus show_or_jump ( folder* flreg , folder* flport , folder* flexp , const char* argv[] , int argc , int n_arg_trailing ) { int arg_ofs = argc - n_arg_trailing ; mcxTing* mark = n_arg_trailing > 0 ? mcxTingNew(argv[arg_ofs]) : NULL ; mcxTing* sub = n_arg_trailing > 1 ? mcxTingNew(argv[arg_ofs+1]) : NULL ; mcxstatus status = STATUS_FAIL ; if (!mark) { qsort(flport->bms, flport->bm_n, sizeof flport->bms[0], bookmark_cmp_dest) ; fprintf(stdout, "--- portals\n"); ; bookmark_show(flport) ; qsort(flexp->bms, flexp->bm_n, sizeof flexp->bms[0], bookmark_cmp_dest) ; fprintf(stdout, "--- expansions\n"); ; bookmark_show(flexp) ; qsort(flreg->bms, flreg->bm_n, sizeof flreg->bms[0], bookmark_cmp_dest) ; fprintf(stdout, "--- bookmarks\n"); ; return bookmark_show(flreg) ; } if ( STATUS_FAIL == (status = attempt_jump(flreg, flexp, mark, sub)) && !quietjump ) mcxErr(us, "I have nothing for %s", mark->str) ; return status ; } int main ( int argc , const char* argv[] ) { const char* h = getenv("HOME") ; const char* home = h ? h : "" ; const char* t = getenv("APPARIXTAG") ; const char* tag = t ? t : "" ; mcxTing* fnrc = mcxTingPrint(NULL, "%s/.%sapparixrc", home, tag) ; mcxTing* fnport = mcxTingPrint(NULL, "%s/.%sapparixexpand", home, tag) ; mcxIO* xfrc = mcxIOnew(fnrc->str, "r+") ; mcxIO* xfport = mcxIOnew(fnport->str, "r+") ; mcxstatus status = STATUS_FAIL ; const char* mark = NULL ; folder* flreg = NULL ; folder* flexp = NULL ; folder* flport = NULL /* only allow one of these modes */ ; enum { MODE_DEFAULT , MODE_LIST , MODE_SHOWARG , MODE_PURGE , MODE_UNDO , MODE_PURGE_MARK , MODE_SQUASH_MARK , MODE_SQUASH_DEST , MODE_LIST_DEST , MODE_LIST_MARK , MODE_REHASH , MODE_BACKUP , MODE_ADD_JUMP , MODE_ADD_PORTAL , MODE_SHELL } ; int n_mode = 0 ; int mode = MODE_DEFAULT ; const char* mode_arg = NULL ; int num = 0 ; mcxstatus parseStatus = STATUS_OK ; mcxOption* opts, *opt ; int n_arg_read = 0 ; int n_arg_trailing = 0 ; mcxOptAnchorSortById(options, sizeof(options)/sizeof(mcxOptAnchor) -1) ; if ( !( opts = mcxOptExhaust (options, (char**) argv, argc, 1, &n_arg_read, &parseStatus) ) ) exit(0) ; for (opt=opts;opt->anch;opt++) { mcxOptAnchor* anch = opt->anch ; switch(anch->id) { case MY_OPT_HELP : case MY_OPT_APROPOS : mcxOptApropos(stdout, us, syntax, 20, MCX_OPT_DISPLAY_SKIP, options) ; return 0 ; case MY_OPT_QUIETJUMP : quietjump = TRUE ; break ; case MY_OPT_VERSION : show_version() ; exit(0) ; case MY_OPT_ADD_JUMP : mode = MODE_ADD_JUMP; n_mode++ ; break ; case MY_OPT_ADD_PORTAL : mode = MODE_ADD_PORTAL; n_mode++ ; break ; case MY_OPT_SQUASH_MARK : mode = MODE_SQUASH_MARK ; mark = opt->val ; n_mode++ ; break ; case MY_OPT_SQUASH_DEST : mode = MODE_SQUASH_DEST ; mark = opt->val ; n_mode++ ; break ; case MY_OPT_BACKUP_NAMED : mode = MODE_BACKUP; n_mode++ ; mode_arg = opt->val ; break ; case MY_OPT_LIST : mode = MODE_LIST; n_mode++ ; break ; case MY_OPT_LIST_MARK : mode = MODE_LIST_MARK; ; mark = opt->val ; n_mode++ ; break ; case MY_OPT_LIST_DEST : mode = MODE_LIST_DEST; ; mark = opt->val ; n_mode++ ; break ; case MY_OPT_DUMP : mode = MODE_BACKUP; n_mode++ ; mode_arg = "-" ; break ; case MY_OPT_BACKUP : mode = MODE_BACKUP; n_mode++ ; break ; case MY_OPT_REHASH : mode = MODE_REHASH; n_mode++ ; break ; case MY_OPT_UNDO : mode = MODE_UNDO; n_mode++ ; num = atoi(opt->val) ; break ; case MY_OPT_PURGE_DEST : mode = MODE_PURGE; n_mode++ ; mode_arg = opt->val ; break ; case MY_OPT_PURGE_MARK : mode = MODE_PURGE_MARK; n_mode++ ; mode_arg = opt->val ; break ; case MY_OPT_FAVOUR : favour = mcxTingNew(opt->val) ; break ; case MY_OPT_SHELL : mode = MODE_SHELL; n_mode++ ; break ; case MY_OPT_CWD : use_cwd = TRUE ; break ; } } if (n_mode > 1) mcxDie(1, us, "arguments specify multiple modes") ; if (mode == MODE_SHELL) { const char** exline = shell_examples ; while (*exline) fprintf(stdout, "%s\n", *exline) , exline++ ; return STATUS_OK ; } else if (mode == MODE_BACKUP) return bookmark_backup_rcfile(xfrc->fn->str, mode_arg) ; if (!(flreg = resource_prepare(xfrc, &flport))) return STATUS_FAIL ; if (mode == MODE_REHASH) return bookmark_resync_portal(flport, xfport) ; if (!(flexp = resource_prepare(xfport, NULL))) return STATUS_FAIL ; n_arg_trailing = argc - n_arg_read - 1 /* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ ; switch(mode) { case MODE_PURGE : bookmark_ungrep(flreg, xfrc, mode_arg, NULL) ; status = bookmark_resync_rc(flreg, flport, xfrc) ; break ; case MODE_UNDO : { folder* flall = bookmark_undo(flreg, flport, num) ; status = bookmark_resync_rc(flall, NULL, xfrc) ; } break ; case MODE_LIST : bookmark_list("expansions", flexp) ; bookmark_list("bookmarks", flreg) ; break ; case MODE_PURGE_MARK : bookmark_ungrep(flreg, xfrc, NULL, mode_arg) ; status = bookmark_resync_rc(flreg, flport, xfrc) ; break ; case MODE_SQUASH_DEST : bookmark_squash(flreg, xfrc, mark, TRUE) ; status = bookmark_resync_rc(flreg, flport, xfrc) ; break ; case MODE_SQUASH_MARK : bookmark_squash(flreg, xfrc, mark, FALSE) ; status = bookmark_resync_rc(flreg, flport, xfrc) ; break ; case MODE_LIST_DEST : status = bookmark_list_query(flreg, mark, TRUE) ; break ; case MODE_LIST_MARK : status = bookmark_list_query(flreg, mark, FALSE) ; break ; case MODE_ADD_JUMP : status = bookmark_add_jump(flreg, flexp, xfrc, argv, argc, n_arg_trailing) ; break ; case MODE_ADD_PORTAL : status = bookmark_add_portal(xfrc, xfport, argv, argc, n_arg_trailing) ; break ; case MODE_DEFAULT : status = show_or_jump(flreg, flport, flexp, argv, argc, n_arg_trailing) ; break ; } mcxIOclose(xfrc) ; mcxIOclose(xfport) ; return status ; } apparix-07-261/src/version.c0000664002600400000120000000010410673731736012614 00000000000000const char *apxDateTag = "07-261"; const char *apxNumTag = "1.003"; apparix-07-261/src/version.h0000664002600400000120000000016410330427475012617 00000000000000#ifndef apx_version_h__ #define apx_version_h__ extern const char *apxDateTag; extern const char *apxNumTag; #endif apparix-07-261/doc/0000777002600400000120000000000010673731737011031 500000000000000apparix-07-261/doc/Makefile.am0000644002600400000120000000141210464731413012764 00000000000000## Process this file with automake to produce Makefile.in ## $Id: Makefile.am,v 1.4 2006-08-04 20:50:19 flux Exp $ TROFF = groff ZOEM = zoem TIDY = tidy docdir = $(datadir)/doc/$(PACKAGE) docdocdir = $(docdir) azms = apparix.azm docdoc_DATA = apparix.html apparix.ps $(azms) man_MANS = apparix.1 EXTRA_DIST = $(azms) $(docdoc_DATA) $(man_MANS) SUFFIXES = .1 .7 .azm .html .ps .azm.1: $(ZOEM) --allow=../src/apparix -d roff -i $< -o $@ $(ZOEM) --allow=../src/apparix -d roff -i $< -o $@ .azm.7: $(ZOEM) -d roff -i $< -o $@ $(ZOEM) -d roff -i $< -o $@ .1.ps: $(TROFF) -man $< > $@ .7.ps: $(TROFF) -man $< > $@ .azm.html: $(ZOEM) --allow=../src/apparix:date -d html -i $< -o $@ $(ZOEM) --allow=../src/apparix:date -d html -i $< -o $@ - $(TIDY) -e $@ apparix-07-261/doc/Makefile.in0000644002600400000120000002600710673721154013007 00000000000000# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 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@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdocdir)" NROFF = nroff MANS = $(man_MANS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; docdocDATA_INSTALL = $(INSTALL_DATA) DATA = $(docdoc_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ TROFF = groff ZOEM = zoem TIDY = tidy docdir = $(datadir)/doc/$(PACKAGE) docdocdir = $(docdir) azms = apparix.azm docdoc_DATA = apparix.html apparix.ps $(azms) man_MANS = apparix.1 EXTRA_DIST = $(azms) $(docdoc_DATA) $(man_MANS) SUFFIXES = .1 .7 .azm .html .ps all: all-am .SUFFIXES: .SUFFIXES: .1 .7 .azm .html .ps $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh uninstall-info-am: install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ done install-docdocDATA: $(docdoc_DATA) @$(NORMAL_INSTALL) test -z "$(docdocdir)" || $(mkdir_p) "$(DESTDIR)$(docdocdir)" @list='$(docdoc_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(docdocDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdocdir)/$$f'"; \ $(docdocDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdocdir)/$$f"; \ done uninstall-docdocDATA: @$(NORMAL_UNINSTALL) @list='$(docdoc_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(docdocdir)/$$f'"; \ rm -f "$(DESTDIR)$(docdocdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ 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"; \ $(mkdir_p) "$(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 $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdocdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done 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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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 mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-docdocDATA install-man install-exec-am: install-info: install-info-am install-man: install-man1 installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-docdocDATA uninstall-info-am uninstall-man uninstall-man: uninstall-man1 .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-docdocDATA install-exec install-exec-am install-info \ install-info-am install-man install-man1 install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-docdocDATA \ uninstall-info-am uninstall-man uninstall-man1 .azm.1: $(ZOEM) --allow=../src/apparix -d roff -i $< -o $@ $(ZOEM) --allow=../src/apparix -d roff -i $< -o $@ .azm.7: $(ZOEM) -d roff -i $< -o $@ $(ZOEM) -d roff -i $< -o $@ .1.ps: $(TROFF) -man $< > $@ .7.ps: $(TROFF) -man $< > $@ .azm.html: $(ZOEM) --allow=../src/apparix:date -d html -i $< -o $@ $(ZOEM) --allow=../src/apparix:date -d html -i $< -o $@ - $(TIDY) -e $@ # 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: apparix-07-261/doc/apparix.azm0000644002600400000120000007351410673731471013127 00000000000000\import{man.zmm} \setx{"man::year"}{\zinsert{stamp.year}} \setx{"man::month"}{\zinsert{stamp.month}} \setx{"man::day"}{\zinsert{stamp.day}} \setx{"man::tag"}{\zinsert{stamp.tag}} \setx{"man::stamp"}{\zinsert{stamp.stamp}} \setx{"man::year"}{\tr{{delete}{[:space:]}}{\"man::year"}} \setx{"man::month"}{\tr{{delete}{[:space:]}}{\"man::month"}} \setx{"man::day"}{\tr{{delete}{[:space:]}}{\"man::day"}} \setx{"man::stamp"}{\tr{{delete}{[:space:]}}{\"man::stamp"}} \setx{"man::tag"}{\tr{{delete}{[:space:]}}{\"man::tag"}} \setx{"man::tag"}{\"man::tag", \"man::stamp"} \set{"man::name"}{apparix} \set{"man::html-title"}{apparix} \set{"man::author"}{Stijn van Dongen} \set{"man::section"}{1} \"man::preamble" \${html}{\"man::maketoc"} \def{apparix}{\bf{apparix}} \sec{name}{NAME} \NAME{apparix}{bookmark directories and apparate inside them} \sec{synopsis}{SYNOPSIS} \par{ Apparix allows you to bookmark directories and later jump to them using the mark. It is possible to directly jump to subdirectories of the target directory. The contributed bash completion code facilitates completion both on bookmarks and subdirectories.} \par{ This manual page suffers from an excess in verbosity due to the many examples, explanations of the bells and whistles, and comparisons with other approaches to bookmarking. The fundamental idea is simply that typing a string of your own choosing takes you to the directory associated with it. Apparix does little more than maintaining a list of keys and values. It obtains directory names and listings, associates path names (values) with bookmarks (keys), and has some facilities for manipulating keys and values. The functions involving apparix (\tt{bm}, \tt{to}, and \tt{portal}) provide the user interface. } \sec{gs}{GETTING STARTED} \par{ Install apparix. This should be as easy as \it{./configure --prefix=$HOME/local && make && make install}, or perhaps a pre-packaged apparix is available for your system. Then get hold of the \bf{to}, \bf{bm} and \bf{portal} shell handles. These are either aliases or functions depending on your shell. Currently csh-style shells and bash are supported. Get the ones you need either from the \secref{files} section or by issuing \v{apparix --shell-examples}. Activate them by simply pasting them in a shell or adding them to the appropriate resource file, e.g. \v{$HOME/.cshrc} or \v{$HOME/.profile} (do not forget to \it{source} the resource file). The handles \bf{to}, \bf{bm} and \bf{portal} can of course be changed to any name desired. The following is a mock-up shell navigation session. } \verbatim{\:/ > \bf{pwd} /home/eez/cvs/xyz/tfa/faq/zut/bar/foo > \bf{ls} src/ doc/ CVS/ bin/ > \bf{bm xkr} # bookmark as xkr (funny name though) > \bf{bm} # bookmark as foo (trailing component is default) (later) > \bf{to xkr} # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (alternatively) > \bf{to xkr src} # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo/src (alternatively) > \bf{to foo} # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (later) > \bf{ls} aap pyu/ qua tim/ zut/ > \bf{pwd} /home/eez/another/branch/deep/down/under > \bf{portal} # bookmark as portal, imports tim zut pyu bookmarks added flock of 3 in portal /home/eez/another/branch/deep/down/under (later) > \bf{to zut} # cd to /home/eez/another/branch/deep/down/under/zut (later) > \bf{apparix} # show all bookmarks --- portals e /home/eez/another/branch/deep/down/under --- expansions j pyu /home/eez/another/branch/deep/down/under/pyu j tim /home/eez/another/branch/deep/down/under/tim j zut /home/eez/another/branch/deep/down/under/zut --- bookmarks j xkr /home/eez/cvs/xyz/tfa/faq/zut/bar/foo j foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo} \car{ In the last example apparix simply shows all its bookmarks. The first batch shows portals. The second batch shows secondary bookmarks expanded from portals. The third batch shows all regular bookmarks.} \par{ Apparix also allows subdirectory specification. If this is combined with the bash completion code it yields a powerful way of navigating container directories, i.e. directories that contain a large number of subdirectories. Refer to the \secref{sub} section.} \cpar{Further options}{ \synoptopt{--add-mark}{add jump bookmark} \synoptopt{--add-portal}{add portal bookmark} \synoptopt{-sm}{}{squash repeated marks} \synoptopt{-sd}{}{squash repeated destinations} \synoptopt{-lm}{}{list bookmarks with this mark} \synoptopt{-ld}{}{list destinations with mark indirection} \synoptopt{-favour}{}{duplicate resolution} \synoptopt{-purge}{pat}{delete bookmarks} \synoptopt{-purge-mark}{pat} \synoptopt{-d}{dump resource file to STDOUT} \synoptopt{-l}{list available jumps} \synoptopt{-u}{}{remove last additions} \synoptopt{--rehash}{re-expand portal bookmarks} \synoptopt{--bu}{create backup of resource file} \synoptopt{-bu}{}{create backup in } \synoptopt{--cwd}{use getcwd(3), not pwd(1)} \synoptopt{--shell-examples}{output example macros} } \sec{description}{DESCRIPTION} \par{ Apparix combines the properties of the \aref{http://www.skamphausen.de/cgi-bin/ska/CDargs}{cdargs} utility and the CDPATH shell mechanism for fast navigation through the file system. It is especially useful for visiting and documenting both often- and rarely-used locations. Apparix enables you to attach marks to locations and jump to those locations by loading the mark. Marking, unmarking and jumping are simple operations that are performed in the shell. All actions take effect immediately in all shells running. By setting up convenient aliases for marking and jumping the file system can be navigated in a fast and intuitive manner. The \secref{files} section lists aliases for csh-type shells and functions for bash, including the setup to equip the \bf{to} function with argument completion in bash.} \par{ This section contains some examples of the most common uses of apparix. \secref{options} contains a list of additional options available for listing, pruning, and squashing bookmarks.} \par{ \secref{notes} features a brief discussion of the advantages of apparix over other approaches such as setting up aliases for often visited directories, using symlinks, CDPATH, or a combination of these. \secref{history} explains the difference between cdargs and apparix. The sections \secref{dup}, \secref{sub}, \secref{tab}, \secref{mov}, and \secref{list} further below are also recommended reading.} \par{ Apparix works in a manner similar to cdargs. One usually invokes apparix by using pre-defined aliases. Here they will be called \bf{bm} for bookmark, \bf{portal} for a CDPATH-style bookmark and \bf{to} for initiating an apparition (aka jump). These aliases are found below in the \secref{files} section and can also be obtained by issuing} \verbatim{apparix --shell-examples} \par{ Suppose your user name is \it{eez} and your home directory is \v{/home/eez}. You often visit a directory called \v{/home/eez/cvs/xyz/tfa/faq/zut/bar/foo}. This is how to create and use a bookmark for foo} \verbatim{\:/ /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \bf{bm foo} added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \bf{cd} /home/eez> \bf{to foo} /home/eez/cvs/xyz/tfa/faq/zut/bar/foo>} \car{ If one bookmarks a directory by its trailing component as happened in this case, it is not necessary to specify the mark. By default apparix will use the trailing component as the mark. So} \verbatim{\:/ /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \bf{bm} added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo} \car{gives the same result.} \par{ Another scenario is where you have some directory that contains a largish number of subdirectories, all of which you would like to have bookmarked. If the subdirectories have distinctive names this can be achieved in one fell swoop by marking the parent directory as a \it{portal}. This is similar to adding the parent directory to the CDPATH environment variable, except that apparix bookmarks are not part of the cd namespace. It is argued in \secref{notes} that this is a good thing. Consider this:} \verbatim{\:/ /home/cvs/bagger/boemel/mcl/mcl/src> \bf{ls} alien/ CVS/ impala/ Makefile.am README shmcx/ attic/ giraffe/ lib/ Makefile.in shcl/ shmx/ contrib/ gmon.out Makefile mcl/ shmcl/ taurus/} \car{ Some of the subdirectories have not-so-distinct names such as \it{contrib} and \it{attic}, but they happen to be the directories least visited. Issuing:} \verbatim{\:/ /home/cvs/bagger/boemel/mcl/mcl/src> \bf{portal} [apparix] expanded 1 portal to 12 destinations} \car{ yields all of the subdirectories as destinations bookmarked by the last component of their path name. Incidentally, directory names such as \v{CVS} can be explicitly excluded from expansion by setting the environment variable \v{APPARIXEXCLUDE} appropriately \- refer to section \secref{environment}. } \par{ Bookmarks resulting from portal expansion are kept in a separate resource file (see \secref{files}). Portal expansions can be recreated by issuing} \verbatim{apparix --rehash} \car{ This is useful to reflect a change in the directory naming structure underneath a portal.} \sec{dup}{duplicate resolution} \par{ Apparix allows identical bookmarks to point to different locations. When asked to visit such a bookmark it will by default present a list of options.} \par{ The \genoptref{-favour}{} option can be used to automate resolution. \usearg{} is a sequence of single characters. The order in which they are given denote the order in which resolution rules are applied. This option is typically used in the definition of the \bf{to} function/alias or in the bash completion code.} \par{ Duplicates are allowed because it can be useful to overwrite a bookmark with a new location. The old bookmark is kept as a matter of policy. Use \genoptref{-sm} to explicitly squash duplicates.} \begin{itemize}{{compact}{1}{contiguous}{0}} \item{l} \car{ \it{level}; prefer paths with fewer components.} \item{L} \car{ reverse of the above.} \item{o} \car{ \it{bookmark order}; prefer older entries. Entries appearing earlier in the file are considered older, but the actual date of creating the bookmark is not stored. Refer to \secref{edit} for more information.} \item{O} \car{ reverse of the above.} \item{r} \car{ \it{regular first}; prefer regular bookmarks over portal expansion.} \item{R} \car{ reverse of the above.} \end{itemize} \par{ If there are still ties after the specified rules have been applied apparix will simply take the first matching option. This behaviour cannot be further specified as the program uses a non-stable ordering routine.} \par{ It is an absolute prerequisite that \genoptref{-favour} is used in the bash completion code. Otherwise completion will fail (for a duplicated bookmark) while apparix is waiting for input. Refer to the tab completion description below.} \sec{sub}{subdirectory specification} \par{ When jumping (apparating) you can specify an additional subdirectory after the bookmark. Apparix will append the subdirectory to the destination.} \par{ This is useful for projects with directory nodes corresponding with versions. Assume you have a directory structure such as this:} \verbatim{\:/ /x/y/z/OpusMagnum/v1/ /x/y/z/OpusMagnum/v2/ /x/y/z/OpusMagnum/v3/} \par{ It is probably easiest to simply bookmark the OpusMagnum directory in some way (say with bookmark \v{om}). You can then issue \vq{to om v2} to jump to \v{OpusMagnum/v2}. This is more flexible and maintainable than creating bookmarks \v{om1}, \v{om2}, \v{om3}. One could add OpusMagnum as a portal, but with generic names such as \v{v1} this is not a very extendible approach.} \par{ See also the tab completion description below - it is possible to tab-complete on subdirectories of the apparix jump directory.} \sec{tab}{tab completion} \par{ The bash tab completion code does two things. First, it is possible to tab-complete on apparix bookmarks themselves, showing a listing of all available bookmarks (or iterating through them in cyclic mode, depending on your bash settings). Second, once a bookmark has been given tab completion will list or iterate over all the subdirectories of the directory associated with that bookmark. Specifying a string after the bookmark will limit tab-completion to directories matching the shell-pattern in string. \it{Very} useful.} \par{ Be careful to not remove the \genoptref{-favour}{list} option from the bash completion code. It is necessary to resolve duplicate bookmarks. } \sec{edit}{editing bookmarks} \car{ Apparix appends new bookmarks to the end of the .apparixrc file. Nothing stops you from editing the file, and this is in fact recommended if for example you need to get rid of a bookmark and neither of \genoptref{-purge}, \genoptref{-purge-mark}, \genoptref{-sd}, \genoptref{-sm} fulfills your needs. It was an easy design choice not to equip apparix with editor capabilities.} \sec{mov}{copying and moving files} \par{ It is straightforward to copy or move files to locations known by apparix. Examples:} \verbatim{BASH and variants cp FOO $(apparix zoem) mv BAR $(apparix zoem doc) mv BAR $(apparix zoem doc)/test CSH and variants cp FOO `apparix zoem` mv BAR `apparix zoem doc`/test} \sec{list}{listing bookmarks} \par{ Simply issuing apparix gives you a list of bookmarks grouped into three categories, portals, expansions, and bookmarks. Use the \genoptref{-d} option to dump the resource file to STDOUT exactly as it is. This can be useful when you intend to use the \genoptref{-u}{num} option to remove bookmarks or portals that were most recently added.} \par{ Use \genoptref{-l} to list all available jumps without their destinations. The jumps are grouped into expansions resulting from portals and regular bookmarks.} \: \car{ \: Apparix currently uses \it{getcwd}(3) to obtain the path name \: of the current directory. On some machines this may include \: funny mount components, e.g. \: } \: \: \verbatim{\:/ \: \bf{/.automount/eek/root}/home/eez/cvs/xyz/tfa/faq/zut/bar/foo} \: \: \car{ \: Until apparix obtains a \: } \sec{options}{OPTIONS} \car{ For bookmarking and jumping apparix is best invoked by using the aliases (tcsh-variants) or functions (sh/bash) listed in \secref{files}. Apparix has a few options that are useful for pruning, squashing and rehasing bookmarks. These are best issued by invoking apparix directly.} \par{ If you are interested in marks or destinations matching a certain pattern, simply issue apparix without arguments and pipe it through your program of choice.} \par{ Unary options (those without arguments) usually start with two hyphens except for standardized options such as \genoptref{-h}. Options that take an argument can be converted to a unary key=value notation, e.g. \useopt{-purge-mark}{foo} is equivalent to \usekvp{--purge-mark}{foo}.} \par{ When invoked without arguments apparix will simply dump its bookmarks.} \begin{itemize} \item{\defopt{--add-mark}{add jump bookmark}} \car{ This options expects trailing \it{[mark [destination]]} argument(s). Both arguments are optional. If a single argument is given it is interpreted as a bookmark name to be mapped to the current directory. If two arguments are given the last argument is taken as the target directory. If no argument is given apparix will enlist the current directory as a target bookmarked by the trailing component of the directory path.} \item{\defopt{--add-portal}{add portal bookmark}} \car{ This option enlists a directory as a portal and adds all subdirectories as bookmarks. The name of the bookmark is simply the name of the subdirectory. By default the current directory is added as a portal. An optional trailing argument will override this behaviour and instead be interpreted as the portal location.} \item{\defopt{-sm}{}{squash repeated marks}} \car{ Apparix will squash bookmarks with mark \v{}. This is useful when a mark points to a versioned project, and the project is updated to a new version and a new directory.} \par{ Apparix will by default keep the last one occurring in the resource file (corresponding with \useopt{-favour}{O}). This option respects the \genoptref{-favour} option if given. Duplicating an already existing mark can be useful when it identifies a project for which the underlying directory changes every once in a while (e.g. the project is downloaded from external sources and comes with version information). It is not strictly necessary to squash bookmarks since \bf{to} functions/macros that are equipped with the \genoptref{-favour} option will generally resolve duplicate matches. } \item{\defopt{-sd}{}{squash repeated destinations}} \car{ All other bookmarks with the same destination as \v{} are removed. This is useful when a given destination has acquired multiple bookmarks and you decide to settle on a favourite. } \item{\defopt{-lm}{}{list bookmarks with this mark}} \car{ It lists all bookmarks \v{} (noting that it may point to multiple locations). } \item{\defopt{-ld}{}{list repeated destinations}} \car{ This lists all bookmarks \v{} (noting that it may point to multiple locations) and additionally lists all other bookmarks that share the destination with any of the first bookmarks. This allows one to predict the effect of issuing \v{apparix -sd }. } \item{\defopt{-purge}{pat}{delete bookmarks}} \car{ This deletes bookmarks where destination matches \genarg{pat}. All deleted bookmarks are printed to STDOUT. Thus if you regret deleting a bookmark it is easy to add it back. Portal specifications are never affected.} \item{\defopt{-purge-mark}{pat}} \car{ This deletes bookmarks where mark matches \genarg{pat}. Portal specifications are never affected.} \item{\defopt{-d}{dump resource file to STDOUT}} \car{ Dump resource file to STDOUT.} \item{\defopt{-l}{list available jumps}} \car{ List available jumps paragraph-style. Portal specifications themselves are excluded, and regular jumps and jumps resulting from portal expansions are listed under different headers.} \item{\defopt{-u}{}{remove last additions}} \car{ Remove last additions. Portal specifications and regular jumps are treated alike.} \item{\defopt{--rehash}{re-expand portal bookmarks}} \car{ Apparix will reread the resource file and reexpand portal locations. Useful if directories have been added, renamed, or removed. Refer to section \secref{environment} for the effect that the environment variable \v{APPARIXEXCLUDE} has on portal expansion.} \item{\defopt{-favour}{}{set duplicat resolution policy}} \car{ This option has its own section. Refer to \secref{dup}.} \item{\defopt{--cwd}{use getcwd(3), not pwd(1)}} \car{ By default aparix uses the program \it{pwd}(1) rather than the system call \it{getcwd}(3). On some systems it was found that the latter results in paths that contain machine-specific mount components. Appparix will use \it{getcwd}(3) when \genoptref{--cwd} is used.} \item{\defopt{--shell-examples}{output example macros}} \car{ This outputs example macros. They are also listed in the \secref{files} section though.} \item{\defopt{--bu}{create backup of the resource file}} \car{ This creates the backup file in .apparixrc.bu.} \item{\defopt{-bu}{fname}{create backup of the resource file}} \car{ This creates the backup file in \genarg{fname}. Use \genoptref{-d} or \useopt{-bu}{-} to dump to STDOUT.} \items{ {\defopt{-h}{show synopsis}} {\defopt{--apropos}{show synopsis}} } \car{ print synopsis of all options} \end{itemize} \sec{environment}{ENVIRONMENT} \'begin{itemize}{{compact}{0}{contiguous}{0}{align}{left}} \item{APPARIXEXCLUDE} \car{ This variable specifies exclusion behaviour when portals are expanded with the \v{--rehash} option. It has the following syntax: } \verbatim{\:/ <[:,][]>+} \car{ That is, a list of names with each name preceded by a colon or a comma. A colon indicates that \v{} triggers exclusion of directory names for which the trailing component is identical to \v{}. A comma indicates that \v{} triggers exclusion of directory names for which the trailing component contains \v{} as a substring. Consider: } \verbatim{\:/ export APPARIXEXCLUDE=:CVS:lib,tmp # A - example export APPARIXEXCLUDE=, # B - curiosity} \car{ The first excludes directory names \v{CVS} and \v{lib} and any directory name having \v{tmp} as a substring. The second example will effectively disable portals, as it speficies the empty string which is a substring of all strings. } \item{APPARIXTAG} \car{ This variable, if set, is incorporated into the names of the apparix resource files. By default these are \v{.apparixrc} and \v{.apparixexpand}. When APPARIXTAG is set to \v{} they become \v{.apparixrc} and \v{.apparixexpand}. This can be used e.g. to maintain different sets of bookmarks on different host machines. } \item{APPARIXLOG} \car{ This variable, if set, is interpreted as the name of a log file. The log file keeps track of all newly added bookmarks and portals without ever deleting anything, in the same format as the \v{.apparixrc} file. If this variable is not set nothing is tracked. } \item{APPARIXPURGE} \car{ This changes the way apparix dumps purged bookmarks to STDOUT. By default they are dumped as command lines that will reimport the bookmarks if issued (i.e. cut and pasted). By setting this variable to 1 purged bookmarks are dumped in the format used in the \v{.apparixrc} file. } \end{itemize} \sec{files}{FILES} \par{ You should use aliases or functions to make apparix really useful. Get them from apparix by giving it the --shell-examples option, or from further below. Note the fragment that provides \bf{to} argument completion in bash. } \begin{itemize}{} \item{$HOME/.apparixrc} \car{This is the primary resource file. There is usually no need to edit it by hand. Sometimes it can be useful to edit by hand to remove an unwanted bookmark; refer to \secref{edit}.} \item{$HOME/.apparixrc.bu} \car{ Apparix creates a back-up file whenever it is asked to remove entries from it. Refer to \secref{edit} for options inducing removal. You can explicitly require a backup to be made by either of \genoptref{--bu} or \genoptref{-bu}{fname}.} \item{$HOME/.apparixexpand} \car{ This contains bookmarks that are expanded from portals. A portal is simply some directory. The names of all subdirectories are taken as bookmarks that point to those subdirectories. This file can be recreated by issuing} \verbatim{apparix --rehash} \items{{$HOME/.bashrc} {$HOME/.tcshrc} {$HOME/.cshrc} } \car{ Add the code you need to the appropriate rc file. The macros and functions below point \it{cd}(1) in the right direction.} \end{itemize} \setx{"examples"}{\system{../src/apparix}{{--shell-examples}}} \apply{_#1{\!{\verbatim{\1}}}}{{\"examples"}} \par{More elaborate setups are possible. This CSH-style alias:} \verbatim{alias to '(test "x" != "x\\!*") && cd `(apparix -favour rOl \\!* || echo -n .)` || apparix -l'} \par{lists all available jumps if invoked without arguments.} \sec{notes}{NOTES} \par{ Below follow some comments on other approaches to file system navigation. \secref{history} explains the difference between the venerable \bf{cdargs} program and \bf{apparix}. } \par{ CDPATH is only useful in cases where a given directory has subdirectories with distinctive names. It does not usually scale well when there are more than a few paths in CDPATH. } \par{ Some people use aliases to jump to often visited directories. I was one of them for a period of ten years. The fact is, those aliases are cumbersome to create and remove and they clutter up the alias namespace. They can clash with executable names when the alias includes the \it{cd} part. This sometimes prohibits one from assigning the logical bookmark to a given location, especially when one has a lot of source code locations. They can clash with directory names when the aliases just expand to the location. This again means that sometimes a location cannot be assigned its logical bookmark. I have found that setting \it{cd} jumps aside in their own namespace improves file system navigation by a large factor. } \par{ It is also possible to create symlinks to often visited files. Again, creation and removal of these are cumbersome. One could of course create shell functions with a similar interface to apparix or cdargs to handle the symlink lifecycle. On Linux Weekly News \it{nix} suggested to put these symlinks in a single directory and add that directory to CDPATH. This is quite a neat trick and effectively creates a bookmark navigation system. } \par{ Still there are problems with the above approach. One problem with the symlink approach is that they are a bit awkward to edit. One could make a utility to wrap around the problem, but in the end the directory-with-symlinks would functionally be the same as apparix's \bf{.apparixrc} resource file, only more of a kludge. Another problem is that symlinks are awkard when traversing the file system. They confuse the notion of parent directory and '\v{cd ..}' mostly does the unexpected. Sometimes '\v{..}' has a different meaning to \bf{cd} than it has to another application, as one will trace back symlinks and the other will not. Finally, a minor objection is that I find it convenient to have bookmarks in a separate namespace than that of \it{cd}(1). Jumps are magical and it is natural to invoke them by a different method. This is in fact how apparix acquired its CDPATH behaviour. I used CDPATH to jump to a few particular source directories with distinct names that lay deeply hidden in some CVS directory. Once I started using apparix however, I would mistakenly issue \it{to} rather than \it{cd} to jump to those locations. My brain classified both types of jump in the same category. } \par{ Apparix (and cdargs) have another use besides jumping, namely annotation. Whenever I end up in an esoteric part of the file system and need to make a quick note of the location, I simply bookmark it. } \par{ On SlashDot, that eternal source of wisdom or alternatively the geek wheel of suffering, Clueless Moron offered the following gems.} \verbatim{\:/ mk() { eval ${1:-MKPWD}=\\"`pwd`\\"; } rt() { eval cd \\"\\$${1:-MKPWD}\\";pwd; } # type "mk" (as in "mark") and "rt" (as in "return") to mark # a directory and later go back to it. # Or give it a name: do "mk foo", and later on "rt foo"} \par{ This of course is a per-session mechanism, but noteworthy for its simplicity. I am not sure whether csh-style shells could offer an equivalent.} \par{ A feature shared by apparix and cdargs is that adding a bookmark immediately takes effect in all shells. There is no need to source some resource file, as the applications do this everytime they are invoked. It is fast, do not worry. } \""{ At LWN nix writes: At work I am stuck with ksh, which doesn't have pushd or popd. Solution: function pushd { PWDSTACK=${PWD}:${PWDSTACK} cd $1 } function popd { cd $(echo ${PWDSTACK:-${PWD}} | cut -d: -f 1) PWDSTACK=$(echo ${PWDSTACK} | cut -s -d: -f 2-) } function dirs { echo $PWDSTACK | tr ":" "\\n" | sed '/^$/d' } (warning: this code was written ten years ago when I barely knew shell scripting and not touched since then; it has notable problems, trivially fixed, with directories with names starting with minus signs). } \sec{bugs}{BUGS} \car{ The resource file parsing code thinks that parentheses are special. Also records are currently separated by commas. Accordingly, apparix will hitch if a path name contains a parenthesis or a comma.} \sec{author}{AUTHOR} \car{ Stijn van Dongen.} \sec{thanks}{THANKS} \par{ Stefan Kamphausen wrote \bf{cdargs}, the inspiration for apparix.} \par{ Sitaram Chamarty fixed up some of the existing bash code, and added the tab completion part (basing this on similar code in cdargs). He does not garantuee predictable or even pretty results if there are spaces in the directory names which you attempt to complete. \secref{author} would like to submit that spaces in path names are evil, and that the completion code seems to work in their evil presence anyway. Just \iref{bugs}{don't put commas} in path names.} \par{ The autotooled build environment was modified from a template written by Joost van Baal.} \sec{history}{HISTORY} \par{ Apparix was created to optimize a scenario that \aref{http://www.skamphausen.de/cgi-bin/ska/CDargs}{cdargs} does not support very well, namely where the mark (called \it{needle} in cdargs) is always known. As an additional feature apparix supports CDPATH-style behaviour and subdirectory specification. In other respects apparix is a much simpler application. \bf{cdargs} offers menu-based navigation of the file system and the bookmark list, which apparix does not.} \"man::postamble" apparix-07-261/doc/apparix.html0000664002600400000120000013777510673731472013321 00000000000000 apparix

18 Sep 2007    apparix 1.003, 07-261

NAME

apparix - bookmark directories and apparate inside them

SYNOPSIS

Apparix allows you to bookmark directories and later jump to them using the mark. It is possible to directly jump to subdirectories of the target directory. The contributed bash completion code facilitates completion both on bookmarks and subdirectories.

This manual page suffers from an excess in verbosity due to the many examples, explanations of the bells and whistles, and comparisons with other approaches to bookmarking. The fundamental idea is simply that typing a string of your own choosing takes you to the directory associated with it. Apparix does little more than maintaining a list of keys and values. It obtains directory names and listings, associates path names (values) with bookmarks (keys), and has some facilities for manipulating keys and values. The functions involving apparix (bm, to, and portal) provide the user interface.

GETTING STARTED

Install apparix. This should be as easy as ./configure --prefix=$HOME/local && make && make install, or perhaps a pre-packaged apparix is available for your system. Then get hold of the to, bm and portal shell handles. These are either aliases or functions depending on your shell. Currently csh-style shells and bash are supported. Get the ones you need either from the FILES section or by issuing apparix --shell-examples. Activate them by simply pasting them in a shell or adding them to the appropriate resource file, e.g. $HOME/.cshrc or $HOME/.profile (do not forget to source the resource file). The handles to, bm and portal can of course be changed to any name desired. The following is a mock-up shell navigation session.

   > pwd
   /home/eez/cvs/xyz/tfa/faq/zut/bar/foo
   > ls
   src/ doc/ CVS/ bin/
   > bm xkr       # bookmark as xkr (funny name though)
   > bm           # bookmark as foo (trailing component is default)
(later)
   > to xkr       # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo
(alternatively)
   > to xkr src   # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo/src
(alternatively)
   > to foo       # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo

(later)
   > ls
   aap pyu/ qua tim/ zut/
   > pwd
   /home/eez/another/branch/deep/down/under
   > portal       # bookmark as portal, imports tim zut pyu bookmarks
   added flock of 3 in portal /home/eez/another/branch/deep/down/under

(later)
   > to zut       # cd to /home/eez/another/branch/deep/down/under/zut

(later)
   > apparix   # show all bookmarks
   --- portals
   e              /home/eez/another/branch/deep/down/under
   --- expansions
   j pyu          /home/eez/another/branch/deep/down/under/pyu
   j tim          /home/eez/another/branch/deep/down/under/tim
   j zut          /home/eez/another/branch/deep/down/under/zut
   --- bookmarks
   j xkr          /home/eez/cvs/xyz/tfa/faq/zut/bar/foo
   j foo          /home/eez/cvs/xyz/tfa/faq/zut/bar/foo

In the last example apparix simply shows all its bookmarks. The first batch shows portals. The second batch shows secondary bookmarks expanded from portals. The third batch shows all regular bookmarks.

Apparix also allows subdirectory specification. If this is combined with the bash completion code it yields a powerful way of navigating container directories, i.e. directories that contain a large number of subdirectories. Refer to the subdirectory specification section.

Further options
[--add-mark (add jump bookmark)] [--add-portal (add portal bookmark)] [-sm <mark> (squash repeated marks)] [-sd <mark> (squash repeated destinations)] [-lm <mark> (list bookmarks with this mark)] [-ld <mark> (list destinations with mark indirection)] [-favour <list> (duplicate resolution)] [-purge pat (delete bookmarks)] [-purge-mark (pat)] [-d (dump resource file to STDOUT)] [-l (list available jumps)] [-u <num> (remove last <num> additions)] [--rehash (re-expand portal bookmarks)] [--bu (create backup of resource file)] [-bu <fname> (create backup in <fname>)] [--cwd (use getcwd(3), not pwd(1))] [--shell-examples (output example macros)]

DESCRIPTION

Apparix combines the properties of the cdargs utility and the CDPATH shell mechanism for fast navigation through the file system. It is especially useful for visiting and documenting both often- and rarely-used locations. Apparix enables you to attach marks to locations and jump to those locations by loading the mark. Marking, unmarking and jumping are simple operations that are performed in the shell. All actions take effect immediately in all shells running. By setting up convenient aliases for marking and jumping the file system can be navigated in a fast and intuitive manner. The FILES section lists aliases for csh-type shells and functions for bash, including the setup to equip the to function with argument completion in bash.

This section contains some examples of the most common uses of apparix. OPTIONS contains a list of additional options available for listing, pruning, and squashing bookmarks.

NOTES features a brief discussion of the advantages of apparix over other approaches such as setting up aliases for often visited directories, using symlinks, CDPATH, or a combination of these. HISTORY explains the difference between cdargs and apparix. The sections duplicate resolution, subdirectory specification, tab completion, copying and moving files, and listing bookmarks further below are also recommended reading.

Apparix works in a manner similar to cdargs. One usually invokes apparix by using pre-defined aliases. Here they will be called bm for bookmark, portal for a CDPATH-style bookmark and to for initiating an apparition (aka jump). These aliases are found below in the FILES section and can also be obtained by issuing

apparix --shell-examples

Suppose your user name is eez and your home directory is /home/eez. You often visit a directory called /home/eez/cvs/xyz/tfa/faq/zut/bar/foo. This is how to create and use a bookmark for foo

/home/eez/cvs/xyz/tfa/faq/zut/bar/foo> bm foo
added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo
/home/eez/cvs/xyz/tfa/faq/zut/bar/foo> cd
/home/eez> to foo
/home/eez/cvs/xyz/tfa/faq/zut/bar/foo>

If one bookmarks a directory by its trailing component as happened in this case, it is not necessary to specify the mark. By default apparix will use the trailing component as the mark. So

/home/eez/cvs/xyz/tfa/faq/zut/bar/foo> bm
added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo

gives the same result.

Another scenario is where you have some directory that contains a largish number of subdirectories, all of which you would like to have bookmarked. If the subdirectories have distinctive names this can be achieved in one fell swoop by marking the parent directory as a portal. This is similar to adding the parent directory to the CDPATH environment variable, except that apparix bookmarks are not part of the cd namespace. It is argued in NOTES that this is a good thing. Consider this:

/home/cvs/bagger/boemel/mcl/mcl/src> ls
alien/       CVS/         impala/      Makefile.am  README       shmcx/
attic/       giraffe/     lib/         Makefile.in  shcl/        shmx/
contrib/     gmon.out     Makefile     mcl/         shmcl/       taurus/

Some of the subdirectories have not-so-distinct names such as contrib and attic, but they happen to be the directories least visited. Issuing:

/home/cvs/bagger/boemel/mcl/mcl/src> portal
[apparix] expanded 1 portal to 12 destinations

yields all of the subdirectories as destinations bookmarked by the last component of their path name. Incidentally, directory names such as CVS can be explicitly excluded from expansion by setting the environment variable APPARIXEXCLUDE appropriately - refer to section ENVIRONMENT.

Bookmarks resulting from portal expansion are kept in a separate resource file (see FILES). Portal expansions can be recreated by issuing

apparix --rehash

This is useful to reflect a change in the directory naming structure underneath a portal.

duplicate resolution

Apparix allows identical bookmarks to point to different locations. When asked to visit such a bookmark it will by default present a list of options.

The -favour <list> option can be used to automate resolution. <list> is a sequence of single characters. The order in which they are given denote the order in which resolution rules are applied. This option is typically used in the definition of the to function/alias or in the bash completion code.

Duplicates are allowed because it can be useful to overwrite a bookmark with a new location. The old bookmark is kept as a matter of policy. Use -sm to explicitly squash duplicates.

l 

level; prefer paths with fewer components.

  
L 

reverse of the above.

  
o 

bookmark order; prefer older entries. Entries appearing earlier in the file are considered older, but the actual date of creating the bookmark is not stored. Refer to editing bookmarks for more information.

  
O 

reverse of the above.

  
r 

regular first; prefer regular bookmarks over portal expansion.

  
R 

reverse of the above.

If there are still ties after the specified rules have been applied apparix will simply take the first matching option. This behaviour cannot be further specified as the program uses a non-stable ordering routine.

It is an absolute prerequisite that -favour is used in the bash completion code. Otherwise completion will fail (for a duplicated bookmark) while apparix is waiting for input. Refer to the tab completion description below.

subdirectory specification

When jumping (apparating) you can specify an additional subdirectory after the bookmark. Apparix will append the subdirectory to the destination.

This is useful for projects with directory nodes corresponding with versions. Assume you have a directory structure such as this:

   /x/y/z/OpusMagnum/v1/
   /x/y/z/OpusMagnum/v2/
   /x/y/z/OpusMagnum/v3/

It is probably easiest to simply bookmark the OpusMagnum directory in some way (say with bookmark om). You can then issue to om v2 to jump to OpusMagnum/v2. This is more flexible and maintainable than creating bookmarks om1, om2, om3. One could add OpusMagnum as a portal, but with generic names such as v1 this is not a very extendible approach.

See also the tab completion description below - it is possible to tab-complete on subdirectories of the apparix jump directory.

tab completion

The bash tab completion code does two things. First, it is possible to tab-complete on apparix bookmarks themselves, showing a listing of all available bookmarks (or iterating through them in cyclic mode, depending on your bash settings). Second, once a bookmark has been given tab completion will list or iterate over all the subdirectories of the directory associated with that bookmark. Specifying a string after the bookmark will limit tab-completion to directories matching the shell-pattern in string. Very useful.

Be careful to not remove the -favour list option from the bash completion code. It is necessary to resolve duplicate bookmarks.

editing bookmarks

Apparix appends new bookmarks to the end of the .apparixrc file. Nothing stops you from editing the file, and this is in fact recommended if for example you need to get rid of a bookmark and neither of -purge, -purge-mark, -sd, -sm fulfills your needs. It was an easy design choice not to equip apparix with editor capabilities.

copying and moving files

It is straightforward to copy or move files to locations known by apparix. Examples:

BASH and variants
   cp FOO $(apparix zoem)
   mv BAR $(apparix zoem doc)
   mv BAR $(apparix zoem doc)/test
   
CSH and variants
   cp FOO `apparix zoem`
   mv BAR `apparix zoem doc`/test

listing bookmarks

Simply issuing apparix gives you a list of bookmarks grouped into three categories, portals, expansions, and bookmarks. Use the -d option to dump the resource file to STDOUT exactly as it is. This can be useful when you intend to use the -u num option to remove bookmarks or portals that were most recently added.

Use -l to list all available jumps without their destinations. The jumps are grouped into expansions resulting from portals and regular bookmarks.

OPTIONS

For bookmarking and jumping apparix is best invoked by using the aliases (tcsh-variants) or functions (sh/bash) listed in FILES. Apparix has a few options that are useful for pruning, squashing and rehasing bookmarks. These are best issued by invoking apparix directly.

If you are interested in marks or destinations matching a certain pattern, simply issue apparix without arguments and pipe it through your program of choice.

Unary options (those without arguments) usually start with two hyphens except for standardized options such as -h. Options that take an argument can be converted to a unary key=value notation, e.g. -purge-mark foo is equivalent to --purge-mark=foo.

When invoked without arguments apparix will simply dump its bookmarks.

--add-mark (add jump bookmark)
  

This options expects trailing [mark [destination]] argument(s). Both arguments are optional. If a single argument is given it is interpreted as a bookmark name to be mapped to the current directory. If two arguments are given the last argument is taken as the target directory. If no argument is given apparix will enlist the current directory as a target bookmarked by the trailing component of the directory path.

  
--add-portal (add portal bookmark)
  

This option enlists a directory as a portal and adds all subdirectories as bookmarks. The name of the bookmark is simply the name of the subdirectory. By default the current directory is added as a portal. An optional trailing argument will override this behaviour and instead be interpreted as the portal location.

  
-sm <mar> (squash repeated marks)
  

Apparix will squash bookmarks with mark <mark>. This is useful when a mark points to a versioned project, and the project is updated to a new version and a new directory.

Apparix will by default keep the last one occurring in the resource file (corresponding with -favour O). This option respects the -favour option if given. Duplicating an already existing mark can be useful when it identifies a project for which the underlying directory changes every once in a while (e.g. the project is downloaded from external sources and comes with version information). It is not strictly necessary to squash bookmarks since to functions/macros that are equipped with the -favour option will generally resolve duplicate matches.

  
-sd <mark> (squash repeated destinations)
  

All other bookmarks with the same destination as <mark> are removed. This is useful when a given destination has acquired multiple bookmarks and you decide to settle on a favourite.

  
-lm <mark> (list bookmarks with this mark)
  

It lists all bookmarks <mark> (noting that it may point to multiple locations).

  
-ld <mark> (list repeated destinations)
  

This lists all bookmarks <mark> (noting that it may point to multiple locations) and additionally lists all other bookmarks that share the destination with any of the first bookmarks. This allows one to predict the effect of issuing apparix -sd <mark>.

  
-purge pat (delete bookmarks)
  

This deletes bookmarks where destination matches pat. All deleted bookmarks are printed to STDOUT. Thus if you regret deleting a bookmark it is easy to add it back. Portal specifications are never affected.

  
-purge-mark (pat)
  

This deletes bookmarks where mark matches pat. Portal specifications are never affected.

  
-d (dump resource file to STDOUT)
  

Dump resource file to STDOUT.

  
-l (list available jumps)
  

List available jumps paragraph-style. Portal specifications themselves are excluded, and regular jumps and jumps resulting from portal expansions are listed under different headers.

  
-u <num> (remove last <num> additions)
  

Remove last <num> additions. Portal specifications and regular jumps are treated alike.

  
--rehash (re-expand portal bookmarks)
  

Apparix will reread the resource file and reexpand portal locations. Useful if directories have been added, renamed, or removed. Refer to section ENVIRONMENT for the effect that the environment variable APPARIXEXCLUDE has on portal expansion.

  
-favour <list> (set duplicat resolution policy)
  

This option has its own section. Refer to duplicate resolution.

  
--cwd (use getcwd(3), not pwd(1))
  

By default aparix uses the program pwd(1) rather than the system call getcwd(3). On some systems it was found that the latter results in paths that contain machine-specific mount components. Appparix will use getcwd(3) when --cwd is used.

  
--shell-examples (output example macros)
  

This outputs example macros. They are also listed in the FILES section though.

  
--bu (create backup of the resource file)
  

This creates the backup file in .apparixrc.bu.

  
-bu fname (create backup of the resource file)
  

This creates the backup file in fname. Use -d or -bu - to dump to STDOUT.

  
-h (show synopsis)
--apropos (show synopsis)
  

print synopsis of all options

ENVIRONMENT

APPARIXEXCLUDE
  

This variable specifies exclusion behaviour when portals are expanded with the --rehash option. It has the following syntax:

   <[:,][<string>]>+

That is, a list of names with each name preceded by a colon or a comma. A colon indicates that <string> triggers exclusion of directory names for which the trailing component is identical to <string>. A comma indicates that <string> triggers exclusion of directory names for which the trailing component contains <string> as a substring. Consider:

   export APPARIXEXCLUDE=:CVS:lib,tmp        # A - example
   export APPARIXEXCLUDE=,                   # B - curiosity

The first excludes directory names CVS and lib and any directory name having tmp as a substring. The second example will effectively disable portals, as it speficies the empty string which is a substring of all strings.

  
APPARIXTAG
  

This variable, if set, is incorporated into the names of the apparix resource files. By default these are .apparixrc and .apparixexpand. When APPARIXTAG is set to <tag> they become .<tag>apparixrc and .<tag>apparixexpand. This can be used e.g. to maintain different sets of bookmarks on different host machines.

  
APPARIXLOG
  

This variable, if set, is interpreted as the name of a log file. The log file keeps track of all newly added bookmarks and portals without ever deleting anything, in the same format as the .apparixrc file. If this variable is not set nothing is tracked.

  
APPARIXPURGE
  

This changes the way apparix dumps purged bookmarks to STDOUT. By default they are dumped as command lines that will reimport the bookmarks if issued (i.e. cut and pasted). By setting this variable to 1 purged bookmarks are dumped in the format used in the .apparixrc file.

FILES

You should use aliases or functions to make apparix really useful. Get them from apparix by giving it the --shell-examples option, or from further below. Note the fragment that provides to argument completion in bash.

$HOME/.apparixrc
  

This is the primary resource file. There is usually no need to edit it by hand. Sometimes it can be useful to edit by hand to remove an unwanted bookmark; refer to editing bookmarks.

  
$HOME/.apparixrc.bu
  

Apparix creates a back-up file whenever it is asked to remove entries from it. Refer to editing bookmarks for options inducing removal. You can explicitly require a backup to be made by either of --bu or -bu fname.

  
$HOME/.apparixexpand
  

This contains bookmarks that are expanded from portals. A portal is simply some directory. The names of all subdirectories are taken as bookmarks that point to those subdirectories. This file can be recreated by issuing

apparix --rehash
  
$HOME/.bashrc
$HOME/.tcshrc
$HOME/.cshrc
  

Add the code you need to the appropriate rc file. The macros and functions below point cd(1) in the right direction.

BASH-style functions
---
function to () {
   if test "$2"; then
     cd "$(apparix "$1" "$2" || echo .)";
   else
     cd "$(apparix "$1" || echo .)";
   fi
   pwd
}
function bm () {
   if test "$2"; then
      apparix --add-mark "$1" "$2";
   elif test "$1"; then
      apparix --add-mark "$1";
   else
      apparix --add-mark;
   fi
}
function portal () {
   if test "$1"; then
      apparix --add-portal "$1";
   else
      apparix --add-portal;
   fi
}
# function to generate list of completions from .apparixrc
function _apparix_aliases ()
{   cur=$2
    dir=$3
    COMPREPLY=()
    if [ "$1" == "$3" ]
    then
        COMPREPLY=( $( cat $HOME/.apparix{rc,expand} | \
                       grep "j,.*$cur.*," | cut -f2 -d, ) )
    else
        dir=`apparix -favour rOl $dir 2>/dev/null` || return 0
        eval_compreply="COMPREPLY=( $(
            cd "$dir"
            \ls -d *$cur* | while read r
            do
                [[ -d "$r" ]] &&
                [[ $r == *$cur* ]] &&
                    echo \"${r// /\\ }\"
            done
            ) )"
        eval $eval_compreply
    fi
    return 0
}
# command to register the above to expand when the 'to' command's args are
# being expanded
complete -F _apparix_aliases to
---
CSH-style aliases
---
alias to    'cd `(apparix -favour rOl \!* || echo -n .)` && pwd'
alias bm   'apparix --add-mark \!*'
alias portal 'apparix --add-portal \!*'
---

More elaborate setups are possible. This CSH-style alias:

alias to '(test "x" !=  "x\!*") && cd `(apparix -favour rOl \!* || echo -n .)` || apparix -l'

lists all available jumps if invoked without arguments.

NOTES

Below follow some comments on other approaches to file system navigation. HISTORY explains the difference between the venerable cdargs program and apparix.

CDPATH is only useful in cases where a given directory has subdirectories with distinctive names. It does not usually scale well when there are more than a few paths in CDPATH.

Some people use aliases to jump to often visited directories. I was one of them for a period of ten years. The fact is, those aliases are cumbersome to create and remove and they clutter up the alias namespace. They can clash with executable names when the alias includes the cd part. This sometimes prohibits one from assigning the logical bookmark to a given location, especially when one has a lot of source code locations. They can clash with directory names when the aliases just expand to the location. This again means that sometimes a location cannot be assigned its logical bookmark. I have found that setting cd jumps aside in their own namespace improves file system navigation by a large factor.

It is also possible to create symlinks to often visited files. Again, creation and removal of these are cumbersome. One could of course create shell functions with a similar interface to apparix or cdargs to handle the symlink lifecycle. On Linux Weekly News nix suggested to put these symlinks in a single directory and add that directory to CDPATH. This is quite a neat trick and effectively creates a bookmark navigation system.

Still there are problems with the above approach. One problem with the symlink approach is that they are a bit awkward to edit. One could make a utility to wrap around the problem, but in the end the directory-with-symlinks would functionally be the same as apparix's .apparixrc resource file, only more of a kludge. Another problem is that symlinks are awkard when traversing the file system. They confuse the notion of parent directory and 'cd ..' mostly does the unexpected. Sometimes '..' has a different meaning to cd than it has to another application, as one will trace back symlinks and the other will not. Finally, a minor objection is that I find it convenient to have bookmarks in a separate namespace than that of cd(1). Jumps are magical and it is natural to invoke them by a different method. This is in fact how apparix acquired its CDPATH behaviour. I used CDPATH to jump to a few particular source directories with distinct names that lay deeply hidden in some CVS directory. Once I started using apparix however, I would mistakenly issue to rather than cd to jump to those locations. My brain classified both types of jump in the same category.

Apparix (and cdargs) have another use besides jumping, namely annotation. Whenever I end up in an esoteric part of the file system and need to make a quick note of the location, I simply bookmark it.

On SlashDot, that eternal source of wisdom or alternatively the geek wheel of suffering, Clueless Moron offered the following gems.

   mk() { eval ${1:-MKPWD}=\"`pwd`\"; }
   rt() { eval cd \"\$${1:-MKPWD}\";pwd; }

   # type "mk" (as in "mark") and "rt" (as in "return") to mark
   # a directory and later go back to it.
   # Or give it a name: do "mk foo", and later on "rt foo"

This of course is a per-session mechanism, but noteworthy for its simplicity. I am not sure whether csh-style shells could offer an equivalent.

A feature shared by apparix and cdargs is that adding a bookmark immediately takes effect in all shells. There is no need to source some resource file, as the applications do this everytime they are invoked. It is fast, do not worry.

BUGS

The resource file parsing code thinks that parentheses are special. Also records are currently separated by commas. Accordingly, apparix will hitch if a path name contains a parenthesis or a comma.

AUTHOR

Stijn van Dongen.

THANKS

Stefan Kamphausen wrote cdargs, the inspiration for apparix.

Sitaram Chamarty fixed up some of the existing bash code, and added the tab completion part (basing this on similar code in cdargs). He does not garantuee predictable or even pretty results if there are spaces in the directory names which you attempt to complete. AUTHOR would like to submit that spaces in path names are evil, and that the completion code seems to work in their evil presence anyway. Just don't put commas in path names.

The autotooled build environment was modified from a template written by Joost van Baal.

HISTORY

Apparix was created to optimize a scenario that cdargs does not support very well, namely where the mark (called needle in cdargs) is always known. As an additional feature apparix supports CDPATH-style behaviour and subdirectory specification. In other respects apparix is a much simpler application. cdargs offers menu-based navigation of the file system and the bookmark list, which apparix does not.

apparix-07-261/doc/apparix.ps0000664002600400000120000023513610673731472012765 00000000000000%!PS-Adobe-3.0 %%Creator: groff version 1.18.1 %%CreationDate: Tue Sep 18 12:15:06 2007 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Courier %%+ font Times-Italic %%DocumentSuppliedResources: procset grops 1.18 1 %%Pages: 12 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.18 1 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /MANUAL{ statusdict begin/manualfeed true store end }bind def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /Fr{ setrgbcolor fill }bind def /Fk{ setcmykcolor fill }bind def /Fg{ setgray fill }bind def /FL/fill load def /LW/setlinewidth load def /Cr/setrgbcolor load def /Ck/setcmykcolor load def /Cg/setgray load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit []0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{}def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%IncludeResource: font Courier %%IncludeResource: font Times-Italic grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron /Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/Euro/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent /ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen /period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O /P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex /underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y /z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft /guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl /endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen /brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft /logicalnot/minus/registered/macron/degree/plusminus/twosuperior /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior /ordmasculine/guilsinglright/onequarter/onehalf/threequarters /questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex /Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn /germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash /ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def /Times-Italic@0 ENC0/Times-Italic RE/Courier@0 ENC0/Courier RE /Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10.95 /Times-Bold@0 SF -.219<4e41>20 84 S<4d45>.219 E F0<6170706172697820ad20 626f6f6b6d61726b206469726563746f7269657320616e6420617070617261746520696e 73696465207468656d>100 96 Q F1<53594e4f50534953>20 112.8 Q F0 .049 <4170706172697820616c6c6f>100 124.8 R .049<777320796f7520746f20626f6f6b 6d61726b206469726563746f7269657320616e64206c61746572206a756d7020746f2074 68656d207573696e6720746865206d61726b2e20497420697320706f737369626c65> -.25 F .606<746f206469726563746c79206a756d7020746f207375626469726563746f 72696573206f662074686520746172>100 136.8 R .606 <676574206469726563746f72792e2054686520636f6e74726962>-.18 F .607 <75746564206261736820636f6d706c6574696f6e20636f6465>-.2 F -.1<6661>100 148.8 S<63696c69746174657320636f6d706c6574696f6e20626f7468206f6e20626f6f 6b6d61726b7320616e64207375626469726563746f726965732e>.1 E .16 <54686973206d616e75616c207061676520737566>100 172.8 R .16 <666572732066726f6d20616e2065>-.25 F .16<786365737320696e2076>-.15 F .16 <6572626f736974792064756520746f20746865206d616e>-.15 F 2.66<7965>-.15 G .16<78616d706c65732c2065>-2.81 F .16<78706c616e6174696f6e73206f66>-.15 F .532<7468652062656c6c7320616e642077686973746c65732c20616e6420636f6d7061 7269736f6e732077697468206f7468657220617070726f616368657320746f20626f6f6b 6d61726b696e672e205468652066756e64616d656e2d>100 184.8 R .281<74616c2069 6465612069732073696d706c79207468617420747970696e67206120737472696e67206f 6620796f7572206f>100 196.8 R .28<776e2063686f6f73696e672074616b>-.25 F .28 <657320796f7520746f20746865206469726563746f7279206173736f636961746564> -.1 F .359<776974682069742e>100 208.8 R .359<4170706172697820646f657320 6c6974746c65206d6f7265207468616e206d61696e7461696e696e672061206c69737420 6f66206b>5.359 F -.15<6579>-.1 G 2.86<7361>.15 G .36<6e642076>-2.86 F 2.86<616c7565732e204974>-.25 F .36<6f627461696e73206469726563746f7279> 2.86 F .56<6e616d657320616e64206c697374696e67732c206173736f636961746573 2070617468206e616d6573202876>100 220.8 R .559 <616c75657329207769746820626f6f6b6d61726b7320286b>-.25 F -.15<6579>-.1 G .559<73292c20616e642068617320736f6d652066>.15 F<6163696c692d>-.1 E .788 <7469657320666f72206d616e6970756c6174696e67206b>100 232.8 R -.15<6579> -.1 G 3.288<7361>.15 G .788<6e642076>-3.288 F .788 <616c7565732e205468652066756e6374696f6e7320696e>-.25 F -.2<766f>-.4 G .789<6c76696e6720617070617269782028>.2 F/F2 10/Courier@0 SF<626d>A F0 <2c>A F2<746f>3.289 E F0 3.289<2c61>C<6e64>-3.289 E F2<706f7274616c> 3.289 E F0<29>A<70726f>100 244.8 Q <7669646520746865207573657220696e74657266>-.15 E<6163652e>-.1 E F1 <47455454494e47205354>20 261.6 Q<4152>-.986 E<544544>-.438 E F0 .109<49 6e7374616c6c20617070617269782e20546869732073686f756c64206265206173206561 7379206173>100 273.6 R/F3 10/Times-Italic@0 SF<2e2f636f6e8c677572>2.609 E 2.609<652d>-.37 G<2d7072>-2.609 E .109 <658c783d24484f4d452f6c6f63616c202626206d616b>-.37 F 2.609<6526>-.1 G 2.609<266d>-2.609 G<616b>-2.609 E<65>-.1 E<696e7374616c6c>100 285.6 Q F0 2.859<2c6f>C 2.859<7270>-2.859 G .359 <6572686170732061207072652d7061636b6167656420617070617269782069732061> -2.859 F -.25<7661>-.2 G .359 <696c61626c6520666f7220796f75722073797374656d2e>.25 F .36 <5468656e2067657420686f6c64206f6620746865>5.36 F/F4 10/Times-Bold@0 SF <746f>2.86 E F0<2c>A F4<626d>100 297.6 Q F0<616e64>2.736 E F4 <706f7274616c>2.736 E F0 .236<7368656c6c2068616e646c65732e20546865736520 6172652065697468657220616c6961736573206f722066756e6374696f6e732064657065 6e64696e67206f6e20796f7572207368656c6c2e20437572>2.736 F<2d>-.2 E 1.148< 72656e746c79206373682d7374796c65207368656c6c7320616e64206261736820617265 20737570706f727465642e>100 309.6 R 1.148<47657420746865206f6e657320796f 75206e656564206569746865722066726f6d20746865>6.148 F F4<46494c4553>3.648 E F0 .182<73656374696f6e206f722062792069737375696e67>100 321.6 R F2 .182 <61707061726978202d2d7368656c6c2d6578616d706c6573>2.682 F F0 2.682<2e41> C<637469>-2.682 E -.25<7661>-.25 G .182 <7465207468656d2062792073696d706c792070617374696e67207468656d>.25 F 4.375<696e2061207368656c6c206f7220616464696e67207468656d20746f2074686520 617070726f707269617465207265736f75726365208c6c652c20652e672e>100 333.6 R F2<24484f4d452f2e6373687263>9.376 E F0<6f72>6.876 E F2 <24484f4d452f2e70726f66696c65>100 345.6 Q F0 .647 <28646f206e6f7420666f72>3.147 F .647<67657420746f>-.18 F F3<736f7572> 3.147 E<6365>-.37 E F0 .646 <746865207265736f75726365208c6c65292e205468652068616e646c6573>3.147 F F4 <746f>3.146 E F0<2c>A F4<626d>3.146 E F0<616e64>3.146 E F4<706f7274616c> 3.146 E F0 .285 <63616e206f6620636f75727365206265206368616e67656420746f20616e>100 357.6 R 2.785<796e>-.15 G .285<616d6520646573697265642e2054686520666f6c6c6f> -2.785 F .285<77696e672069732061206d6f636b2d7570207368656c6c206e61>-.25 F<766967>-.2 E .285<6174696f6e207365732d>-.05 F<73696f6e2e>100 369.6 Q <6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<31>204 E 0 Cg EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Courier@0 SF <3e>118 84 Q/F2 10/Times-Bold@0 SF<707764>6 E F1<2f686f6d652f65657a2f63 76732f78797a2f7466612f6661712f7a75742f6261722f666f6f>118 96 Q<3e>118 108 Q F2<6c73>6 E F1<7372632f20646f632f204356532f2062696e2f>118 120 Q<3e>118 132 Q F2<626d20786b72>6 E F1 6<2362>42 G <6f6f6b6d61726b20617320786b72202866756e6e79206e616d652074686f75676829>-6 E<3e>118 144 Q F2<626d>6 E F1 6<2362>66 G<6f6f6b6d61726b20617320666f6f20 28747261696c696e6720636f6d706f6e656e742069732064656661756c7429>-6 E <286c6174657229>100 156 Q<3e>118 168 Q F2<746f20786b72>6 E F1 6<2363>42 G 6<6474>-6 G 6<6f2f>-6 G<686f6d652f65657a2f6376732f78797a2f7466612f6661 712f7a75742f6261722f666f6f>-6 E<28616c7465726e61746976656c7929>100 180 Q <3e>118 192 Q F2<746f20786b72207372>6 E<63>-.18 E F1 6<2363>18 G 6<6474> -6 G 6<6f2f>-6 G<686f6d652f65657a2f6376732f78797a2f7466612f6661712f7a75 742f6261722f666f6f2f737263>-6 E<28616c7465726e61746976656c7929>100 204 Q <3e>118 216 Q F2<746f2066>6 E<6f6f>-.25 E F1 6<2363>42 G 6<6474>-6 G 6 <6f2f>-6 G<686f6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f62 61722f666f6f>-6 E<286c6174657229>100 240 Q<3e>118 252 Q F2<6c73>6 E F1 <616170207079752f207175612074696d2f207a75742f>118 264 Q<3e>118 276 Q F2 <707764>6 E F1<2f686f6d652f65657a2f616e6f746865722f6272616e63682f646565 702f646f776e2f756e646572>118 288 Q<3e>118 300 Q F2<706f7274616c>6 E F1 6 <2362>42 G<6f6f6b6d61726b20617320706f7274616c2c20696d706f7274732074696d 207a75742070797520626f6f6b6d61726b73>-6 E<616464656420666c6f636b206f6620 3320696e20706f7274616c202f686f6d652f65657a2f616e6f746865722f6272616e6368 2f646565702f646f776e2f756e646572>118 312 Q<286c6174657229>100 336 Q<3e> 118 348 Q F2<746f207a7574>6 E F1 6<2363>42 G 6<6474>-6 G 6<6f2f>-6 G<68 6f6d652f65657a2f616e6f746865722f6272616e63682f646565702f646f776e2f756e64 65722f7a7574>-6 E<286c6174657229>100 372 Q<3e>118 384 Q F2 <61707061726978>6 E F1 6<2373>18 G<686f7720616c6c20626f6f6b6d61726b73>-6 E<2d2d2d20706f7274616c73>118 396 Q 84<652f>118 408 S<686f6d652f65657a2f 616e6f746865722f6272616e63682f646565702f646f776e2f756e646572>-84 E <2d2d2d20657870616e73696f6e73>118 420 Q 6<6a70>118 432 S 54<7975202f686f 6d652f65657a2f616e6f746865722f6272616e63682f646565702f646f776e2f756e6465 722f707975>-6 F 6<6a74>118 444 S 54<696d202f686f6d652f65657a2f616e6f7468 65722f6272616e63682f646565702f646f776e2f756e6465722f74696d>-6 F 6<6a7a> 118 456 S 54<7574202f686f6d652f65657a2f616e6f746865722f6272616e63682f64 6565702f646f776e2f756e6465722f7a7574>-6 F<2d2d2d20626f6f6b6d61726b73>118 468 Q 6<6a78>118 480 S 54<6b72202f686f6d652f65657a2f6376732f78797a2f7466 612f6661712f7a75742f6261722f666f6f>-6 F 6<6a66>118 492 S 54<6f6f202f686f 6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f6261722f666f6f>-6 F F0 .746<496e20746865206c6173742065>100 516 R .746 <78616d706c6520617070617269782073696d706c792073686f>-.15 F .745<77732061 6c6c2069747320626f6f6b6d61726b732e20546865208c7273742062617463682073686f> -.25 F .745<777320706f7274616c732e20546865>-.25 F .17 <7365636f6e642062617463682073686f>100 528 R .17 <7773207365636f6e6461727920626f6f6b6d61726b732065>-.25 F .17<7870616e64 65642066726f6d20706f7274616c732e205468652074686972642062617463682073686f> -.15 F .17<777320616c6c207265>-.25 F<672d>-.15 E <756c617220626f6f6b6d61726b732e>100 540 Q 1.64 <4170706172697820616c736f20616c6c6f>100 564 R 1.639<77732073756264697265 63746f72792073706563698c636174696f6e2e204966207468697320697320636f6d6269 6e6564207769746820746865206261736820636f6d706c6574696f6e>-.25 F .877 <636f6465206974207969656c6473206120706f>100 576 R .878<77657266756c2077> -.25 F .878<6179206f66206e61>-.1 F<766967>-.2 E .878<6174696e6720636f6e 7461696e6572206469726563746f726965732c20692e652e206469726563746f72696573 207468617420636f6e7461696e2061>-.05 F<6c6172>100 588 Q <6765206e756d626572206f66207375626469726563746f726965732e>-.18 E <526566657220746f20746865>5 E F2<737562646972>2.5 E <6563746f72792073706563698c636174696f6e>-.18 E F0<73656374696f6e2e>2.5 E F2<46757274686572206f7074696f6e73>100 612 Q<5b2d2d6164642d6d61726b>100 624 Q F0<28>6.063 E/F3 10/Times-Italic@0 SF 3.563 <616464206a756d7020626f6f6b6d61726b>B F0<29>A F2 6.062<5d5b>C <2d2d6164642d706f7274616c>-6.062 E F0<28>6.062 E F3 3.562 <61646420706f7274616c20626f6f6b6d61726b>B F0<29>A F2 6.062<5d5b>C <2d736d>-6.062 E F0<3c6d61726b3e>6.062 E<28>100 636 Q F3 .642 <7371756173682072>B .642<65706561746564206d61726b73>-.37 F F0<29>A F2 3.142<5d5b>C<2d7364>-3.142 E F0 .643<3c6d61726b3e2028>3.143 F F3 .643 <7371756173682072>B .643<657065617465642064657374696e6174696f6e73>-.37 F F0<29>A F2 3.143<5d5b>C<2d6c6d>-3.143 E F0 .643<3c6d61726b3e2028>3.143 F F3 .643<6c69737420626f6f6b2d>B 1.486 <6d61726b7320776974682074686973206d61726b>100 648 R F0<29>A F2 3.986 <5d5b>C<2d6c64>-3.986 E F0 1.486<3c6d61726b3e2028>3.986 F F3 1.486 <6c6973742064657374696e6174696f6e732077697468206d61726b20696e646972>B <656374696f6e>-.37 E F0<29>A F2 3.985<5d5b>C<2d6661>-3.985 E -.1<766f> -.25 G<7572>.1 E F0<3c6c6973743e>3.985 E<28>100 660 Q F3 .106 <6475706c69636174652072>B<65736f6c7574696f6e>-.37 E F0<29>A F2 2.606 <5d5b>C<2d707572>-2.606 E<6765>-.1 E F0 .106<7061742028>2.606 F F3 .106 <64656c65746520626f6f6b6d61726b73>B F0<29>A F2 2.606<5d5b>C<2d707572> -2.606 E<67652d6d61726b>-.1 E F0<28>2.606 E F3<706174>A F0<29>A F2 2.606 <5d5b>C<2d64>-2.606 E F0<28>2.606 E F3 .106<64756d702072>B<65736f7572> -.37 E<6365>-.37 E 3.18<8c6c6520746f205354444f5554>100 672 R F0<29>A F2 5.68<5d5b>C<2d6c>-5.68 E F0<28>5.68 E F3 3.18 <6c69737420617661696c61626c65206a756d7073>B F0<29>A F2 5.68<5d5b>C<2d75> -5.68 E F0 3.18<3c6e756d3e2028>5.68 F F3 -.37<7265>C<6d6f>.37 E 3.18 <7665206c617374203c6e756d3e206164646974696f6e73>-.1 F F0<29>A F2<5d>A <5b2d2d72>100 684 Q<6568617368>-.18 E F0<28>3.519 E F3 -.37<7265>C<2d65> .37 E 1.019<7870616e6420706f7274616c20626f6f6b6d61726b73>-.2 F F0<29>A F2 3.519<5d5b>C<2d2d62>-3.519 E<75>-.2 E F0<28>3.519 E F3<6372>A 1.019 <6561746520626163>-.37 F 1.019<6b7570206f662072>-.2 F<65736f7572>-.37 E 1.019<6365208c6c65>-.37 F F0<29>A F2 3.519<5d5b>C<2d62>-3.519 E<75>-.2 E F0<3c666e616d653e>3.52 E<28>100 696 Q F3<6372>A 1.886<6561746520626163> -.37 F 1.886<6b757020696e203c666e616d653e>-.2 F F0<29>A F2 4.386<5d5b>C <2d2d637764>-4.386 E F0<28>4.386 E F3 1.886<7573652067>B 1.886 <65746377642833292c206e6f7420707764283129>-.1 F F0<29>A F2 4.386<5d5b>C <2d2d7368656c6c2d6578616d706c6573>-4.386 E F0<28>4.386 E F3 <6f7574707574>A -.2<6578>100 708 S<616d706c65206d616372>.2 E<6f73>-.45 E F0<29>A F2<5d>A F0<6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<32>204 E 0 Cg EP %%Page: 3 3 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10.95 /Times-Bold@0 SF<4445534352495054494f4e>20 84 Q F0 .237<4170706172697820 636f6d62696e6573207468652070726f70657274696573206f6620746865>100 96 R/F2 10/Times-Italic@0 SF<63646172>2.737 E<6773>-.37 E F0 .237 <7574696c69747920616e642074686520434450>2.737 F -1.11<4154>-.92 G 2.737 <4873>1.11 G .238<68656c6c206d656368616e69736d20666f722066>-2.737 F <617374>-.1 E<6e61>100 108 Q<766967>-.2 E 1.832<6174696f6e207468726f7567 6820746865208c6c652073797374656d2e20497420697320657370656369616c6c792075 736566756c20666f72207669736974696e6720616e6420646f63756d656e74696e672062 6f7468>-.05 F .754<6f6674656e2d20616e6420726172656c792d75736564206c6f63 6174696f6e732e204170706172697820656e61626c657320796f7520746f206174746163 68206d61726b7320746f206c6f636174696f6e7320616e64206a756d7020746f>100 120 R 1.41<74686f7365206c6f636174696f6e73206279206c6f6164696e6720746865206d 61726b2e204d61726b696e672c20756e6d61726b696e6720616e64206a756d70696e6720 6172652073696d706c65206f7065726174696f6e73>100 132 R .455<74686174206172 6520706572666f726d656420696e20746865207368656c6c2e20416c6c20616374696f6e 732074616b>100 144 R 2.956<6565>-.1 G -.25<6666>-2.956 G .456<6563742069 6d6d6564696174656c7920696e20616c6c207368656c6c732072756e6e696e672e204279 207365742d>.25 F .086<74696e6720757020636f6e>100 156 R -.15<7665>-.4 G .085<6e69656e7420616c696173657320666f72206d61726b696e6720616e64206a756d 70696e6720746865208c6c652073797374656d2063616e206265206e61>.15 F<766967> -.2 E .085<6174656420696e20612066>-.05 F .085<61737420616e64>-.1 F <696e7475697469>100 168 Q 1.995 -.15<7665206d>-.25 H 1.695 <616e6e65722e20546865>.15 F/F3 10/Times-Bold@0 SF<46494c4553>4.195 E F0 1.696<73656374696f6e206c6973747320616c696173657320666f72206373682d747970 65207368656c6c7320616e642066756e6374696f6e7320666f7220626173682c>4.195 F <696e636c7564696e672074686520736574757020746f20657175697020746865>100 180 Q F3<746f>2.5 E F0<66756e6374696f6e2077697468206172>2.5 E <67756d656e7420636f6d706c6574696f6e20696e20626173682e>-.18 E .266 <546869732073656374696f6e20636f6e7461696e7320736f6d652065>100 204 R .265 <78616d706c6573206f6620746865206d6f737420636f6d6d6f6e2075736573206f6620 617070617269782e>-.15 F F3<4f5054494f4e53>5.265 E F0<636f6e7461696e73> 2.765 E 2.5<616c>100 216 S <697374206f66206164646974696f6e616c206f7074696f6e732061>-2.5 E -.25 <7661>-.2 G<696c61626c6520666f72206c697374696e672c207072756e696e672c2061 6e6420737175617368696e6720626f6f6b6d61726b732e>.25 E F3<4e4f>100 240 Q <544553>-.4 E F0 .725<66656174757265732061206272696566206469736375737369 6f6e206f662074686520616476>3.225 F .725 <616e7461676573206f662061707061726978206f>-.25 F -.15<7665>-.15 G 3.225 <726f>.15 G .725<7468657220617070726f61636865732073756368206173>-3.225 F 1.286<73657474696e6720757020616c696173657320666f72206f6674656e2076697369 746564206469726563746f726965732c207573696e672073796d6c696e6b732c20434450> 100 252 R -1.11<4154>-.92 G 1.286 <482c206f72206120636f6d62696e6174696f6e206f66>1.11 F<74686573652e>100 264 Q F3<48495354>3.435 E<4f52>-.18 E<59>-.35 E F0 -.15<6578>3.435 G .935<706c61696e732074686520646966>.15 F .935 <666572656e6365206265747765656e2063646172>-.25 F .936 <677320616e6420617070617269782e>-.18 F .936<5468652073656374696f6e73> 5.936 F F3<6475706c6963617465>3.436 E -.18<7265>100 276 S <736f6c7574696f6e>.18 E F0<2c>A F3<737562646972>2.899 E .399 <6563746f72792073706563698c636174696f6e>-.18 F F0<2c>A F3 .399 <74616220636f6d706c6574696f6e>2.899 F F0<2c>A F3 .399 <636f7079696e6720616e64206d6f>2.899 F .399<76696e67208c6c6573>-.1 F F0 2.899<2c61>C<6e64>-2.899 E F3<6c697374696e67>2.899 E<626f6f6b6d61726b73> 100 288 Q F0<667572746865722062656c6f>2.5 E 2.5<7761>-.25 G <726520616c736f207265636f6d6d656e6465642072656164696e672e>-2.5 E .467 <417070617269782077>100 312 R .467 <6f726b7320696e2061206d616e6e65722073696d696c617220746f2063646172>-.1 F .467<67732e204f6e6520757375616c6c7920696e>-.18 F -.2<766f>-.4 G -.1 <6b65>.2 G 2.967<7361>.1 G .468 <707061726978206279207573696e67207072652d64658c6e6564>-2.967 F .11 <616c69617365732e204865726520746865>100 324 R 2.61<7977>-.15 G .11 <696c6c2062652063616c6c6564>-2.61 F F3<626d>2.609 E F0 .109 <666f7220626f6f6b6d61726b2c>2.609 F F3<706f7274616c>2.609 E F0 .109 <666f72206120434450>2.609 F -1.11<4154>-.92 G .109 <482d7374796c6520626f6f6b6d61726b20616e64>1.11 F F3<746f>2.609 E F0 .312 <666f7220696e6974696174696e6720616e2061707061726974696f6e2028616b61206a 756d70292e>100 336 R .313 <546865736520616c69617365732061726520666f756e642062656c6f>5.313 F 2.813 <7769>-.25 G 2.813<6e74>-2.813 G<6865>-2.813 E F3<46494c4553>2.813 E F0 .313<73656374696f6e20616e64>2.813 F <63616e20616c736f206265206f627461696e65642062792069737375696e67>100 348 Q/F4 10/Courier@0 SF<61707061726978202d2d7368656c6c2d6578616d706c6573> 100 372 Q F0 1.695<537570706f736520796f75722075736572206e616d65206973> 100 396 R F2<65657a>4.195 E F0 1.695 <616e6420796f757220686f6d65206469726563746f7279206973>4.195 F F4 <2f686f6d652f65657a>4.194 E F0 6.694<2e59>C 1.694 <6f75206f6674656e2076697369742061>-7.794 F 1.492 <6469726563746f72792063616c6c6564>100 408 R F4<2f686f6d652f65657a2f6376 732f78797a2f7466612f6661712f7a75742f6261722f666f6f>3.993 E F0 6.493 <2e54>C 1.493<68697320697320686f>-6.493 F 3.993<7774>-.25 G 3.993<6f63> -3.993 G<7265617465>-3.993 E <616e6420757365206120626f6f6b6d61726b20666f7220666f6f>100 420 Q F4<2f68 6f6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f6261722f666f6f3e> 100 444 Q F3<626d2066>6 E<6f6f>-.25 E F4<61646465643a20666f6f202d3e202f 686f6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f6261722f666f6f> 100 456 Q<2f686f6d652f65657a2f6376732f78797a2f7466612f6661712f7a75742f62 61722f666f6f3e>100 468 Q F3<6364>6 E F4<2f686f6d652f65657a3e>100 480 Q F3<746f2066>6 E<6f6f>-.25 E F4<2f686f6d652f65657a2f6376732f78797a2f7466 612f6661712f7a75742f6261722f666f6f3e>100 492 Q F0 .441<4966206f6e652062 6f6f6b6d61726b732061206469726563746f72792062792069747320747261696c696e67 20636f6d706f6e656e742061732068617070656e656420696e207468697320636173652c 206974206973206e6f74206e656365732d>100 516 R <7361727920746f207370656369667920746865206d61726b2e20427920646566>100 528 Q<61756c7420617070617269782077696c6c207573652074686520747261696c696e 6720636f6d706f6e656e7420617320746865206d61726b2e20536f>-.1 E F4<2f686f6d 652f65657a2f6376732f78797a2f7466612f6661712f7a75742f6261722f666f6f3e>100 552 Q F3<626d>6 E F4<61646465643a20666f6f202d3e202f686f6d652f65657a2f63 76732f78797a2f7466612f6661712f7a75742f6261722f666f6f>100 564 Q F0<6769> 100 588 Q -.15<7665>-.25 G 2.5<7374>.15 G <68652073616d6520726573756c742e>-2.5 E .099 <416e6f74686572207363656e6172696f20697320776865726520796f75206861>100 612 R .399 -.15<76652073>-.2 H .099 <6f6d65206469726563746f7279207468617420636f6e7461696e732061206c6172>.15 F .1<67697368206e756d626572206f66207375626469726563746f2d>-.18 F 1.608 <726965732c20616c6c206f6620776869636820796f752077>100 624 R 1.608 <6f756c64206c696b>-.1 F 4.108<6574>-.1 G 4.108<6f68>-4.108 G -2.25 -.2 <61762065>-4.108 H<626f6f6b6d61726b>4.308 E 4.108<65642e204966>-.1 F 1.608<746865207375626469726563746f72696573206861>4.108 F 1.907 -.15 <76652064>-.2 H<697374696e637469>.15 E -.15<7665>-.25 G .12 <6e616d657320746869732063616e206265206163686965>100 636 R -.15<7665>-.25 G 2.62<6469>.15 G 2.62<6e6f>-2.62 G .12<6e652066656c6c207377>-2.62 F .121<6f6f70206279206d61726b696e672074686520706172656e74206469726563746f 72792061732061>-.1 F F2<706f7274616c>2.621 E F0 2.621<2e54>C .121 <686973206973>-2.621 F .453<73696d696c617220746f20616464696e672074686520 706172656e74206469726563746f727920746f2074686520434450>100 648 R -1.11 <4154>-.92 G 2.953<4865>1.11 G -.4<6e76>-2.953 G .453 <69726f6e6d656e742076>.4 F .453<61726961626c652c2065>-.25 F .453 <786365707420746861742061707061726978>-.15 F .941<626f6f6b6d61726b732061 7265206e6f742070617274206f6620746865206364206e616d6573706163652e20497420 6973206172>100 660 R .942<6775656420696e>-.18 F F3<4e4f>3.442 E<544553> -.4 E F0 .942<746861742074686973206973206120676f6f64207468696e672e>3.442 F<436f6e736964657220746869733a>100 672 Q <6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<33>204 E 0 Cg EP %%Page: 4 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Courier@0 SF< 2f686f6d652f6376732f6261676765722f626f656d656c2f6d636c2f6d636c2f7372633e> 100 84 Q/F2 10/Times-Bold@0 SF<6c73>6 E F1 36<616c69656e2f204356532f>100 96 R 30<696d70616c612f204d616b6566696c652e616d>54 F 36 <524541444d452073686d63782f>12 F 36<61747469632f20676972616666652f>100 108 R 48<6c69622f204d616b6566696c652e696e>30 F 42 <7368636c2f2073686d782f>12 F 24 <636f6e747269622f20676d6f6e2e6f7574204d616b6566696c65206d636c2f>100 120 R 36<73686d636c2f207461757275732f>54 F F0 .208 <536f6d65206f6620746865207375626469726563746f72696573206861>100 144 R .508 -.15<7665206e>-.2 H .208 <6f742d736f2d64697374696e6374206e616d65732073756368206173>.15 F/F3 10 /Times-Italic@0 SF<636f6e74726962>2.708 E F0<616e64>2.708 E F3 <6174746963>2.708 E F0 2.708<2c62>C .207<757420746865>-2.908 F 2.707 <7968>-.15 G<617070656e>-2.707 E<746f20626520746865206469726563746f7269 6573206c6561737420766973697465642e>100 156 Q<49737375696e673a>5 E F1<2f 686f6d652f6376732f6261676765722f626f656d656c2f6d636c2f6d636c2f7372633e> 100 180 Q F2<706f7274616c>6 E F1<5b617070617269785d20657870616e64656420 3120706f7274616c20746f2031322064657374696e6174696f6e73>100 192 Q F0 .859 <7969656c647320616c6c206f6620746865207375626469726563746f72696573206173 2064657374696e6174696f6e7320626f6f6b6d61726b>100 216 R .86<656420627920 746865206c61737420636f6d706f6e656e74206f662074686569722070617468>-.1 F 2.975<6e616d652e20496e636964656e74616c6c79>100 228 R 2.975<2c64>-.65 G .475<69726563746f7279206e616d65732073756368206173>-2.975 F F1<435653> 2.975 E F0 .475<63616e2062652065>2.975 F .474<78706c696369746c792065> -.15 F .474<78636c756465642066726f6d2065>-.15 F .474 <7870616e73696f6e206279>-.15 F 1.573<73657474696e672074686520656e>100 240 R 1.573<7669726f6e6d656e742076>-.4 F<61726961626c65>-.25 E F1 <415050415249584558434c554445>4.073 E F0 1.573 <617070726f7072696174656c7920ad20726566657220746f2073656374696f6e>4.073 F F2<454e56492d>4.073 E -.3<524f>100 252 S<4e4d454e54>.3 E F0<2e>A 1.495 <426f6f6b6d61726b7320726573756c74696e672066726f6d20706f7274616c2065>100 276 R 1.495<7870616e73696f6e20617265206b>-.15 F 1.494 <65707420696e2061207365706172617465207265736f75726365208c6c652028736565> -.1 F F2<46494c4553>3.994 E F0<292e>A<506f7274616c2065>100 288 Q<787061 6e73696f6e732063616e206265207265637265617465642062792069737375696e67> -.15 E F1<61707061726978202d2d726568617368>100 312 Q F0<5468697320697320 75736566756c20746f2072658d6563742061206368616e676520696e2074686520646972 6563746f7279206e616d696e672073747275637475726520756e6465726e656174682061 20706f7274616c2e>100 336 Q/F4 10.95/Times-Bold@0 SF <6475706c69636174652072>20 352.8 Q<65736f6c7574696f6e>-.197 E F0 .696 <4170706172697820616c6c6f>100 364.8 R .696<7773206964656e746963616c2062 6f6f6b6d61726b7320746f20706f696e7420746f20646966>-.25 F .696 <666572656e74206c6f636174696f6e732e>-.25 F .697<5768656e2061736b>5.697 F .697<656420746f20766973697420737563682061>-.1 F <626f6f6b6d61726b2069742077696c6c20627920646566>100 376.8 Q <61756c742070726573656e742061206c697374206f66206f7074696f6e732e>-.1 E <546865>100 400.8 Q F2<2d6661>3.9 E -.1<766f>-.25 G<7572>.1 E F3 <3c6c6973743e>2.5 E F0 1.4<6f7074696f6e2063616e206265207573656420746f20 6175746f6d617465207265736f6c7574696f6e2e>3.9 F F2<3c6c6973743e>3.9 E F0 1.4<697320612073657175656e6365206f662073696e676c65>3.9 F 3.91 <636861726163746572732e20546865>100 412.8 R 1.41 <6f7264657220696e20776869636820746865>3.91 F 3.91<7961>-.15 G 1.41 <7265206769>-3.91 F -.15<7665>-.25 G 3.91<6e64>.15 G 1.41<656e6f74652074 6865206f7264657220696e207768696368207265736f6c7574696f6e2072756c65732061 7265>-3.91 F .08<6170706c6965642e2054686973206f7074696f6e20697320747970 6963616c6c79207573656420696e207468652064658c6e6974696f6e206f6620746865> 100 424.8 R F2<746f>2.579 E F0 .079 <66756e6374696f6e2f616c696173206f7220696e20746865206261736820636f6d2d> 2.579 F<706c6574696f6e20636f64652e>100 436.8 Q 1 <4475706c6963617465732061726520616c6c6f>100 460.8 R 1 <77656420626563617573652069742063616e2062652075736566756c20746f206f>-.25 F -.15<7665>-.15 G 1 <727772697465206120626f6f6b6d61726b20776974682061206e65>.15 F 3.5<776c> -.25 G<6f636174696f6e2e>-3.5 E <546865206f6c6420626f6f6b6d61726b206973206b>100 472.8 Q <6570742061732061206d6174746572206f6620706f6c6963>-.1 E<792e20557365> -.15 E F2<2d736d>2.5 E F0<746f2065>2.5 E <78706c696369746c7920737175617368206475706c6963617465732e>-.15 E<6c>100 496.8 Q F3<6c65>27.22 E<76656c>-.15 E F0 2.5<3b70>C <72656665722070617468732077697468206665>-2.5 E <77657220636f6d706f6e656e74732e>-.25 E 23.89<4c72>100 520.8 S -2.15 -.25 <65762065>-23.89 H<727365206f66207468652061626f>.25 E -.15<7665>-.15 G <2e>.15 E<6f>100 544.8 Q F3 .475<626f6f6b6d61726b206f72>25 F<646572>-.37 E F0 2.975<3b70>C .474<7265666572206f6c64657220656e74726965732e>-2.975 F .474<456e747269657320617070656172696e67206561726c69657220696e2074686520 8c6c652061726520636f6e73696465726564>5.474 F<6f6c646572>130 556.8 Q 2.928<2c62>-.4 G .428<7574207468652061637475616c2064617465206f6620637265 6174696e672074686520626f6f6b6d61726b206973206e6f742073746f7265642e> -3.128 F .428<526566657220746f>5.428 F F2 .428 <65646974696e6720626f6f6b2d>2.928 F<6d61726b73>130 568.8 Q F0 <666f72206d6f726520696e666f726d6174696f6e2e>2.5 E 22.78<4f72>100 592.8 S -2.15 -.25<65762065>-22.78 H<727365206f66207468652061626f>.25 E -.15 <7665>-.15 G<2e>.15 E<72>100 616.8 Q F3 -.37<7265>26.67 G <67756c6172208c72>-.03 E<7374>-.1 E F0 2.5<3b70>C<7265666572207265>-2.5 E<67756c617220626f6f6b6d61726b73206f>-.15 E -.15<7665>-.15 G 2.5<7270> .15 G<6f7274616c2065>-2.5 E<7870616e73696f6e2e>-.15 E 23.33<5272>100 640.8 S -2.15 -.25<65762065>-23.33 H<727365206f66207468652061626f>.25 E -.15<7665>-.15 G<2e>.15 E .485<496620746865726520617265207374696c6c2074 696573206166746572207468652073706563698c65642072756c6573206861>100 664.8 R .785 -.15<76652062>-.2 H .484 <65656e206170706c69656420617070617269782077696c6c2073696d706c792074616b> .15 F 2.984<6574>-.1 G .484<6865208c727374>-2.984 F 1.233 <6d61746368696e67206f7074696f6e2e20546869732062656861>100 676.8 R 1.234< 76696f75722063616e6e6f7420626520667572746865722073706563698c656420617320 7468652070726f6772616d20757365732061206e6f6e2d737461626c65>-.2 F <6f72646572696e6720726f7574696e652e>100 688.8 Q .672 <497420697320616e206162736f6c757465207072657265717569736974652074686174> 100 712.8 R F2<2d6661>3.171 E -.1<766f>-.25 G<7572>.1 E F0 .671<69732075 73656420696e20746865206261736820636f6d706c6574696f6e20636f64652e204f7468 65727769736520636f6d2d>3.171 F .533<706c6574696f6e2077696c6c2066>100 724.8 R .533<61696c2028666f722061206475706c69636174656420626f6f6b6d6172 6b29207768696c6520617070617269782069732077>-.1 F .533 <616974696e6720666f7220696e7075742e20526566657220746f2074686520746162> -.1 F<6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<34>204 E 0 Cg EP %%Page: 5 5 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F <636f6d706c6574696f6e206465736372697074696f6e2062656c6f>100 84 Q<772e> -.25 E/F1 10.95/Times-Bold@0 SF<737562646972>20 100.8 Q <6563746f72792073706563698c636174696f6e>-.197 E F0 2.148<5768656e206a75 6d70696e67202861707061726174696e672920796f752063616e20737065636966792061 6e206164646974696f6e616c207375626469726563746f72792061667465722074686520 626f6f6b6d61726b2e>100 112.8 R<417070617269782077696c6c20617070656e6420 746865207375626469726563746f727920746f207468652064657374696e6174696f6e2e> 100 124.8 Q .194<546869732069732075736566756c20666f722070726f6a65637473 2077697468206469726563746f7279206e6f64657320636f72726573706f6e64696e6720 776974682076>100 148.8 R .195 <657273696f6e732e20417373756d6520796f75206861>-.15 F .495 -.15<76652061> -.2 H <6469726563746f727920737472756374757265207375636820617320746869733a>100 160.8 Q/F2 10/Courier@0 SF<2f782f792f7a2f4f7075734d61676e756d2f76312f> 118 184.8 Q<2f782f792f7a2f4f7075734d61676e756d2f76322f>118 196.8 Q <2f782f792f7a2f4f7075734d61676e756d2f76332f>118 208.8 Q F0 1.216<497420 69732070726f6261626c79206561736965737420746f2073696d706c7920626f6f6b6d61 726b20746865204f7075734d61676e756d206469726563746f727920696e20736f6d6520 77>100 232.8 R 1.215<617920287361792077697468>-.1 F<626f6f6b6d61726b>100 244.8 Q F2<6f6d>3.408 E F0 .908<292e2059>B .908 <6f752063616e207468656e2069737375652027>-1.1 F F2 .908<746f206f6d207632> B F0 3.408<2774>C 3.408<6f6a>-3.408 G .908<756d7020746f>-3.408 F F2 <4f7075734d61676e756d2f7632>3.408 E F0 3.408<2e54>C .908 <686973206973206d6f7265>-3.408 F<8d65>100 256.8 Q .674<7869626c6520616e 64206d61696e7461696e61626c65207468616e206372656174696e6720626f6f6b6d6172 6b73>-.15 F F2<6f6d31>3.174 E F0<2c>A F2<6f6d32>3.174 E F0<2c>A F2 <6f6d33>3.174 E F0 5.674<2e4f>C .674 <6e6520636f756c6420616464204f7075734d61672d>-5.674 F <6e756d206173206120706f7274616c2c2062>100 268.8 Q <757420776974682067656e65726963206e616d65732073756368206173>-.2 E F2 <7631>2.5 E F0<74686973206973206e6f7420612076>2.5 E<6572792065>-.15 E <7874656e6469626c6520617070726f6163682e>-.15 E .71<53656520616c736f2074 68652074616220636f6d706c6574696f6e206465736372697074696f6e2062656c6f>100 292.8 R 3.211<772d69>-.25 G 3.211<7469>-3.211 G 3.211<7370>-3.211 G .711 <6f737369626c6520746f207461622d636f6d706c657465206f6e207375626469726563 746f72696573>-3.211 F <6f66207468652061707061726978206a756d70206469726563746f72792e>100 304.8 Q F1<74616220636f6d706c6574696f6e>20 321.6 Q F0 .968<546865206261736820 74616220636f6d706c6574696f6e20636f646520646f6573207477>100 333.6 R 3.467 <6f74>-.1 G .967<68696e67732e2046697273742c20697420697320706f737369626c 6520746f207461622d636f6d706c657465206f6e2061707061726978>-3.467 F .763 <626f6f6b6d61726b73207468656d73656c76>100 345.6 R .763<65732c2073686f> -.15 F .763<77696e672061206c697374696e67206f6620616c6c2061>-.25 F -.25 <7661>-.2 G .764<696c61626c6520626f6f6b6d61726b7320286f7220697465726174 696e67207468726f756768207468656d>.25 F .5<696e2063>100 357.6 R .5<79636c 6963206d6f64652c20646570656e64696e67206f6e20796f757220626173682073657474 696e6773292e205365636f6e642c206f6e6365206120626f6f6b6d61726b206861732062 65656e206769>-.15 F -.15<7665>-.25 G 3<6e74>.15 G<6162>-3 E 1.469 <636f6d706c6574696f6e2077696c6c206c697374206f722069746572617465206f>100 369.6 R -.15<7665>-.15 G 3.969<7261>.15 G 1.469<6c6c20746865207375626469 726563746f72696573206f6620746865206469726563746f7279206173736f6369617465 6420776974682074686174>-3.969 F .045<626f6f6b6d61726b2e2053706563696679 696e67206120737472696e672061667465722074686520626f6f6b6d61726b2077696c6c 206c696d6974207461622d636f6d706c6574696f6e20746f206469726563746f72696573 206d617463682d>100 381.6 R <696e6720746865207368656c6c2d7061747465726e20696e20737472696e672e>100 393.6 Q/F3 10/Times-Italic@0 SF -1.11<5665>5 G<7279>1.11 E F0 <75736566756c2e>2.5 E .636<4265206361726566756c20746f206e6f742072656d6f> 100 417.6 R .936 -.15<76652074>-.15 H<6865>.15 E/F4 10/Times-Bold@0 SF <2d6661>3.136 E -.1<766f>-.25 G<7572>.1 E F3<6c697374>2.5 E F0 .636<6f70 74696f6e2066726f6d20746865206261736820636f6d706c6574696f6e20636f64652e20 4974206973206e6563657373617279>3.136 F<746f207265736f6c76>100 429.6 Q 2.5<6564>-.15 G<75706c696361746520626f6f6b6d61726b732e>-2.5 E F1 <65646974696e6720626f6f6b6d61726b73>20 446.4 Q F0 .498 <4170706172697820617070656e6473206e65>100 458.4 R 2.998<7762>-.25 G .498 <6f6f6b6d61726b7320746f2074686520656e64206f6620746865202e61707061726978 7263208c6c652e204e6f7468696e672073746f707320796f752066726f6d20656469742d> -2.998 F .817 <696e6720746865208c6c652c20616e64207468697320697320696e2066>100 470.4 R .817<616374207265636f6d6d656e64656420696620666f722065>-.1 F .818<78616d 706c6520796f75206e65656420746f2067657420726964206f66206120626f6f6b6d6172 6b>-.15 F .688<616e64206e656974686572206f66>100 482.4 R F4<2d707572> 3.188 E<6765>-.1 E F0<2c>A F4<2d707572>3.188 E<67652d6d61726b>-.1 E F0 <2c>A F4<2d7364>3.188 E F0<2c>A F4<2d736d>3.187 E F0 .687 <66756c8c6c6c7320796f7572206e656564732e2049742077>3.187 F .687 <617320616e20656173792064657369676e2063686f696365>-.1 F<6e6f7420746f2065 717569702061707061726978207769746820656469746f72206361706162696c69746965 732e>100 494.4 Q F1<636f7079696e6720616e64206d6f>20 511.2 Q <76696e67208c6c6573>-.11 E F0<4974206973207374726169676874666f7277>100 523.2 Q<61726420746f20636f70>-.1 E 2.5<796f>-.1 G 2.5<726d>-2.5 G .3 -.15<6f7665208c>-2.5 H<6c657320746f206c6f636174696f6e73206b6e6f>.15 E <776e20627920617070617269782e204578616d706c65733a>-.25 E F2 <4241534820616e642076617269616e7473>100 547.2 Q <637020464f4f20242861707061726978207a6f656d29>118 559.2 Q <6d762042415220242861707061726978207a6f656d20646f6329>118 571.2 Q <6d762042415220242861707061726978207a6f656d20646f63292f74657374>118 583.2 Q<43534820616e642076617269616e7473>100 607.2 Q <637020464f4f206061707061726978207a6f656d60>118 619.2 Q <6d7620424152206061707061726978207a6f656d20646f63602f74657374>118 631.2 Q F1<6c697374696e6720626f6f6b6d61726b73>20 660 Q F0 1.707 <53696d706c792069737375696e672061707061726978206769>100 672 R -.15<7665> -.25 G 4.207<7379>.15 G 1.707<6f752061206c697374206f6620626f6f6b6d61726b 732067726f7570656420696e746f2074687265652063617465>-4.207 F 1.707 <676f726965732c20706f7274616c732c>-.15 F -.15<6578>100 684 S .427 <70616e73696f6e732c20616e6420626f6f6b6d61726b732e2055736520746865>.15 F F4<2d64>2.927 E F0 .427<6f7074696f6e20746f2064756d7020746865207265736f75 726365208c6c6520746f205354444f55542065>2.927 F .426<786163746c79206173> -.15 F .381<69742069732e20546869732063616e2062652075736566756c207768656e 20796f7520696e74656e6420746f2075736520746865>100 696 R F4<2d75>2.882 E F3<6e756d>2.5 E F0 .382<6f7074696f6e20746f2072656d6f>2.882 F .682 -.15 <76652062>-.15 H .382<6f6f6b6d61726b73206f7220706f72>.15 F<2d>-.2 E <74616c7320746861742077657265206d6f737420726563656e746c792061646465642e> 100 708 Q<6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<35>204 E 0 Cg EP %%Page: 6 6 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F<557365>100 84 Q/F1 10/Times-Bold@0 SF<2d6c>3.131 E F0 .631<746f206c69737420616c6c2061>3.131 F -.25<7661>-.2 G .631<696c61626c65206a756d707320776974686f757420746865 69722064657374696e6174696f6e732e>.25 F .63 <546865206a756d7073206172652067726f7570656420696e746f2065>5.631 F <7870616e2d>-.15 E <73696f6e7320726573756c74696e672066726f6d20706f7274616c7320616e64207265> 100 96 Q<67756c617220626f6f6b6d61726b732e>-.15 E/F2 10.95/Times-Bold@0 SF<4f5054494f4e53>20 112.8 Q F0 -.15<466f>100 124.8 S 4.036<7262>.15 G 1.536<6f6f6b6d61726b696e6720616e64206a756d70696e672061707061726978206973 206265737420696e>-4.036 F -.2<766f>-.4 G -.1<6b65>.2 G 4.036<6462>.1 G 4.036<7975>-4.036 G 1.536 <73696e672074686520616c69617365732028746373682d76>-4.036 F 1.537 <617269616e747329206f72>-.25 F 1.723 <66756e6374696f6e73202873682f6261736829206c697374656420696e>100 136.8 R F1<46494c4553>4.223 E F0 6.723<2e41>C 1.723 <707061726978206861732061206665>-6.723 F 4.223<776f>-.25 G 1.723 <7074696f6e732074686174206172652075736566756c20666f72207072756e696e672c> -4.223 F<737175617368696e6720616e64207265686173696e6720626f6f6b6d61726b 732e2054686573652061726520626573742069737375656420627920696e>100 148.8 Q -.2<766f>-.4 G<6b696e672061707061726978206469726563746c792e>.2 E 1.111< 496620796f752061726520696e746572657374656420696e206d61726b73206f72206465 7374696e6174696f6e73206d61746368696e672061206365727461696e20706174746572 6e2c2073696d706c792069737375652061707061726978>100 172.8 R <776974686f7574206172>100 184.8 Q<67756d656e747320616e642070697065206974 207468726f75676820796f75722070726f6772616d206f662063686f6963652e>-.18 E .295<556e617279206f7074696f6e73202874686f736520776974686f7574206172>100 208.8 R .294 <67756d656e74732920757375616c6c792073746172742077697468207477>-.18 F 2.794<6f68>-.1 G .294<797068656e732065>-2.844 F .294 <786365707420666f72207374616e64617264697a6564>-.15 F .547 <6f7074696f6e732073756368206173>100 220.8 R F1<2d68>3.047 E F0 5.547 <2e4f>C .547<7074696f6e7320746861742074616b>-5.547 F 3.047<6561>-.1 G 3.047<6e61>-3.047 G -.18<7267>-3.047 G .548 <756d656e742063616e20626520636f6e>.18 F -.15<7665>-.4 G .548 <7274656420746f206120756e617279206b>.15 F -.15<6579>-.1 G<3d76>.15 E .548<616c7565206e6f74612d>-.25 F<74696f6e2c20652e672e>100 232.8 Q F1 <2d707572>2.5 E<67652d6d61726b2066>-.1 E<6f6f>-.25 E F0<69732065717569> 2.5 E -.25<7661>-.25 G<6c656e7420746f>.25 E F1<2d2d707572>2.5 E <67652d6d61726b>-.1 E F0<3d>A F1 -.25<666f>C<6f>.25 E F0<2e>A <5768656e20696e>100 256.8 Q -.2<766f>-.4 G -.1<6b65>.2 G 2.5<6477>.1 G <6974686f7574206172>-2.5 E<67756d656e747320617070617269782077696c6c2073 696d706c792064756d702069747320626f6f6b6d61726b732e>-.18 E F1 <2d2d6164642d6d61726b>100 280.8 Q F0<28>2.5 E/F3 10/Times-Italic@0 SF <616464206a756d7020626f6f6b6d61726b>A F0<29>A 2.523 <54686973206f7074696f6e732065>130 292.8 R 2.522 <78706563747320747261696c696e67>-.15 F F3 2.522 <5b6d61726b205b64657374696e6174696f6e5d5d>5.022 F F0<6172>5.022 E 5.022 <67756d656e742873292e20426f7468>-.18 F<6172>5.022 E 2.522 <67756d656e747320617265>-.18 F .14 <6f7074696f6e616c2e20496620612073696e676c65206172>130 304.8 R .14 <67756d656e74206973206769>-.18 F -.15<7665>-.25 G 2.64<6e69>.15 G 2.64 <7469>-2.64 G 2.64<7369>-2.64 G .14<6e746572707265746564206173206120626f 6f6b6d61726b206e616d6520746f206265206d6170706564>-2.64 F .335 <746f207468652063757272656e74206469726563746f72792e>130 316.8 R .335 <4966207477>5.335 F 2.835<6f61>-.1 G -.18<7267>-2.835 G .334 <756d656e747320617265206769>.18 F -.15<7665>-.25 G 2.834<6e74>.15 G .334 <6865206c617374206172>-2.834 F .334<67756d656e742069732074616b>-.18 F .334<656e2061732074686520746172>-.1 F<2d>-.2 E .514 <676574206469726563746f72792e204966206e6f206172>130 328.8 R .514 <67756d656e74206973206769>-.18 F -.15<7665>-.25 G 3.015<6e61>.15 G .515< 7070617269782077696c6c20656e6c697374207468652063757272656e74206469726563 746f7279206173206120746172>-3.015 F<676574>-.18 E<626f6f6b6d61726b>130 340.8 Q<65642062792074686520747261696c696e6720636f6d706f6e656e74206f6620 746865206469726563746f727920706174682e>-.1 E F1 <2d2d6164642d706f7274616c>100 364.8 Q F0<28>2.5 E F3 <61646420706f7274616c20626f6f6b6d61726b>A F0<29>A .555<54686973206f7074 696f6e20656e6c697374732061206469726563746f7279206173206120706f7274616c20 616e64206164647320616c6c207375626469726563746f7269657320617320626f6f6b6d 61726b732e20546865>130 376.8 R 1.396<6e616d65206f662074686520626f6f6b6d 61726b2069732073696d706c7920746865206e616d65206f662074686520737562646972 6563746f72792e20427920646566>130 388.8 R 1.396 <61756c74207468652063757272656e74>-.1 F .266 <6469726563746f7279206973206164646564206173206120706f7274616c2e>130 400.8 R .265<416e206f7074696f6e616c20747261696c696e67206172>5.265 F .265 <67756d656e742077696c6c206f>-.18 F -.15<7665>-.15 G .265 <727269646520746869732062656861>.15 F<76696f7572>-.2 E<616e6420696e7374 65616420626520696e7465727072657465642061732074686520706f7274616c206c6f63 6174696f6e2e>130 412.8 Q F1<2d736d>100 436.8 Q F0<3c6d61723e2028>2.5 E F3<7371756173682072>A<65706561746564206d61726b73>-.37 E F0<29>A .476<41 7070617269782077696c6c2073717561736820626f6f6b6d61726b732077697468206d61 726b>130 448.8 R/F4 10/Courier@0 SF<3c6d61726b3e>2.976 E F0 5.476<2e54>C .476<6869732069732075736566756c207768656e2061206d61726b20706f696e7473> -5.476 F<746f20612076>130 460.8 Q<657273696f6e65642070726f6a6563742c2061 6e64207468652070726f6a656374206973207570646174656420746f2061206e65>-.15 E 2.5<7776>-.25 G<657273696f6e20616e642061206e65>-2.65 E 2.5<7764>-.25 G <69726563746f72792e>-2.5 E 1.128<417070617269782077696c6c20627920646566> 130 484.8 R 1.128<61756c74206b>-.1 F 1.128<65657020746865206c617374206f 6e65206f6363757272696e6720696e20746865207265736f75726365208c6c652028636f 72726573706f6e64696e67>-.1 F<77697468>130 496.8 Q F1<2d6661>2.636 E -.1 <766f>-.25 G<7572204f>.1 E F0 .136 <292e2054686973206f7074696f6e20726573706563747320746865>B F1<2d6661> 2.637 E -.1<766f>-.25 G<7572>.1 E F0 .137<6f7074696f6e206966206769>2.637 F -.15<7665>-.25 G .137 <6e2e204475706c69636174696e6720616e20616c7265616479>.15 F -.15<6578>130 508.8 S .864<697374696e67206d61726b2063616e2062652075736566756c20776865 6e206974206964656e74698c657320612070726f6a65637420666f722077686963682074 686520756e6465726c79696e672064697265632d>.15 F .357 <746f7279206368616e6765732065>130 520.8 R -.15<7665>-.25 G .357<7279206f 6e636520696e2061207768696c652028652e672e207468652070726f6a65637420697320 646f>.15 F .357<776e6c6f616465642066726f6d2065>-.25 F .358 <787465726e616c20736f7572636573>-.15 F 1.354 <616e6420636f6d657320776974682076>130 532.8 R 1.353<657273696f6e20696e66 6f726d6174696f6e292e204974206973206e6f74207374726963746c79206e6563657373 61727920746f2073717561736820626f6f6b6d61726b73>-.15 F<73696e6365>130 544.8 Q F1<746f>5.157 E F0 2.657<66756e6374696f6e732f6d6163726f73207468 617420617265206571756970706564207769746820746865>5.157 F F1<2d6661>5.157 E -.1<766f>-.25 G<7572>.1 E F0 2.658 <6f7074696f6e2077696c6c2067656e6572616c6c79>5.158 F<7265736f6c76>130 556.8 Q 2.5<6564>-.15 G<75706c6963617465206d6174636865732e>-2.5 E F1 <2d7364>100 580.8 Q F0<3c6d61726b3e2028>2.5 E F3<7371756173682072>A <657065617465642064657374696e6174696f6e73>-.37 E F0<29>A .629<416c6c206f 7468657220626f6f6b6d61726b732077697468207468652073616d652064657374696e61 74696f6e206173>130 592.8 R F4<3c6d61726b3e>3.128 E F0 .628 <6172652072656d6f>3.128 F -.15<7665>-.15 G 3.128<642e2054686973>.15 F .628<69732075736566756c>3.128 F .484<7768656e2061206769>130 604.8 R -.15 <7665>-.25 G 2.984<6e64>.15 G .484<657374696e6174696f6e2068617320616371 7569726564206d756c7469706c6520626f6f6b6d61726b7320616e6420796f7520646563 69646520746f20736574746c65206f6e2061>-2.984 F -.1<6661>130 616.8 S -.2 <766f>-.1 G<75726974652e>.2 E F1<2d6c6d>100 640.8 Q F0<3c6d61726b3e2028> 2.5 E F3<6c69737420626f6f6b6d61726b7320776974682074686973206d61726b>A F0 <29>A<4974206c6973747320616c6c20626f6f6b6d61726b73>130 652.8 Q F4 <3c6d61726b3e>2.5 E F0<286e6f74696e672074686174206974206d617920706f696e 7420746f206d756c7469706c65206c6f636174696f6e73292e>2.5 E F1<2d6c64>100 676.8 Q F0<3c6d61726b3e2028>2.5 E F3<6c6973742072>A <657065617465642064657374696e6174696f6e73>-.37 E F0<29>A 1.457 <54686973206c6973747320616c6c20626f6f6b6d61726b73>130 688.8 R F4 <3c6d61726b3e>3.956 E F0 1.456<286e6f74696e672074686174206974206d617920 706f696e7420746f206d756c7469706c65206c6f636174696f6e732920616e64>3.956 F .028<6164646974696f6e616c6c79206c6973747320616c6c206f7468657220626f6f6b 6d61726b732074686174207368617265207468652064657374696e6174696f6e20776974 6820616e>130 700.8 R 2.528<796f>-.15 G 2.528<6674>-2.528 G .028 <6865208c72737420626f6f6b2d>-2.528 F<6d61726b732e205468697320616c6c6f> 130 712.8 Q<7773206f6e6520746f207072656469637420746865206566>-.25 E <66656374206f662069737375696e67>-.25 E F4 <61707061726978202d7364203c6d61726b3e>2.5 E F0<2e>A <6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<36>204 E 0 Cg EP %%Page: 7 7 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Times-Bold@0 SF<2d707572>100 84 Q<6765>-.1 E F0<7061742028>2.5 E/F2 10/Times-Italic@0 SF<64656c65746520626f6f6b6d61726b73>A F0<29>A 2.583<546869732064656c6574 657320626f6f6b6d61726b732077686572652064657374696e6174696f6e206d61746368 6573>130 96 R F2<706174>5.083 E F0 7.583<2e41>C 2.583 <6c6c2064656c6574656420626f6f6b6d61726b7320617265>-7.583 F 1.206 <7072696e74656420746f205354444f55542e205468757320696620796f75207265>130 108 R 1.206<677265742064656c6574696e67206120626f6f6b6d61726b206974206973 206561737920746f20616464206974206261636b2e>-.15 F <506f7274616c2073706563698c636174696f6e7320617265206e65>130 120 Q -.15 <7665>-.25 G 2.5<7261>.15 G -.25<6666>-2.5 G<65637465642e>.25 E F1 <2d707572>100 144 Q<67652d6d61726b>-.1 E F0<28>2.5 E F2<706174>A F0<29>A 3.513<546869732064656c6574657320626f6f6b6d61726b73207768657265206d61726b 206d617463686573>130 156 R F2<706174>6.013 E F0 8.513<2e50>C 3.513 <6f7274616c2073706563698c636174696f6e7320617265206e65>-8.513 F -.15 <7665>-.25 G<72>.15 E<6166>130 168 Q<6665637465642e>-.25 E F1<2d64>100 192 Q F0<28>2.5 E F2<64756d702072>A<65736f7572>-.37 E <6365208c6c6520746f205354444f5554>-.37 E F0<29>A <44756d70207265736f75726365208c6c6520746f205354444f55542e>130 204 Q F1 <2d6c>100 228 Q F0<28>2.5 E F2<6c69737420617661696c61626c65206a756d7073> A F0<29>A .824<4c6973742061>130 240 R -.25<7661>-.2 G .824<696c61626c65 206a756d7073207061726167726170682d7374796c652e20506f7274616c207370656369 8c636174696f6e73207468656d73656c76>.25 F .825<6573206172652065>-.15 F .825<78636c756465642c20616e64>-.15 F<7265>130 252 Q .116<67756c6172206a 756d707320616e64206a756d707320726573756c74696e672066726f6d20706f7274616c 2065>-.15 F .116 <7870616e73696f6e7320617265206c697374656420756e64657220646966>-.15 F .115<666572656e7420686561642d>-.25 F<6572732e>130 264 Q F1<2d75>100 288 Q F0<3c6e756d3e2028>2.5 E F2 -.37<7265>C<6d6f>.37 E <7665206c617374203c6e756d3e206164646974696f6e73>-.1 E F0<29>A<52656d6f> 130 300 Q .3 -.15<7665206c>-.15 H<617374203c6e756d3e206164646974696f6e73 2e20506f7274616c2073706563698c636174696f6e7320616e64207265>.15 E <67756c6172206a756d707320617265207472656174656420616c696b>-.15 E<652e> -.1 E F1<2d2d72>100 324 Q<6568617368>-.18 E F0<28>2.5 E F2 -.37<7265>C <2d65>.37 E<7870616e6420706f7274616c20626f6f6b6d61726b73>-.2 E F0<29>A .663<417070617269782077696c6c2072657265616420746865207265736f7572636520 8c6c6520616e6420726565>130 336 R .664<7870616e6420706f7274616c206c6f6361 74696f6e732e2055736566756c206966206469726563746f72696573>-.15 F<6861>130 348 Q .311 -.15<76652062>-.2 H .011 <65656e2061646465642c2072656e616d65642c206f722072656d6f>.15 F -.15<7665> -.15 G .011<642e20526566657220746f2073656374696f6e>.15 F F1<454e564952> 2.511 E<4f4e4d454e54>-.3 E F0 .01<666f7220746865206566>2.511 F<66656374> -.25 E<746861742074686520656e>130 360 Q<7669726f6e6d656e742076>-.4 E <61726961626c65>-.25 E/F3 10/Courier@0 SF<415050415249584558434c554445> 2.5 E F0<686173206f6e20706f7274616c2065>2.5 E<7870616e73696f6e2e>-.15 E F1<2d6661>100 384 Q -.1<766f>-.25 G<7572>.1 E F0<3c6c6973743e2028>2.5 E F2<736574206475706c696361742072>A<65736f6c7574696f6e20706f6c696379>-.37 E F0<29>A<54686973206f7074696f6e2068617320697473206f>130 396 Q <776e2073656374696f6e2e20526566657220746f>-.25 E F1 <6475706c69636174652072>2.5 E<65736f6c7574696f6e>-.18 E F0<2e>A F1 <2d2d637764>100 420 Q F0<28>2.5 E F2<7573652067>A <65746377642833292c206e6f7420707764283129>-.1 E F0<29>A 1.533 <427920646566>130 432 R 1.533 <61756c74206170617269782075736573207468652070726f6772616d>-.1 F F2 <707764>4.033 E F0 1.533 <28312920726174686572207468616e207468652073797374656d2063616c6c>B F2 -.1 <6765>4.033 G<74637764>.1 E F0 1.534<2833292e204f6e>B 1.032 <736f6d652073797374656d732069742077>130 444 R 1.031<617320666f756e642074 68617420746865206c617474657220726573756c747320696e2070617468732074686174 20636f6e7461696e206d616368696e652d73706563698c63>-.1 F <6d6f756e7420636f6d706f6e656e74732e>130 456 Q <41707070617269782077696c6c20757365>5 E F2 -.1<6765>2.5 G<74637764>.1 E F0<283329207768656e>A F1<2d2d637764>2.5 E F0<697320757365642e>2.5 E F1 <2d2d7368656c6c2d6578616d706c6573>100 480 Q F0<28>2.5 E F2 <6f75747075742065>A<78616d706c65206d616372>-.2 E<6f73>-.45 E F0<29>A <54686973206f7574707574732065>130 492 Q <78616d706c65206d6163726f732e20546865>-.15 E 2.5<7961>-.15 G <726520616c736f206c697374656420696e20746865>-2.5 E F1<46494c4553>2.5 E F0<73656374696f6e2074686f7567682e>2.5 E F1<2d2d62>100 516 Q<75>-.2 E F0 <28>2.5 E F2<6372>A<6561746520626163>-.37 E<6b7570206f66207468652072>-.2 E<65736f7572>-.37 E<6365208c6c65>-.37 E F0<29>A<546869732063726561746573 20746865206261636b7570208c6c6520696e202e6170706172697872632e62>130 528 Q <752e>-.2 E F1<2d62>100 552 Q<75>-.2 E F0<666e616d652028>2.5 E F2<6372>A <6561746520626163>-.37 E<6b7570206f66207468652072>-.2 E<65736f7572>-.37 E<6365208c6c65>-.37 E F0<29>A <54686973206372656174657320746865206261636b7570208c6c6520696e>130 564 Q F2<666e616d65>2.5 E F0 2.5<2e55>C<7365>-2.5 E F1<2d64>2.5 E F0<6f72>2.5 E F1<2d62>2.5 E 2.5<752d>-.2 G F0<746f2064756d7020746f205354444f55542e>A F1<2d68>100 588 Q F0<28>2.5 E F2<73686f772073796e6f70736973>A F0<29>A F1 <2d2d617072>100 600 Q<6f706f73>-.18 E F0<28>2.5 E F2 <73686f772073796e6f70736973>A F0<29>A <7072696e742073796e6f70736973206f6620616c6c206f7074696f6e73>130 612 Q/F4 10.95/Times-Bold@0 SF<454e564952>20 628.8 Q<4f4e4d454e54>-.329 E F0 <415050>100 640.8 Q<415249584558434c554445>-.92 E 4.159<546869732076>130 652.8 R 4.159<61726961626c652073706563698c65732065>-.25 F 4.159 <78636c7573696f6e2062656861>-.15 F 4.159 <76696f7572207768656e20706f7274616c73206172652065>-.2 F 4.159 <7870616e646564207769746820746865>-.15 F F3<2d2d726568617368>130 664.8 Q F0 2.5<6f7074696f6e2e204974>2.5 F<6861732074686520666f6c6c6f>2.5 E <77696e672073796e7461783a>-.25 E F3<3c5b3a2c5d5b3c737472696e673e5d3e2b> 148 688.8 Q F0 .495<546861742069732c2061206c697374206f66206e616d65732077 6974682065616368206e616d65207072656365646564206279206120636f6c6f6e206f72 206120636f6d6d612e>130 712.8 R 2.994<4163>5.494 G .494 <6f6c6f6e20696e64692d>-2.994 F 2.871<63617465732074686174>130 724.8 R F3 <3c737472696e673e>5.371 E F0 2.872<74726967676572732065>5.372 F 2.872<78 636c7573696f6e206f66206469726563746f7279206e616d657320666f72207768696368 2074686520747261696c696e67>-.15 F <6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<37>204 E 0 Cg EP %%Page: 8 8 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F 2.091 <636f6d706f6e656e74206973206964656e746963616c20746f>130 84 R/F1 10 /Courier@0 SF<3c737472696e673e>4.591 E F0 7.091<2e41>C 2.091 <636f6d6d6120696e646963617465732074686174>-2.5 F F1<3c737472696e673e> 4.591 E F0<7472696767657273>4.591 E -.15<6578>130 96 S .341<636c7573696f 6e206f66206469726563746f7279206e616d657320666f72207768696368207468652074 7261696c696e6720636f6d706f6e656e7420636f6e7461696e73>.15 F F1 <3c737472696e673e>2.841 E F0 .341<61732061>2.841 F 2.5 <737562737472696e672e20436f6e73696465723a>130 108 R F1 <6578706f727420415050415249584558434c5544453d3a4356533a6c69622c746d70> 148 132 Q 6<23412d65>48 G<78616d706c65>-6 E <6578706f727420415050415249584558434c5544453d2c>148 144 Q 6<23422d63>114 G<7572696f73697479>-6 E F0 .366<546865208c7273742065>130 168 R .366 <78636c75646573206469726563746f7279206e616d6573>-.15 F F1<435653>2.866 E F0<616e64>2.866 E F1<6c6962>2.866 E F0 .366<616e6420616e>2.866 F 2.866 <7964>-.15 G .365<69726563746f7279206e616d65206861>-2.866 F<76696e67>-.2 E F1<746d70>2.865 E F0<6173>2.865 E 2.582<6173>130 180 S 2.582 <7562737472696e672e20546865>-2.582 F .082<7365636f6e642065>2.582 F .082 <78616d706c652077696c6c206566>-.15 F<6665637469>-.25 E -.15<7665>-.25 G .083<6c792064697361626c6520706f7274616c732c206173206974207370658c636965 732074686520656d707479>.15 F<737472696e67207768696368206973206120737562 737472696e67206f6620616c6c20737472696e67732e>130 192 Q<415050>100 216 Q <4152495854>-.92 E -.4<4147>-.93 G 1.804<546869732076>130 228 R 1.804<61 726961626c652c206966207365742c20697320696e636f72706f726174656420696e746f 20746865206e616d6573206f66207468652061707061726978207265736f75726365208c 6c65732e204279>-.25 F<646566>130 240 Q .987 <61756c7420746865736520617265>-.1 F F1<2e617070617269787263>3.488 E F0 <616e64>3.488 E F1<2e61707061726978657870616e64>3.488 E F0 5.988<2e57>C .988<68656e20415050>-5.988 F<4152495854>-.92 E 1.788 -.4<41472069>-.93 H 3.488<7373>.4 G<6574>-3.488 E<746f>130 252 Q F1<3c7461673e>4.405 E F0 <746865>4.405 E 4.404<7962>-.15 G<65636f6d65>-4.404 E F1 <2e3c7461673e617070617269787263>4.404 E F0<616e64>4.404 E F1 <2e3c7461673e61707061726978657870616e64>4.404 E F0 6.904<2e54>C<686973> -6.904 E <63616e206265207573656420652e672e20746f206d61696e7461696e20646966>130 264 Q<666572656e742073657473206f6620626f6f6b6d61726b73206f6e20646966> -.25 E<666572656e7420686f7374206d616368696e65732e>-.25 E<415050>100 288 Q<415249584c4f47>-.92 E .047<546869732076>130 300 R .048<61726961626c65 2c206966207365742c20697320696e74657270726574656420617320746865206e616d65 206f662061206c6f67208c6c652e>-.25 F .048<546865206c6f67208c6c65206b> 5.048 F .048<6565707320747261636b206f6620616c6c>-.1 F<6e65>130 312 Q .807<776c7920616464656420626f6f6b6d61726b7320616e6420706f7274616c732077 6974686f75742065>-.25 F -.15<7665>-.25 G 3.307<7264>.15 G .807 <656c6574696e6720616e>-3.307 F .806 <797468696e672c20696e207468652073616d6520666f726d6174>-.15 F <617320746865>130 324 Q F1<2e617070617269787263>2.5 E F0 <8c6c652e20496620746869732076>2.5 E <61726961626c65206973206e6f7420736574206e6f7468696e6720697320747261636b> -.25 E<65642e>-.1 E<415050>100 348 Q<415249585055524745>-.92 E .992 <54686973206368616e676573207468652077>130 360 R .992 <617920617070617269782064756d707320707572>-.1 F .993 <67656420626f6f6b6d61726b7320746f205354444f55542e>-.18 F .993 <427920646566>5.993 F .993<61756c7420746865>-.1 F<79>-.15 E 1.209<617265 2064756d70656420617320636f6d6d616e64206c696e657320746861742077696c6c2072 65696d706f72742074686520626f6f6b6d61726b73206966206973737565642028692e65 2e2063757420616e64>130 372 R 3.224<706173746564292e204279>130 384 R .724 <73657474696e6720746869732076>3.224 F .724 <61726961626c6520746f203120707572>-.25 F .725<67656420626f6f6b6d61726b73 206172652064756d70656420696e2074686520666f726d61742075736564>-.18 F <696e20746865>130 396 Q F1<2e617070617269787263>2.5 E F0<8c6c652e>2.5 E /F2 10.95/Times-Bold@0 SF<46494c4553>20 412.8 Q F0 -1.1<596f>100 424.8 S 3.618<7573>1.1 G 1.118<686f756c642075736520616c6961736573206f722066756e 6374696f6e7320746f206d616b>-3.618 F 3.617<6561>-.1 G 1.117 <707061726978207265616c6c792075736566756c2e>-3.617 F 1.117 <476574207468656d2066726f6d2061707061726978206279>6.117 F<6769>100 436.8 Q .414<76696e6720697420746865202d2d7368656c6c2d65>-.25 F .414<78616d706c 6573206f7074696f6e2c206f722066726f6d20667572746865722062656c6f>-.15 F 2.914<772e204e6f7465>-.25 F .415 <74686520667261676d656e7420746861742070726f>2.914 F<7669646573>-.15 E/F3 10/Times-Bold@0 SF<746f>2.915 E F0<6172>100 448.8 Q <67756d656e7420636f6d706c6574696f6e20696e20626173682e>-.18 E <24484f4d452f2e617070617269787263>100 472.8 Q .502<54686973206973207468 65207072696d617279207265736f75726365208c6c652e20546865726520697320757375 616c6c79206e6f206e65656420746f20656469742069742062792068616e642e20536f6d 6574696d6573>130 484.8 R .18<69742063616e2062652075736566756c20746f2065 6469742062792068616e6420746f2072656d6f>130 496.8 R .481 -.15<76652061> -.15 H 2.681<6e75>.15 G<6e77>-2.681 E .181 <616e74656420626f6f6b6d61726b3b20726566657220746f>-.1 F F3 .181 <65646974696e6720626f6f6b2d>2.681 F<6d61726b73>130 508.8 Q F0<2e>A <24484f4d452f2e6170706172697872632e62>100 532.8 Q<75>-.2 E 1.037 <4170706172697820637265617465732061206261636b2d7570208c6c65207768656e65> 130 544.8 R -.15<7665>-.25 G 3.537<7269>.15 G 3.537<7469>-3.537 G 3.537 <7361>-3.537 G<736b>-3.537 E 1.037<656420746f2072656d6f>-.1 F 1.336 -.15 <76652065>-.15 H 1.036<6e74726965732066726f6d2069742e20526566657220746f> .15 F F3 .905<65646974696e6720626f6f6b6d61726b73>130 556.8 R F0 .905 <666f72206f7074696f6e7320696e647563696e672072656d6f>3.405 F -.25<7661> -.15 G 3.405<6c2e2059>.25 F .906<6f752063616e2065>-1.1 F .906 <78706c696369746c7920726571756972652061206261636b7570>-.15 F <746f206265206d61646520627920656974686572206f66>130 568.8 Q F3<2d2d62> 2.5 E<75>-.2 E F0<6f72>2.5 E F3<2d62>2.5 E<75>-.2 E/F4 10/Times-Italic@0 SF<666e616d65>2.5 E F0<2e>A<24484f4d452f2e61707061726978>100 592.8 Q -.15<6578>-.15 G<70616e64>.15 E .31 <5468697320636f6e7461696e7320626f6f6b6d61726b732074686174206172652065> 130 604.8 R .31<7870616e6465642066726f6d20706f7274616c732e>-.15 F 2.81 <4170>5.31 G .31<6f7274616c2069732073696d706c7920736f6d652064697265632d> -2.81 F .047<746f72792e20546865206e616d6573206f6620616c6c20737562646972 6563746f72696573206172652074616b>130 616.8 R .047<656e20617320626f6f6b6d 61726b73207468617420706f696e7420746f2074686f73652073756264697265632d>-.1 F 2.5<746f726965732e2054686973>130 628.8 R <8c6c652063616e206265207265637265617465642062792069737375696e67>2.5 E F1 <61707061726978202d2d726568617368>130 652.8 Q F0 <24484f4d452f2e626173687263>100 688.8 Q<24484f4d452f2e746373687263>100 700.8 Q<24484f4d452f2e6373687263>100 712.8 Q .591<4164642074686520636f64 6520796f75206e65656420746f2074686520617070726f707269617465207263208c6c65 2e20546865206d6163726f7320616e642066756e6374696f6e732062656c6f>130 724.8 R 3.091<7770>-.25 G<6f696e74>-3.091 E <6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<38>204 E 0 Cg EP %%Page: 9 9 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10 /Times-Italic@0 SF<6364>130 84 Q F0 <28312920696e2074686520726967687420646972656374696f6e2e>A <6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<39>204 E 0 Cg EP %%Page: 10 10 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Courier@0 SF <424153482d7374796c652066756e6374696f6e73>100 84 Q<2d2d2d>100 96 Q <66756e6374696f6e20746f202829207b>100 108 Q <6966207465737420222432223b207468656e>118 120 Q<636420222428617070617269 7820222431222022243222207c7c206563686f202e29223b>130 132 Q<656c7365>118 144 Q<636420222428617070617269782022243122207c7c206563686f202e29223b>130 156 Q<6669>118 168 Q<707764>118 180 Q<7d>100 192 Q <66756e6374696f6e20626d202829207b>100 204 Q <6966207465737420222432223b207468656e>118 216 Q <61707061726978202d2d6164642d6d61726b202224312220222432223b>136 228 Q <656c6966207465737420222431223b207468656e>118 240 Q <61707061726978202d2d6164642d6d61726b20222431223b>136 252 Q<656c7365>118 264 Q<61707061726978202d2d6164642d6d61726b3b>136 276 Q<6669>118 288 Q <7d>100 300 Q<66756e6374696f6e20706f7274616c202829207b>100 312 Q <6966207465737420222431223b207468656e>118 324 Q <61707061726978202d2d6164642d706f7274616c20222431223b>136 336 Q <656c7365>118 348 Q<61707061726978202d2d6164642d706f7274616c3b>136 360 Q <6669>118 372 Q<7d>100 384 Q 6<2366>100 396 S<756e6374696f6e20746f206765 6e6572617465206c697374206f6620636f6d706c6574696f6e732066726f6d202e617070 617269787263>-6 E <66756e6374696f6e205f617070617269785f616c6961736573202829>100 408 Q 18 <7b63>100 420 S<75723d2432>-18 E<6469723d2433>124 432 Q <434f4d505245504c593d2829>124 444 Q <6966205b2022243122203d3d2022243322205d>124 456 Q<7468656e>124 468 Q<43 4f4d505245504c593d28202428206361742024484f4d452f2e617070617269787b72632c 657870616e647d207c205c>148 480 Q<6772657020226a2c2e2a246375722e2a2c2220 7c20637574202d6632202d642c20292029>238 492 Q<656c7365>124 504 Q<6469723d 6061707061726978202d6661766f757220724f6c202464697220323e2f6465762f6e756c 6c60207c7c2072657475726e2030>148 516 Q <6576616c5f636f6d707265706c793d22434f4d505245504c593d28202428>148 528 Q <636420222464697222>172 540 Q <5c6c73202d64202a246375722a207c207768696c6520726561642072>172 552 Q <646f>172 564 Q<5b5b202d642022247222205d5d202626>196 576 Q <5b5b202472203d3d202a246375722a205d5d202626>196 588 Q <6563686f205c22247b722f2f202f5c5c207d5c22>220 600 Q<646f6e65>172 612 Q 6 <2929>172 624 S<22>-6 E<6576616c20246576616c5f636f6d707265706c79>148 636 Q<6669>124 648 Q<72657475726e2030>124 660 Q<7d>100 672 Q 6<2363>100 684 S<6f6d6d616e6420746f207265676973746572207468652061626f766520746f20657870 616e64207768656e207468652027746f2720636f6d6d616e642773206172677320617265> -6 E 6<2362>100 696 S<65696e6720657870616e646564>-6 E <636f6d706c657465202d46205f617070617269785f616c696173657320746f>100 708 Q<2d2d2d>100 720 Q F0<6170706172697820312e3030332c2030372d323631>20 768 Q<3138205365702032303037>120.68 E<3130>199 E 0 Cg EP %%Page: 11 11 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Courier@0 SF <4353482d7374796c6520616c6961736573>100 84 Q<2d2d2d>100 96 Q <616c69617320746f>100 108 Q<27636420602861707061726978202d6661766f757220 724f6c205c212a207c7c206563686f202d6e202e29602026262070776427>24 E <616c69617320626d>100 120 Q <2761707061726978202d2d6164642d6d61726b205c212a27>18 E<616c69617320706f 7274616c202761707061726978202d2d6164642d706f7274616c205c212a27>100 132 Q <2d2d2d>100 144 Q F0<4d6f726520656c61626f726174652073657475707320617265 20706f737369626c652e2054686973204353482d7374796c6520616c6961733a>100 168 Q F1<616c69617320746f202728746573742022782220213d>100 192 Q<22785c212a22 2920262620636420602861707061726978202d6661766f757220724f6c205c212a207c7c 206563686f202d6e202e2960207c7c2061707061726978202d6c27>12 E F0 <6c6973747320616c6c2061>100 216 Q -.25<7661>-.2 G <696c61626c65206a756d707320696620696e>.25 E -.2<766f>-.4 G -.1<6b65>.2 G 2.5<6477>.1 G<6974686f7574206172>-2.5 E<67756d656e74732e>-.18 E/F2 10.95 /Times-Bold@0 SF<4e4f>20 232.8 Q<544553>-.438 E F0<42656c6f>100 244.8 Q 5.239<7766>-.25 G<6f6c6c6f>-5.239 E 5.239<7773>-.25 G 2.739<6f6d6520636f 6d6d656e7473206f6e206f7468657220617070726f616368657320746f208c6c65207379 7374656d206e61>-5.239 F<766967>-.2 E<6174696f6e2e>-.05 E/F3 10 /Times-Bold@0 SF<48495354>7.74 E<4f52>-.18 E<59>-.35 E F0 -.15<6578>100 256.8 S<706c61696e732074686520646966>.15 E <666572656e6365206265747765656e207468652076>-.25 E<656e657261626c65>-.15 E F3<63646172>2.5 E<6773>-.1 E F0<70726f6772616d20616e64>2.5 E F3 <61707061726978>2.5 E F0<2e>A<434450>100 280.8 Q -1.11<4154>-.92 G 4.384 <4869>1.11 G 4.384<736f>-4.384 G 1.884 <6e6c792075736566756c20696e2063617365732077686572652061206769>-4.384 F -.15<7665>-.25 G 4.384<6e64>.15 G 1.884<69726563746f72792068617320737562 6469726563746f7269657320776974682064697374696e637469>-4.384 F -.15<7665> -.25 G<6e616d65732e20497420646f6573206e6f7420757375616c6c79207363616c65 2077656c6c207768656e20746865726520617265206d6f7265207468616e2061206665> 100 292.8 Q 2.5<7770>-.25 G<6174687320696e20434450>-2.5 E -1.11<4154> -.92 G<482e>1.11 E .638<536f6d652070656f706c652075736520616c696173657320 746f206a756d7020746f206f6674656e2076697369746564206469726563746f72696573 2e>100 316.8 R 3.138<4977>5.638 G .639 <6173206f6e65206f66207468656d20666f72206120706572696f64206f66>-3.238 F .232<74656e2079656172732e205468652066>100 328.8 R .231<6163742069732c20 74686f736520616c6961736573206172652063756d626572736f6d6520746f2063726561 746520616e642072656d6f>-.1 F .531 -.15<76652061>-.15 H .231 <6e6420746865>.15 F 2.731<7963>-.15 G .231<6c757474657220757020746865> -2.731 F .143<616c696173206e616d6573706163652e20546865>100 340.8 R 2.643 <7963>-.15 G .143<616e20636c61736820776974682065>-2.643 F -.15<7865>-.15 G .143<63757461626c65206e616d6573207768656e2074686520616c69617320696e63 6c7564657320746865>.15 F/F4 10/Times-Italic@0 SF<6364>2.644 E F0 .144 <706172742e2054686973>2.644 F 1.605<736f6d6574696d65732070726f6869626974 73206f6e652066726f6d2061737369676e696e6720746865206c6f676963616c20626f6f 6b6d61726b20746f2061206769>100 352.8 R -.15<7665>-.25 G 4.105<6e6c>.15 G 1.605<6f636174696f6e2c20657370656369616c6c79>-4.105 F 1.313<7768656e206f 6e65206861732061206c6f74206f6620736f7572636520636f6465206c6f636174696f6e 732e>100 364.8 R<546865>6.313 E 3.813<7963>-.15 G 1.313<616e20636c617368 2077697468206469726563746f7279206e616d6573207768656e20746865>-3.813 F 2.355<616c6961736573206a7573742065>100 376.8 R 2.354 <7870616e6420746f20746865206c6f636174696f6e2e2054686973206167>-.15 F 2.354<61696e206d65616e73207468617420736f6d6574696d65732061206c6f63617469 6f6e2063616e6e6f74206265>-.05 F .372 <61737369676e656420697473206c6f676963616c20626f6f6b6d61726b2e>100 388.8 R 2.872<4968>5.372 G -2.25 -.2<61762065>-2.872 H .373 <666f756e6420746861742073657474696e67>3.073 F F4<6364>2.873 E F0 .373 <6a756d707320617369646520696e207468656972206f>2.873 F .373 <776e206e616d657370616365>-.25 F<696d70726f>100 400.8 Q -.15<7665>-.15 G 2.5<738c>.15 G<6c652073797374656d206e61>-2.5 E<766967>-.2 E <6174696f6e2062792061206c6172>-.05 E<67652066>-.18 E<6163746f722e>-.1 E .6<497420697320616c736f20706f737369626c6520746f206372656174652073796d6c 696e6b7320746f206f6674656e2076697369746564208c6c65732e204167>100 424.8 R .6<61696e2c206372656174696f6e20616e642072656d6f>-.05 F -.25<7661>-.15 G 3.1<6c6f>.25 G 3.1<6674>-3.1 G<68657365>-3.1 E .625 <6172652063756d626572736f6d652e>100 436.8 R .625<4f6e6520636f756c64206f 6620636f7572736520637265617465207368656c6c2066756e6374696f6e732077697468 20612073696d696c617220696e74657266>5.625 F .625 <61636520746f2061707061726978>-.1 F 1.092<6f722063646172>100 448.8 R 1.092<677320746f2068616e646c65207468652073796d6c696e6b206c69666563>-.18 F 3.592<79636c652e204f6e>-.15 F 1.092<4c696e75782057>3.592 F 1.092 <65656b6c79204e65>-.8 F<7773>-.25 E F4<6e6978>3.592 E F0 1.092 <73756767657374656420746f20707574207468657365>3.592 F .477<73796d6c696e 6b7320696e20612073696e676c65206469726563746f727920616e642061646420746861 74206469726563746f727920746f20434450>100 460.8 R -1.11<4154>-.92 G 2.978 <482e2054686973>1.11 F .478 <69732071756974652061206e65617420747269636b20616e64>2.978 F<6566>100 472.8 Q<6665637469>-.25 E -.15<7665>-.25 G <6c792063726561746573206120626f6f6b6d61726b206e61>.15 E<766967>-.2 E <6174696f6e2073797374656d2e>-.05 E 1.152<5374696c6c20746865726520617265 2070726f626c656d732077697468207468652061626f>100 496.8 R 1.452 -.15 <76652061>-.15 H 3.652<7070726f6163682e204f6e65>.15 F 1.152<70726f626c65 6d2077697468207468652073796d6c696e6b20617070726f616368206973>3.652 F .358<7468617420746865>100 508.8 R 2.858<7961>-.15 G .358 <72652061206269742061>-2.858 F<776b77>-.15 E .358 <61726420746f20656469742e204f6e6520636f756c64206d616b>-.1 F -5.357 2.858 <65612075>-.1 H .359<74696c69747920746f20777261702061726f756e6420746865 2070726f626c656d2c2062>-2.858 F .359<757420696e>-.2 F 1.818<74686520656e 6420746865206469726563746f72792d776974682d73796d6c696e6b732077>100 520.8 R 1.817<6f756c642066756e6374696f6e616c6c79206265207468652073616d65206173 206170706172697827>-.1 F<73>-.55 E F3<2e6170706172697872>4.317 E<63>-.18 E F0 .053<7265736f75726365208c6c652c206f6e6c79206d6f7265206f662061206b6c 756467652e>100 532.8 R .053<416e6f746865722070726f626c656d20697320746861 742073796d6c696e6b73206172652061>5.053 F .054 <776b617264207768656e20747261>-.15 F -.15<7665>-.2 G<72732d>.15 E .929 <696e6720746865208c6c652073797374656d2e20546865>100 544.8 R 3.429<7963> -.15 G .929<6f6e6675736520746865206e6f74696f6e206f6620706172656e74206469 726563746f727920616e642027>-3.429 F F1 .928<6364202e2e>B F0 3.428<276d>C .928<6f73746c7920646f657320746865>-3.428 F<756e65>100 556.8 Q .412 <787065637465642e20536f6d6574696d65732027>-.15 F F1<2e2e>A F0 2.912 <2768>C .412<6173206120646966>-2.912 F .412 <666572656e74206d65616e696e6720746f>-.25 F F3<6364>2.912 E F0 .412<7468 616e2069742068617320746f20616e6f74686572206170706c69636174696f6e2c206173> 2.912 F .898<6f6e652077696c6c207472616365206261636b2073796d6c696e6b7320 616e6420746865206f746865722077696c6c206e6f742e>100 568.8 R <46696e616c6c79>5.898 E 3.398<2c616d>-.65 G .897 <696e6f72206f626a656374696f6e20697320746861742049208c6e64206974>-3.398 F <636f6e>100 580.8 Q -.15<7665>-.4 G 1.177<6e69656e7420746f206861>.15 F 1.478 -.15<76652062>-.2 H 1.178<6f6f6b6d61726b7320696e206120736570617261 7465206e616d657370616365207468616e2074686174206f66>.15 F F4<6364>3.678 E F0 1.178<2831292e204a756d707320617265206d61676963616c>B .844 <616e64206974206973206e61747572616c20746f20696e>100 592.8 R -.2<766f>-.4 G 1.044 -.1<6b652074>.2 H .843<68656d206279206120646966>.1 F .843 <666572656e74206d6574686f642e205468697320697320696e2066>-.25 F .843 <61637420686f>-.1 F 3.343<7761>-.25 G .843 <70706172697820616371756972656420697473>-3.343 F<434450>100 604.8 Q -1.11<4154>-.92 G 2.782<4862>1.11 G<656861>-2.782 E .282 <76696f75722e2049207573656420434450>-.2 F -1.11<4154>-.92 G 2.782<4874> 1.11 G 2.782<6f6a>-2.782 G .282<756d7020746f2061206665>-2.782 F 2.782 <7770>-.25 G .282<6172746963756c617220736f75726365206469726563746f726965 7320776974682064697374696e6374>-2.782 F .997<6e616d65732074686174206c61 7920646565706c792068696464656e20696e20736f6d6520435653206469726563746f72 792e204f6e636520492073746172746564207573696e67206170706172697820686f>100 616.8 R<7765>-.25 E -.15<7665>-.25 G 1.796 -.4<722c2049>.15 H -.1<776f> 100 628.8 S 1.251<756c64206d697374616b>.1 F 1.251<656e6c79206973737565> -.1 F F4<746f>3.751 E F0 1.251<726174686572207468616e>3.751 F F4<6364> 3.751 E F0 1.252<746f206a756d7020746f2074686f7365206c6f636174696f6e732e 204d7920627261696e20636c617373698c656420626f7468>3.751 F <7479706573206f66206a756d7020696e207468652073616d652063617465>100 640.8 Q<676f72792e>-.15 E .459<417070617269782028616e642063646172>100 664.8 R .459<677329206861>-.18 F .759 -.15<76652061>-.2 H .458<6e6f746865722075 73652062657369646573206a756d70696e672c206e616d656c7920616e6e6f746174696f 6e2e205768656e65>.15 F -.15<7665>-.25 G 2.958<724965>.15 G .458 <6e64207570>-2.958 F 1.218<696e20616e2065736f74657269632070617274206f66 20746865208c6c652073797374656d20616e64206e65656420746f206d616b>100 676.8 R 3.719<656171>-.1 G 1.219 <7569636b206e6f7465206f6620746865206c6f636174696f6e2c20492073696d706c79> -3.719 F<626f6f6b6d61726b2069742e>100 688.8 Q .822<4f6e20536c617368446f 742c207468617420657465726e616c20736f75726365206f6620776973646f6d206f7220 616c7465726e617469>100 712.8 R -.15<7665>-.25 G .821 <6c7920746865206765656b20776865656c206f6620737566>.15 F .821 <666572696e672c20436c75652d>-.25 F<6c657373204d6f726f6e206f66>100 724.8 Q<66657265642074686520666f6c6c6f>-.25 E<77696e672067656d732e>-.25 E <6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<3131>199 E 0 Cg EP %%Page: 12 12 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 145.125<617070617269782831292055534552>20 48 R 147.625<434f4d4d414e44532061707061726978283129>2.5 F/F1 10/Courier@0 SF< 6d6b2829207b206576616c20247b313a2d4d4b5057447d3d5c2260707764605c223b207d> 118 84 Q<72742829207b206576616c206364205c225c24247b313a2d4d4b5057447d5c 223b7077643b207d>118 96 Q 6<2374>118 120 S<79706520226d6b22202861732069 6e20226d61726b222920616e6420227274222028617320696e202272657475726e222920 746f206d61726b>-6 E 6<236164>118 132 S <69726563746f727920616e64206c6174657220676f206261636b20746f2069742e>-6 E 6<234f>118 144 S 6<7267>-6 G<6976652069742061206e616d653a20646f20226d6b 20666f6f222c20616e64206c61746572206f6e2022727420666f6f22>-6 E F0 1.866 <54686973206f6620636f75727365206973206120706572>100 168 R 1.867 <2d73657373696f6e206d656368616e69736d2c2062>-.2 F 1.867<7574206e6f7465> -.2 F -.1<776f>-.25 G<727468>.1 E 4.367<7966>-.05 G 1.867 <6f72206974732073696d706c69636974792e204920616d206e6f742073757265>-4.367 F<77686574686572206373682d7374796c65207368656c6c7320636f756c64206f66>100 180 Q<66657220616e2065717569>-.25 E -.25<7661>-.25 G<6c656e742e>.25 E 2.622<4166>100 204 S .122 <65617475726520736861726564206279206170706172697820616e642063646172> -2.622 F .122<6773206973207468617420616464696e67206120626f6f6b6d61726b20 696d6d6564696174656c792074616b>-.18 F .122<6573206566>-.1 F .121 <6665637420696e20616c6c>-.25 F .607<7368656c6c732e205468657265206973206e 6f206e65656420746f20736f7572636520736f6d65207265736f75726365208c6c652c20 617320746865206170706c69636174696f6e7320646f20746869732065>100 216 R -.15<7665>-.25 G .608<727974696d6520746865>.15 F<79>-.15 E<61726520696e> 100 228 Q -.2<766f>-.4 G -.1<6b65>.2 G<642e2049742069732066>.1 E <6173742c20646f206e6f742077>-.1 E<6f7272792e>-.1 E/F2 10.95/Times-Bold@0 SF -.11<4255>20 244.8 S<4753>.11 E F0 1.329<546865207265736f75726365208c 6c652070617273696e6720636f6465207468696e6b73207468617420706172656e746865 73657320617265207370656369616c2e>100 256.8 R 1.328 <416c736f207265636f726473206172652063757272656e746c79>6.328 F .304 <73657061726174656420627920636f6d6d61732e204163636f7264696e676c79>100 268.8 R 2.804<2c61>-.65 G .304<7070617269782077696c6c206869746368206966 20612070617468206e616d6520636f6e7461696e73206120706172656e74686573697320 6f722061>-2.804 F<636f6d6d612e>100 280.8 Q F2 -.548<4155>20 297.6 S <54484f52>.548 E F0<5374696a6e2076>100 309.6 Q<616e20446f6e67656e2e>-.25 E F2<5448414e4b53>20 326.4 Q F0<53746566>100 338.4 Q <616e204b616d7068617573656e2077726f7465>-.1 E/F3 10/Times-Bold@0 SF <63646172>2.5 E<6773>-.1 E F0 2.5<2c74>C <686520696e737069726174696f6e20666f7220617070617269782e>-2.5 E .927 <5369746172616d204368616d61727479208c78>100 362.4 R .927 <656420757020736f6d65206f66207468652065>-.15 F .926<78697374696e67206261 736820636f64652c20616e64206164646564207468652074616220636f6d706c6574696f 6e2070617274>-.15 F .543<28626173696e672074686973206f6e2073696d696c6172 20636f646520696e2063646172>100 374.4 R .543 <6773292e20486520646f6573206e6f742067>-.18 F .544 <6172616e74756565207072656469637461626c65206f722065>-.05 F -.15<7665> -.25 G 3.044<6e70>.15 G .544<726574747920726573756c7473>-3.044 F .325<69 66207468657265206172652073706163657320696e20746865206469726563746f727920 6e616d657320776869636820796f7520617474656d707420746f20636f6d706c6574652e> 100 386.4 R F3 -.5<4155>2.824 G<54484f52>.5 E F0 -.1<776f>2.824 G .324 <756c64206c696b>.1 F<65>-.1 E .142<746f207375626d6974207468617420737061 63657320696e2070617468206e616d6573206172652065>100 398.4 R .142<76696c2c 20616e6420746861742074686520636f6d706c6574696f6e20636f6465207365656d7320 746f2077>-.25 F .143<6f726b20696e207468656972>-.1 F -.25<6576>100 410.4 S<696c2070726573656e636520616e>.25 E<7977>-.15 E<61792e204a757374>-.1 E /F4 10/Times-Italic@0 SF<646f6e27>2.5 E 2.5<7470>-.3 G <757420636f6d6d6173>-2.5 E F0<696e2070617468206e616d65732e>2.5 E <546865206175746f746f6f6c65642062>100 434.4 Q<75696c6420656e>-.2 E <7669726f6e6d656e742077>-.4 E<6173206d6f64698c65642066726f6d20612074656d 706c617465207772697474656e206279204a6f6f73742076>-.1 E<616e204261616c2e> -.25 E F2<48495354>20 451.2 Q<4f52>-.197 E<59>-.383 E F0 1.831 <417070617269782077>100 463.2 R 1.831<6173206372656174656420746f206f7074 696d697a652061207363656e6172696f2074686174>-.1 F F4<63646172>4.331 E <6773>-.37 E F0 1.83<646f6573206e6f7420737570706f72742076>4.331 F 1.83 <6572792077656c6c2c206e616d656c79>-.15 F .248 <776865726520746865206d61726b202863616c6c6564>100 475.2 R F4 <6e6565646c65>2.748 E F0 .249<696e2063646172>2.748 F .249 <67732920697320616c>-.18 F -.1<7761>-.1 G .249<7973206b6e6f>.1 F .249<77 6e2e20417320616e206164646974696f6e616c2066656174757265206170706172697820 7375702d>-.25 F 1.896<706f72747320434450>100 487.2 R -1.11<4154>-.92 G 1.896<482d7374796c652062656861>1.11 F 1.895<76696f757220616e642073756264 69726563746f72792073706563698c636174696f6e2e20496e206f746865722072657370 6563747320617070617269782069732061>-.2 F .28 <6d7563682073696d706c6572206170706c69636174696f6e2e>100 499.2 R F3 <63646172>2.78 E<6773>-.1 E F0<6f66>2.781 E .281 <66657273206d656e752d6261736564206e61>-.25 F<766967>-.2 E .281<6174696f 6e206f6620746865208c6c652073797374656d20616e642074686520626f6f6b2d>-.05 F<6d61726b206c6973742c207768696368206170706172697820646f6573206e6f742e> 100 511.2 Q<6170706172697820312e3030332c2030372d323631>20 768 Q <3138205365702032303037>120.68 E<3132>199 E 0 Cg EP %%Trailer end %%EOF apparix-07-261/doc/apparix.10000664002600400000120000007377610673731471012514 00000000000000.\" Copyright (c) 2007 Stijn van Dongen .TH "apparix" 1 "18 Sep 2007" "apparix 1\&.003, 07-261" "USER COMMANDS " .po 2m .de ZI .\" Zoem Indent/Itemize macro I. .br 'in +\\$1 .nr xa 0 .nr xa -\\$1 .nr xb \\$1 .nr xb -\\w'\\$2' \h'|\\n(xau'\\$2\h'\\n(xbu'\\ .. .de ZJ .br .\" Zoem Indent/Itemize macro II. 'in +\\$1 'in +\\$2 .nr xa 0 .nr xa -\\$2 .nr xa -\\w'\\$3' .nr xb \\$2 \h'|\\n(xau'\\$3\h'\\n(xbu'\\ .. .if n .ll -2m .am SH .ie n .in 4m .el .in 8m .. .SH NAME apparix \- bookmark directories and apparate inside them .SH SYNOPSIS Apparix allows you to bookmark directories and later jump to them using the mark\&. It is possible to directly jump to subdirectories of the target directory\&. The contributed bash completion code facilitates completion both on bookmarks and subdirectories\&. This manual page suffers from an excess in verbosity due to the many examples, explanations of the bells and whistles, and comparisons with other approaches to bookmarking\&. The fundamental idea is simply that typing a string of your own choosing takes you to the directory associated with it\&. Apparix does little more than maintaining a list of keys and values\&. It obtains directory names and listings, associates path names (values) with bookmarks (keys), and has some facilities for manipulating keys and values\&. The functions involving apparix (\fCbm\fP, \fCto\fP, and \fCportal\fP) provide the user interface\&. .SH GETTING STARTED Install apparix\&. This should be as easy as \fI\&./configure --prefix=$HOME/local && make && make install\fP, or perhaps a pre-packaged apparix is available for your system\&. Then get hold of the \fBto\fP, \fBbm\fP and \fBportal\fP shell handles\&. These are either aliases or functions depending on your shell\&. Currently csh-style shells and bash are supported\&. Get the ones you need either from the \fBFILES\fP section or by issuing \fCapparix --shell-examples\fP\&. Activate them by simply pasting them in a shell or adding them to the appropriate resource file, e\&.g\&. \fC$HOME/\&.cshrc\fP or \fC$HOME/\&.profile\fP (do not forget to \fIsource\fP the resource file)\&. The handles \fBto\fP, \fBbm\fP and \fBportal\fP can of course be changed to any name desired\&. The following is a mock-up shell navigation session\&. .di ZV .in 0 .nf \fC > \fBpwd\fP /home/eez/cvs/xyz/tfa/faq/zut/bar/foo > \fBls\fP src/ doc/ CVS/ bin/ > \fBbm xkr\fP # bookmark as xkr (funny name though) > \fBbm\fP # bookmark as foo (trailing component is default) (later) > \fBto xkr\fP # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (alternatively) > \fBto xkr src\fP # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo/src (alternatively) > \fBto foo\fP # cd to /home/eez/cvs/xyz/tfa/faq/zut/bar/foo (later) > \fBls\fP aap pyu/ qua tim/ zut/ > \fBpwd\fP /home/eez/another/branch/deep/down/under > \fBportal\fP # bookmark as portal, imports tim zut pyu bookmarks added flock of 3 in portal /home/eez/another/branch/deep/down/under (later) > \fBto zut\fP # cd to /home/eez/another/branch/deep/down/under/zut (later) > \fBapparix\fP # show all bookmarks --- portals e /home/eez/another/branch/deep/down/under --- expansions j pyu /home/eez/another/branch/deep/down/under/pyu j tim /home/eez/another/branch/deep/down/under/tim j zut /home/eez/another/branch/deep/down/under/zut --- bookmarks j xkr /home/eez/cvs/xyz/tfa/faq/zut/bar/foo j foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR In the last example apparix simply shows all its bookmarks\&. The first batch shows portals\&. The second batch shows secondary bookmarks expanded from portals\&. The third batch shows all regular bookmarks\&. Apparix also allows subdirectory specification\&. If this is combined with the bash completion code it yields a powerful way of navigating container directories, i\&.e\&. directories that contain a large number of subdirectories\&. Refer to the \fBsubdirectory specification\fP section\&. \fBFurther options\fP .br \fB[--add-mark\fP (\fIadd jump bookmark\fP)\fB]\fP \fB[--add-portal\fP (\fIadd portal bookmark\fP)\fB]\fP \fB[-sm\fP (\fIsquash repeated marks\fP)\fB]\fP \fB[-sd\fP (\fIsquash repeated destinations\fP)\fB]\fP \fB[-lm\fP (\fIlist bookmarks with this mark\fP)\fB]\fP \fB[-ld\fP (\fIlist destinations with mark indirection\fP)\fB]\fP \fB[-favour\fP (\fIduplicate resolution\fP)\fB]\fP \fB[-purge\fP pat (\fIdelete bookmarks\fP)\fB]\fP \fB[-purge-mark\fP (\fIpat\fP)\fB]\fP \fB[-d\fP (\fIdump resource file to STDOUT\fP)\fB]\fP \fB[-l\fP (\fIlist available jumps\fP)\fB]\fP \fB[-u\fP (\fIremove last additions\fP)\fB]\fP \fB[--rehash\fP (\fIre-expand portal bookmarks\fP)\fB]\fP \fB[--bu\fP (\fIcreate backup of resource file\fP)\fB]\fP \fB[-bu\fP (\fIcreate backup in \fP)\fB]\fP \fB[--cwd\fP (\fIuse getcwd(3), not pwd(1)\fP)\fB]\fP \fB[--shell-examples\fP (\fIoutput example macros\fP)\fB]\fP .SH DESCRIPTION Apparix combines the properties of the \fIcdargs\fP utility and the CDPATH shell mechanism for fast navigation through the file system\&. It is especially useful for visiting and documenting both often- and rarely-used locations\&. Apparix enables you to attach marks to locations and jump to those locations by loading the mark\&. Marking, unmarking and jumping are simple operations that are performed in the shell\&. All actions take effect immediately in all shells running\&. By setting up convenient aliases for marking and jumping the file system can be navigated in a fast and intuitive manner\&. The \fBFILES\fP section lists aliases for csh-type shells and functions for bash, including the setup to equip the \fBto\fP function with argument completion in bash\&. This section contains some examples of the most common uses of apparix\&. \fBOPTIONS\fP contains a list of additional options available for listing, pruning, and squashing bookmarks\&. \fBNOTES\fP features a brief discussion of the advantages of apparix over other approaches such as setting up aliases for often visited directories, using symlinks, CDPATH, or a combination of these\&. \fBHISTORY\fP explains the difference between cdargs and apparix\&. The sections \fBduplicate resolution\fP, \fBsubdirectory specification\fP, \fBtab completion\fP, \fBcopying and moving files\fP, and \fBlisting bookmarks\fP further below are also recommended reading\&. Apparix works in a manner similar to cdargs\&. One usually invokes apparix by using pre-defined aliases\&. Here they will be called \fBbm\fP for bookmark, \fBportal\fP for a CDPATH-style bookmark and \fBto\fP for initiating an apparition (aka jump)\&. These aliases are found below in the \fBFILES\fP section and can also be obtained by issuing .di ZV .in 0 .nf \fC apparix --shell-examples .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR Suppose your user name is \fIeez\fP and your home directory is \fC/home/eez\fP\&. You often visit a directory called \fC/home/eez/cvs/xyz/tfa/faq/zut/bar/foo\fP\&. This is how to create and use a bookmark for foo .di ZV .in 0 .nf \fC /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \fBbm foo\fP added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \fBcd\fP /home/eez> \fBto foo\fP /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR If one bookmarks a directory by its trailing component as happened in this case, it is not necessary to specify the mark\&. By default apparix will use the trailing component as the mark\&. So .di ZV .in 0 .nf \fC /home/eez/cvs/xyz/tfa/faq/zut/bar/foo> \fBbm\fP added: foo -> /home/eez/cvs/xyz/tfa/faq/zut/bar/foo .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR gives the same result\&. Another scenario is where you have some directory that contains a largish number of subdirectories, all of which you would like to have bookmarked\&. If the subdirectories have distinctive names this can be achieved in one fell swoop by marking the parent directory as a \fIportal\fP\&. This is similar to adding the parent directory to the CDPATH environment variable, except that apparix bookmarks are not part of the cd namespace\&. It is argued in \fBNOTES\fP that this is a good thing\&. Consider this: .di ZV .in 0 .nf \fC /home/cvs/bagger/boemel/mcl/mcl/src> \fBls\fP alien/ CVS/ impala/ Makefile\&.am README shmcx/ attic/ giraffe/ lib/ Makefile\&.in shcl/ shmx/ contrib/ gmon\&.out Makefile mcl/ shmcl/ taurus/ .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR Some of the subdirectories have not-so-distinct names such as \fIcontrib\fP and \fIattic\fP, but they happen to be the directories least visited\&. Issuing: .di ZV .in 0 .nf \fC /home/cvs/bagger/boemel/mcl/mcl/src> \fBportal\fP [apparix] expanded 1 portal to 12 destinations .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR yields all of the subdirectories as destinations bookmarked by the last component of their path name\&. Incidentally, directory names such as \fCCVS\fP can be explicitly excluded from expansion by setting the environment variable \fCAPPARIXEXCLUDE\fP appropriately \- refer to section \fBENVIRONMENT\fP\&. Bookmarks resulting from portal expansion are kept in a separate resource file (see \fBFILES\fP)\&. Portal expansions can be recreated by issuing .di ZV .in 0 .nf \fC apparix --rehash .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR This is useful to reflect a change in the directory naming structure underneath a portal\&. .SH duplicate resolution Apparix allows identical bookmarks to point to different locations\&. When asked to visit such a bookmark it will by default present a list of options\&. The \fB-favour\fP\ \&\fI\fP option can be used to automate resolution\&. \fB\fP is a sequence of single characters\&. The order in which they are given denote the order in which resolution rules are applied\&. This option is typically used in the definition of the \fBto\fP function/alias or in the bash completion code\&. Duplicates are allowed because it can be useful to overwrite a bookmark with a new location\&. The old bookmark is kept as a matter of policy\&. Use \fB-sm\fP to explicitly squash duplicates\&. .ZI 3m "l" \fIlevel\fP; prefer paths with fewer components\&. .in -3m .ZI 3m "L" reverse of the above\&. .in -3m .ZI 3m "o" \fIbookmark order\fP; prefer older entries\&. Entries appearing earlier in the file are considered older, but the actual date of creating the bookmark is not stored\&. Refer to \fBediting bookmarks\fP for more information\&. .in -3m .ZI 3m "O" reverse of the above\&. .in -3m .ZI 3m "r" \fIregular first\fP; prefer regular bookmarks over portal expansion\&. .in -3m .ZI 3m "R" reverse of the above\&. .in -3m If there are still ties after the specified rules have been applied apparix will simply take the first matching option\&. This behaviour cannot be further specified as the program uses a non-stable ordering routine\&. It is an absolute prerequisite that \fB-favour\fP is used in the bash completion code\&. Otherwise completion will fail (for a duplicated bookmark) while apparix is waiting for input\&. Refer to the tab completion description below\&. .SH subdirectory specification When jumping (apparating) you can specify an additional subdirectory after the bookmark\&. Apparix will append the subdirectory to the destination\&. This is useful for projects with directory nodes corresponding with versions\&. Assume you have a directory structure such as this: .di ZV .in 0 .nf \fC /x/y/z/OpusMagnum/v1/ /x/y/z/OpusMagnum/v2/ /x/y/z/OpusMagnum/v3/ .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR It is probably easiest to simply bookmark the OpusMagnum directory in some way (say with bookmark \fCom\fP)\&. You can then issue \&'\fCto om v2\fP\&' to jump to \fCOpusMagnum/v2\fP\&. This is more flexible and maintainable than creating bookmarks \fCom1\fP, \fCom2\fP, \fCom3\fP\&. One could add OpusMagnum as a portal, but with generic names such as \fCv1\fP this is not a very extendible approach\&. See also the tab completion description below - it is possible to tab-complete on subdirectories of the apparix jump directory\&. .SH tab completion The bash tab completion code does two things\&. First, it is possible to tab-complete on apparix bookmarks themselves, showing a listing of all available bookmarks (or iterating through them in cyclic mode, depending on your bash settings)\&. Second, once a bookmark has been given tab completion will list or iterate over all the subdirectories of the directory associated with that bookmark\&. Specifying a string after the bookmark will limit tab-completion to directories matching the shell-pattern in string\&. \fIVery\fP useful\&. Be careful to not remove the \fB-favour\fP\ \&\fIlist\fP option from the bash completion code\&. It is necessary to resolve duplicate bookmarks\&. .SH editing bookmarks Apparix appends new bookmarks to the end of the \&.apparixrc file\&. Nothing stops you from editing the file, and this is in fact recommended if for example you need to get rid of a bookmark and neither of \fB-purge\fP, \fB-purge-mark\fP, \fB-sd\fP, \fB-sm\fP fulfills your needs\&. It was an easy design choice not to equip apparix with editor capabilities\&. .SH copying and moving files It is straightforward to copy or move files to locations known by apparix\&. Examples: .di ZV .in 0 .nf \fC BASH and variants cp FOO $(apparix zoem) mv BAR $(apparix zoem doc) mv BAR $(apparix zoem doc)/test CSH and variants cp FOO \&`apparix zoem\&` mv BAR \&`apparix zoem doc\&`/test .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR .SH listing bookmarks Simply issuing apparix gives you a list of bookmarks grouped into three categories, portals, expansions, and bookmarks\&. Use the \fB-d\fP option to dump the resource file to STDOUT exactly as it is\&. This can be useful when you intend to use the \fB-u\fP\ \&\fInum\fP option to remove bookmarks or portals that were most recently added\&. Use \fB-l\fP to list all available jumps without their destinations\&. The jumps are grouped into expansions resulting from portals and regular bookmarks\&. .SH OPTIONS For bookmarking and jumping apparix is best invoked by using the aliases (tcsh-variants) or functions (sh/bash) listed in \fBFILES\fP\&. Apparix has a few options that are useful for pruning, squashing and rehasing bookmarks\&. These are best issued by invoking apparix directly\&. If you are interested in marks or destinations matching a certain pattern, simply issue apparix without arguments and pipe it through your program of choice\&. Unary options (those without arguments) usually start with two hyphens except for standardized options such as \fB-h\fP\&. Options that take an argument can be converted to a unary key=value notation, e\&.g\&. \fB-purge-mark\fP\ \&\fBfoo\fP is equivalent to \fB--purge-mark\fP=\fBfoo\fP\&. When invoked without arguments apparix will simply dump its bookmarks\&. .ZI 3m "\fB--add-mark\fP (\fIadd jump bookmark\fP)" \& .br This options expects trailing \fI[mark [destination]]\fP argument(s)\&. Both arguments are optional\&. If a single argument is given it is interpreted as a bookmark name to be mapped to the current directory\&. If two arguments are given the last argument is taken as the target directory\&. If no argument is given apparix will enlist the current directory as a target bookmarked by the trailing component of the directory path\&. .in -3m .ZI 3m "\fB--add-portal\fP (\fIadd portal bookmark\fP)" \& .br This option enlists a directory as a portal and adds all subdirectories as bookmarks\&. The name of the bookmark is simply the name of the subdirectory\&. By default the current directory is added as a portal\&. An optional trailing argument will override this behaviour and instead be interpreted as the portal location\&. .in -3m .ZI 3m "\fB-sm\fP (\fIsquash repeated marks\fP)" \& .br Apparix will squash bookmarks with mark \fC\fP\&. This is useful when a mark points to a versioned project, and the project is updated to a new version and a new directory\&. Apparix will by default keep the last one occurring in the resource file (corresponding with \fB-favour\fP\ \&\fBO\fP)\&. This option respects the \fB-favour\fP option if given\&. Duplicating an already existing mark can be useful when it identifies a project for which the underlying directory changes every once in a while (e\&.g\&. the project is downloaded from external sources and comes with version information)\&. It is not strictly necessary to squash bookmarks since \fBto\fP functions/macros that are equipped with the \fB-favour\fP option will generally resolve duplicate matches\&. .in -3m .ZI 3m "\fB-sd\fP (\fIsquash repeated destinations\fP)" \& .br All other bookmarks with the same destination as \fC\fP are removed\&. This is useful when a given destination has acquired multiple bookmarks and you decide to settle on a favourite\&. .in -3m .ZI 3m "\fB-lm\fP (\fIlist bookmarks with this mark\fP)" \& .br It lists all bookmarks \fC\fP (noting that it may point to multiple locations)\&. .in -3m .ZI 3m "\fB-ld\fP (\fIlist repeated destinations\fP)" \& .br This lists all bookmarks \fC\fP (noting that it may point to multiple locations) and additionally lists all other bookmarks that share the destination with any of the first bookmarks\&. This allows one to predict the effect of issuing \fCapparix -sd \fP\&. .in -3m .ZI 3m "\fB-purge\fP pat (\fIdelete bookmarks\fP)" \& .br This deletes bookmarks where destination matches \fIpat\fP\&. All deleted bookmarks are printed to STDOUT\&. Thus if you regret deleting a bookmark it is easy to add it back\&. Portal specifications are never affected\&. .in -3m .ZI 3m "\fB-purge-mark\fP (\fIpat\fP)" \& .br This deletes bookmarks where mark matches \fIpat\fP\&. Portal specifications are never affected\&. .in -3m .ZI 3m "\fB-d\fP (\fIdump resource file to STDOUT\fP)" \& .br Dump resource file to STDOUT\&. .in -3m .ZI 3m "\fB-l\fP (\fIlist available jumps\fP)" \& .br List available jumps paragraph-style\&. Portal specifications themselves are excluded, and regular jumps and jumps resulting from portal expansions are listed under different headers\&. .in -3m .ZI 3m "\fB-u\fP (\fIremove last additions\fP)" \& .br Remove last additions\&. Portal specifications and regular jumps are treated alike\&. .in -3m .ZI 3m "\fB--rehash\fP (\fIre-expand portal bookmarks\fP)" \& .br Apparix will reread the resource file and reexpand portal locations\&. Useful if directories have been added, renamed, or removed\&. Refer to section \fBENVIRONMENT\fP for the effect that the environment variable \fCAPPARIXEXCLUDE\fP has on portal expansion\&. .in -3m .ZI 3m "\fB-favour\fP (\fIset duplicat resolution policy\fP)" \& .br This option has its own section\&. Refer to \fBduplicate resolution\fP\&. .in -3m .ZI 3m "\fB--cwd\fP (\fIuse getcwd(3), not pwd(1)\fP)" \& .br By default aparix uses the program \fIpwd\fP(1) rather than the system call \fIgetcwd\fP(3)\&. On some systems it was found that the latter results in paths that contain machine-specific mount components\&. Appparix will use \fIgetcwd\fP(3) when \fB--cwd\fP is used\&. .in -3m .ZI 3m "\fB--shell-examples\fP (\fIoutput example macros\fP)" \& .br This outputs example macros\&. They are also listed in the \fBFILES\fP section though\&. .in -3m .ZI 3m "\fB--bu\fP (\fIcreate backup of the resource file\fP)" \& .br This creates the backup file in \&.apparixrc\&.bu\&. .in -3m .ZI 3m "\fB-bu\fP fname (\fIcreate backup of the resource file\fP)" \& .br This creates the backup file in \fIfname\fP\&. Use \fB-d\fP or \fB-bu\fP\ \&\fB-\fP to dump to STDOUT\&. .in -3m .ZI 3m "\fB-h\fP (\fIshow synopsis\fP)" \& 'in -3m .ZI 3m "\fB--apropos\fP (\fIshow synopsis\fP)" \& 'in -3m 'in +3m \& .br print synopsis of all options .in -3m .SH ENVIRONMENT .ZI 3m "APPARIXEXCLUDE" \& .br This variable specifies exclusion behaviour when portals are expanded with the \fC--rehash\fP option\&. It has the following syntax: .di ZV .in 0 .nf \fC <[:,][]>+ .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR That is, a list of names with each name preceded by a colon or a comma\&. A colon indicates that \fC\fP triggers exclusion of directory names for which the trailing component is identical to \fC\fP\&. A comma indicates that \fC\fP triggers exclusion of directory names for which the trailing component contains \fC\fP as a substring\&. Consider: .di ZV .in 0 .nf \fC export APPARIXEXCLUDE=:CVS:lib,tmp # A - example export APPARIXEXCLUDE=, # B - curiosity .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR The first excludes directory names \fCCVS\fP and \fClib\fP and any directory name having \fCtmp\fP as a substring\&. The second example will effectively disable portals, as it speficies the empty string which is a substring of all strings\&. .in -3m .ZI 3m "APPARIXTAG" \& .br This variable, if set, is incorporated into the names of the apparix resource files\&. By default these are \fC\&.apparixrc\fP and \fC\&.apparixexpand\fP\&. When APPARIXTAG is set to \fC\fP they become \fC\&.apparixrc\fP and \fC\&.apparixexpand\fP\&. This can be used e\&.g\&. to maintain different sets of bookmarks on different host machines\&. .in -3m .ZI 3m "APPARIXLOG" \& .br This variable, if set, is interpreted as the name of a log file\&. The log file keeps track of all newly added bookmarks and portals without ever deleting anything, in the same format as the \fC\&.apparixrc\fP file\&. If this variable is not set nothing is tracked\&. .in -3m .ZI 3m "APPARIXPURGE" \& .br This changes the way apparix dumps purged bookmarks to STDOUT\&. By default they are dumped as command lines that will reimport the bookmarks if issued (i\&.e\&. cut and pasted)\&. By setting this variable to 1 purged bookmarks are dumped in the format used in the \fC\&.apparixrc\fP file\&. .in -3m .SH FILES You should use aliases or functions to make apparix really useful\&. Get them from apparix by giving it the --shell-examples option, or from further below\&. Note the fragment that provides \fBto\fP argument completion in bash\&. .ZI 3m "$HOME/\&.apparixrc" \& .br This is the primary resource file\&. There is usually no need to edit it by hand\&. Sometimes it can be useful to edit by hand to remove an unwanted bookmark; refer to \fBediting bookmarks\fP\&. .in -3m .ZI 3m "$HOME/\&.apparixrc\&.bu" \& .br Apparix creates a back-up file whenever it is asked to remove entries from it\&. Refer to \fBediting bookmarks\fP for options inducing removal\&. You can explicitly require a backup to be made by either of \fB--bu\fP or \fB-bu\fP\ \&\fIfname\fP\&. .in -3m .ZI 3m "$HOME/\&.apparixexpand" \& .br This contains bookmarks that are expanded from portals\&. A portal is simply some directory\&. The names of all subdirectories are taken as bookmarks that point to those subdirectories\&. This file can be recreated by issuing .di ZV .in 0 .nf \fC apparix --rehash .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR .in -3m .ZI 3m "$HOME/\&.bashrc" \& 'in -3m .ZI 3m "$HOME/\&.tcshrc" \& 'in -3m .ZI 3m "$HOME/\&.cshrc" \& 'in -3m 'in +3m \& .br Add the code you need to the appropriate rc file\&. The macros and functions below point \fIcd\fP(1) in the right direction\&. .in -3m .di ZV .in 0 .nf \fC BASH-style functions --- function to () { if test "$2"; then cd "$(apparix "$1" "$2" || echo \&.)"; else cd "$(apparix "$1" || echo \&.)"; fi pwd } function bm () { if test "$2"; then apparix --add-mark "$1" "$2"; elif test "$1"; then apparix --add-mark "$1"; else apparix --add-mark; fi } function portal () { if test "$1"; then apparix --add-portal "$1"; else apparix --add-portal; fi } # function to generate list of completions from \&.apparixrc function _apparix_aliases () { cur=$2 dir=$3 COMPREPLY=() if [ "$1" == "$3" ] then COMPREPLY=( $( cat $HOME/\&.apparix{rc,expand} | \e grep "j,\&.*$cur\&.*," | cut -f2 -d, ) ) else dir=\&`apparix -favour rOl $dir 2>/dev/null\&` || return 0 eval_compreply="COMPREPLY=( $( cd "$dir" \els -d *$cur* | while read r do [[ -d "$r" ]] && [[ $r == *$cur* ]] && echo \e"${r// /\e\e }\e" done ) )" eval $eval_compreply fi return 0 } # command to register the above to expand when the \&'to\&' command\&'s args are # being expanded complete -F _apparix_aliases to --- CSH-style aliases --- alias to \&'cd \&`(apparix -favour rOl \e!* || echo -n \&.)\&` && pwd\&' alias bm \&'apparix --add-mark \e!*\&' alias portal \&'apparix --add-portal \e!*\&' --- .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR More elaborate setups are possible\&. This CSH-style alias: .di ZV .in 0 .nf \fC alias to \&'(test "x" != "x\e!*") && cd \&`(apparix -favour rOl \e!* || echo -n \&.)\&` || apparix -l\&' .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR lists all available jumps if invoked without arguments\&. .SH NOTES Below follow some comments on other approaches to file system navigation\&. \fBHISTORY\fP explains the difference between the venerable \fBcdargs\fP program and \fBapparix\fP\&. CDPATH is only useful in cases where a given directory has subdirectories with distinctive names\&. It does not usually scale well when there are more than a few paths in CDPATH\&. Some people use aliases to jump to often visited directories\&. I was one of them for a period of ten years\&. The fact is, those aliases are cumbersome to create and remove and they clutter up the alias namespace\&. They can clash with executable names when the alias includes the \fIcd\fP part\&. This sometimes prohibits one from assigning the logical bookmark to a given location, especially when one has a lot of source code locations\&. They can clash with directory names when the aliases just expand to the location\&. This again means that sometimes a location cannot be assigned its logical bookmark\&. I have found that setting \fIcd\fP jumps aside in their own namespace improves file system navigation by a large factor\&. It is also possible to create symlinks to often visited files\&. Again, creation and removal of these are cumbersome\&. One could of course create shell functions with a similar interface to apparix or cdargs to handle the symlink lifecycle\&. On Linux Weekly News \fInix\fP suggested to put these symlinks in a single directory and add that directory to CDPATH\&. This is quite a neat trick and effectively creates a bookmark navigation system\&. Still there are problems with the above approach\&. One problem with the symlink approach is that they are a bit awkward to edit\&. One could make a utility to wrap around the problem, but in the end the directory-with-symlinks would functionally be the same as apparix\&'s \fB\&.apparixrc\fP resource file, only more of a kludge\&. Another problem is that symlinks are awkard when traversing the file system\&. They confuse the notion of parent directory and \&'\fCcd \&.\&.\fP\&' mostly does the unexpected\&. Sometimes \&'\fC\&.\&.\fP\&' has a different meaning to \fBcd\fP than it has to another application, as one will trace back symlinks and the other will not\&. Finally, a minor objection is that I find it convenient to have bookmarks in a separate namespace than that of \fIcd\fP(1)\&. Jumps are magical and it is natural to invoke them by a different method\&. This is in fact how apparix acquired its CDPATH behaviour\&. I used CDPATH to jump to a few particular source directories with distinct names that lay deeply hidden in some CVS directory\&. Once I started using apparix however, I would mistakenly issue \fIto\fP rather than \fIcd\fP to jump to those locations\&. My brain classified both types of jump in the same category\&. Apparix (and cdargs) have another use besides jumping, namely annotation\&. Whenever I end up in an esoteric part of the file system and need to make a quick note of the location, I simply bookmark it\&. On SlashDot, that eternal source of wisdom or alternatively the geek wheel of suffering, Clueless Moron offered the following gems\&. .di ZV .in 0 .nf \fC mk() { eval ${1:-MKPWD}=\e"\&`pwd\&`\e"; } rt() { eval cd \e"\e$${1:-MKPWD}\e";pwd; } # type "mk" (as in "mark") and "rt" (as in "return") to mark # a directory and later go back to it\&. # Or give it a name: do "mk foo", and later on "rt foo" .fi \fR .in .di .ne \n(dnu .nf \fC .ZV .fi \fR This of course is a per-session mechanism, but noteworthy for its simplicity\&. I am not sure whether csh-style shells could offer an equivalent\&. A feature shared by apparix and cdargs is that adding a bookmark immediately takes effect in all shells\&. There is no need to source some resource file, as the applications do this everytime they are invoked\&. It is fast, do not worry\&. .SH BUGS The resource file parsing code thinks that parentheses are special\&. Also records are currently separated by commas\&. Accordingly, apparix will hitch if a path name contains a parenthesis or a comma\&. .SH AUTHOR Stijn van Dongen\&. .SH THANKS Stefan Kamphausen wrote \fBcdargs\fP, the inspiration for apparix\&. Sitaram Chamarty fixed up some of the existing bash code, and added the tab completion part (basing this on similar code in cdargs)\&. He does not garantuee predictable or even pretty results if there are spaces in the directory names which you attempt to complete\&. \fBAUTHOR\fP would like to submit that spaces in path names are evil, and that the completion code seems to work in their evil presence anyway\&. Just \fIdon\&'t put commas\fP in path names\&. The autotooled build environment was modified from a template written by Joost van Baal\&. .SH HISTORY Apparix was created to optimize a scenario that \fIcdargs\fP does not support very well, namely where the mark (called \fIneedle\fP in cdargs) is always known\&. As an additional feature apparix supports CDPATH-style behaviour and subdirectory specification\&. In other respects apparix is a much simpler application\&. \fBcdargs\fP offers menu-based navigation of the file system and the bookmark list, which apparix does not\&.