diff options
125 files changed, 60348 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog new file mode 100755 index 0000000..fbb8ccb --- /dev/null +++ b/ChangeLog @@ -0,0 +1,8 @@ +2003-09-15 Gary Kunkel <gkunkel@zhsac.com> + + * branched xbase off of current tree and renamed to xbase64 + - added 64 bit file support + - fixes to multi user windows record and file locking + - changed license to GPL instead of LGPL as recommended by GNU web site + - added data type XB_BOOL + - updated documentation diff --git a/Makefile.am b/Makefile.am new file mode 100755 index 0000000..8bd0414 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,48 @@ +# $Id: Makefile.am,v 1.11 2001/06/27 04:36:44 gkunkel $ +# +## Process this file with automake to produce Makefile.in +## +# This file is part of the xbase64 libraries +# Copyright (C) 1998 Denis Pershin (dyp@inetlab.com) +# +# This library 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.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Contact: +# +# Email: +# +# xbase64-dev@techass.com +# +# + +SUBDIRS = @XSUBDIRS@ + +MAINTAINERCLEANFILES = Makefile.in configure aclocal.m4 libtool + +# not currently working - left behing in release 2.0 for now +#EXTRA_DIST = makefile.g95 + + +bin_SCRIPTS = xbase64-config + +rpm : dist + cp xbase64-@VERSION@.tar.gz /usr/src/redhat/SOURCES + cp xbase64.spec /usr/src/redhat/SPECS + (cd /usr/src/redhat/SPECS ; rpm -ba --clean xbase64.spec) + +docs : + (cd docs ; make docs) + +.PHONY : docs
\ No newline at end of file diff --git a/Makefile.in b/Makefile.in new file mode 100755 index 0000000..8ffbd3c --- /dev/null +++ b/Makefile.in @@ -0,0 +1,499 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# $Id: Makefile.am,v 1.11 2001/06/27 04:36:44 gkunkel $ +# +# This file is part of the xbase64 libraries +# Copyright (C) 1998 Denis Pershin (dyp@inetlab.com) +# +# This library 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.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Contact: +# +# Email: +# +# xbase64-dev@techass.com +# +# +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +GXXVER = @GXXVER@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RELEASE = @RELEASE@ +RHREL = @RHREL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XSUBDIRS = @XSUBDIRS@ +am__include = @am__include@ +am__quote = @am__quote@ +doxygen = @doxygen@ +install_sh = @install_sh@ +topdir = @topdir@ + +SUBDIRS = @XSUBDIRS@ + +MAINTAINERCLEANFILES = Makefile.in configure aclocal.m4 libtool + + +# not currently working - left behing in release 2.0 for now +#EXTRA_DIST = makefile.g95 +bin_SCRIPTS = xbase64-config +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h +CONFIG_CLEAN_FILES = xbase64-config xbase64.spec +SCRIPTS = $(bin_SCRIPTS) + +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ + uninstall-info-recursive all-recursive install-data-recursive \ + install-exec-recursive installdirs-recursive install-recursive \ + uninstall-recursive check-recursive installcheck-recursive +DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ + Makefile.in NEWS TODO aclocal.m4 config.guess config.sub \ + configure configure.in depcomp install-sh ltconfig ltmain.sh \ + missing mkinstalldirs xbase64-config.in xbase64.spec.in +DIST_SUBDIRS = $(SUBDIRS) +all: all-recursive + +.SUFFIXES: + +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) + +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +xbase64-config: $(top_builddir)/config.status xbase64-config.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +xbase64.spec: $(top_builddir)/config.status xbase64.spec.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f"; \ + $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = . +distdir = $(PACKAGE)-$(VERSION) + +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } + +GZIP_ENV = --best +distcleancheck_listfiles = find . -type f -print + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkinstalldirs) $(distdir)/. $(distdir)/docs + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + $(am__remove_distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ + && cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + find $$dc_install_base -type f -print ; \ + exit 1; } >&2 ) \ + && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ + && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +distcleancheck: distclean + if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: install-binSCRIPTS + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf autom4te.cache +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-binSCRIPTS uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive dist dist-all \ + dist-gzip distcheck distclean distclean-generic \ + distclean-libtool distclean-recursive distclean-tags \ + distcleancheck distdir dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-binSCRIPTS \ + install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive tags tags-recursive \ + uninstall uninstall-am uninstall-binSCRIPTS uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + + +rpm : dist + cp xbase64-@VERSION@.tar.gz /usr/src/redhat/SOURCES + cp xbase64.spec /usr/src/redhat/SPECS + (cd /usr/src/redhat/SPECS ; rpm -ba --clean xbase64.spec) + +docs : + (cd docs ; make docs) + +.PHONY : docs +# 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: diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100755 index 0000000..bf9ed34 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,4328 @@ +# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Do all the work for Automake. -*- Autoconf -*- + +# This macro actually does too much some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +AC_PREREQ([2.52]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl + AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl + +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_][CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_][CC], + defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_][CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_][CXX], + defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.6.3])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# +# Check to make sure that the build environment is sane. +# + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# -*- Autoconf -*- + + +# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_AUX_DIR_EXPAND + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +# Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50]) + +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# serial 4 -*- Autoconf -*- + +# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null +AC_SUBST([DEPDIR]) +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST(am__include) +AC_SUBST(am__quote) +AC_MSG_RESULT($_am_result) +rm -f confinc confmf +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 5 + +AC_PREREQ(2.52) + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional \"$1\" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_PREREQ([2.52]) + +# serial 6 + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. We must strip everything past the first ":", +# and everything past the last "/". + +# _AM_DIRNAME(PATH) +# ----------------- +# Like AS_DIRNAME, only do it during macro expansion +AC_DEFUN([_AM_DIRNAME], + [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, + m4_if(regexp([$1], [^//\([^/]\|$\)]), -1, + m4_if(regexp([$1], [^/.*]), -1, + [.], + patsubst([$1], [^\(/\).*], [\1])), + patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), + patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl +])# _AM_DIRNAME + + +# The stamp files are numbered to have different names. +# We could number them on a directory basis, but that's additional +# complications, let's have a unique counter. +m4_define([_AM_STAMP_Count], [0]) + + +# _AM_STAMP(HEADER) +# ----------------- +# The name of the stamp file for HEADER. +AC_DEFUN([_AM_STAMP], +[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl +AS_ESCAPE(_AM_DIRNAME(patsubst([$1], + [:.*])))/stamp-h[]_AM_STAMP_Count]) + + +# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS) +# ------------------------------------------------------------ +# We used to try to get a real timestamp in stamp-h. But the fear is that +# that will cause unnecessary cvs conflicts. +AC_DEFUN([_AM_CONFIG_HEADER], +[# Add the stamp file to the list of files AC keeps track of, +# along with our hook. +AC_CONFIG_HEADERS([$1], + [# update the timestamp +echo 'timestamp for $1' >"_AM_STAMP([$1])" +$2], + [$3]) +])# _AM_CONFIG_HEADER + + +# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) +# -------------------------------------------------------------- +AC_DEFUN([AM_CONFIG_HEADER], +[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) +])# AM_CONFIG_HEADER + +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- + +# serial 46 AC_PROG_LIBTOOL + +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +_LT_AC_PROG_ECHO_BACKSLASH +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac + +_LT_AC_LTCONFIG_HACK + +]) + +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) + +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix*) + symcode='[[BCDEGRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[if test "$cross_compiling" = yes; then : + [$4] +else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + +AC_DEFUN([_LT_AC_LTCONFIG_HACK], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +AC_MSG_CHECKING([for objdir]) +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +AC_MSG_RESULT($objdir) + + +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi +]) +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # <tim.van.holder@pandora.be>, C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <<EOF 1>&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +AC_MSG_CHECKING([how to hardcode library paths into programs]) +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +AC_MSG_RESULT([$hardcode_action]) + +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +AC_LIBTOOL_DLOPEN_SELF + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], + [$rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# 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. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include <windows.h> +# #undef WIN32_LEAN_AND_MEAN +# #include <stdio.h> +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include <cygwin/cygwin_dll.h> +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include <stdio.h> /* for printf() */ +# #include <unistd.h> /* for open(), lseek(), read() */ +# #include <fcntl.h> /* for O_RDONLY, O_BINARY */ +# #include <string.h> /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i<nexp; i++) +# { +# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); +# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); +# } +# +# return 0; +# } +# /* impgen.c ends here */ + +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + +])# _LT_AC_LTCONFIG_HACK + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | [[A-Za-z]]:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +# AC_PROG_LD_GNU - +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | s390* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[[78]]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + @@ -0,0 +1,47 @@ + +This is a list of the people who are or have worked on the xbase64 Library. + +Gary Kunkel <gkunkel@zhsac.com> - original author, + current maintainer of xbase64 +Larry McCourry <lmccourry@charter.net - memory leak testing +Sergiy Yakovin <s.yakovin@if.ukrsotsbank.com> - cdx index support + +Previous to this library being branced to xbase64, the following AUTHORS have +supported xbase to the 2.x release level. + + + +------------------------------------------------------------------------------ +The following list is the AUTHORS file for the xbase library release 2. +------------------------------------------------------------------------------ +This is a partial list of the people that have helped with the xbase +project and something specific they worked on. Most have worked on more +than what is listed. + +Derry Bryson <derry@techass.com> - release 2.x maintainer +Mario Motta - testing and bugfixes +Serge Smirnov <sw1181@mail.ru> - MSVC stuff and OCAML support +Frolov Sergey - bugfixes (memory leaks) + +------------------------------------------------------------------------------ +The following is the original AUTHORS file for the xbase library +------------------------------------------------------------------------------ +This is a partial list of the people that have helped with the xbase +project and something specific they worked on. Most have worked on more +than what is listed. + + +Bob Cotton <bcotton@synix.com> - Clipper NTX index support +Denis Braussen <postoffice@mail.dotcom.fr> - general support +Denis Pershin <dyp@inetlab.com> - provided library enhancements +Eirk Bachman <ebp@geocities.com> - keeper of definitive Xbase spec +Gabriel Emerson <egabriel@io.com> - provided logo +Kehl Hubertus <kehlh@hotmail.com> - Xbase to Xbase C++ Perl Converter +Michael Bedward <mbedward@ozemail.com.au> - Expression logic support +Paul Foster <paulf@quillandmouse.com> - general support +Vitaly Fedrushkov <willy@snowyowl.csu.ac.ru> - TV support and more + +------------------------------------------------------------------------------ + +If you are missing and you should be included in this file, please let me +know at xbase64-dev@lists.sourceforge.net. Thanks, Gary Kunkel. diff --git a/bin/Makefile.am b/bin/Makefile.am new file mode 100755 index 0000000..43c8333 --- /dev/null +++ b/bin/Makefile.am @@ -0,0 +1,30 @@ + +INCLUDES= -I$(topdir) +LDADD = -L$(topdir)/xbase64 -lxbase64 + +INSTALL_PROGRAM = @INSTALL@ + +bin_PROGRAMS = checkndx copydbf dbfxtrct deletall dumphdr dumprecs packdbf \ + reindex undelall zap dbfutil1 + +noinst_PROGRAMS = dumpdbt + +checkndx_SOURCES = checkndx.cpp +copydbf_SOURCES = copydbf.cpp +dbfxtrct_SOURCES = dbfxtrct.cpp +dbfutil1_SOURCES = dbfutil1.cpp +deletall_SOURCES = deletall.cpp +dumpdbt_SOURCES = dumpdbt.cpp +dumphdr_SOURCES = dumphdr.cpp +dumprecs_SOURCES = dumprecs.cpp +packdbf_SOURCES = packdbf.cpp +reindex_SOURCES = reindex.cpp +undelall_SOURCES = undelall.cpp +zap_SOURCES = zap.cpp + +noinst_HEADERS = + +EXTRA_DIST = makebcc.bat + +CLEANFILES = Makefile.in *.exe *.BAK *.tds *.obj *.tr2 *.ndx *.dbf *.dbt \ + *.ntx compout diff --git a/bin/Makefile.in b/bin/Makefile.in new file mode 100755 index 0000000..e757afd --- /dev/null +++ b/bin/Makefile.in @@ -0,0 +1,507 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ + +INSTALL_PROGRAM = @INSTALL@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +GXXVER = @GXXVER@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RELEASE = @RELEASE@ +RHREL = @RHREL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XSUBDIRS = @XSUBDIRS@ +am__include = @am__include@ +am__quote = @am__quote@ +doxygen = @doxygen@ +install_sh = @install_sh@ +topdir = @topdir@ + +INCLUDES = -I$(topdir) +LDADD = -L$(topdir)/xbase64 -lxbase64 + +bin_PROGRAMS = checkndx copydbf dbfxtrct deletall dumphdr dumprecs packdbf \ + reindex undelall zap dbfutil1 + + +noinst_PROGRAMS = dumpdbt + +checkndx_SOURCES = checkndx.cpp +copydbf_SOURCES = copydbf.cpp +dbfxtrct_SOURCES = dbfxtrct.cpp +dbfutil1_SOURCES = dbfutil1.cpp +deletall_SOURCES = deletall.cpp +dumpdbt_SOURCES = dumpdbt.cpp +dumphdr_SOURCES = dumphdr.cpp +dumprecs_SOURCES = dumprecs.cpp +packdbf_SOURCES = packdbf.cpp +reindex_SOURCES = reindex.cpp +undelall_SOURCES = undelall.cpp +zap_SOURCES = zap.cpp + +noinst_HEADERS = + +EXTRA_DIST = makebcc.bat + +CLEANFILES = Makefile.in *.exe *.BAK *.tds *.obj *.tr2 *.ndx *.dbf *.dbt \ + *.ntx compout + +subdir = bin +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = checkndx$(EXEEXT) copydbf$(EXEEXT) dbfxtrct$(EXEEXT) \ + deletall$(EXEEXT) dumphdr$(EXEEXT) dumprecs$(EXEEXT) \ + packdbf$(EXEEXT) reindex$(EXEEXT) undelall$(EXEEXT) \ + zap$(EXEEXT) dbfutil1$(EXEEXT) +noinst_PROGRAMS = dumpdbt$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) + +am_checkndx_OBJECTS = checkndx.$(OBJEXT) +checkndx_OBJECTS = $(am_checkndx_OBJECTS) +checkndx_LDADD = $(LDADD) +checkndx_DEPENDENCIES = +checkndx_LDFLAGS = +am_copydbf_OBJECTS = copydbf.$(OBJEXT) +copydbf_OBJECTS = $(am_copydbf_OBJECTS) +copydbf_LDADD = $(LDADD) +copydbf_DEPENDENCIES = +copydbf_LDFLAGS = +am_dbfutil1_OBJECTS = dbfutil1.$(OBJEXT) +dbfutil1_OBJECTS = $(am_dbfutil1_OBJECTS) +dbfutil1_LDADD = $(LDADD) +dbfutil1_DEPENDENCIES = +dbfutil1_LDFLAGS = +am_dbfxtrct_OBJECTS = dbfxtrct.$(OBJEXT) +dbfxtrct_OBJECTS = $(am_dbfxtrct_OBJECTS) +dbfxtrct_LDADD = $(LDADD) +dbfxtrct_DEPENDENCIES = +dbfxtrct_LDFLAGS = +am_deletall_OBJECTS = deletall.$(OBJEXT) +deletall_OBJECTS = $(am_deletall_OBJECTS) +deletall_LDADD = $(LDADD) +deletall_DEPENDENCIES = +deletall_LDFLAGS = +am_dumpdbt_OBJECTS = dumpdbt.$(OBJEXT) +dumpdbt_OBJECTS = $(am_dumpdbt_OBJECTS) +dumpdbt_LDADD = $(LDADD) +dumpdbt_DEPENDENCIES = +dumpdbt_LDFLAGS = +am_dumphdr_OBJECTS = dumphdr.$(OBJEXT) +dumphdr_OBJECTS = $(am_dumphdr_OBJECTS) +dumphdr_LDADD = $(LDADD) +dumphdr_DEPENDENCIES = +dumphdr_LDFLAGS = +am_dumprecs_OBJECTS = dumprecs.$(OBJEXT) +dumprecs_OBJECTS = $(am_dumprecs_OBJECTS) +dumprecs_LDADD = $(LDADD) +dumprecs_DEPENDENCIES = +dumprecs_LDFLAGS = +am_packdbf_OBJECTS = packdbf.$(OBJEXT) +packdbf_OBJECTS = $(am_packdbf_OBJECTS) +packdbf_LDADD = $(LDADD) +packdbf_DEPENDENCIES = +packdbf_LDFLAGS = +am_reindex_OBJECTS = reindex.$(OBJEXT) +reindex_OBJECTS = $(am_reindex_OBJECTS) +reindex_LDADD = $(LDADD) +reindex_DEPENDENCIES = +reindex_LDFLAGS = +am_undelall_OBJECTS = undelall.$(OBJEXT) +undelall_OBJECTS = $(am_undelall_OBJECTS) +undelall_LDADD = $(LDADD) +undelall_DEPENDENCIES = +undelall_LDFLAGS = +am_zap_OBJECTS = zap.$(OBJEXT) +zap_OBJECTS = $(am_zap_OBJECTS) +zap_LDADD = $(LDADD) +zap_DEPENDENCIES = +zap_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/xbase64 +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/checkndx.Po ./$(DEPDIR)/copydbf.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dbfutil1.Po ./$(DEPDIR)/dbfxtrct.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/deletall.Po ./$(DEPDIR)/dumpdbt.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dumphdr.Po ./$(DEPDIR)/dumprecs.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/packdbf.Po ./$(DEPDIR)/reindex.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/undelall.Po ./$(DEPDIR)/zap.Po +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(checkndx_SOURCES) $(copydbf_SOURCES) \ + $(dbfutil1_SOURCES) $(dbfxtrct_SOURCES) $(deletall_SOURCES) \ + $(dumpdbt_SOURCES) $(dumphdr_SOURCES) $(dumprecs_SOURCES) \ + $(packdbf_SOURCES) $(reindex_SOURCES) $(undelall_SOURCES) \ + $(zap_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(checkndx_SOURCES) $(copydbf_SOURCES) $(dbfutil1_SOURCES) $(dbfxtrct_SOURCES) $(deletall_SOURCES) $(dumpdbt_SOURCES) $(dumphdr_SOURCES) $(dumprecs_SOURCES) $(packdbf_SOURCES) $(reindex_SOURCES) $(undelall_SOURCES) $(zap_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu bin/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +checkndx$(EXEEXT): $(checkndx_OBJECTS) $(checkndx_DEPENDENCIES) + @rm -f checkndx$(EXEEXT) + $(CXXLINK) $(checkndx_LDFLAGS) $(checkndx_OBJECTS) $(checkndx_LDADD) $(LIBS) +copydbf$(EXEEXT): $(copydbf_OBJECTS) $(copydbf_DEPENDENCIES) + @rm -f copydbf$(EXEEXT) + $(CXXLINK) $(copydbf_LDFLAGS) $(copydbf_OBJECTS) $(copydbf_LDADD) $(LIBS) +dbfutil1$(EXEEXT): $(dbfutil1_OBJECTS) $(dbfutil1_DEPENDENCIES) + @rm -f dbfutil1$(EXEEXT) + $(CXXLINK) $(dbfutil1_LDFLAGS) $(dbfutil1_OBJECTS) $(dbfutil1_LDADD) $(LIBS) +dbfxtrct$(EXEEXT): $(dbfxtrct_OBJECTS) $(dbfxtrct_DEPENDENCIES) + @rm -f dbfxtrct$(EXEEXT) + $(CXXLINK) $(dbfxtrct_LDFLAGS) $(dbfxtrct_OBJECTS) $(dbfxtrct_LDADD) $(LIBS) +deletall$(EXEEXT): $(deletall_OBJECTS) $(deletall_DEPENDENCIES) + @rm -f deletall$(EXEEXT) + $(CXXLINK) $(deletall_LDFLAGS) $(deletall_OBJECTS) $(deletall_LDADD) $(LIBS) +dumpdbt$(EXEEXT): $(dumpdbt_OBJECTS) $(dumpdbt_DEPENDENCIES) + @rm -f dumpdbt$(EXEEXT) + $(CXXLINK) $(dumpdbt_LDFLAGS) $(dumpdbt_OBJECTS) $(dumpdbt_LDADD) $(LIBS) +dumphdr$(EXEEXT): $(dumphdr_OBJECTS) $(dumphdr_DEPENDENCIES) + @rm -f dumphdr$(EXEEXT) + $(CXXLINK) $(dumphdr_LDFLAGS) $(dumphdr_OBJECTS) $(dumphdr_LDADD) $(LIBS) +dumprecs$(EXEEXT): $(dumprecs_OBJECTS) $(dumprecs_DEPENDENCIES) + @rm -f dumprecs$(EXEEXT) + $(CXXLINK) $(dumprecs_LDFLAGS) $(dumprecs_OBJECTS) $(dumprecs_LDADD) $(LIBS) +packdbf$(EXEEXT): $(packdbf_OBJECTS) $(packdbf_DEPENDENCIES) + @rm -f packdbf$(EXEEXT) + $(CXXLINK) $(packdbf_LDFLAGS) $(packdbf_OBJECTS) $(packdbf_LDADD) $(LIBS) +reindex$(EXEEXT): $(reindex_OBJECTS) $(reindex_DEPENDENCIES) + @rm -f reindex$(EXEEXT) + $(CXXLINK) $(reindex_LDFLAGS) $(reindex_OBJECTS) $(reindex_LDADD) $(LIBS) +undelall$(EXEEXT): $(undelall_OBJECTS) $(undelall_DEPENDENCIES) + @rm -f undelall$(EXEEXT) + $(CXXLINK) $(undelall_LDFLAGS) $(undelall_OBJECTS) $(undelall_LDADD) $(LIBS) +zap$(EXEEXT): $(zap_OBJECTS) $(zap_DEPENDENCIES) + @rm -f zap$(EXEEXT) + $(CXXLINK) $(zap_LDFLAGS) $(zap_OBJECTS) $(zap_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/checkndx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copydbf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbfutil1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbfxtrct.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deletall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumpdbt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumphdr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumprecs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packdbf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reindex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/undelall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zap.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` + +.cpp.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CXXDEPMODE = @CXXDEPMODE@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstPROGRAMS distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-binPROGRAMS install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool 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: diff --git a/bin/checkndx.cpp b/bin/checkndx.cpp new file mode 100755 index 0000000..35d6add --- /dev/null +++ b/bin/checkndx.cpp @@ -0,0 +1,76 @@ +/* + Xbase64 project source code + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ +#ifdef XBASE_DEBUG + xbXBase x; + xbDbf d( &x ); + xbNdx i( &d ); + xbShort rc; + + if( 3 != ac ){ + std::cout << + "\nUsage: checkndx dbf_file index_file\n"; + return 1; + } + + if(( rc = d.OpenDatabase( av[1] )) != XB_NO_ERROR ) + { + std::cout << "\nCould not open file " << av[1] << " rc = " << rc << "\n"; + return 2; + } + + if(( rc = i.OpenIndex( av[2] )) != XB_NO_ERROR ) + { + std::cout << "\nCould not open file " << av[2] << " rc = " << rc << "\n"; + return 3; + } + + std::cout << "\nRunning...\n"; + rc = i.CheckIndexIntegrity( 1 ); + std::cout << "\nNdx integrity check = " << rc << "\n"; + + i.DumpHdrNode(0); + + d.CloseDatabase(); +#else + std::cout << "\nXBASE_DEBUG is not compiled in\n"; +#endif + return 0; +} diff --git a/bin/copydbf.cpp b/bin/copydbf.cpp new file mode 100755 index 0000000..3175a87 --- /dev/null +++ b/bin/copydbf.cpp @@ -0,0 +1,76 @@ +/* + Xbase64 project source code + + This sample program copies the structure of one dbf to another + dbf file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (3 != ac) { + std::cout << + "\nUsage: copydbf filename1 filename2\n" + "This program copies the structure of one dbf file to another\n"; + return 1; + } + + char* sfilename = av[1]; + char* tfilename = av[2]; + + xbXBase x; + xbDbf MyFile( &x ); + + xbShort rc = MyFile.OpenDatabase( sfilename ); + if( rc != XB_NO_ERROR ) { + std::cout << "Could not open file " << sfilename << " Error = " << rc + << "\n"; + return 2; + } + + // OverlaySwitch = 0; /* dont overlay existing file if it exists */ + xbShort OverlaySwitch = 1; /* overlay existing file if it exists */ + + if(( rc = MyFile.CopyDbfStructure( tfilename, OverlaySwitch )) != XB_NO_ERROR ) + { + std::cout << "Could not copy file " << tfilename << " Error = " << rc + << "\n"; + return 3; + } + + MyFile.CloseDatabase(); /* close database */ + return 0; +} diff --git a/bin/dbfutil1.cpp b/bin/dbfutil1.cpp new file mode 100755 index 0000000..0b74d41 --- /dev/null +++ b/bin/dbfutil1.cpp @@ -0,0 +1,1347 @@ +/* + dbf utility program + + This is a generic XBase menu program for executing XBase64 functions + on a single dbf database table. + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +// next lines are helpful for debugging purposes +/* +#include <xbase64/xbdbf.cpp> +#include <xbase64/xbexp.cpp> +#include <xbase64/xbexpprc.cpp> +#include <xbase64/xbexpfnc.cpp> +#include <xbase64/xbfields.cpp> +#include <xbase64/xbindex.cpp> +#include <xbase64/xbmemo.cpp> +#include <xbase64/xbndx.cpp> +#include <xbase64/xbntx.cpp> +#include <xbase64/xbase64.cpp> +#include <xbase64/xbdate.cpp> +#include <xbase64/xbfilter.cpp> +#include <xbase64/xblock.cpp> +#include <xbase64/xbstring.cpp> +#include <xbase64/xbfile.cpp> +#include <xbase64/xbcdx.cpp> +*/ + +xbXBase x; +xbDbf d( &x ); +xbIndex *ix; + +#ifdef XB_FILTERS +xbFilter *xbf; +#endif + + +class MyClass { + public: + MyClass() {}; + void OpenFile(); + void CloseFile(); + void ConvertDatabase(); + void ReindexDatabase(); + void PackDatabase(); + void ZapDatabase(); + void DeleteMemoField(); + void UpdateMemoField(); + void ShowFieldInfo( int ); + void ShowFieldData(); + void UpdateFieldData(); + void PutRecord(); + void GetRecord(); + void DumpDbtHeader(); + void BlankRecord(); + void FindMemoBlocks(); + void GetMemoBlocks(); + void FileStats(); + void MainMenu(); + void FileMenu(); + void RecordMenu(); + void FieldMenu(); + void IndexMenu(); + void LockingMenu(); + void DebugMenu(); + void OpenIndex(); + void CloseIndex(); + void FindKey(); + void GetFirstKey(); + void GetLastKey(); + void GetNextKey(); + void GetPrevKey(); + void DumpIndexNodes(); + void ShowLockInfo(); + void SetRetryCount(); + void SetDefaultLockMode(); + void SetTableLockMode(); + void LockDbf(); + void UnlockDbf(); + void LockRecord(); + void UnlockRecord(); + void LockMemoFile( xbShort ); + void LockIndexFile( xbShort ); + void CreateNewIndex(); + void ProcessExpression(); + void FilterMenu(); + void SetFilter(); + void FirstFilterRec(); + void NextFilterRec(); + void PrevFilterRec(); + void LastFilterRec(); +}; +/************************************************************************/ +#ifdef XB_FILTERS +void MyClass::FilterMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl + << "Filter Menu" << std::endl; + std::cout << "1 - Set Filter Expression" << std::endl; + std::cout << "2 - Get First Filter Record" << std::endl; + std::cout << "3 - Get Next Filter Record" << std::endl; + std::cout << "4 - Get Previous Filter Record" << std::endl; + std::cout << "5 - Get Last Filter Record" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: SetFilter(); break; + case 2: FirstFilterRec(); break; + case 3: NextFilterRec(); break; + case 4: PrevFilterRec(); break; + case 5: LastFilterRec(); break; + case 99: break; + default: std::cout << "Invalid option" << std::endl; break; + } + } +} +/************************************************************************/ +void MyClass::SetFilter() +{ + char Expression[512]; + memset( Expression, 0x00, 512 ); + while( !strlen( Expression )){ + std::cout << "Enter filter expression (like AMOUNT<5)" << std::endl; + gets( Expression ); + } + if( xbf ) + delete xbf; + + xbf = new xbFilter( &d, 0, Expression ); + + if( xbf->GetStatus() ) + x.DisplayError( xbf->GetStatus()); + else + std::cout << "Filter initialized" << std::endl; +} +/************************************************************************/ +void MyClass::FirstFilterRec() +{ + xbShort rc; + if( !xbf ) + SetFilter(); + rc = xbf->GetFirstFilterRec(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + for( int i = 0; i < d.FieldCount() && i < 3; i++ ) + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); + +} +/************************************************************************/ +void MyClass::NextFilterRec() +{ + xbShort rc; + if( !xbf ) + SetFilter(); + rc = xbf->GetNextFilterRec(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + for( int i = 0; i < d.FieldCount() && i < 3; i++ ) + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); +} +/************************************************************************/ +void MyClass::PrevFilterRec() +{ + xbShort rc; + if( !xbf ) + SetFilter(); + rc = xbf->GetPrevFilterRec(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + for( int i = 0; i < d.FieldCount() && i < 3; i++ ) + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); +} +/************************************************************************/ +void MyClass::LastFilterRec() +{ + xbShort rc; + if( !xbf ) + SetFilter(); + rc = xbf->GetLastFilterRec(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + for( int i = 0; i < d.FieldCount() && i < 3; i++ ) + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); +} +#endif // XB_FILTERS +/************************************************************************/ +#ifdef XB_EXPRESSIONS +void MyClass::ProcessExpression() +{ + char exprsn[256]; + char type; + xbExpn *exp; // expression + xbShort rc; + int debug = 0; + memset( exprsn, 0x00, 256 ); + + std::cout << "Enter expression string or HELP" << std::endl; + + while( !strstr( exprsn, "QUIT" ) && !strstr( exprsn, "quit" )){ + + std::cout << ">"; + gets( exprsn ); + + if( strstr( exprsn, "HELP" ) || strstr( exprsn, "help" )){ + std::cout << "** Command Help ***" << std::endl << std::endl; + std::cout << "HELP - This help screen" << std::endl; + std::cout << "QUIT - Exit the function" << std::endl; + #ifdef XBASE_DEBUG + std::cout << "DEBUG - Toggle debug mode on/off" << std::endl; + #endif + std::cout << "\nExamples expressions:" << std::endl; + std::cout << " 5+5 or 5-2/7 or FUNC(op1,op2)" << std::endl; + std::cout << "\nRecognized functions:" << std::endl; + xbString s; + xbShort i = 0; + exp = new xbExpn( &x ); + s = exp->GetValidFuncName( i++ ); + while( s.len() ){ + std::cout << s << "\t"; + s = exp->GetValidFuncName( i++ ); + } + + delete exp; + std::cout << "\n\nSee documentation for more expression info" + << std::endl << std::endl; + } + + else if( strstr( exprsn, "DEBUG" ) || strstr( exprsn, "debug" )){ + if( debug ){ + std::cout << "Debug mode toggled off" << std::endl; + debug = 0; + } else { + std::cout << "Debug mode toggled on" << std::endl; + debug = 1; + } + } + + else if( !strstr( exprsn, "QUIT" ) && !strstr( exprsn, "quit" )) + { + exp = new xbExpn( &x ); + if(( rc = exp->ParseExpression( exprsn, &d )) != 0 ){ + std::cout << "Error while parsing" << std::endl; + x.DisplayError( rc ); + } + + else { + if( debug ){ + exp->DumpExpressionTree( 1 ); + std::cout << "Expression tree dumped to file xbase64.log" << std::endl; + } + + if(( rc = exp->ProcessExpression()) != 0 ){ + std::cout << "Error in processing " << std::endl; + x.DisplayError( rc ); + } else { + + type = exp->GetExpressionResultType(); + + std::cout << "Result Type = [" << type << "]" << std::endl; + std::cout << "Result Data = ["; + switch( type ){ + case 'C': + case 'D': + std::cout << exp->GetStringResult() << "]" << std::endl; + break; + case 'N': + std::cout << exp->GetDoubleResult() << "]" << std::endl; + break; + case 'L': + std::cout << exp->GetIntResult() << "]" << std::endl; + break; + default: + std::cout << "Unknown result type]" << std::endl; + break; + } + } + delete exp; + } + } + } +} +#endif // XB_EXPRESSIONS +/************************************************************************/ +#ifdef XBASE_DEBUG +void MyClass::DumpIndexNodes() +{ + xbLong NodeCnt = ix->GetTotalNodes(); + std::cout << "For NDX indices, output placed in xbase.log" << std::endl; + std::cout << "total nodes = " << NodeCnt << std::endl; + ix->DumpHdrNode( 1 ); + if( NodeCnt > 1 ) + for( xbLong l = 1L; l <= NodeCnt-1; l++ ) + ix->DumpNodeRec( l ); +} +#endif +/************************************************************************/ +void MyClass::OpenIndex() +{ + int rc; + char Filename[51]; + + if( d.GetDbfStatus() == XB_CLOSED ){ + std::cout << "No open database" << std::endl; + return; + } + if( ix ){ + std::cout << "Index already opened" << std::endl; + return; + } + + std::cout << "Enter index name: "; + std::cin >> Filename; + if( strstr( Filename, "NDX" ) || strstr( Filename, "ndx" )){ + ix = new xbNdx( &d ); + rc = ix->OpenIndex( Filename ); + } + else if( strstr( Filename, "NTX" ) || strstr( Filename, "ntx" )){ + ix = new xbNtx( &d ); + rc = ix->OpenIndex( Filename ); + } + else + { + std::cout + << "Invalid index name. Needs file extension. index.ndx or index.ntx" + << std::endl; + return; + } + x.DisplayError( rc ); +// std::cout << "Return code " << rc << std::endl; +} +/************************************************************************/ +void MyClass::FindKey() +{ + if( !ix ){ + std::cout << "No open index" << std::endl; + return; + } + + char KeyBuf[101]; + memset( KeyBuf, 0x00, 101 ); + std::cout << "This function only works for character keys (so far).." + << std::endl; + std::cout << "Enter search key:" << std::endl; + std::cin >> KeyBuf; + x.DisplayError( ix->FindKey( KeyBuf ) ); +} +/************************************************************************/ +void MyClass::GetNextKey() +{ + if( !ix ) + std::cout << "No open index" << std::endl; + else + x.DisplayError( ix->GetNextKey() ); +} +/************************************************************************/ +void MyClass::GetPrevKey() +{ + if( !ix ) + std::cout << "No open index" << std::endl; + else + x.DisplayError( ix->GetPrevKey() ); +} +/************************************************************************/ +void MyClass::GetFirstKey() +{ + if( !ix ) + std::cout << "No open index" << std::endl; + else + x.DisplayError( ix->GetFirstKey() ); +} +/************************************************************************/ +void MyClass::GetLastKey() +{ + if( !ix ) + std::cout << "No open index" << std::endl; + else + x.DisplayError( ix->GetLastKey() ); +} +/************************************************************************/ +void MyClass::CloseIndex() +{ + if( !ix ){ + std::cout << "No open index" << std::endl; + return; + } + x.DisplayError( ix->CloseIndex()); + delete ix; + ix = 0; +} +/************************************************************************/ +/* stats */ +void MyClass::FileStats() +{ + if( d.GetDbfStatus() == XB_CLOSED ){ + std::cout << "No open database" << std::endl; + return; + } + std::cout << "Database name = " << d.GetDbfName() << std::endl; + std::cout << "Number of records = " << d.NoOfRecords() << std::endl; + std::cout << "Physical no of recs = " << d.PhysicalNoOfRecords() << std::endl; + std::cout << "Number of fields = " << d.FieldCount() << std::endl; + std::cout << "Database Status = "; + switch( d.GetDbfStatus() ){ + case 0: + std::cout << "XB_CLOSED" << std::endl; + break; + case 1: + std::cout << "XB_OPEN" << std::endl; + break; + case 2: + std::cout << "XB_UPDATED" << std::endl; + break; + default: + std::cout << std::endl; + break; + } + std::cout << "Record Length = " << d.GetRecordLen() << std::endl; +#ifdef XB_MEMO_FIELDS + std::cout << "Memo Fields Present = "; + switch( d.MemoFieldsPresent() ){ + case 0: + std::cout << "No " << std::endl; + break; + case 1: + std::cout << "Yes" << std::endl; + std::cout << "Memofile name = " << d.GetDbtName() << std::endl; + break; + default: + std::cout << std::endl; + break; + } +#endif + std::cout << "Current Record No = " << d.GetCurRecNo() << std::endl; + std::cout << "Autolock status = " << d.GetAutoLock() << std::endl; + std::cout << "Real Delete status = " << d.GetRealDelete()<< std::endl; + std::cout << "Index Count = " << d.IndexCount() << std::endl; +} +/************************************************************************/ +/* open database */ +void MyClass::OpenFile() +{ + int rc; + char filename[50]; + std::cout << "Enter database file (.dbf) name: "; + std::cin >> filename; + + rc = d.OpenDatabase( filename ); + x.DisplayError( rc ); +} +/************************************************************************/ +/* open database */ +void MyClass::PackDatabase() +{ + x.DisplayError( d.PackDatabase( 0,0,0 )); +} +/************************************************************************/ +/* open database */ +void MyClass::ZapDatabase() +{ + x.DisplayError( d.Zap(0) ); +} +/************************************************************************/ +/* close database */ +void MyClass::CloseFile() +{ + int rc; + rc = d.CloseDatabase(); + x.DisplayError( rc ); +} +/************************************************************************/ +/* convert database */ +void MyClass::ConvertDatabase() +{ + int rc; + xbShort FieldNo; + xbLong len, FieldCnt; + xbDbf d2( &x ); + char *MemoFieldBuf = NULL; + xbLong MemoFieldLen = 0L; + + std::cout << "Warning - check your results!!" << std::endl << std::endl; + + char filename[50]; + std::cout << "Enter database file name to convert to: "; + std::cin >> filename; + + if(( rc = d2.OpenDatabase( filename )) != XB_NO_ERROR ){ + std::cout << "Error " << rc << " opening database" << std::endl; + return; + } + + rc = d.GetFirstRecord(); + FieldCnt = d.FieldCount(); + std::cout << "Database has " << FieldCnt << " fields to convert" + << std::endl; + while( rc == XB_NO_ERROR ) + { + d2.BlankRecord(); + for( xbShort i = 0; i < FieldCnt; i++ ) + { + if(( FieldNo = d2.GetFieldNo( d.GetFieldName( i ))) == -1 ) + std::cout << "Error converting field " << d.GetFieldName( i ) + << std::endl; + else + { + if( d.GetFieldType( i ) != d2.GetFieldType( FieldNo )) + std::cout << "Error - different field types " << d.GetFieldName(i); + else + { + if( d.GetFieldType( i ) == 'M' ) + { +#ifdef XB_MEMO_FIELDS + len = d.GetMemoFieldLen( i ); + if( len > MemoFieldLen ) + { + if( MemoFieldLen > 0 ) + delete MemoFieldBuf; + MemoFieldBuf = new char[len]; + MemoFieldLen = len; + } + d.GetMemoField( i, len, MemoFieldBuf, XB_LOCK ); + d2.UpdateMemoData( FieldNo, len, MemoFieldBuf, XB_LOCK ); +#else + std::cout + << "Memo fields not converted XB_MEMO_FIELDS not compiled in\n"; +#endif + } + else{ + if( d.GetFieldType(i) == 'N' ){ + std::cout << "const code compile prob..." << std::endl; + +// d2.PutField( FieldNo, x.LTRIM( d.GetField( i ))); + } + else + d2.PutField( FieldNo, d.GetField(i)); + } + } + } + } + rc = d.GetNextRecord(); + d2.AppendRecord(); + } + if( MemoFieldLen > 0 ) + delete MemoFieldBuf; + d2.CloseDatabase(); +} +/************************************************************************/ +void MyClass::ShowFieldInfo( int option ) +{ + FILE * out; + xbString dbfName = d.GetDbfName(); + if( option ){ + if(( out = fopen( "xbase64.dmp" , "w" )) == NULL ){ + std::cout << "File could not be opened" << std::endl; + getchar(); + } else { + fprintf( out, "Table Name = %s\n\n", dbfName.getData()); + fprintf( out, "Number Name Type Len Decs\n" ); + for( int i = 0; i < d.FieldCount(); i++ ) + fprintf(out, "%3d %-10s %c %5d %d\n", i+1, + d.GetFieldName(i), d.GetFieldType(i), + d.GetFieldLen(i), d.GetFieldDecimal(i) ); + } + fclose( out ); + } + else + { + printf( "Table Name = %s\n", dbfName.getData()); + std::cout << "Number Name Type Len Decs" << std::endl; + for( int i = 0; i < d.FieldCount(); i++ ){ + printf( "%3d %-10s %c %5d %d\n", i+1, + d.GetFieldName(i), d.GetFieldType(i), + d.GetFieldLen(i), d.GetFieldDecimal(i) ); + if(((i+1)%15) == 0 ){ + std::cout << "Press a key to continue" << std::endl; + getchar(); + std::cout << "Number Name Type Len Decs" << std::endl; + } + } + } + std::cout << "Press a key to continue" << std::endl; + getchar(); +} +/************************************************************************/ +void MyClass::ShowFieldData() +{ + int done = 0; + + if( d.GetCurRecNo() == 0L ){ + d.GetRecord( 1L ); + } + + while( !done ){ + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + std::cout << "FieldName Data" << std::endl; + std::cout << "========= ====" << std::endl; + if( d.RecordDeleted()) + std::cout << "Record is deleted" << std::endl; + for( int i = 0; i < d.FieldCount(); i++ ){ + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); + if(((i+1)%15) == 0 ){ + std::cout << "Press a key to continue" << std::endl; + getchar(); + std::cout << " Name Data" << std::endl; + } + } + std::cout << "Press 'N' for next record or any other key to exit" << std::endl; + if( toupper( getchar()) == 'N' ){ + d.GetRecord( d.GetCurRecNo() + 1L ); + getchar(); + } + else + done ++; + } +} +/************************************************************************/ +void MyClass::UpdateFieldData() +{ + char dbuf[100]; + int rc, fn; + std::cout << "Enter Field Number to update (first field is 0): " + << std::endl; + std::cin >> fn; + std::cout << "Enter Field Data" << std::endl; + std::cin >> dbuf; + rc = d.PutField( fn, dbuf ); + x.DisplayError( rc ); +} +/************************************************************************/ +/* open database */ +void MyClass::ReindexDatabase() +{ + xbNdx n(&d); + int rc; + char filename[50]; + std::cout << "Enter index file name: "; + std::cin >> filename; + + if(( rc = n.OpenIndex( filename )) != XB_NO_ERROR ){ + x.DisplayError( rc ); + return; + } + x.DisplayError( n.ReIndex() ); +} +/************************************************************************/ +void MyClass::GetRecord() +{ + xbLong RecNo; + std::cout << "Enter record number: "; + std::cin >> RecNo; + + x.DisplayError( d.GetRecord( RecNo )); +} +/************************************************************************/ +void MyClass::UpdateMemoField() +{ +#ifdef XB_MEMO_FIELDS + xbShort fn,rc; + xbLong len; + char bufchar[2]; + char *buf; + + std::cout << "Enter Field Number: " << std::endl; + std::cin >> fn; + if( fn < 0 || fn > d.FieldCount()){ + std::cout << "Invalid Field Number" << std::endl; + return; + } + if( d.GetFieldType( fn ) != 'M' ){ + std::cout << "Field " << fn << " is not a memo field" << std::endl; + std::cout << "Field Name = " << d.GetFieldName( fn ) << " type= "; + std::cout << d.GetFieldType( fn ) << std::endl; + return; + } + std::cout << "Enter length of memo data:" << std::endl; + std::cin >> len; + + std::cout << "Enter character to populate memo data:" << std::endl; + std::cin >> bufchar; + + buf = new char[len]; + memset( buf, bufchar[0], len ); + + rc = d.UpdateMemoData( fn, len, buf, XB_LOCK ); + std::cout << "Return Code = " << rc << std::endl; +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +/************************************************************************/ +void MyClass::DeleteMemoField() +{ +#ifdef XB_MEMO_FIELDS + xbShort fn,rc; + std::cout << "Enter Field Number: " << std::endl; + std::cin >> fn; + if( fn < 0 || fn > d.FieldCount()){ + std::cout << "Invalid Field Number" << std::endl; + return; + } + if( d.GetFieldType( fn ) != 'M' ){ + std::cout << "Field " << fn << " is not a memo field" << std::endl; + std::cout << "Field Name = " << d.GetFieldName( fn ) << " type= "; + std::cout << d.GetFieldType( fn ) << std::endl; + return; + } + rc = d.UpdateMemoData( fn, 0, 0, XB_LOCK ); + x.DisplayError( rc ); +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +/************************************************************************/ +#ifdef XBASE_DEBUG +void MyClass::DumpDbtHeader() +{ + int rc; + +#ifdef XB_MEMO_FIELDS +#ifdef XBASE_DEBUG + +/* - This is used to peek in the file for debugging purposes + probably not to useful for anything else - Gary +*/ + + rc = d.DumpMemoFreeChain(); + x.DisplayError( rc ); + +#else + std::cout << "\nXBASE_DEBUG is not compiled in\n"; +#endif +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +/************************************************************************/ +void MyClass::GetMemoBlocks() +{ +#ifdef XB_MEMO_FIELDS + xbLong BlocksNeeded, Location, PrevNode; + int rc; + + std::cout << "Enter number of blocks: " << std::endl; + std::cin >> BlocksNeeded; + std::cout << "Enter starting location: " << std::endl; + std::cin >> Location; + std::cout << "Enter previous node: " << std::endl; + std::cin >> PrevNode; + rc = d.GetBlockSetFromChain( BlocksNeeded, Location, PrevNode ); + x.DisplayError( rc ); + +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +/************************************************************************/ +void MyClass::CreateNewIndex() +{ + char IndexName[128]; + char KeyExpression[500]; + char Unique[25]; + xbShort uniqueSw = 0; + xbShort rc; + + if( ix ){ + std::cout << "Program only supports one open index at a time" << std::endl; + std::cout << "Looking for volunteer to change that fact" << std::endl; + return; + } + memset( IndexName, 0x00, 128 ); + memset( KeyExpression, 0x00, 500 ); + memset( Unique, 0x00, 25 ); + std::cout << "This function creates a new index for an open table" << std::endl; + std::cout << "If the index already exists, it will be overlaid" << std::endl; + while( !strlen( IndexName ) || + ( !strstr( IndexName, ".ndx" ) && !strstr( IndexName, ".ntx" ))){ + std::cout << "Enter index name (include .ntx or .ndx extension)" << std::endl; + std::cin >> IndexName; + for( int i = 0; i < (int) strlen( IndexName ); i++ ) + IndexName[i] = tolower( IndexName[i] ); + } + while( Unique[0] != 'U' && Unique[0] != 'N' ){ + std::cout << "Enter U)nique or N)on unique" << std::endl; + std::cin >> Unique; + if( Unique[0] == 'U' ) + uniqueSw++; + } + while( !strlen( KeyExpression )){ + std::cout << "Enter key expression" << std::endl; + std::cin >> KeyExpression; + } + if( strstr( IndexName, "ndx" )){ + ix = new xbNdx( &d ); + rc = ix->CreateIndex( IndexName, KeyExpression, uniqueSw, 1 ); + } + else if( strstr( IndexName, "ntx" )){ + ix = new xbNtx( &d ); + rc = ix->CreateIndex( IndexName, KeyExpression, uniqueSw, 1 ); + } + if( rc ){ + x.DisplayError( rc ); + ix->CloseIndex(); + ix = NULL; + return; + } + std::cout << IndexName << " created. Loading data.." << std::endl; + rc = ix->ReIndex(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Index loaded successfully" << std::endl; + return; +} +/************************************************************************/ +void MyClass::FindMemoBlocks() +{ +#ifdef XB_MEMO_FIELDS + xbLong BlocksNeeded, Location, PrevNode; + int rc; + + std::cout << "Enter number of blocks: " << std::endl; + std::cin >> BlocksNeeded; + rc = d.FindBlockSetInChain( BlocksNeeded, 0, Location, PrevNode ); + std::cout << "Return code = " << rc << std::endl; + std::cout << "Location = " << Location << std::endl; + std::cout << "Previous Node = " << PrevNode << std::endl; +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +#endif // XBASE_DEBUG +/************************************************************************/ +void MyClass::IndexMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl + << "NDX and NTX Index Menu" << std::endl; + std::cout << "This program only supports one open index at a time" << std::endl; + std::cout << "1 - Open Index" << std::endl; + std::cout << "2 - Create New Index" << std::endl; + if( ix ){ + std::cout << "3 - Find Key" << std::endl; + std::cout << "4 - Get First Key" << std::endl; + std::cout << "5 - Get Last Key" << std::endl; + std::cout << "6 - Get Previous Key" << std::endl; + std::cout << "7 - Get Next Key" << std::endl; + std::cout << "8 - Close Index" << std::endl; + std::cout << "9 - Check Index Integrity" << std::endl; + } + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: OpenIndex(); break; + case 2: CreateNewIndex(); break; + case 3: FindKey(); break; + case 4: GetFirstKey(); break; + case 5: GetLastKey(); break; + case 6: GetPrevKey(); break; + case 7: GetNextKey(); break; + case 8: CloseIndex(); break; + case 9: x.DisplayError( ix->CheckIndexIntegrity( 1 )); break; + case 99: break; + default: std::cout << "Invalid option" << std::endl; break; + } + } +} +/************************************************************************/ +#ifdef XBASE_DEBUG +void MyClass::DebugMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl << "Debug Menu" << std::endl; + std::cout << "1 - Dislay DBT Header" << std::endl; + std::cout << "2 - Find Memo Blocks" << std::endl; + std::cout << "3 - Get Memo Blocks" << std::endl; + std::cout << "4 - Dump index node chains to file xbase.dmp" << std::endl; + std::cout << "5 - Dump index node chain" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: DumpDbtHeader(); break; + case 2: FindMemoBlocks(); break; + case 3: GetMemoBlocks(); break; + case 4: DumpIndexNodes(); break; + case 5: ix->DumpNodeChain(); break; + case 99: break; + default: std::cout << "Invalid option" << std::endl; break; + } + } +} +#endif // XBASE_DEBUG + +/************************************************************************/ + +#ifdef XB_LOCKING_ON + +void MyClass::LockDbf() +{ + xbShort rc; + std::cout << "Locking table" << std::endl; +// rc = d.LockTable( XB_LOCK ); +// x.DisplayError( rc ); + std::cout << "temporarily out of service" << std::endl; +} +/************************************************************************/ + +void MyClass::UnlockDbf() +{ + xbShort rc; + std::cout << "Unlocking table" << std::endl; +// rc = d.LockTable( XB_UNLOCK ); +// x.DisplayError( rc ); + + std::cout << "temporarily out of service" << std::endl; +} + +/************************************************************************/ + +void MyClass::LockRecord() +{ + xbShort rc; + xbULong RecNo; + xbULong RecCnt; + + std::cout << "Enter start record number to lock" << std::endl; + std::cin >> RecNo; + std::cout << "Enter number of records to lock" << std::endl; + std::cin >> RecCnt; + +// rc = d.LockRecord( XB_LOCK, RecNo, RecCnt ); +// x.DisplayError( rc ); + + std::cout << "temporarily out of service" << std::endl; +} +/************************************************************************/ +void MyClass::UnlockRecord() +{ + xbShort rc; + xbULong RecNo; + xbULong RecCnt; + std::cout << "Enter start record number to unlock" << std::endl; + std::cin >> RecNo; + std::cout << "Enter number of records to unlock" << std::endl; + std::cin >> RecCnt; +// rc = d.LockRecord( XB_UNLOCK, RecNo, RecCnt ); +// x.DisplayError( rc ); + + std::cout << "temporarily out of service" << std::endl; +} +/************************************************************************/ +void MyClass::ShowLockInfo() +{ + std::cout << "Retry Count (in seconds) => " << x.GetLockRetryCount() << std::endl; +// std::cout << "No of table locks => " << d.GetTableLockCnt() << std::endl; + + #ifdef XB_MEMO_FIELDS +// std::cout << "Memo locks => " << d.GetMemoLockCnt() << std::endl; + #endif + + std::cout << "Current default lock mode => "; + switch( x.GetLockMode() ){ + case XB_SINGLE_USER_MODE: + std::cout << "XB_SINGLE_USER_MODE" << std::endl; + break; + case XB_XBASE_LOCK_MODE: + std::cout << "XB_XBASE_LOCK_MODE" << std::endl; + break; + case XB_DBASE5_LOCK_MODE: + std::cout << "XB_DBASE5_LOCK_MODE" << std::endl; + break; case XB_CLIPPER5_LOCK_MODE: + std::cout << "XB_CLIPPER5_LOCK_MODE" << std::endl; + break; + case XB_FOXPRO3_LOCK_MODE: + std::cout << "XB_FOXPRO3_LOCK_MODE" << std::endl; + break; + default: + std::cout << "Unknown lock mode" << std::endl; + break; + } + + std::cout << "Current table lock mode => "; + switch( d.GetLockMode() ){ + case XB_SINGLE_USER_MODE: + std::cout << "XB_SINGLE_USER_MODE" << std::endl; + break; + case XB_XBASE_LOCK_MODE: + std::cout << "XB_XBASE_LOCK_MODE" << std::endl; + break; + case XB_DBASE5_LOCK_MODE: + std::cout << "XB_DBASE5_LOCK_MODE" << std::endl; + break; + case XB_CLIPPER5_LOCK_MODE: + std::cout << "XB_CLIPPER5_LOCK_MODE" << std::endl; + break; + case XB_FOXPRO3_LOCK_MODE: + std::cout << "XB_FOXPRO3_LOCK_MODE" << std::endl; + break; + default: + std::cout << "Unknown lock mode" << std::endl; + break; + } +} + +/************************************************************************/ + +void MyClass::SetDefaultLockMode() +{ + xbShort option; + + std::cout << std::endl << std::endl; + std::cout << "Default Lock Mode Selection" << std::endl; + std::cout << "1 - XB_SINGLE_USER_MODE" << std::endl; + std::cout << "2 - XB_XBASE_LOCK_MODE" << std::endl; + std::cout << "3 - XB_DBASE5_LOCK_MODE" << std::endl; + std::cout << "4 - XB_CLIPPER5_LOCK_MODE" << std::endl; + std::cout << "5 - XB_FOXPRO3_LOCK_MODE" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + + switch( option ){ + case 1: x.SetLockMode( XB_SINGLE_USER_MODE ); break; + case 2: x.SetLockMode( XB_XBASE_LOCK_MODE ); break; + case 3: x.SetLockMode( XB_DBASE5_LOCK_MODE ); break; + case 4: x.SetLockMode( XB_CLIPPER5_LOCK_MODE ); break; + case 5: x.SetLockMode( XB_FOXPRO3_LOCK_MODE ); break; + case 99: break; + } +} + +/************************************************************************/ + +void MyClass::SetTableLockMode() +{ + + xbShort option; + + std::cout << std::endl << std::endl; + std::cout << "Table Lock Mode Selection" << std::endl; + std::cout << "1 - XB_SINGLE_USER_MODE" << std::endl; + std::cout << "2 - XB_XBASE_LOCK_MODE" << std::endl; + std::cout << "3 - XB_DBASE5_LOCK_MODE" << std::endl; + std::cout << "4 - XB_CLIPPER5_LOCK_MODE" << std::endl; + std::cout << "5 - XB_FOXPRO3_LOCK_MODE" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + + switch( option ){ + case 1: d.SetLockMode( XB_SINGLE_USER_MODE ); break; + case 2: d.SetLockMode( XB_XBASE_LOCK_MODE ); break; + case 3: d.SetLockMode( XB_DBASE5_LOCK_MODE ); break; + case 4: d.SetLockMode( XB_CLIPPER5_LOCK_MODE ); break; + case 5: d.SetLockMode( XB_FOXPRO3_LOCK_MODE ); break; + case 99: break; + } +} + +/************************************************************************/ + +void MyClass::SetRetryCount() +{ + xbShort retryCnt; + std::cout << "Enter new Retry Count " << std::endl; + std::cin >> retryCnt; + x.SetLockRetryCount( retryCnt ); +} + +/************************************************************************/ +#ifdef XB_MEMO_FIELDS + +void MyClass::LockMemoFile( xbShort LockType ) +{ + xbShort rc; +// rc = d.LockMemoFile( LockType ); +// x.DisplayError( rc ); + std::cout << "no memo locking here" << std::endl; +} + +#endif + +/************************************************************************/ + +void MyClass::LockIndexFile( xbShort LockType ) +{ + xbShort rc; + + if( ix ){ +// rc = ix->LockIndex( LockType ); +// x.DisplayError( rc ); + + std::cout << "temporarily out of service" << std::endl; + } + else + std::cout << "No open index" << std::endl; +} + +#endif +/************************************************************************/ +void MyClass::PutRecord() +{ + xbLong l; + std::cout << "Enter Record number for PutRecord()" << std::endl; + std::cin >> l; + int rc = d.PutRecord( l ); + x.DisplayError( rc ); +} +/************************************************************************/ +void MyClass::FieldMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl << "Field Menu" << std::endl; + std::cout << "1 - Delete Memo Field" << std::endl; + std::cout << "2 - Update Memo Field" << std::endl; + std::cout << "3 - Show Field Info" << std::endl; + std::cout << "4 - Dump Field Info to file xbase64.dmp" << std::endl; + std::cout << "5 - Show Field Data" << std::endl; + std::cout << "6 - Update Field Data" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: DeleteMemoField(); break; + case 2: UpdateMemoField(); break; + case 3: ShowFieldInfo(0); break; + case 4: ShowFieldInfo(1); break; + case 5: ShowFieldData(); break; + case 6: UpdateFieldData(); break; + case 99: break; + default: std::cout << "Function not available" << std::endl; break; + } + } +} +/************************************************************************/ +void MyClass::RecordMenu() +{ + int option = 0; + std::cout << "Record Menu" << std::endl; + while( option != 99 ) { + std::cout << std::endl << std::endl << "Record Menu" << std::endl; + std::cout << "1 - Get Record" << std::endl; + std::cout << "2 - Blank Record" << std::endl; + std::cout << "3 - Append Record" << std::endl; + std::cout << "4 - Put Record" << std::endl; + std::cout << "5 - Delete Record" << std::endl; + std::cout << "6 - Undelete Record" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: GetRecord(); break; + case 2: x.DisplayError( d.BlankRecord()); break; + case 3: x.DisplayError( d.AppendRecord()); break; + case 4: x.DisplayError( d.PutRecord()); break; + case 5: x.DisplayError( d.DeleteRecord()); break; + case 6: x.DisplayError( d.UndeleteRecord()); break; + case 99: break; + default: std::cout << "Invalid option" << std::endl; break; + } + } +} +/************************************************************************/ +void MyClass::FileMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl << "File Menu" << std::endl; + std::cout << "1 - Open File" << std::endl; + std::cout << "2 - Close File" << std::endl; + std::cout << "3 - File Stats" << std::endl; + std::cout << "4 - Convert Database" << std::endl; + std::cout << "5 - Reindex Database" << std::endl; + std::cout << "6 - Pack Database" << std::endl; + std::cout << "7 - Zap Database" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + + switch( option ){ + case 1: OpenFile(); break; + case 2: CloseFile(); break; + case 3: FileStats(); break; + case 4: ConvertDatabase(); break; + case 5: ReindexDatabase(); break; + case 6: PackDatabase(); break; + case 7: ZapDatabase(); break; + case 99: break; + default: std::cout << "Invalid Option" << std::endl; + } + } +} +/************************************************************************/ + +#ifdef XB_LOCKING_ON +void MyClass::LockingMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl << "Locking Menu" << std::endl; + std::cout << "1 - Display lock info" << std::endl; + std::cout << "2 - Set retry count" << std::endl; + std::cout << "3 - Set default lock mode" << std::endl; + std::cout << "4 - Set table lock mode" << std::endl; + std::cout << "5 - Lock table (dbf file)" << std::endl; + std::cout << "6 - Unlock table (dbf file)" << std::endl; + std::cout << "7 - Lock Record" << std::endl; + std::cout << "8 - Unlock Record" << std::endl; + std::cout << "9 - Lock Memo File" << std::endl; + std::cout << "10 - Unlock Memo File" << std::endl; + std::cout << "11 - Lock Index File" << std::endl; + std::cout << "12 - Unlock Index File" << std::endl; + + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + + switch( option ) { + case 1: ShowLockInfo(); break; + case 2: SetRetryCount(); break; + case 3: SetDefaultLockMode(); break; + case 4: SetTableLockMode(); break; + case 5: LockDbf(); break; + case 6: UnlockDbf(); break; + case 7: LockRecord(); break; + case 8: UnlockRecord(); break; + case 9: LockMemoFile( XB_LOCK ); break; + case 10: LockMemoFile( XB_UNLOCK ); break; + case 11: LockIndexFile( XB_LOCK ); break; + case 12: LockIndexFile( XB_UNLOCK ); break; + + case 99: break; + default: std::cout << "Invalid Option" << std::endl; + } + } +} +#endif + +/************************************************************************/ + +void MyClass::MainMenu() +{ + int option = 0; + std::cout << std::endl<< std::endl << "XBase Utility Program"; + while( option != 99 ) { + std::cout << std::endl << std::endl << "Main Menu" << std::endl; + std::cout << "1 - File Menu" << std::endl; + std::cout << "2 - Record Menu" << std::endl; + std::cout << "3 - Field Menu" << std::endl; + std::cout << "4 - Index Menu" << std::endl; + #ifdef XB_LOCKING_ON + std::cout << "5 - Locking Menu" << std::endl; + #endif + #ifdef XBASE_DEBUG + std::cout << "6 - Debug Menu" << std::endl; + #endif + #ifdef XB_EXPRESSIONS + std::cout << "7 - Expression Testor" << std::endl; + #endif + #ifdef XB_FILTERS + std::cout << "8 - Filter Menu" << std::endl; + #endif + std::cout << "99 - Exit" << std::endl; + std::cin >> option; + switch( option ){ + case 1: FileMenu(); break; + case 2: RecordMenu(); break; + case 3: FieldMenu(); break; + case 4: IndexMenu(); break; + #ifdef XB_LOCKING_ON + case 5: LockingMenu(); break; + #endif + #ifdef XBASE_DEBUG + case 6: DebugMenu(); break; + #endif + #ifdef XB_EXPRESSIONS + case 7: ProcessExpression(); break; + #endif + #ifdef XB_FILTERS + case 8: FilterMenu(); break; + #endif + + case 99: std::cout << "Bye!! - Thanks for using XBase64" + << std::endl; break; + default: std::cout << "Invalid function" << std::endl; break; + } + } +} + +/************************************************************************/ + +int main(int, char**) +{ + MyClass m; + m.MainMenu(); + return 0; +} diff --git a/bin/dbfxtrct.cpp b/bin/dbfxtrct.cpp new file mode 100755 index 0000000..5d36b1e --- /dev/null +++ b/bin/dbfxtrct.cpp @@ -0,0 +1,188 @@ +/* + Xbase64 project source code + + This program extracts data from a dbf data file and puts it in + a comma delimited output file, suitable for input into an awk or + perl script + + This program excludes all memo fields + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +/*************************************************************************/ +void Usage(); +void Usage() +{ + std::cout << "\nUsage: dbfxtrct -iDATABASE.DBF -sINDEX.N[TD]X -f -F -dMM/DD/YY\n"; + std::cout << "\nWhere DATABASE.DBF is the name of the database file to dump\n"; + std::cout << "INDEX.NTX or .NDX is an optional index sort paramater\n"; + std::cout << "-f optional field name list in first record\n"; + std::cout << "-F optional field name and attributes in first record\n"; + std::cout << "MM/DD/YY is an optional output date format for any date fields\n"; + std::cout << "\nThis program creates output suitable for awk and perl scripts\n"; + std::cout << "\nThis program does not support memo fields (yet).\n"; +} +/*************************************************************************/ +int main(int ac,char** av) +{ + xbXBase x; + xbDbf d( &x ); + xbShort rc, FieldOption = 0; + xbIndex *ix = 0; + xbNdx z(&d); + + char *dbfname = NULL; + char *ixname = NULL; + char *p; + char buf[200]; + xbExpn exp( &x ); + +/* Get the input paramaters + + -i input datafile name + -s optional sort index name + -f optional field names in record one + -F optional field names and attributes in record one + -d date format +*/ + for( int i = 1; i < ac; i++ ) + { + p = av[i]; + if( *p != '-' ){ + std::cout << "Invalid paramater " << *p << std::endl; + Usage(); + return 1; + } + p++; + if( *p == 'i' ) + dbfname = ++p; + else if( *p == 's' ) + ixname = ++p; + else if( *p == 'f' ) + FieldOption = 1; + else if( *p == 'F' ) + FieldOption = 2; + else if( *p == 'd' ) + x.SetDefaultDateFormat( ++p ); + else{ + std::cout << "Invalid paramater " << *p << std::endl; + Usage(); + return 1; + } + } + +/* if missing params, display a usage message and exit */ + + if( !dbfname ){ + Usage(); + return 1; + } + +/* open the database file */ + + if(( rc = d.OpenDatabase( dbfname )) != XB_NO_ERROR ) + { + std::cout << "\nCould not open file " << dbfname << " rc = " << rc + << "\n"; + return 2; + } + +/* if an index was specified, open the index file */ + + if( ixname ){ + +#ifdef XB_INDEX_NTX + if( strstr( ixname, "NTX" )) + ix = new xbNtx( &d ); +#endif + +#ifdef XB_INDEX_NDX + if( strstr( ixname, "NDX" )) + ix = new xbNdx( &d ); +#endif + if( !ix ){ + std::cout << "Unknown index type. .NTX and .NDX index file support only\n"; + return 3; + } + if(( rc = ix->OpenIndex( ixname )) != XB_NO_ERROR ) + { + std::cout << "\nCould not open index " << ixname << " rc = " << rc + << "\n"; + return 4; + } + } + + +/* if -f or -F paramater, dump the header information */ + if( FieldOption ){ + for( xbLong l = 0; l < d.FieldCount(); l++ ){ + if( l ) std::cout << ","; + std::cout << d.GetFieldName(l); + if( FieldOption == 2 ){ + std::cout << "|" << d.GetFieldType(l) << "|" << d.GetFieldLen(l); + std::cout << "|" << d.GetFieldDecimal(l); + } + } + std::cout << std::endl; + } + +/* if an index used, then loop thru each record, based on index, else + dump in dbf sort order */ + if( ixname ) + rc = ix->GetFirstKey(); + else + rc = d.GetFirstRecord(); + + while( rc == XB_NO_ERROR ){ + for( xbLong l = 0; l < d.FieldCount(); l++ ){ + if( l ) std::cout << ","; + strcpy( buf, exp.LTRIM( d.GetStringField( l ))); + if( d.GetFieldType( l ) == 'D' ) + std::cout << exp.DTOC( buf ); + else + std::cout << exp.TRIM( buf ); + } + if( ixname ) + rc = ix->GetNextKey(); + else + rc = d.GetNextRecord(); + std::cout << std::endl; + } + +/* close everything */ + d.CloseDatabase(); + return 0; +} diff --git a/bin/deletall.cpp b/bin/deletall.cpp new file mode 100755 index 0000000..03d2e23 --- /dev/null +++ b/bin/deletall.cpp @@ -0,0 +1,71 @@ +/* + Xbase64 project source code + + This sample program deletes all records in an Xbase64 DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (ac <= 1) { + std::cout << "\nUsage: deletall filename...\n"; + return 1; + } + + for (int i=1; i<ac; ++i) { + char* filename = av[i]; + + xbXBase x; + xbDbf MyFile( &x ); + + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << "\n"; + return 2; + } + + xbShort rc = MyFile.DeleteAllRecords(); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError Deleting all records - database ==> " + << filename; + std::cout << " Return Code = " << rc; + } + MyFile.CloseDatabase(); /* close database */ + + std::cout << "\nDone...\n\n"; + } + + return 0; +} diff --git a/bin/dumpdbt.cpp b/bin/dumpdbt.cpp new file mode 100755 index 0000000..1ecae84 --- /dev/null +++ b/bin/dumpdbt.cpp @@ -0,0 +1,113 @@ +/* + Xbase64 project source code + + This program is used for debugging the memo file logic + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main( int ac, char **av ) +{ +#ifdef XB_MEMO_FIELDS + xbXBase x; + + if( ac <= 1 ){ + std::cout << "\nUsage: dumpdbt filename...\n"; + return 1; + } + + for( int i = 1; i < ac; ++i ){ + char* filename = av[i]; + xbDbf dbf( &x ); + + if( dbf.OpenDatabase( filename )){ + std::cout << "\nCant open input file " << filename; + return 2; + } + + std::cout << "\n\nFree Block Chain...."; +#ifdef XBASE_DEBUG + dbf.DumpMemoFreeChain(); + std::cout <<"\nEnd of free block chain\n***********************************"; +#else + std::cout << "\nXBASE_DEBUG is not compiled in\n"; +#endif + + /* lock the memo file */ +# ifdef XB_LOCKING_ON +// dbf.LockMemoFile( XB_LOCK ); +# endif /* XB_LOCKING_ON */ + + if( !dbf.MemoFieldsPresent() ) { + std::cout << "No memo fields exist in " << filename << std::endl; + } else { + xbLong BufSize = 0L; + char* Buf = NULL; + for( xbLong l = 1; l <= dbf.NoOfRecords(); l++ ){ + dbf.GetRecord( l ); + std::cout << "\nRecord # " << dbf.GetCurRecNo(); + for( int j = 0; j < dbf.FieldCount(); j++ ) { + if( dbf.GetFieldType( j ) == 'M' ) { + int len = dbf.GetMemoFieldLen( j ); + std::cout << "\nMemo field " << dbf.GetFieldName(j) + << " length = " << len; + std::cout << " Head Block = " << dbf.GetLongField( j ) << "\n"; + if( len > BufSize ){ + if( BufSize ) free( Buf ); + if(( Buf = (( char *) malloc( len ))) == NULL ) + return XB_NO_MEMORY; + BufSize = len; + } + dbf.GetMemoField( j, len, Buf, XB_LOCK ); + for( int i = 0; i < len; i++ ) + std::cout << Buf[i]; + } + } + } + + /* unlock the memo file */ +# ifdef XB_LOCKING_ON +// dbf.LockMemoFile( XB_UNLOCK ); +# endif /* XB_LOCKING_ON */ + + std::cout << "\n"; + dbf.CloseDatabase(); + } + } +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif + return 0; +} diff --git a/bin/dumphdr.cpp b/bin/dumphdr.cpp new file mode 100755 index 0000000..50115b6 --- /dev/null +++ b/bin/dumphdr.cpp @@ -0,0 +1,69 @@ +/* + This sample program dumps an Xbase header record + + Xbase64 project source code + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main( int ac, char ** av ) +{ +#ifdef XBASE_DEBUG + xbShort rc; + xbXBase x; + + if( ac <= 1 ) { + std::cout << "\nUsage: dumphdr filename...\n"; + return 1; + } + for( int i = 1; i < ac; ++i ){ + char * filename = av[i]; + xbDbf MyFile( &x ); + + if(( rc = MyFile.OpenDatabase( filename )) != 0 ) + { + std::cout << "Could not open file rc = " << rc << " file = " + << filename << "\n"; + return 0; + } + MyFile.DumpHeader( 3 ); + MyFile.CloseDatabase(); + } +#else + std::cout << "\nXBASE_DEBUG is not compiled in\n"; +#endif + return 0; +} diff --git a/bin/dumprecs.cpp b/bin/dumprecs.cpp new file mode 100755 index 0000000..5d79ab2 --- /dev/null +++ b/bin/dumprecs.cpp @@ -0,0 +1,97 @@ +/* dumprecs.cpp + + Thos program dumps a dbf file contents + + Xbase64 project source code + + This sample program dumps Xbase records + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ +#include <xbase64/xbase64.h> + +// next lines are helpful for debugging purposes +#include <xbase64/xbdbf.cpp> +#include <xbase64/xbexp.cpp> +#include <xbase64/xbexpprc.cpp> +#include <xbase64/xbexpfnc.cpp> +#include <xbase64/xbfields.cpp> +#include <xbase64/xbindex.cpp> +#include <xbase64/xbmemo.cpp> +#include <xbase64/xbndx.cpp> +#include <xbase64/xbntx.cpp> +#include <xbase64/xbase64.cpp> +#include <xbase64/xbdate.cpp> +#include <xbase64/xbfilter.cpp> +#include <xbase64/xblock.cpp> +#include <xbase64/xbstring.cpp> +#include <xbase64/xbfile.cpp> +#include <xbase64/xbcdx.cpp> + + + +int main(int ac,char** av) +{ + xbXBase x; + xbShort rc; + + if (ac <= 1) { + std::cout << "Usage: dumprecs filename..." << std::endl; + return 1; + } + + for(int i=1; i<ac; ++i){ + char* filename = av[i]; + + xbDbf MyFile( &x ); + + MyFile.SetVersion( 4 ); + rc = MyFile.OpenDatabase(filename); + if( rc != XB_NO_ERROR) { + std::cout << "Could not open file " << filename << std::endl; + x.DisplayError( rc ); + return 1; + } + + std::cout << "Processing file sequentially from beginning..." << std::endl; + int i = 0; + while(i<MyFile.NoOfRecords()){ + rc = MyFile.DumpRecord(++i); + if( rc != XB_NO_ERROR ) + x.DisplayError( rc ); + } + MyFile.CloseDatabase(); /* close database */ + } + return 0; +} + diff --git a/bin/makebcc.bat b/bin/makebcc.bat new file mode 100755 index 0000000..d4baca0 --- /dev/null +++ b/bin/makebcc.bat @@ -0,0 +1,22 @@ +
+rem This batch file builds the xbase utility programs
+rem using the borland 5.5 compiler
+
+del *.bak
+del *.tds
+del *.exe
+del *.obj
+
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 checkndx.cpp xbase64.lib > compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 copydbf.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dbfutil1.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dbfxtrct.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 deletall.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dumpdbt.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dumphdr.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dumprecs.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 packdbf.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 reindex.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 undelall.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 zap.cpp xbase64.lib >> compout
+
diff --git a/bin/packdbf.cpp b/bin/packdbf.cpp new file mode 100755 index 0000000..2c5db8b --- /dev/null +++ b/bin/packdbf.cpp @@ -0,0 +1,77 @@ +/* + Xbase64 project source code + + This sample program packs an Xbase DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (ac <= 1) { + std::cout << + "\nUsage: packdbf filename...\n" + "\nThis program does not automatically reindex any NDX indexes." + "\nUse the reindex program to reindex any indexes associated" + "\nwith the database, or build your own program which executes " + "\nthe PackDatabase() method after opening all the index files " + "\nassociated with the database.\n\n" + ; + return 1; + } + + for (int i=1; i<ac; ++i) { + char* filename = av[i]; + + xbXBase x; + xbDbf MyFile( &x ); + + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << "\n"; + return 1; + } + + xbShort rc = MyFile.PackDatabase( XB_LOCK ); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError packing database ==> " << filename; + std::cout << " Return Code = " << rc; + } + MyFile.CloseDatabase(); /* close database */ + + std::cout << "\nPack Database complete...\n\n"; + } + + return 0; +} diff --git a/bin/reindex.cpp b/bin/reindex.cpp new file mode 100755 index 0000000..94f56d4 --- /dev/null +++ b/bin/reindex.cpp @@ -0,0 +1,90 @@ +/* + Xbase64 project source code + + This sample program packs an Xbase DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +static void +showStatus(xbLong itemNum, xbLong numItems) +{ + printf("indexing record %ld of %ld\r", itemNum, numItems); + fflush(stdout); +} + +int main(int ac,char** av) +{ + if (3 != ac) { + std::cout << + "\nUsage: reindex dbf_file ndx_file\n" + ; + return 1; + } + + char* filename = av[1]; + char* filename2 = av[2]; + + xbXBase x; + xbDbf MyFile( &x ); + xbNdx MyIndex( &MyFile ); + + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << "\n"; + return 0; + } + if( MyIndex.OpenIndex( filename2 )) { + std::cout << "Could not open index file " << filename2 << "\n"; + return 0; + } + + xbShort rc = MyIndex.ReIndex(showStatus); + printf("\n"); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError reindexing index ==> " << filename2; + std::cout << " Return Code = " << rc; + } + + /* or + if(( rc = MyFile.RebuildAllIndicis()) != XB_NO_ERROR ) + { + std::cout << "\nError reindexing..."; + std::cout << "\nReturn Code = " << rc; + } + */ + MyFile.CloseDatabase(); /* close database */ + + return 0; +} diff --git a/bin/undelall.cpp b/bin/undelall.cpp new file mode 100755 index 0000000..e63a8c1 --- /dev/null +++ b/bin/undelall.cpp @@ -0,0 +1,76 @@ +/* + Xbase64 project source code + + This sample program zaps an Xbase DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (ac <= 1) { + std::cout << + "\nUsage: undelall filename...\n" + "\nThis program does not automatically reindex any NDX indexes." + "\nUse the reindex program to reindex any indexes associated" + "\nwith the database, or build your own program which executes " + "\nthe PackDatabase() method after opening all the index files " + "\nassociated with the database.\n\n" + ; + return 1; + } + + for (int i=1; i<ac; ++i) { + char* filename = av[i]; + + xbXBase x; + xbDbf MyFile( &x ); + + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << "\n"; + return 0; + } + + xbShort rc = MyFile.UndeleteAllRecords(); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError undeleting records - database ==> " << filename; + std::cout << " Return Code = " << rc; + } + MyFile.CloseDatabase(); /* close database */ + + std::cout << "\nUndelete all records complete...\n\n"; + } + return 0; +} diff --git a/bin/zap.cpp b/bin/zap.cpp new file mode 100755 index 0000000..7261a1a --- /dev/null +++ b/bin/zap.cpp @@ -0,0 +1,76 @@ +/* + Xbase64 project source code + + This sample program zaps an Xbase DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (ac <= 1) { + std::cout << + "\nUsage: zap filename...\n" + "\nThis program does not automatically reindex any indices." + "\nUse the reindex program to reindex any indexes associated" + "\nwith the database, or build your own program which executes " + "\nthe PackDatabase() method after opening all the index files " + "\nassociated with the database.\n\n" + ; + return 1; + } + + for (int i=1; i<ac; ++i) { + char* filename = av[i]; + + xbXBase x; + xbDbf MyFile( &x ); + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << std::endl; + return 0; + } + + xbShort rc = MyFile.Zap( XB_LOCK ); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError zapping database ==> " << filename; + std::cout << " Return Code = " << rc << std::endl; + } + MyFile.CloseDatabase(); /* close database */ + + std::cout << "\nZap Database complete..." << std::endl; + } + + return 0; +} diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..dff9e48 --- /dev/null +++ b/config.guess @@ -0,0 +1,1317 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-04' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# 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. + +# Written by Per Bothner <bothner@cygnus.com>. +# Please send patches to <config-patches@gnu.org>. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <<EOF >$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + sparc*:NetBSD:*) + echo `uname -p`-unknown-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; + esac + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + cat >$dummy.c <<EOF +#include <features.h> +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-pc-linux-gnu\n", argv[1]); +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-pc-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +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` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..393f13d --- /dev/null +++ b/config.sub @@ -0,0 +1,1411 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-07' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# 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. + +# Please send patches to <config-patches@gnu.org>. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | s390 | s390x \ + | sh | sh[34] | sh[34]eb | shbe | shle \ + | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ + | stormy16 | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 \ + | we32k \ + | x86 | xscale \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alphapca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cray2-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | s390-* | s390x-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ + | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..fabec7e --- /dev/null +++ b/configure @@ -0,0 +1,10750 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.53 for xbase64 3.1.2. +# +# Report bugs to <xbase64-devel@lists.sourceforge.net>. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF + +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$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" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.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 + 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 + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export 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 +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='xbase64' +PACKAGE_TARNAME='xbase64' +PACKAGE_VERSION='3.1.2' +PACKAGE_STRING='xbase64 3.1.2' +PACKAGE_BUGREPORT='xbase64-devel@lists.sourceforge.net' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_unique_file="examples/exfilter.cpp" + +# 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 +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 +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS + +# +# 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 xbase64 3.1.2 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 + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of xbase64 3.1.2:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes + --enable-fast-install=PKGS optimize for fast installation default=yes + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-largefile omit support for large files + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-pic try to use only PIC/non-PIC objects default=use both + --without-index-ndx turn off .ndx index support + --without-index-ntx turn off .ntx index support + --without-memo-fields turn off memo fields support + --without-expressions turn off expressions support + --without-xbase-locking turn off XBase file locking + --without-realdelete turn off XBase record deletion + --without-xbase-filters turn off XBase filter logic + --without-xbase-debug turn off XBase specific debug + --without-largefile-support turn off Xbase 64 bit largefile support + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + +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 <xbase64-devel@lists.sourceforge.net>. +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +xbase64 configure 3.1.2 +generated by GNU Autoconf 2.53 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xbase64 $as_me 3.1.2, which was +generated by GNU Autoconf 2.53. 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. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n ) continue ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# 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 + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + +# set variable XSUBVARS with a list of sub directories to process +XSUBDIRS="xbase64 examples bin html libtest" + + +# look for AIX and MINIX environments +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 + set dummy "$as_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + 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" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&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 </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; + a.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 --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&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'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&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 +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 `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) 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" >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +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 ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +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. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <assert.h> + 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=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat 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. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <assert.h> + 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=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat 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" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&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 AIX" >&5 +echo $ECHO_N "checking for AIX... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#ifdef _AIX + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +cat >>confdefs.h <<\_ACEOF +#define _ALL_SOURCE 1 +_ACEOF + +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest* + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ctype.h> +#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 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "${ac_cv_header_minix_config_h+set}" = set; then + echo "$as_me:$LINENO: checking for minix/config.h" >&5 +echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6 +if test "${ac_cv_header_minix_config_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking minix/config.h usability" >&5 +echo $ECHO_N "checking minix/config.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <minix/config.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking minix/config.h presence" >&5 +echo $ECHO_N "checking minix/config.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <minix/config.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for minix/config.h" >&5 +echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6 +if test "${ac_cv_header_minix_config_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_minix_config_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 +echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6 + +fi +if test $ac_cv_header_minix_config_h = yes; then + MINIX=yes +else + MINIX= +fi + + +if test "$MINIX" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_SOURCE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_1_SOURCE 2 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _MINIX 1 +_ACEOF + +fi + + +# build the following programs + + +# init automake +am__api_version="1.6" +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="${MAKE}"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null + + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + # test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# Define the identity of the package. + PACKAGE=xbase64 + VERSION=3.1.2 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + + +# create this header file +# Add the stamp file to the list of files AC keeps track of, +# along with our hook. +ac_config_headers="$ac_config_headers xbase64/xbconfig.h:xbase64/xbconfig.in" + + + + +#create a library +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi; +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi; +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi; +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi + +NM="$lt_cv_path_NM" +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +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 + +echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5 +echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | s390* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv5uw[78]* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac + +fi +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + + + + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + 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 + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + 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); } && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "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=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +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 + + + + + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="/usr/bin:$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +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 + +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 + + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 4360 "configure"' > conftest.$ac_ext + 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 + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + 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 + + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +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>&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 + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +lt_cv_cc_needs_belf=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext 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 + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + + +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 + + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi + +fi + +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 + + # Check to make sure the pic_flag actually works. + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + lt_cv_prog_cc_pic_works=no + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +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>&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 + lt_cv_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:4896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +fi + +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # <tim.van.holder@pandora.be>, C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <<EOF 1>&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +f = shl_load; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +f = dlopen; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +#line 6689 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +#line 6787 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + 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 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi + + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# 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. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include <windows.h> +# #undef WIN32_LEAN_AND_MEAN +# #include <stdio.h> +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include <cygwin/cygwin_dll.h> +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include <stdio.h> /* for printf() */ +# #include <unistd.h> /* for open(), lseek(), read() */ +# #include <fcntl.h> /* for O_RDONLY, O_BINARY */ +# #include <string.h> /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i<nexp; i++) +# { +# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); +# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); +# } +# +# return 0; +# } +# /* impgen.c ends here */ + +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + +# C++ Code +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$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 +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# 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 </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cxx_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +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 + +depcc="$CXX" 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_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +# look for doxygen software +# Extract the first word of "doxygen", so it can be a program name with args. +set dummy doxygen; 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_doxygen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$doxygen"; then + ac_cv_prog_doxygen="$doxygen" # 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_doxygen="yes" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_doxygen" && ac_cv_prog_doxygen="no" +fi +fi +doxygen=$ac_cv_prog_doxygen +if test -n "$doxygen"; then + echo "$as_me:$LINENO: result: $doxygen" >&5 +echo "${ECHO_T}$doxygen" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$doxygen" = "yes"; then + XSUBDIRS="$XSUBDIRS docs" +fi + +# get RedHat release +if test -f /etc/redhat-release ; then + RHREL=`cut -d " " -f 5 /etc/redhat-release` + RHREL="rh${RHREL}" +else + RHREL="X" +fi + + +# get G++ version +if test "$GXX" = "yes"; then + GXXVER=`${CXX} -v 2>&1 | grep version | cut -d " " -f 3 -` + GXXVER="gcc${GXXVER}" +else + GXXVER="" +fi + + +RELEASE="${RHREL}-${GXXVER}-2.1" + + +# setup topdir +topdir=`pwd` + + +# Checks for header files +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ctype.h> +#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 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core 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 + +if test "${ac_cv_header_io_h+set}" = set; then + echo "$as_me:$LINENO: checking for io.h" >&5 +echo $ECHO_N "checking for io.h... $ECHO_C" >&6 +if test "${ac_cv_header_io_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_io_h" >&5 +echo "${ECHO_T}$ac_cv_header_io_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking io.h usability" >&5 +echo $ECHO_N "checking io.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <io.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking io.h presence" >&5 +echo $ECHO_N "checking io.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <io.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: io.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: io.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: io.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: io.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: io.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: io.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: io.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: io.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: io.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: io.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for io.h" >&5 +echo $ECHO_N "checking for io.h... $ECHO_C" >&6 +if test "${ac_cv_header_io_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_io_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_io_h" >&5 +echo "${ECHO_T}$ac_cv_header_io_h" >&6 + +fi + + +if test "${ac_cv_header_sys_locking_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/locking.h" >&5 +echo $ECHO_N "checking for sys/locking.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_locking_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_locking_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_locking_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/locking.h usability" >&5 +echo $ECHO_N "checking sys/locking.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <sys/locking.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking sys/locking.h presence" >&5 +echo $ECHO_N "checking sys/locking.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sys/locking.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: sys/locking.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/locking.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/locking.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/locking.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: sys/locking.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/locking.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/locking.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/locking.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/locking.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/locking.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for sys/locking.h" >&5 +echo $ECHO_N "checking for sys/locking.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_locking_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_locking_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_locking_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_locking_h" >&6 + +fi + + +if test "${ac_cv_header_fcntl_h+set}" = set; then + echo "$as_me:$LINENO: checking for fcntl.h" >&5 +echo $ECHO_N "checking for fcntl.h... $ECHO_C" >&6 +if test "${ac_cv_header_fcntl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_fcntl_h" >&5 +echo "${ECHO_T}$ac_cv_header_fcntl_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking fcntl.h usability" >&5 +echo $ECHO_N "checking fcntl.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <fcntl.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking fcntl.h presence" >&5 +echo $ECHO_N "checking fcntl.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <fcntl.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: fcntl.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: fcntl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: fcntl.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: fcntl.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: fcntl.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: fcntl.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: fcntl.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: fcntl.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: fcntl.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: fcntl.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for fcntl.h" >&5 +echo $ECHO_N "checking for fcntl.h... $ECHO_C" >&6 +if test "${ac_cv_header_fcntl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_fcntl_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_fcntl_h" >&5 +echo "${ECHO_T}$ac_cv_header_fcntl_h" >&6 + +fi +if test $ac_cv_header_fcntl_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FCNTL_H 1 +_ACEOF + +fi + + +if test "${ac_cv_header_ctype_h+set}" = set; then + echo "$as_me:$LINENO: checking for ctype.h" >&5 +echo $ECHO_N "checking for ctype.h... $ECHO_C" >&6 +if test "${ac_cv_header_ctype_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_ctype_h" >&5 +echo "${ECHO_T}$ac_cv_header_ctype_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking ctype.h usability" >&5 +echo $ECHO_N "checking ctype.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <ctype.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking ctype.h presence" >&5 +echo $ECHO_N "checking ctype.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ctype.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: ctype.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: ctype.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: ctype.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ctype.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: ctype.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: ctype.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: ctype.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: ctype.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: ctype.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ctype.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for ctype.h" >&5 +echo $ECHO_N "checking for ctype.h... $ECHO_C" >&6 +if test "${ac_cv_header_ctype_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_ctype_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_ctype_h" >&5 +echo "${ECHO_T}$ac_cv_header_ctype_h" >&6 + +fi + + +if test "${ac_cv_header_unistd_h+set}" = set; then + echo "$as_me:$LINENO: checking for unistd.h" >&5 +echo $ECHO_N "checking for unistd.h... $ECHO_C" >&6 +if test "${ac_cv_header_unistd_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_unistd_h" >&5 +echo "${ECHO_T}$ac_cv_header_unistd_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking unistd.h usability" >&5 +echo $ECHO_N "checking unistd.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#include <unistd.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking unistd.h presence" >&5 +echo $ECHO_N "checking unistd.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <unistd.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: unistd.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: unistd.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: unistd.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: unistd.h: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: unistd.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: unistd.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: unistd.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: unistd.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: unistd.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: unistd.h: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for unistd.h" >&5 +echo $ECHO_N "checking for unistd.h... $ECHO_C" >&6 +if test "${ac_cv_header_unistd_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_unistd_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_unistd_h" >&5 +echo "${ECHO_T}$ac_cv_header_unistd_h" >&6 + +fi + + + +# Checks for library functions. + +for ac_func in vsnprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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 +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in vsprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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 +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in strcasecmp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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 +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# Checks for 64 bit file support +# Check whether --enable-largefile or --disable-largefile was given. +if test "${enable_largefile+set}" = set; then + enableval="$enable_largefile" + +fi; +if test "$enable_largefile" != no; then + + echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 +echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_largefile_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext + CC="$CC -n32" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_largefile_CC=' -n32'; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_file_offset_bits+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_file_offset_bits=no + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#define _FILE_OFFSET_BITS 64 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_file_offset_bits=64; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 +echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 +if test "$ac_cv_sys_file_offset_bits" != no; then + +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF + +fi +rm -f conftest* + echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 +echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_large_files+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_large_files=no + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#define _LARGE_FILES 1 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_large_files=1; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 +echo "${ECHO_T}$ac_cv_sys_large_files" >&6 +if test "$ac_cv_sys_large_files" != no; then + +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF + +fi +rm -f conftest* +fi + + +for ac_func in ftello +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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 +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in fseeko +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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 +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +# compile support for ndx index logic + +# Check whether --with-index-ndx or --without-index-ndx was given. +if test "${with_index_ndx+set}" = set; then + withval="$with_index_ndx" + enable_index_ndx="$withval" +else + enable_index_ndx="yes" +fi; +if test "$enable_index_ndx" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define XB_INDEX_NDX 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define XB_EXPRESSIONS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define XB_INDEX_ANY 1 +_ACEOF + +fi + +# compile support for ntx index logic + +# Check whether --with-index-ntx or --without-index-ntx was given. +if test "${with_index_ntx+set}" = set; then + withval="$with_index_ntx" + enable_index_ntx="$withval" +else + enable_index_ntx="yes" +fi; +if test "$enable_index_ntx" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define XB_INDEX_NTX 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define XB_EXPRESSIONS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define XB_INDEX_ANY 1 +_ACEOF + +fi + +# compile support for memo fields + +# Check whether --with-memo-fields or --without-memo-fields was given. +if test "${with_memo_fields+set}" = set; then + withval="$with_memo_fields" + enable_memo_fields="$withval" +else + enable_memo_fields="yes" +fi; +if test "$enable_memo_fields" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define XB_MEMO_FIELDS 1 +_ACEOF + +fi + +# compile support for expressions +# index logic requires this be enabled + +# Check whether --with-expressions or --without-expressions was given. +if test "${with_expressions+set}" = set; then + withval="$with_expressions" + enable_expressions="$withval" +else + enable_expressions="yes" +fi; +if test "$enable_expressions" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define XB_EXPRESSIONS 1 +_ACEOF + +fi + +# compile support for record locking + +# Check whether --with-xbase-locking or --without-xbase-locking was given. +if test "${with_xbase_locking+set}" = set; then + withval="$with_xbase_locking" + enable_xbase_locking="$withval" +else + enable_xbase_locking="yes" +fi; +if test "$enable_xbase_locking" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define XB_LOCKING_ON 1 +_ACEOF + +fi + +# compile support for true record deletion + +# Check whether --with-realdelete or --without-realdelete was given. +if test "${with_realdelete+set}" = set; then + withval="$with_realdelete" + enable_realdelete="$withval" +else + enable_realdelete="yes" +fi; +if test "$enable_realdelete" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define XB_REAL_DELETE 1 +_ACEOF + +fi + +# compile support for filters + +# Check whether --with-xbase-filters or --without-xbase-filters was given. +if test "${with_xbase_filters+set}" = set; then + withval="$with_xbase_filters" + enable_xbase_filters="$withval" +else + enable_xbase_filters="yes" +fi; +if test "$enable_xbase_filters" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define XB_FILTERS 1 +_ACEOF + +fi + +# compile in debug logic + +# Check whether --with-xbase-debug or --without-xbase-debug was given. +if test "${with_xbase_debug+set}" = set; then + withval="$with_xbase_debug" + enable_xbase_debug="$withval" +else + enable_xbase_debug="yes" +fi; +if test "$enable_xbase_debug" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define XBASE_DEBUG 1 +_ACEOF + +fi + +# compile in largefile support + +# Check whether --with-xbase-largefile or --without-xbase-largefile was given. +if test "${with_xbase_largefile+set}" = set; then + withval="$with_xbase_largefile" + enable_largefile_support="$withval" +else + enable_largefile_support="yes" +fi; +if test "$enable_largefile_support" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define XB_LARGEFILE_SUPPORT 1 +_ACEOF + +fi + +# path separator + + + +# default memo file block size + + + +# build the following Makefiles +ac_config_files="$ac_config_files Makefile xbase64/Makefile examples/Makefile bin/Makefile html/Makefile libtest/Makefile xbase64-config xbase64.spec docs/doxygen.cfg docs/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 overriden 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 cmp -s $cache_file confcache; 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 + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +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=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$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" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.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 + 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 + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export 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 xbase64 $as_me 3.1.2, which was +generated by GNU Autoconf 2.53. 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 + -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 <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +xbase64 config.status 3.1.2 +configured by $0, generated by GNU Autoconf 2.53, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + --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 ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # 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 + +_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" ;; + "xbase64/Makefile" ) CONFIG_FILES="$CONFIG_FILES xbase64/Makefile" ;; + "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "bin/Makefile" ) CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;; + "html/Makefile" ) CONFIG_FILES="$CONFIG_FILES html/Makefile" ;; + "libtest/Makefile" ) CONFIG_FILES="$CONFIG_FILES libtest/Makefile" ;; + "xbase64-config" ) CONFIG_FILES="$CONFIG_FILES xbase64-config" ;; + "xbase64.spec" ) CONFIG_FILES="$CONFIG_FILES xbase64.spec" ;; + "docs/doxygen.cfg" ) CONFIG_FILES="$CONFIG_FILES docs/doxygen.cfg" ;; + "docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "xbase64/xbconfig.h" ) CONFIG_HEADERS="$CONFIG_HEADERS xbase64/xbconfig.h:xbase64/xbconfig.in" ;; + *) { { 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 + +# 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. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&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,@XSUBDIRS@,$XSUBDIRS,;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,@CPP@,$CPP,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@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,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@doxygen@,$doxygen,;t t +s,@RHREL@,$RHREL,;t t +s,@GXXVER@,$GXXVER,;t t +s,@RELEASE@,$RELEASE,;t t +s,@topdir@,$topdir,;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'` + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*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 <<CEOF' >>$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 # egrep' >>$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 <<CEOF' >>$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 cmp -s $ac_file $tmp/config.h 2>/dev/null; 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'` + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi + # Run the commands associated with the file. + case $ac_file in + xbase64/xbconfig.h ) # update the timestamp +echo 'timestamp for xbase64/xbconfig.h:xbase64/xbconfig.in' >"xbase64/stamp-h1" + ;; + esac +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { case $dirpart/$fdir in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy=$dirpart/$fdir +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + # 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=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || 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 + + diff --git a/configure.in b/configure.in new file mode 100755 index 0000000..3110c70 --- /dev/null +++ b/configure.in @@ -0,0 +1,207 @@ +# $Id: configure.in,v 1.20 2003/08/22 14:27:20 gkunkel Exp $ +# Created by Denis Pershin <dyp@inetlab.com> +# +# 8/10/03 Recreated by Gary Kunkel <gkunkel@zhsac.com> +# for Redhat 8.0, autoheader 2.53, autoconf 2.53, automake 1.63 +# simplified, removed unused and obsolete macros, etc +# +# All configuration parms moved to this file - if you make updates +# please add meaningful comments + + +AC_INIT(xbase64,3.1.2,xdb-devel@lists.sourceforge.net) + +# set variable XSUBVARS with a list of sub directories to process +XSUBDIRS="xbase64 examples bin html libtest" +AC_SUBST(XSUBDIRS) + +# look for AIX and MINIX environments +AC_AIX +AC_MINIX + +# build the following programs +AC_CONFIG_SRCDIR( examples/exfilter.cpp, + examples/sample1.cpp, + examples/sample2.cpp, + examples/sample3.cpp, + examples/sample4.cpp, + examples/sample5.cpp, + bin/checkndx.cpp, + bin/copydbf.cpp, + bin/dbfxtrct.cpp, + bin/dbfutil1.cpp, + bin/deletall.cpp, + bin/dumpdbt.cpp, + bin/dumphdr.cpp, + bin/dumprecs.cpp, + bin/packdbf.cpp, + bin/reindex.cpp, + bin/undelall.cpp, + bin/zap.cpp, + libtest/indextst.cpp, + libtest/exptest.cpp, + libtest/locktest.cpp, + libtest/testdate.cpp, + libtest/testhtml.cpp + ) + +# init automake +AM_INIT_AUTOMAKE(xbase64, 3.1.2) + +# create this header file +AM_CONFIG_HEADER(xbase64/xbconfig.h:xbase64/xbconfig.in) + +#create a library +AM_PROG_LIBTOOL + +# C++ Code +AC_PROG_CXX + +# look for doxygen software +AC_CHECK_PROG(doxygen, doxygen, yes, no) +if test "$doxygen" = "yes"; then + XSUBDIRS="$XSUBDIRS docs" +fi + +# get RedHat release +if test -f /etc/redhat-release ; then + RHREL=`cut -d " " -f 5 /etc/redhat-release` + RHREL="rh${RHREL}" +else + RHREL="X" +fi +AC_SUBST(RHREL) + +# get G++ version +if test "$GXX" = "yes"; then + GXXVER=`${CXX} -v 2>&1 | grep version | cut -d " " -f 3 -` + GXXVER="gcc${GXXVER}" +else + GXXVER="" +fi +AC_SUBST(GXXVER) + +RELEASE="${RHREL}-${GXXVER}-2.1" +AC_SUBST(RELEASE) + +# setup topdir +topdir=`pwd` +AC_SUBST(topdir) + +# Checks for header files +AC_HEADER_STDC +AC_CHECK_HEADER(io.h) +AC_CHECK_HEADER(sys/locking.h) +AC_CHECK_HEADER(fcntl.h, + [AC_DEFINE(HAVE_FCNTL_H,1,[Define to 1 if you have the <fcntl.h> header file.])]) +AC_CHECK_HEADER(ctype.h) +AC_CHECK_HEADER(unistd.h) + +# Checks for library functions. +AC_CHECK_FUNCS(vsnprintf) +AC_CHECK_FUNCS(vsprintf) +AC_CHECK_FUNCS(strcasecmp) + +# Checks for 64 bit file support +AC_SYS_LARGEFILE +AC_CHECK_FUNCS(ftello) +AC_CHECK_FUNCS(fseeko) + + +# compile support for ndx index logic +AC_ARG_WITH(index-ndx, + [ --without-index-ndx turn off .ndx index support ], + enable_index_ndx="$withval", enable_index_ndx="yes") +if test "$enable_index_ndx" = "yes"; then + AC_DEFINE(XB_INDEX_NDX, 1, XB_INDEX_NDX) + AC_DEFINE(XB_EXPRESSIONS, 1, XB_EXPRESSIONS) + AC_DEFINE(XB_INDEX_ANY, 1, XB_INDEX_ANY) +fi + +# compile support for ntx index logic +AC_ARG_WITH(index-ntx, + [ --without-index-ntx turn off .ntx index support ], + enable_index_ntx="$withval", enable_index_ntx="yes") +if test "$enable_index_ntx" = "yes"; then + AC_DEFINE(XB_INDEX_NTX, 1, XB_INDEX_NTX) + AC_DEFINE(XB_EXPRESSIONS, 1, XB_EXPRESSIONS) + AC_DEFINE(XB_INDEX_ANY, 1, XB_INDEX_ANY) +fi + +# compile support for memo fields +AC_ARG_WITH(memo-fields, + [ --without-memo-fields turn off memo fields support ], + enable_memo_fields="$withval", enable_memo_fields="yes") +if test "$enable_memo_fields" = "yes"; then + AC_DEFINE(XB_MEMO_FIELDS, 1, XB_MEMO_FIELDS) +fi + +# compile support for expressions +# index logic requires this be enabled +AC_ARG_WITH(expressions, + [ --without-expressions turn off expressions support ], + enable_expressions="$withval", enable_expressions="yes") +if test "$enable_expressions" = "yes"; then + AC_DEFINE(XB_EXPRESSIONS, 1, XB_EXPRESSIONS) +fi + +# compile support for record locking +AC_ARG_WITH(xbase-locking, + [ --without-xbase-locking turn off XBase file locking ], + enable_xbase_locking="$withval", enable_xbase_locking="yes") +if test "$enable_xbase_locking" = "yes"; then + AC_DEFINE(XB_LOCKING_ON, 1, XB_LOCKING_ON) +fi + +# compile support for true record deletion +AC_ARG_WITH(realdelete, + [ --without-realdelete turn off XBase record deletion ], + enable_realdelete="$withval", enable_realdelete="yes") +if test "$enable_realdelete" = "yes"; then + AC_DEFINE(XB_REAL_DELETE, 1, XB_REAL_DELETE) +fi + +# compile support for filters +AC_ARG_WITH(xbase-filters, + [ --without-xbase-filters turn off XBase filter logic ], + enable_xbase_filters="$withval", enable_xbase_filters="yes") +if test "$enable_xbase_filters" = "yes"; then + AC_DEFINE(XB_FILTERS, 1, XB_FILTERS) +fi + +# compile in debug logic +AC_ARG_WITH(xbase-debug, + [ --without-xbase-debug turn off XBase specific debug ], + enable_xbase_debug="$withval", enable_xbase_debug="yes") +if test "$enable_xbase_debug" = "yes"; then + AC_DEFINE(XBASE_DEBUG, 1, XB_DEBUG) +fi + +# compile in largefile support +AC_ARG_WITH(xbase-largefile, + [ --without-largefile-support turn off Xbase 64 bit largefile support ], + enable_largefile_support="$withval", enable_largefile_support="yes") +if test "$enable_largefile_support" = "yes"; then + AC_DEFINE(XB_LARGEFILE_SUPPORT, 1, XB_LARGEFILE_SUPPORT) +fi + +# path separator +AH_VERBATIM([PATH_SEPARATOR],[#define PATH_SEPARATOR '/']) + +# default memo file block size +AH_VERBATIM([XB_DBT_BLOCK_SIZE],[#define XB_DBT_BLOCK_SIZE 512]) + +# build the following Makefiles +AC_OUTPUT( + Makefile + xbase64/Makefile + examples/Makefile + bin/Makefile + html/Makefile + libtest/Makefile + xbase64-config + xbase64.spec + docs/doxygen.cfg + docs/Makefile +) + @@ -0,0 +1,858 @@ +The XBase library itself is released under the GNU Lesser General Public +License, see the text of the GNU LGPL below. + +The executable programs in the bin, examples, and libtest directories +are release under the GNU General Public License, see the text of the +GNU GPL below. + +----------------------------------------------------------------------------- + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + + +----------------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +-----------------------------------------------------------------------------
\ No newline at end of file @@ -0,0 +1,423 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + 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 + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. We will use -o /dev/null later, + # however we can't do the remplacement now because + # `-o $object' might simply not be used + 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 + "$@" -o /dev/null $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 $? + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -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 proprocessed 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 proprocessed 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 diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100755 index 0000000..c2f12fd --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,14 @@ +all : docs + +docs : + doxygen doxygen.cfg + +clean : + -rm -r html + -rm -r latex + -rm -r man + +EXTRA_DIST = \ + Makefile.am \ + Makefile.in \ + doxygen.cfg.in diff --git a/docs/Makefile.in b/docs/Makefile.in new file mode 100755 index 0000000..236d04b --- /dev/null +++ b/docs/Makefile.in @@ -0,0 +1,240 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +GXXVER = @GXXVER@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RELEASE = @RELEASE@ +RHREL = @RHREL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XSUBDIRS = @XSUBDIRS@ +am__include = @am__include@ +am__quote = @am__quote@ +doxygen = @doxygen@ +install_sh = @install_sh@ +topdir = @topdir@ + +EXTRA_DIST = \ + Makefile.am \ + Makefile.in \ + doxygen.cfg.in + +subdir = docs +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h +CONFIG_CLEAN_FILES = doxygen.cfg +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in doxygen.cfg.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu docs/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +doxygen.cfg: $(top_builddir)/config.status doxygen.cfg.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile + +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_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-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 + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool uninstall uninstall-am uninstall-info-am + +all : docs + +docs : + doxygen doxygen.cfg + +clean : + -rm -r html + -rm -r latex + -rm -r man +# 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: diff --git a/docs/doxygen.cfg.in b/docs/doxygen.cfg.in new file mode 100755 index 0000000..ec22ae9 --- /dev/null +++ b/docs/doxygen.cfg.in @@ -0,0 +1,732 @@ +# Doxyfile 1.2.3 + +# This file describes the settings to be used by doxygen for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "Xbase64 Class Library" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = @VERSION@ + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, +# Korean, Hungarian, Spanish, Romanian, Russian, Croatian, Polish, +# Portuguese and Slovene. + +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a class diagram (in Html and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. + +CLASS_DIAGRAMS = YES + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explict @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# The ENABLE_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = ../xbase64 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +FILE_PATTERNS = *.cpp *.h + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse. + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using a WORD or other. +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. Warning: This feature +# is still experimental and very incomplete. + +GENERATE_XML = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented file showing +# the direct and indirect include dependencies of the file with other +# documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented header file showing +# the documented files that directly or indirectly include this file + +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. + +CGI_NAME = search.cgi + +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. + +CGI_URL = + +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. + +DOC_URL = + +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. + +DOC_ABSPATH = + +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. + +BIN_ABSPATH = /usr/local/bin/ + +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. + +EXT_DOC_PATHS = diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100755 index 0000000..248b1ec --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,23 @@ + +INCLUDES= -I$(topdir) $(all_includes) +LDADD = -L$(topdir)/xbase64 -lxbase64 + +# for shadow passwords override the value +INSTALL_PROGRAM = @INSTALL@ + +noinst_PROGRAMS = sample1 sample2 sample3 sample4 sample5 \ + exfilter xbstring + +exfilter_SOURCES = exfilter.cpp +sample1_SOURCES = sample1.cpp +sample2_SOURCES = sample2.cpp +sample3_SOURCES = sample3.cpp +sample4_SOURCES = sample4.cpp +sample5_SOURCES = sample5.cpp +xbstring_SOURCES = xbstring.cpp + +noinst_HEADERS = + +EXTRA_DIST = makebcc.bat + +CLEANFILES = Makefile.in *.obj *.exe *.dbf *.dbt *.ndx *.ntx compout *.tds *.bak diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100755 index 0000000..36e9f79 --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,417 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ + +# for shadow passwords override the value +INSTALL_PROGRAM = @INSTALL@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +GXXVER = @GXXVER@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RELEASE = @RELEASE@ +RHREL = @RHREL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XSUBDIRS = @XSUBDIRS@ +am__include = @am__include@ +am__quote = @am__quote@ +doxygen = @doxygen@ +install_sh = @install_sh@ +topdir = @topdir@ + +INCLUDES = -I$(topdir) $(all_includes) +LDADD = -L$(topdir)/xbase64 -lxbase64 + +noinst_PROGRAMS = sample1 sample2 sample3 sample4 sample5 \ + exfilter xbstring + + +exfilter_SOURCES = exfilter.cpp +sample1_SOURCES = sample1.cpp +sample2_SOURCES = sample2.cpp +sample3_SOURCES = sample3.cpp +sample4_SOURCES = sample4.cpp +sample5_SOURCES = sample5.cpp +xbstring_SOURCES = xbstring.cpp + +noinst_HEADERS = + +EXTRA_DIST = makebcc.bat + +CLEANFILES = Makefile.in *.obj *.exe *.dbf *.dbt *.ndx *.ntx compout *.tds *.bak +subdir = examples +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h +CONFIG_CLEAN_FILES = +noinst_PROGRAMS = sample1$(EXEEXT) sample2$(EXEEXT) sample3$(EXEEXT) \ + sample4$(EXEEXT) sample5$(EXEEXT) exfilter$(EXEEXT) \ + xbstring$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) + +am_exfilter_OBJECTS = exfilter.$(OBJEXT) +exfilter_OBJECTS = $(am_exfilter_OBJECTS) +exfilter_LDADD = $(LDADD) +exfilter_DEPENDENCIES = +exfilter_LDFLAGS = +am_sample1_OBJECTS = sample1.$(OBJEXT) +sample1_OBJECTS = $(am_sample1_OBJECTS) +sample1_LDADD = $(LDADD) +sample1_DEPENDENCIES = +sample1_LDFLAGS = +am_sample2_OBJECTS = sample2.$(OBJEXT) +sample2_OBJECTS = $(am_sample2_OBJECTS) +sample2_LDADD = $(LDADD) +sample2_DEPENDENCIES = +sample2_LDFLAGS = +am_sample3_OBJECTS = sample3.$(OBJEXT) +sample3_OBJECTS = $(am_sample3_OBJECTS) +sample3_LDADD = $(LDADD) +sample3_DEPENDENCIES = +sample3_LDFLAGS = +am_sample4_OBJECTS = sample4.$(OBJEXT) +sample4_OBJECTS = $(am_sample4_OBJECTS) +sample4_LDADD = $(LDADD) +sample4_DEPENDENCIES = +sample4_LDFLAGS = +am_sample5_OBJECTS = sample5.$(OBJEXT) +sample5_OBJECTS = $(am_sample5_OBJECTS) +sample5_LDADD = $(LDADD) +sample5_DEPENDENCIES = +sample5_LDFLAGS = +am_xbstring_OBJECTS = xbstring.$(OBJEXT) +xbstring_OBJECTS = $(am_xbstring_OBJECTS) +xbstring_LDADD = $(LDADD) +xbstring_DEPENDENCIES = +xbstring_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/xbase64 +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/exfilter.Po ./$(DEPDIR)/sample1.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/sample2.Po ./$(DEPDIR)/sample3.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/sample4.Po ./$(DEPDIR)/sample5.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/xbstring.Po +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(exfilter_SOURCES) $(sample1_SOURCES) $(sample2_SOURCES) \ + $(sample3_SOURCES) $(sample4_SOURCES) $(sample5_SOURCES) \ + $(xbstring_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(exfilter_SOURCES) $(sample1_SOURCES) $(sample2_SOURCES) $(sample3_SOURCES) $(sample4_SOURCES) $(sample5_SOURCES) $(xbstring_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +exfilter$(EXEEXT): $(exfilter_OBJECTS) $(exfilter_DEPENDENCIES) + @rm -f exfilter$(EXEEXT) + $(CXXLINK) $(exfilter_LDFLAGS) $(exfilter_OBJECTS) $(exfilter_LDADD) $(LIBS) +sample1$(EXEEXT): $(sample1_OBJECTS) $(sample1_DEPENDENCIES) + @rm -f sample1$(EXEEXT) + $(CXXLINK) $(sample1_LDFLAGS) $(sample1_OBJECTS) $(sample1_LDADD) $(LIBS) +sample2$(EXEEXT): $(sample2_OBJECTS) $(sample2_DEPENDENCIES) + @rm -f sample2$(EXEEXT) + $(CXXLINK) $(sample2_LDFLAGS) $(sample2_OBJECTS) $(sample2_LDADD) $(LIBS) +sample3$(EXEEXT): $(sample3_OBJECTS) $(sample3_DEPENDENCIES) + @rm -f sample3$(EXEEXT) + $(CXXLINK) $(sample3_LDFLAGS) $(sample3_OBJECTS) $(sample3_LDADD) $(LIBS) +sample4$(EXEEXT): $(sample4_OBJECTS) $(sample4_DEPENDENCIES) + @rm -f sample4$(EXEEXT) + $(CXXLINK) $(sample4_LDFLAGS) $(sample4_OBJECTS) $(sample4_LDADD) $(LIBS) +sample5$(EXEEXT): $(sample5_OBJECTS) $(sample5_DEPENDENCIES) + @rm -f sample5$(EXEEXT) + $(CXXLINK) $(sample5_LDFLAGS) $(sample5_OBJECTS) $(sample5_LDADD) $(LIBS) +xbstring$(EXEEXT): $(xbstring_OBJECTS) $(xbstring_DEPENDENCIES) + @rm -f xbstring$(EXEEXT) + $(CXXLINK) $(xbstring_LDFLAGS) $(xbstring_OBJECTS) $(xbstring_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exfilter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample4.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbstring.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` + +.cpp.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CXXDEPMODE = @CXXDEPMODE@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) + +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_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-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 + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + 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: diff --git a/examples/exfilter.cpp b/examples/exfilter.cpp new file mode 100755 index 0000000..0dc6c0a --- /dev/null +++ b/examples/exfilter.cpp @@ -0,0 +1,77 @@ +/* exfilter.cpp + + Xbase project source code + + This program demonstrates the usage of the xbFilter class + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-dev@lists.sourceforge.net + + +*/ + + +#include <xbase64/xbase64.h> + +int main() +{ +#if defined(XB_FILTERS) + xbShort rc; + xbXBase x; + xbDbf d( &x ); + xbNdx i( &d ); + + std::cout << "exfilter program executing" << std::endl; + + if(( rc = d.OpenDatabase( "MYFILE.DBF" )) != XB_NO_ERROR ){ + std::cout << "Error opening database" << std::endl; + return 1; + } + + if(( rc = i.OpenIndex( "MYINDEX1.NDX" )) != XB_NO_ERROR ){ + std::cout << "Error opening index" << std::endl; + return 2; + } + + xbFilter f1( &d, 0, "FLOAT1>1" ); + /* use filter 1 w/o index */ + rc = f1.GetFirstFilterRec(); + while( rc == XB_NO_ERROR ){ + std::cout << "Filter 1 Found Record " << d.GetCurRecNo() << std::endl; + rc = f1.GetNextFilterRec(); + } + xbFilter f2( &d, &i, "FLOAT1>1" ); + /* use filter 2 w/ index */ + rc = f2.GetLastFilterRec(); + + while( rc == XB_NO_ERROR ){ + std::cout << "Filter 2 Found Record " << d.GetCurRecNo() << std::endl; + rc = f2.GetPrevFilterRec(); + } + d.CloseDatabase(); +#else + std::cout << "XB_FILTERS not compiled into library" << std::endl; +#endif + + return 0; +} + diff --git a/examples/makebcc.bat b/examples/makebcc.bat new file mode 100755 index 0000000..2facb73 --- /dev/null +++ b/examples/makebcc.bat @@ -0,0 +1,17 @@ +
+rem This batch file builds the xbase sample programs
+rem using the borland 5.5 compiler
+
+del *.bak
+del *.tds
+del *.exe
+del *.obj
+
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample1.cpp xbase64.lib > compout
+bcc32 -v -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample2.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample3.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample4.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample5.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib exfilter.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib xbstring.cpp xbase64.lib >> compout
+
diff --git a/examples/sample1.cpp b/examples/sample1.cpp new file mode 100755 index 0000000..8d89d96 --- /dev/null +++ b/examples/sample1.cpp @@ -0,0 +1,120 @@ +/* sample1.cpp + + Xbase project source code + + This program creates a sample database and four indexes + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main() +{ + + xbSchema MyRecord[] = + { + { "FIRSTNAME", XB_CHAR_FLD, 15, 0 }, + { "LASTNAME", XB_CHAR_FLD, 20, 0 }, + { "BIRTHDATE", XB_DATE_FLD, 8, 0 }, + { "STARTDATE", XB_DATE_FLD, 8, 0 }, + { "AMOUNT", XB_NUMERIC_FLD, 9, 2 }, + { "SWITCH", XB_LOGICAL_FLD, 1, 0 }, + { "FLOAT1", XB_FLOAT_FLD, 9, 2 }, + { "FLOAT2", XB_FLOAT_FLD, 9, 1 }, + { "FLOAT3", XB_FLOAT_FLD, 9, 2 }, + { "FLOAT4", XB_FLOAT_FLD, 9, 3 }, + { "ZIPCODE", XB_NUMERIC_FLD, 5, 0 }, +#ifdef XB_MEMO_FIELDS + { "MEMO1", XB_MEMO_FLD, 10, 0 }, +#endif + { "",0,0,0 } + }; + + /* define the classes */ + xbXBase x; /* initialize xbase */ + xbDbf MyFile( &x ); /* class for table */ + +// Create Dbase style indices +#ifdef XB_INDEX_NDX + xbNdx MyIndex1( &MyFile ); /* class for index 1 */ + xbNdx MyIndex2( &MyFile ); /* class for index 2 */ + xbNdx MyIndex3( &MyFile ); /* class for index 3 */ +#endif + +// Create Clipper style indices +#ifdef XB_INDEX_NTX + xbNtx MyIndex4( &MyFile ); /* class for index 4 */ + xbNtx MyIndex5( &MyFile ); /* class for index 5 */ +#endif + + xbShort rc; + MyFile.SetVersion( 4 ); /* create dbase IV style files */ + + if(( rc = MyFile.CreateDatabase( "MYFILE.DBF", MyRecord, XB_OVERLAY )) + != XB_NO_ERROR ) + x.DisplayError( rc ); + else + { + +#ifdef XB_INDEX_NDX + /* define a simple index */ + if(( rc = MyIndex1.CreateIndex( + "MYINDEX1.NDX", "LASTNAME", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + x.DisplayError( rc ); + /* define a multi-field index "LASTNAME FIRSTNAME" */ + if(( rc = MyIndex2.CreateIndex( + "MYINDEX2.NDX", "LASTNAME+FIRSTNAME", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + x.DisplayError( rc ); + /* define a numeric index "ZIPCODE" */ + if(( rc = MyIndex3.CreateIndex( + "MYINDEX3.NDX", "ZIPCODE", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + x.DisplayError( rc ); + + +#endif +#ifdef XB_INDEX_NTX + /* define a multi-field index "LASTNAMEFIRSTNAME" */ + if(( rc = MyIndex4.CreateIndex( + "MYINDEX4.NTX", "LASTNAME-FIRSTNAME", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + x.DisplayError( rc ); + /* define a numeric index "ZIPCODE" */ + if(( rc = MyIndex5.CreateIndex( + "MYINDEX5.NTX", "ZIPCODE", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + x.DisplayError( rc ); +#endif + } + + MyFile.CloseDatabase(); /* Close database and associated indexes */ + return 0; +} diff --git a/examples/sample2.cpp b/examples/sample2.cpp new file mode 100755 index 0000000..c755b39 --- /dev/null +++ b/examples/sample2.cpp @@ -0,0 +1,226 @@ +/* sample2.cpp + + Xbase64 project source code + + This sample program updates the database created by the sample1 + program + + This program demonstrates the use of the following functions/methods + OpenDatabase, GetFieldNo, BlankRecord, AppendRecord, + PutField and CloseDatabase + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + + +#include <xbase64/xbase64.h> +#include <xbase64/xbdbf.cpp> +#include <xbase64/xbexp.cpp> +#include <xbase64/xbexpprc.cpp> +#include <xbase64/xbexpfnc.cpp> +#include <xbase64/xbfields.cpp> +#include <xbase64/xbindex.cpp> +#include <xbase64/xbmemo.cpp> +#include <xbase64/xbndx.cpp> +#include <xbase64/xbntx.cpp> +#include <xbase64/xbase64.cpp> +#include <xbase64/xbdate.cpp> +#include <xbase64/xbfilter.cpp> +#include <xbase64/xblock.cpp> +#include <xbase64/xbstring.cpp> +#include <xbase64/xbfile.cpp> + + + +int main() +{ + xbShort lname, fname, birthdate, startdate; + xbShort amount, sw, f1, f2, f3, f4, m1, rc, z; + xbFloat f; + + xbXBase x; + xbDbf MyFile( &x ); + MyFile.AutoLockOff(); // turn off locking + + char bigBuf[4096]; + +#undef XB_INDEX_NTX + +#ifdef XB_INDEX_NDX + xbNdx MyIndex1( &MyFile ); + xbNdx MyIndex2( &MyFile ); + xbNdx MyIndex3( &MyFile ); +#endif + +#ifdef XB_INDEX_NTX + xbNtx MyIndex4( &MyFile ); + xbNtx MyIndex5( &MyFile ); +#endif + + xbDate d; + + if(( rc = MyFile.OpenDatabase( "MYFILE.DBF" )) != XB_NO_ERROR ) + x.DisplayError( rc ); + +#ifdef XB_INDEX_NDX + if(( rc = MyIndex1.OpenIndex( "MYINDEX1.NDX" )) != XB_NO_ERROR ) + x.DisplayError( rc ); + if(( rc = MyIndex2.OpenIndex( "MYINDEX2.NDX" )) != XB_NO_ERROR ) + x.DisplayError( rc ); + if(( rc = MyIndex3.OpenIndex( "MYINDEX3.NDX" )) != XB_NO_ERROR ) + x.DisplayError( rc ); +#endif + +#ifdef XB_INDEX_NTX + if(( rc = MyIndex4.OpenIndex( "MYINDEX4.NTX" )) != XB_NO_ERROR ) + x.DisplayError( rc ); + if(( rc = MyIndex5.OpenIndex( "MYINDEX5.NTX" )) != XB_NO_ERROR ) + x.DisplayError( rc ); +#endif + + fname = MyFile.GetFieldNo( "FIRSTNAME" ); + lname = MyFile.GetFieldNo( "LASTNAME" ); + birthdate = MyFile.GetFieldNo( "BIRTHDATE" ); + startdate = MyFile.GetFieldNo( "STARTDATE" ); + amount = MyFile.GetFieldNo( "AMOUNT" ); + sw = MyFile.GetFieldNo( "SWITCH" ); + f1 = MyFile.GetFieldNo( "FLOAT1" ); + f2 = MyFile.GetFieldNo( "FLOAT2" ); + f3 = MyFile.GetFieldNo( "FLOAT3" ); + f4 = MyFile.GetFieldNo( "FLOAT4" ); + m1 = MyFile.GetFieldNo( "MEMO1" ); + z = MyFile.GetFieldNo( "ZIPCODE" ); + + std::cout << "First Name Id = " << fname << std::endl; + std::cout << "Last Name Id = " << lname << std::endl; + std::cout << "Birthdate Id = " << birthdate << std::endl; + std::cout << "Startdate Id = " << startdate << std::endl; + std::cout << "Amount Id = " << amount << std::endl; + std::cout << "Switch Id = " << sw << std::endl; + std::cout << "Float 1 Id = " << f1 << std::endl; + std::cout << "Float 2 Id = " << f2 << std::endl; + std::cout << "Float 3 Id = " << f3 << std::endl; + std::cout << "Float 4 Id = " << f4 << std::endl; + std::cout << "Zipcode Id = " << z << std::endl; +#ifdef XB_MEMO_FIELDS + std::cout << "Memo1 Id = " << m1 << std::endl << std::endl;; +#endif + + /* build record one */ + MyFile.BlankRecord(); /* blank out the record buffer */ + MyFile.PutField( lname, "Queue" ); /* a name */ + MyFile.PutField( fname, "Suzy" ); /* a name */ + MyFile.PutField( birthdate, d.Sysdate()); /* a date */ + MyFile.PutField( startdate, "20040506" ); + MyFile.PutField( amount, "99.99" ); /* an amount */ + MyFile.PutField( sw, "Y" ); /* a switch */ + f = 1.466f; + MyFile.PutFloatField( f1, f ); + MyFile.PutFloatField( "FLOAT2", f ); + MyFile.PutField( f3, "1" ); + MyFile.PutField( f4, "1" ); + MyFile.PutField( z, "76262" ); + + if(( rc = MyFile.AppendRecord()) != XB_NO_ERROR ) /* write it */ + x.DisplayError( rc ); + + /* build record two */ + MyFile.BlankRecord(); /* blank out the record buffer */ + MyFile.PutField( lname, "Bob" ); /* a name */ + MyFile.PutField( fname, "Billy" ); /* a name */ + MyFile.PutField( birthdate, "19970304" ); /* a date */ + MyFile.PutField( startdate, "19970310" ); /* a date */ + MyFile.PutField( amount, "88.88" ); /* an amount */ + MyFile.PutField( sw, "N" ); /* a switch */ + f = -2.1f; + MyFile.PutFloatField( f1, f ); + MyFile.PutFloatField( "FLOAT2", -2.1f ); + MyFile.PutField( f1, "-2.1" ); + MyFile.PutField( f2, "-2.1" ); + MyFile.PutField( f3, "-2.1" ); + MyFile.PutField( f4, "-2.1" ); + MyFile.PutField( z, "76261" ); +#ifdef XB_MEMO_FIELDS + memset( bigBuf, 0x00, 4096 ); + memset( bigBuf, 'a', 596 ); + bigBuf[0] = '['; + strcat( bigBuf, "EOD]" ); + MyFile.UpdateMemoData( m1, strlen( bigBuf ), bigBuf, XB_LOCK ); +#endif + if(( rc = MyFile.AppendRecord()) != XB_NO_ERROR ) /* write it */ + x.DisplayError( rc ); + /* build record three */ + MyFile.BlankRecord(); /* blank out the record buffer */ + MyFile.PutField( lname, "Slippery" ); /* a name */ + MyFile.PutField( fname, "Sam" ); /* a name */ + MyFile.PutField( birthdate, "19970406" ); /* a date */ + MyFile.PutField( startdate, "19990101" ); /* a date */ + MyFile.PutField( amount, "77.77" ); /* an amount */ + MyFile.PutField( sw, "T" ); /* a switch */ + f = 3.21f; + MyFile.PutFloatField( f1, f ); + MyFile.PutFloatField( "FLOAT2", 3.21f ); + MyFile.PutField( f1, "3.21" ); + MyFile.PutField( f2, "3.21" ); + MyFile.PutField( f3, "3.21" ); + MyFile.PutField( f4, "3.21" ); + MyFile.PutField( z, "76263" ); +#ifdef XB_MEMO_FIELDS + MyFile.UpdateMemoData( m1, 20, "Sample memo field 3", XB_LOCK ); +#endif + + if(( rc = MyFile.AppendRecord()) != XB_NO_ERROR ) /* write it */ + x.DisplayError( rc ); + + /* build record four */ + MyFile.BlankRecord(); /* blank out the record buffer */ + MyFile.PutField( lname, "Lucas" ); /* a name */ + MyFile.PutField( fname, "George" ); /* a name */ + MyFile.PutField( birthdate, "19470406" ); /* a date */ + MyFile.PutField( amount, "77.77" ); /* an amount */ + MyFile.PutField( sw, "T" ); /* a switch */ + f = 4.321f; + MyFile.PutFloatField( f1, f ); + MyFile.PutFloatField( "FLOAT2", 4.321f ); + MyFile.PutField( f1, "4.321" ); + MyFile.PutField( f2, "4.321" ); + MyFile.PutField( f3, "4.321" ); + MyFile.PutField( f4, "4.321" ); + MyFile.PutField( z, "76260" ); +#ifdef XB_MEMO_FIELDS + MyFile.UpdateMemoData( m1, 20, "Sample memo field 4", XB_LOCK ); +#endif + if(( rc = MyFile.AppendRecord()) != XB_NO_ERROR ) /* write it */ + x.DisplayError( rc ); + + MyFile.CloseDatabase(); /* close database */ + return 0; +} diff --git a/examples/sample3.cpp b/examples/sample3.cpp new file mode 100755 index 0000000..137ee54 --- /dev/null +++ b/examples/sample3.cpp @@ -0,0 +1,137 @@ +/* sample3.cpp + + Xbase64 project source code + + This sample program reads the database created and updated by the sample1 + and sample2 program + + This program demonstrates the use of the following functions/methods + OpenDatabase, GetFieldNo, GetRecord, GetLastRecord, GetFirstRecord, + GetNextRecord, GetPrevRecord, NoOfRecords and CloseDatabase, FieldCount + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main() +{ + char buf[40]; + xbShort rc,i; + xbShort lname, fname, birthdate, amount, sw, f1, memo; + char *p; + xbFloat f; + + xbXBase x; + xbDbf MyFile( &x ); + MyFile.OpenDatabase( "MYFILE.DBF" ); + MyFile.AutoLockOff(); + + lname = MyFile.GetFieldNo( "LASTNAME" ); + fname = MyFile.GetFieldNo( "FIRSTNAME" ); + birthdate = MyFile.GetFieldNo( "BIRTHDATE" ); + amount = MyFile.GetFieldNo( "AMOUNT" ); + sw = MyFile.GetFieldNo( "SWITCH" ); + f1 = MyFile.GetFieldNo( "FLOAT1" ); + memo = MyFile.GetFieldNo( "MEMO1" ); + + std::cout << "There are " << MyFile.FieldCount() + << " fields in the file" << std::endl; + std::cout << "There are " << MyFile.NoOfRecords() + << " records in the file." << std::endl; + std::cout << "LASTNAME is type: " << MyFile.GetFieldType( lname ) + << " length: " << MyFile.GetFieldLen( lname ) + << std::endl; + std::cout << "FIRSTNAME is type: " << MyFile.GetFieldType( fname ) + << " length: " << MyFile.GetFieldLen( fname ) + << std::endl; + std::cout << "BIRTHDATE is type: " << MyFile.GetFieldType( birthdate ) + << " length: " << MyFile.GetFieldLen( birthdate ) + << std::endl; + std::cout << "AMOUNT is type: " << MyFile.GetFieldType( amount ) + << " length: " << MyFile.GetFieldLen( amount ) + << std::endl; + std::cout << "SWITCH is type: " << MyFile.GetFieldType( sw ) + << " length: " << MyFile.GetFieldLen( sw ) + << std::endl; + std::cout << "MEMO1 is type: " << MyFile.GetFieldType( memo ) + << " length: " << MyFile.GetFieldLen( memo ) + << std::endl << std::endl; + + std::cout << "Sample GetRecord" << std::endl; + MyFile.GetRecord( 1L ); + MyFile.GetField( lname, buf ); + std::cout << "Name 1 = " << buf << std::endl; + std::cout << "Name 1 = " << MyFile.GetStringField( lname ) << std::endl; + + f = MyFile.GetFloatField( f1 ); + std::cout << "FLOAT1 = " << f << std::endl; + f = MyFile.GetFloatField( "FLOAT2" ); + std::cout << "FLOAT2 = " << f << std::endl; + + std::cout << "Sample GetRecordBuf" << std::endl; + p = MyFile.GetRecordBuf(); /* pointer to record buffer */ + for( i = 0; i < 49; i++ ) std::cout << *p++; /* display the buffer */ + + std::cout << std::endl << "Loop through forwards..." << std::endl; + rc = MyFile.GetFirstRecord(); + while( rc == XB_NO_ERROR ) { + MyFile.GetField( lname, buf ); + std::cout << MyFile.GetCurRecNo(); + std::cout << " Name = " << buf << std::endl; + rc = MyFile.GetNextRecord(); +#ifdef XB_MEMO_FIELDS + if( MyFile.MemoFieldExists( memo )) + std::cout << "Memo field MEMO1 len = " << MyFile.GetMemoFieldLen(memo) + << std::endl; +#endif + } + + std::cout << "Sample PutRecord" << std::endl; + MyFile.PutField( lname, "Stantonbob" ); + MyFile.PutField( lname, "Sally" ); + MyFile.PutRecord( MyFile.GetCurRecNo() ); + + std::cout << "Loop through backwards.." << std::endl; + rc = MyFile.GetLastRecord(); + while( rc == XB_NO_ERROR ){ + std::cout << "Last Name = " << MyFile.GetStringField( lname ) << std::endl; + std::cout << "Logical Field = " << MyFile.GetLogicalField( "SWITCH" ) + << std::endl; + rc = MyFile.GetPrevRecord(); + } + + std::cout << std::endl; + MyFile.CloseDatabase(); /* close database */ + return 0; +} diff --git a/examples/sample4.cpp b/examples/sample4.cpp new file mode 100755 index 0000000..16acada --- /dev/null +++ b/examples/sample4.cpp @@ -0,0 +1,135 @@ +/* sample4.cpp + + Xbase64 project source code + + This sample program reads the database created and updated by the sample1 + and sample2 program + + This program demonstrates the use of the following functions/methods + DeleteRecord, UndeleteRecord, RecordDeleted + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main() +{ + xbShort rc; + xbXBase x; + xbDbf MyFile( &x ); + MyFile.AutoLockOff(); + +#ifdef XB_INDEX_NDX + xbNdx MyIndex1( &MyFile ); + xbNdx MyIndex2( &MyFile ); + xbNdx MyIndex3( &MyFile ); +#endif +#ifdef XB_INDEX_NTX + xbNtx MyIndex4( &MyFile ); + xbNtx MyIndex5( &MyFile ); +#endif + + if(( rc = MyFile.OpenDatabase( "MYFILE.DBF" )) != XB_NO_ERROR ){ + std::cout << "Error opening file" << std::endl; + x.DisplayError( rc ); + exit(1); + } + +#ifdef XB_INDEX_NDX + if(( rc = MyIndex1.OpenIndex( "MYINDEX1.NDX" )) != XB_NO_ERROR ){ + std::cout << "\nError opening index1" << std::endl; + x.DisplayError( rc ); + exit(1); + } + + if(( rc = MyIndex2.OpenIndex( "MYINDEX2.NDX" )) != XB_NO_ERROR ){ + std::cout << "\nError opening index2" << std::endl; + x.DisplayError( rc ); + exit(1); + } + + if(( rc = MyIndex3.OpenIndex( "MYINDEX3.NDX" )) != XB_NO_ERROR ){ + std::cout << "\nError opening index3" << std::endl; + x.DisplayError( rc ); + exit(1); + } + +#endif +#ifdef XB_INDEX_NTX + if(( rc = MyIndex4.OpenIndex( "MYINDEX4.NTX" )) != XB_NO_ERROR ){ + std::cout << "\nError opening index4" << std::endl; + x.DisplayError( rc ); + exit(1); + } + if(( rc = MyIndex5.OpenIndex( "MYINDEX5.NTX" )) != XB_NO_ERROR ){ + std::cout << "\nError opening index5" << std::endl; + x.DisplayError( rc ); + exit(1); + } +#endif + + std::cout << "Sample GetRecord\n"; + +// MyFile.ExclusiveLock( XB_LOCK ); /* lock the files for our exclusive use */ + + MyFile.GetRecord( 2L ); /* get the second record */ + + MyFile.DeleteRecord(); /* delete it */ + + if( MyFile.RecordDeleted() ) + std::cout << "Record is deleted..." << std::endl; + else + std::cout << "Record is not deleted..." << std::endl; + +/* to undelete a record the following commented code could be used + MyFile.UndeleteRecord(); + if( MyFile.RecordDeleted() ) + std::cout << "Record is deleted...\n"; + else + std::cout << "Record is not deleted...\n"; +*/ + +/* to permanently remove deleted records from the file, pack the database */ + + if(( rc = MyFile.PackDatabase( XB_LOCK )) != XB_NO_ERROR ){ + std::cout << "Error packing database" << std::endl; + x.DisplayError( rc ); + } + else + std::cout << "Database packed." << std::endl; + +// MyFile.ExclusiveUnlock(); /* unlock the files */ + MyFile.CloseDatabase(); /* close database */ + return 0; +} diff --git a/examples/sample5.cpp b/examples/sample5.cpp new file mode 100755 index 0000000..a0071bd --- /dev/null +++ b/examples/sample5.cpp @@ -0,0 +1,135 @@ +/* sample5.cpp + + Xbase64 project source code + + This program demonstrates NDX index usage. It is not very useful + if NDX index logic has been disabled + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main() +{ + xbShort rc; /* return code */ + xbXBase x; + xbDbf d( &x ); + d.AutoLockOff(); + +// dbase indices +#ifdef XB_INDEX_NDX + xbNdx i1( &d ); + xbNdx i2( &d ); + xbNdx i3( &d ); +#endif + +// clipper indices +#ifdef XB_INDEX_NTX + xbNtx i4( &d ); + xbNtx i5( &d ); +#endif + + rc = d.OpenDatabase( "MYFILE" ); + x.DisplayError( rc ); + +#ifdef XB_INDEX_NDX + rc = i1.OpenIndex( "MYINDEX1" ); + std::cout << "OpenIndex 1 - "; + x.DisplayError( rc ); + + rc = i2.OpenIndex( "MYINDEX2" ); + std::cout << "OpenIndex 2 - "; + x.DisplayError( rc ); + + rc = i3.OpenIndex( "MYINDEX3" ); + std::cout << "OpenIndex 3 - "; + x.DisplayError( rc ); + + +#endif + +#ifdef XB_INDEX_NTX + rc = i4.OpenIndex( "MYINDEX4" ); + std::cout << "OpenIndex 4 - "; + x.DisplayError( rc ); + + rc = i5.OpenIndex( "MYINDEX5" ); + std::cout << "OpenIndex 5 - "; + x.DisplayError( rc ); +#endif + +#ifdef XB_INDEX_NDX + rc = i1.FindKey( "Queue" ); /* alpha search */ + std::cout << "NDX Find alpha key - "; + x.DisplayError( rc ); + + rc = i3.FindKey( (xbDouble) 76262 ); + std::cout << "NDX Find numeric key - "; + x.DisplayError( rc ); +#endif + + +#ifdef XB_INDEX_NTX + rc = i4.FindKey( "Queue" ); /* alpha search */ + std::cout << "NTX Find alpha key - "; + x.DisplayError( rc ); + +// looks like ntx doesn't support numeric keys + rc = i5.FindKey( (xbDouble) 76262 ); /* numeric search */ + std::cout << "NTX Find numeric key - "; + x.DisplayError( rc ); +#endif + +#ifdef XB_INDEX_NDX + + rc = i1.GetFirstKey(); + std::cout << "Get first key - "; + x.DisplayError( rc ); + + rc = i1.GetNextKey(); + std::cout << "Get next key - "; + x.DisplayError( rc ); + + rc = i1.GetLastKey(); + std::cout << "Get last key - "; + x.DisplayError( rc ); + + rc = i1.GetPrevKey(); + std::cout << "Get prev key - "; + x.DisplayError( rc ); +#endif + + d.CloseDatabase(); + return 0; +} diff --git a/examples/xbstring.cpp b/examples/xbstring.cpp new file mode 100755 index 0000000..fb4f843 --- /dev/null +++ b/examples/xbstring.cpp @@ -0,0 +1,84 @@ +/* xbstring.cpp + + Xbase64 project source code + + This program demonstrates the usage of the xbString class + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + + +#include <xbase64/xbase64.h> + +int main() +{ + xbString s1; + xbString s2; + + std::cout << "Xbstring sample program" << std::endl; + std::cout << "This program demonstrates xbString class usage" << std::endl; + + s1 = "Some string data"; + s2 = "some more string data"; + + std::cout << "s1 => " << s1 << std::endl; + std::cout << "s2 => " << s2 << std::endl; + + + s1 = "s1 "; + s2 = "s2"; + s1 -= s2; + + std::cout << "-= operator => " << s1 << std::endl; + + s1 = "s1 "; + s2 = "s2"; + s1 += s2; + + std::cout << "+= operator => " << s1 << std::endl; + + s1 = "some data"; + s2 = s1.mid( 2, 3 ); + std::cout << "mid() = " << s2 << std::endl; + + + s1.setNum( (xbLong ) 123456789 ); + std::cout << "setNum(xbLong) = " << s1 << std::endl; + + s1.setNum( "4.4", (xbDouble ) 1234.56789 ); + std::cout << "setNum(xbDouble) = " << s1 << std::endl; + + + return 0; +} + diff --git a/html/Makefile.am b/html/Makefile.am new file mode 100755 index 0000000..62aaa21 --- /dev/null +++ b/html/Makefile.am @@ -0,0 +1,34 @@ +## Process this file with automake to produce Makefile.in +## +# This file is part of the XBase libraries +# Copyright (C) 1998,1999 Vitaly Fedrushkov <fedrushkov@acm.org> + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. + +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. + +# You should have received a copy of the GNU Library General Public +# License along with this library; see the file COPYING.LIB. If not, +# write to the Free Software Foundation, Inc., or see +# http://www.gnu.org/. + +EXTRA_DIST = COPYING.LIB Xb2cpp.htm xbase.jpg index.htm xba1.htm \ + xba2.htm xbapps.htm xbbib.htm xbc1.htm xbc2.htm xbc3.htm \ + xbc4.htm xbc12.htm xbc13.htm xbc14.htm xbc15.htm xbc16.htm \ + xbc17.htm xbc18.htm xbc2.htm xbc3.htm xbc4.htm xbc5.htm xbc6.htm \ + xbc7.htm xbc8.htm xblock.htm xbc11.htm + +## Uncomment these to have docs installed by `make install`: + +## htmldir = $(prefix)/doc/$(PACKAGE)-$(VERSION)/html +## html_DATA = $(EXTRA_DIST) + +MAINTAINERCLEANFILES = Makefile.in + +CLEANFILES = *.bak Makefile.in
\ No newline at end of file diff --git a/html/Makefile.in b/html/Makefile.in new file mode 100755 index 0000000..2902a47 --- /dev/null +++ b/html/Makefile.in @@ -0,0 +1,254 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# This file is part of the XBase libraries +# Copyright (C) 1998,1999 Vitaly Fedrushkov <fedrushkov@acm.org> + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. + +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. + +# You should have received a copy of the GNU Library General Public +# License along with this library; see the file COPYING.LIB. If not, +# write to the Free Software Foundation, Inc., or see +# http://www.gnu.org/. +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +GXXVER = @GXXVER@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RELEASE = @RELEASE@ +RHREL = @RHREL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XSUBDIRS = @XSUBDIRS@ +am__include = @am__include@ +am__quote = @am__quote@ +doxygen = @doxygen@ +install_sh = @install_sh@ +topdir = @topdir@ + +EXTRA_DIST = COPYING.LIB Xb2cpp.htm xbase.jpg index.htm xba1.htm \ + xba2.htm xbapps.htm xbbib.htm xbc1.htm xbc2.htm xbc3.htm \ + xbc4.htm xbc12.htm xbc13.htm xbc14.htm xbc15.htm xbc16.htm \ + xbc17.htm xbc18.htm xbc2.htm xbc3.htm xbc4.htm xbc5.htm xbc6.htm \ + xbc7.htm xbc8.htm xblock.htm xbc11.htm + + +MAINTAINERCLEANFILES = Makefile.in + +CLEANFILES = *.bak Makefile.in +subdir = html +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = COPYING.LIB Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu html/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile + +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_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-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 + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool 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: diff --git a/html/Xb2cpp.htm b/html/Xb2cpp.htm new file mode 100755 index 0000000..aa9d532 --- /dev/null +++ b/html/Xb2cpp.htm @@ -0,0 +1,81 @@ +<HTML> +<HEAD> +<TITLE>Xbase to Xbase DBMS C++ Converter</TITLE> +</HEAD> +<BODY> + +<H1>Xbase to Xbase DBMS C++ Converter</H1> + +<H2>Program Xb2cpp.pl V0.1 26-11-98</P> +<H2>Author</H2> +<A HREF="mailto:kehl@informatik.tu-muenchen.de">Hubertus Kehl</A>, kehl@informatik.tu-muenchen.de, kehlh@hotmail.com +<BR>Please send suggestions, bug reports, patches, etc. one of these email +adresses. +<H2>Language</H2> +<P>Perl 5.0</P> +<H2>Purpose</H2> +<P>Convert Dbase, Clipper, FOXPRO Source Code to XBASE C++ Code for use with +<A HREF="http://xdb.sourceforge.net">XBASE DBMS Library</A></P> +<H2>Output</H2> +<P>.cpp File and .h File</P> +<H2>Arguments</H2> +<P>1st arg = filename</P> +<H2>Remarks</H2> +<P>The script tries to keep track of the databases used in different workareas. +But the flow through your program cannot be determined, so in some cases +you have to help the script a bit by giving additional info.</P> +<P>Three special comments have been designed to add this info:</P> +<PRE>* XB2CPP(SelectedArea) +or * XB2CPP(SelectedArea,Workarea1,Alias1,Wa2,Al2...) +or * XB2CPP(SelA,WA1,Al1[Total1, Active1],Wa2, Al2[Tot2,Act2])</PRE> +<P>e.g. * XB2CPP(3,3,ZP,2,PL) will inform the script for example at the beginning +of a PROCEDURE that a database with Alias ZP is opened in workarea 3 and +a database with alias PL is opened in workarea2 and when calling this procedure +always workarea 3 is selected.</P> +<P>The third alternative of this statement makes it possible to define +the number of open indices and which one is the active index, as given +by a previous SET INDEX TO or USE and SET ORDER TO statements. The script +cannot know, which procedures, statements have been executed before and +opened indices.... So * XB2CPP(2,2,ZP[2,1]) will inform the script about +an open database alias ZP in workarea 2 which is currently selected and +has two open indices where the first one is the active one.</P> +<H2>Hints</H2> + +<OL> +<LI>Always give an ALIAS in USE-Statements this is needed for generation +of the Database Classnames</LI> +<LI>Give the above described additional infos where necessary.</LI> +<LI>Use ALIASes in Expressions with database fields, this helps the script +in knowing where database references are.</LI> +<LI>Replace the XXX in PutXXXField or GetXXXField manually the script is +not able to determine variable or field types. The code for getting a Textfield +(GetField) must also be corrected. Xbase DBMS Syntax requires the buffer +as second parameter, the string will not be returned ! You may use a C++ +String wrapper for this job.</LI> +<LI>PROCEDURES that will operate on two different databases where some statements +are used for both cannot be converted The script needs to know everytime +on which database the statements are operating. Either duplicate such procedures, +(one for each database), or write a generic C++ routine with pointers to +databases.</LI> +<LI>Don't assume any compilable or even working C++ source code as output. +The ambigous DBASE language, which lacks type and variable definitions +is one reason for this. This script only will help you for about 10-30% +of the conversion. The rest (which remained uppercase) has to be done manually +:)</LI> +</OL> + +<H2>Copyright</H2> +<P>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 (version 2 of the License)</P> + +<P>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.</P> +<HR> +<ADDRESS> +<A HREF="mailto:kehl@informatik.tu-muenchen.de">Hubertus Kehl</A>,29-11-1998 +</ADDRESS> +</BODY> +</HTML> diff --git a/html/copying.lib b/html/copying.lib new file mode 100755 index 0000000..e3df74a --- /dev/null +++ b/html/copying.lib @@ -0,0 +1,443 @@ +NOTE! The LGPL below is copyrighted by the Free Software Foundation, but +the instance of code that it refers to (the XBase libraries) are copyrighted +by the authors who actually wrote it. + +--------------------------------------------------------------------------- + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library 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 Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/html/index.htm b/html/index.htm new file mode 100755 index 0000000..2825ac4 --- /dev/null +++ b/html/index.htm @@ -0,0 +1,39 @@ +<!DOCTYPE HTML PUBLIC> +<HTML><TITLE>Xbase DBMS Documentation Table of Contents</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase DBMS<br> +Last Updated 3/19/04<br>Version 3.0</p></H1> +<h2>Documentation Table Of Contents</h2> +<h3>Section 1 - Xbase Concepts</h3> +<h4> +<A HREF="xbc1.htm">Chapter 1 - Getting Started</A><br> +<A HREF="xbc2.htm">Chapter 2 - Database Overview</A><br> +<A HREF="xbc3.htm">Chapter 3 - Fields and Strings</A><br> +<A HREF="xbc4.htm">Chapter 4 - Date Processing</A><br> +<A HREF="xbc5.htm">Chapter 5 - Expression Handling</A><br> +<A HREF="xbc6.htm">Chapter 6 - NDX (DBase) Indices</A><br> +<A HREF="xbc7.htm">Chapter 7 - NTX (Clipper) Indices</A><br> +<A HREF="xbc8.htm">Chapter 8 - Record and File Locking</A><br> +</h4> +<h3>Section 2 - Using the Library</h3> +<h4> +<A HREF="xbc11.htm">Chapter 11 - Library Options and Methods</A><br> +<A HREF="xbc12.htm">Chapter 12 - Database Methods</A><br> +<A HREF="xbc13.htm">Chapter 13 - Field Methods</A><br> +<A HREF="xbc14.htm">Chapter 14 - String Methods</A><br> +<A HREF="xbc15.htm">Chapter 15 - Date Methods</A><br> +<A HREF="xbc16.htm">Chapter 16 - Expression Reference</A><br> +<A HREF="xbc17.htm">Chapter 17 - Index Methods</A><br> +<A HREF="xbc18.htm">Chapter 18 - Locking Methods</A><br> +</h4> +<h3>Section 3 - Appendices</h3> +<h4> +<A HREF="xba1.htm">Appendix A - Return Codes and Exception Processing</A><br> +<A HREF="xba2.htm">Appendix B - Quick Reference</A><br> +<A HREF="copying.lib">Appendix C - GPL Library License</A><br> +<A HREF="xbbib.htm">Appendix D - Bibliography</A><br> +<A HREF="Xb2cpp.htm">Appendix F - Xbase DBMS Perl conversion program</A><br> +</h4> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xba1.htm b/html/xba1.htm new file mode 100755 index 0000000..7125e79 --- /dev/null +++ b/html/xba1.htm @@ -0,0 +1,65 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Appendix A</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase Return Codes</p></H1> +<p align="center">Page Updated 2/19/04</p><hr> + + +Beginning with release 3.0 exception processing has been removed from the +library. There were reports that it was not 100% working, so I trimmed the +library back to working code. If there are any volunteers to re-install the +exception processing, AND test it, let me know. Thanks - Gary + +It is generally a good idea to check the method return codes to verify an +error hasn't occured. Most Xbase DBMS methods return a SHORT return code +value which corresponds to a value in this table.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Return Codes</h3></CAPTION> +<TR ALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Number<TD>Error<TD>Description<TD>Type +<TR><TH ALIGN="LEFT">0<TD>XB_NO_ERROR<TD>Success<TD>General +<TR><TH ALIGN="LEFT">100<TD>XB_XBASE_EOF<TD>End of file<TD>Database<br>Index +<TR><TH ALIGN="LEFT">102<TD>XB_NO_MEMORY<TD>Error when allocating memory<TD>General +<TR><TH ALIGN="LEFT">103<TD>XB_FILE_EXISTS<TD>File Already Exists<TD>Database +<TR><TH ALIGN="LEFT">104<TD>XB_OPEN_ERROR<TD>Error when opening file<TD>Database +<TR><TH ALIGN="LEFT">105<TD>XB_WRITE_ERROR<TD>Error occured when writing to file<TD>Database<br>Index +<TR><TH ALIGN="LEFT">106<TD>XB_UNKNOWN_FIELD_TYPE<TD>Field was not one of:<br> +XB_CHAR_FLD<br>XB_FLOAT_FLD<br>XB_NUMERIC_FLD<br>XB_DATE_FLD<br> +XB_LOGICAL_FLD or XB_MEMO_FLD<br><TD>Field +<TR><TH ALIGN="LEFT">107<TD>XB_ALREADY_OPEN<TD>Can't open the same file twice<TD>Database<br>Index +<TR><TH ALIGN="LEFT">108<TD>XB_NOT_XBASE<TD>Can't open non X-Base file with<br> + X-Base routines<TD>Database +<TR><TH ALIGN="LEFT">109<TD>XB_INVALID_RECORD<TD>Not a valid record<TD>Database +<TR><TH ALIGN="LEFT">110<TD>XB_INVALID_OPTION<TD>Not a valid option<TD>General +<TR><TH ALIGN="LEFT">112<TD>XB_SEEK_ERROR<TD>Could not position in file<TD>Database<br>Index +<TR><TH ALIGN="LEFT">114<TD>XB_NOT_FOUND<TD>Record for key not found<TD>Index +<TR><TH ALIGN="LEFT">116<TD>XB_INVALID_KEY<TD>Invalid key argument given<TD>Index +<TR><TH ALIGN="LEFT">118<TD>XB_KEY_NOT_UNIQUE<TD>Trying to add a duplicate key for an unique index<TD>Index +<TR><TH ALIGN="LEFT">119<TD>XB_INVALID_KEY_EXPRESSION<TD>An invalid key expression given<TD>Index +<TR><TH ALIGN="LEFT">121<TD>XB_INVALID_KEY_TYPE<TD>Invalid Key Type<TD>Index +<TR><TH ALIGN="LEFT">122<TD>XB_INVALID_NODE_NO<TD>Internal index error, notify tech support<TD>Index +<TR><TH ALIGN="LEFT">123<TD>XB_NODE_FULL<TD>Internal index error, notify tech support<TD>Index +<TR><TH ALIGN="LEFT">124<TD>XB_INVALID_FIELDNO<TD>Attempt to access invalid field number<TD>Field +<TR><TH ALIGN="LEFT">125<TD>XB_INVALID_DATA<TD>Invalid data encountered<TD>Field +<TR><TH ALIGN="LEFT">126<TD>XB_NOT_LEAFNODE<TD>Internal index error, notify tech support<TD>Index +<TR><TH ALIGN="LEFT">127<TD>XB_LOCK_FAILED<TD>Lock function failed<BR>See errno for detail + <TD>Lock +<TR><TH ALIGN="LEFT">128<TD>XB_CLOSE_ERROR<TD>Error closing file<TD>Database<br>Index +<TR><TH ALIGN="LEFT">129<TD>XB_INVALID_SCHEMA<TD>Error with schema definition, check decimal points<TD>Database +<TR><TH ALIGN="LEFT">130<TD>XB_INVALID_NAME<TD>Invalid database name<TD>Memo +<TR><TH ALIGN="LEFT">131<TD>XB_INVALID_BLOCK_SIZE<TD>Block size is invalid, must be increment of 512<TD>Memo +<TR><TH ALIGN="LEFT">132<TD>XB_INVALID_BLOCK_NO<TD>Invalid block number used<TD>Memo +<TR><TH ALIGN="LEFT">133<TD>XB_NOT_MEMO_FIELD<TD>Not a memo field<TD>Memo +<TR><TH ALIGN="LEFT">134<TD>XB_NO_MEMO_DATA<TD>No memo data<TD>Memo +<TR><TH ALIGN="LEFT">135<TD>XB_EXP_SYNTAX_ERROR<TD>Expression syntax error<TD>Expression +<TR><TH ALIGN="LEFT">136<TD>XB_PARSE_ERROR<TD>Parse error in expression<TD>Expression +<TR><TH ALIGN="LEFT">137<TD>XB_NO_DATA<TD>No data for expression<TD>Expression +<TR><TH ALIGN="LEFT">140<TD>XB_INVALID_FIELD<TD>Invalid field in expression<TD>Expression +<TR><TH ALIGN="LEFT">141<TD>XB_INSUFFICIENT_PARMS<TD>Insufficient paramaters for function<TD>Expression +<TR><TH ALIGN="LEFT">142<TD>XB_INVALID_FUNCTION<TD>Invalid function encountered<TD>Expression +</TABLE><br><br><hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xba2.htm b/html/xba2.htm new file mode 100755 index 0000000..4a39d3c --- /dev/null +++ b/html/xba2.htm @@ -0,0 +1,110 @@ +<!DOCTYPE xbHtml PUBLIC> +<xbHtml> +<TITLE>Xbase DBMS Appendix B</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase DBMS Quick Reference</p></H1> +<p align="center">Page Updated 2/19/04</p><hr> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Quick Reference Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::AppendRecord() +<TR><TH ALIGN="LEFT">void xbDbf::AutoLockOff() +<TR><TH ALIGN="LEFT">void xbDbf::AutoLockOn() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::BlankRecord() +<TR><TH ALIGN="LEFT">xbLong cs xbDbf::CalcCheckSum() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::CloseDatabase() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::CopyDbfStructure( char * NewFileName, xbShort Overlay ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::CreateDatabase( char * FileName, xbSchema * RecordLayout, xbShort Overlay ) +<TR><TH ALIGN="LEFT">xbULong RecNo xbDbf::CurrentRecNo() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::DeleteAllRecords() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::DeleteRecord() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::DumpHeader( xbShort Option ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::DumpRecord( xbULong RecNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::ExclusiveLock( xbShort WaitOption ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::ExclusiveUnlock() +<TR><TH ALIGN="LEFT">xbLong NoOfFields xbDbf::FieldCount() +<TR><TH ALIGN="LEFT">xbLong RecNo xbDbf::GetCurRecNo() +<TR><TH ALIGN="LEFT">xbDouble Val xbDbf::GetDoubleField( char * FieldName) +<TR><TH ALIGN="LEFT">xbDouble Val xbDbf::GetDoubleField( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetField( xbShort FieldNo, char * FieldName ) +<TR><TH ALIGN="LEFT">xbShort DecimalCount xbDbf::GetFieldDecimal( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort FieldLen xbDbf::GetFieldLen( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">char * FieldName xbDbf::GetFieldName( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort FieldNo xbDbf::GetFieldNo( char * FieldName ) +<TR><TH ALIGN="LEFT">char Type xbDbf::GetFieldType( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetFirstRecord() +<TR><TH ALIGN="LEFT">xbFloat FloatVal xbDbf::GetFloatField( char * FieldName ) +<TR><TH ALIGN="LEFT">xbFloat FloatVal xbDbf::GetFloatField( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetLastRecord() +<TR><TH ALIGN="LEFT">xbShort Val xbDbf::GetLogicalField( char * FieldName ) +<TR><TH ALIGN="LEFT">xbShort Val xbDbf::GetLogicalField( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbLong LongVal xbDbf::GetLongField( char * FieldName ) +<TR><TH ALIGN="LEFT">xbLong LongVal xbDbf::GetLongField( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetMemoField( xbShort FieldNo, xbLong len, char * Buf ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetMemoFieldLen( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetNextRecord() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetPrevRecord() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::GetRecord( xbLong RecNo ) +<TR><TH ALIGN="LEFT">char * BufPtr xbDbf::GetRecordBuf() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::LockDatabase( xbShort WaitOption, xbShort LockType, xbLong RecNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::MemoFieldExists( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::MemoFieldsPresent() +<TR><TH ALIGN="LEFT">xbLong RecCnt xbDbf::NoOfRecords() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::OpenDatabase( char * FileName ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PackDatabase( xbShort WaitOption ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutDoubleField( char * FieldName,xbDouble DoubleValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutDoubleField( xbShort FieldNo,xbDouble DoubleValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutField( xbShort FieldNo, char * Buf ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutFloatField( char * FieldName, xbFloat FloatValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutFloatField( xbShort FieldNo, xbFloat FloatValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutLongField( char * FieldName, xbLong LongValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutLongField( xbShort FieldNo, xbLong LongValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::PutRecord( xbLong RecNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::RebuildAllIndices() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::RecordDeleted() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::SetVersion( xbShort Version ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::UndeleteAllRecords() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::UndeleteRecord() +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::UpdateMemoData( xbShort FieldNo, xbLong len, char * Buf, xbShort LockOption ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::ValidLogicalData( xbShort FieldNo ) +<TR><TH ALIGN="LEFT">xbShort rc xbDbf::ValidNumericData( xbShort FieldNo ) + + +<TR><TH ALIGN="LEFT">char * Day xbXBase::CharDayOf( char * Date8 ) +<TR><TH ALIGN="LEFT">char * Month xbXBase::CharMonthOf( char * Date8 ) +<TR><TH ALIGN="LEFT">xbShort rc xbXBase::DateIsValid( char * Date8 ) +<TR><TH ALIGN="LEFT">xbShort Day xbXBase::DayOf( xbShort Format, char * Date8 ) +<TR><TH ALIGN="LEFT">char * Date xbXBase::FormatDate( char * Format, char * Date8 ) +<TR><TH ALIGN="LEFT">xbString & Result xbXBase::GetStringResult() +<TR><TH ALIGN="LEFT">xbDouble * Result xbXBase::GetDoubleResult() +<TR><TH ALIGN="LEFT">XB_EXPRESSION * Exp xbXBase::GetExpressionHandle() +<TR><TH ALIGN="LEFT">char Type xbXBase::GetExpressionResultType( XB_EXPRESSION * ) +<TR><TH ALIGN="LEFT">xbLong * result xbXBase::GetIntResult() +<TR><TH ALIGN="LEFT">xbShort rc xbXBase::IsLeapYear( char * Date8 ) +<TR><TH ALIGN="LEFT">xbLong JulVal xbXBase::JulianDays( char * Date8 ) +<TR><TH ALIGN="LEFT">char * Date8 xbXBase::JulToDate8( xbLong JulVal ) +<TR><TH ALIGN="LEFT">xbLong JulVal xbXBase::LastDayOfMonth( char * Date8 ) +<TR><TH ALIGN="LEFT">xbShort Month xbXBase::MonthOf( char * Date8 ) +<TR><TH ALIGN="LEFT">xbShort rc xbXBase::ParseExpression( char * exp, xbDbf * d ) +<TR><TH ALIGN="LEFT">xbShort rc xbXBase::ProcessExpression( XB_EXPRESSION * ) +<TR><TH ALIGN="LEFT">char * Date8 xbXBase::Sysdate() +<TR><TH ALIGN="LEFT">xbShort Year xbXBase::YearOf( char * Date8 ) + +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::CheckNdxIntegrity( xbShort Option ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::CloseIndex() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::CreateIndex( char * IndexName, char * KeyExpression, xbShort Unique, xbShort Overlay ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::FindKey( char * SearchValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::FindKey( xbDouble SearchValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::GetFirstKey() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::GetLastKey() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::GetNextKey() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::GetPrevKey() +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::KeyExists( char * SearchValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::KeyExists( xbDouble SearchValue ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::LockIndex( xbShort WaitOption, xbShort LockType ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::OpenIndex( char * IndexName ) +<TR><TH ALIGN="LEFT">xbShort rc xbNdx::ReIndex() +</TABLE> +<br><br><hr> +<p><img src="xbase.jpg"><br><hr> diff --git a/html/xbapps.htm b/html/xbapps.htm new file mode 100755 index 0000000..7a87d02 --- /dev/null +++ b/html/xbapps.htm @@ -0,0 +1,39 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Sample Application</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align=center>Sample Programs</p></H1> +<p align=center>Page Updated 2/12/04</p><hr><br><br> +Sample Xbase DBMS programs are located in the xbase/samples and xbase/bin +directories.<br><br> +<CENTER> +<TABLE BORDER> +<CAPTION ALIGN=TOP><H3>X-Base Sample Programs</H3></CAPTION> +<TR ALIGN=BASELINE> +<TR><TH ALIGN=LEFT>Program<TD>Program Description +<TR><TH ALIGN=LEFT>checkndx<TD>This program checks an NDX file +<TR><TH ALIGN=LEFT>copydbf<TD>This program copies a DBF file structure +<TR><TH ALIGN=LEFT>dbfxtrct<TD>Extract data from dbf file and load into +<TR><TH ALIGN=LEFT>dbfutil1<TD>Menu program for executing Xbase functions +<TR><TH ALIGN=LEFT>deletall<TD>This program marks all records in a DBF file for deletion +<TR><TH ALIGN=LEFT>dumpdbt<TD>Debug memo files +<TR><TH ALIGN=LEFT>dumphdr<TD>This program opens an Xbase file and prints its header +<TR><TH ALIGN=LEFT>dumprecs<TD>This program dumps records for an X-Base file +<TR><TH ALIGN=LEFT>exfilter<TD>Expression filter test program +<TR><TH ALIGN=LEFT>packdbf<TD>This program packs a database file +<TR><TH ALIGN=LEFT>reindex<TD>This program rebuilds an index +<TR><TH ALIGN=LEFT>sample1<TD>This program creates an Xbase file MYFILE.DBF +<TR><TH ALIGN=LEFT>sample2<TD>This program populates file MYFILE.DBF created by program sample1 +<TR><TH ALIGN=LEFT>sample3<TD>This program lists MYFILE.DBF data populated by program sample2 +<TR><TH ALIGN=LEFT>sample4<TD>This program deletes records, undeletes records, locks and packs datafile MYFILE.DBF +<TR><TH ALIGN=LEFT>sample5<TD>This program demonstrates NDX class usage +<TR><TH ALIGN=LEFT>testdate<TD>This program tests the Xbase date methods +<TR><TH ALIGN=LEFT>undelall<TD>This program undeletes all deleted records in a dbf file +<TR><TH ALIGN=LEFT>zap<TD>This program removes all records from a DBF file + comma delimitedoutput file suitable for input into an awk or perl script +</TABLE></CENTER> +P<br><br> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbase.jpg b/html/xbase.jpg Binary files differnew file mode 100755 index 0000000..5070fcb --- /dev/null +++ b/html/xbase.jpg diff --git a/html/xbbib.htm b/html/xbbib.htm new file mode 100755 index 0000000..70e4e82 --- /dev/null +++ b/html/xbbib.htm @@ -0,0 +1,63 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Bibliography</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase DBMS Bibliography</p></H1> +<p align="center">Page Updated 2/1/99</p><hr> + +Bachman, Erik<br> +Xbase File Format Description / Erik Bachman, Roskilde, Denmark: Clickety +Click Software, 1996-1998, 44 pages<br><br> + +Loomis, Mary:<br> +The Database Book, Macmillan Publishing Company, 1987, New York, New York: +ISBN 0-02-371760-2<br><br> + +Dorfman, Len:<br> +Building C Libraries, Windcrest, 1990, Blue Ridge Summit, PA: +ISBN 0-8306-3418-5<br><br> + +Eckel, Bruce:<br> +Using C++, Osborne, McGraw-Hill, 1990, Berkeley, CA: +ISBN 0-07-881522-3<br><br> + +Aho, Alfred: Hopcroft, John: Ullman, Jeffrey:<br> +Data Structures and Algorithms, Addison-Wesley Publishing, 1983, +Reading Massachusetts: ISBN 0-201-00023-7<br><br> + +Stevens, Al:<br> +C Database Development, MIS Press, 1991, Portland Oregon: +ISBN 1-55828-136-3<br><br> + +Pressman, Roger:<br> +Software Engineering: A Practitioner's Approach, McGraw-Hill, 1982, +New York ISBN 0-07-050781-3<br><br> + +Chou, George Tsu-der:<br> +2nd Edition dBase III Plus Handbook: Que Corporation, 1986, +Indianapolis, Indiana ISBN 0-88022-269-7<br><br> + +Krumm, Rob:<br> +Understanding and Using dBase II & III, Brady Communications Company, Inc, +1985, Bowie MD ISBN 0-89303-917-9<br><br> + +Hursch, Jack: Hursch, Carulyn:<br> +dBase IV Essentials, Windcrest, 1988, Blue Ridge Summit, PA +ISBN 0-8306-9616-4<br><br> + +Borland:<br> +Turbo C++, Programmer's Guide, Borland International, 1990, +Scotts Valley CA<br><br> + +Borland:<br> +Turbo C++, Library Reference, Borland International 1990, +Scotts Valley CA<br><br> + +The Draft Standard C++ Library by P.J. Plauger, Prentice Hall, New Jersey, +1995.<br><br> + +H.M Dietel/P.J. Deitel: C++ How To Program, Prentice Hall, Englewod Cliffs, +New Jersey 07632<br><br> + +</BODY> +</HTML> diff --git a/html/xbc1.htm b/html/xbc1.htm new file mode 100755 index 0000000..72c9904 --- /dev/null +++ b/html/xbc1.htm @@ -0,0 +1,232 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 1</TITLE> +<BODY BGCOLOR=#FFFFFF> + +<h1><p align="center">Getting Started</p></h1> +<p align="center">Chapter Updated 8/14/03</p> + +<hr><h2>Overview</h2> + +Welcome to Xbase DBMS. Xbase DBMS is a collection of specifications, +programs, utilities and a C++ class library for manipulating Xbase type +datafiles and indices. Xbase has been developed and produced by several +people from around the world via the internet. +<br><br> + +The term Xbase is often used used to describe the format of the original +DBase, Clipper and Foxbase (.DBF) files. Many vendors support the industry +standard Xbase file format and are committed to this technology for many +years to come, thus insuring continued support.<br><br> + +The original purpose of the Xbase library was to provide reliable and +economical programming tools to programmers for reading, writing and updating +DBF databases, indices and memo fields.<br><br><br> + +<hr><h2>System Requirements</h2> + +To use Xbase DBMS, the following items are needed:<br><br> + +A computer and C/C++ compiler.<br><br> + +The original source code is developed on a Linux platform with the GCC +public domain C/C++ compiler. +<br><br> + +Xbase DBMS has been successfully ported and runs on Linux, Sun Solaris, +OpenVMS, FreeBSD, OS2 and DOS/Windows (Using the large memory model). +<br><br> + +This software is not intended to be used on any system using an SCO operating +system. +<br><br> + +<hr><h2>Classes and User Interface</h2> + +There are six classes in the Xbase library which are available +for use in a typical Xbase application program.<br><br><br> + +<CENTER><TABLE BORDER> +<CAPTION ALIGN=TOP><H3>Xbase Classes - Version 1.8.0 and newer</H3></CAPTION> +<TR VALIGN=BASELINE> +<TR><TH ALIGN=LEFT>Class<TD>Basic Description<TD>How Used<TD>Old Class<br>Name +<TR><TH ALIGN=LEFT>xbXBase<TD>Basic Xbase Class<TD>Every program gets one of these<TD>XBASE +<TR><TH ALIGN=LEFT>xbDbf<TD>Database and Field class<TD>Need one of these for each open DBF file<TD>DBF +<TR><TH ALIGN=LEFT>xbNdx<TD>Ndx index class<TD>Need one of these for each open NDX index<TD>NDX +<TR><TH ALIGN=LEFT>xbNtx<TD>Ntx index class<TD>Need one of these for each open NTX index +<TR><TH ALIGN=LEFT>xbString<TD>String class<TD>Used for handling strings +<TR><TH ALIGN=LEFT>xbHtml<TD>Html generation class<TD>Needed for creating HTML code<TD>HTML +</TABLE></CENTER> +<br><br> +There are other classes used internally by these Xbase classes, but most +application programs need not to be concerned with. These classes are +xbStack - used for stack data structures, xbExpn - used for expression +logic, and xbDate - used for date manipulation logic. + +<br><br> +<hr><h2>Portability, Type Defs and Structures</h2> + +To effectively make the Xbase library as portable across platforms as possible, +three things occured. +<br><br> +<li>First, the software was developed to run and compile on either big endian +or little endian computers and store all numeric data in little endian format. +<br><br> +<li>Secondly, field types must be consistently defined in each environment. The <em>types.h</em> +file defines the xbase data types. To modify the Xbase code base to function +in a different (non ported to yet) environment, start by modifying the <em>types.h</em> +file for your site and recompile.<br><br> +<li>Thirdly, support for unix automake and autoconf has been to provided +support on a wide variety of unices. +<hr><br><br> +<CENTER> +<TABLE BORDER> +<CAPTION ALIGN=TOP><h3>Field Types</h3></CAPTION> +<TR ALIGN=BASELINE> +<TR><TH ALIGN=LEFT>Type<TD>Description +<TR><TH ALIGN=LEFT>xbULong<TD>unsigned long int +<TR><TH ALIGN=LEFT>xbUShort<TD>unsigned short int +<TR><TH ALIGN=LEFT>xbShort<TD>short int +<TR><TH ALIGN=LEFT>xbLong<TD>long +<TR><TH ALIGN=LEFT>xbFloat<TD>float +<TR><TH ALIGN=LEFT>xbDouble<TD>double +<TR><TH ALIGN=LEFT>char<TD>char +<TR><TH ALIGN=LEFT>void<TD>void +<TR><TH ALIGN=LEFT>struct SCHEMA<TD>Used for defining record structures +</TABLE></CENTER> +<br><br> + +Xbase was designed for portability utilizing standard ANSI-C compliant +code. If you decide to write updates to the Xbase project, please try +to keep your work to standard generic ANSI-C (no special DOS/WINDOWS Calls). +<br><br> + +<hr><h2>Compilation Overview</h2> +If you are building the sources on a Linux/Unix platform:<br><br> +Download the source<br> +./configure<br> +make<br> +su<br> +make install<br> +exit<br><br> + +<br><br> +Before compiling the library, you may need to modify the options for your +environment. Do "./configure --help" for a list of the current options + +<br><br> +On my server, I had to: +<li>Verify the library and associated links were copied from xbase/xbase/.libs +into /usr/local/lib +<li>Add /usr/local/lib is in /etc/ld.so.conf +<li>execute program <em>ldconfig</em> as root to refresh the new libs + +<br><br> +Actual milage at your site may vary. +<br><br> + +<hr><h2>Building a program with the Xbase library</H2> + +Create a directory for your project:<br><br> + +cd /home/me<br> +mkdir MyProject<br> +cd MyProject<br> +vi MyProg.cpp<br><br> + +To use the Xbase classes, include the following header file in the program: +<br><br> + +#include <xbase/xbase.h><br><br> + +For more details, check out the sample programs in the +xbase/examples directory. +<br><br> +<hr><h2>Compiling and Linking Unix Application Program for v3.0 later</h2> + +The install script should have provided specific instructions for your +environment on how to link with the xbase library. <br><br> + +In the Linux environment, assuming that you are using shared libraries, +and usr/local/lib has been added to +the /etc/ld.so.conf file, and the ldconfig command was executed +<br><br> + +To Compile:<br> +g++ -c -Wall -I/usr/include -I/usr/src/linux/include-asm-i386 -I/usr/local/include +-I/usr/local/xbase myprog.cpp<br><br> +To Link Edit:<br> +g++ -o myprog myprog.o libxbase.so<br><br> + +<hr><h2>Compiling an Application Program with Borland v4.5 C/C++compiler</h2> +With Borland C compiler: bcc -Ic:\xbase\src myprog.cpp -Lc:\xbase\src\xbase.lib +<br><br> + +<hr><h2>Getting the latest development version of XBase</h2> + +<br>The Xbase project is in an ongoing state of development with new +enhancements being added and bug fixes being applied as they are found +and the package maintainers have time. There are several programmers +from various parts of the world working on Xbase. If you would like to +get the latest version of the Xbase library for your project, it is +available on sourceforge.net. + +<br><h3>Notes about using the current development library</h3> +<li>1 - Library functions may or may not be documented +<li>2 - The library may or may not be stable. This is the development library +and is being updated with current code changes. If you are using it, and it +does not behave the way you think it should, you may want to drop a note to +<A HREF="mailto:xdb-devel@lists.sourceforeg.net">xdb-devel@lists.sourceforge.net +</A> This may sound a little unsettling, but the +library is generally stable. It goes through periods of time where it is in +a state of flux when major changes are occurring, but for the most part it is +probably OK to use. +<li>3 - If you have changes to contribute to the library, mail your updates +to<A HREF="mailto:xdb-devel@lists.sourceforge.net"> +xdb-devel@lists.sourceforge.net</A><br>. + +<hr><br> +<h2>System Limitations</h2> +<br> +Maximum size of a database file is the size of LONG - 2,147,483,647 bytes<br> +Total number of fields in a database - 1024 <br> +Total number of characters in all fields - 32767<br> +Maximum number of characters in a field - 254<br> +Total number of records in a file - 1 billion<br> +Maximum index key length - 100 bytes<br> +Maximum .DBT file memo block size - 32256<br> +Maximum expression result length - 100 bytes<br> +Maximum NDX index key length - 100 bytes<br><br> +<hr><br><br> + +<CENTER> +<TABLE BORDER> +<CAPTION ALIGN=TOP><H3>Xbase Options - Unix Automake environment</H3></CAPTION> +<TR VALIGN=BASELINE> +<TR><TH ALIGN=LEFT>OPTION<TD>DESCRIPTION +<TR><TH ALIGN=LEFT>--without-xbase-debug<TD>Turns off xbase debugging code +<TR><TH ALIGN=LEFT>--without-index-ndx<TD>Turns off NDX index options +<TR><TH ALIGN=LEFT>--without-index-ntx<TD>Turns off NTX index options +<TR><TH ALIGN=LEFT>--without-memo-fields<TD>Turns off memo fields +<TR><TH ALIGN=LEFT>--without-expressions<TD>Turns off expression processing +<TR><TH ALIGN=LEFT>--without-ui-html<TD>Turns off HTML user interface class +<TR><TH ALIGN=LEFT>--without-xbase-locking<TD>Turns off xbase locking +<TR><TH ALIGN=LEFT>--without-xbase-debug<TD>Turns off debug logic +<TR><TH ALIGN=LEFT>--without-exceptions<TD>Turns on exception processing +<TR><TH ALIGN=LEFT>--with-castellano<TD>Turn on castellano/spanish date options +<TR><TH ALIGN=LEFT>--without-realdelete<TD>Turn off Xbase record deletion +<TR><TH ALIGN=LEFT>--without-xbase-filter<TD>Turn off Xbase filter logic +</TABLE></CENTER> +<br><br> + +Use these options on the command line when executing the <em>./configure</em> +command. Also, you can execute <em>./configure --help</em> for a complete +list of all unix configure options. +<br><br> +<B>Q</B> Why turn any of thes options off?<br> +<B>A</B> Smaller library<br><br><hr> + + +<p><img src=xbase.jpg><br><hr> +</BODY> +</HTML> diff --git a/html/xbc11.htm b/html/xbc11.htm new file mode 100755 index 0000000..9af3860 --- /dev/null +++ b/html/xbc11.htm @@ -0,0 +1,40 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 11</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Library Options and Methods<br></H1> +<p align="center">Chapter Updated 2/1/99</p><hr> +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>xbXbase Class Methods</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">void xbXBase::DisplayError(xbShort ErrorNumber)<TD>Display error text +<TR><TH ALIGN="LEFT">char * xbXbase::GetDefaultDateFormat()<TD>Return the default date format +<TR><TH ALIGN="LEFT">void xbXBase::SetDefaultDateFormat(char * Format)<TD>Set the default date format +</TABLE> +<br><br> +<hr> +<h2>Method Definitions</h2> +<hr> +<h4>Method void xbXbase::DisplayError( xbShort ErrorNo )</h4><br> +This method prints a text description of an error code. +<h4>Example Code Snipit:</h4> + +<xmp> +xbShort rc; +rc = d.SomeXbaseFunction(...); +if( rc < 0 ) + x.DisplayError( rc ); +else + DoSomethingUsefull(); +</xmp> +<hr> +<h4>Method char * xbXBase::GetDefaultDateFormat( void )<br> +Method void xbXBase::SetDefaultDateFormat( char * NewDateFormat )</h4><br> +These methods are used for retrieving and setting the default date format +which is used by expression function DTOC. +<br><br><hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc12.htm b/html/xbc12.htm new file mode 100755 index 0000000..af33408 --- /dev/null +++ b/html/xbc12.htm @@ -0,0 +1,566 @@ +<!DOCTYPE xbHtml PUBLIC> +<xbHtml> +<TITLE>Xbase DBMS Chapter 12</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Database Methods</p></H1> +<p align="center">Chapter Updated 1/30/99</p><hr> +<br> +This chapter lists the database methods and provides links to examples of how +to use them.<br><br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Database Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">xbShort rc AppendRecord()<TD>Append a new record to the end of an open database +<TR><TH ALIGN="LEFT">void AutoLockOn()<TD>Turns on automatic record locking (see locking chapter) +<TR><TH ALIGN="LEFT">void AutoLockOff()<TD>Turns off automatic record locking (see locking chapter) +<TR><TH ALIGN="LEFT">void BlankRecord()<TD>Fill the current record buffer with blanks +<TR><TH ALIGN="LEFT">xbLong csum CalcCheckSum()<TD>Calculate checksum on a data record +<TR><TH ALIGN="LEFT">xbShort rc CloseDatabase()<TD>Close an open database +<TR><TH ALIGN="LEFT">xbShort rc CopyDbfStructure(<br> char * NewFileName,<br> + xbShort OverlaySwitch )<TD>Copies the structure of a xbDbf file to a new file +<TR><TH ALIGN="LEFT">xbShort rc CreateDatabase(<br>char * FileName, + XbSchema *s, xbShort OverlaySwitch )<TD>Close an open database +<TR><TH ALIGN="LEFT">xbULong CurrentRecNo()<TD>Returns the current record number +<TR><TH ALIGN="LEFT">xbShort rc DeleteAllRecords()<TD>Mark all records for deletion +<TR><TH ALIGN="LEFT">xbShort rc DeleteRecord()<TD>Mark a record for deletion +<TR><TH ALIGN="LEFT">xbShort rc DumpHeader(xbShort option)<TD>Display information about a .DBF file header +<TR><TH ALIGN="LEFT">xbShort rc DumpRecord(<br>xbULong RecNo)<TD>Dump a record for a database +<TR><TH ALIGN="LEFT">xbLong cnt FieldCount()<TD>Returns number of fields in database +<TR><TH ALIGN="LEFT">xbLong recno GetCurRecNo()<TD>Returns current record number +<TR><TH ALIGN="LEFT">xbShort rc GetFirstRecord()<TD>Get the first record in the database +<TR><TH ALIGN="LEFT">xbShort rc GetLastRecord()<TD>Get the last record in the database +<TR><TH ALIGN="LEFT">xbShort rc GetNextRecord()<TD>Get the next record in the database +<TR><TH ALIGN="LEFT">xbShort rc GetPrevRecord()<TD>Get the previous record in the database +<TR><TH ALIGN="LEFT">xbShort rc GetRecord(xbLong RecNo)<TD>Get a record by record number from an open database +<TR><TH ALIGN="LEFT">char * buf GetRecordBuf()<TD>Returns a pointer to the record buffer +<TR><TH ALIGN="LEFT">xbLong RecCnt NoOfRecords()<TD>Returns the number of records in an open database +<TR><TH ALIGN="LEFT">xbShort rc OpenDatabase(char * FileName)<TD>Open an existing database +<TR><TH ALIGN="LEFT">xbShort rc PackDatabase(<br>xbShort WaitOption)<TD>Compress file and remove deleted records +<TR><TH ALIGN="LEFT">xbShort rc PutRecord(xbULong RecNo)<TD>Put a record in an open database +<TR><TH ALIGN="LEFT">xbShort rc RebuildAllIndices()<TD>Rebuilds all open indices +<TR><TH ALIGN="LEFT">xbShort dflag RecordDeleted()<TD>Determine if a record has been deleted +<TR><TH ALIGN="LEFT">xbShort version SetVersion(xbShort Ver)<TD>Set version to xbase III+ or IV style xbDbf files +<TR><TH ALIGN="LEFT">xbShort rc UndeleteAllRecords()<TD>Unmark all deleted records +<TR><TH ALIGN="LEFT">xbShort rc UndeleteRecord()<TD>Unmark a deleted record +<TR><TH ALIGN="LEFT">xbShort rc Zap(xbShort WaitOption)<TD>Deletes all records from a database +</TABLE> +<BR><BR><hr> +<h2>Method Definitions</h2> +<hr> +<h3>Method xbShort xbDbf::AppendRecord( void )</h3><br> +This method appends the contents of the database record buffer to the end of +the .DBF file and updates the date and number of records in the header of the +datafile.<br><br> +This method also updates any open indexes associated with the database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Write lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Unsuccessful write operation +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example +of how to use this method. +<hr> +<h3>Method xbShort xbDbf::BlankRecord( void )</h3><br> +This method overlays the database record buffer with space (0x20) +CHARacters. This method is useful for initializing the record buffer.<br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example of +how to use this method. +<hr> + +<h3>Method xbLong xbDbf::CalcCheckSum( void )</h3><br> +This method calculates the checksum of a database record. +<hr> + +<h3>Method xbShort xbDbf::CloseDatabase( void )</h3><br> +This method closes an Xbase (.DBF) file +which was previously opened by CreateDatabase or OpenDatabase +and frees any previously allocated memory which is no LONGer needed.<br><br> +This method automatically closes any open indexes associated with the +database before closing the database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If there is no error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example +of how to use this method. +<hr> + + +<h3>Method xbShort xbDbf::CopyDbfStructure( char *NewFileName, xbShort OverLay )</h3><br> +This method copies the structure of an Xbase (.DBF) file to file <em>NewFileName</em>. +If there are memo fields, they are included. +<br><br> +The <em>OverLay</em> switch is +used to determine what to do if a xbDbf file with the same name +already exists. If <em>OverLay</em> is set to XB_OVERLAY and the file exists, +the file is overwritten, otherwise an error is returned.<br><br> +<em>Overlay Switch</em> is:<br> +<li>XB_OVERLAY = Overlay file if it exists<br> +<li>XB_DONTOVERLAY = Return with error if file exists<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_FILE_EXISTS<TD>If a file exists and OverLay switch = FALSE +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Couldn't open the file +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory allocation error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Couldn't write to disk +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/copydbf.cpp">copydbf.cpp</A> for an example +of how to use this method. +<hr> + + +<h3>Method: xbShort xbDbf::CreateDatabase( char *FileName, + xbSchema *s, xbShort OverLay )</h3><br> +This method creates an Xbase (.DBF) file with the name +of FileName and builds the header record with the format as +defined in the <em>xbSchema</em> parameter. The <em>OverLay</em> switch is +used to determine what to do if a xbDbf file with the same name +already exists. If <em>OverLay</em> is set to XB_OVERLAY and the file exists, +the file is overwritten, otherwise an error is returned.<br><br> +<em>Overlay Switch</em> is:<br> +<li>XB_OVERLAY = Overlay file if it exists<br> +<li>XB_DONTOVERLAY = Return with error if file exists<br><br> +<em>xbSchema</em> has the following format:<br> +<xmp> +xbSchema MyRecordSchema[] = +{ + { FieldName, Type, FieldLength, NoOfDecimals }, + { FieldName2, Type, FieldLength, NoOfDecimals }, + ... + { "",0,0,0 } +}; +</xmp> +Where:<br> +<li><em>FieldName</em> is the name of the data field.<br> +<li><em>Type</em><br><br> +<h4>Version 1.7.4 and greater:</h4> +XB_CHAR_FLD or C<br> +XB_DATE_FLD or D<br> +XB_LOGICAL_FLD or L<br> +XB_MEMO_FLD or M<br> +XB_FLOAT_FLD or F<br> +XB_NUMERIC_FLD or N<br><br> +<li><em>FieldLength</em> is the length of the field.<br> +<li><em>NoOfDecimals</em> is the number of decimals for NUMERIC fields.<br> +<br> +The record buffer is automatically set to spaces when this method is called. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_FILE_EXISTS<TD>If a file exists and OverLay switch = FALSE +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Couldn't open the file +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory allocation error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Couldn't write to disk +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an example +of how to use this method. +<hr> +<h3>Method xbULong xbDbf::CurrentRecNo( void )</h3><br> +This method returns the current record number.<br><br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/dumprecs.cpp">dumprecs.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::DeleteAllRecords( void )</h3><br> +This method marks all unmarked records in the database for deletion.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Could not mark record +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/deletall.cpp">deletall.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::DeleteRecord( void )</h3><br> +This method marks the current record for deletion in the database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Could not mark record +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::DumpHeader( xbShort Option )</h3><br> +This method displays information about a .DBF file header to stdout. +This method is only available if the DEBUG option is turned on in the +<em>options.h</em> file<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Options</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Option<TD>Action +<TR><TH ALIGN="LEFT">1<TD>Print Header Only +<TR><TH ALIGN="LEFT">2<TD>Field Data Only +<TR><TH ALIGN="LEFT">3<TD>Header and Field Data +</TABLE> +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_OPTION<TD>Option must be 1,2 or 3 +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>File is not open +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +</TABLE> +<br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/dumphdr.cpp">dumphdr.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::DumpRecord( xbULong RecNo )</h3><br> +This method dumps record RecNo for the database to stdout.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record for RecNo parameter +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/dumprecs.cpp">dumprecs.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbLong xbDbf::FieldCount( void )</h3><br> +This method returns the number of fields defined in the database. +<br><br> +<hr> +<h3>Method xbLong xbDbf::GetCurRecNo( void )</h3><br> +This method returns the current record number of the record in the record buffer. +<br><br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetFirstRecord( void )</h3><br> +This method loads the first record of the file into the record buffer.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Unsuccessful lock operation +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetLastRecord( void )</h3><br> + +This method loads the last record of the file into the record buffer.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_EOF<TD>At end of file +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an example +of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetNextRecord( void )</h3><br> + +This method loads the next record of the file into the record buffer.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_EOF<TD>At end of file +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetPrevRecord( void )</h3><br> + +This method loads the previous record of the file into the record buffer.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_BOF<TD>At beginning of file +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::GetRecord( xbLong RecNo )</h3><br> +This method retrieves record RecNo from the database into the record buffer. +<br><br> +This method will call the PutRec method and flush all updates to disk if +necessary before moving to the specified record. If PutRecord is not +successful, this method will return the return code from PutRecord.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method char * xbDbf::GetRecordBuf( void )</h3><br> +This method returns a pointer to the record buffer. +<br><br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbLong xbDbf::NoOfRecords( void )</h3><br> +This method returns the number of records in the file.<br><br> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::OpenDatabase( char * FileName )</h3><br> +This method opens an Xbase (.DBF) file with the name +of FileName. <em>FileName</em> must a valid filename which can include +drives identifier, directory, filename and extension. <br><br> +The OpenDatabase method does not position to any any particular +data record. After opening a database, use GetRecord, GetFirstRecord +or GetLastRecord to position to a particular data record and load +a data record into the record buffer.<br><br> +The record buffer is automatically set to spaces when this method is called. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Couldn't open the file +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory allocation error +<TR><TH ALIGN="LEFT">XB_NOT_XBASE<TD>Not an xbXBase type file +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::PackDatabase( xbShort WaitOption )</h3><br> +This method removes all records marked for deletion from an Xbase (.DBF) file +and reindexes any open index files. This method also reorganizes any memo +fields stored in a .DBT memo file. +<br><br> +<em>WaitOption</em> is one of:<br><br> +<li>F_SETLK - returns if the xbDbf file can not be exclusively locked +<li>F_SETLKW - will wait to execute until it can exclusively lock the file +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_CLOSE_ERROR<TD>If intermediate work file can not be closed +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open file +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory allocation error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Error writing to file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Can not lock file or index +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/packdbf.cpp">packdbf.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::PutRecord( xbLong RecNo )</h3><br> +This method copies the record buffer into record <em>RecNo</em> in the database. +This method can be used for updating records which were retrieved by +the GetRecord method.<br><br> +This method updates any open index files.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Write lock not successful +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>Database is not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek operation failed +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write operation failed +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::RebuildAllIndicis( void )</h3><br> +This method rebuilds all opened indicis for the database file.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Error writing data +<TR><TH ALIGN="LEFT">XB_CLOSE_ERROR<TD>Error closing work file +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/reindex.cpp">reindex.cpp</A> for an +example of how to use this method. +<hr> + + + +<h3>Method xbShort xbDbf::RecordDeleted( void )</h3><br> +This method returns TRUE (or 1) if a record is marked for deletion and +returns FALSE (or 0) if the record is not marked for deletion. <br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">TRUE (1)<TD>Record is marked for deletion +<TR><TH ALIGN="LEFT">FALSE (0)<TD>Record is not marked for deletion +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an +example of how to use this method. +<hr> + + +<h3>Method xbShort xbDbf::SetVersion( xbShort Vswitch )</h3><br> + +This method sets the version of xbDbf and DBT database files and memo files +to be created using the CreateDatabase method. The default setting is +3 - dBASE III+ version files. It can be set to 4 - for dBASE IV style +files.<br><br> +Vswitch is one of:<br> +0 - return current setting<br> +3 - Set to create version III files (default)<br> +4 - Set to create version IV files<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>Setting updated +<TR><TH ALIGN="LEFT">3 or 4<TD>If Vswitch = 0, it returns current version setting +<TR><TH ALIGN="LEFT">XB_INVALID_OPTION<TD>Vswictch not one of 0,3 or 4 +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an +example of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::UndeleteAllRecords( void )</h3><br> +This method unmarks all marked for deletion records in the database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Could not mark record +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>If the file is not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/undelall.cpp">undelall.cpp</A> for an example +of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::UndeleteRecord( void )</h3><br> +This method removes the mark for deletion on the current record in the +database.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Could not unmark record +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an +example of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::Zap( xbShort WaitOption )</h3><br> +This method removes all records from a database and any open indices. +<br><br> +<em>WaitOption</em> is one of:<br><br> +<li>F_SETLK - returns if the xbDbf file can not be exclusively locked +<li>F_SETLKW - will wait to execute until it can exclusively lock the file +<br><br> +<TABLE BORDER> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No error encountered +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Could not lock file +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Could not write to file +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open temp database +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/zap.cpp">zap.cpp</A> for an +example of how to use this method. +<hr> + +<p><img src="xbase.jpg"><br><hr> +</BODY> +</xbHtml> diff --git a/html/xbc13.htm b/html/xbc13.htm new file mode 100755 index 0000000..e085157 --- /dev/null +++ b/html/xbc13.htm @@ -0,0 +1,470 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 13</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Field Methods</p></H1> +<p align="center">Chapter Updated 2/1/99</p><hr> + +This chapter lists the field methods and provides examples of how to use +them.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Field Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">xbLong cnt FieldCount()<TD>Returns the number of fields + in the file +<TR><TH ALIGN="LEFT">xbDouble d GetDoubleField(char * FieldName)<TD>Returns a xbDouble field for field name +<TR><TH ALIGN="LEFT">xbDouble d GetDoubleField(xbShort FieldNo)<TD>Returns a xbDouble field for field number +<TR><TH ALIGN="LEFT">xbShort rc GetField(xbShort,char *buf)<TD>Gets field data from the record buffer +<TR><TH ALIGN="LEFT">xbShort d GetFieldDecimal(xbShort FieldNo)<TD>Gets field decimal count +<TR><TH ALIGN="LEFT">xbShort len GetFieldLen(xbShort FieldNo)<TD>Returns the length of a given field +<TR><TH ALIGN="LEFT">char * name GetFieldName(xbShort FieldNo)<TD>Returns field name for field number +<TR><TH ALIGN="LEFT">xbShort FieldNo GetFieldNo(char * FieldName)<TD>Returns the field ID number for a given field +<TR><TH ALIGN="LEFT">char type GetFieldType(xbShort FieldNo)<TD>Returns the type of a given field +<TR><TH ALIGN="LEFT">xbFloat f GetFloatField(char * FieldName)<TD>Returns a float field for field name +<TR><TH ALIGN="LEFT">xbFloat f GetFloatField(xbShort FieldNo)<TD>Returns a float field for field number +<TR><TH ALIGN="LEFT">xbShort l GetLogicalField(xbShort FieldNo)<TD>Returns logical field data +<TR><TH ALIGN="LEFT">xbShort l GetLogicalField(char * FieldName)<TD>Returns logical field data +<TR><TH ALIGN="LEFT">xbLong l GetLongField(char * FieldName)<TD>Returns a long field for field name +<TR><TH ALIGN="LEFT">xbLong l GetLongField(xbShort FieldNo)<TD>Returns a long field for field number +<TR><TH ALIGN="LEFT">xbShort rc GetMemoField(xbShort FieldNo,<br>xbLong len,char * buf)<TD>Get memo field data +<TR><TH ALIGN="LEFT">xbLong len GetMemoFieldLen(xbShort FieldNo)<TD>Get memo field data length +<TR><TH ALIGN="LEFT">xbShort s MemoFieldsPresent()<TD>Determine if memo fields exist in DBF file +<TR><TH ALIGN="LEFT">xbShort s MemoFieldExists(xbShort FieldNo)<TD>Determine if a particular memo field has data +<TR><TH ALIGN="LEFT">xbShort rc PutDoubleField(char * FieldName,<br>xbDouble d)<TD>Updates a xbDouble field for field name +<TR><TH ALIGN="LEFT">xbShort rc PutDoubleField(xbShort FieldNo,<br>xbDouble d)<TD>Updates a xbDouble field for field number +<TR><TH ALIGN="LEFT">xbShort rc PutField(xbShort FieldNo,char * val)<TD>Fills or overlays a field in the current record buffer +</TABLE> + +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase Field Method List (cont)</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">xbShort rc PutFloatField(char * FieldName,<br>xbFloat f)<TD>Updates a float field for field name +<TR><TH ALIGN="LEFT">xbShort rc PutFloatField(xbShort FieldNo,<br>xbFloat f)<TD>Updates a float field for field number +<TR><TH ALIGN="LEFT">xbShort rc PutLongField(char * FieldName,<br>xbLong l)<TD>Updates a long field for field name +<TR><TH ALIGN="LEFT">xbShort rc PutLongField(xbShort FieldNo,<br>xbLong l)<TD>Updates a long field for field number +<TR><TH ALIGN="LEFT">xbShort rc UpdateMemoData(xbShort FieldNo,<br>xbLong len,char * buf, +xbShort LockOpt)<TD>Update memo field data +<TR><TH ALIGN="LEFT">xbShort l ValidLogicalData( char * buf )<TD>Check for valid logical data +<TR><TH ALIGN="LEFT">xbShort l ValidNumericData( char * buf )<TD>Check for valid numeric data +</TABLE> +<BR><BR> + +<hr> +<h2>Method Definitions</h2> +<hr> + +<h3>Method xbLong xbDbf::FieldCount( void )</h3><br> +This method returns the number of fields which exist in the database. +<br><br> +<h4>Method Return Codes</h4><br> +If successful, this method returns the number of fields in the database. +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> + +<h3>Method xbDouble xbDbf::GetxbDoubleField( char * FieldNo )</h3><br> +This method returns a xbDouble value for field FieldNo. Fieldno can be retrieved +by using method GetFieldNo. +<br><br> +<hr> + +<h3>Method xbDouble xbDbf::GetxbDoubleField( char * FieldName )</h3><br> +This method returns a xbDouble value for field FieldName. If multiple accesses +for this particular field will be made from within the program, it is more +efficient to access the data utlizing the field's number, rather than its name. +<br><br> + +<hr> +<h3>Method xbShort xbDbf::GetField( xbShort FieldNo, char * buf )</h3><br> + +This method fills an application program supplied buffer *buf with data +from the record buffer for field number FieldNo. FieldNo can be retrieved +by using method GetFieldNo.<br><br> + +It is the responsibility of the application program to verify the buffer is +large enough to hold the data. No checking is done by method GetField to +verify the buffer is large enough to hold the data.<br><br> +If successful, this method returns the length of the field in bytes. + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::GetFieldDecimal( xbShort FieldNo )</h3><br> + +This method returns the decimal count of field FieldNo. FieldNo can be retrieved +by using method GetFieldNo.<br><br> +If successful, this method returns the decimal count. + +<hr> +<h3>Method xbShort xbDbf::GetFieldLen( xbShort FieldNo )</h3><br> + +This method returns the length of field FieldNo. FieldNo can be retrieved +by using method GetFieldNo.<br><br> +If successful, this method returns the length of the field in bytes. + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method char * xbDbf::GetFieldName( xbShort FieldNo )</h3><br> + +This method returns a pointer to the name of field FieldNo. FieldNo can be retrieved +by using method GetFieldNo.<br><br> +If successful, this method returns the field name.<br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for an example +of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::GetFieldNo( char * FieldName )</h3><br> + +This method is used to get a field's ID number based on paramater +FieldName. Where FieldName is a valid name of a field in the database.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">-1<TD>Field not found in record +<TR><TH ALIGN="LEFT">0 through n<TD>The field number for field FieldName +</TABLE> +<br><br> +<h4>Example Program:</h4> + +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example +of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::GetFieldType( xbShort FieldNo )</h3><br> + +This method returns the type of field FieldNo. FieldNo can be retrieved +by using method GetFieldNo.<br><br> + +<h4>Method Return Codes</h4><br> +If successful, this method returns the field type.<br> +C = character<br> +D = Date<br> +L = Logical<br> +M = Memo<br> +N = Numeric<br> +F = Float<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an example +of how to use this method. +<hr> + +<h3>Method xbFloat xbDbf::GetFloatField( char * FieldName )</h3><br> + +This method returns a float value for field FieldName. If multiple accesses +for this particular field will be made from within the program, it is more +efficient to access the data utlizing the field's number, rather than its name. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbFloat xbDbf::GetFloatField( xbShort * FieldNo )</h3><br> + +This method returns a float value for field number FieldNo. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample3.cpp">sample3.cpp</A> for an +example of how to use this method. +<hr> + + +<h3>Method xbShort xbDbf::GetLogicalField( xbShort FieldNo )</h3><br> + +<h3>Method xbShort xbDbf::GetLogicalField( char * FieldName )</h3><br> + +This method returns -1 if field <em>FieldName</em> or <em>FieldNo</em> is not +a logical field. +It returns 1 if field <em>FieldName</em> is a 'T','t','Y' or 'y'. It returns +0 if not 'T','t','Y' or 'y'. +<br> +<hr> +<h3>Method xbLong xbDbf::GetLongField( xbShort * FieldNo )</h3><br> + +<h3>Method xbLong xbDbf::GetLongField( char * FieldName )</h3><br> + +This method returns a long value for field FieldName. If multiple accesses +for this particular field will be made from within the program, it is more +efficient to access the data utlizing the field's number, rather than its name. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/zips/zipinit.cpp">zipinit.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbLong xbDbf::GetLongField( xbShort * FieldNo )</h3><br> + +This method returns a long value for field FieldNo. FieldNo can be +determined by utilizing method GetFieldNo. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/zips/zipinq.cpp">zipinq.cpp</A> for an +example of how to use this method. + + + +<hr> +<h3>Method xbShort xbDbf::GetMemoField( xbShort FieldNo, xbLong len, char * Buf, xbShort LockOption )</h3><br> + +This method returns <em>Len</em> bytes of memo field <em>FieldNo</em>. <em>Buf</em> +is a user supplied buffer large enough to contain the data. No checking +of the field's size is performed by this method.<br><br> + + +<em>Lock Option</em>is one of:<br> + +F_SETLK - return immediately if lock fails<br> +F_SETLKW - wait until lock function executes<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_NOT_MEMO_FIELD<TD>Not a memo field +<TR><TH ALIGN="LEFT">XB_NO_MEMO_DATA<TD>No memo data exists +<TR><TH ALIGN="LEFT">XB_INVALID_BLOCK_NO<TD>Internal error, notify tech support +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No Error +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for +an example of how to use this method. + +<hr> +<h3>Method xbLong xbDbf::GetMemoFieldLen( xbShort FieldNo )</h3><br> + +This method returns the length of memo field FieldNo. FieldNo can be +retrieved by using method GetFieldNo.<br><br> +If successful, this method returns the length of the memo field in bytes. + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for +an example of how to use this method. + +<hr> + +<h3>Method xbShort xbDbf::MemoFieldExists( xbShort FieldNo )</h3><br> + +This method returns true (1) if field FieldNo has any memo data. Otherwise +it returns false (0). +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">0<TD>Data file does not have any memo fields +<TR><TH ALIGN="LEFT">1<TD>Data file has memo fields +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for an +example of how to use this method. + +<hr> + +<h3>Method xbShort xbDbf::MemoFieldsPresent( void )</h3><br> + +This method returns true (1) if the file has any memo fields. Otherwise +it returns false (0). +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">0<TD>Data file does not have any memo fields +<TR><TH ALIGN="LEFT">1<TD>Data file has memo fields +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/dumpdbt.cpp">dumpdbt.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbShort xbDbf::PutxbDoubleField( char * FieldName, xbDouble d )</h3><br> + +This method puts a xbDouble value d for field FieldName. If multiple accesses +for this particular field will be made from within the program, it is more +efficient to access the data utlizing the field's number. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br><hr> +<h3>Method xbShort xbDbf::PutxbDoubleField( xbShort FieldNo, xbDouble d )</h3><br> +This method puts a xbDouble value d for field FieldNo. +<br><br> +<h3>Method Return Codes</h3> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br> + +<hr> +<h3>Method xbShort xbDbf::PutField( xbShort FieldNo, char * buf )</h3><br> + +This method fills field number FieldNo, with the data from buffer *buf.<br><br> +It copies data from *buf until a 0x00 character is encountered or the buffer +is filled. The field will be truncated if it is to long.<br><br> +Use method GetFieldNo to determine the value for FieldNo.<br><br> +If the field is type N or F, the field is loaded right justified, left blank +filled onto the record buffer.<br><br> +This method does check the validity of NUMERIC and LOGICAL data it is loading onto the +record buffer. Ther can be no spaces or non-numeric data for numeric fields.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an example +of how to use this method. +<hr> + +<h3>Method xbShort xbDbf::PutFloatField( char * FieldName, FLOAT f )</h3><br> + +This method puts a float value f for field FieldName. If multiple accesses +for this particular field will be made from within the program, it is more +efficient to access the data utlizing the field's number. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::PutFloatField( xbShort FieldNo, FLOAT f )</h3><br> +This method puts a float value f for field number FieldNo. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_FIELDNO<TD>An invalid field number was used +<TR><TH ALIGN="LEFT">XB_INVALID_DATA<TD>Attempt to load invalid numeric or logical data +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbLong xbDbf::PutLongField( char * FieldName, xbLong Val )</h3><br> +This method puts a long value Val for field FieldName. If multiple accesses +for this particular field will be made from within the program, it is more +efficient to access the data utlizing the field's number. +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/zips/zipinit.cpp">zipinit.cpp</A> for an +example of how to use this method. + +<hr> +<h3>Method xbLong xbDbf::PutLongField( xbShort FieldNo, xbLong Val )</h3><br> +This method puts a long value Val for field FieldNo. FieldNo can be determined +by utilizing method GetFieldNo. +<br><br> + +<h4>Example Program:</h4> +See sample program <A HREF="/zips/zipinq.cpp">zipinq.cpp</A> for an +example of how to use this method. +<hr> +<h3>Method xbShort xbDbf::UpdateMemoData( xbShort FieldNo, xbLong len, + char * Buf, xbShort LockOption )</h3><br> +This method updates field <em>FieldNo</em> with <em>Len</em> bytes of +data from <em>Buf</em>.<br><br> +This is the only routine necessary to add, revise or delete memo field +data. To delete a memo field, set the length to zero (0L).<br><br> + +<em>LockOption</em> is one of<br> +<li>F_SETLK - return immediately if lock fails +<li>F_SETLKW - wait until lock function executes +<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Lock Failed +<TR><TH ALIGN="LEFT">XB_INVALID_BLOCK_NO<TD>Internal error, notify tech support +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Disk Error +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>No Error +</TABLE> +<br><br> +<h4>Example Program:</h4> +See sample program <A HREF="/XbaseSamples/sample2.cpp">sample2.cpp</A> for +an example of how to use this method. +<hr> + + + +<h3>Method xbShort xbDbf::ValidLogicalData( char * data )</h3><br> + +This method returns true if <em>data</em> contains a valid logical data value. +Otherwise, it returns false. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">1<TD>Valid logical data +<TR><TH ALIGN="LEFT">0<TD>Invalid logical data +</TABLE> +<br> +<hr> + +<h3>Method xbShort xbDbf::ValidNumericData( char * data )</h3><br> +This method returns true if <em>data</em> contains a valid numeric data value. +Otherwise, it returns false. +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">1<TD>Valid numeric data +<TR><TH ALIGN="LEFT">0<TD>Invalid numeric data +</TABLE> +<br> +<hr> + +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc14.htm b/html/xbc14.htm new file mode 100755 index 0000000..032b57f --- /dev/null +++ b/html/xbc14.htm @@ -0,0 +1,200 @@ +<!DOCTYPE HTML PUBLIC> +<html> +<title>Base DBMS Chapter 14</title> +<body bgcolor=#FFFFFF> +<h1><p align="center">xbString Methods</p></h1> +<p align="center">Chapter Updated 8/20/03</p><hr> +<h2>This table lists the xbString methods.</h2><br><br> +<table border> +<caption align=top><h3>xbString Method List API</h3></caption> +<tr valign=baseline> +<tr><th align=left>Method<td>Description +<tr><th align=left>xbString()<td>Class Constructor +<tr><th align=left>xbString(size_t size)<td>Constructor, allocates space of size +<tr><th align=left>xbString(char c)<td>Constructor, initialized to char c +<tr><th align=left>xbString(const char *s)<td>Constructor, initialized to string s +<tr><th align=left>xbString(const char *s, size_t maxlen<td> +Constructor, initialized to string s, with minimal string buf size of max_len +<tr><th align=left>xbString(const xbString &s)<td>Constructor, initialized to string s +<tr><th align=left>~xbString()<td>Class Destructor +<tr><th align=left>const char operator*()<td>Returns data +<tr><th align=left>char operator[](int n)<td>Returns char in position n +<tr><th align=left>xbString &operator=(const xbString &s)<br> + xbString &operator=(const char *s)<br>xbString &operator=(char c) + <td>Set string to <em>s</em> or <em>c</em>. +<tr><th align=left>xbString &operator+=(const char *s)<br> +xbSting &operator+=(char c)<td>Concatonate data to string +<tr><th align=left>xbString &operator-=(const char *s)<br> +xbSting &operator+=(char c)<td>Concatonate data and eliminate spaces between +strings. +<tr><th align=left>bool operator==(const xbString &)<td> +Compare string == +<tr><th align=left>bool operator!=(const xbString &)<td> +Compare string != +<tr><th align=left>bool operator<(const xbString &s)<td> +Compare string < +<tr><th align=left>bool operator>(const xbString &s)<td> +Compare string > +<tr><th align=left>bool operator<=(const xbString &s)<td> +Compare string <= +<tr><th align=left>bool operator<=(const xbString &s)<td> +Compare string >= +<tr><th align=left>xbString addBackSlash( char c )<td>Prefixes all +char <em>c</em> with a backslash. +<tr><th align=left>xbString& assign(const xbString& str, size_t pos = 0, +int len = 1)<td>Assign data in <em>str</em> starting at position <em>pos</em> +for a length of <em>len</em> and return a reference. +<tr><th align=left>xbString& assign(const xbString& str, int len )<td> +Assign data in <em>str</em> for a length of <em>len</em> and return a reference. +<tr><th align=left>xbString copy() const<td>Used to copy a string +<tr><th align=left>const char * c_str() const<td>Returns the string or NULL +if string is null. Depreciated function. +<tr><th align=left>int countChar( char c ) const<td>Returns the count +of char <em>c</em>. +<tr><th align=left>int cvtHexChar( char & out )<td>Converts a four byte +string in the format of 0x00 to a one byte char value <em>out</em>. Returns +0 on success, -1 on error. +<tr><th align=left>int cvtHexString( zbString & out )<td>Converts a +string of four byte groupings in the format of 0x00 to a string of one byte +characters <em>out</em>. Returns 0 on success, -1 on error. +<tr><th align=left>char getCharacter( int n ) const<td>Returns the character +as position <em>n</em>. +<tr><th align=left>const char *getdata() const<td>Returns the string +<tr><th align=left>bool hasAlphaChars() const<td>Returns true is string +contains any alpha characters, otherwise returns false. +<tr><th align=left>bool isEmpty() const<td>Returns true if the string has +no memory allocated, or memory allocated is a zero byte string, otherwise +returns false +<tr><th align=left>bool isNull() const<td>Returns true if the string +has no memory allocated for the string, otherwise returns false +<tr><th align=left>size_t len() const<br>size_t length() const +<td>Returns length of string. It does not include the null terminating byte. +<tr><th align=left>xbString mid( size_t pos, int len )<td>Pull a string of +data out of another string of data, starting at position <em>pos</em> for a +length of <em>len</em>. +<tr><th align=left>void ltrunc( size_t cnt )<td>Left truncate the string +<em>cnt</em> bytes. +<tr><th align=left>int pos(char c)<td>Locate character in string +<tr><th align=left>int pos(const char *s)<td>Locate string <em>s</em> in string +<tr><th align=left>void swapChars(char from, char to)<td>Swap character +<em>from</em> to character <em>to</em>. +<tr><th align=left>void putAt(size_t pos, char c)<td>Put character c at position pos +<tr><th align=left>void remove( size_t pos = 0, int len )<td>Remove data +from the string to starting at <em>pos</em> for a lenght of <em>len</em>. +<tr><th align=left>void setNum(long num)<td>This method sets the string +to the numeric value <em>num</em>. +<tr><th align=left>xbString &sprintf(const char * format, ... )<td> +Used to format a string. See the standard C printf function for formatting +details. Internal 256 byte buffer which can be overflowed. +<tr><th align=left>void toLowerCase()<td>Converts string to lower case +<tr><th align=left>void toUpperCase()<td>Converts string to upper case +<tr><th align=left>void trim()<td>trim trailing spaces +<tr><th align=left>void zapChar( char c )<td>Remove all instances of +<em>c</em> from the string. +<tr><th align=left>void zapLeadingChar( char c )<td>Left truncate all +of <em>c</em> from the string. +<tr><th align=left> + xbString operator-(const xbString &s1, const xbString &s2) +<td>Concatonate two strings together, eliminate spaces +<tr><th align=left> + xbString operator+(const xbString &s1, const xbString &s2)<br> + xbString operator+(const xbString &s1, const char *s2)<br> + xbString operator+(const char *s1, const xbString &s2)<br> + xbString operator+(const xbString &s1, char c2)<br> + xbString operator+(char c1, const xbString &s2)<td>Concatonate two + strings together +<tr><th align=left>bool operator==(const xbString &, const char *)<td> +Compare string == +<tr><th align=left>bool operator!=(const xbString &, const char *)<td> +Compare string != +</table><br><br><br> +<h2>Sample program</h2> +<xmp> + +/* string.cpp + + Xbase project source code + + This program demonstrates the usage of the xbString class + + Copyright (C) 1997 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Mail: + + Technology Associates, Inc. + XBase Project + 1455 Deming Way #11 + Sparks, NV 89434 + USA + + Email: + + xbase@techass.com + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + Website: + + xdb.sourceforge.net + +*/ + + +#include <xbase/xbase.h> + +int main() +{ + xbString s1; + xbString s2; + + s1 = "Some string data"; + s2 = "some more string data"; + + std::cout << "s1 => " << s1 << std::endl; + std::cout << "s2 => " << s2 << std::endl; + + + s1 = "s1 "; + s2 = "s2"; + s1 -= s2; + + std::cout << "-= operator => " << s1 << std::endl; + + s1 = "s1 "; + s2 = "s2"; + s1 += s2; + + std::cout << "+= operator => " << s1 << std::endl; + + s1 = "some data"; + s2 = s1.mid( 2, 3 ); + std::cout << "mid() = " << s2 << std::endl; + + return 0; +} + + + +</xmp> + + +<br><hr> +<p><img src="xbase.jpg"><br><hr> +</body> +</html> diff --git a/html/xbc15.htm b/html/xbc15.htm new file mode 100755 index 0000000..de01ec4 --- /dev/null +++ b/html/xbc15.htm @@ -0,0 +1,338 @@ +<!DOCTYPE HTML PUBLIC> +<html> +<title>Xbase DBMS Chapter 15</title> +<body bgcolor=#FFFFFF> +<h1><p align="center">xbDate Methods</p></h1> +<p align="center">Chapter Updated 8/21/03</p><hr><br> + +This chapter lists the xbDate methods and provides an example program to demonstrate usage.<br> +Xbase .DBF files and the xbDate class handle dates in the format of CCYYMMDD (Date8).<br><br><br> + +<center> +<table border> +<caption align=top><h3>xbDate Method List API</h3></caption> + +<tr><th align=left>Method<td>Description + +<tr><th align=left>xbDate( const char * Date8 )<br>xbDate( const xbString & Date8 )<br>xbDate() + <td>Class constructors. If no date provided, or invalid date provided, date is set to Sysdate(). + +<tr><th align=left>~xbDate()<td>Class destructor + +<tr><th align=left>xbString & CharDayOf( const char *Date8 )<br> + xbString & CharDayOf( const xbString & Date8 )<br>xbString & CharDayOf() + <td>Returns <em>Sun - Sat</em> day of week for a given date + +<tr><th align=left>xbString & CharMonthOf( const char *Date8 )<br>xbString & CharMonthOf( const xbString & Date8 )<br> + xbString & CharMonthOf()<td>Returns <em>Jan - Dec</em> month of year for a given date + +<tr><th align=left>int DateIsValid( const char *Date8 ) const<br>int DateIsValid( const xbString & Date8 ) const + <td>Checks a date for validity, returns true (1) if date is valid + +<tr><th align=left>int DayOf( int Format, const char *Date8 ) const<br>int DayOf( int Format, const xbString &Date8 ) const<br> + int DayOf( int Format ) const<td>Returns day of WEEK, MONTH or YEAR from a given date where <em>Format</em> is one of<br> + <em>XB_FMT_WEEK</em> => Number of day in week 0-6 (sun-Sat)<br> + <em>XB_FMT_MONTH</em> => Number of day in month 1-31<br> + <em>XB_FMT_YEAR</em> => Number of day in year 1-366 + +<tr><th align=left>xbString & Formatdate( const char * Format, const char * Date8 )<br> + xbString & FormatDate( const xbString & Format, const char * Date8 )<br> + xbString & FormatDate( const char * Format, const xbString & Date8 )<br> + xbString & FormatDate( const xbString & Format, const xbString & Date8 )<br> + xbString & FormatDate( const xbString & Format )<br> + xbString & FormatDate( const char * )<br> + + <td>Return a formatted date.<br> + + Format - A format specifier with the following paramaters:<br> + + 1) YYDDD - A julian date format<br> + + 2) YY or YYYY will print a 2 or 4 digit year<br> + + 3) M,MM,MMM or MMMM<br> + + M - one digit month if no leading zero<br> + MM - two digit month, contains leading zero<br> + MMM - Jan through Dec<br> + MMMM - January through December<br> + + 4) D,DD,DDD or DDDD<br> + + D - one digit dayif no leading zero<br> + DD - two digit day, contains leading zero <br> + DDD - Sun through Sat (or julian if YYDDD)<br> + DDDD - Sunday through Saturday<br> + + +<tr><th align=left>const xbString & GetDate() const<br>xbString & GetDate()<td>Return date + +<tr><th align=left>const xbString & GetFormattedDate() const<br>xbString & GetFormattedDate()<td> + Returns formatted date. See notes on format paramaters. + +<tr><th align=left>int IsLeapYear( const char *Date8 ) const<br>int IsLeapYear( const xbString &Date8 ) const<br> + int IsLeapYear() const<td>Returns true if given date is a leap year + +<tr><th align=left>long JulianDays( const char *Date8 ) const<br>long JulianDays( const xbString & Date8 ) const<br> + long JulianDays() const<td>Returns number of days since 1/1/0100 to given date + +<tr><th align=left>xbString & JulToDate8( long )<td>Converts julian based date to CCYYMMDD format. + +<tr><th align=left>xbString & LastdayOfMonth( const char *Date8 )<br>xbString & LastDayOfMonth( const xbString & Date8 )<br> + xbString & LastDayOfMonth()<td>Returns the Date8 format of the last day of the month for a given date + +<tr><th align=left>int MonthOf( const char *Date8 ) const<br>int MonthOf( const xbString &Date8) const<br> +int MonthOf() const<td>Returns month of a date + +<tr><th align=left>int SetDate( const char * Date8 )<br>int SetDate( const xbString & Date8 )<td> + Sets the xbDate to <em>Date8</em>. Return 1 on success, 0 on error. + + +<tr><th align=left>xbString & Sysdate()<td>This method sets the class date and returns the system date + +<tr><th align=left>int YearOf( const char *Date8 ) const<br>int YearOf( const xbString &Date8 ) const<br> +int YearOf() const<td>Returns century and year of a date + +<tr><th align=left>xbString &operator+=( int )<td>+= operator +<tr><th align=left>xbString &operator-=( int )<td>-= operator +<tr><th align=left>xbString &operator++( int )<td>++ operator +<tr><th align=left>xbString &operator--( int )<td>-- operator +<tr><th align=left>xbString &operator+( int )<td>+ operator +<tr><th align=left>xbString &operator-( int )<td>- operator +<tr><th align=left>long operator-( const xbDate & ) const<td>- operator +<tr><th align=left>int operator==( const xbDate & ) const<td>== operator +<tr><th align=left>int operator!=( const xbDate & ) const<td>!= operator +<tr><th align=left>int operator<( const xbDate & ) const<td>< operator +<tr><th align=left>int operator>( const xbDate & ) const<td>> operator +<tr><th align=left>int operator<=( const xbDate & ) const<td><= operator +<tr><th align=left>int operator>=( const xbDate & ) const<td>>= operator + +</table></center> +<br><br><br> + +<h2>Sample program</h2><br> +The source for this program is in the libtest directory. <br><br> + +<xmp> + Xbase project source code + + This program tests the xdate routines + + Copyright (C) 1997 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Mail: + + Technology Associates, Inc. + XBase Project + 1455 Deming Way #11 + Sparks, NV 89434 + USA + + Email: + + xbase@techass.com + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + Website: + + xdb.sourceforge.net + + + This program tests and demonstrates usage of the various xbDate methods + + Several of the tests pass either StringDate or Chardate to the method + being tested - this is done to test the class methods. In actual usage, + this may not be necessary due to the instance of the class already + containing a date value. +*/ + +#include "xbase.h" + +int main() +{ + xbString StringDate( "19601007" ); /* oct 7 1960 */ + char CharDate[9] = "19611109"; /* nov 9 1961 */ + + xbDate d1; /* today is default */ + xbDate d2( StringDate ); /* from string data */ + xbDate d3( CharDate ); /* from char data */ + xbDate d4; /* another date class */ + + std::cout << "This program tests the XDATE routines" << std::endl; + std::cout << "Date 1 (Sysdate) is " << d1.GetDate() << std::endl; + std::cout << "Date 2 (StringDate) is " << d2.GetDate() << std::endl; + std::cout << "Date 3 (CharDate) is " << d3.GetDate() << std::endl; + + std::cout << "This year is " << d1.YearOf() << std::endl; + std::cout << "Year of xbString Date is " << d2.YearOf( StringDate ) + << std::endl; + std::cout << "Year of char Date is " << d3.YearOf( CharDate ) + << std::endl; + + std::cout << "This Month is " << d1.MonthOf() << std::endl; + std::cout << "Month of xbString Date is " << d2.MonthOf( StringDate ) + << std::endl; + std::cout << "Month of char Date is " << d3.MonthOf( CharDate ) + << std::endl; + + std::cout << "Today is day " << d1.DayOf( XB_FMT_WEEK ) << " of the week" + << std::endl; + std::cout << "StringDate is day " << d2.DayOf( XB_FMT_MONTH, StringDate ) + << " of the month" << std::endl; + std::cout << "CharDate is day " << d3.DayOf( XB_FMT_YEAR, CharDate ) + << " of the year" << std::endl; + + if( d1.IsLeapYear()) + std::cout << "This is a leapyear" << std::endl; + else + std::cout << "This is not a leap year." << std::endl; + + if( d2.IsLeapYear( StringDate )) + std::cout << "StringDate is a leapyear" << std::endl; + else + std::cout << "StringDate is not a leap year." << std::endl; + + if( d3.IsLeapYear( CharDate )) + std::cout << "CharDate is a leapyear" << std::endl; + else + std::cout << "CharDate is not a leap year." << std::endl; + + std::cout << "Today is " << d1.Sysdate() << std::endl; + + if( d1.DateIsValid( "19951301" )) + std::cout << "19951301 is a valid date" << std::endl; + else + std::cout << "19951301 is not a valid date" << std::endl; + + if( d1.DateIsValid( "19920229" )) + std::cout << "19920229 is a valid date" << std::endl; + else + std::cout << "19920229 is not a valid date" << std::endl; + + if( d2.DateIsValid( StringDate )) + std::cout << StringDate << " is a valid date" << std::endl; + else + std::cout << StringDate << " is not a valid date" << std::endl; + + std::cout << "Today's Julian date " << d1.JulianDays() << std::endl; + std::cout << "StringDate Julian date " << d2.JulianDays( StringDate ) + << std::endl; + + std::cout << "There are " + << ( d1.JulianDays( "19951101" ) - d1.JulianDays( "19951001" )) + << " days between 10/1/95 and 11/1/95." << std::endl; + + std::cout << "Todays Julian date (Number of days since Jan 1 0100):" + << d1.JulianDays() << std::endl; + + d4 = d1; // set d4 class = to sysdate + std::cout << "Object d4 initialized to " << d4.GetDate() << std::endl; + std::cout << "This should be todays date: " + << d4.JulToDate8(d4.JulianDays()) << std::endl; + std::cout << "In 7 days it will be " + << d4.JulToDate8(d4.JulianDays() + 7L ) << std::endl; + + std::cout << "Today is " << d1.CharDayOf() << std::endl; + std::cout << "StringDate day is " << d2.CharDayOf( StringDate ) + << std::endl; + std::cout << "This month is " << d1.CharMonthOf() << std::endl; + std::cout << "StringDate month is " << d2.CharMonthOf() << std::endl; + + + /* various format routines using different formats, strings and chars */ + xbString xbStFmt( "MM/DD/YY" ); + std::cout << "Format (YYDDD) " << d1.FormatDate( "YYDDD" ) << std::endl; + std::cout << "Format (MM/DD/YY) " << d1.FormatDate( xbStFmt ) << std::endl; + xbStFmt = "DD/MM/YY"; + std::cout << "Format (DD/MM/YY) " << d1.FormatDate(xbStFmt, "19730110") + << std::endl; + std::cout << "Format (MMMM DD,YYYY) " + << d1.FormatDate( "MMMM DD,YYYY", d1.GetDate()) << std::endl; + xbStFmt = "DDDD, MMMM DD YYYY"; + std::cout << "Format (DDDD, MMMM DD YYYY) " + << d2.FormatDate( xbStFmt, d2.GetDate()) << std::endl; + + std::cout << "Last day this month " << d1.LastDayOfMonth() << std::endl; + std::cout << "Last day of month for StringDate is " + << d2.LastDayOfMonth( d2.GetDate()) << std::endl; + + std::cout << "Overloaded operators test..." << std::endl; + + if( d1 == d2 ) + std::cout << d1.GetDate() << " is equal to " << d2.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is not equal to " << d2.GetDate() + << std::endl; + + if( d1 != d3 ) + std::cout << d1.GetDate() << " is not equal to " << d3.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is equal to " << d3.GetDate() + << std::endl; + + if( d1 < d2 ) + std::cout << d1.GetDate() << " is less than " << d2.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is not less than " << d2.GetDate() + << std::endl; + + if( d1 > d2 ) + std::cout << d1.GetDate() << " is greater than " << d2.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is not greater than " << d2.GetDate() + << std::endl; + + if( d1 <= d2 ) + std::cout << d1.GetDate() << " is less than or equal to " << d2.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is not less than or equal to " + << d2.GetDate() << std::endl; + + if( d1 >= d2 ) + std::cout << d1.GetDate() << " is greater than or equal to " + << d2.GetDate() << std::endl; + else + std::cout << d1.GetDate() << " is not greater than or equal to " + << d2.GetDate() << std::endl; + + d1.Sysdate(); + d1++; + std::cout << "Tomorrow is " << d1.GetDate() << std::endl; + d1-=2; + std::cout << "Yesterday was " << d1.GetDate() << std::endl; + std::cout << "There are " << d1 - d2 << " days between " << d1.GetDate() + << " and " << d2.GetDate() << std::endl; + + return 0; +} + + +</xmp> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> + + diff --git a/html/xbc16.htm b/html/xbc16.htm new file mode 100755 index 0000000..b19511b --- /dev/null +++ b/html/xbc16.htm @@ -0,0 +1,202 @@ +<!doctype html public> +<html> +<title>Xbase DBMS Chapter 16</title> +<body bgcolor=#FFFFFF> +<h1><p align="center">Expressions Reference<br></h1> +<p align="center">Chapter Updated 2/19/04</p><hr> +<br><br> +<table border> +<caption align=top><h3>Expression Operands</h3></caption> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Operand<TD>Type<TD>Function +<TR><TH ALIGN="LEFT">+<TD>Alpha<TD>Concatonate +<TR><TH ALIGN="LEFT">+<TD>Numeric<TD>Addition +<TR><TH ALIGN="LEFT">-<TD>Alpha<TD>Concatonate, remove white space +<TR><TH ALIGN="LEFT">-<TD>Numeric<TD>Subtraction +<TR><TH ALIGN="LEFT">*<TD>Numeric<TD>Multiplication +<TR><TH ALIGN="LEFT">/<TD>Numeric<TD>Division +<TR><TH ALIGN="LEFT">**<TD>Numeric<TD>Exponentiation +<TR><TH ALIGN="LEFT"><<TD>Logical<TD>Less Than +<TR><TH ALIGN="LEFT">><TD>Logical<TD>Greater Than +<TR><TH ALIGN="LEFT">=<TD>Logical<TD>Equal +<TR><TH ALIGN="LEFT"><><TD>Logical<TD>Not Equal +<TR><TH ALIGN="LEFT">#<TD>Logical<TD>Not Equal +<TR><TH ALIGN="LEFT"><=<TD>Logical<TD>Less Than or Equal +<TR><TH ALIGN="LEFT">>=<TD>Logical<TD>Greater Than or Equal +<TR><TH ALIGN="LEFT">$<TD>Logical<TD>Contains +<TR><TH ALIGN="LEFT">-><TD>N/A<TD>Identifies database field ie; DATABASE->FIELD +<TR><TH ALIGN="LEFT">.AND.<TD>Logical<TD>Logical AND +<TR><TH ALIGN="LEFT">.OR.<TD>Logical<TD>Logical OR +</TABLE> + +<br><br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Expression Functions</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Expression Function<TD>Xbase C++ Method<TD>Description +<TR><TH ALIGN="LEFT">ABS()<TD>xbDouble EXPN::ABS( xbDouble d )<TD> +Returns absolute numeric value of argument. +<TR><TH ALIGN="LEFT">ASC()<TD>xbLong EXPN::ASC( char * String )<TD> +Returns ASCII code of left character of string. +<TR><TH ALIGN="LEFT">AT()<TD>xbLong EXPN::AT( char *s1, char *s2 )<TD> +Returns starting position of first alphanumeric argument in second argument. +<TR><TH ALIGN="LEFT">CDOW()<TD>char * EXPN::CDOW( char Date8 )<TD> +Returns name of the day of the week of Date8. +<TR><TH ALIGN="LEFT">CHR()<TD>char * EXPN::CHR( xbLong l )<TD> +Returns ASCII character corresponding to numeric value supplied. +<TR><TH ALIGN="LEFT">CMONTH()<TD>char * EXPN::CMONTH( char * Date8 )<TD> +Returns name of the month of Date8. +<TR><TH ALIGN="LEFT">DATE()<TD>char * EXPN::DATE()<TD> +Returns system date. +<TR><TH ALIGN="LEFT">DAY()<TD>xbLong EXPN::DAY( char * Date8 )<TD> +Returns numeric value of the day of the month for Date8. +<TR><TH ALIGN="LEFT">DESCEND()<TD>EXPN::DESCEND()<TD> +Descend - used to create descending indices +<TR><TH ALIGN="LEFT">DTOC()<TD>char * EXPN::DTOC( char * Date8 )<TD> +Returns a date converted to format MM/DD/YY. +<TR><TH ALIGN="LEFT">EXP()<TD>xbDouble EXPN::EXP( xbDouble d )<TD> +Returns exponential for supplied value. +<TR><TH ALIGN="LEFT">IIF()<TD> +char * EXPN::IIF( xbShort, const char *,const char *)<TD>If statement +<TR><TH ALIGN="LEFT">INT()<TD>xbLong EXPN::INT( xbDouble d )<TD> +Converts any numeric value to an integer. +<TR><TH ALIGN="LEFT">ISALPHA()<TD>xbLong EXPN::ISALPHA( char * String )<TD> +Returns TRUE if string is alpha. +<TR><TH ALIGN="LEFT">ISLOWER()<TD>xbLong EXPN::ISLOWER( char * String )<TD> +Returns TRUE if string is lower case. +<TR><TH ALIGN="LEFT">ISUPPER()<TD>xbLong EXPN::ISUPPER( char * String )<TD> +Returns TRUE if string is upper case. +<TR><TH ALIGN="LEFT">LEFT()<TD>char * EXPN::LEFT( char * String, xbShort Len )<TD> +Returns <em>Len</em> characters from the left side of <em>String</em>. +<TR><TH ALIGN="LEFT">LEN()<TD>xbLong EXPN::LEN( char * String )<TD> +eturns the number of characters in the String. +<TR><TH ALIGN="LEFT">LOG()<TD>xbDouble EXPN::LOG( xbDouble d )<TD> +Returns the natural log of d. +<TR><TH ALIGN="LEFT">LOWER()<TD>char * EXPN::LOWER( char * String )<TD> +Converts a string to lower case. +<TR><TH ALIGN="LEFT">LTRIM()<TD>char * EXPN::LTRIM( char * String )<TD> +Eliminates leading white space from String. +<TR><TH ALIGN="LEFT">MAX()<TD>xbDouble EXPN::MAX( xbDouble d1, xbDouble d2 )<TD> +Returns the larger of two numeric arguments. +<TR><TH ALIGN="LEFT">MIN()<TD>xbDouble EXPN::MIN(xbDouble d1, xbDouble d2 )<TD> +Returns the smaller of two numeric arguments. +<TR><TH ALIGN="LEFT">MONTH()<TD>xbLong EXPN::MONTH( char * Date8 )<TD> +Returns numeric month for Date8. +<TR><TH ALIGN="LEFT">RECNO()<TD>xbLong EXPN::RECNO()<TD> +Returns the current record number of the associated DBF file +<TR><TH ALIGN="LEFT">REPLICATE()<TD>char * EXPN::REPLICATE( char * String, xbShort Count )<TD> +Replicates String Conut times. +<TR><TH ALIGN="LEFT">RIGHT()<TD>char * EXPN::RIGHT( char * String, xbShort Count )<TD> +Returns Count characters from the right side of String. +<TR><TH ALIGN="LEFT">RTRIM()<TD>char * EXPN::RTRIM( char * String )<TD> +Removes trailing white space from String. +<TR><TH ALIGN="LEFT">SPACE()<TD>char * EXPN::SPACE( xbShort Count )<TD> +Returns a buffer filled with Count spaces. +<TR><TH ALIGN="LEFT">SQRT()<TD>xbDouble EXPN::SQRT( xbDouble d )<TD> +Returns square root of d. +<TR><TH ALIGN="LEFT">STR()<TD> +char * EXPN::STR( xbDouble d )<hr> +char * EXPN::STR( xbDouble, xbShort )<hr> +char * EXPN::STR( xbDouble, xbShort, xbShort ) +<TD> +Converts a number to a string. +<TR><TH ALIGN="LEFT">SUBSTR()<TD>char * EXPN::SUBSTR( char * String, xbShort StartPos, xbShort Len )<TD> +Returns a string form String starting at position StartPos for a length of Len. +<TR><TH ALIGN="LEFT">TRIM()<TD>char * EXPN::TRIM( char * String )<TD> +Same as RTRIM. +<TR><TH ALIGN="LEFT">UPPER()<TD>char * EXPN::UPPER( char * String )<TD> +Converts a string to upper case. +<TR><TH ALIGN="LEFT">VAL()<TD>xbLong EXPN::VAL( char * String )<TD> +Converts a string to an integer. +<TR><TH ALIGN="LEFT">YEAR()<TD>xbLong EXPN::YEAR( char * Date8 )<TD> +Returns numeric year from Date8. +</TABLE> + + + +<br><br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Expression Processing Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">GetDoubleResult()<TD>Get xbDouble result from processed expression +<TR><TH ALIGN="LEFT">GetIntResult()<TD>Get a xbLong result from processed expression +<TR><TH ALIGN="LEFT">GetExpressionHandle()<TD>Get an expression's handle +<TR><TH ALIGN="LEFT">GetExpressionResultType(xbExpression *)<TD>Get expression result type +<TR><TH ALIGN="LEFT">GetStringResult()<TD>Get xbString & result from processed expression +<TR><TH ALIGN="LEFT">ParseExpression(char *,xbDbf *)<TD>Parse an expression +<TR><TH ALIGN="LEFT">ProcessExpression(xbExpression *)<TD>Process a parsed expression +</TABLE> +<br><hr> +<h3>Method Definitions</h3> +<hr> + +<h3>Method xbDouble xbXBase::GetDoubleResult()</h3><br> + +This method returns a xbDouble result from a processed expression. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. + +<hr> +<h3>Method xbLong xbXBase::GetIntResult()</h3><br> +This method returns a xbLong result from a processed expression. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. + +<hr> +<h3>Method xbExpression * xbXBase::GetExpressionHandle()</h3><br> + +This method returns a handle to a recently parsed expression. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. + +<hr> +<h3>Method char xbXBase::GetExpressionResultType( xbExpression * e )</h3><br> + +This method returns the result type for a given expression <em>e</em>. + +<br> +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code Value<TD>Description +<TR><TH ALIGN="LEFT">C<TD>char * result from processed expression +- use GetStringResult() +<TR><TH ALIGN="LEFT">N<TD>xbDouble result from processed expression +- use GetDoubleResult() +<TR><TH ALIGN="LEFT">L<TD>xbLong (also logical) result from processed expression +- use GetIntResult() +</TABLE><br><br> + +See the program listing in chapter 5 for an example of how to use this method. + +<hr> +<h3>Method char * xbXBase::GetStringResult()</h3><br> + +This method returns a xbString & result from a processed expression. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. + +<hr + +<hr> +<h3>Method xbShort ParseExpression( char * exp, DBF * d)</h3><br> + +This method parses expression <em>exp</em>.<br><em>d</em> is a pointer to +a database used for resolving any fieldname which does not contain the +<en>-></em> operator. + +<br><br> +See the program listing in chapter 5 for an example of how to use this method. +<hr> +<h3>Method xbShort ProcessExpression( xbExpression * e )</h3><br> + +This method processes parsed expression <em>e</em>. +<br><br> +See the program listing in chapter 5 for an example of how to use this method. +<br><br> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc17.htm b/html/xbc17.htm new file mode 100755 index 0000000..c1d2c37 --- /dev/null +++ b/html/xbc17.htm @@ -0,0 +1,352 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 17</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Index Methods</p></H1> +<p align="center">Chapter Updated 2/12/99</p><hr> + +This chapter lists the xbNdx and xbNtx index methods and provides +examples of how to use them.<br><br> + +There are many methods in the xbNdx and xbNtx classes which are used for +maintaining and updating NDX and NTX files. Fortunately for the +application programmer, most of the complexities of dealing with the +NDX and NTX indices are automatically cared for by the Xbase library.<br><br> + +xbNdx and xbNtx methods which are used by application programs are documented here. +With some exceptions (OpenIndex,CloseIndex and KeyExists) using the index +routines automatically positions and returns the associated record in +the DBF database.<br><br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Xbase xbNdx Index Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">CheckIndxIntegrity<TD>Checks an index file for integrity +<TR><TH ALIGN="LEFT">CloseIndex<TD>Optional, closes an index. Closing + the DBF file will close any open indexes. +<TR><TH ALIGN="LEFT">CreateIndex<TD>Create an index +<TR><TH ALIGN="LEFT">FindKey<TD>Find a key in an index file +<TR><TH ALIGN="LEFT">GetFirstKey<TD>Get the first key in an index +<TR><TH ALIGN="LEFT">GetLastKey<TD>Get the last key in an index +<TR><TH ALIGN="LEFT">GetNextKey<TD>Get the next key in an index +<TR><TH ALIGN="LEFT">GetPrevKey<TD>Get the previous key in an index +<TR><TH ALIGN="LEFT">KeyExists<TD>Determine if a key exists w/o positioning DBF file +<TR><TH ALIGN="LEFT">OpenIndex<TD>Open an index +<TR><TH ALIGN="LEFT">ReIndex<TD>Rebuilds an index +</TABLE>in +<BR><BR> +<hr> +<h2>Method Definitions</h2> +<hr> + +<h3>Method xbShort xbNdx::CheckIndexIntegrity( xbShort option )</h3> +<h3>Method xbShort xbNtx::CheckIndexIntegrity( xbShort option )</h3><br> + +This method checks an open index for accuracy or file corruption. +If the option is non zero, the method will display informational messages.<br> +<br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>Read lock not successfull +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>File not open +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>Invalid record number +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek routine error +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Write routine error +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/checkndx.cpp">checkndx.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::CloseIndex( VOID )</h3> +<h3>Method xbShort xbNtx::CloseIndex( VOID )</h3><br> + +This method closes an open NDX index. NDX indexes are closed automatically +by the DBF::CloseDatabase routine, so this is an optional method. +Closed indices are not updated by the Xbase routines.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::CreateIndex( char * IndexName, char * KeyExpression, + xbShort Unique, xbShort OverLay )</h3> + +<h3>Method xbShort xbNtx::CreateIndex( char * IndexName, char * KeyExpression, + xbShort Unique, xbShort OverLay )</h3><br> + +This method creates an index. Indices are created as either a +character based index or a numeric based index, depending on the KeyExpression +value.<br><br> +<li><em>Indexname</em> - is the name of the physical index file name. +<li><em>KeyExpression</em> - is the key of the index. +<li><em>Unique</em> - XB_UNIQUE or XB_NOT_UNIQUE +<li><em>Overlay</em> - XB_OVERLAY or XB_DONTOVERLAY<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_INVALID_KEY_EXPRESSION<TD>Bad index key expression +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>The database was not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<br><br> +Index expressions can be a single field or multiple fields. Assuming a +database has fields LASTNAME and FIRSTNAME, valid index expressions +could be:<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Sample Index Expressions</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Expression<TD>Description +<TR><TH ALIGN="LEFT">"LASTNAME"<TD>Index on LASTNAME only. +<TR><TH ALIGN="LEFT">"LASTNAME+FIRSTNAME"<TD>Index on LASTNAME and FIRSTNAME +<TR><TH ALIGN="LEFT">"LASTNAME-FIRSTNAME"<TD>Index on LASTNAME and FIRSTNAME, +all spaces between the two fields removed. +<TR><TH ALIGN="LEFT">"LASTNAME-','FIRSTNAME"<TD>Index on LASTNAME and +FIRSTNAME, insert a comma between the two values, remove spaces between +the two fields. +</TABLE> +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><H3>Allowable Index Expression Operators</H3> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Operator<TD>Key Type<TD>Description +<TR><TH ALIGN="LEFT">+<TD>Character<TD>Concatonate string fields +<TR><TH ALIGN="LEFT">-<TD>Character<TD> +Concatonate string fields, remove trailing spaces +<TR><TH ALIGN="LEFT">'literal'<TD>Character<TD>include literal value +<TR><TH ALIGN="LEFT">"literal"<TD>Character<TD>include literal value +<TR><TH ALIGN="LEFT">+<TD>Numeric<TD>Add two numeric fields togethor +<TR><TH ALIGN="LEFT">-<TD>Numeric<TD>Subtract one numeric field from another +<TR><TH ALIGN="LEFT">*<TD>Numeric<TD>Mulitply two numeric fields togethor +<TR><TH ALIGN="LEFT">/<TD>Numeric<TD>Divide one numeric field into another +<TR><TH ALIGN="LEFT">**<TD>Numeric<TD>Exponential +</TABLE> +<br><br> +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::FindKey( char * SearchValue )</h3> +<h3>Method xbShort xbNdx::FindKey( xbDouble SearchValue )</h3> +<h3>Method xbShort xbNtx::FindKey( char * SearchValue )</h3> +<h3>Method xbShort xbNtx::FindKey( xbDouble SearchValue )</h3><br> + +This method searches the index for key <em>SearchValue</em>. +The routine positions in the index, then positions to the database record +for the key. If the key is not +found, the key value that is the next higher value is returned.<br><br> + +For character keys, the SearchValue should be a null terminated string. +To find an exact match, use a key value which is as long as the key is, +padded on the right with spaces.<br><br> + +For numeric keys, use a xbDouble value for a search value. This is because +all numeric field indices are saved as double values.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_FOUND<TD>The key was found +<TR><TH ALIGN="LEFT">XB_NOT_FOUND<TD>The key was not found +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::GetFirstKey( VOID )</h3> +<h3>Method xbShort xbNtx::GetFirstKey( VOID )</h3><br> + + +This method retrieves the record for the first key in the index.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. + + +<hr> + +<h3>Method xbShort xbNdx::GetLastKey( VOID )</h3> +<h3>Method xbShort xbNtx::GetLastKey( VOID )</h3><br> + +This method retrieves the record for the last key in the index.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. +<hr><h3>Method xbShort xbNdx::GetNextKey( VOID )</h3><br> +This method retrieves the record for the next key in the index. If the +index is not positioned, a call to GetFirstKey is autoamtically executed.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. + + +<hr><h3>Method xbShort xbNdx::GetPrevKey( VOID )</h3> +<hr><h3>Method xbShort xbNtx::GetPrevKey( VOID )</h3><br> + +This method retrieves the record for the previous key in the index. If the +index is not positioned, a call to GetLastKey is autoamtically executed.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample5.cpp">sample5.cpp</A> for an example +of how to use this method. + +<hr> + +<h3>Method xbShort xbNdx::KeyExists( char * SearchValue )</h3> +<h3>Method xbShort xbNdx::KeyExists( xbDouble SearchValue )</h3> +<h3>Method xbShort xbNtx::KeyExists( char * SearchValue )</h3> +<h3>Method xbShort xbNtx::KeyExists( xbDouble SearchValue )</h3><br> + +This method searches the index for the key <em>SearchValue</em>. The routine does not +position the database record for the key. See the reference on FindKey for more +information regarding KeyValue.<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_FOUND<TD>The key was found +<TR><TH ALIGN="LEFT">XB_NOT_FOUND<TD>The key was not found +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> +<h4>Example Program:</h4> +<xmp> +if( xbNdx::KeyExists( "MyKeyValue" )) + cout << "\nKey was found"; +else + cout << "\nKey was not found"; +</xmp> +<hr> +<h3>Method xbShort xbNdx::OpenIndex( char * IndexName )</h3> +<h3>Method xbShort xbNtx::OpenIndex( char * IndexName )</h3><br> +This method opens index <em>IndexName</em> for a given DBF database. An index must be +opened before it will be automatically updated by the database update +routines.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_NO_MEMORY<TD>Memory error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_INVALID_KEY_EXPRESSION<TD>Bad key in index +<TR><TH ALIGN="LEFT">XB_NOT_OPEN<TD>The database was not open +<TR><TH ALIGN="LEFT">XB_SEEK_ERROR<TD>Seek error encountered +<TR><TH ALIGN="LEFT">XB_READ_ERROR<TD>Read error encountered +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/sample1.cpp">sample1.cpp</A> for an example +of how to use this method. +<hr> +<h3>Method xbShort xbNdx::ReIndex( VOID )</h3> +<h3>Method xbShort xbNtx::ReIndex( VOID )</h3><br> +This method rebuilds an index. It is used for optimizing an index, or recreating +a damaged index. If the index is severly damaged (ie; the first 512 bytes are +foobar) then the index must be recreated with the CreateIndex method before +using the ReIndex method.<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Method Return Codes</h3></CAPTION><br> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>If there is no error +<TR><TH ALIGN="LEFT">XB_OPEN_ERROR<TD>Could not open index file +<TR><TH ALIGN="LEFT">XB_WRITE_ERROR<TD>Error writing data +<TR><TH ALIGN="LEFT">XB_CLOSE_ERROR<TD>Error closing work file +</TABLE> +<h4>Example Program:</h4> +See program <A HREF="/XbaseSamples/reindex.cpp">reindex.cpp</A> for an example +of how to use this method.<br><br> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc18.htm b/html/xbc18.htm new file mode 100755 index 0000000..78d8de6 --- /dev/null +++ b/html/xbc18.htm @@ -0,0 +1,261 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 18</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Locking Methods</p></H1> +<p align="center">Chapter Updated 2/1/99</p><hr> + +The locking methods return either XB_LOCK_FAILED or XB_NO_ERROR. If they return +LOCK_FAILED the actual reason can be found in the global variable +<em>errno</em> or function <em>perror()</em> can be executed to view the +results. +<br><br> + +The errno field may contain one of the following values if the lock was not +successful.<br><br> +<TABLE BORDER> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Error Code<TD>Description +<TR><TH ALIGN="LEFT">EBADF<TD>Invalid file descriptor +<TR><TH ALIGN="LEFT">EINVAL<TD>Invalid lock information or file does not support locks +<TR><TH ALIGN="LEFT">EACCESS<BR>EAGAIN<TD>Lock can not be set because it is blocked by an existing lock on the file. +<TR><TH ALIGN="LEFT">ENOLCK<TD>The system is out of lock resources, too many file locks in place. +<TR><TH ALIGN="LEFT">EDEADLK<TD>Deadlock condition +<TR><TH ALIGN="LEFT">EINTR<TD>Process was interrupted by a signal while it was waiting +</TABLE> +<br><br> +<h3>Types of Locks</h3> + +<li><em>Write or Exclusive Locks</em> provide exclusive access to a +particular file location. No other process can lock the same location.<br><br> + +<li><em>Read or Shared Locks</em> prohibit any process from requesting a write +lock on a specified part of the file. Other processes can request +simultaneous read locks.<br><br><br> + +<h3>DBF File Locking Techniques</h3> + +Xbase DBMS uses the following protocol for DBF file and record locking: +<br><br> + +To lock a record - the first byte of the record is locked.<br> +To lock the file - the header bytes of the file are locked.<br><br> + +When a record is being appended to the file, the header bytes are locked.<br> +When a record is being updated, the header bytes and the specific record are +locked.<br><br> +This locking protocol is probably not compatable with other Xbase type products. +However, Xbase can be safely used for multi-user access when it is not +simultaneously updating DBF or NDX files while other products/programs are. +<br><br><br> + +<h3>NDX File Locking Techniques</h3> + +Xbase DBMS locks indexes by locking the first 512 bytes +of the index file. +The entire index is locked because any updates to the index potentially +can modify significant portions of the index tree. +<br><br><br> + +<h3>DBT File Locking Techniques</h3> + +Xbase DBMS locks memo files by locking the first 4 bytes +of the memo file. This effectively locks the entire file. The entire file +is locked because any updates to the free block chain can significantly +change the structure of the file. +<br><br><br> + + +<h3>AutoLocking Features</h3> + +If XB_LOCKING_ON is set in the <em>options.h</em> file, the locking methods +execute any appropriate locking logic. If XB_LOCKING_ON is not set in the +<em>options.h</em> file, all locking methods return NO_ERROR without +performing any actual record or file locking. This enables the application +program to always call locking routines regardless of the XB_LOCKING_ON switch +in the <em>options.h</em> file. +<br><br> +By leaving the autolocking features enabled, the application program does +not need to address record, file or index locking. All locking is handled +automatically by the Xbase routines. However, if access to the locking +routines is required, they are available to the applciation programmer. +<br><br> +When the files are automatically locked by the Xbase routines, the database +file is locked first, then it locks the indexes in alphabetical order. To +avoid deadlock conditions, files and record locks should always be done in +the same order. When the files are unlocked, then indexes are unlocked +first, then the database is unlocked. +<br><br> +Auto-locking works well in an on-line transaction based environment. +However, it does not function efficiently in batch mode. If you +will be writing programs which process files in a batch mode, disabling +auto-lock and locking the entire file at the beginning of the process +and unlocking the file at the end of the process will significantly +reduce process time. On a 586-200 class machine, a file with 45000 records +can be read thru in a few seconds with the file locked in batch mode. +In record-lock mode it takes about six minutes with the same processor. + +<br><br>For processing large files, locking the file instead of locking each +record is far more efficient. This is how you do it.<br><br> + +For reading the file in batch mode:<br> +xbDbf.AutoLockOff();<br> +xbDbf.LockDatabase( F_SETLKW, F_RDLCK, 0L );<br><br> +For updating the file in batch mode:<br> +xbDbf.AutoLockOff();<br> +xbDbf.LockDatabase( F_SETLKW, F_WRLCK, 0L );<br><br> +<br> +<hr><br> + +<h3>Method Table</h3> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3><Xbase Locking Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">xbDbf::AutoLockOn<TD>Turns autolocking on +<TR><TH ALIGN="LEFT">xbDbf::AutoLockOff<TD>Turns autolocking off +<TR><TH ALIGN="LEFT">xbDbf::ExclusiveLock<TD>Lock file and indexes in exclusive mode +<TR><TH ALIGN="LEFT">xbDbf::ExclusiveUnlock<TD>Unlock files and indexes +<TR><TH ALIGN="LEFT">xbDbf::LockDatabase<TD>Locks or unlocks a DBF database +<TR><TH ALIGN="LEFT">xbNdx::LockIndex<TD>Locks or unlocks an xbNdx index +<TR><TH ALIGN="LEFT">xbNdx::LockMemoFile<TD>Locks or unlocks a DBT memo field file +</TABLE> +<BR><HR> + +<h4>Method Descriptions</h4> + +<h4>Method VOID xbDbf::AutoLockOn( VOID )</h4><br> + +This method turns automatic record locking on. Auto record locking is on +by default if XB_LOCKING_ON is set in the options.h file.<br><br> + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. +<hr> + +<h4>Method VOID xbDbf::AutoLockOff( VOID )</h4><br> + +This method turns automatic record locking off. Auto record locking is on +by default if XB_LOCKING_ON is set in the options.h file. +<br><br> +Turning auto locking off will result in slightly better execution speeds +but should not be used in multi-user environments when multiple users can +update files simultanteously. If multiple users are accessing a file which +is read only then it is safe to turn off auto-locking for a particular file. +<br><br> +Turning autolocking off will disable any index file locking which is +particularly dangerous in a multi-user environment if updates on the files +are permitted. + + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. + +<hr> +<h4>Method SHORT xbDbf::ExclusiveLock( SHORT WaitOption )</h4> +<h4>Method SHORT xbDbf::ExclusiveUnlock( VOID )</h4><br> + +ExclusiveLock and ExclusiveUnclock will lock the data file, memo file (if applicable) +and any associated indexes in an exclusive mode. They also turn auto-lock +on and off as appropriate.<br><br> + +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an example of +how to use this method. + +<hr> +<h3>Method SHORT xbDbf::LockDatabase( SHORT WaitOption, SHORT LockType, LONG LRecNo ) +</h3><br> + +This method locks or unlocks an Xbase (.DBF) file which was previously opened.<br> +<br> +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +LRecNo is:<br><br> +0 - Lock the header section of the file (use this to lock the file)<br> +1 through n - Lock a particular record<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_INVALID_RECORD<TD>An invalid record given +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>The lock was successful +</TABLE> + + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. + +<hr> + +<h3>Method xbShort xbDbf::LockIndex( xbShort WaitOption, xbShort LockType ) +</h3><br> + +This method locks or unlocks an Index (.NDX) file which was previously opened.<br> +<br> +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>The lock was successful +</TABLE> + +<h4>Example Program:</h4> +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. +<hr> + +<h3>Method xbShort xbDbf::LockMemoFile( xbShort WaitOption, xbShort LockType ) +</h3><br> + +This method locks or unlocks a memo (.DBT) file which was previously opened. +It is not necessary for an application to call this method as locking is +handled automatically by other routines.<br><br> + +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">XB_LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">XB_NO_ERROR<TD>The lock was successful +</TABLE> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc2.htm b/html/xbc2.htm new file mode 100755 index 0000000..ac4800e --- /dev/null +++ b/html/xbc2.htm @@ -0,0 +1,276 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 2</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H2><p align="center">Database Overview</p></H2> +<p align="center">Chapter Updated 3/18/04</p><hr> + +The objective of this chapter is to provide information regarding how +the database files are utilized and document the various record structures. +With the exception of the brief section on the record buffer, the +information presented in this chapter is not required to use the +Xbase library. It is mainly information describing internal file +structures utilized by the Xbase routines.<br><br> + +Xbase files are comprised of a variable length header record which stores +information about the file and describes +the fixed length record format, followed by a series of fixed length +data records. +<br><br> + +Each fixed length data record is preceded by a one byte indicator +which identifiies if the record has been deleted. If the record is +not deleted, the indicator is a space (0x20). If deleted, the +indicator contains an asterisk (0x2A). Data fields are stored in records +without field separators or record terminators.<br><br> + +In earlier releases of dBASE, there is an ASCII NULL character +between the $0D end of header indicator and the start of the data. +This NULL was removed starting with dBASE III Plus, making a Plus +header one byte shorter than an identically structured III file. +The methods documented in the Xbase software and documentation follow +the more recent version where the NULL character is not included. +<br><br> + +Each database file is comprised of zero, one or many records. A record is +comprised of fields. Only one record is accessed at a time.<br><br> + +Zero, one or many database files can be open simultaneously.<br><br> + +<hr> + +<h3>The Record Buffer</h3> + +When using the Xbase routines, each open data file has a record buffer +which is manipulated by calling the database, index and field routines. + +Updates are committed from the record buffer to the database when a write, +or append is performed. The library will automatically write updates +to the database if the buffer has been updated and the record is +repositioned or the database is closed.<br><br> + +The record buffer is not used for handling the actual data portion of +memo fields. When working with memo fields, the application program must +allocate enough buffer space for reading and writing memo fields.<br><br> + +Internal to the library, there is an additional record buffer which +stores the original value of the data record before any changes are made. +This is used by the index routines for finding and deleting original key +values from any open indices before adding the new keys. If the key values +are not changed, no index updates occur. + + +<br><br> + +<hr> +<br> +<h3>Xbase Database File Header</h3> + +The Xbase file header, located at the beginning of the database, describes +the .DBF database. Knowledge of this structure is not necessary to +effectively utilize the Xbase libraries.<br><br><br> + +<TABLE BORDER> +<TR valign="BASELINE"> +<TR><TH ALIGN="LEFT">Position<TD>Length<TD>Description +<TR><TH ALIGN="LEFT">0<TD>1 byte<TD>file version number<br> + (03H without a .DBT file)<br> + (83H with a .DBT file) +<TR><TH ALIGN="LEFT">1-3<TD>3 bytes<TD>date of last update<br> + (YY MM DD) in binary format +<TR><TH ALIGN="LEFT">4-7<TD>32 bit number<TD>number of records in data file +<TR><TH ALIGN="LEFT">8-9<TD>16 bit number<TD>length of header structure +<TR><TH ALIGN="LEFT">10-11<TD>16 bit number<TD>length of the record +<TR><TH ALIGN="LEFT">12-31<TD>20 bytes<TD>reserved +<TR><TH ALIGN="LEFT">32-n<TD>32 bytes each<TD>field descriptor record (see below) +<TR><TH ALIGN="LEFT">n+1<TD>1 byte<TD>0DH as the field terminator +</TABLE> +<BR><BR> + +<hr> +<br> +<h3>Xbase Field Descriptor Record</h3> +The Xbase field descriptor record stores information about each field in the +database. Each database has from 1 to 1024 fields. +Knowledge of this structure is not necessary to +effectively utilize the Xbase libraries.<br><br><br> + +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">Position<TD>Length<TD>Description +<TR><TH ALIGN="LEFT">0-10<TD>11 bytes<TD>field name in ASCII zero-filled +<TR><TH ALIGN="LEFT">11<TD>1 byte<TD>field type in ASCII (C N L D or M) +<TR><TH ALIGN="LEFT">12-15<TD>32 bit number<TD>field data address +<TR><TH ALIGN="LEFT">16<TD>1 byte<TD>field length in binary +<TR><TH ALIGN="LEFT">17<TD>1 byte<TD>field decimal count in binary +<TR><TH ALIGN="LEFT">18-31<TD>14 bytes<TD>reserved bytes (version 1.00) +</TABLE> +<BR><BR> +<hr> +<br> +<h3>Field Data Format</h3> +Data are stored in ASCII format in the database as follows:<br><br> +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">DATA TYPE<TD>DATA RECORD STORAGE +<TR><TH ALIGN="LEFT">Character<TD>ASCII characters, left justified, right blank filled +<TR><TH ALIGN="LEFT">Date<TD>(8 digits in YYYYMMDD format, such as<BR> + 19601007 for October 7, 1960) +<TR><TH ALIGN="LEFT">Logical<TD>? Y y N n T t F f (? when not initialized) +<TR><TH ALIGN="LEFT">Memo<TD>10 digits representing a .DBT block number +<TR><TH ALIGN="LEFT">Numeric<TD>. 0 1 2 3 4 5 6 7 8 9 + -, right justified, left blank filled +<TR><TH ALIGN="LEFT">Float<TD>. 0 1 2 3 4 5 6 7 8 9 + -, right justified, left blank filled +</TABLE> +<BR><BR> + +<hr> +<h3>Memo Fields</h3> + +Memo fields store variable length data elements in a seperate .DBT file. +The main .DBF file maintains a ten byte field which is used by the Xbase +routines for determining the location of the data in the .DBT file. +<br><br> + +Xbase DBMS supports both dBASE III+ and dBASE IV version memo files. +The version IV files are somewhat more efficient in that they reuse +unused memo space when data are deleted or freed from use. With version +III files, all new updates are appended to the end of the file and the +unused space is not reclaimed until the datafiles are packed. +<br><br> + +Memo fields can be used for storing a variety of date type. However, +type 3 files are limited to storing textual data because most internal +memo field processing in a type 3 file relies on two contiguous 0x1a +charaters. <br><br> + +Type 4 memo fields can be used for storing BLOB (binary large object) +data reliably, as the internal file structure does not rely on any +special characters embedded in the data.<br><br> + +A special note on storing string data in a memo field. For those users +that are new to C/C++ programming, string fields typically end with +a null (0x00) terminator character. As a general rule of thumb when using +the library, add one to the length of any string when +specifying the length of the data. This stores the null terminating byte +with the data. For example, when storing string "This is a string" +specified size should be 17, not 16. + + +<h4>Technical memo file information</h4> + +The following info on memo fields is for the curious. +It is not required +reading if you don't need to know the internals.<br><br> + +<li>Memo files are made up of one or more blocks +<li>For version III files, the block size is 512 +<li>For version IV files, the block size is a multiple of 512 +<li>The minimum amout of space necessary to store one memo field is +one block or 512 bytes. +<li>The default block size can be adjusted by manipulating the +XB_DBT_BLOCK_SIZE macro in the options.h file. + + +<li>The main .DBF file maintains a ten byte numeric field which is blank if +no memo data exists for a given field. Otherwise it contains a number, which +when multiplied by the block size, points to the offset in the file of the head +block in the file/ +<br><br> + +For version 3 memo field files, there are two fields in the head block of +the file, <em>NextBlockNo</em> and <em>Version</em>. Depending on the +Xbase software, some vendors products update these two fields, some do not. +The Xbase library keeps the fields updated, but does not rely on them to +be valued with correct data. This helps to support maximum compatibility +amoungst all Xbase tools available.<br><br> + +For version 4 memo field files, +the first block in the .DBT file is a header block which is comprised of +8 bytes of data which maintain the file's block size and the next free +block available in the file. Blocks two through n contain the actual +memo data. A chain of empty blocks is maintained within the file for +potential future use. When an add or update routine executes, it first +attempts to find a spot in a set of blocks which were earlier allocated, +but not currently in use for the data. If no free spot is found, data are +appended to the end of the file. + +The free block chain is sorted in block number order. When blocks of +data are freed and added to the free block chain, the routines will attempt +to concatonate free block chains togethor where possible. When a delete +occurs, or an update which requires less space occurs, the new free space +is added to the free block chain. + +<br><br> + +<h3>Various Memo File Block Types</h3> + +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">Valid Block Types +<TR><TH ALIGN="LEFT">Head Block +<TR><TH ALIGN="LEFT">Only data block for memo field +<TR><TH ALIGN="LEFT">First of several contiguous data block set +<TR><TH ALIGN="LEFT">2-n of contiguous data block set +<TR><TH ALIGN="LEFT">Only data block in free chain (version IV only) +<TR><TH ALIGN="LEFT">First of several contiguous free block set (version IV only) +<TR><TH ALIGN="LEFT">2-n of contiguous free block set (type 4 only) +</TABLE> +<BR><BR> + +<h3>Head Block Structure</h3> +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">1-4<TD>LONG<TD>Next Block ID +<TR><TH ALIGN="LEFT">5-8<TD>LONG<TD>Not used all 0x00's +<TR><TH ALIGN="LEFT">9-16<TD>CHAR(8)<TD>Filename (Version IV Only) +<TR><TH ALIGN="LEFT">17<TD>CHAR<TD>Version (0x03 = Version III, 0x00 = Version IV) +<TR><TH ALIGN="LEFT">18-20<TD>CHAR(3)<TD>Not used all 0x00's +<TR><TH ALIGN="LEFT">21-22<TD>SHORT<TD>Block Size (Version IV only ) +<TR><TH ALIGN="LEFT">23-Remainder of block<TD>CHAR<TD>Not used +</TABLE> +<BR><BR> + + +<h3>Version IV Head Data Block Structure</h3> +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">xbShort<TD>0-1<TD>-1 +<TR><TH ALIGN="LEFT">xbShort<TD>2-3<TD>Starting position of data (always 8 ?) +<TR><TH ALIGN="LEFT">xbLong<TD>4-7<TD>Length of data includes first 8 bytes +<TR><TH ALIGN="LEFT">char (9) - Blocksize<TD>8-15<TD>Data +</TABLE> +<BR><BR> + +<h3>Version IV Head Free Block Structure</h3> +<TABLE BORDER> +<TR VALIGN="BASELIGN"> +<TR><TH ALIGN="LEFT">xbLong<TD>0-3<TD>Next free block in the free block chain +<TR><TH ALIGN="LEFT">xbLong<TD>4-7<TD>Number of free blocks in this contiguous free + block set +</table> +<br><br> +Version 3 and 4 memo fields are terminated with two contiguous 0x1A bytes of data. +<br><br> +<hr> +<h3>64 Bit File Support</h3> +Beginning with Release 3.0 of the library, Xbase was renamed to Xbase64 and +64 bit file support was incorporated into the library. +<br><br> +This functionality currently works on Linux/Unix platforms which support +64 bit file structures. 64 bit support was not tested with Windows +because the author didn't have access to a compiler which creates 64 +bit Windows apps. If you need this functionality for Windows, consider +donating a Windows 64 bit compiler to the project and I'll get 64 bit +support working for Windows. +<br><br> +It is not advisable to use Xbase 64 bit file support in combination with +32 bit Xbase applications such as older versions of DBase, Clipper and Foxpro. +Xbase64 can extend the files well beyond any limits in the older 32 bit +application development environments. +<br><br> +If Xbase is being built with glibc, verify it is at least version 2.2.3. +<br><br><hr> +<p><img src="xbase.jpg"><hr> +</BODY> +</HTML> + diff --git a/html/xbc3.htm b/html/xbc3.htm new file mode 100755 index 0000000..b944a1b --- /dev/null +++ b/html/xbc3.htm @@ -0,0 +1,91 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 3</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Fields and Strings</p></H1> +<p align="center">Chapter Updated 8/20/03</p><hr> + +<br><br> +The title of this chapter almost sounds like a popular North American +magazine called Field and Stream. The difference between this chapter and +that magazine is there are no dead animal carcuses or fishing lures in +this chapter. For those you will need to get a copy of Field and Stream. + +<br><br> +The main objective of this chapter is to provide information regarding the +basic concepts of manipulating data via the field methods.<br><br> + +Field names can be up to ten bytes in length and can contain characters, numbers +or special characters in the name. The field methods are used to manipulate +the data in a record of a data file. There are several types of fields.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>Field Types</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Allowable Values<TD>Schema Value +<TR><TH ALIGN="LEFT">Numeric<TD>0 - 17(include sign and decimal point<TD>+ - . 0 through 9<TD>XB_NUMERIC_FLD +<TR><TH ALIGN="LEFT">Character<TD>0 - 254<TD>Anything<TD>XB_CHAR_FLD +<TR><TH ALIGN="LEFT">Date<TD>8<TD>CCYYMMDD<TD>XB_DATE_FLD +<TR><TH ALIGN="LEFT">Floating Point<TD>0 - 17 (includes sign and decimal point<TD>+ - . 0 through 9<TD>XB_FLOAT_FLD +<TR><TH ALIGN="LEFT">Logical<TD>1<TD>? Y y N n T t F f (? - uninitialized)<TD>XB_LOGICAL_FLD +<TR><TH ALIGN="LEFT">Memo<TD>Fixed length portion - 10<br>Variable length 0 - 32760 +<TD>Type III - Text<br>Type IV - Anything<TD>XB_MEMO_FLD +</TABLE> + +<br><br> +Field names, types and lengths are defined when a data file is created. +After the file is created, the field characteristics can not be changed. To +change field characteristics, a new database must be defined with the new +field requirements.<br><br> + +<h2>Memo Fields</h2> + +Memo fields are variable length data fields which are stored in two parts. +This first part is a ten byte field which is stored +in the fixed length record of the .DBF file. The variable data is stored in +a seperate .DBT file in 512 byte blocks. The ten byte field in the fixed +length portion of the record points to a .DBT block number.<br><br> + +There are two versions of memo data files type III and type IV. Type IV +is more advanced in that released space can be reused and it also +supports BLOB data. The type III file is older technology, does not +support dynamic space reclamation and only supports string data. +See method xbDbf::SetVersion for controlling which version type you are +using. + +<br><br> +To utilize memo fields, the application program must allocate a buffer +which is large enough to handle the memo data.<br><br> + +<h2>Fields and Field Numbers</h2> + +The Xbase routines can access field data via using field names or field +numbers. Field numbers are numbered 0-n where the first field in a datafile +is field 0 going through the last field n. Accessing fields by number is +more efficient than accessing by name.<br><br> + +<h2>Record Schema</h2> + +The record schema of a file can be found in the documentation for method +CreateDatabase in the Database Methods chapter, or view example program +sample1.cpp.</A><br><br> + +<h2>Strings</h2> + +Beginning with Release 1.8.0a, Xbase includes support for a string class +<em>xbString</em>. The original thinking was not to include a string +class in the library, and encourage users to use the string class +native to the user's compiler. But as C++ does not have a native way +to handle strings, and there is not a standard string class across C++ +compilers, it was decided to include a lightweight string class with the +library. In some cases this is redundant, but it is portable. +<br><br> +The xbString class interface was derived from the <em>Draft Standard C++ +Library by P.J. Plauger</em> and modified. If you are familiar with +other string classes, this one should feel similar. +<br><br> +<hr> +<p><img src="xbase.jpg"><hr> +</BODY> +</HTML> diff --git a/html/xbc4.htm b/html/xbc4.htm new file mode 100755 index 0000000..f570ed7 --- /dev/null +++ b/html/xbc4.htm @@ -0,0 +1,151 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 4</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Date Processing</p></H1> +<p align="center">Chapter Updated 2/12/99</p><hr> + +The objective of this chapter is to provide information regarding +the basic concepts of date arithmetic and supply generic +C/C++ date methods.<br><br> + +Two common things of all programmers is that if they write +enough code, they will eventually have to deal with dates. They +may be Julian dates, Gregorian dates, or a date with their best +freind's girl, but they'll eventually be working with dates. The +other thing is that most programmers don't have the time or don't +want to spend time writing mundane date routines.<br><br> + +To explain how dates work, I'll give a brief overview and history of Julian +dates, Gregorian dates, leap years and leap centuries. + +<h2>Leap Years</h2> + +Due to the fact that it actually takes about 365 1/4 days for +the earth to circle the sun, every fourth year and every fourth +century have an extra day added to the end of February and the year +is called a leap year. Leap years have 366 days, non leap years +have 365 days. The following code segment describes how to +determine if a given year is a leap year. + +A leap year is a year having 366 days, which can be evenly +divisible by 4 and not by 100 or divisible by 400. + +There are also leap centuries. Leap centuries are years which +are evenly divisible by 400. + +To calculate a leap year, the following code segment can be used + +<xmp> + int year; + + if(( year % 4 == 0 && year % 100 != 0 ) || year % 400 = 0 ) + LEAP_YEAR = TRUE; + else + LEAP_YEAR = FALSE +</xmp> + + +<h2>Julian Dates</h2> + +Around the time of Jesus Christ, a fellow with the name of Julias Ceasar +established the Julian calendar. The Julian calendar established every +fourth year as a leap year with 366 days and all other years having 365 days. +The months were set up the same as they are with a Gregorian calendar, which +is what we use today. A Julian date is defined as as the number of days from the +first day of the year; February 1 would have a Julian day of 32.<br><br> + +From a programmer's perspective, Julian dates are useful for doing date +arithmetic, determining the difference between two dates or calculating +a future or past date.<br><br> + +To determine the difference between two dates, convert both dates to a +Julian date and subtract one from the other.<br><br> + +To calculate a future or past date, convert the base date to a Julian date, +add (or subtract) the number of days necessary to (from) it and convert the +julian date back to a Gregorian date.<br><br> + +The Julian date routines use a base date of 01/01/1900.<br><br> + +<h2>Gregorian Dates</h2> + +In 1582, Pope Gregor XIII introduced a corrected form of the Julian calendar. +Every 4th year still has 366 days except for century years. Century years +were added as leap years if evenly divisible by 400. The year 2000 is a leap century. +<br><br> + +The methods supplied with this software are based on gregorian dates with +the format of CCYYMMDD for century, year, month and day.<br><br> + + +<h2>CASTELLANO options</h2> + +There is an option in the <em>options.h</em> file for enabling the date routines +to return Spanish values for days, weeks and months.<br><br> +#define CASTELLANO<br><br> + +<h2>Date Formats</h2> + +All dates are stored in the .DBF files with format CCYYMMDD.<br><br> + +All date routines work with dates formated with the same CCYYMMDD format.<br><br> + +<h2>Sample Program</h2> + +<xmp> +#include <iostream.h> +#include <xbase/xbase.h> + +main() +{ + xbXBase x; + long l; + + cout << "\nThis program tests the XDATE routines\n\n"; + + + cout << "\nThis year is " << x.YearOf ( x.Sysdate() ); + cout << "\nThis Month is " << x.MonthOf( x.Sysdate() ); + cout << "\nToday is day " << x.DayOf( WEEK, x.Sysdate()) << " of the week"; + cout << "\nToday is day " << x.DayOf( MONTH, x.Sysdate()) << " of the month"; + cout << "\nToday is day " << x.DayOf( YEAR, x.Sysdate()) << " of the year"; + + if( x.IsLeapYear( x.Sysdate())) + cout << "\nThis is a leapyear"; + else + cout << "\nThis is not a leap year."; + + cout << "\nToday is " << x.Sysdate(); + + if( x.DateIsValid( "19951301" )) + cout << "\n19951301 is a valid date"; + else + cout << "\n19951301 is not a valid date"; + + l = x.JulianDays( "19951101" ) - x.JulianDays( "19951001" ); + + cout << "\nThere are " << l + << " days between 10/1/95 and 11/1/95."; + + cout << "\nIn 7 days it will be " + << x.JulToDate8( x.JulianDays( x.Sysdate()) + 7L ); + + cout << "\nToday is " << x.CharDayOf( x.Sysdate()); + cout << "\nThis month is " << x.CharMonthOf( x.Sysdate()); + + cout << "\nFormat (YYDDD) "; + cout << x.FormatDate( "YYDDD", x.Sysdate()); + cout << "\nFormat (MM/DD/YY) "; + cout << x.FormatDate( "MM/DD/YY", x.Sysdate()); + cout << "\nFormat (MMMM DD,YYYY) "; + cout << x.FormatDate( "MMMM DD,YYYY", x.Sysdate()); + cout << "\nFormat (DDDD, MMMM DD YYYY) "; + cout << x.FormatDate( "DDDD, MMMM DD YYYY", x.Sysdate()); + cout << "\n"; +} +</xmp> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc5.htm b/html/xbc5.htm new file mode 100755 index 0000000..377129f --- /dev/null +++ b/html/xbc5.htm @@ -0,0 +1,156 @@ +<!DOCTYPE HTML PUBLIC> +<html> +<title>Xbase DBMS Chapter 5</title> +<body bgcolor=#FFFFFF> +<h1><p align="center">Expression Handling<br></h1> +<p align="center">Chapter Updated 3/12/04</p><hr> + +<h3>Overview</h3> + +The main objective of this chapter is to provide information regarding the +basic concepts of using the Xbase Expression module.<br><br> + +Beginning with release 1.7.4, the Xbase library includes an expression parsing +routine which assists application programmers by providing a high level data +manipulation tool and also allows for building complex index keys. + +The functions included were derived from dBASE III Plus, but not all +dBASE III Plus functions have been implemented yet. +<br><br> +Release 3.0 brought some upgrades to the expression module of the library +including bug fixes, additional operators and new functions. The expression +module is usable and functional, but has some room for improvement. +A future release of Xbase will include more comprehensive expresion logic. + +<br><br> + +<h3>Internal fuctioning</h3> +The expression module works in two phases. Firstly, method +<em>ParseExpression</em> is called and builds an expression tree from +all the components of the expression. The tree is made up of indivdual +nodes. The expression is checked for valid field names, literals, +operands and functions. Any field references are resolved. If fields +are used in an expression and the database name for the field is not +included in the name with the -> operand, the routines assume the +associated database has been successfully opened. +<br><br> +Secondly, method <em>ProcessExpression</em> is called to process the +expression tree created by ParseExpression(). The routine parses each +node in the expression tree, executing functions, processing operands +and manipulating data to produce the desired result.<br><br> + +If an expression will be processed repeatedely, it is best to pre-parse the +tree using <em>ParseExpression</em>, then for each new call to the expression, +execute method <em>ProcessExpression</em> which processes the tree. + + +<h3>Expression Return Types</h3> +Expressions will return a type of CHAR *, NUMERIC or LOGICAL.<br><br> + +An expression return type can be determined with method <em> +GetExpressionResultType</em> after parsing it.<br><br> + +Expressions returning a return type of CHAR are limited to a 200 byte internal +buffer. There is also a 100 byte limit for NDX index key support. If +the 200 byte limit is not large enough for your application, adjust field +<em>enum { WorkBufMaxLen = 200 };</em> in file <em>exp.h</em>. + +<h3>Expression Functions</h3> +Each expression function also has a corresponding C++ function. It is +slightly more efficient to call the C++ functions directly, rather than +execute the expression parsing routines. + +<h3>Expression Components</h3> +Expressions are made up of one or more tokens. A token is one of literal, +database field, operand or function. Literals are either numeric or character. +Character literals are enclosed in 'single' or "double" quotes. numeric +literals are a series of one or more contiguous numerals, ".", "+" or "-'". +<br><br> +A field is simply a field name in the default database, or is in the form +of database->fieldname. + +<br><br> +<hr> +<h3>Sample Program Demonstrating Expression Processing</h3> +<xmp> + +/* expressn.cpp */ + +#ifdef DOS +extern unsigned _stklen = 40000; +#endif + +#include <xbase/xbase.h> +xbSchema MyRecord[] = +{ + { "FIELD1", 'C', 20, 0 }, + { "FIELD2", 'C', 20, 0 }, + { "NAME", 'C', 10, 0 }, + { "DOUB1", 'N', 7, 2 }, + { "FLOAT1", 'F', 8, 3 }, + { "DATE1", 'D', 8, 0 }, +}; +xbShort rc; +xbXBase x; +xbDbf d( &x ); +XB_EXPRESSION *e; + +/****************************************************************************/ +xbShort MyExpressionProcessor( char * Expression ) +{ + xbShort rc; + char type; + + if(( rc = x.ParseExpression( Expression, &d )) != 0 ) + { + cout << "\nParse Error " << rc; + return rc; + } + e = x.GetExpressionHandle(); + + if(( rc = x.ProcessExpression( e )) != 0 ) + { + cout << "\nError processing expression rc = " << rc; + return rc; + } + type = x.GetExpressionResultType( e ); + cout << "\nExpression " << Expression << " produced result = "; + if( type == 'C' ) + cout << x.GetStringResult(); + else if( type == 'N' ) + cout << x.GetDoubleResult(); + else if( type == 'L' ) + cout << x.GetIntResult(); + else + cout << "\nUnknown result type " << type; + return 0; +} +/****************************************************************************/ +main() +{ + e = NULL; + + d.CreateDatabase( "TEST", MyRecord, OVERLAY ); + d.BlankRecord(); + d.PutField( d.GetFieldNo( "FIELD1" ), "TESTA " ); + d.PutField( d.GetFieldNo( "FIELD2" ), " testb" ); + d.PutField( d.GetFieldNo( "DOUB1" ), "200.33" ); + d.PutField( d.GetFieldNo( "FLOAT1" ), "100.00" ); + d.PutField( d.GetFieldNo( "DATE1" ), "19980101" ); + d.AppendRecord(); + + /* process 3 simple expressions */ + MyExpressionProcessor( "FIELD1+FIELD2" ); + MyExpressionProcessor( "FIELD1-UPPER(FIELD2)" ); + MyExpressionProcessor( "5+TEST->DOUB1" ); + + d.CloseDatabase(); + return 1; +} + +</xmp> + +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc6.htm b/html/xbc6.htm new file mode 100755 index 0000000..f5cf75d --- /dev/null +++ b/html/xbc6.htm @@ -0,0 +1,150 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 6</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H2><p align="center">NDX Indices</p></H2> +<p align="center">Chapter Updated 4/12/04</p><hr> + +The objective of this chapter is to provide information regarding the +basic concepts of how .NDX index files work in the Xbase environment.<br><br> + +The information in this chapter has been gathered by searching the internet +and by examining the structure of known good NDX indexes.<br><br> + +<h4>NDX Index File Characteristics</h4> + +<li>NDX indices maintain keys in ascending sort order only.<br><br> +<li>NDX indices support <em>unique</em> or <em>non unique</em> keys.<br><br> + +<em>Unique</em> keys must be unique. The database update routines will +fail if an attempt to add a non-unique key is performed.<br><br> + +<em>Non-unique</em> Keys are not required to be unique, duplicate +keys are allowed if the index is created with the XB_NOT_UNIQUE +setting. Duplicate keys are stored in record number order.<br><br> + +<li>NDX indexes are automatically updated by the Xbase library after the +indices are opened.<br><br> + +<li>Character keys are left justified and padded on the right with spaces.<br><br> + +<li>Numeric keys are stored as eight byte double values.<br><br> + +<h4>NDX File Internals</h4> + +NDX files are comprised of two or more 512 byte blocks or nodes of +information. There are three types of nodes: Head Nodes, Interior +Nodes and Leaf Nodes.<br><br> + +<li>The <em>Head Node</em> is the first node in the file starting at +position zero (0) and contains information about the NDX file. There +is only one Head Node in each index and it always starts at the +beginning of the file.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>NDX Header Node</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>StartNode<TD>This identifies the root node of + the index. The Header node is node 0. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>Total Nodes<TD>This is the count of the total + nodes in the index. The count includes the header node. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>NoOfKeys<TD>Total number of keys in the index +1 +<TR><TH ALIGN="LEFT">xbUShort<TD>2<TD>KeyLen<TD>The index key length +<TR><TH ALIGN="LEFT">xbUShort<TD>2<TD>KeysPerNode<TD>The maximum number of keys per node +<TR><TH ALIGN="LEFT">xbUShort<TD>2<TD>KeyType<TD>Type of key<br> +00 - Character<br>01 - Numeric +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>Keysize<TD>Key record size + 8 +<TR><TH ALIGN="LEFT">char<TD>1<TD>Unknown<TD>Reserved +<TR><TH ALIGN="LEFT">char<TD>1<TD>Unique<TD>Unique indicator<br> +00 - Not Unique - XB_NON_UNIQUE<br>01 - Unique - XB_UNIQUE +<TR><TH ALIGN="LEFT">char<TD>488<TD>KeyExpression<TD>Key expression string +<TR><TH ALIGN="LEFT"><TD>512<TD><TD>Total bytes in node +</TABLE> +<br><br> +The following structure is used by the Xbase NDX routines: +<xmp> + struct NdxHeadNode{ + xbLong StartNode; /* header node is node 0 */ + xbLong TotalNodes; /* includes header node */ + xbLong NoOfKeys; /* actual count + 1 */ + xbUShort KeyLen; /* length of key data */ + xbUShort KeysPerNode; /* max number of keys per node */ + xbUShort KeyType; /* 00 = Char, 01 = Numeric */ + xbLong KeySize; /* KeyLen + 8 */ + char Reserved1; /* Not sure about this one */ + char Unique; /* 00 = not unique, 01 = unique*/ + char KeyExpression[488]; /* key definition */ + } +</xmp> +<br><br> + +<h4>Interior and Leaf Nodes</h4> + +Interior Nodes and Leaf Nodes share the same structure in an NDX file. +The difference between the two types is that interior nodes point to +other interior nodes or leaf nodes and leaf nodes point to records in +a DBF file. Interior nodes are optional nodes in an NDX file, +however if there are more than a few keys in the index there will +certainly be one or more interior nodes in the file. There will +always be at least one leaf node in the file. Leaf nodes contain DBF +record numbers which point to the location of the record in the +DBF file.<br><br> + +Interior nodes have field LeftNodeNo valued which points to the node +which points to the keys which are less than the key value in the KeyVal +field. There is one more LeftNodeNo value in the node than there are keys. +The Last LeftNodeNo points to the node which is greater than the highest +key value in the node. Interior nodes have 0 in the value for the +DbfRecNo field.<br><br> + +Leaf nodes have 0 in the LeftNodeNo field but do have a value in the +DbfRecNo field which points to a DFB record.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>NDX Interior Node and Leaf Node Structure</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>NoOfKeysThisNode<TD>The number of key values in this node. +<TR><TH ALIGN="LEFT">char<TD>508<TD>KeyRec<TD>A repeating structure of + pointers and keys. See the next table for the KeyRec structure. +</TABLE> +<br><br> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>KeyRec Structure</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>LeftNodeNo<TD>The node number of the lower node + for this key. 0 in Leaf Nodes. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>DbfRecNo<TD>The DBF record number for this key. + 0 in Interior Nodes. +<TR><TH ALIGN="LEFT">char<TD>KeyLen<TD>KeyValue<TD>The key value. +</TABLE> + +<br><br> +For those interested in knowing how the Xbase DBMS manipulates and +navigates index files, the following discussion may be helpfull.<br><br> + +Xbase DBMS navigates through NDX files by using an in-memory chain +of nodes of the current location / key in use. It starts by reading the +Head Node of the index, which points to the first node of the file. The +first node of the file will be a leaf node if the index is small or will +be an interior node if the index has more than one leaf node. The first +interior node is loaded into memory, added to the node chain and points +to the next node to read. The node is made up of one or more keys. If +it is a leaf node, the logic looks for a matching key on the node. +Otherwise, if it is an interior node, the logic looks at the keys until the +search key is greater than or equal to the key in the node and then +traverses down the tree to the next node. It continues down the tree, +adding the nodes to the in-memory node chain until it reaches the correct +leaf node. If it finds a matching key in the leaf node, it returns a +XB_FOUND condition. If it doesn't find an exact match in the leaf node, it +returns a XB_NOT_FOUND condition and stops on the key which is greater than +the search key given. + +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xbc7.htm b/html/xbc7.htm new file mode 100755 index 0000000..bffb5ea --- /dev/null +++ b/html/xbc7.htm @@ -0,0 +1,176 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 7</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H2><p align="center">NTX Indices</p></H2> +<p align="center">Chapter Updated 2/12/99</p><hr> + +The objective of this chapter is to provide information regarding the +basic concepts of how .NTX index files work in the Xbase environment.<br><br> + +The information in this chapter has been gathered by searching the internet +and by examining the structure of known good NTX indexes.<br><br> + +<h4>NTX Index File Characteristics</h4> + +<ul><li>NTX indices maintain keys in ascending sort order only.<br><br> +<li>NTX indices support <em>unique</em> or <em>non unique</em> keys.<br><br> + +<em>Unique</em> keys must be unique. The database update routines will +fail if an attempt to add a non-unique key is performed.<br><br> + +<em>Non-unique</em> Keys are not required to be unique, duplicate +keys are allowed if the index is created with the XB_NOT_UNIQUE +setting. Duplicate keys are stored in record number order.<br><br> + +<li>NTX indexes are automatically updated by the Xbase library after the +indices are opened.<br><br> + +<li>Character keys are left justified and padded on the right with spaces.<br><br> + +<li>Numeric keys are stored as eight byte double values.<br><br> + +The numeric key processing logic performs floating point numeric +calculations on eight byte double values. This logic may be compute intensive +and slow on older machines, especially the older intel processors without a +math coprocessor chip. + +</ul> + + +<h4>NTX File Internals</h4> + +NTX files are comprised of two or more 1024 byte blocks or nodes of +information. There are three types of nodes: Head Nodes, Interior +Nodes and Leaf Nodes.<br><br> + +The <em>Head Node</em> is the first node in the file starting at +position zero (0) and contains information about the NTX file. There +is only one Head Node in each index and it always starts at the +beginning of the file.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>NTX Header Node</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Signature Byte<TD>The Clipper signature byte. 0x003h indicates Clipper 87. 0x006h indicates Clipper 5.x +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Indexing Version Number<TD>Documented as the "Compiler Version" but I have observed an increasing number. Incremented whenever the index is changed. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>First Node Offset<TD>The offset to the first node. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>First Unused Page Offset<TD>The offset to the first unused node. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Key Size + 8<TD>The Key Size plus 8 bytes. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Key Size<TD>The size (length) of the key. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Number of Decimals<TD>Number of decimal places in key. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>Max Items Per Node<TD>The maximum number of key per node. +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>1/2 The Max Items Per Node<TD>Half the maximum number of key per node. Important in a B-tree system, as this is the minimum number of keys that must be on a page. +<TR><TH ALIGN="LEFT">char<TD>256<TD>KeyExpression<TD>Key expression string +<TR><TH ALIGN="LEFT">char<TD>1<TD>Unique<TD>Unique indicator<br> + 00 - Not Unique - XB_NON_UNIQUE<br> + 01 - Unique - XB_UNIQUE +<TR><TH ALIGN="LEFT">char<TD>745<TD>Unused<TD>Unused + + +<TR><TH ALIGN="LEFT"><TD>1024<TD><TD>Total bytes in node +</TABLE> +<br><br> +The following structure is used by the Xbase NTX routines: +<xmp> + +struct NtxHeadNode { /* ntx header on disk */ + xbUShort Signature; /* Clipper 5.x or Clipper 87 */ + xbUShort Version; /* Compiler Version */ + /* Also turns out to be */ + /* a last modified counter */ + xbULong StartNode; /* Offset in file for first node */ + xbULong UnusedOffset; /* First free node offset */ + xbUShort KeySize; /* Size of items (KeyLen + 8) */ + xbUShort KeyLen; /* Size of the Key */ + xbUShort DecimalCount; /* Number of decimal positions */ + xbUShort KeysPerNode; /* Max number of keys per node */ + xbUShort HalfKeysPerNode; /* Min number of keys per node */ + char KeyExpression[256]; /* Null terminated key expression */ + unsigned Unique; /* Unique Flag */ + char NotUsed[745]; +}; + +</xmp> + +<br><br> + +<h4>Interior and Leaf Nodes</h4> + +NTX files use a B-tree system to store keys. A B-tree is a balanced, +on disk tree who's design minimizes disk access. Interior Nodes and +Leaf Nodes share the same structure in an NTX file. The difference is +that interior nodes point to other nodes. Leaf nodes point to +nothing. Keys in both interior nodes and leaf nodes point to records +in a DBF file. + +Interior nodes have field LeftNodeNo valued which points to the node +which points to the keys which are less than the key value in the KeyVal +field. There is one more LeftNodeNo value in the node than there are keys. The +Last LeftNodeNo points to the node which is greater than the highest +key value in the node. <br><br> + +Leaf nodes have 0 in the LeftNodeNo field.<br><br> + + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>NTX Interior Node and Leaf Node Structure</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbShort<TD>2<TD>NoOfKeysThisNode<TD>The number of key values in this node. (N) +<TR><TH ALIGN="LEFT">Array of xbUShort<TD>2<TD>offsets[]<TD>Array of + <pre>HeadNode.KeysPerNode +1</pre> unsigned longs. + These values are the offsets (in bytes) of each key + in this node, from the beginning of the node. +<TR><TH ALIGN="LEFT">char<TD>variable<TD>KeyRecs<TD>A repeating structure of + pointers and keys. See the next table for the KeyRec structure. +</TABLE> +<br><br> + +One primary difference between NDX files and NTX files is that NTX +files uses an array of offsets on all interior and leaf nodes. Each +offset is the byte count from the beginning of the node where each +KeyRec will be found. The order of the array of offsets determines +the order of keys on a given node. When keys are added or deleted, +thus changing the order of the keys on a node, only the order of the +offset array is changed. All other key data is not moved. This results +in slightly better index performance. + +<BR> +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3>KeyRec Structure</H3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Type<TD>Size<TD>Field Name<TD>Description +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>LeftNodeNo<TD>The node number (offset from beginning of file) of the lower node + for this key. 0 in Leaf Nodes. +<TR><TH ALIGN="LEFT">xbLong<TD>4<TD>DbfRecNo<TD>The DBF record number for this key. + 0 in Interior Nodes. +<TR><TH ALIGN="LEFT">char<TD>KeyLen<TD>KeyValue<TD>The key value. +</TABLE> + +<br><br> +For those interested in knowing how the Xbase DBMS manipulates and +navigates index files, the following discussion may be helpfull.<br><br> + +Xbase DBMS navigates through NTX files by using an in-memory chain of +nodes of the current location / key in use. It starts by reading the +Head Node of the index, which points to the first node of the +file. The first node of the file will be a leaf node if the index is +small or will be an interior node if the index has more than one leaf +node. The first interior node is loaded into memory, added to the +node chain and points to the next node to read. The node is made up +of one or more keys. If it is a leaf node, the logic looks for a +matching key on the node. It continues down the tree, adding the +nodes to the in-memory node chain until it reaches the correct +node. If it finds a matching key in the leaf node, it returns a XB_FOUND +condition. If it doesn't find an exact match in the leaf node, it +returns a XB_NOT_FOUND condition and stops on the key which is greater +than the search key given. + +<hr> +<A HREF="mailto:bob@#synxis.com"> +Author: Bob Cotton - bob@synxis.com</A><br> +</BODY> +</HTML> diff --git a/html/xbc8.htm b/html/xbc8.htm new file mode 100755 index 0000000..efab841 --- /dev/null +++ b/html/xbc8.htm @@ -0,0 +1,130 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 8</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Record and File Locking</p></H1> +<p align="center">Chapter Updated 2/1/99</p><hr> + +<h3>Locking Overview</h3> + +Xbase DBMS supports multi-user processing through file and record locks. +Record locking restricts multiple cooperating programs from simultaneously +accessing the same data and corrupting it. Without record and file locking +in a multi-user environment, simultaneous access to the data and index files +can cause the files to become inaccurate and unusable.<br><br> + +Record locking is on by default in the Xbase DBMS library. To disable it, +comment out the XB_LOCKING_ON option in the <em>options.h</em> file in the +xbase/src directory.<br><br> + +The current Xbase DBMS record locking does not co-exist with other Xbase +products and there is not yet support for locking in a DOS/Windows environment. +The locking functions do work correctly for a Xbase DBMS only configuration. +Future version of Xbase DBMS will have enhanced locking features for +co-existing with other Xbase products and also include DOS/Windows support. +<br><br> + +The locking methods return either XB_LOCK_FAILED or XB_NO_ERROR. If they return +XB_LOCK_FAILED the actual reason can be found in the global variable +<em>errno</em> or function <em>perror()</em> can be executed to view the +results. +<br><br> + +The errno field may contain one of the following values if the lock was not +successful.<br><br> +<TABLE BORDER> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Error Code<TD>Description +<TR><TH ALIGN="LEFT">EBADF<TD>Invalid file descriptor +<TR><TH ALIGN="LEFT">EINVAL<TD>Invalid lock information or file does not support locks +<TR><TH ALIGN="LEFT">EACCESS<BR>EAGAIN<TD>Lock can not be set because it is blocked by an existing lock on the file. +<TR><TH ALIGN="LEFT">ENOLCK<TD>The system is out of lock resources, too many file locks in place. +<TR><TH ALIGN="LEFT">EDEADLK<TD>Deadlock condition +<TR><TH ALIGN="LEFT">EINTR<TD>Process was interrupted by a signal while it was waiting +</TABLE> +<br><br> +<h3>Types of Locks</h3> + +<li><em>Write or Exclusive Locks</em> provide exclusive access to a +particular file location. No other process can lock the same location.<br><br> + +<li><em>Read or Shared Locks</em> prohibit any process from requesting a write +lock on a specified part of the file. Other processes can request +simultaneous read locks.<br><br><br> + +<h3>DBF File Locking Techniques</h3> + +Xbase DBMS uses the following protocol for DBF file and record locking: +<br><br> + +To lock a record - the first byte of the record is locked.<br> +To lock the file - the header bytes of the file are locked.<br><br> + +When a record is being appended to the file, the header bytes are locked.<br> +When a record is being updated, the header bytes and the specific record are +locked.<br><br> +This locking protocol is probably not compatable with other Xbase type products. +However, Xbase can be safely used for multi-user access when it is not +simultaneously updating DBF or NDX files while other products/programs are. +<br><br><br> + +<h3>NDX File Locking Techniques</h3> + +Xbase DBMS locks indexes by locking the first 512 bytes +of the index file. +The entire index is locked because any updates to the index potentially +can modify significant portions of the index tree. +<br><br><br> + +<h3>DBT File Locking Techniques</h3> + +Xbase DBMS locks memo files by locking the first 4 bytes +of the memo file. This effectively locks the entire file. The entire file +is locked because any updates to the free block chain can significantly +change the structure of the file. +<br><br><br> + + +<h3>AutoLocking Features</h3> + +If XB_LOCKING_ON is set in the <em>options.h</em> file, the locking methods +execute any appropriate locking logic. If XB_LOCKING_ON is not set in the +<em>options.h</em> file, all locking methods return XB_NO_ERROR without +performing any actual record or file locking. This enables the application +program to always call locking routines regardless of the XB_LOCKING_ON switch +in the <em>options.h</em> file. +<br><br> +By leaving the autolocking features enabled, the application program does +not need to address record, file or index locking. All locking is handled +automatically by the Xbase routines. However, if access to the locking +routines is required, they are available to the applciation programmer. +<br><br> +When the files are automatically locked by the Xbase routines, the database +file is locked first, then it locks the indexes in alphabetical order. To +avoid deadlock conditions, files and record locks should always be done in +the same order. When the files are unlocked, then indexes are unlocked +first, then the database is unlocked. +<br><br> +Auto-locking works well in an on-line transaction based environment. +However, it does not function efficiently in batch mode. If you +will be writing programs which process files in a batch mode, disabling +auto-lock and locking the entire file at the beginning of the process +and unlocking the file at the end of the process will significantly +reduce process time. On a 586-200 class machine, a file with 45000 records +can be read thru in a few seconds with the file locked in batch mode. +In record-lock mode it takes about six minutes with the same processor. + +<br><br>For processing large files, locking the file instead of locking each +record is far more efficient. This is how you do it.<br><br> + +For reading the file in batch mode:<br> +xbDbf.AutoLockOff();<br> +xbDbf.LockDatabase( F_SETLKW, F_RDLCK, 0L );<br><br> +For updating the file in batch mode:<br> +xbDbf.AutoLockOff();<br> +xbDbf.LockDatabase( F_SETLKW, F_WRLCK, 0L );<br><br> +<br> +<hr><br> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> diff --git a/html/xblock.htm b/html/xblock.htm new file mode 100755 index 0000000..e95f1e3 --- /dev/null +++ b/html/xblock.htm @@ -0,0 +1,281 @@ +<!DOCTYPE HTML PUBLIC> +<HTML> +<TITLE>Xbase DBMS Chapter 10</TITLE> +<BODY BGCOLOR=#FFFFFF> +<H1><p align="center">Xbase DBMS Record and File Locking</p></H1> +<p align="center">Chapter Updated 4/8/98</p><hr> + +<h3>Locking Overview</h3> + +Xbase DBMS supports multi-user processing through file and record locks. +Record locking restricts multiple cooperating programs from simultaneously +accessing the same data and corrupting it. Without record and file locking +in a multi-user environment, simultaneous access to the data and index files +can cause the files to become inaccurate and unusable.<br><br> + +Record locking is on by default in the Xbase DBMS library. To disable it, +comment out the LOCKING_ON option in the <em>options.h</em> file in the +xbase/src directory.<br><br> + +The current Xbase DBMS record locking does not co-exist with other Xbase +products and there is not yet support for locking in a DOS/Windows environment. +The locking functions do work correctly for a Xbase DBMS only configuration. +Future version of Xbase DBMS will have enhanced locking features for +co-existing with other Xbase products and also include DOS/Windows support. +<br><br> + +The locking methods return either LOCK_FAILED or NO_ERROR. If they return +LOCK_FAILED the actual reason can be found in the global variable +<em>errno</em> or function <em>perror()</em> can be executed to view the +results. +<br><br> + +The errno field may contain one of the following values if the lock was not +successful.<br><br> +<TABLE BORDER> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Error Code<TD>Description +<TR><TH ALIGN="LEFT">EBADF<TD>Invalid file descriptor +<TR><TH ALIGN="LEFT">EINVAL<TD>Invalid lock information or file does not support locks +<TR><TH ALIGN="LEFT">EACCESS<BR>EAGAIN<TD>Lock can not be set because it is blocked by an existing lock on the file. +<TR><TH ALIGN="LEFT">ENOLCK<TD>The system is out of lock resources, too many file locks in place. +<TR><TH ALIGN="LEFT">EDEADLK<TD>Deadlock condition +<TR><TH ALIGN="LEFT">EINTR<TD>Process was interrupted by a signal while it was waiting +</TABLE> +<br><br> +<h3>Types of Locks</h3> + +<li><em>Write or Exclusive Locks</em> provide exclusive access to a +particular file location. No other process can lock the same location.<br><br> + +<li><em>Read or Shared Locks</em> prohibit any process from requesting a write +lock on a specified part of the file. Other processes can request +simultaneous read locks.<br><br><br> + +<h3>DBF File Locking Techniques</h3> + +Xbase DBMS uses the following protocol for DBF file and record locking: +<br><br> + +To lock a record - the first byte of the record is locked.<br> +To lock the file - the header bytes of the file are locked.<br><br> + +When a record is being appended to the file, the header bytes are locked.<br> +When a record is being updated, the header bytes and the specific record are +locked.<br><br> +This locking protocol is probably not compatable with other Xbase type products. +However, Xbase can be safely used for multi-user access when it is not +simultaneously updating DBF or NDX files while other products/programs are. +<br><br><br> + +<h3>NDX File Locking Techniques</h3> + +Xbase DBMS locks indexes by locking the first 512 bytes +of the index file. +The entire index is locked because any updates to the index potentially +can modify significant portions of the index tree. +<br><br><br> + +<h3>DBT File Locking Techniques</h3> + +Xbase DBMS locks memo files by locking the first 4 bytes +of the memo file. This effectively locks the entire file. The entire file +is locked because any updates to the free block chain can significantly +change the structure of the file. +<br><br><br> + + +<h3>AutoLocking Features</h3> + +If LOCKING_ON is set in the <em>options.h</em> file, the locking methods +execute any appropriate locking logic. If LOCKING_ON is not set in the +<em>options.h</em> file, all locking methods return NO_ERROR without +performing any actual record or file locking. This enables the application +program to always call locking routines regardless of the LOCKING_ON switch +in the <em>options.h</em> file. +<br><br> +By leaving the autolocking features enabled, the application program does +not need to address record, file or index locking. All locking is handled +automatically by the Xbase routines. However, if access to the locking +routines is required, they are available to the applciation programmer. +<br><br> +When the files are automatically locked by the Xbase routines, the database +file is locked first, then it locks the indexes in alphabetical order. To +avoid deadlock conditions, files and record locks should always be done in +the same order. When the files are unlocked, then indexes are unlocked +first, then the database is unlocked. +<br><br> +Auto-locking works well in an on-line transaction based environment. +However, it does not function efficiently in batch mode. If you +will be writing programs which process files in a batch mode, disabling +auto-lock and locking the entire file at the beginning of the process +and unlocking the file at the end of the process will significantly +reduce process time. On a 586-200 class machine, a file with 45000 records +can be read thru in a few seconds with the file locked in batch mode. +In record-lock mode it takes about six minutes with the same processor. + +<br><br>For processing large files, locking the file instead of locking each +record is far more efficient. This is how you do it.<br><br> + +For reading the file in batch mode:<br> +DBF.AutoLockOff();<br> +DBF.LockDatabase( F_SETLKW, F_RDLCK, 0L );<br><br> +For updating the file in batch mode:<br> +DBF.AutoLockOff();<br> +DBF.LockDatabase( F_SETLKW, F_WRLCK, 0L );<br><br> +<br> +<hr><br> + +<h3>Method Table</h3> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"><h3><Xbase Locking Method List</h3></CAPTION> +<TR VALIGN="BASELINE"> +<TR><TH ALIGN="LEFT">Method<TD>Description +<TR><TH ALIGN="LEFT">DBF::AutoLockOn<TD>Turns autolocking on +<TR><TH ALIGN="LEFT">DBF::AutoLockOff<TD>Turns autolocking off +<TR><TH ALIGN="LEFT">DBF::ExclusiveLock<TD>Lock file and indexes in exclusive mode +<TR><TH ALIGN="LEFT">DBF::ExclusiveUnlock<TD>Unlock files and indexes +<TR><TH ALIGN="LEFT">DBF::LockDatabase<TD>Locks or unlocks a DBF database +<TR><TH ALIGN="LEFT">NDX::LockIndex<TD>Locks or unlocks an NDX index +<TR><TH ALIGN="LEFT">NDX::LockMemoFile<TD>Locks or unlocks a DBT memo field file +</TABLE> +<BR><HR> + +<h4>Method Descriptions</h4> + +<h4>Method VOID DBF::AutoLockOn( VOID )</h4><br> + +This method turns automatic record locking on. Auto record locking is on +by default if LOCKING_ON is set in the options.h file.<br><br> + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. +<hr> + +<h4>Method VOID DBF::AutoLockOff( VOID )</h4><br> + +This method turns automatic record locking off. Auto record locking is on +by default if LOCKING_ON is set in the options.h file. +<br><br> +Turning auto locking off will result in slightly better execution speeds +but should not be used in multi-user environments when multiple users can +update files simultanteously. If multiple users are accessing a file which +is read only then it is safe to turn off auto-locking for a particular file. +<br><br> +Turning autolocking off will disable any index file locking which is +particularly dangerous in a multi-user environment if updates on the files +are permitted. + + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. + +<hr> +<h4>Method SHORT DBF::ExclusiveLock( SHORT WaitOption )</h4> +<h4>Method SHORT DBF::ExclusiveUnlock( VOID )</h4><br> + +ExclusiveLock and ExclusiveUnclock will lock the data file, memo file (if applicable) +and any associated indexes in an exclusive mode. They also turn auto-lock +on and off as appropriate.<br><br> + +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +<h4>Example Program:</h4> + +See program <A HREF="/XbaseSamples/sample4.cpp">sample4.cpp</A> for an example of +how to use this method. + +<hr> +<h3>Method SHORT DBF::LockDatabase( SHORT WaitOption, SHORT LockType, LONG LRecNo ) +</h3><br> + +This method locks or unlocks an Xbase (.DBF) file which was previously opened.<br> +<br> +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +LRecNo is:<br><br> +0 - Lock the header section of the file (use this to lock the file)<br> +1 through n - Lock a particular record<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">INVALID_RECORD<TD>An invalid record given +<TR><TH ALIGN="LEFT">LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">NO_ERROR<TD>The lock was successful +</TABLE> + + +<h4>Example Program:</h4> + +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. + +<hr> + +<h3>Method SHORT DBF::LockIndex( SHORT WaitOption, SHORT LockType ) +</h3><br> + +This method locks or unlocks an Index (.NDX) file which was previously opened.<br> +<br> +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">NO_ERROR<TD>The lock was successful +</TABLE> + +<h4>Example Program:</h4> +See program <A HREF="/zips/loadzips.cpp">loadzips.cpp</A> for an example of +how to use this method. +<hr> + +<h3>Method SHORT DBF::LockMemoFile( SHORT WaitOption, SHORT LockType ) +</h3><br> + +This method locks or unlocks a memo (.DBT) file which was previously opened. +It is not necessary for an application to call this method as locking is +handled automatically by other routines.<br><br> + +WaitOption is either:<br><br> +<li>F_SETLK - returns immediately regardless if success or failure<br> +<li>F_SETLKW - waits until lock function executes<br><br> + +LockType is one of:<br><br> +<li>F_RDLCK - Perform a Read or Shared Lock<br> +<li>F_WRLCK - Perform a Write or Exclusive Lock<br> +<li>F_UNLCK - Unlock it<br><br> + +<TABLE BORDER> +<CAPTION ALIGN="TOP"<h4>Method Return Codes</h4></CAPTION> +<TR><TH ALIGN="LEFT">Return Code<TD>Description +<TR><TH ALIGN="LEFT">LOCK_FAILED<TD>The lock action failed, see errno +<TR><TH ALIGN="LEFT">NO_ERROR<TD>The lock was successful +</TABLE> +<hr> +<p><img src="xbase.jpg"><br><hr> +</BODY> +</HTML> @@ -0,0 +1,186 @@ +Basic Installation +================== + +For xbase64 specific installation notes + +1) Review the README file in this directory + +and/or + +2) Review Chapter 1 in the manual on getting started. + + +The remainder of this file is the generic installation +instructions included with automake/autoconf. + + 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, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + 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 at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' 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 a while. 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. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +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 supports 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/kde/bin', `/usr/local/kde/lib', etc. You can specify an +installation prefix other than `/usr/local/kde' 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. + + 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' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +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 host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +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. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..11870f1 --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + 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" ] || [ -d "$src" ] + then + : + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + : + 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 + : + 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 + : + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; 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 + : + 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 :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/libtest/Makefile.am b/libtest/Makefile.am new file mode 100755 index 0000000..9e84830 --- /dev/null +++ b/libtest/Makefile.am @@ -0,0 +1,19 @@ + +INCLUDES= -I$(topdir) +LDADD = -L$(topdir)/xbase64 -lxbase64 + +INSTALL_PROGRAM = @INSTALL@ + +noinst_PROGRAMS = indextst exptest locktest testdate lfiletst + +indextst_SOURCES = indextst.cpp +exptest_SOURCES = exptest.cpp +locktest_SOURCES = locktest.cpp +testdate_SOURCES = testdate.cpp +lfiletst_SOURCES = lfiletst.cpp + +noinst_HEADERS = + +EXTRA_DIST = readme makebcc.bat + +CLEANFILES = Makefile.in *.exe compout *.tds *.dbf *.dbt *.ndx *.ntx *.obj diff --git a/libtest/Makefile.in b/libtest/Makefile.in new file mode 100755 index 0000000..372dd58 --- /dev/null +++ b/libtest/Makefile.in @@ -0,0 +1,391 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ + +INSTALL_PROGRAM = @INSTALL@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +GXXVER = @GXXVER@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RELEASE = @RELEASE@ +RHREL = @RHREL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XSUBDIRS = @XSUBDIRS@ +am__include = @am__include@ +am__quote = @am__quote@ +doxygen = @doxygen@ +install_sh = @install_sh@ +topdir = @topdir@ + +INCLUDES = -I$(topdir) +LDADD = -L$(topdir)/xbase64 -lxbase64 + +noinst_PROGRAMS = indextst exptest locktest testdate lfiletst + +indextst_SOURCES = indextst.cpp +exptest_SOURCES = exptest.cpp +locktest_SOURCES = locktest.cpp +testdate_SOURCES = testdate.cpp +lfiletst_SOURCES = lfiletst.cpp + +noinst_HEADERS = + +EXTRA_DIST = readme makebcc.bat + +CLEANFILES = Makefile.in *.exe compout *.tds *.dbf *.dbt *.ndx *.ntx *.obj +subdir = libtest +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h +CONFIG_CLEAN_FILES = +noinst_PROGRAMS = indextst$(EXEEXT) exptest$(EXEEXT) locktest$(EXEEXT) \ + testdate$(EXEEXT) lfiletst$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) + +am_exptest_OBJECTS = exptest.$(OBJEXT) +exptest_OBJECTS = $(am_exptest_OBJECTS) +exptest_LDADD = $(LDADD) +exptest_DEPENDENCIES = +exptest_LDFLAGS = +am_indextst_OBJECTS = indextst.$(OBJEXT) +indextst_OBJECTS = $(am_indextst_OBJECTS) +indextst_LDADD = $(LDADD) +indextst_DEPENDENCIES = +indextst_LDFLAGS = +am_lfiletst_OBJECTS = lfiletst.$(OBJEXT) +lfiletst_OBJECTS = $(am_lfiletst_OBJECTS) +lfiletst_LDADD = $(LDADD) +lfiletst_DEPENDENCIES = +lfiletst_LDFLAGS = +am_locktest_OBJECTS = locktest.$(OBJEXT) +locktest_OBJECTS = $(am_locktest_OBJECTS) +locktest_LDADD = $(LDADD) +locktest_DEPENDENCIES = +locktest_LDFLAGS = +am_testdate_OBJECTS = testdate.$(OBJEXT) +testdate_OBJECTS = $(am_testdate_OBJECTS) +testdate_LDADD = $(LDADD) +testdate_DEPENDENCIES = +testdate_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/xbase64 +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/exptest.Po ./$(DEPDIR)/indextst.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/lfiletst.Po ./$(DEPDIR)/locktest.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/testdate.Po +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(exptest_SOURCES) $(indextst_SOURCES) \ + $(lfiletst_SOURCES) $(locktest_SOURCES) $(testdate_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(exptest_SOURCES) $(indextst_SOURCES) $(lfiletst_SOURCES) $(locktest_SOURCES) $(testdate_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu libtest/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +exptest$(EXEEXT): $(exptest_OBJECTS) $(exptest_DEPENDENCIES) + @rm -f exptest$(EXEEXT) + $(CXXLINK) $(exptest_LDFLAGS) $(exptest_OBJECTS) $(exptest_LDADD) $(LIBS) +indextst$(EXEEXT): $(indextst_OBJECTS) $(indextst_DEPENDENCIES) + @rm -f indextst$(EXEEXT) + $(CXXLINK) $(indextst_LDFLAGS) $(indextst_OBJECTS) $(indextst_LDADD) $(LIBS) +lfiletst$(EXEEXT): $(lfiletst_OBJECTS) $(lfiletst_DEPENDENCIES) + @rm -f lfiletst$(EXEEXT) + $(CXXLINK) $(lfiletst_LDFLAGS) $(lfiletst_OBJECTS) $(lfiletst_LDADD) $(LIBS) +locktest$(EXEEXT): $(locktest_OBJECTS) $(locktest_DEPENDENCIES) + @rm -f locktest$(EXEEXT) + $(CXXLINK) $(locktest_LDFLAGS) $(locktest_OBJECTS) $(locktest_LDADD) $(LIBS) +testdate$(EXEEXT): $(testdate_OBJECTS) $(testdate_DEPENDENCIES) + @rm -f testdate$(EXEEXT) + $(CXXLINK) $(testdate_LDFLAGS) $(testdate_OBJECTS) $(testdate_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exptest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indextst.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lfiletst.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locktest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdate.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` + +.cpp.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CXXDEPMODE = @CXXDEPMODE@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) + +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_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-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 + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + 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: diff --git a/libtest/exptest.cpp b/libtest/exptest.cpp new file mode 100755 index 0000000..d5330c6 --- /dev/null +++ b/libtest/exptest.cpp @@ -0,0 +1,277 @@ +/* exptest.cpp + + Xbase project source code + + This program tests the Xbase expression logic + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + + +*/ + +#include "xbase64/xbase64.h" + +class ExpTestor{ + public:ExpTestor( xbXBase *, xbDbf * ); + xbShort TestExpression( const char * TestExpression, + const char * ExpectedResult ); + xbShort TestExpression( const char * TestExpression, + const xbDouble ExpectedResult ); + private: + xbXBase *xbptr; + xbDbf *dbfPtr; +}; +/**************************************************************************/ +ExpTestor::ExpTestor( xbXBase *xp, xbDbf *dp ) +{ + xbptr = xp; + dbfPtr = dp; +} +/**************************************************************************/ +xbShort ExpTestor::TestExpression( const char * Expression, + const xbDouble ExpectedResult ) +{ +// xbExpNode * e; + xbExpn * exp; + xbShort rc; + + exp = new xbExpn( xbptr ); + if(( rc = exp->ParseExpression( Expression, dbfPtr )) != 0 ){ + std::cout << "Parse Error " << rc << " in expression " << Expression + << std::endl; + if( exp ) + delete exp; + return 1; + } + + if(( rc = exp->ProcessExpression()) != 0 ){ + std::cout << "Error " << rc << " processing expression " << Expression + << std::endl; + if( exp ) + delete exp; + return 1; + } + char type = exp->GetExpressionResultType(); + if( type != 'N' && type != 'L' ){ + std::cout << "Expression " << Expression; + std::cout << " Expected result type Numeric or Logical, actual was "; + std::cout << type << std::endl; + delete exp; + return 1; + } + + if( type == 'N' ){ + xbString d1; + xbString d2; + d1.setNum( "2.4", ExpectedResult ); + d2.setNum( "2.4", exp->GetDoubleResult()); + if( d1 != d2 ){ + std::cout << "Expression " << Expression; + std::cout << " Actual result of " << d2 << " does not match"; + std::cout << " expected result of " << d1 << std::endl; + delete exp; + return 1; + } + } + if( type == 'L' && ExpectedResult != (xbDouble) exp->GetIntResult()){ + std::cout << "Expression " << Expression; + std::cout << " Actual result of " << exp->GetIntResult() + << " does not match "; + std::cout << " expected result of " << ExpectedResult << std::endl; + delete exp; + return 1; + } + + std::cout << "Expression " << Expression << " returned " << ExpectedResult; + std::cout << " OK" << std::endl; + delete exp; + return 0; +} +/**************************************************************************/ +xbShort ExpTestor::TestExpression( const char * Expression, + const char * ExpectedResult ) +{ +// xbExpNode * e; + xbExpn * exp; + xbShort rc; + + exp = new xbExpn( xbptr ); + if(( rc = exp->ParseExpression( Expression, dbfPtr )) != 0 ){ + std::cout << "Parse Error " << rc << " in expression " << Expression + << std::endl; + if( exp ) + delete exp; + return 1; + } + + if(( rc = exp->ProcessExpression()) != 0 ){ + std::cout << "Error " << rc << " processing expression " << Expression + << std::endl; + delete exp; + return 1; + } + char type = exp->GetExpressionResultType(); + if( type != 'C' ){ + std::cout << "Expression " << Expression; + std::cout << " Expected result type Character, actual was " << type + << std::endl; + delete exp; + return 1; + } + + if( strlen( ExpectedResult ) != strlen( exp->GetStringResult())){ + std::cout << "Expression " << Expression; + std::cout << " result length of " + << strlen( exp->GetStringResult()) + << " different than expected of " << strlen( ExpectedResult ) + << std::endl; + std::cout << "Calculated result =" << exp->GetStringResult() + << "<" << std::endl; + delete exp; + return 1; + } + + if( strcmp( ExpectedResult, exp->GetStringResult())){ + std::cout << "Expression " << Expression; + std::cout << " Actual result of " << exp->GetStringResult() + << " does not match "; + std::cout << " expected result of " << ExpectedResult << std::endl; + delete exp; + return 1; + } + + std::cout << "Expression " << Expression << " returned " << ExpectedResult; + std::cout << " OK" << std::endl; + return 0; +} +/*************************************************************************/ +int main() +{ + xbSchema MyRecord[] = + { + { "FLOAT1", XB_FLOAT_FLD, 9, 2 }, + { "DATE1", XB_DATE_FLD, 8, 0 }, + { "DATE2", XB_DATE_FLD, 8, 0 }, + { "", 0, 0, 0 }, + }; + + xbXBase x; + xbDbf d( &x ); + xbExpn exp( &x ); + + d.CreateDatabase( "TEST", MyRecord, XB_OVERLAY ); + d.PutFloatField( "FLOAT1", 5 ); + d.PutField( "DATE1", "19990110" ); + d.PutField( "DATE2", "19990120" ); + d.AppendRecord(); + + std::cout << "XBase Expression testing program.." << std::endl; + std::cout << "This program tests the XBase expression logic." << std::endl; + ExpTestor * e = new ExpTestor( &x, &d ); + +/* test functions which return a character value result */ + e->TestExpression( "CDOW( \"20000101\" )", "Saturday " ); + e->TestExpression( "CHR( 101 )", "e" ); + e->TestExpression( "CMONTH( \"20000101\" )", "January " ); + e->TestExpression( "DATE()", exp.DATE() ); + e->TestExpression( "DTOC( \"20000101\" )", "01/01/00" ); + e->TestExpression( "DTOS( \"20000101\" )", "20000101" ); + e->TestExpression( "LEFT( \"STRING\", 3 )", "STR" ); + e->TestExpression( "LTRIM( \" xxxxxx\" )", "xxxxxx" ); + e->TestExpression( "LOWER( \"AAAA\" )", "aaaa" ); + + e->TestExpression( "REPLICATE( \"abc\", 3 )", "abcabcabc" ); + e->TestExpression( "RTRIM( \"zzz \" )", "zzz" ); + e->TestExpression( "RTRIM( \"zzz \" )+\"qqq\"", "zzzqqq" ); + e->TestExpression( "SPACE( 3 )", " " ); + + e->TestExpression( "STR( -52.345 )", " -52" ); + e->TestExpression( "STR( -52.345, 3 )", "-52" ); + e->TestExpression( "STR( 52.34, 4, 1 )", "52.3" ); + +// not sure what the STRZERO function is supposed to do +/* + e->TestExpression( "STRZERO( \"aaa\" )", "not sure" ); + e->TestExpression( "STRZERO( \"aaa\", 3, 3, )", "??" ); + e->TestExpression( "STRZERO( 22 )", "not sure" ); + e->TestExpression( "STRZERO( 22, 3 )", "not sure" ); + e->TestExpression( "STRZERO( 2, 3, 3 )", "not sure" ); + e->TestExpression( "STRZERO( \"ddd\", 4, 6 ), "not sure" ); +*/ + e->TestExpression( "TRIM( \"aaa \" )", "aaa" ); + e->TestExpression( "UPPER( \"abcde\" )", "ABCDE" ); + +/* functions returning double values */ + e->TestExpression( "ABS( -222 )", 222 ); + e->TestExpression( "EXP( 1 )", (xbDouble) 2.7182800 ); + e->TestExpression( "LOG( 2 )", (xbDouble) 0.69314700 ); + e->TestExpression( "MAX( 10, 27 )", 27 ); + e->TestExpression( "MIN( 10, 5 )", 5 ); + e->TestExpression( "SQRT( 9 )", 3 ); + +/* functions returning long values */ + e->TestExpression( "ASC( \"A\" )", 'A' ); + e->TestExpression( "AT( \"BC\", \"ABCD\" )", 2 ); + e->TestExpression( "DAY( 20000101 )", 1 ); + + e->TestExpression( "DESCEND( 1500 )", -1500 ); + + e->TestExpression( "DOW( 20000101 )", 6 ); + e->TestExpression( "INT( 621.5 )", 621 ); + e->TestExpression( "ISALPHA( \"A\" )", 1 ); + e->TestExpression( "ISLOWER( \"a\" )", 1 ); + e->TestExpression( "ISUPPER( \"A\" )", 1 ); + e->TestExpression( "LEN( \"AAAAA\" )", 5 ); + e->TestExpression( "MONTH( 20000101 )", 1 ); + e->TestExpression( "RECNO()", (xbDouble) 0 ); + e->TestExpression( "VAL( \"ABC\" )", 65 ); + e->TestExpression( "YEAR( \"20000101\" )", 2000 ); + + e->TestExpression( "(25-3+2)*2", 48 ); + e->TestExpression( "(25+3+2)*2", 60 ); + e->TestExpression( "TEST->FLOAT1+1", 6 ); + e->TestExpression( "TEST->FLOAT1 + 1", 6 ); + e->TestExpression( "FLOAT1+1", 6 ); + e->TestExpression( "FLOAT1 + 1", 6 ); + + e->TestExpression( "TEST->FLOAT1 < 1", (xbDouble) 0 ); + e->TestExpression( "TEST->FLOAT1 > 1", (xbDouble) 1 ); + e->TestExpression( "TEST->DATE2 - TEST->DATE1", (xbDouble) 10 ); + + e->TestExpression( "IIF( \"TEST->FLOAT1>0\", \"T\", \"F\" )", "F" ); + e->TestExpression( "IIF( \"TEST->FLOAT1<=0\", \"T\", \"F\" )", "T" ); + + + delete e; + return 0; +} diff --git a/libtest/indextst.cpp b/libtest/indextst.cpp new file mode 100755 index 0000000..c3a74be --- /dev/null +++ b/libtest/indextst.cpp @@ -0,0 +1,297 @@ +/* indextst.cpp + + Xbase project source code + + This program creates a sample database and multiple indices. + It tests the index logic. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +#include "xbase64/xbase64.h" + +int CheckIndex( +#ifdef XB_INDEX_NDX + xbNdx *indx1, xbNdx *indx2, xbNdx *indx3 +#endif +#if defined( XB_INDEX_NDX ) && defined ( XB_INDEX_NTX ) + , +#endif +#ifdef XB_INDEX_NTX + xbNtx *intx1, xbNtx *intx2, xbNtx *intx3 +#endif + ); + +int main() +{ + xbShort f1, f2, f3, rc, sts = 0; + char charbuf[10]; + + xbSchema MyRecord[] = + { + { "CHARFLD1", XB_CHAR_FLD, 6, 0 }, + { "CHARFLD2", XB_CHAR_FLD, 6, 0 }, + { "NUMFLD1", XB_NUMERIC_FLD, 6, 0 }, + { "",0,0,0 } + }; + + /* define the classes */ + xbXBase x; /* initialize xbase */ + xbDbf MyFile( &x ); /* class for table */ + +#ifdef XB_INDEX_NDX + xbNdx indx1( &MyFile ); /* class for ndx index 1 */ + xbNdx indx2( &MyFile ); /* class for ndx index 2 */ + xbNdx indx3( &MyFile ); /* class for ndx index 3 */ +#endif + +#ifdef XB_INDEX_NTX + xbNtx intx1( &MyFile ); /* class for ntx index 1 */ + xbNtx intx2( &MyFile ); /* class for ntx index 2 */ + xbNtx intx3( &MyFile ); /* class for ntx index 3 */ +#endif + +#ifndef XBASE_DEBUG + std::cout << "XBASE_DEBUG support option not compiled into library"; + return 1; +#endif + + + std::cout << "Creating test database and indices" << std::endl; + if(( rc = MyFile.CreateDatabase( "IXTEST.DBF", MyRecord, XB_OVERLAY )) + != XB_NO_ERROR ) + std::cout << "Error creating database = " << rc << "\n"; + else + { +#ifdef XB_INDEX_NDX + if(( rc = indx1.CreateIndex( + "IXNDX1.NDX", "CHARFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + { + std::cout << "Error creating index 1 = " << rc << std::endl; + exit( 1 ); + } + + if(( rc = indx2.CreateIndex( + "IXNDX2.NDX", "CHARFLD1+CHARFLD2", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + { + std::cout << "Error creating index 2 = " << rc << std::endl; + exit( 1 ); + } + + if(( rc = indx3.CreateIndex( + "IXNDX3.NDX", "NUMFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + { + std::cout << "Error creating index 3 = " << rc << std::endl; + exit( 1 ); + } +#endif + + +#ifdef XB_INDEX_NTX + if(( rc = intx1.CreateIndex( + "IXNTX1.NTX", "CHARFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + { + std::cout << "Error creating index 4 = " << rc << std::endl; + exit( 1 ); + } + + if(( rc = intx2.CreateIndex( + "IXNTX2.NTX", "CHARFLD1+CHARFLD2", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + { + std::cout << "Error creating index 5 = " << rc << std::endl; + exit( 1 ); + } + + if(( rc = intx3.CreateIndex( + "IXNTX3.NTX", "NUMFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ) + { + std::cout << "Error creating index 6 = " << rc << std::endl; + exit( 1 ); + } +#endif + } + + f1 = MyFile.GetFieldNo( "CHARFLD1" ); + f2 = MyFile.GetFieldNo( "CHARFLD2" ); + f3 = MyFile.GetFieldNo( "NUMFLD1" ); + + std::cout << "Populating database and indices with data" << std::endl; + std::cout << "."; + std::cout.flush(); + for( int i = 0; i < 10000; i++ ){ + if( i % 100 == 0){ + std::cout << "."; + std::cout.flush(); + } + memset( charbuf, 0x00, 10 ); + sprintf( charbuf, "%d", i ); + MyFile.BlankRecord(); + MyFile.PutField( f1, charbuf ); + MyFile.PutField( f2, charbuf ); + MyFile.PutLongField( f3, i ); + MyFile.AppendRecord(); + + + } + std::cout << " Done." << std::endl; + + // Check all indices. + sts += CheckIndex( +#ifdef XB_INDEX_NDX + &indx1, &indx2, &indx3 +#endif +#if defined( XB_INDEX_NDX ) && defined( XB_INDEX_NTX ) + , +#endif +#ifdef XB_INDEX_NTX + &intx1, &intx2, &intx3 +#endif + ); + // + // Appending a "Z" to the records will cause the index delete + // functions to be used. + // + // - Bob Cotton <bob@synxis.com> + // + std::cout << "Reversing records." << std::endl; + std::cout << "."; + std::cout.flush(); + for( xbLong j = 1; j < MyFile.NoOfRecords(); j++ ){ + if (j % 1000 == 0) + { + std::cout << "."; + std::cout.flush(); + } + MyFile.GetRecord(j); + memset( charbuf, 0x00, 10 ); + sprintf( charbuf, "Z%d", (int)j-1 ); + MyFile.PutField( f1, charbuf ); + MyFile.PutField( f2, charbuf ); + MyFile.PutLongField( f3, j-1 ); + MyFile.PutRecord(); + } + std::cout << " Done." << std::endl; + // Check all indices + sts += CheckIndex( +#ifdef XB_INDEX_NDX + &indx1, &indx2, &indx3 +#endif +#if defined( XB_INDEX_NDX ) && defined( XB_INDEX_NTX ) + , +#endif +#ifdef XB_INDEX_NTX + &intx1, &intx2, &intx3 +#endif + ); + + + std::cout << "Index testing completed" << std::endl;std::cout.flush(); + MyFile.CloseDatabase(); /* Close database and associated indexes */ + return sts; +} + + +int CheckIndex( +#ifdef XB_INDEX_NDX + xbNdx *indx1, + xbNdx *indx2, + xbNdx *indx3 +#endif +#if defined( XB_INDEX_NDX ) && defined( XB_INDEX_NTX ) + , +#endif +#ifdef XB_INDEX_NTX + xbNtx *intx1, + xbNtx *intx2, + xbNtx *intx3 +#endif + ) +{ + int rc; + int sts = 0; + +#if defined( XB_INDEX_NDX ) && defined( XBASE_DEBUG ) + std::cout << "Testing NDX index 1 "; std::cout.flush(); + if(( rc = indx1->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ + std::cout << "Error " << rc << " with index indx1" << std::endl; + sts++; + } + else + std::cout << "OK" << std::endl; + + std::cout << "Testing NDX index 2 ";std::cout.flush(); + if(( rc = indx2->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ + std::cout << "Error " << rc << " with index indx2" << std::endl; + sts++; + } + else + std::cout << "OK" << std::endl; + + + std::cout << "Testing NDX index 3 ";std::cout.flush(); + if(( rc = indx3->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ + std::cout << "Error " << rc << " with index indx3" << std::endl; + sts++; + } + else + std::cout << "OK" << std::endl; +#endif +#if defined( XB_INDEX_NTX ) && defined( XBASE_DEBUG ) + std::cout << "Testing NTX index 1 ";std::cout.flush(); + if(( rc = intx1->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ + std::cout << "Error " << rc << " with index intx1" << std::endl; + sts++; + } + else + std::cout << "OK" << std::endl; + + std::cout << "Testing NTX index 2 ";std::cout.flush(); + if(( rc = intx2->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ + std::cout << "Error " << rc << " with index intx2" << std::endl; + sts++; + } + else + std::cout << "OK" << std::endl; + + std::cout << "Testing NTX index 3 ";std::cout.flush(); + if(( rc = intx3->CheckIndexIntegrity(0)) != XB_NO_ERROR ){ + std::cout << "Error " << rc << " with index intx3" << std::endl; + sts++; + } + else + std::cout << "OK" << std::endl; +#endif + return sts; + +} + diff --git a/libtest/lfiletst.cpp b/libtest/lfiletst.cpp new file mode 100755 index 0000000..7e50c8f --- /dev/null +++ b/libtest/lfiletst.cpp @@ -0,0 +1,138 @@ +/* lfiletst.cpp + + Xbase project source code + + This program creates a sample database and multiple indices. + It tests the 64 bit file support logic. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +#include "xbase64/xbase64.h" + +int main() +{ + xbShort f1, f2, f3, f4, rc; +#ifdef XB_MEMO_FIELDS + xbShort f5; +#endif + char charbuf[10]; + + xbSchema MyRecord[] = + { + { "CHARFLD1", XB_CHAR_FLD, 10, 0 }, + { "NUMFLD1", XB_NUMERIC_FLD, 10, 0 }, + { "BIGFIELD1", XB_CHAR_FLD, 255, 0 }, + { "BIGFIELD2", XB_CHAR_FLD, 255, 0 }, + { "BIGFIELD3", XB_CHAR_FLD, 255, 0 }, + { "BIGFIELD4", XB_CHAR_FLD, 255, 0 }, +#ifdef XB_MEMO_FIELDS + { "MEMOFLD", XB_MEMO_FLD, 10, 0 }, +#endif + { "",0,0,0 } + }; + + /* define the classes */ + xbXBase x; /* initialize xbase */ + xbDbf MyFile( &x ); /* class for table */ + +#ifdef XB_INDEX_NDX + xbNdx indx1( &MyFile ); /* class for ndx index 1 */ +#endif + +#ifdef XB_INDEX_NTX + xbNtx intx1( &MyFile ); /* class for ntx index 1 */ +#endif + +#ifndef XBASE_64_BIT + std::cout << "XBASE_64_BIT support option not compiled into library"; + return 1; +#endif + + std::cout << "Creating test database and indices" << std::endl; + if(( rc = MyFile.CreateDatabase( "LFTEST.DBF", MyRecord, XB_OVERLAY )) + != XB_NO_ERROR ) + std::cout << "Error creating database = " << rc << "\n"; + else + { +#ifdef XB_INDEX_NDX + if(( rc = indx1.CreateIndex( + "LFNDX1.NDX", "CHARFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ){ + std::cout << "Error creating index 1 = " << rc << std::endl; + exit( 1 ); + } +#endif + +#ifdef XB_INDEX_NTX + if(( rc = intx1.CreateIndex( + "LFNTX1.NTX", "CHARFLD1", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR ){ + std::cout << "Error creating index 2 = " << rc << std::endl; + exit( 1 ); + } +#endif + } + + f1 = MyFile.GetFieldNo( "CHARFLD1" ); + f2 = MyFile.GetFieldNo( "NUMFLD1" ); + f3 = MyFile.GetFieldNo( "BIGFIELD1" ); + f4 = MyFile.GetFieldNo( "BIGFIELD2" ); +#ifdef XB_MEMO_FIELDS + f5 = MyFile.GetFieldNo( "MEMOFLD" ); +#endif + + std::cout << "sizeof( XbOffT ) = " << sizeof( xbOffT ) << std::endl; + std::cout << "sizeof( xbLong ) = " << sizeof( xbLong ) << std::endl; + std::cout << "Populating database and indices with data" << std::endl; + std::cout << "This will take a while and consume some 20G of disk space" << std::endl; + std::cout << "<ctrl><C> to kill this program" << std::endl; + std::cout << "."; + std::cout.flush(); + for( long i = 0; i < 20000000; i++ ){ + if( i % 5000 == 0){ + std::cout << "."; + std::cout.flush(); + } + memset( charbuf, 0x00, 10 ); + sprintf( charbuf, "%d", i ); + MyFile.BlankRecord(); + MyFile.PutField( f1, charbuf ); + MyFile.PutLongField( f2, i ); + MyFile.PutField( f3, charbuf ); + MyFile.PutField( f4, charbuf ); +#ifdef XB_MEMO_FIELDS + MyFile.UpdateMemoData( f5, strlen( charbuf ), charbuf, 0 ); +#endif + MyFile.AppendRecord(); + } + std::cout << " Done." << std::endl; +} diff --git a/libtest/locktest.cpp b/libtest/locktest.cpp new file mode 100755 index 0000000..01f75de --- /dev/null +++ b/libtest/locktest.cpp @@ -0,0 +1,77 @@ +/* + This debugging program tests Xbase locking functions + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + + +*/ + +#include "xbase64/xbase64.h" + +int main(int, char**) +{ +#if 0 // FIXME - seriously +#ifdef XB_LOCKING_ON + xbShort rc; + + if(2!=ac){ + cout << "\nUsage: locktest filename\n"; + return 1; + } + + if(( rc = d.OpenDatabase( av[1] )) != XB_NO_ERROR ) { + cout << "\nError " << rc << " opening file " << av[1] << endl; + exit(0); + } + xbXBase x; + xbDbf d( &x ); + + cout << "\nGoing to lock database..." << endl; + rc = d.LockDatabase( F_SETLKW, F_WRLCK, 1L ); + if ( rc == -1 ){ + perror("Lock Error"); + return 2; + } + cout << "Database locked\n\nEnter a keystroke to release lock\n"; + char xx[4]; + cin >> xx; + + rc = d.LockDatabase( F_SETLK, F_UNLCK, 1L ); + cout << "Unlock database rc = " << rc << "\n"; + d.CloseDatabase(); +#else + cout << "\nXB_LOCKING_ON is not compiled in\n"; +#endif +#endif + return 0; +} diff --git a/libtest/makebcc.bat b/libtest/makebcc.bat new file mode 100755 index 0000000..bc38b05 --- /dev/null +++ b/libtest/makebcc.bat @@ -0,0 +1,16 @@ +
+rem This batch file builds the xbase sample programs
+rem using the borland 5.5 compiler
+
+del *.bak
+del *.tds
+del *.exe
+del *.obj
+del compout
+
+
+bcc32 -Id:\xbase64 -Id:\borland\bcc55\include -L\borland\bcc55\lib -L..\xbase64 indextst.cpp xbase64.lib >> compout
+bcc32 -Id:\xbase64 -Id:\borland\bcc55\include -L\borland\bcc55\lib -L..\xbase64 exptest.cpp xbase64.lib >> compout
+bcc32 -Id:\xbase64 -Id:\borland\bcc55\include -L\borland\bcc55\lib -L..\xbase64 locktest.cpp xbase64.lib >> compout
+bcc32 -Id:\xbase64 -Id:\borland\bcc55\include -L\borland\bcc55\lib -L..\xbase64 testdate.cpp xbase64.lib >> compout
+
diff --git a/libtest/readme b/libtest/readme new file mode 100755 index 0000000..64f6b52 --- /dev/null +++ b/libtest/readme @@ -0,0 +1,10 @@ +The libtest directory includes programs which are designed for +testing the basic functionality of the library. These programs +are intended to be used to find bugs in the basic library functions +after enhancements/updates or fixes have been applied to the library. + +testdate - used for testing date logic +indextst - used for testing indices +exptest - used for testing the expression logic +locktest - used for the debugging of the record and file locking logic +lfiletst - used for testing 64 bit file support
\ No newline at end of file diff --git a/libtest/testdate.cpp b/libtest/testdate.cpp new file mode 100755 index 0000000..1049049 --- /dev/null +++ b/libtest/testdate.cpp @@ -0,0 +1,213 @@ +/* + Xbase project source code + + This program tests the xdate routines + + This program tests and demonstrates usage of the various xbDate methods + + Several of the tests pass either StringDate or Chardate to the method + being tested - this is done to test the class methods. In actual usage, + this may not be necessary due to the instance of the class already + containing a date value. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include "xbase64/xbase64.h" + +int main() +{ + xbString StringDate( "19701007" ); /* oct 7 1960 */ + char CharDate[9] = "19611109"; /* nov 9 1961 */ + + xbDate d1; /* today is default */ + xbDate d2( StringDate ); /* from string data */ + xbDate d3( CharDate ); /* from char data */ + xbDate d4; /* another date class */ + + std::cout << "This program tests the XDATE routines" << std::endl; + std::cout << "Date 1 (Sysdate) is " << d1.GetDate() << std::endl; + std::cout << "Date 2 (StringDate) is " << d2.GetDate() << std::endl; + std::cout << "Date 3 (CharDate) is " << d3.GetDate() << std::endl; + + std::cout << "This year is " << d1.YearOf() << std::endl; + std::cout << "Year of xbString Date is " << d2.YearOf( StringDate ) + << std::endl; + std::cout << "Year of char Date is " << d3.YearOf( CharDate ) + << std::endl; + + std::cout << "This Month is " << d1.MonthOf() << std::endl; + std::cout << "Month of xbString Date is " << d2.MonthOf( StringDate ) + << std::endl; + std::cout << "Month of char Date is " << d3.MonthOf( CharDate ) + << std::endl; + + std::cout << "Today is day " << d1.DayOf( XB_FMT_WEEK ) << " of the week" + << std::endl; + std::cout << "StringDate is day " << d2.DayOf( XB_FMT_MONTH, StringDate ) + << " of the month" << std::endl; + std::cout << "CharDate is day " << d3.DayOf( XB_FMT_YEAR, CharDate ) + << " of the year" << std::endl; + + if( d1.IsLeapYear()) + std::cout << "This is a leapyear" << std::endl; + else + std::cout << "This is not a leap year." << std::endl; + + if( d2.IsLeapYear( StringDate )) + std::cout << "StringDate is a leapyear" << std::endl; + else + std::cout << "StringDate is not a leap year." << std::endl; + + if( d3.IsLeapYear( CharDate )) + std::cout << "CharDate is a leapyear" << std::endl; + else + std::cout << "CharDate is not a leap year." << std::endl; + + std::cout << "Today is " << d1.Sysdate() << std::endl; + + if( d1.DateIsValid( "19951301" )) + std::cout << "19951301 is a valid date" << std::endl; + else + std::cout << "19951301 is not a valid date" << std::endl; + + if( d1.DateIsValid( "19920229" )) + std::cout << "19920229 is a valid date" << std::endl; + else + std::cout << "19920229 is not a valid date" << std::endl; + + if( d2.DateIsValid( StringDate )) + std::cout << StringDate << " is a valid date" << std::endl; + else + std::cout << StringDate << " is not a valid date" << std::endl; + + std::cout << "Today's Julian date " << d1.JulianDays() << std::endl; + std::cout << "Julian date of Jan 01, 1970 " << d2.JulianDays( "19700101" ) + << std::endl; + std::cout << "StringDate Julian date " << d2.JulianDays( StringDate ) + << std::endl; + + std::cout << "There are " + << ( d1.JulianDays( "19951101" ) - d1.JulianDays( "19951001" )) + << " days between 10/1/95 and 11/1/95." << std::endl; + + std::cout << "Todays Julian date (Number of days since Jan 1 0100):" + << d1.JulianDays() << std::endl; + + d4 = d1; // set d4 class = to sysdate + std::cout << "Object d4 initialized to " << d4.GetDate() << std::endl; + std::cout << "This should be todays date: " + << d4.JulToDate8(d4.JulianDays()) << std::endl; + std::cout << "In 7 days it will be " + << d4.JulToDate8(d4.JulianDays() + 7L ) << std::endl; + + std::cout << "Today is " << d1.CharDayOf() << std::endl; + std::cout << "StringDate day is " << d2.CharDayOf( StringDate ) + << std::endl; + std::cout << "This month is " << d1.CharMonthOf() << std::endl; + std::cout << "StringDate month is " << d2.CharMonthOf() << std::endl; + + + /* various format routines using different formats, strings and chars */ + xbString xbStFmt( "MM/DD/YY" ); + std::cout << "Format (YYDDD) " << d1.FormatDate( "YYDDD" ) << std::endl; + std::cout << "Format (MM/DD/YY) " << d1.FormatDate( xbStFmt ) << std::endl; + xbStFmt = "DD/MM/YY"; + std::cout << "Format (DD/MM/YY) " << d1.FormatDate(xbStFmt, "19730110") + << std::endl; + std::cout << "Format (MMMM DD,YYYY) " + << d1.FormatDate( "MMMM DD,YYYY", d1.GetDate()) << std::endl; + xbStFmt = "DDDD, MMMM DD YYYY"; + std::cout << "Format (DDDD, MMMM DD YYYY) " + << d2.FormatDate( xbStFmt, d2.GetDate()) << std::endl; + + std::cout << "Last day this month " << d1.LastDayOfMonth() << std::endl; + std::cout << "Last day of month for StringDate is " + << d2.LastDayOfMonth( d2.GetDate()) << std::endl; + + std::cout << "Overloaded operators test..." << std::endl; + + if( d1 == d2 ) + std::cout << d1.GetDate() << " is equal to " << d2.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is not equal to " << d2.GetDate() + << std::endl; + + if( d1 != d3 ) + std::cout << d1.GetDate() << " is not equal to " << d3.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is equal to " << d3.GetDate() + << std::endl; + + if( d1 < d2 ) + std::cout << d1.GetDate() << " is less than " << d2.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is not less than " << d2.GetDate() + << std::endl; + + if( d1 > d2 ) + std::cout << d1.GetDate() << " is greater than " << d2.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is not greater than " << d2.GetDate() + << std::endl; + + if( d1 <= d2 ) + std::cout << d1.GetDate() << " is less than or equal to " << d2.GetDate() + << std::endl; + else + std::cout << d1.GetDate() << " is not less than or equal to " + << d2.GetDate() << std::endl; + + if( d1 >= d2 ) + std::cout << d1.GetDate() << " is greater than or equal to " + << d2.GetDate() << std::endl; + else + std::cout << d1.GetDate() << " is not greater than or equal to " + << d2.GetDate() << std::endl; + + d1.Sysdate(); + d1++; + std::cout << "Tomorrow is " << d1.GetDate() << std::endl; + d1-=2; + std::cout << "Yesterday was " << d1.GetDate() << std::endl; + std::cout << "There are " << d1 - d2 << " days between " << d1.GetDate() + << " and " << d2.GetDate() << std::endl; + + return 0; +} + diff --git a/ltconfig b/ltconfig new file mode 100755 index 0000000..43049d1 --- /dev/null +++ b/ltconfig @@ -0,0 +1,2105 @@ +#! /bin/sh + +# ltconfig - Create a system-specific libtool. +# Copyright (C) 1996-1998 Free Software Foundation, Inc. +# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# 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. + +# A lot of this script is taken from autoconf-2.10. + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} +echo=echo +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit 0 +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec "$SHELL" "$0" --no-reexec ${1+"$@"} +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi + +if test "X${echo_test_string+set}" != "Xset"; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || + test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + for dir in $PATH /usr/ucb; do + if test -f $dir/echo && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif test -f /bin/ksh && test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # Cool, printf works + : + elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# The name of this program. +progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` + +# Constants: +PROGRAM=ltconfig +PACKAGE=libtool +VERSION=1.2c +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' +rm="rm -f" + +help="Try \`$progname --help' for more information." + +# Global variables: +default_ofile=libtool +can_build_shared=yes +enable_shared=yes +# All known linkers require a `.a' archive for static linking. +enable_static=yes +ltmain= +silent= +srcdir= +ac_config_guess= +ac_config_sub= +host= +nonopt= +ofile="$default_ofile" +verify_host=yes +with_gcc=no +with_gnu_ld=no +need_locks=yes +objext=o +libext=a + +old_AR="$AR" +old_CC="$CC" +old_CFLAGS="$CFLAGS" +old_CPPFLAGS="$CPPFLAGS" +old_LD="$LD" +old_LN_S="$LN_S" +old_NM="$NM" +old_RANLIB="$RANLIB" +old_DLLTOOL="$DLLTOOL" +old_AS="$AS" + +# Parse the command line options. +args= +prev= +for option +do + case "$option" in + -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + eval "$prev=\$option" + prev= + continue + fi + + case "$option" in + --help) cat <<EOM +Usage: $progname [OPTION]... [HOST [LTMAIN]] + +Generate a system-specific libtool script. + + --debug enable verbose shell tracing + --disable-shared do not build shared libraries + --disable-static do not build static libraries + --help display this help and exit + --no-verify do not verify that HOST is a valid host type +-o, --output=FILE specify the output file [default=$default_ofile] + --quiet same as \`--silent' + --silent do not print informational messages + --srcdir=DIR find \`config.guess' in DIR + --version output version information and exit + --with-gcc assume that the GNU C compiler will be used + --with-gnu-ld assume that the C compiler uses the GNU linker + --disable-lock disable file locking + +LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program +that provides basic libtool functionality. + +HOST is the canonical host system name [default=guessed]. +EOM + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --disable-shared) enable_shared=no ;; + + --disable-static) enable_static=no ;; + + --quiet | --silent) silent=yes ;; + + --srcdir) prev=srcdir ;; + --srcdir=*) srcdir="$optarg" ;; + + --no-verify) verify_host=no ;; + + --output | -o) prev=ofile ;; + --output=*) ofile="$optarg" ;; + + --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;; + + --with-gcc) with_gcc=yes ;; + --with-gnu-ld) with_gnu_ld=yes ;; + + --disable-lock) need_locks=no ;; + + -*) + echo "$progname: unrecognized option \`$option'" 1>&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if test -z "$ltmain"; then + ltmain="$option" + elif test -z "$host"; then +# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then +# echo "$progname: warning \`$option' is not a valid host type" 1>&2 +# fi + host="$option" + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac +done + +if test -z "$ltmain"; then + echo "$progname: you must specify a LTMAIN file" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +if test ! -f "$ltmain"; then + echo "$progname: \`$ltmain' does not exist" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +# Quote any args containing shell metacharacters. +ltconfig_args= +for arg +do + case "$arg" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ltconfig_args="$ltconfig_args '$arg'" ;; + *) ltconfig_args="$ltconfig_args $arg" ;; + esac +done + +# A relevant subset of AC_INIT. + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 5 compiler messages saved in config.log +# 6 checking for... messages and results +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>>./config.log + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + +if test -z "$srcdir"; then + # Assume the source directory is the same one as the path to LTMAIN. + srcdir=`$echo "$ltmain" | $Xsed -e 's%/[^/]*$%%'` + test "$srcdir" = "$ltmain" && srcdir=. +fi + +trap "$rm conftest*; exit 1" 1 2 15 +if test "$verify_host" = yes; then + # Check for config.guess and config.sub. + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/config.guess; then + ac_aux_dir=$ac_dir + break + fi + done + if test -z "$ac_aux_dir"; then + echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + + # Make sure we can run config.sub. + if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : + else + echo "$progname: cannot run $ac_config_sub" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + + host_alias=$host + case "$host_alias" in + "") + if host_alias=`$SHELL $ac_config_guess`; then : + else + echo "$progname: cannot guess host type; you must specify one" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac + host=`$SHELL $ac_config_sub $host_alias` + echo "$ac_t$host" 1>&6 + + # Make sure the host verified. + test -z "$host" && exit 1 + +elif test -z "$host"; then + echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 + echo "$help" 1>&2 + exit 1 +else + host_alias=$host +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host_os" in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +case "$host_os" in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "${COLLECT_NAMES+set}" != set; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR cru $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +# Set a sane default for `AR'. +test -z "$AR" && AR=ar + +# If RANLIB is not set, then run the test. +if test "${RANLIB+set}" != "set"; then + result=no + + echo $ac_n "checking for ranlib... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/ranlib; then + RANLIB="ranlib" + result="ranlib" + break + fi + done + IFS="$save_ifs" + + echo "$ac_t$result" 1>&6 +fi + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" +fi + +# Set sane defaults for `DLLTOOL' and `AS', used on cygwin32. +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$AS" && AS=as + +# Check to see if we are using GCC. +if test "$with_gcc" != yes || test -z "$CC"; then + # If CC is not set, then try to find GCC or a usable CC. + if test -z "$CC"; then + echo $ac_n "checking for gcc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + IFS="$save_ifs" + test -z "$dir" && dir=. + if test -f $dir/gcc; then + CC="gcc" + break + fi + done + IFS="$save_ifs" + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + fi + + # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". + if test -z "$CC"; then + echo $ac_n "checking for cc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + cc_rejected=no + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/cc; then + if test "$dir/cc" = "/usr/ucb/cc"; then + cc_rejected=yes + continue + fi + CC="cc" + break + fi + done + IFS="$save_ifs" + if test $cc_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same name, so the bogon will be chosen + # first if we set CC to just the name; use the full file name. + shift + set dummy "$dir/cc" "$@" + shift + CC="$@" + fi + fi + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$CC"; then + echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 + exit 1 + fi + fi + + # Now see if the compiler is really GCC. + with_gcc=no + echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 + echo "$progname:530: checking whether we are using GNU C" >&5 + + $rm conftest.c + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF + if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + with_gcc=yes + fi + $rm conftest.c + echo "$ac_t$with_gcc" 1>&6 +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for object suffix... $ac_c" 1>&6 +$rm conftest* +echo 'int i = 1;' > conftest.c +echo "$progname:552: checking for object suffix" >& 5 +if { (eval echo $progname:553: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* +echo "$ac_t$objext" 1>&6 + +echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 +pic_flag= +special_shlib_compile_flags= +wl= +link_static_flag= +no_builtin_flag= + +if test "$with_gcc" = yes; then + wl='-Wl,' + link_static_flag='-static' + + case "$host_os" in + aix3* | aix4* | irix5* | irix6* | osf3* | osf4*) + # PIC is the default for these OSes. + ;; + cygwin32* | mingw32* | os2*) + # We can build DLLs from non-PIC. + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + pic_flag='-m68020 -resident32 -malways-restore-a4' + ;; + *) + pic_flag='-fPIC' + ;; + esac +else + # PORTME Check for PIC flags for the system compiler. + case "$host_os" in + aix3* | aix4*) + # All AIX code is PIC. + link_static_flag='-bnso -bI:/lib/syscalls.exp' + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag="${wl}-a ${wl}archive" + pic_flag='+Z' + ;; + + irix5* | irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin32* | mingw32* | os2*) + # We can build DLLs from non-PIC. + ;; + + osf3* | osf4*) + # All OSF/1 code is PIC. + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' + ;; + + solaris*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + sunos4*) + pic_flag='-PIC' + link_static_flag='-Bstatic' + wl='-Qoption ld ' + ;; + + sysv4.2uw2*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + uts4*) + pic_flag='-pic' + link_static_flag='-Bstatic' + ;; + + *) + can_build_shared=no + ;; + esac +fi + +if test -n "$pic_flag"; then + echo "$ac_t$pic_flag" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $pic_flag -DPIC" + echo "$progname:674: checking if $compiler PIC flag $pic_flag works" >&5 + if { (eval echo $progname:675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + # On HP-UX, both CC and GCC only warn that PIC is supported... then they + # create non-PIC objects. So, if there were any warnings, we assume that + # PIC is not supported. + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + can_build_shared=no + pic_flag= + else + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + can_build_shared=no + pic_flag= + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + echo "$ac_t"none 1>&6 +fi + +# Check to see if options -o and -c are simultaneously supported by compiler +echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 +$rm conftest* +echo "int some_variable = 0;" > conftest.c +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -c -o conftest2.o" +echo "$progname:709: checking if $compiler supports -c -o file.o" >&5 +if { (eval echo $progname:710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest2.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_c_o=no + else + echo "$ac_t"yes 1>&6 + compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_c_o=no + echo "$ac_t"no 1>&6 +fi +CFLAGS="$save_CFLAGS" +$rm conftest* + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + echo "$progname:737: checking if $compiler supports -c -o file.lo" >&5 +if { (eval echo $progname:738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_o_lo=no + else + echo "$ac_t"yes 1>&6 + compiler_o_lo=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_o_lo=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$ac_t$hard_links" 1>&6 + $rm conftest* + if test "$hard_links" = no; then + echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 + need_locks=warn + fi +else + need_locks=no +fi + +if test "$with_gcc" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" + echo "$progname:789: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + if { (eval echo $progname:790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_rtti_exceptions=no + else + echo "$ac_t"yes 1>&6 + compiler_rtti_exceptions=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_rtti_exceptions=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi + +fi + +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 +$rm conftest* +echo 'main(){return(0);}' > conftest.c +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $link_static_flag" +echo "$progname:833: checking if $compiler static flag $link_static_flag works" >&5 +if { (eval echo $progname:834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + echo "$ac_t$link_static_flag" 1>&6 +else + echo "$ac_t"none 1>&6 + link_static_flag= +fi +LDFLAGS="$save_LDFLAGS" +$rm conftest* + +if test -z "$LN_S"; then + # Check to see if we can use ln -s, or we need hard links. + echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 + $rm conftestdata + if ln -s X conftestdata 2>/dev/null; then + $rm conftestdata + LN_S="ln -s" + else + LN_S=ln + fi + if test "$LN_S" = "ln -s"; then + echo "$ac_t"yes 1>&6 + else + echo "$ac_t"no 1>&6 + fi +fi + +# Make sure LD is an absolute path. +if test -z "$LD"; then + ac_prog=ld + if test "$with_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 + echo "$progname:866: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + /* | [A-Za-z]:/*) + re_direlt='/[^/][^/]*/\.\./' + sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%' + # Canonicalize the path of ld + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + case "$host_os" in + cygwin*) + # Convert to a UNC path for cygwin + test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"` + ;; + *) + test -z "$LD" && LD="$ac_prog" + ;; + esac + ;; + ## + ## FIXME: The code fails later on if we try to use an $LD with + ## '\\' path separators. + ## + [A-Za-z]:[\\]*) + re_direlt='\\[^\\][^\\]*\\\.\.\(\\\)' + sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%' + sub_uncdir='s%\\%/%g' + # Canonicalize the path of ld + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"` + done + case "$host_os" in + cygwin*) + # Convert to a UNC path for cygwin + test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive" -e "$sub_uncdir"` + ;; + *) + test -z "$LD" && LD="$ac_prog" + ;; + esac + ;; + "") + # If it fails, then pretend we are not using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld... $ac_c" 1>&6 + echo "$progname:920: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "$progname:923: checking for non-GNU ld" >&5 + fi + + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog"; then + LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + fi + + if test -n "$LD"; then + echo "$ac_t$LD" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi +fi + +# Check to see if it really is or is not GNU ld. +echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then + with_gnu_ld=yes +else + with_gnu_ld=no +fi +echo "$ac_t$with_gnu_ld" 1>&6 + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 + +allow_undefined_flag= +no_undefined_flag= +archive_cmds= +archive_sym_cmds= +old_archive_from_new_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= + +case "$host_os" in +aix3* | aix4*) + # On AIX, the GNU linker works like the native linker. + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + + # See if GNU ld supports shared libraries. + case "$host_os" in + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib$libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs$deplibs' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + cygwin32* | mingw32*) + if test "$with_gcc" = yes; then + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + # Very, very bogus. + echo ' +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#undef WIN32_LEAN_AND_MEAN +#include <stdio.h> + +BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); + +#include <cygwin/cygwin_dll.h> +DECLARE_CYGWIN_DLL( DllMain ); +HINSTANCE __hDllInstance_base; + +BOOL APIENTRY +DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +{ + __hDllInstance_base = hInst; + return TRUE; +} +' > ltdll.c + archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib.exp~ + $DLLTOOL --export-all --output-def $lib.exp~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobs ltdll.$objext~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $rm ltdll.$objext $soname-base $soname-exp' + archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib.exp~ + cat "$export_symbols" > $lib.exp~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobs ltdll.$objext~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $rm ltdll.$objext $soname-base $soname-exp' + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --output-lib $objdir/$libname.a~$rm $lib.exp' + else + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + with_gnu_ld=no + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib$libobjs`echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs' + fix_srcfile_path='`cygpath -w $srcfile`' + fi + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs' + archive_sym_cmds='$CC -shared ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib$libobjs$deplibs' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes && test "$with_gnu_ld" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported + archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp~ + $LD -o $objdir/$soname$libobjs$deplibs -bE:$lib.exp -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + archive_sym_cmds='cat $export_symbols > $lib.exp~ + $LD -o $objdir/$soname$libobjs$deplibs -bE:$lib.exp -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname~$rm $lib.exp' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$with_gcc" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4*) + allow_undefined_flag=unsupported + archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp else cat $export_symbols > $lib.exp~ + $CC -o $objdir/$soname$libobjs$deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry~$AR cru $lib $objdir/$soname' + archive_sym_cmds='cat $export_symbols > $lib.exp~ + $CC -o $objdir/$soname$libobjs$deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry~$AR cru $lib $objdir/$soname~$rm $lib.exp' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib$libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + + cygwin32* | mingw32*) + if test "$with_gcc" = yes; then + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + # Very, very bogus. + echo ' +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#undef WIN32_LEAN_AND_MEAN +#include <stdio.h> + +BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); + +#include <cygwin/cygwin_dll.h> +DECLARE_CYGWIN_DLL( DllMain ); +HINSTANCE __hDllInstance_base; + +BOOL APIENTRY +DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +{ + __hDllInstance_base = hInst; + return TRUE; +} +' > ltdll.c + archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib.exp~ + $DLLTOOL --export-all --output-def $lib.exp~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobs ltdll.$objext~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $rm ltdll.$objext $soname-base $soname-exp' + archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib.exp~ + cat "$export_symbols" > $lib.exp~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobs ltdll.$objext~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $rm ltdll.$objext $soname-base $soname-exp' + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --output-lib $objdir/$libname.a~$rm $lib.exp' + else + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib$libobjs`echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs' + fix_srcfile_path='`cygpath -w $srcfile`' + fi + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3, at last, uses gcc -shared to do shared libraries. + freebsd3*) + archive_cmds='$CC -shared -o $lib$libobjs$deplibs' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + ;; + + hpux9*) + archive_cmds='$rm $objdir/$soname~$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs~test $objdir/$soname = $lib || mv $objdir/$soname $lib' + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10* | hpux11*) + archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$with_gcc" = yes && test "$with_gnu_ld" = yes; then + archive_cmds='$CC -shared -o $lib ${wl}-soname ${wl}$soname ${wl}-set_version ${wl}$verstring$libobjs$deplibs' + else + archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs$deplibs' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + ;; + + netbsd*) + # Tested with NetBSD 1.2 ld + archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp$libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib$libobjs$deplibs $objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' + ;; + + osf3* | osf4*) + if test "$with_gcc" = yes && test "$with_gnu_ld" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} -o $lib ${wl}-soname ${wl}$soname ${wl}-set_version ${wl}$verstring$libobjs$deplibs' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs$deplibs' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -o $lib$libobjs$deplibs' + hardcode_direct=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + if test "$with_gcc" = yes && test "$with_gnu_ld" = yes; then + archive_cmds='$CC -shared ${wl}-h $wl$soname -o $lib$libobjs$deplibs' + else + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib$libobjs$deplibs' + archive_sym_cmds='$echo "{ global:" > $lib.exp~sed $export_symbols -e "s/.*/\1;/" >> $lib.exp~$echo "local: * }" > $lib.exp~ + $LD -G${allow_undefined_flag} -M $export_symbols -h $soname -o $lib$libobjs$deplibs~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + + # Solaris 2 before 2.5 hardcodes -L paths. + case "$host_os" in + solaris2.[0-4]*) + hardcode_minus_L=yes + ;; + esac + ;; + + sunos4*) + # Why do we need -Bstatic? To avoid inter-library dependencies, maybe... + if test "$with_gcc" = yes && test "$with_gnu_ld" = yes; then + archive_cmds='$CC -shared ${wl}-Bstatic -o $lib$libobjs$deplibs' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs$deplibs' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + can_build_shared=no + ;; + esac +fi +echo "$ac_t$ld_shlibs" 1>&6 + +if test -z "$NM"; then + echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 + case "$NM" in + /* | [A-Za-z]:[/\\]*) ;; # Let the user override the test with a path. + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -B" + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -p" + else + NM="$ac_dir/nm" + fi + break + fi + done + IFS="$ac_save_ifs" + test -z "$NM" && NM=nm + ;; + esac + echo "$ac_t$NM" 1>&6 +fi + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRSTU]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \1' + +# Define system-specific variables. +case "$host_os" in +aix*) + symcode='[BCDTU]' + ;; +sunos* | cygwin32* | mingw32*) + sympat='_\([_A-Za-z][_A-Za-z0-9]*\)' + symxfrm='_\1 \1' + ;; +irix*) + # Cannot use undefined symbols on IRIX because inlined functions mess us up. + symcode='[BCDEGRST]' + ;; +solaris*) + symcode='[BDTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTUW]' +fi + +case "$host_os" in +cygwin32* | mingw32*) + # We do not want undefined symbols on cygwin32. The user must + # arrange to define them via -l arguments. + symcode='[ABCDGISTW]' + ;; +esac + +# Write the raw and C identifiers. +global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'" + +# Check to see that the pipe works correctly. +pipe_works=no +$rm conftest* +cat > conftest.c <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +main(){nm_test_var='a';nm_test_func();return(0);} +EOF + +echo "$progname:1429: checking if global_symbol_pipe works" >&5 +if { (eval echo $progname:1430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then + # Now try to grab the symbols. + nlist=conftest.nm + if { echo "$progname:1433: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + wcout=`wc "$nlist" 2>/dev/null` + count=`$echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` + (test "$count" -ge 0) 2>/dev/null || count=-1 + else + rm -f "$nlist"T + count=-1 + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.c +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c + + cat <<EOF >> conftest.c +#if defined (__STDC__) && __STDC__ +# define __ptr_t void * +#else +# define __ptr_t char * +#endif + +/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ +int dld_preloaded_symbol_count = $count; + +/* The mapping between symbol names and symbols. */ +struct { + char *name; + __ptr_t address; +} +dld_preloaded_symbols[] = +{ +EOF + sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> conftest.c + cat <<\EOF >> conftest.c + {0, (__ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$objext conftestm.$objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftestm.$objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo $progname:1491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + LIBS="$save_LIBS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $global_symbol_pipe" >&5 + fi +else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* + +# Do not use the global_symbol_pipe unless it works. +echo "$ac_t$pipe_works" 1>&6 +test "$pipe_works" = yes || global_symbol_pipe= + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && \ + test "$hardcode_minus_L" != no && \ + test "$hardcode_shlibpath_var" != no; then + + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$ac_t$hardcode_action" 1>&6 + + +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 +# PORTME Some linkers may need a different reload flag. +reload_flag='-r' +echo "$ac_t$reload_flag" 1>&6 +test -n "$reload_flag" && reload_flag=" $reload_flag" + +# PORTME Fill in your ld.so characteristics +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_search_path="/lib /usr/lib /usr/local/lib" +check_shared_deplibs_method='none' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_regex' -- check by looking for filenames that look like the shared +# library in the library path. +# 'file_magic [regex]' -- check by looking for files in library path which +# responds to the "file" command with a given regex. This is actually a +# superset of the file_regex command. If you have file on your system, you'll +# want to use this instead. +# Notes: regexes are run through expr. + +echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 +case "$host_os" in +aix3* | aix4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +bsdi4*) + version_type=linux + library_names_spec='${libname}.so.$major ${libname}.so' + soname_spec='${libname}.so' + finish_cmds='PATH="$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +cygwin32* | mingw32*) + version_type=windows + if test "$with_gcc" = yes; then + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' + else + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + fi + dynamic_linker='Win32 ld.exe' + libname_spec='$name' + shlibpath_var=PATH + ;; + +freebsd2* | freebsd3*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + library_names_spec='${libname}${release}.so$versuffix $libname.so' + finish_cmds='PATH="$PATH:/sbin" OBJFORMAT="$objformat" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +gnu*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + shlibpath_var=SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5*) + version_type=osf + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +irix6*) + version_type=osf + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARYN32_PATH + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + check_shared_deplibs_method='file_magic ELF 32-bit LSB shared object' + sys_lib_search_path="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`" + + if test -f /lib/ld.so.1; then + dynamic_linker='GNU ld.so' + else + # Only the GNU ld.so supports shared libraries on MkLinux. + case "$host_cpu" in + powerpc*) dynamic_linker=no ;; + *) dynamic_linker='Linux ld.so' ;; + esac + fi + ;; + +netbsd* | openbsd*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4*) + version_type=osf + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + check_shared_deplibs_method='pass_all' + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4.2uw2*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' + soname_spec='${libname}${release}.so.$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t$dynamic_linker" 1>&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 + +echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +esac + +echo "$ac_t$enable_shared" 1>&6 + +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes + +echo "checking whether to build static libraries... $enable_static" 1>&6 + +echo $ac_n "checking for objdir... $ac_c" 1>&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t$objdir" 1>&6 + +# Copy echo and quote the copy, instead of the original, because it is +# used later. +ltecho="$echo" +if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ltecho="$CONFIG_SHELL \$0 --fallback-echo" +fi +LTSHELL="$SHELL" + +# Only quote variables if we're using ltmain.sh. +case "$ltmain" in +*.sh) + # Now quote all the things that may contain metacharacters. + for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ + old_LN_S old_DLLTOOL old_AS AR CC LD LN_S NM LTSHELL VERSION \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + whole_archive_flag_spec libname_spec library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_sym_cmds postinstall_cmds postuninstall_cmds \ + check_shared_deplibs_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe \ + hardcode_libdir_flag_spec hardcode_libdir_separator sys_lib_search_path \ + compiler_c_o compiler_o_lo need_locks; do + + case "$var" in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + archive_cmds | archive_sym_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path) + # Double-quote double-evaled strings. + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`\\\"" + ;; + *) + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case "$ltecho" in + *'\$0 --fallback-echo"') + ltecho=`$echo "X$ltecho" | + $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + + trap "$rm \"$ofile\"; exit 1" 1 2 15 + echo "creating $ofile" + $rm "$ofile" + cat <<EOF > "$ofile" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1998 Free Software Foundation, Inc. +# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# 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. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +EOF + cfgfile="$ofile" + ;; + +*) + # Double-quote the variables that need it (for aesthetics). + for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ + old_LN_S old_DLLTOOL old_AS; do + eval "$var=\\\"\$var\\\"" + done + + # Just create a config file. + cfgfile="$ofile.cfg" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + echo "creating $cfgfile" + $rm "$cfgfile" + cat <<EOF > "$cfgfile" +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION) +EOF + ;; +esac + +cat <<EOF >> "$cfgfile" +# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ +# LD=$old_LD NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ +# DLLTOOL="$old_DLLTOOL" AS="$old_AS" \\ +# $0$ltconfig_args +# +# Compiler and other test output produced by $progname, useful for +# debugging $progname, is in ./config.log if it exists. + +# The version of $progname that generated this script. +LTCONFIG_VERSION=$VERSION + +# Shell to use when invoking shell scripts. +SHELL=$LTSHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$ltecho + +# The archiver. +AR=$AR + +# The default C compiler. +CC=$CC + +# The linker used to build libraries. +LD=$LD + +# Whether we need hard or soft links. +LN_S=$LN_S + +# A BSD-compatible nm program. +NM=$NM + +# Used on cygwin32: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin32: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$reload_flag +reload_cmds=$reload_cmds + +# How to pass a linker flag through the compiler. +wl=$wl + +# Object file suffix (normally "o"). +objext="$objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Additional compiler flags for building library objects. +pic_flag=$pic_flag + +# Does compiler simultaneously support -c and -o options +compiler_c_o=$compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$need_locks + +# Compiler flag to prevent dynamic linking. +link_static_flag=$link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$whole_archive_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$RANLIB +old_archive_cmds=$old_archive_cmds +old_postinstall_cmds=$old_postinstall_cmds +old_postuninstall_cmds=$old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$old_archive_from_new_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$archive_cmds +archive_sym_cmds=$archive_sym_cmds +postinstall_cmds=$postinstall_cmds +postuninstall_cmds=$postuninstall_cmds + +# Method to check whether dependent libraries are shared objects. +check_shared_deplibs_method=$check_shared_deplibs_method + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$global_symbol_pipe + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# System search path for libraries +sys_lib_search_path=$sys_lib_search_path + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" +EOF + +case "$ltmain" in +*.sh) + echo '### END LIBTOOL CONFIG' >> "$ofile" + echo >> "$ofile" + case "$host_os" in + aix3*) + cat <<\EOF >> "$ofile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "${COLLECT_NAMES+set}" != set; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # Append the ltmain.sh script. + cat "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) + + chmod +x "$ofile" + ;; + +*) + # Compile the libtool program. + echo "FIXME: would compile $ltmain" + ;; +esac +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/ltmain.sh b/ltmain.sh new file mode 100755 index 0000000..c8c38c2 --- /dev/null +++ b/ltmain.sh @@ -0,0 +1,5064 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# 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. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit 0 +fi + +# The name of this program. +progname=`$echo "$0" | sed 's%^.*/%%'` +modename="$progname" + +# Constants. +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.4.2 +TIMESTAMP=" (1.922.2.54 2001/09/11 03:33:37)" + +default_mode= +help="Try \`$progname --help' for more information." +magic="%%%MAGIC variable%%%" +mkdir="mkdir" +mv="mv -f" +rm="rm -f" + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' +SP2NL='tr \040 \012' +NL2SP='tr \015\012 \040\040' + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +# We save the old values to restore during execute mode. +if test "${LC_ALL+set}" = set; then + save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL +fi +if test "${LANG+set}" = set; then + save_LANG="$LANG"; LANG=C; export LANG +fi + +# Make sure IFS has a sensible default +: ${IFS=" "} + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + prev= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + # Accept any command-line options. + case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if (test -z "$pic_flag" || test "$pic_mode" != default) && + test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n $prev + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test "$status" -ne 0 && test ! -d "$output_objdir"; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode" = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test "$linkmode" = oldlib && test "$linkmode" = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: This library needs some functionality provided by $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + else + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then + # Add dl[pre]opened files of deplib + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" + fi + continue + fi + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + if test "$linkmode" = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`echo $soroot | sed -e 's/^.*\///'` + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + # Try looking first in the location we're being installed to. + add_dir= + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="-L$inst_prefix_dir$libdir" + ;; + esac + fi + add_dir="$add_dir -L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + # Try looking first in the location we're being installed to. + add_dir= + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="-L$inst_prefix_dir$libdir" + ;; + esac + fi + add_dir="$add_dir -L$libdir" + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + echo "*** Warning: This library needs some functionality provided by $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** Therefore, libtool will create a static module, that should work " + echo "*** as long as the dlopening application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="-L$absdir/$objdir" + else + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + test "$pass" != scan && dependency_libs="$newdependency_libs" + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case $current in + [0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $revision in + [0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $age in + [0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix) + major=`expr $current - $age + 1` + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c <<EOF + int main() { return 0; } +EOF + $rm conftest + $CC -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occured in the first compile. Let's try to salvage the situation: + # Compile a seperate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + $rm conftest + $CC -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + droppeddeps=yes + echo + echo "*** Warning! Library $i is needed by this library but I was not able to" + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + fi + ;; + file_magic*) + set dummy $deplibs_check_method + file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + if eval echo \"$potent_lib\" 2>/dev/null \ + | sed 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + test -z "$dlname" && dlname=$soname + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + prog) + case $host in + *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) exeext=.exe ;; + *) exeext= ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit 1 + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit 1 + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` + if test $? = 0 ; then : + else + tmpdir="$tmpdir/libtool-$$" + fi + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + /usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`echo $destfile | sed -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + rmdirs= + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test "$mode" = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + ;; + + *) + # Do a test to see if this is a libtool program. + if test "$mode" = clean && + (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 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 + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +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]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - 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 missing on your system. 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 missing on your system. 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 missing on your system. 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 missing on your system. 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, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' 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' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + 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 missing on your system. 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 missing on your system. 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 missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + 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 you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..8ab885e --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,99 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) # -h for help + echo "${usage}" 1>&2; exit 0 ;; + -m ) # -m PERM arg + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + dirmode="${1}" + shift ;; + -- ) shift; break ;; # stop option processing + -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option + * ) break ;; # first non-opt arg + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in +0) exit 0 ;; +esac + +case $dirmode in +'') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi ;; +*) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 3 +# End: +# mkinstalldirs ends here @@ -0,0 +1,49 @@ + +Xbase64 (Sept 15, 2003) +------------------------ + +Xbase64 was branched off the xbase C++ class lib project and given a new name. + +There are significant changes in this release. + +1) The original author (Gary Kunkel) has resumed working on the project. + +2) The project was branched and renamed to xbase64 with 64 bit file + processing capabilities. The xbase name is being used by other projects, + so I thought it was time for a new name. + +3) Modified the license from LGPL to GPL as recommended by the GNU web site. + Files that I have not been able to get permission from the original + author for GPL terms have beed deleted from the library. + +4) Trimmed the tree: Dropped support for the xbHtml class, the turbo vision + interface, and the ybase directory. These are either unused, not working, + undocumented, not maintained, or I didn't have authority to change the + license from LGPL to GPL. + +5) Didn't move make files forward that were not documented or working. + These need to be reviewed and brought forward. + +6) Worked on the locking logic. + +7) Added support for Borland C++ 5.x compiler. + +8) Created a new data type of XB_BOOL. Current bool data type was causing + issues in certain environments. + +9) Dropped support for XB_CASTELLANO dates. Changed the logic to use + system locale settings, this supports descriptive dates in different + languages. + +10) Cleaned up memory leaks. + +11) Updates to the documentation. + +12) Enhancements to the expression logic + +13) Fixed the broken index logic - the ndx and ntx indices are working + again. + +----------------------------------------------------------------------- +For a the historical NEWS file history (pre 9/15/03), review the older +xbase library. @@ -0,0 +1,108 @@ + Xbase64 Version 3.1.0 + + + +WHAT IS IT? +----------- + +Xbase64 is an xbase (i.e. dBase, FoxPro, etc.) compatible C++ class library +originally by Gary Kunkel and others (see the AUTHORS file). + +Xbase64 is useful for accessing data in legacy dBase 3 and 4 database files as +well as a general light-weight database engine. It includes support for +DBF (dBase version 3 and 4) data files, NDX and NTX indexes, and DBT +(dBase version 3 and 4). It supports file and record locking under *nix +and Windows. + + +DIRECTORY LAYOUT +---------------- + + /bin contains various utility programs + /examples contains various test programs + /html contains the original xBase documentation in html format + /xbase64 Xbase64 source and header files + + +BUILDING THE LIBRARY ON UNIX/LINUX +---------------------------------- + +XBase64 uses autoconf and libtool to manage the build process. + +To configure the library for your specific system, run the "configure" +shell script as follows: + + ./configure + +The configure script accepts the following options in addition to the +normal default options: + + --enable-debug creates debugging code [default=no] + --enable-shared build shared libraries [default=yes] + --enable-static build static libraries [default=no] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --without-index-ndx turn off .ndx index support + --without-index-ntx turn off .ntx index support + --without-memo-fields turn off memo fields support + --without-expressions turn off expressions support + --without-xbase-locking turn off XBase file locking + --without-realdelete turn off XBase record deletion + --without-xbase-debug turn off XBase specific debug + --without-largefile-support turn off XBase largefile support + +Once configured, execute make as follows to build the library: + + make + +Once compiled (and assuming no errors occurred), use make to install the +library, header files, and utilities as follows: + + make install + +The default install directory is /usr/local. + + +BUILDING THE LIBRARY ON WINDOWS +------------------------------- + +The MINGW32 and CYGWIN compiler support didn't make the first cut to +Xbase64. They will be migrated forward in a future release of xbase64. +Any volunteers? + +If using the MINGW32 GCC compiler package, use the makefile.g95 make files. +Edit bin/makefile.g95 xbase/makefile.g95 to change installation directories. + +If using the CYGWIN environment, use the makefile.cyg make files (or fix +the autoconf/automake stuff to work correclty). However, for some reason +(as yet undetermined) it seems to run very slowly when compiled with the +cygwin compiler (perhaps the file handing in the cygwin dll is just dog slow?). + + +BUILDING THE LIRARY WITH BORLAND 5.5 +------------------------------------ + +There are batch files MAKEBCC.BAT which build the xbase libs for +Borland C++ 5.5. + + + +DOCUMENTATION +------------- + +The documentation at this point consists of the original xBase documentation +(in the html directory). It is still very useful as little has changed +from the original library except bugfixes and a few enhancements. + +We are working on incorporating comments into the source to allow +generation of reference documentation using the Doxygen document generator. +A small amount has been done already, but we hope to complete this effort +before the next release. + + +CONTACT +------- + +Please email comments, bug reports, and patches to Gary Kunkel +xdb-dev@lists.sourceforge.net + + @@ -0,0 +1,123 @@ + +Last updated 2/20/04 - gk + +Xbase64 TODO's (not necessarily in this order!) +----------------------------------------------- + +1) Current updates/fixes as documented on source forge + +2) Additional expression support + + a) Close out ticket on source forge + + b) RECNO + Requires the concept of current DB or USE + + - Set Current table open, create, select and set, use + - Update documentation with new functions + + c) IIF + S/b same as a function + + d) RECNO is broke + e) STR( "ccc", 2 ) -> returns "ccc" even though length is 2 + f) STR( -52.345, 3 ) -> return -52.345 even though length is 3 + g) DESCEND does not work, not sure what is should do + h) DTOC function in testdate program does not work + i) Date: Wed, 10 Feb 1999 16:10:41 +0500 (YEKT) + From: Vitaly Fedrushkov <willy@snowyowl.csu.ac.ru> + + Expressions like these are not supported: + + DATE - DATE (= NUM) + DATE - NUM (= DATE) + DATE + NUM (= DATE) + + j) Empty date (like CTOD(" / / ") ) is not handled in many cases. + In fact, EMPTY() function is not implemented either. + + k) Any other tickets regarding expression logic? + +3) rename files + dbf.cpp ==> xbdbf.cpp + +4) Real deletes + + - test this functionality + - incorporate into dbfutil1 + - update documentation + - impact on indices + +5) dbfutil1 + + - update to support table and indice name at open + + + +2) 64 bit support + +3) Finish up multi user locking support for multiple environments + +4) Locking + +5) Release 3.0 + +6) Additional index support + - Additional index types (.IDX,.MDX) support + +7) Re-install exeception handling + +8) Transaction support + Create a logging routine - + put hooks in the PutRecord function to log data +9) Build an SQL front end / module +10) Add client/server support +11) Create library front end for perl. +12) PHP Support +13) Xbase environment programming language/support/command processing + environment + +14) Create Xbase How To +15) Create Xbase FAQ + +16) map the xbase function names to standard Dbase names + + opendatabase ==> OpenTable + CreateDatabase ==>CreateTable + + + + +Documentation +============== + + + + +Design +====== + +1) Extended version of tables to support: + + maybe put info in file with name of filename.xbi, also use same file for + xbase locking purposes + + a) auto index opening closing + b) indicator if real delete is on + c) 30 byte field names + +2) Think thru design of field names / AUDA storage for expressions + + + +Website +======= + +Proposed Website Functionality + +- documentation - migrate all documentation to source forge +- other xbase links +- contribute +- purchase support +- quick reference page + diff --git a/xbase64-config.in b/xbase64-config.in new file mode 100755 index 0000000..5aa75de --- /dev/null +++ b/xbase64-config.in @@ -0,0 +1,74 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +exec_prefix_set=no +CC="@CC@" +CXX="@CXX@" +LD="@SHARED_LD@" + +usage="\ +Usage: xbase-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags] [--cc] [--cxx] [--ld]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo @VERSION@ + ;; + --cflags) + if test @includedir@ != /usr/include ; then + if test @includedir@ != /usr/include/c++ ; then + includes=-I@includedir@ + fi + fi + echo $includes + ;; + --libs) + if test @libdir@ != /usr/lib ; then + libs="-L@libdir@" + fi + echo $libs -lxbase + ;; + --cc) + echo $CC + ;; + --cxx) + echo $CXX + ;; + --ld) + echo $LD + ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done + diff --git a/xbase64.spec.in b/xbase64.spec.in new file mode 100755 index 0000000..1ac9edf --- /dev/null +++ b/xbase64.spec.in @@ -0,0 +1,67 @@ +# $Id: xbase.spec.in,v 1.10 2003/02/08 03:02:22 dbryson Exp $ +%define xbase_ver @VERSION@ + +Summary: Xbase dBase database file library +Name: xbase-@RHREL@-@GXXVER@ +Provides: xbase-@RELEASE@ +Version: %{xbase_ver} +Release: 1 +Source: xbase-@VERSION@.tar.gz +Copyright: LGPL +Group: Development/Libraries +Packager: Derry Bryson <derry@techass.com> +Vendor: Xbase Development Team (linux.techass.com/projects/xdb) + +%description +Library for accessing dBase .dbf, .ndx, .dbt, and Clipper .ntx files. + +%package -n xbase-devel-@RHREL@-@GXXVER@ +Version: %{xbase_ver} +Summary: Xbase development package +Group: Development/Libraries +Provides: xbase-devel-@RELEASE@ +Requires: xbase-@RELEASE@ + +%description -n xbase-devel-@RHREL@-@GXXVER@ +Headers and such for compiling programs that use the Xbase library. + +%prep +%setup -n xbase-@VERSION@ +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --enable-static + +%build +make + +%install +rm -rf $RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files -n xbase-@RHREL@-@GXXVER@ +/usr/bin/checkndx +/usr/bin/copydbf +/usr/bin/deletall +/usr/bin/dumphdr +/usr/bin/dumprecs +/usr/bin/packdbf +/usr/bin/reindex +/usr/bin/undelall +/usr/bin/zap +/usr/bin/dbfutil1 +/usr/lib/libxbase.so +/usr/lib/libxbase-@RELEASE@.so.* + +%doc NEWS README TODO AUTHORS COPYING ChangeLog + +%files -n xbase-devel-@RHREL@-@GXXVER@ +/usr/include/xbase +/usr/bin/xbase-config +/usr/lib/libxbase.la +/usr/lib/libxbase.a + +%doc docs/html docs/latex diff --git a/xbase64/Makefile.am b/xbase64/Makefile.am new file mode 100755 index 0000000..b0dff24 --- /dev/null +++ b/xbase64/Makefile.am @@ -0,0 +1,55 @@ +# This file is part of the xbase64 libraries +# Copyright (C) 1998 Denis Pershin (dyp@inetlab.com) +# +# +# This library 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.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Contact: +# +# Email: +# +# xbase64-dev@lists.sourceforge.net +# xbase64-users@lists.sourceforge.net +# +# + +INCLUDES = -I$(topdir) + +lib_LTLIBRARIES = libxbase64.la + +pkginclude_HEADERS = xbdbf.h xbexp.h xbndx.h xbretcod.h xbase64.h xbdate.h \ + xbtypes.h xbstring.h xbindex.h xbntx.h xbconfig.h xbfilter.h \ + xblock.h xbfile.h xbcdx.h xbwincfg.h xbmindex.h xbnode.h + +#install-data-hook: +# (cd $(includedir); rm -f xbase64.h; ln -s xbase64/xbase64.h xbase64.h) + +libxbase64_la_SOURCES = xbdbf.cpp xbexp.cpp xbexpfnc.cpp xbexpprc.cpp \ + xbfields.cpp xbmemo.cpp xbndx.cpp xbase64.cpp xbdate.cpp \ + xbstring.cpp xbindex.cpp xbntx.cpp xbfilter.cpp xblock.cpp \ + xbfile.cpp xbcdx.cpp xbnode.cpp + +EXTRA_DIST = makebcc.bat +# makefile.g95 \ +# makebcc.bat \ +# xbase.ide + + +libxbase64_la_LDFLAGS = -version-info 1:0:0 +libxbase64_la_LIBADD = + +MAINTAINERCLEANFILES = Makefile.in stamp-h.in +CLEANFILES = *.obj *.BAK *.bak *.tds *.lib compout + diff --git a/xbase64/Makefile.in b/xbase64/Makefile.in new file mode 100755 index 0000000..981a6b9 --- /dev/null +++ b/xbase64/Makefile.in @@ -0,0 +1,475 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# This file is part of the xbase64 libraries +# Copyright (C) 1998 Denis Pershin (dyp@inetlab.com) +# +# +# This library 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.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Contact: +# +# Email: +# +# xbase64-dev@lists.sourceforge.net +# xbase64-users@lists.sourceforge.net +# +# +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +GXXVER = @GXXVER@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RELEASE = @RELEASE@ +RHREL = @RHREL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XSUBDIRS = @XSUBDIRS@ +am__include = @am__include@ +am__quote = @am__quote@ +doxygen = @doxygen@ +install_sh = @install_sh@ +topdir = @topdir@ + +INCLUDES = -I$(topdir) + +lib_LTLIBRARIES = libxbase64.la + +pkginclude_HEADERS = xbdbf.h xbexp.h xbndx.h xbretcod.h xbase64.h xbdate.h \ + xbtypes.h xbstring.h xbindex.h xbntx.h xbconfig.h xbfilter.h \ + xblock.h xbfile.h xbcdx.h xbwincfg.h xbmindex.h xbnode.h + + + +#install-data-hook: +# (cd $(includedir); rm -f xbase64.h; ln -s xbase64/xbase64.h xbase64.h) +libxbase64_la_SOURCES = xbdbf.cpp xbexp.cpp xbexpfnc.cpp xbexpprc.cpp \ + xbfields.cpp xbmemo.cpp xbndx.cpp xbase64.cpp xbdate.cpp \ + xbstring.cpp xbindex.cpp xbntx.cpp xbfilter.cpp xblock.cpp \ + xbfile.cpp xbcdx.cpp xbnode.cpp + + +EXTRA_DIST = makebcc.bat + +# makefile.g95 \ +# makebcc.bat \ +# xbase.ide +libxbase64_la_LDFLAGS = -version-info 1:0:0 +libxbase64_la_LIBADD = + +MAINTAINERCLEANFILES = Makefile.in stamp-h.in +CLEANFILES = *.obj *.BAK *.bak *.tds *.lib compout +subdir = xbase64 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = xbconfig.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + +libxbase64_la_DEPENDENCIES = +am_libxbase64_la_OBJECTS = xbdbf.lo xbexp.lo xbexpfnc.lo xbexpprc.lo \ + xbfields.lo xbmemo.lo xbndx.lo xbase64.lo xbdate.lo xbstring.lo \ + xbindex.lo xbntx.lo xbfilter.lo xblock.lo xbfile.lo xbcdx.lo \ + xbnode.lo +libxbase64_la_OBJECTS = $(am_libxbase64_la_OBJECTS) + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/xbase64.Plo ./$(DEPDIR)/xbcdx.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xbdate.Plo ./$(DEPDIR)/xbdbf.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xbexp.Plo ./$(DEPDIR)/xbexpfnc.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xbexpprc.Plo ./$(DEPDIR)/xbfields.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xbfile.Plo ./$(DEPDIR)/xbfilter.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xbindex.Plo ./$(DEPDIR)/xblock.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xbmemo.Plo ./$(DEPDIR)/xbndx.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xbnode.Plo ./$(DEPDIR)/xbntx.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xbstring.Plo +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(libxbase64_la_SOURCES) +HEADERS = $(pkginclude_HEADERS) + +DIST_COMMON = $(pkginclude_HEADERS) Makefile.am Makefile.in xbconfig.in +SOURCES = $(libxbase64_la_SOURCES) + +all: xbconfig.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu xbase64/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +xbconfig.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/xbconfig.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status xbase64/xbconfig.h + +$(srcdir)/xbconfig.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + touch $(srcdir)/xbconfig.in + +distclean-hdr: + -rm -f xbconfig.h stamp-h1 +libLTLIBRARIES_INSTALL = $(INSTALL) +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test -z "$dir" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxbase64.la: $(libxbase64_la_OBJECTS) $(libxbase64_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libxbase64_la_LDFLAGS) $(libxbase64_la_OBJECTS) $(libxbase64_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbase64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbcdx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbdate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbdbf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbexp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbexpfnc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbexpprc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbfields.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbfile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbfilter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbindex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xblock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbmemo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbndx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbnode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbntx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbstring.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` + +.cpp.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CXXDEPMODE = @CXXDEPMODE@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) +install-pkgincludeHEADERS: $(pkginclude_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(pkgincludedir) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f"; \ + $(pkgincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(pkgincludedir)/$$f; \ + done + +uninstall-pkgincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(pkginclude_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(pkgincludedir)/$$f"; \ + rm -f $(DESTDIR)$(pkgincludedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) xbconfig.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) xbconfig.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) xbconfig.h + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(pkgincludedir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-pkgincludeHEADERS + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-pkgincludeHEADERS + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool distclean distclean-compile \ + distclean-depend distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pkgincludeHEADERS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS + +# 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: diff --git a/xbase64/makebcc.bat b/xbase64/makebcc.bat new file mode 100755 index 0000000..efdad66 --- /dev/null +++ b/xbase64/makebcc.bat @@ -0,0 +1,32 @@ +
+rem 2/14/04
+rem This batch file builds the xbase64 library using Borland C++ 5.5
+rem use -v for source level debugging
+
+del *.bak
+del *.obj
+
+bcc32 -c -I.. -Id:\borland\bcc55\include xbdate.cpp > compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xblock.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbdbf.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbexp.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbexpfnc.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbexpprc.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbfields.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbindex.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbase64.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbmemo.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbstring.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbfilter.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbndx.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbntx.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbcdx.cpp >> compout
+bcc32 -c -I.. -Id:\borland\bcc55\include xbfile.cpp >> compout
+
+
+del xbase64.lib
+tlib xbase64.lib /C +xbdbf.obj +xbexp.obj +xbexpfnc.obj >> compout
+tlib xbase64.lib /C +xbndx.obj +xbntx.obj +xbexpprc.obj >> compout
+tlib xbase64.lib /C +xbfields.obj +xbfile.obj +xbcdx.obj >> compout
+tlib xbase64.lib /C +xbindex.obj +xbfilter.obj +xbase64.obj >> compout
+tlib xbase64.lib /C +xbmemo.obj +xbdate.obj +xbstring.obj >> compout
diff --git a/xbase64/xbase64.cpp b/xbase64/xbase64.cpp new file mode 100755 index 0000000..fc5613d --- /dev/null +++ b/xbase64/xbase64.cpp @@ -0,0 +1,766 @@ +/* xbase64.cpp + + Xbase64 project source code + + This file contains logic for the basic Xbase class. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbase64.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> +#include <ctype.h> +#include <string.h> + +//#include <xbase64/xbexcept.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_IO_H // windows locking +#include <io.h> +#endif + +#ifdef HAVE_DOS_H // windows _sleep +#include <dos.h> +#endif + + +/*! \file xbase64.cpp +*/ + +/*************************************************************************/ +//! Constructor. +/*! +*/ +xbXBase::xbXBase() +{ + xbShort e = 1; + EndianType = *(char *) &e; + if( EndianType ) + EndianType = 'L'; + else + EndianType = 'B'; + DbfList = NULL; + FreeDbfList = NULL; + +#ifdef XB_LOCKING_ON + LockRetryCount = 5; + LockMode = XB_SINGLE_USER_MODE; +#endif + + DefaultDateFormat = "MM/DD/YY"; +} +/*************************************************************************/ +//! Get pointer to named dbf. +/*! + Looks up an open DBF file by Name. + + \param Name + \returns A pointer to the xbDbf class instance if found or NULL if + not found. +*/ +xbDbf *xbXBase::GetDbfPtr(const char *Name) { + xbDbList *t; + + t = DbfList; + xbShort len = strlen(Name); + + /* check for -> embedded in the name */ + for( xbShort i = 0; i < (len-1); i++ ) + if( Name[i] == '-' && Name[i+1] == '>' ) + len = i-1; + + while (t) { + if (strncmp(Name, t->DbfName, len) == 0 ) + return t->dbf; + t = t->NextDbf; + } + return NULL; +} + +/*************************************************************************/ +//! Destructor. +/*! +*/ +xbXBase::~xbXBase() +{ + xbDbList *i = FreeDbfList; + while (i) { + xbDbList *t = i->NextDbf; + if (i->DbfName) { + free(i->DbfName); + } + free(i); + i = t; + } +} +/*************************************************************************/ +//! Add dbf to dbf list. +/*! + Adds an xbDbf class instance to the list of dbf's. + + \param d the xbDbf instance to be added + \param DatabaseName name of the database + + \returns One of the following return codes: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_NO_MEMORY</td><td>Out of memory</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No Error \\ \hline + XB\_NO\_MEMORY & Out of memory \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbXBase::AddDbfToDbfList(xbDbf *d, const char *DatabaseName) { + xbDbList *i, *s, *t; + + if(!FreeDbfList) { + if((i = (xbDbList *)malloc(sizeof(xbDbList))) == NULL) { + return XB_NO_MEMORY; + } + } else { + i = FreeDbfList; + FreeDbfList = i->NextDbf; + } + memset(i, 0x00, sizeof(xbDbList)); + + i->DbfName = strdup(DatabaseName); + i->dbf = d; + + /* insert new dbf into the list of open dbf files, sorted by dbf name */ + s = NULL; + t = DbfList; + while(t && strcmp(t->DbfName, DatabaseName) < 0) { + s = t; + t = t->NextDbf; + } + i->NextDbf = t; + if (s == NULL) + DbfList = i; + else + s->NextDbf = i; + + return 0; +} +/***********************************************************************/ +//! Remove dbf from dbf list. +/*! + Removes the specified xbDbf class instance from the list of dbf's. + + \param d xbDbf to be removed + + \returns One of the following return codes: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No Error \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbXBase::RemoveDbfFromDbfList(xbDbf *d) { + xbDbList *i, *s; + + i = DbfList; + s = NULL; + + while (i) { + if(i->dbf == d) { + /* remove it from current chain */ + if(s) + s->NextDbf = i->NextDbf; + else + DbfList = i->NextDbf; + + /* add i to the current free chain */ + i->NextDbf = FreeDbfList; + FreeDbfList = i; + free(FreeDbfList->DbfName); + FreeDbfList->DbfName = NULL; + break; + } else { + s = i; + i = i->NextDbf; + } + } + return XB_NO_ERROR; +} + +// FIXME: byte reverse methods are awful, compared to bitwise shifts -- willy + +/************************************************************************/ +//! Get a portable short value. +/*! + Converts a short (16 bit integer) value stored at p from a portable + format to the machine format. + + \param p pointer to memory containing the portable short value + + \returns the short value. +*/ +/* This routine returns a short value from a 2 byte character stream */ +xbShort xbXBase::GetShort(const char *p) { + xbShort s, i; + const char *sp; + char *tp; + + s = 0; + tp = (char *) &s; + sp = p; + if( EndianType == 'L' ) + for( i = 0; i < 2; i++ ) *tp++ = *sp++; + else + { + sp++; + for( i = 0; i < 2; i++ ) *tp++ = *sp--; + } + return s; +} +/*************************************************************************/ +//! Get a portable long value. +/*! + Converts a long (32 bit integer) value stored at p from a portable + format to the machine format. + + \param p pointer to memory containing the portable long value + + \returns the long value. +*/ +/* This routine returns a long value from a 4 byte character stream */ +xbLong xbXBase::GetLong( const char *p ) +{ + xbLong l; + const char *sp; + char *tp; + xbShort i; + + tp = (char *) &l; + sp = p; + if( EndianType == 'L' ) + for( i = 0; i < 4; i++ ) *tp++ = *sp++; + else + { + sp+=3; + for( i = 0; i < 4; i++ ) *tp++ = *sp--; + } + return l; +} +/*************************************************************************/ +//! Get a portable unsigned long value. +/*! + Converts an unsigned long (32 bit integer) value stored at p from a portable + format to the machine format. + + \param p pointer to memory containing the portable unsigned long value + + \returns the unsigned long value. +*/ +/* This routine returns a long value from a 4 byte character stream */ +xbULong xbXBase::GetULong( const char *p ) +{ + xbULong l; + char *tp; + xbShort i; + + tp = (char *) &l; + if( EndianType == 'L' ) + for( i = 0; i < 4; i++ ) *tp++ = *p++; + else{ + p+=3; + for( i = 0; i < 4; i++ ) *tp++ = *p--; + } + return l; +} + +/************************************************************************/ +//! Get a high byte first short value. +/*! + Converts a short (16 bit integer) value stored at p from a high byte first + format to the machine format. + + \param p pointer to memory containing the high byte first short value + + \returns the short value. +*/ +/* This routine returns a short value from a 2 byte character stream */ +xbShort xbXBase::GetHBFShort(const char *p) { + xbShort s, i; + const char *sp; + char *tp; + + s = 0; + tp = (char *) &s; + sp = p; + if( EndianType == 'B' ) + for( i = 0; i < 2; i++ ) *tp++ = *sp++; + else + { + sp++; + for( i = 0; i < 2; i++ ) *tp++ = *sp--; + } + return s; +} + +/*************************************************************************/ +//! Get a high byte first unsigned long value. +/*! + Converts an unsigned long (32 bit integer) value stored at p from a high byte first + format to the machine format. + + \param p pointer to memory containing the high byte first unsigned long value + + \returns the unsigned long value. +*/ +/* This routine returns a long value from a 4 byte character stream */ +xbULong xbXBase::GetHBFULong( const char *p ) +{ + xbULong l; + char *tp; + xbShort i; + + tp = (char *) &l; + if( EndianType == 'B' ) + for( i = 0; i < 4; i++ ) *tp++ = *p++; + else{ + p+=3; + for( i = 0; i < 4; i++ ) *tp++ = *p--; + } + return l; +} +/*************************************************************************/ +//! Get a portable double value. +/*! + Converts a double (64 bit floating point) value stored at p from a portable + format to the machine format. + + \param p pointer to memory containing the portable double value + + \returns the double value. +*/ +/* This routine returns a double value from an 8 byte character stream */ +xbDouble xbXBase::GetDouble( const char *p ) +{ + xbDouble d; + const char *sp; + char *tp; + xbShort i; + + tp = (char *) &d; + sp = p; + if( EndianType == 'L' ) + for( i = 0; i < 8; i++ ) *tp++ = *sp++; + else + { + sp+=7; + for( i = 0; i < 8; i++ ) *tp++ = *sp--; + } + + return d; +} +/*************************************************************************/ +//! Put a portable short value. +/*! + Converts a short (16 bit integer) value from machine format to a + portable format and stores the converted value in the memory referenced + by c. + + \param c pointer to memory to hold converted value + \param s value to be converted +*/ +/* This routine puts a short value to a 2 byte character stream */ +void xbXBase::PutShort( char * c, xbShort s ) +{ + const char *sp; + char *tp; + xbShort i; + + tp = c; + sp = (const char *) &s; + + if( EndianType == 'L' ) + { + for( i = 0; i < 2; i++ ) *tp++ = *sp++; + } + else /* big endian */ + { + sp++; + for( i = 0; i < 2; i++ ) *tp++ = *sp--; + } + return; +} + +/*************************************************************************/ +//! Put a portable long value. +/*! + Converts a long (32 bit integer) value from machine format to a + portable format and stores the converted value in the memory referenced + by c. + + \param c pointer to memory to hold converted value + \param l value to be converted +*/ +/* This routine puts a long value to a 4 byte character stream */ +void xbXBase::PutLong( char * c, xbLong l ) +{ + const char *sp; + char *tp; + xbShort i; + + tp = c; + sp = (const char *) &l; + if( EndianType == 'L' ) + for( i = 0; i < 4; i++ ) *tp++ = *sp++; + else + { + sp+=3; + for( i = 0; i < 4; i++ ) *tp++ = *sp--; + } + return; +} +/*************************************************************************/ +//! Put a portable unsigned short value. +/*! + Converts an unsigned long (16 bit integer) value from machine format to a + portable format and stores the converted value in the memory referenced + by c. + + \param c pointer to memory to hold converted value + \param s value to be converted +*/ +/* This routine puts a short value to a 2 byte character stream */ +void xbXBase::PutUShort( char * c, xbUShort s ) +{ + const char *sp; + char *tp; + xbShort i; + + tp = c; + sp = (const char *) &s; + if( EndianType == 'L' ) + for( i = 0; i < 2; i++ ) *tp++ = *sp++; + else + { + sp++; + for( i = 0; i < 2; i++ ) *tp++ = *sp--; + } + return; +} +/*************************************************************************/ +//! Put a portable unsigned long value. +/*! + Converts an unsigned long (32 bit integer) value from machine format to a + portable format and stores the converted value in the memory referenced + by c. + + \param c pointer to memory to hold converted value + \param l value to be converted +*/ +/* This routine puts a long value to a 4 byte character stream */ +void xbXBase::PutULong( char * c, xbULong l ) +{ + const char *sp; + char *tp; + xbShort i; + + tp = c; + sp = (const char *) &l; + if( EndianType == 'L' ) + for( i = 0; i < 4; i++ ) *tp++ = *sp++; + else + { + sp+=3; + for( i = 0; i < 4; i++ ) *tp++ = *sp--; + } + return; +} +/*************************************************************************/ +//! Put a portable double value. +/*! + Converts a double (64 floating point) value from machine format to a + portable format and stores the converted value in the memory referenced + by c. + + \param c pointer to memory to hold converted value + \param d value to be converted +*/ +/* This routine puts a double value to an 8 byte character stream */ +void xbXBase::PutDouble( char * c, xbDouble d ) +{ + const char *sp; + char *tp; + xbShort i; + + tp = c; + sp = (const char *) &d; + if( EndianType == 'L' ) + for( i = 0; i < 8; i++ ) *tp++ = *sp++; + else + { + sp+=7; + for( i = 0; i < 8; i++ ) *tp++ = *sp--; + } + return; +} +/************************************************************************/ +//! Get offset of last PATH_SEPARATOR in Name. +/*! + Scans the specified Name for the last occurance of PATH_SEPARATOR. + + \param Name string to be scanned. + + \returns offset of last occurance of PATH_SEPARATOR +*/ +xbShort xbXBase::DirectoryExistsInName( const char * Name ) +{ + /* returns the offset in the string of the last directory slash */ + + xbShort Count, Mark; + char Delim; + const char *p; + + Delim = PATH_SEPARATOR; + + Count = Mark = 0; + p = Name; + + while( *p ) + { + Count++; + if( *p++ == Delim ) Mark = Count; + } + return Mark; +} + +/************************************************************************/ +//! Display description of error code. +/*! + Displays a text description of an XBase error code. + + \param ErrorCode error to be displayed +*/ +void xbXBase::DisplayError( xbShort ErrorCode ) const +{ + std::cout << GetErrorMessage( ErrorCode ) << std::endl; +} +/************************************************************************/ +//! Get description of error code. +/*! + Returns a pointer to string containing a text description of an + error code. + + \param ErrorCode error number of description to be returned +*/ +const char* xbXBase::GetErrorMessage( xbShort ErrorCode ) +{ + switch( ErrorCode ) { + case 0: return "No Error"; + case -100: return "End Of File"; + case -101: return "Beginning Of File"; + case -102: return "No Memory"; + case -103: return "File Already Exists"; + case -104: return "Database or Index Open Error"; + case -105: return "Error writing to disk drive"; + case -106: return "Unknown Field Type"; + case -107: return "Database already open"; + case -108: return "Not an Xbase type database"; + case -109: return "Invalid Record Number"; + case -110: return "Invalid Option"; + case -111: return "Database not open"; + case -112: return "Disk Drive Seek Error"; + case -113: return "Disk Drive Read Error"; + case -114: return "Search Key Not Found"; + case -115: return "Search Key Found"; + case -116: return "Invalid Key"; + case -117: return "Invalid Node Link"; + case -118: return "Key Not Unique"; + case -119: return "Invalid Key Expression"; + case -120: return "DBF File Not Open"; + case -121: return "Invalid Key Type"; + case -122: return "Invalid Node No"; + case -123: return "Node Full"; + case -124: return "Invalid Field Number"; + case -125: return "Invalid Data"; + case -126: return "Not a leaf node"; + case -127: return "Lock Failed"; + case -128: return "Close Error"; + case -129: return "Invalid Schema"; + case -130: return "Invalid Name"; + case -131: return "Invalid Block Size"; + case -132: return "Invalid Block Number"; + case -133: return "Not a Memo field"; + case -134: return "No Memo Data"; + case -135: return "Expression syntax error"; + case -136: return "Parse Error"; + case -137: return "No Data"; + case -138: return "Unknown Token Type"; + case -140: return "Invalid Field"; + case -141: return "Insufficient Parms"; + case -142: return "Too Many Parms"; + case -143: return "Invalid or Undefined Function"; + case -144: return "Invalid Field Length"; + case -145: return "Harvest Node"; + case -146: return "Invalid Date"; + case -147: return "Invalid Lock Option"; + default: return "Unknown error code"; + } +} +/************************************************************************/ +#ifdef XB_LOCKING_ON + +//! File lock routine +/*! + Lowest level lock routine + Locks/unlocks a database,memo or index file. + This function assumes the file position has been correctly set + + \param fn file to lock/unlock + \param LockType lock type, one of: XB_LOCK or XB_UNLOCK + \param lockLen byte count to lock +*/ + +#ifdef __WIN32__ +xbShort xbXBase::LockFile( int fn, xbShort LockType, xbOffT lockLen) +{ + + int mode; + int rc; + int tries = 0; + + /* convert the xbase locking command into a windows locking command */ + if( LockType == XB_UNLOCK ) + mode = LK_UNLCK; + else if( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) + mode = LK_NBLCK; + else + return XB_INVALID_LOCK_OPTION; + + do{ + rc = locking( fn, mode, lockLen ); + if( rc ) + _sleep( 1 ); + } while( rc == -1 && tries++ < GetLockRetryCount()); + + if( rc ) + return XB_LOCK_FAILED; + + return 0; +} + +#elif HAVE_FCNTL_H + +xbShort xbXBase::LockFile( int fn, xbShort LockType, xbOffT lockLen ) +{ + xbShort cmd, rc; + xbShort tries = 0; + +/* convert cross platform xbase lock type to unix lock type */ + if( LockType == XB_UNLOCK ) + cmd = F_ULOCK; + else if( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) + cmd = F_TLOCK; + else + return XB_INVALID_LOCK_OPTION; + +/* do the actual lock */ + do{ + #ifdef _LARGEFILE64_SOURCE + rc = lockf64( fn, cmd, lockLen ); + #else + rc = lockf( fn, cmd, lockLen ); + #endif + if( rc == -1 && errno != EINTR ){ + tries++; + sleep(1); + } + } while( rc == -1 && tries < GetLockRetryCount()); + + if( rc ) + return XB_LOCK_FAILED; + + return XB_NO_ERROR; +} +#endif // HAVE_FCNTL +#endif // XB_LOCKING_ON + +/************************************************************************/ +#ifdef XB_LOCKING_ON + +//! Set high level lock mode +/*! + + \param nlm New lock mode +*/ + +xbShort xbXBase::SetLockMode( xbShort nlm ) +{ + if( nlm != XB_SINGLE_USER_MODE && nlm != XB_XBASE_LOCK_MODE && + nlm != XB_DBASE5_LOCK_MODE && nlm != XB_CLIPPER5_LOCK_MODE && + nlm != XB_FOXPRO3_LOCK_MODE ) + return XB_INVALID_LOCK_OPTION; + + LockMode = nlm; + return XB_NO_ERROR; +} + +#endif // XB_LOCKING_ON + + + diff --git a/xbase64/xbase64.h b/xbase64/xbase64.h new file mode 100755 index 0000000..7267299 --- /dev/null +++ b/xbase64/xbase64.h @@ -0,0 +1,239 @@ +/* xbase64.h + + Xbase project source code + + This file contains a header file for the xbXBase class, which is the + base class for using the Xbase DBMS library. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifndef __XB_XBASE_H__ +#define __XB_XBASE_H__ + +#ifdef __GNU LesserG__ +#pragma interface +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <string.h> + +#if defined(__WIN32__) +#include "windows.h" + +// ripped from wxWindows + +// _declspec works in BC++ 5 and later, as well as VC++ +#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNU LesserC__) +# ifdef XBMAKINGDLL +# define XBDLLEXPORT __declspec( dllexport ) +# define XBDLLEXPORT_DATA(type) __declspec( dllexport ) type +# define XBDLLEXPORT_CTORFN +# elif defined(XBUSINGDLL) +# define XBDLLEXPORT __declspec( dllimport ) +# define XBDLLEXPORT_DATA(type) __declspec( dllimport ) type +# define XBDLLEXPORT_CTORFN +# else +# define XBDLLEXPORT +# define XBDLLEXPORT_DATA(type) type +# define XBDLLEXPORT_CTORFN +# endif + +#else + +# define XBDLLEXPORT +# define XBDLLEXPORT_DATA(type) type +# define XBDLLEXPORT_CTORFN +#endif + +#else // !Windows +# define XBDLLEXPORT +# define XBDLLEXPORT_DATA(type) type +# define XBDLLEXPORT_CTORFN +#endif // Win/!Win + + +#define XB_SINGLE_USER_MODE 0 +#define XB_UNLOCK 200 +#define XB_LOCK 201 +#define XB_LOCK_HOLD 202 + +#ifdef XB_LOCKING_ON + + #ifdef HAVE_SYS_LOCKING_H + #include <sys/locking.h> + #ifdef __MINGW32__ + #defibe locking _locking + #endif + #endif + + #ifdef HAVE_FCNTL_H + #include <fcntl.h> + #endif + + #ifdef HAVE_UNISTD_H + #include <unistd.h> + #endif + + #define XB_XBASE_LOCK_MODE 200 + #define XB_DBASE5_LOCK_MODE 201 + #define XB_CLIPPER5_LOCK_MODE 202 + #define XB_FOXPRO3_LOCK_MODE 203 + +#endif // XB_LOCKING_ON + +#include "xbtypes.h" +#include "xbretcod.h" +#include "xbdate.h" +#include "xbstring.h" + +#ifndef XB_MIN +#define XB_MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif /* XB_MIN */ + +// 3/18/04 next macro isn't currently used in the library - GK +//#ifndef XB_MAX +//#define XB_MAX(a, b) (((a) < (b)) ? (b) : (a)) +//#endif /* XB_MAX */ + +/*! \file xbase64.h +*/ + +class XBDLLEXPORT xbDbf; + +//! xbDbList struct +/*! +*/ +struct XBDLLEXPORT xbDbList{ + xbDbList * NextDbf; + char * DbfName; + xbDbf * dbf; +}; + +//! xbXBase class +/*! +*/ +class XBDLLEXPORT xbXBase { + public: + ~xbXBase(); + xbXBase(); + xbShort AddDbfToDbfList(xbDbf *d, const char *DatabaseName); + xbDbf * GetDbfPtr( const char *Name ); + xbShort DirectoryExistsInName( const char *Name ); + xbShort GetEndianType() { return EndianType; } + void DisplayError( xbShort ErrorCode ) const; + static const char* GetErrorMessage( xbShort ErrorCode ); + xbString & GetDefaultDateFormat() { return DefaultDateFormat; } + void SetDefaultDateFormat( const xbString & f ){ DefaultDateFormat = f; } + + /* next 6 routines handle both big endian and little endian machines */ + xbDouble GetDouble( const char *p ); + xbLong GetLong ( const char *p ); + xbULong GetULong ( const char *p ); + xbShort GetShort ( const char *p ); + xbULong GetHBFULong( const char *p ); + xbShort GetHBFShort ( const char *p ); + + void PutLong ( char *p, const xbLong l ); + void PutShort ( char *p, const xbShort s ); + void PutULong ( char *p, const xbULong l ); + void PutUShort( char *p, const xbUShort s ); + void PutDouble( char *p, const xbDouble d ); + + xbShort RemoveDbfFromDbfList( xbDbf * ); + +#ifdef XB_LOCKING_ON + xbShort GetLockRetryCount(){ return LockRetryCount; } + void SetLockRetryCount( xbShort lrc ) { LockRetryCount = lrc; } + xbShort LockFile( int fn, xbShort type, xbOffT len ); + xbShort GetLockMode() { return LockMode; } + xbShort SetLockMode( xbShort nlm ); +#endif + +protected: + xbDbList * DbfList; + xbDbList * FreeDbfList; + xbShort EndianType; /* B = Big Endian, L = Little Endian */ + +private: + xbString DefaultDateFormat; + +#ifdef XB_LOCKING_ON + xbShort LockRetryCount; + xbShort LockMode; +#endif +}; + +#include "xbdbf.h" + +#if defined(XB_EXPRESSIONS) +#include "xbexp.h" +#endif + +#if defined(XB_INDEX_ANY) +#include "xbindex.h" +#include "xbmindex.h" +#endif + +#ifdef XB_LOCKING_ON +#include "xblock.h" +#endif + +#ifdef XB_INDEX_NDX +#include "xbndx.h" +#endif + +#ifdef XB_INDEX_NTX +#include "xbntx.h" +#endif + +#ifdef XB_INDEX_CDX +#include "xbcdx.h" +#endif + +#if defined(XB_FILTERS) && !defined(XB_INDEX_ANY) +#error XB_FILTERS cant be used without index support +#elif defined(XB_FILTERS) +#include "xbfilter.h" +#endif + +#endif // __XB_XBASE_H__ + + + diff --git a/xbase64/xbcdx.cpp b/xbase64/xbcdx.cpp new file mode 100755 index 0000000..83a69df --- /dev/null +++ b/xbase64/xbcdx.cpp @@ -0,0 +1,113 @@ +#include "xbtypes.h"
+#include "xbcdx.h"
+
+xbShort xbCdx::CreateIndex(const char* filename, const char *expr,
+ xbShort unique, xbShort overwrite)
+{
+ return CreateIndex(filename, "NoName", expr, unique, overwrite);
+}
+
+xbShort xbCdx::CreateIndex(const char* filename, const char *tagName,
+ const char *expr, xbShort unique, xbShort overwrite)
+{
+ if (IsOpen()) CloseIndex();
+ SetFileName(filename);
+
+ indexfp=fopen(GetFileName(), "wb+");
+ WriteTagHeader(tagName);
+ WriteTagRoot(tagName);
+ WriteIndexHeader(expr);
+ WriteIndexRoot();
+ return 0;
+}
+
+const char* xbCdx::GetExtWithDot(bool lower)
+{
+ return lower? ".cdx": ".CDX";
+}
+
+void xbCdx::WriteTagHeader(const char* tagName)
+{
+ memset(&tagHeader_, 0, sizeof(tagHeader_));
+ tagHeader_.rootNode=0x400;
+ tagHeader_.keyLen=strlen(tagName)+1;
+ tagHeader_.features.feature=0xe0;
+ tagHeader_.signature=1;
+ tagHeader_.totalExprLen=1;
+ tagHeader_.forExprLen=1;
+ tagHeader_.keyExprLen=1;
+ fwrite(&tagHeader_, sizeof(tagHeader_), 1, indexfp);
+}
+
+void xbCdx::WriteTagRoot(const char* tagName)
+{
+ memset(&tagRootNode_, 0, sizeof(tagRootNode_));
+ tagRootNode_.attr=3;
+ tagRootNode_.keyCount=1;
+ tagRootNode_.leftSibling=-1;
+ tagRootNode_.rightSibling=-1;
+ tagRootNode_.freeSpace=476;
+ tagRootNode_.recNumberMask=0xffff;
+ tagRootNode_.dupByteCounterMask=0xf;
+ tagRootNode_.tailByteCounterMask=0xf;
+ tagRootNode_.recBitUsing=16;
+ tagRootNode_.dupBitUsing=4;
+ tagRootNode_.tailBitUsing=4;
+ tagRootNode_.byteCount=3;
+ xbShort indexHeadOffset=0x600;
+ int len=sizeof(indexHeadOffset);
+ memcpy(tagRootNode_.keys, &indexHeadOffset, len);
+ tagRootNode_.keys[len]=16;
+ len=strlen(tagName);
+ xbString tag=tagName;
+ tag.toUpperCase();
+ memcpy(tagRootNode_.keys+sizeof(tagRootNode_.keys)-len, tag.c_str(), len);
+ fwrite(&tagRootNode_, sizeof(tagRootNode_), 1, indexfp);
+}
+
+void xbCdx::WriteIndexHeader(const char* expr)
+{
+ memset(&indexHeader_, 0, sizeof(indexHeader_));
+ indexHeader_.rootNode=0xa00;
+ indexHeader_.keyLen=33;
+ indexHeader_.features.feature=0x60;
+ indexHeader_.signature=1;
+ indexHeader_.totalExprLen=strlen(expr)+1;
+ indexHeader_.forExprLen=1;
+ indexHeader_.keyExprLen=strlen(expr)+1;
+ xbString exprn=expr;
+ exprn.toUpperCase();
+ memcpy(indexHeader_.keyforBuffer, exprn.c_str(), indexHeader_.keyExprLen);
+ fwrite(&indexHeader_, sizeof(indexHeader_), 1, indexfp);
+}
+
+void xbCdx::WriteIndexRoot()
+{
+ memset(&indexRootNode_, 0, sizeof(indexRootNode_));
+ indexRootNode_.attr=3;
+ indexRootNode_.keyCount=0;
+ indexRootNode_.leftSibling=-1;
+ indexRootNode_.rightSibling=-1;
+ indexRootNode_.freeSpace=488;
+ indexRootNode_.recNumberMask=0x0fff;
+ indexRootNode_.dupByteCounterMask=0x3f;
+ indexRootNode_.tailByteCounterMask=0x3f;
+ indexRootNode_.recBitUsing=12;
+ indexRootNode_.dupBitUsing=6;
+ indexRootNode_.tailBitUsing=6;
+ indexRootNode_.byteCount=3;
+ fwrite(&indexRootNode_, sizeof(indexRootNode_), 1, indexfp);
+}
+
+xbShort xbCdx::GetHeadNode()
+{
+ ReadTagHeader();
+ ReadIndexHeader(GetIndexTagOffset());
+ return XB_NO_ERROR;
+}
+
+void xbCdx::ReadTagHeader()
+{
+ _fseek(indexfp, 0, SEEK_SET);
+ fread(&tagHeader_, sizeof(tagHeader_), 1, indexfp);
+}
diff --git a/xbase64/xbcdx.h b/xbase64/xbcdx.h new file mode 100755 index 0000000..f76a45f --- /dev/null +++ b/xbase64/xbcdx.h @@ -0,0 +1,150 @@ +#ifndef cdx_h
+#define cdx_h
+
+#include "xbmindex.h"
+
+struct CdxHeader
+{
+ xbLong rootNode;
+ xbLong freeNode;
+ xbLong reserved;
+ xbShort keyLen;
+ union cdxFeatures
+ {
+ struct Features
+ {
+ bool unique:1;
+ int:2;
+ bool hasFor:1;
+ bool:1;
+ bool cdxHeader:1;
+ bool cdxFmt:1;
+ bool cdxTagHeader:1;
+ } features;
+ char feature;
+ } features;
+ char signature;
+ xbLong reserved1[5];
+ char reserved2[466];
+ xbShort descending;
+ xbShort totalExprLen;
+ xbShort forExprLen;
+ xbShort reserved4;
+ xbShort keyExprLen;
+ char keyforBuffer[512];
+};
+
+struct CdxNode
+{
+ xbShort attr;
+ xbShort keyCount;
+ xbLong leftSibling;
+ xbLong rightSibling;
+}
+#ifdef __GNU LesserC__
+ __attribute__((packed))
+#endif
+;
+
+struct CdxInnerNode: public CdxNode
+{
+ char keys[500];
+}
+#ifdef __GNU LesserC__
+ __attribute__((packed))
+#endif
+;
+
+struct CdxLeafNode: public CdxNode
+{
+ xbShort freeSpace;
+ xbLong recNumberMask;
+ char dupByteCounterMask;
+ char tailByteCounterMask;
+ char recBitUsing;
+ char dupBitUsing;
+ char tailBitUsing;
+ char byteCount;
+ char keys[488];
+}
+#ifdef __GNU LesserC__
+ __attribute__((packed))
+#endif
+;
+
+class XBDLLEXPORT xbCdx: public xbMultiIndex
+{
+ public:
+// xbCdx() {} I don't like to make empty object with no protection
+// to method method call. And I don't see any need of it.
+ xbCdx(xbDbf* dbf): xbMultiIndex(dbf)
+ {
+ memset(&indexHeader_, 0, sizeof(indexHeader_));
+ memset(&tagHeader_, 0, sizeof(tagHeader_));
+ }
+
+ virtual ~xbCdx() {CloseIndex();}
+
+ virtual xbShort CreateIndex(const char *filename, const char *expr,
+ xbShort unique, xbShort overwrite);
+ virtual xbShort CreateIndex(const char *filename, const char* tagname,
+ const char *expr, xbShort unique, xbShort overwrite);
+
+ virtual xbShort AddTag(const char* tagname, const char *expr,
+ xbShort unique, xbShort overwrite) {return 0;}
+
+ virtual xbLong GetTotalNodes() {return 0;}
+ virtual xbULong GetCurDbfRec() {return 0;}
+ virtual xbShort CreateKey( xbShort, xbShort ) {return 0;}
+ virtual xbShort GetCurrentKey(char *key) {return 0;}
+ virtual xbShort AddKey( xbLong ) {return 0;}
+ virtual xbShort UniqueIndex() {return 0;}
+ virtual xbShort DeleteKey( xbLong ) {return 0;}
+ virtual xbShort KeyWasChanged() {return 0;}
+ virtual xbShort FindKey( const char * ) {return 0;}
+ virtual xbShort FindKey() {return 0;}
+ virtual xbShort FindKey( xbDouble ) {return 0;}
+ virtual xbShort GetNextKey() {return 0;}
+ virtual xbShort GetLastKey() {return 0;}
+ virtual xbShort GetFirstKey() {return 0;}
+ virtual xbShort GetPrevKey() {return 0;}
+ virtual xbShort ReIndex(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0) {return 0;}
+ virtual xbShort KeyExists( xbDouble ) {return 0;}
+ virtual void GetExpression(char *buf, int len) {}
+#ifdef XBASE_DEBUG
+ virtual void DumpHdrNode( xbShort Option ) {};
+ virtual void DumpNodeRec( xbLong ) {};
+ virtual void DumpNodeChain() {};
+ virtual xbShort CheckIndexIntegrity( xbShort ) {return 0;};
+#endif
+
+// static xbString CreateIndexName(const xbString& dbfName);
+ virtual const char* GetExtWithDot(bool lower);
+ const CdxHeader& GetIndexHeader() {return indexHeader_;}
+ const CdxHeader& GetTagHeader() {return tagHeader_;}
+
+ protected:
+ virtual xbShort GetHeadNode();
+ virtual xbUShort GetKeyLen() {return 0;}
+ virtual const char* GetKeyExpression() {return "";}
+ virtual void FreeNodesMemory() {}
+ void ReadTagHeader();
+ xbLong GetIndexTagOffset() {return 0;}
+ void ReadIndexHeader(xbLong) {}
+
+ private:
+ xbCdx(const xbCdx&);
+ xbCdx& operator=(const xbCdx&);
+ void WriteTagHeader(const char* tagName);
+ void WriteTagRoot(const char* tagName);
+ void WriteIndexHeader(const char* expr);
+ void WriteIndexRoot();
+
+ private:
+ CdxHeader tagHeader_;
+ CdxLeafNode tagRootNode_;
+ CdxHeader indexHeader_;
+ CdxLeafNode indexRootNode_;
+};
+
+#endif
diff --git a/xbase64/xbconfig.h b/xbase64/xbconfig.h new file mode 100644 index 0000000..15a3e69 --- /dev/null +++ b/xbase64/xbconfig.h @@ -0,0 +1,131 @@ +/* xbase64/xbconfig.h. Generated by configure. */ +/* xbase64/xbconfig.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fseeko' function. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the `ftello' function. */ +#define HAVE_FTELLO 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the `vsprintf' function. */ +#define HAVE_VSPRINTF 1 + +/* Name of package */ +#define PACKAGE "xbase64" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "xdb-devel@lists.sourceforge.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "xbase64" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "xbase64 3.1.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "xbase64" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.1.2" + +#define PATH_SEPARATOR '/' + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "3.1.2" + +/* XB_DEBUG */ +#define XBASE_DEBUG 1 + +#define XB_DBT_BLOCK_SIZE 512 + +/* XB_EXPRESSIONS */ +#define XB_EXPRESSIONS 1 + +/* XB_FILTERS */ +#define XB_FILTERS 1 + +/* XB_INDEX_ANY */ +#define XB_INDEX_ANY 1 + +/* XB_INDEX_NDX */ +#define XB_INDEX_NDX 1 + +/* XB_INDEX_NTX */ +#define XB_INDEX_NTX 1 + +/* XB_LARGEFILE_SUPPORT */ +#define XB_LARGEFILE_SUPPORT 1 + +/* XB_LOCKING_ON */ +#define XB_LOCKING_ON 1 + +/* XB_MEMO_FIELDS */ +#define XB_MEMO_FIELDS 1 + +/* XB_REAL_DELETE */ +#define XB_REAL_DELETE 1 + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ diff --git a/xbase64/xbconfig.in b/xbase64/xbconfig.in new file mode 100755 index 0000000..8c25663 --- /dev/null +++ b/xbase64/xbconfig.in @@ -0,0 +1,130 @@ +/* xbase64/xbconfig.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fseeko' function. */ +#undef HAVE_FSEEKO + +/* Define to 1 if you have the `ftello' function. */ +#undef HAVE_FTELLO + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the `vsprintf' function. */ +#undef HAVE_VSPRINTF + +/* 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 PATH_SEPARATOR '/' + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* XB_DEBUG */ +#undef XBASE_DEBUG + +#define XB_DBT_BLOCK_SIZE 512 + +/* XB_EXPRESSIONS */ +#undef XB_EXPRESSIONS + +/* XB_FILTERS */ +#undef XB_FILTERS + +/* XB_INDEX_ANY */ +#undef XB_INDEX_ANY + +/* XB_INDEX_NDX */ +#undef XB_INDEX_NDX + +/* XB_INDEX_NTX */ +#undef XB_INDEX_NTX + +/* XB_LARGEFILE_SUPPORT */ +#undef XB_LARGEFILE_SUPPORT + +/* XB_LOCKING_ON */ +#undef XB_LOCKING_ON + +/* XB_MEMO_FIELDS */ +#undef XB_MEMO_FIELDS + +/* XB_REAL_DELETE */ +#undef XB_REAL_DELETE + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE diff --git a/xbase64/xbdate.cpp b/xbase64/xbdate.cpp new file mode 100755 index 0000000..fd26438 --- /dev/null +++ b/xbase64/xbdate.cpp @@ -0,0 +1,851 @@ +/* xbdate.cpp + + Xbase64 project source code + + These functions are used for processing dates. + All functions assume a standard date format of CCYYMMDD + for Century,Year,Month and Day + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbdate.h" +#endif + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif +#include <xbase64/xbase64.h> +#include <xbase64/xbdate.h> +//#include <xbase64/retcodes.h> + +/*! \file xbdate.cpp +*/ + +int xbDate::DaysInMonths[2][13]; +int xbDate::AggregatedDaysInMonths[2][13]; + +#define EPOCH_MIN 100 +#define EPOCH_MAX 3000 +#define DAYS_AD(year) ((year) *365L + (year) / 4 - (year) / 100 + (year) / 400) + +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +xbDate::xbDate( const xbString & Date8 ) { + if( DateIsValid( Date8 )) + cDate8 = Date8; + else + Sysdate(); + SetDateTables(); +} +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +xbDate::xbDate( const char * Date8 ) { + if( DateIsValid( Date8 )) + cDate8 = Date8; + else + Sysdate(); /* if invalid date, set class to sysdate */ + SetDateTables(); +} +/***************************************************************/ +//! Short description. +/*! +*/ +xbDate::xbDate() +{ + Sysdate(); + SetDateTables(); +} + +/***************************************************************/ +//! Destructor +/*! +*/ +xbDate::~xbDate() +{ +} +/***************************************************************/ +//! Short description. +/*! +*/ +void xbDate::SetDateTables() { + if( AggregatedDaysInMonths[1][12] != 366 ){ /* first time called ? */ + AggregatedDaysInMonths[0][0] = 0; + AggregatedDaysInMonths[0][1] = 31; + AggregatedDaysInMonths[0][2] = 59; + AggregatedDaysInMonths[0][3] = 90; + AggregatedDaysInMonths[0][4] = 120; + AggregatedDaysInMonths[0][5] = 151; + AggregatedDaysInMonths[0][6] = 181; + AggregatedDaysInMonths[0][7] = 212; + AggregatedDaysInMonths[0][8] = 243; + AggregatedDaysInMonths[0][9] = 273; + AggregatedDaysInMonths[0][10] = 304; + AggregatedDaysInMonths[0][11] = 334; + AggregatedDaysInMonths[0][12] = 365; + AggregatedDaysInMonths[1][0] = 0; + AggregatedDaysInMonths[1][1] = 31; + AggregatedDaysInMonths[1][2] = 60; + AggregatedDaysInMonths[1][3] = 91; + AggregatedDaysInMonths[1][4] = 121; + AggregatedDaysInMonths[1][5] = 152; + AggregatedDaysInMonths[1][6] = 182; + AggregatedDaysInMonths[1][7] = 213; + AggregatedDaysInMonths[1][8] = 244; + AggregatedDaysInMonths[1][9] = 274; + AggregatedDaysInMonths[1][10] = 305; + AggregatedDaysInMonths[1][11] = 335; + AggregatedDaysInMonths[1][12] = 366; + + DaysInMonths[0][0] = 0; + DaysInMonths[0][1] = 31; + DaysInMonths[0][2] = 28; + DaysInMonths[0][3] = 31; + DaysInMonths[0][4] = 30; + DaysInMonths[0][5] = 31; + DaysInMonths[0][6] = 30; + DaysInMonths[0][7] = 31; + DaysInMonths[0][8] = 31; + DaysInMonths[0][9] = 30; + DaysInMonths[0][10] = 31; + DaysInMonths[0][11] = 30; + DaysInMonths[0][12] = 31; + DaysInMonths[1][0] = 0; + DaysInMonths[1][1] = 31; + DaysInMonths[1][2] = 29; + DaysInMonths[1][3] = 31; + DaysInMonths[1][4] = 30; + DaysInMonths[1][5] = 31; + DaysInMonths[1][6] = 30; + DaysInMonths[1][7] = 31; + DaysInMonths[1][8] = 31; + DaysInMonths[1][9] = 30; + DaysInMonths[1][10] = 31; + DaysInMonths[1][11] = 30; + DaysInMonths[1][12] = 31; + } +} + +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +/* this function returns century and year from a CCYYMMDD date */ +int xbDate::CenturyOf( const char * Date8 ) const +{ + char Century[3]; + Century[0] = Date8[0]; + Century[1] = Date8[1]; + Century[2] = 0x00; + return( atoi( Century )); +} + +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +/* this function returns century and year from a CCYYMMDD date */ +int xbDate::YearOf( const char * Date8 ) const +{ + char year[5]; + year[0] = Date8[0]; + year[1] = Date8[1]; + year[2] = Date8[2]; + year[3] = Date8[3]; + year[4] = 0x00; + return( atoi( year )); +} +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +/* this function returns the month from a CCYYMMDD date */ +int xbDate::MonthOf( const char * Date8 ) const +{ + char month[3]; + month[0] = Date8[4]; + month[1] = Date8[5]; + month[2] = 0x00; + return( atoi( month )); +} +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +/* this function returns TRUE if a CCYYMMDD date is a leap year*/ + +int xbDate::IsLeapYear( const char * Date8 ) const +{ + int year; + year = YearOf( Date8 ); + if(( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 ) + return 1; + else + return 0; +} + +/***************************************************************/ +//! Short description. +/*! + \param CalcYear +*/ +/* this function returns TRUE if a CCYYMMDD date is a leap year*/ + +int xbDate::CalcRollingCenturyForYear( int CalcYear ) const +{ + /* this routine calculates a century for a year - it uses + an 80/20 rolling date window to calculate the century */ + + xbDate d; + int ThisYear = YearOf( d.Sysdate() ); + int ThisCentury = CenturyOf( d.Sysdate() ); + + ThisYear -= (ThisCentury * 100); + + if( ThisYear < 80 && CalcYear < (ThisYear+20) ) + return ThisCentury; + + else if( ThisYear >= 80 && + CalcYear < ThisYear && + CalcYear >= (ThisYear-80)) + return ThisCentury; + + else + return ThisCentury - 1; +} +/***************************************************************/ +//! Short description. +/*! + \param Format + \param Date8 +*/ +/* this function returns the "day of" from a CCYYMMDD date */ + +/* format = XB_FMT_WEEK Number of day in WEEK 0-6 ( Sun - Sat ) + format = XB_FMT_MONTH Number of day in MONTH 1-31 + format = XB_FMT_YEAR Number of day in YEAR 1-366 +*/ + +int xbDate::DayOf( int Format, const char * Date8 ) const +{ + char day[3]; + int iday, imonth, iyear, iday2; + + /* check for valid format switch */ + + if( Format!=XB_FMT_WEEK && Format!=XB_FMT_MONTH && Format!=XB_FMT_YEAR ) + return XB_INVALID_OPTION; + + if( Format == XB_FMT_WEEK ) + { + iday = DayOf( XB_FMT_MONTH, Date8 ); + imonth = MonthOf( Date8 ); + iyear = YearOf ( Date8 ); + + /* The following formula uses Zeller's Congruence to determine + the day of the week */ + + if( imonth > 2 ) /* init to February */ + imonth -= 2; + else + { + imonth += 10; + iyear--; + } + + iday2 = ((13 * imonth - 1) / 5) +iday + ( iyear % 100 ) + + (( iyear % 100 ) / 4) + ((iyear /100 ) / 4 ) - 2 * + ( iyear / 100 ) + 77 ; + + return( iday2 - 7 * ( iday2 / 7 )); + } + + else if( Format == XB_FMT_MONTH ) + { + day[0] = Date8[6]; + day[1] = Date8[7]; + day[2] = 0x00; + return( atoi( day )); + } + else + return( + AggregatedDaysInMonths[IsLeapYear(Date8)][MonthOf(Date8)-1]+ + DayOf(XB_FMT_MONTH, Date8)); +} +/**********************************************************************/ +//! Short description. +/*! +*/ +/* this method sets the class date & returns the system date */ + +xbString& xbDate::Sysdate() +{ + char dt[9]; + time_t timer; + struct tm *tblock; + timer = time( NULL ); + tblock = localtime( &timer ); + tblock->tm_year += 1900; + tblock->tm_mon++; + sprintf( dt,"%4d%02d%02d",tblock->tm_year,tblock->tm_mon,tblock->tm_mday ); + dt[8] = 0x00; + cDate8 = dt; + return cDate8; +} +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +/* this function checks a date for validity - returns 1 if OK */ + +int xbDate::DateIsValid( const char * Date8 ) const +{ + int year, month, day; + + if(!isdigit( Date8[0] ) || !isdigit( Date8[1] ) || !isdigit( Date8[2] ) || + !isdigit( Date8[3] ) || !isdigit( Date8[4] ) || !isdigit( Date8[5] ) || + !isdigit( Date8[6] ) || !isdigit( Date8[7] ) ) + return 0; + + year = YearOf ( Date8 ); + month = MonthOf( Date8 ); + day = DayOf ( XB_FMT_MONTH, Date8 ); + + /* check the basics */ + if( year == 0 || month < 1 || month > 12 || day < 1 || day > 31 ) + return 0; + + /* April, June, September and November have 30 days */ + if(( month==4 || month==6 || month==9 || month==11 )&& day > 30 ) + return 0; + + /* check for February with leap year */ + if( month == 2 ) + if( IsLeapYear( Date8 )) + { + if( day > 29 ) + return 0; + } + else + { + if( day > 28 ) + return 0; + } + return 1; +} + +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +int xbDate::SetDate( const char * Date8 ) +{ + if( DateIsValid( Date8 )) + { + cDate8 = Date8; + return 1; + } + return 0; +} + +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +/* this returns the number of days since 1/1/EPOCH_MIN */ +long xbDate::JulianDays( const char * Date8 ) const +{ + int year = YearOf( Date8 ); + if(( year < EPOCH_MIN ) || (year >= EPOCH_MAX)) + return XB_INVALID_DATE; + + long days = 0; + for (long y = EPOCH_MIN; y < year; y++ ) + days += 365 + ( ( ( y%4==0 && y%100!=0 ) || y%400==0 ) ? 1 : 0 ); + + days += (long) DayOf( XB_FMT_YEAR, Date8 ) -1; + + return days; +} +/***************************************************************/ +//! Short description. +/*! + \param days +*/ +/* this function does the opposite of the JulianDays function */ +/* it converts a julian based date into a Date8 format */ + +xbString& xbDate::JulToDate8( long days ) +{ + char Date8[9]; + int year, leap, month; + + year = EPOCH_MIN; + leap = 0; /* EPOCH_MIN of 100 is not a leap year */ + +/* this while loop calculates the year of the date by incrementing + the years counter as it decrements the days counter */ + + while( days > ( 364+leap )) + { + days -= 365+leap; + year++; + if(( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 ) + leap = 1; + else + leap = 0; + } + +/* this for loop calculates the month and day of the date by + comparing the number of days remaining to one of the tables */ + + for( month = 12; month >= 1; month-- ) + if( days >= (long)AggregatedDaysInMonths[leap][month] ) { + days -= AggregatedDaysInMonths[leap][month]; + break; + } + + sprintf( Date8, "%4d%02d%02ld", year, month+1, days+1 ); + + Date8[8] = 0x00; + cDate8 = Date8; + return cDate8; +} +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +/* this routine returns a pointer to the day of the week(Sun-Sat)*/ +xbString& xbDate::CharDayOf( const char * Date8 ) +{ + struct tm tblock; + char buf[25]; + + tblock.tm_year = YearOf( Date8 ) - 1900; + tblock.tm_mon = MonthOf( Date8 ) - 1; + tblock.tm_mday = DayOf( XB_FMT_MONTH, Date8 ); + tblock.tm_hour = 0; + tblock.tm_min = 0; + tblock.tm_sec = 1; + tblock.tm_isdst = -1; + if( mktime( &tblock ) == -1 ) + fDate = "????"; + else + { + strftime( buf, 25, "%A", &tblock ); + fDate = buf; + } + return fDate; +} +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +/* this routine returns a pointer to the month */ + +xbString& xbDate::CharMonthOf( const char * Date8 ) +{ + struct tm tblock; + char buf[25]; + + tblock.tm_year = YearOf( Date8 ) - 1900; + tblock.tm_mon = MonthOf( Date8 ) - 1; + tblock.tm_mday = DayOf( XB_FMT_MONTH, Date8 ); + tblock.tm_hour = 0; + tblock.tm_min = 0; + tblock.tm_sec = 1; + tblock.tm_isdst = -1; + if( mktime( &tblock ) == -1 ) + fDate = "????"; + else + { + strftime( buf, 25, "%B", &tblock ); + fDate = buf; + } + return fDate; +} + +/***************************************************************/ +//! Short description. +/*! + \param indate in the format of MM/DD/YY +*/ +/* This function formats a date and returns a pointer to a */ +/* static buffer containing the date */ + +xbString& xbDate::FormatCTODdate( const char * indate ) +{ + xbDate d; + char cbuf[3]; + char odate[9]; + fDate = ""; + if( indate[0] == ' ' || indate[1] == ' ' ) // empty date + return fDate; + + sprintf( cbuf, "%02d", + d.CalcRollingCenturyForYear( atoi( indate+6 ))); + odate[0] = cbuf[0]; + odate[1] = cbuf[1]; + odate[2] = indate[6]; + odate[3] = indate[7]; + odate[4] = indate[0]; + odate[5] = indate[1]; + odate[6] = indate[3]; + odate[7] = indate[4]; + odate[8] = 0x00; + + fDate = odate; + return fDate; +} +/***************************************************************/ +//! Short description. +/*! + \param Format + \param Date8 +*/ +/* This function formats a date and returns a pointer to a */ +/* static buffer containing the date */ + +xbString& xbDate::FormatDate( const char * Format, const char * Date8 ) +{ + const char *FmtPtr; /* format pointer */ + char *BufPtr; /* buffer pointer */ + char type; + char cbuf[10]; + int type_ctr, i; + char buf[50]; + xbString s; + + memset( buf, 0x00, 50 ); + if( strstr( Format, "YYDDD" )) + { + buf[0] = Date8[2]; + buf[1] = Date8[3]; + sprintf( buf+2, "%03d", DayOf( XB_FMT_YEAR, Date8 )); + } + else + { + BufPtr = buf; + FmtPtr = Format; + memset( cbuf, 0x00, 10 ); + while( *FmtPtr ) + { + if( *FmtPtr != 'D' && *FmtPtr != 'M' && *FmtPtr != 'Y' ) + { + *BufPtr = *FmtPtr; + BufPtr++; + FmtPtr++; + } + else + { + type = *FmtPtr; + type_ctr = 0; + while( *FmtPtr == type ) + { + type_ctr++; + FmtPtr++; + } + switch( type ) + { + case 'D': + if( type_ctr == 1 ) + { + sprintf( cbuf, "%d", DayOf( XB_FMT_MONTH, Date8 )); + strcat( buf, cbuf ); + BufPtr += strlen( cbuf ); + } + else if( type_ctr == 2 ) + { + cbuf[0] = Date8[6]; + cbuf[1] = Date8[7]; + cbuf[2] = 0x00; + strcat( buf, cbuf ); + BufPtr += 2; + } + else + { + s = CharDayOf( Date8 ); + if( type_ctr == 3 ) + { + strncat( buf, s.getData(), 3 ); + BufPtr += 3; + } + else + { + strcpy( cbuf, CharDayOf( Date8 )); + for( i = 0; i < 9; i++ ) + if( cbuf[i] == 0x20 ) cbuf[i] = 0x00; + strcat( buf, cbuf ); + BufPtr += strlen( cbuf ); + } + } + break; + + case 'M': + if( type_ctr == 1 ) + { + sprintf( cbuf, "%d", MonthOf( Date8 )); + strcat( buf, cbuf ); + BufPtr += strlen( cbuf ); + } + else if( type_ctr == 2 ) + { + cbuf[0] = Date8[4]; + cbuf[1] = Date8[5]; + cbuf[2] = 0x00; + strcat( buf, cbuf ); + BufPtr += 2; + } + else + { + s = CharMonthOf( Date8 ); + if( type_ctr == 3 ) + { + strncat( buf, s.getData(), 3 ); + BufPtr += 3; + } + else + { + strcpy( cbuf, CharMonthOf( Date8 )); + for( i = 0; i < 9; i++ ) + if( cbuf[i] == 0x20 ) cbuf[i] = 0x00; + strcat( buf, cbuf ); + BufPtr += strlen( cbuf ); + } + } + break; + + case 'Y': + if( type_ctr == 2 ) + { + cbuf[0] = Date8[2]; + cbuf[1] = Date8[3]; + cbuf[2] = 0x00; + strcat( buf, cbuf ); + BufPtr += 2; + } + else if( type_ctr == 4 ) + { + cbuf[0] = Date8[0]; + cbuf[1] = Date8[1]; + cbuf[2] = Date8[2]; + cbuf[3] = Date8[3]; + cbuf[4] = 0x00; + strcat( buf, cbuf ); + BufPtr += 4; + } + break; + + default: + break; + } + } + } + } + fDate = buf; + return fDate; +} +/***************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +/* this routine returns the Date8 format of the last day of the + month for the given input Date8 */ + +xbString & xbDate::LastDayOfMonth( const char * Date8 ) +{ + char tmp[9]; + sprintf( tmp, "%4.4d%2.2d%2.2d", + YearOf( Date8 ), MonthOf( Date8 ), + DaysInMonths[IsLeapYear(Date8)][MonthOf(Date8)]); + cDate8 = tmp; + return cDate8; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +xbString &xbDate::operator+=( int count ) +{ + JulToDate8( JulianDays() + count ); + return cDate8; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +xbString &xbDate::operator-=( int count ) +{ + JulToDate8( JulianDays() - count ); + return cDate8; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +xbString &xbDate::operator++( int ) +{ + *this+=1; + return cDate8; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +xbString &xbDate::operator--( int ) +{ + *this-=1; + return cDate8; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +xbString &xbDate::operator+( int count ) +{ + xbDate d( GetDate() ); + d+=count; + fDate = d.GetDate(); + return fDate; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +xbString &xbDate::operator-( int count ) +{ + xbDate d( GetDate() ); + d-=count; + fDate = d.GetDate(); + return fDate; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +long xbDate::operator-( const xbDate & d ) const +{ + return JulianDays() - d.JulianDays(); +} +/**********************************************************************/ +//! Short description. +/*! +*/ +int xbDate::operator==( const xbDate & d ) const +{ + if( JulianDays() == d.JulianDays() ) + return 1; + else + return 0; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +int xbDate::operator!=( const xbDate & d ) const +{ + if( JulianDays() != d.JulianDays() ) + return 1; + else + return 0; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +int xbDate::operator<( const xbDate & d ) const +{ + if( JulianDays() < d.JulianDays() ) + return 1; + else + return 0; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +int xbDate::operator>( const xbDate & d ) const +{ + if( JulianDays() > d.JulianDays() ) + return 1; + else + return 0; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +int xbDate::operator<=( const xbDate & d ) const +{ + if( JulianDays() <= d.JulianDays() ) + return 1; + else + return 0; +} +/**********************************************************************/ +//! Short description. +/*! +*/ +int xbDate::operator>=( const xbDate & d ) const +{ + if( JulianDays() >= d.JulianDays() ) + return 1; + else + return 0; +} +/**********************************************************************/ diff --git a/xbase64/xbdate.h b/xbase64/xbdate.h new file mode 100755 index 0000000..617fe50 --- /dev/null +++ b/xbase64/xbdate.h @@ -0,0 +1,278 @@ +/* xbdate.h + + Xbase64 project source code + + This file contains a header file for the xbDate object, which is + used for handling dates. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +/*! \file xbdate.h +*/ + +#ifndef __XB_XBDATE_H__ +#define __XB_XBDATE_H__ + +#ifdef __GNU LesserG__ +#pragma interface +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbstring.h> + +#define XB_FMT_WEEK 1 +#define XB_FMT_MONTH 2 +#define XB_FMT_YEAR 3 + +//! xbDate class +/*! +*/ + +class XBDLLEXPORT xbDate { + public: + xbDate(); + xbDate( const char * Date8 ); + xbDate( const xbString &Date8 ); + virtual ~xbDate(); + + //! Short description. + /*! + */ + const xbString & GetDate() const + { return cDate8; }; + //! Short description. + /*! + */ + xbString & GetDate() + { return cDate8; }; + //! Short description. + /*! + */ + const xbString & GetFormattedDate() const + { return fDate; }; + //! Short description. + /*! + */ + xbString & GetFormattedDate() + { return fDate; }; + + int SetDate( const char * Date8 ); + //! Short description. + /*! + */ + int SetDate( const xbString & Date8 ) + { return SetDate((const char *) Date8 ); }; + + long JulianDays ( const char *Date8 ) const; + //! Short description. + /*! + */ + long JulianDays ( const xbString & Date8 ) const + { return JulianDays((const char *) Date8 ); }; + //! Short description. + /*! + */ + long JulianDays () const + { return JulianDays((const char *) cDate8 ); }; + + int YearOf ( const char *Date8 ) const; + //! Short description. + /*! + */ + int YearOf ( const xbString & Date8 ) const + { return YearOf((const char *) Date8 ); }; + //! Short description. + /*! + */ + int YearOf () const + { return YearOf((const char *) cDate8 ); }; + + //! Short description. + /*! + */ + int CenturyOf ( const char *Date8 ) const; + + int MonthOf ( const char *Date8 ) const; + //! Short description. + /*! + */ + int MonthOf ( const xbString &Date8 ) const + { return MonthOf((const char *) Date8 ); }; + //! Short description. + /*! + */ + int MonthOf () const + { return MonthOf(( const char *) cDate8 ); }; + + int DayOf ( int Format, const char *Date8 ) const; + //! Short description. + /*! + */ + int DayOf ( int Format, const xbString &Date8 ) const + { return DayOf( Format, (const char *) Date8 ); }; + //! Short description. + /*! + */ + int DayOf ( int Format ) const + { return DayOf( Format, (const char *) cDate8 ); }; + + int IsLeapYear ( const char *Date8 ) const; + //! Short description. + /*! + */ + int IsLeapYear ( const xbString &Date8 ) const + { return IsLeapYear((const char *) Date8 ); }; + //! Short description. + /*! + */ + int IsLeapYear () const + { return IsLeapYear((const char *) cDate8 ); }; + + //! Short description. + /*! + */ + int CalcRollingCenturyForYear( int ) const; + + + int DateIsValid ( const char *Date8 ) const; + //! Short description. + /*! + */ + int DateIsValid ( const xbString & Date8 ) const + { return DateIsValid( (const char *) Date8 ); }; + + xbString& LastDayOfMonth( const char *Date8 ); + //! Short description. + /*! + */ + xbString& LastDayOfMonth( const xbString & Date8 ) + { return LastDayOfMonth((const char *) Date8 ); }; + //! Short description. + /*! + */ + xbString& LastDayOfMonth() + { return LastDayOfMonth((const char *) cDate8 ); }; + + xbString& Sysdate (); + xbString& JulToDate8( long ); + + //! Short description. + /*! + */ + xbString& FormatCTODdate( const char * indate ); + + //! Short description. + /*! + */ + xbString& FormatDate( const char *Format, const char *Date8 ); + //! Short description. + /*! + */ + xbString& FormatDate( const xbString &Format, const char *Date8 ) + { return FormatDate((const char *) Format, Date8 ); }; + //! Short description. + /*! + */ + xbString& FormatDate( const char *Format, const xbString &Date8 ) + { return FormatDate( Format, (const char *) Date8 ); }; + //! Short description. + /*! + */ + xbString& FormatDate( const xbString &Format, const xbString &Date8 ) + { return FormatDate((const char *) Format,(const char *) Date8 ); }; + //! Short description. + /*! + */ + xbString& FormatDate( const char *Format ) + { return FormatDate( (const char *) Format, (const char *) cDate8 ); }; + //! Short description. + /*! + */ + xbString& FormatDate( const xbString &Format ) + { return FormatDate((const char *) Format, (const char *) cDate8 ); }; + + xbString& CharDayOf ( const char *Date8 ); + //! Short description. + /*! + */ + xbString& CharDayOf ( const xbString &Date8 ) + { return CharDayOf((const char *) Date8 ); }; + //! Short description. + /*! + */ + xbString& CharDayOf () + { return CharDayOf((const char *) cDate8 ); }; + + xbString& CharMonthOf ( const char *Date8 ); + //! Short description. + /*! + */ + xbString& CharMonthOf ( const xbString &Date8 ) + { return CharMonthOf(( const char *) Date8 ); }; + //! Short description. + /*! + */ + xbString& CharMonthOf () + { return CharMonthOf(( const char *) cDate8 ); }; + + xbString &operator+=( int ); + xbString &operator-=( int ); + xbString &operator++( int ); /* post increment */ + xbString &operator--( int ); /* post increment */ + xbString &operator+ ( int ); + xbString &operator- ( int ); + long operator-( const xbDate & ) const; + int operator==( const xbDate & ) const; + int operator!=( const xbDate & ) const; + int operator< ( const xbDate & ) const; + int operator> ( const xbDate & ) const; + int operator<=( const xbDate & ) const; + int operator>=( const xbDate & ) const; + + protected: + void SetDateTables(); + xbString cDate8; /* CCYYMMDD date format */ + xbString fDate; /* other date format */ + static int AggregatedDaysInMonths[2][13]; + static int DaysInMonths[2][13]; +}; + +#endif // __XB_XBDATE_H__ + diff --git a/xbase64/xbdbf.cpp b/xbase64/xbdbf.cpp new file mode 100755 index 0000000..d3790cb --- /dev/null +++ b/xbase64/xbdbf.cpp @@ -0,0 +1,2671 @@ +/* xbdbf.cpp + + Xbase64 project source code + + This file contains the basic Xbase routines for reading and writing + Xbase .DBF files. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbdbf.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> + +#ifdef HAVE_IO_H +#include <io.h> +#endif +#include <errno.h> + +/*! \file xbdbf.cpp +*/ + +/************************************************************************/ +//! Constructor +/*! + \param x pointer to the global xbXbase class +*/ +xbDbf::xbDbf( xbXBase * x ) +{ + xbase = x; + InitVars(); +} +/************************************************************************/ +//! Destructor +/*! +*/ +xbDbf::~xbDbf() +{ + CloseDatabase(true); +} +/************************************************************************/ +//! Initialize private data members. +/*! + Internal use only. +*/ +void xbDbf::InitVars() +{ + SetFileName(NULL); + NoOfFields = 0; + DbfStatus = XB_CLOSED; + fp = NULL; + CurRec = 0L; + SchemaPtr = NULL; + RecBuf = NULL; + RecBuf2 = NULL; + Version = 0x00; + UpdateYY = 0x00; + UpdateMM = 0x00; + UpdateDD = 0x00; + NoOfRecs = 0L; + HeaderLen = 0x00; + RecordLen = 0x00; + NdxList = NULL; + FreeIxList = NULL; + XFV = 3; /* Xbase file version */ + +#ifdef XB_LOCKING_ON + xblfh = NULL; /* lock file for XB_XBASE_LOCK_MODE */ + LockMode = xbase->GetLockMode(); + TableLockCnt = 0; + IndexLockCnt = 0; +#ifdef XB_MEMO_FIELDS + MemoLockCnt = 0; +#endif + + AutoLock = 1; + CurLockType = -1; + CurLockCount = 0; + CurLockedRecNo = 0L; + CurRecLockType = -1; + CurRecLockCount = 0; + CurMemoLockType = -1; + CurMemoLockCount = 0; +#else + AutoLock = 0; +#endif + +#ifdef XB_MEMO_FIELDS + MemofileName = ""; + MemoHeader.BlockSize = XB_DBT_BLOCK_SIZE; + MemoHeader.Version = 0x03; + mfp = NULL; + mbb = NULL; + CurMemoBlockNo = -1; + mfield1 = 0; + MStartPos = 0; + MFieldLen = 0; + NextFreeBlock = 0L; + FreeBlockCnt = 0L; + MNextBlockNo = 0L; + MNoOfFreeBlocks = 0L; +#endif + +//#ifdef XB_REAL_DELETE + RealDelete = 0; + FirstFreeRec = 0L; + RealNumRecs = 0L; +//#endif +} +/************************************************************************/ +//! Set dbase version for the dbf file. +/*! + Set dbase version. Should only be used before creating a database with + xbDbf::CreateDatabase(). + + \param v version, either 3 or 4. +*/ +xbShort xbDbf::SetVersion(xbShort v) { + if (v == 0) + return XFV; + else + if(v == 3) { + XFV = 3; +#ifdef XB_MEMO_FIELDS + MemoHeader.Version = 0x03; +#endif + return XFV; + } else + if (v == 4) { + XFV = 4; +#ifdef XB_MEMO_FIELDS + MemoHeader.Version = 0x00; +#endif + return XFV; + } + + return XB_INVALID_OPTION; +} +/************************************************************************/ +//! Write the dbf header +/*! + Internal use only. + + \param PositionOption flag that indicates whether file postition should + be moved. non-zero if so, zero if not. +*/ +xbShort xbDbf::WriteHeader( xbShort PositionOption ) +{ + char buf[32]; + memset(buf, 0, 32); + if(PositionOption) + rewind(fp); + + memcpy(&buf[0], &Version, 4); + xbase->PutLong(&buf[4], NoOfRecs); + xbase->PutShort(&buf[8], HeaderLen ); + xbase->PutShort(&buf[10], RecordLen ); + +#ifdef XB_REAL_DELETE + if(RealDelete){ + xbase->PutULong(&buf[12], FirstFreeRec); + xbase->PutULong(&buf[16], RealNumRecs); + } +#endif + if(fwrite(buf, 32, 1, fp) != 1) + return XB_WRITE_ERROR; + + return XB_NO_ERROR; +} +/************************************************************************/ +//! Read the dbf header. +/*! + Internal use only. + + \param PositionOption +*/ +xbShort xbDbf::ReadHeader( xbShort PositionOption ) +{ +#if 0 + char buf[4]; + if (PositionOption) + rewind(fp); + if (fread(&Version, 4, 1, fp) != 1) + xb_error(XB_READ_ERROR); + + if (fread(buf, 4, 1, fp ) != 1) + xb_error(XB_READ_ERROR); + + NoOfRecs = xbase->GetLong( buf ); + if(fread(buf, 2, 1, fp) != 1) + xb_error(XB_READ_ERROR); + + HeaderLen = xbase->GetShort( buf ); + if(fread(buf, 2, 1, fp) != 1) + xb_error(XB_READ_ERROR); + + RecordLen = xbase->GetShort(buf); + +#ifdef XB_REAL_DELETE + if(RealDelete) + { + if (fread(buf, 4, 1, fp ) != 1) + xb_error(XB_READ_ERROR); + FirstFreeRec = xbase->GetULong( buf ); + + if (fread(buf, 4, 1, fp ) != 1) + xb_error(XB_READ_ERROR); + RealNumRecs = xbase->GetULong( buf ); + } +#endif +#else + char buf[32]; + + if(PositionOption) + rewind(fp); + + if(fread(buf, 32, 1, fp) != 1) + return XB_READ_ERROR; + + memcpy(&Version, buf, 4); + NoOfRecs = xbase->GetLong(&buf[4]); + HeaderLen = xbase->GetShort(&buf[8]); + RecordLen = xbase->GetShort(&buf[10]); + +#ifdef XB_REAL_DELETE + if(RealDelete) + { + FirstFreeRec = xbase->GetULong(&buf[12]); + RealNumRecs = xbase->GetULong(&buf[16]); + } +#endif +#endif + + return XB_NO_ERROR; +} +/************************************************************************/ +//! Determine if file name suffix is missing +/*! + Internal use only. +*/ +xbShort xbDbf::NameSuffixMissing( xbShort type, const char * name ) +{ + /* type 1 is DBF check + type 2 is NDX check + type 3 is MDX check + type 4 is NTX check + + Returns 0 if suffix found + 1 if suffix not found, lower case + 2 is suffix not found, upper, case +*/ + + xbShort len; + + len = strlen( name ); + if( len <= 4 ) + if( name[len-1] >= 'A' && name[len-1] <= 'Z' ) + return 2; + else + return 1; + + if( type == 1 && name[len-4] == '.' && + ( name[len-3] == 'd' || name[len-3] == 'D' ) && + ( name[len-2] == 'b' || name[len-2] == 'B' ) && + ( name[len-1] == 'f' || name[len-1] == 'F' ) + ) + return 0; + + if( type == 2 && name[len-4] == '.' && + ( name[len-3] == 'n' || name[len-3] == 'N' ) && + ( name[len-2] == 'd' || name[len-2] == 'D' ) && + ( name[len-1] == 'x' || name[len-1] == 'X' ) + ) + return 0; + + if( type == 4 && name[len-4] == '.' && + ( name[len-3] == 'n' || name[len-3] == 'N' ) && + ( name[len-2] == 't' || name[len-2] == 'T' ) && + ( name[len-1] == 'x' || name[len-1] == 'X' ) + ) + return 0; + + if( name[len-5] >= 'A' && name[len-5] <= 'Z' ) + return 2; + else + return 1; +} +/************************************************************************/ +//! Create the dbf file. +/*! + This method attempts to create the DBF file with the specified + name (TableName) and schema (xbSchema s). The OverLay switch is used to determine + if an existing file should be overwritten or an error flagged if the + file already exists. The record buffer is blanked (set to spaces). + + \param TableName name of the table + \param s xbSchema + \param Overlay One of the following: + \htmlonly + <p> + <table border=2><tr><th>OverLay</th><th>Description</th></tr> + <tr><td>XB_OVERLAY</td><td>Overwrite existing file if it exists</td></tr> + <tr><td>XB_DONTOVERLAY</td><td>Report an error if file exists</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{OverLay} & \textbf{Description} \\ \hline \hline + XB\_OVERLAY & Overwrite existing file if it exists \\ \hline + XB\_DONTOVERLAY & Report an error if file exists \\ \hline + \end{tabular} + \endlatexonly + \returns One of the following return codes: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_FILE_EXISTS</td><td>If the file exists and OverLay is XB_DONTOVERLAY</td></tr> + <tr><td>XB_OPEN_ERROR</td><td>Couldn't open the file</td></tr> <tr><td>XB_NO_MEMORY</td><td>Memory allocation error</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Couldn't write to disk</td><tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No Error \\ \hline + XB\_FILE\_EXISTS & If the file exists and OverLay is XB\_DONTOVERAY \\ \hline + XB\_OPEN\_ERROR & Couldn't open the file \\ \hline + XB\_WRITE\_ERROR & Couldn't write to disk \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::CreateDatabase( const char * TableName, xbSchema * s, + const xbShort Overlay ) +{ + xbShort i, j, k, k2, rc; /* , count; */ + +#ifdef XB_MEMO_FIELDS + xbShort MemoSw = 0; +#endif + + DbfStatus = XB_CLOSED; + SetFileName( TableName ); + + /* check if the file already exists */ + if((( fp = fopen( GetFileName(), "r" )) != NULL ) && !Overlay ){ + fclose( fp ); + return XB_FILE_EXISTS; + } + else if( fp ) fclose( fp ); + + if(( fp = fopen( GetFileName(), "w+b" )) == NULL ) + return XB_OPEN_ERROR; + +#ifdef XB_LOCKING_ON + /* no buffering in multi user mode */ + setbuf( fp, NULL ); + + /* open the lock file if XB_XBASE_LOCK_FLAVOR */ +// if( LockMode == XB_XBASE_LOCK_MODE ) +// if(( rc = OpenXbLockFile()) != XB_NO_ERROR ) +// return rc; +#endif + + /* count the number of fields and check paramaters */ + i = 0; + while( s[i].Type != 0 ){ + NoOfFields++; + +#ifdef XB_MEMO_FIELDS + if(s[i].Type == 'M'){ + s[i].FieldLen = 10; + s[i].NoOfDecs = 0; + } +#endif /* XB_MEMO_FIELDS */ + + if(s[i].Type == 'D'){ + s[i].FieldLen = 8; + s[i].NoOfDecs = 0; + } + + if(s[i].Type == 'C') + s[i].NoOfDecs = 0; + + RecordLen += s[i].FieldLen; + + if( s[i].Type != 'C' && + s[i].Type != 'N' && + s[i].Type != 'F' && + s[i].Type != 'D' && +#ifdef XB_MEMO_FIELDS + s[i].Type != 'M' && +#endif /* XB_MEMO_FIELDS */ + s[i].Type != 'L' ) + { + fclose( fp ); + InitVars(); + return XB_UNKNOWN_FIELD_TYPE; + } + +#ifdef XB_MEMO_FIELDS +// 8/18/03 types B and O dont exist yet - gkunkel +// if( !MemoSw && ( s[i].Type=='M' || s[i].Type=='B' || s[i].Type=='O')) + if( !MemoSw && ( s[i].Type=='M' )) + MemoSw++; +#endif + +// check for numeric fields which are too long + if((s[i].Type == 'N' || s[i].Type == 'F') && s[i].FieldLen > 19 ){ + fclose( fp ); + InitVars(); + return XB_INVALID_FIELD_LEN; + } + i++; + } + RecordLen++; /* add one byte for 0x0D */ + + if(( RecBuf = (char *) malloc( RecordLen )) == NULL ){ + fclose( fp ); + InitVars(); + return XB_NO_MEMORY; + } + + if(( RecBuf2 = (char *) malloc( RecordLen )) == NULL ){ + free( RecBuf ); + fclose( fp ); + InitVars(); + return XB_NO_MEMORY; + } + + /* BlankRecord(); */ + memset( RecBuf, 0x20, RecordLen ); + memset( RecBuf2, 0x20, RecordLen ); + + /* set class variables */ + Version = XFV & 0x7; // file version - bit 0-2 +#ifdef XB_MEMO_FIELDS + if(MemoSw){ + if((XFV & 0x7) == 3) + Version |= 0x80; // memo presence - bit 7 + else + Version = (char) 0x8b; + } +#endif + + CurRec = 0L; + HeaderLen = 33 + NoOfFields * 32; + xbDate d; + UpdateYY = (d.YearOf() - 1900); + if((XFV & 0x7) == 3) + UpdateYY %= 100; // dBASE III seems to do this, but IV does not. DTB + + UpdateMM = d.MonthOf(); + UpdateDD = d.DayOf( XB_FMT_MONTH ); + + /* write the header prolog */ + if(( rc = WriteHeader( 0 )) != XB_NO_ERROR ){ + free( RecBuf ); + free( RecBuf2 ); + fclose( fp ); + InitVars(); + return XB_WRITE_ERROR; + } + + if((SchemaPtr=(xbSchemaRec *)malloc(NoOfFields*sizeof(xbSchemaRec)))==NULL){ + free( RecBuf ); + free( RecBuf2 ); + fclose( fp ); + InitVars(); + return XB_NO_MEMORY; + } + memset( SchemaPtr, 0x00, ( NoOfFields * sizeof(xbSchemaRec))); + + /* write the field information into the header */ + for( i = 0, k = 1; i < NoOfFields; i++ ){ + memset( SchemaPtr[i].FieldName, 0x00, 11 ); + strncpy( SchemaPtr[i].FieldName, s[i].FieldName, 10 ); + + SchemaPtr[i].Type = s[i].Type; + SchemaPtr[i].FieldLen = s[i].FieldLen; + SchemaPtr[i].NoOfDecs = s[i].NoOfDecs; + + if( SchemaPtr[i].NoOfDecs > SchemaPtr[i].FieldLen ) { + fclose( fp ); + free( SchemaPtr ); + free( RecBuf ); + free( RecBuf2 ); + InitVars(); + return XB_INVALID_SCHEMA; + } + + k2 = k; + k += SchemaPtr[i].FieldLen; + + if(( fwrite( &SchemaPtr[i], 1, 18, fp )) != 18 ) { + fclose( fp ); + free( SchemaPtr ); + free( RecBuf ); + free( RecBuf2 ); + InitVars(); + return XB_WRITE_ERROR; + } + + for( j = 0; j < 14; j++ ) { + if(( fwrite( "\x00", 1, 1, fp )) != 1 ) { + free( SchemaPtr ); + free( RecBuf ); + free( RecBuf2 ); + fclose( fp ); + InitVars(); + return XB_WRITE_ERROR; + } + } + SchemaPtr[i].Address = RecBuf + k2; + SchemaPtr[i].Address2 = RecBuf2 + k2; + } + + /* write the header terminator */ + if(( fputc( XB_CHARHDR, fp )) != XB_CHARHDR ){ + fclose( fp ); + free( SchemaPtr ); + free( RecBuf ); + free( RecBuf2 ); + InitVars(); + return XB_WRITE_ERROR; + } + +#ifdef XB_MEMO_FIELDS + if( MemoSw ) + if((rc = CreateMemoFile()) != XB_NO_ERROR){ + fclose(fp); + free(RecBuf); + free(RecBuf2); + InitVars(); + return rc; + } +#endif + + DbfStatus = XB_OPEN; + return xbase->AddDbfToDbfList(this, GetFileName()); +} +/************************************************************************/ +//! Close the dbf file. +/*! + This method attempts to close the DBF file which was previously + opened with either CreateDatabase() or OpenDatabase(). Deletes any + memory allocated. Automatically closes any open indexes associated + with this data file. + + \param deleteIndexes if TRUE, the indexes (xbIndex instances) will also + be deleted (index files will not be deleted) + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_NOT_OPEN</td><td>File was not open</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No Error \\ \hline + XB\_NOT\_OPEN\_ERROR & File was not open \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::CloseDatabase( xbBool deleteIndexes ) +{ +#if defined(XB_INDEX_ANY) + xbIxList *i, *ti; +#endif + + if(DbfStatus == XB_CLOSED) + return XB_NO_ERROR; + + +#if defined(XB_INDEX_ANY) + i = NdxList; + while (i){ + i->index->CloseIndex(); + if(deleteIndexes) + delete i->index; + i = NdxList; + } +/* free up unused nodes */ + i = FreeIxList; + while( i ) { + ti = i; + i = i->NextIx; + free(ti); + } +#endif + + if(SchemaPtr){ + for( int j = 0; j < NoOfFields; j++ ) + if( SchemaPtr[j].fp ) delete SchemaPtr[j].fp; + free( SchemaPtr ); + } + if(RecBuf) + free( RecBuf ); + if(RecBuf2) + free( RecBuf2 ); + +#ifdef XB_MEMO_FIELDS + if( mbb ) + free( mbb ); /* memo block buffer */ + if( mfp ) + fclose( mfp ); /* memo file pointer */ +#endif + +#ifdef XB_LOCKING_ON + if( xblfh ){ + fclose( xblfh ); + xblfh = NULL; + } +#endif + + xbase->RemoveDbfFromDbfList( this ); + if(fp) + fclose( fp ); + InitVars(); + return XB_NO_ERROR; +} +/************************************************************************/ +/* options 1 = Print header only + 2 = Field data only + 3 = Header and Field data */ + +//! Dump header information. +/*! + \param Option One of the following: + \htmlonly + <p> + <table border=2><tr><th>Option</th><th>Description</th></tr> + <tr><td>1</td><td>Print header only</td></tr> + <tr><td>2</td><td>Field data only</td></tr> + <tr><td>3</td><td>Header and field data</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Option} & \textbf{Description} \\ \hline \hline + 1 & Header only \\ \hline + 2 & Field data only \\ \hline + 3 & Header and field data \\ \hline + \end{tabular} + \endlatexonly +*/ +#ifdef XBASE_DEBUG +xbShort xbDbf::DumpHeader( xbShort Option ) +{ + int i; + + if( Option < 1 || Option > 3 ) + return XB_INVALID_OPTION; + + if( DbfStatus == XB_CLOSED ) + return XB_NOT_OPEN; + + std::cout << "\nDatabase file " << GetFileName() << std::endl << std::endl; + + if( Option != 2 ){ + std::cout << "File header data:" << std::endl; + if( Version == 3 ) + std::cout << "Dbase III file" << std::endl; + else if ( Version == 83 ) + std::cout << "Dbase III file with memo fields" << std::endl << std::endl; + + std::cout << "Last update date = " + << (int) UpdateMM << "/" << (int) UpdateDD << "/" << (int) UpdateYY % 100 << std::endl; + + std::cout << "Header length = " << HeaderLen << std::endl; + std::cout << "Record length = " << RecordLen << std::endl; + std::cout << "Records in file = " << NoOfRecs << std::endl << std::endl; +#ifdef XB_REAL_DELETE + std::cout << "First Free Rec = " << FirstFreeRec << std::endl << std::endl; +#endif + } + if( Option != 1 ){ + std::cout << "Field Name Type Length Decimals" << std::endl; + std::cout << "---------- ---- ------ --------" << std::endl; + for( i = 0; i <NoOfFields; i++ ){ + if( SchemaPtr[i].Type == 'C' && SchemaPtr[i].NoOfDecs > 0 ) + printf( "%10s %1c %4d %4d\n", SchemaPtr[i].FieldName, + SchemaPtr[i].Type, SchemaPtr[i].FieldLen, 0 ); + else + printf( "%10s %1c %4d %4d\n", SchemaPtr[i].FieldName, + SchemaPtr[i].Type, SchemaPtr[i].FieldLen, SchemaPtr[i].NoOfDecs ); + } + } + std::cout << std::endl; + return XB_NO_ERROR; +} +#endif +/************************************************************************/ +//! Open the DBF file. +/*! + This method attempts to open the DBF file with the specified + name (TableName). This method does not position to any particular + record in the file. The record buffer is blanked (set to spaces). + + \param TableName Name of table to open + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_OPEN_ERROR</td><td>Couldn't open file</td></tr> + <tr><td>XB_NO_MEMORY</td><td>Memory allocation error</td></tr> + <tr><td>XB_NOT_XBASE</td><td>Not an DBF file</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_OPEN\_ERROR & Couldn't open file \\ \hline + XB\_NO\_MEMORY & Memory allocation error \\ \hline + XB\_NOT\_XBASE & Not an DBF file \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::OpenDatabase( const char * TableName ) +{ + xbShort i, j, rc; + char buf[33]; + char *p; + +#ifdef XB_MEMO_FIELDS + xbShort MemoSw = 0; +#endif + + /* verify the file is not already open */ + if( DbfStatus != XB_CLOSED ) + return XB_ALREADY_OPEN; + + /* copy the file name to the class variable */ + SetFileName( TableName ); + + /* open the file */ + if(( fp = fopen(GetFileName(), "r+b")) == NULL ){ + // + // Try to open read only if failed to open read/write + // + if(( fp = fopen(GetFileName(), "rb")) == NULL ) + return XB_OPEN_ERROR; + } + +#ifdef XB_LOCKING_ON + /* no buffering in multi user mode - may not see what others have updated */ + setbuf( fp, NULL ); + + /* open the lock file if XB_XBASE_LOCK_MODE */ +// if( LockMode == XB_XBASE_LOCK_MODE ) +// if(( rc = OpenXbLockFile()) != XB_NO_ERROR ) +// return rc; +#endif + +#ifdef XB_LOCKING_ON +// if( AutoLock ) +// if(( rc = LockDatabase( XB_LOCK, 0L )) != XB_NO_ERROR) +// return rc; +#endif + + /* copy the header into memory */ + if(( rc = ReadHeader( 1 )) != XB_NO_ERROR ){ + InitVars(); + return rc; + } + + /* check the version */ + if( Version == 3 || Version == (char)0x83 ){ /* dBASE III+ */ + XFV = 3; +#ifdef XB_MEMO_FIELDS + MemoHeader.Version = 0x03; +#endif + } + else if( Version == 4 || Version == (char)0x8B ){ /* dBASE IV */ + XFV = 4; +#ifdef XB_MEMO_FIELDS + MemoHeader.Version = 0x00; +#endif + } + else if( Version == (char)0xf5 ){ /* FoxPro */ + XFV = 4; +#ifdef XB_MEMO_FIELDS + MemoHeader.Version = 0x00; +#endif + } + else if( Version == (char)0x30 ){ /* Visual Foxpro */ + XFV = 4; +#ifdef XB_MEMO_FIELDS + MemoHeader.Version = 0x00; +#endif + } else { + InitVars(); + return XB_NOT_XBASE; + } + + // it would seem that dBASE III+ generates an UpdateYY value + // of 0 for 2000 and dBASE IV uses 100, so I have removed the + // check for UpdateYY being 0 (which might be valid). DTB + + // Not all flavors of database tools use these fields + // Found a month set to 0 in valid dbf file + // Commented out this check 2/11/06 - GAK + + // if( UpdateMM == 0 || UpdateDD == 0 ){ + // InitVars(); + // return XB_NOT_XBASE; + // } + + /* calculate the number of fields */ + if( Version == (char)0x30 ) { + NoOfFields = ( HeaderLen - 296 ) / 32 ; + } else { + NoOfFields = ( HeaderLen - 33 ) / 32; + } + + if(( RecBuf = (char *) malloc( RecordLen )) == NULL ) { + fclose( fp ); + InitVars(); + return XB_NO_MEMORY; + } + if(( RecBuf2 = (char *) malloc( RecordLen )) == NULL ) { + fclose( fp ); + free( RecBuf ); + InitVars(); + return XB_NO_MEMORY; + } + + if((SchemaPtr=(xbSchemaRec *)malloc(NoOfFields*sizeof(xbSchemaRec)))==NULL){ + free( RecBuf ); + free( RecBuf2 ); + fclose( fp ); + InitVars(); + return XB_NO_MEMORY; + } + memset( SchemaPtr, 0x00, ( NoOfFields * sizeof(xbSchemaRec))); + + /* copy field info into memory */ + for( i = 0, j = 1; i < NoOfFields; i++ ){ + _fseek( fp,((xbOffT)i*32+32), 0 ); + fread( &buf, 1, 32, fp ); + p = buf; + strncpy( SchemaPtr[i].FieldName, p, 10 ); + p += 11; + SchemaPtr[i].Type = *p++; + + SchemaPtr[i].Address = RecBuf + j; + SchemaPtr[i].Address2 = RecBuf2 + j; + + SchemaPtr[i].FieldLen = *( p + 4 ); + SchemaPtr[i].NoOfDecs = *( p + 5 ); + + if( SchemaPtr[i].Type == 'C' && SchemaPtr[i].NoOfDecs > 0 ){ + SchemaPtr[i].LongFieldLen = xbase->GetShort( p + 4 ); + j += SchemaPtr[i].LongFieldLen; + } + else + j += SchemaPtr[i].FieldLen; +#ifdef XB_MEMO_FIELDS + if( !MemoSw && (SchemaPtr[i].Type == 'M' || + SchemaPtr[i].Type == 'B' || SchemaPtr[i].Type == 'O' )) + MemoSw++; +#endif + } + CurRec = 0L; + BlankRecord(); + DbfStatus = XB_OPEN; + +#ifdef XB_MEMO_FIELDS + if( MemoSw ) /* does this table have memo fields ? */ + if(( rc = OpenMemoFile()) != XB_NO_ERROR ){ + free( RecBuf ); + free( RecBuf2 ); + free( SchemaPtr ); + fclose( fp ); + InitVars(); + return rc; + } +#endif + +#ifdef XB_LOCKING_ON +// if( AutoLock ) +// LockDatabase( XB_UNLOCK, 0L ); +#endif /* XB_LOCKING_ON */ + + return xbase->AddDbfToDbfList( this, GetFileName() ); +} +/************************************************************************/ +//! Blank the record buffer. +/*! + Sets the record to spaces. +*/ +xbShort xbDbf::BlankRecord() +{ + if( DbfStatus == XB_CLOSED ) + return XB_NOT_OPEN; + + if( DbfStatus != XB_UPDATED ){ + DbfStatus = XB_UPDATED; + memcpy( RecBuf2, RecBuf, RecordLen ); + } + + memset( RecBuf, 0x20, RecordLen ); + return XB_NO_ERROR; +} +/************************************************************************/ +//! Append the current record to the data file +/*! + This method attempts to append the contents of the current record buffer + to the end of the DBF file and updates the file date and number of + records in the file. Also updates any open indices associated with + this data file. + + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_LOCK_FAILED</td><td>Couldn't lock file</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Error writing to file</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_LOCK\_FAILED & Couldn't lock file \\ \hline + XB\_WRITE\_ERROR & Error writing to file \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::AppendRecord() +{ + xbShort rc; + xbULong nextRecNo; + +#if defined(XB_INDEX_ANY) + xbIxList *i; +#endif + +/* lock the database */ +#ifdef XB_LOCKING_ON +// if( AutoLock ) +// if(( rc = LockDatabase( XB_LOCK, 0L )) != XB_NO_ERROR) +// return rc; + + rc = ReadHeader(1); + +// if(AutoLock) +// LockDatabase( XB_UNLOCK, 0L ); + + if( rc ) + return rc; + +#endif + +/* lock any indexes */ +#if defined(XB_INDEX_ANY) +#ifdef XB_LOCKING_ON + i = NdxList; + while( i && AutoLock ){ +// if(( rc = i->index->LockIndex( XB_LOCK )) != XB_NO_ERROR ) +// return rc; + i = i->NextIx; + } +#endif /* XB_LOCKING_ON */ +#endif + +// if there are no duplicates, and no records set the CurRec to the +// last record + 1. This is for EXP::RECNO() + +/* check for any duplicate keys */ +#if defined(XB_INDEX_ANY) + i = NdxList; + while( i ){ + if( i->index->UniqueIndex() ){ + i->index->CreateKey( 0, 0 ); + if( i->index->FindKey() == XB_FOUND ) + return XB_KEY_NOT_UNIQUE; + } + i = i->NextIx; + } +#endif + +#ifdef XB_REAL_DELETE + if(RealDelete && FirstFreeRec) + nextRecNo = FirstFreeRec; + else + nextRecNo = NoOfRecs + 1; +#else + nextRecNo = NoOfRecs + 1; +#endif + + CurRec = NoOfRecs + 1; + +#if defined(XB_INDEX_ANY) +/* update the indexes */ + i = NdxList; + while( i ){ + if( !i->index->UniqueIndex() ) /* if we didn't prepare the key */ + if(( rc = i->index->CreateKey( 0, 0 )) != XB_NO_ERROR ) /* then do it before the add */ + return rc; + if(( rc = i->index->AddKey(nextRecNo)) != XB_NO_ERROR ) + return rc; + i->index->TouchIndex(); + i = i->NextIx; + } +#endif /* XB_INDEX_ANY */ + +#ifdef XB_REAL_DELETE + char buf[4]; + + if(RealDelete && FirstFreeRec){ + /* + ** Grab the next free rec no and put it in FirstFreeRec + */ + if(_fseek(fp, (HeaderLen+(((xbOffT)FirstFreeRec-1)*RecordLen)+1), 0) != 0) + return XB_SEEK_ERROR; + + if(fread(buf, 4, 1, fp) != 1) + return XB_READ_ERROR; + + FirstFreeRec = xbase->GetULong(buf); + } + + /* + ** Okay, seek and write the record out + */ + if(_fseek(fp, (HeaderLen+(((xbOffT)nextRecNo-1)*RecordLen)), 0) != 0) + return XB_SEEK_ERROR; + + if(fwrite( RecBuf, RecordLen, 1, fp) != 1) + return XB_WRITE_ERROR; + + /* + ** If we just appended the record to the file, then write the EOF char + */ + if(nextRecNo == NoOfRecs + 1){ + if( fputc( XB_CHAREOF, fp ) != XB_CHAREOF ) + return XB_WRITE_ERROR; + } +#else + /* write the last record */ + if( _fseek( fp,(HeaderLen+((xbOffT)NoOfRecs*RecordLen)), 0 ) != 0 ) + return XB_SEEK_ERROR; + + if( fwrite( RecBuf, RecordLen, 1, fp ) != 1 ) + return XB_WRITE_ERROR; + + /* write the end of file marker */ + if( fputc( XB_CHAREOF, fp ) != XB_CHAREOF ) + return XB_WRITE_ERROR; +#endif + + /* calculate the latest header information */ + xbDate d; + UpdateYY = d.YearOf() - 1900; + if(XFV == 3) + UpdateYY %= 100; // dBASE III seems to do this, IV does not. DTB + UpdateMM = d.MonthOf(); + UpdateDD = d.DayOf( XB_FMT_MONTH ); +#ifndef XB_REAL_DELETE + NoOfRecs++; +#else + if(RealDelete){ + if(nextRecNo == NoOfRecs + 1) + NoOfRecs++; + RealNumRecs++; + } + else + NoOfRecs++; +#endif + CurRec = nextRecNo; + + /* rewrite the header record */ + if(( rc = WriteHeader( 1 )) != XB_NO_ERROR ) + return rc; + +#ifdef XB_LOCKING_ON +// if( AutoLock ) +// LockDatabase( XB_UNLOCK, 0L ); + +#if defined(XB_INDEX_ANY) + i = NdxList; + while( i && AutoLock ){ +// i->index->LockIndex( XB_UNLOCK ); + i = i->NextIx; + } +#endif /* XB_INDEX_ANY */ +#endif /* XB_LOCKING_ON */ + + DbfStatus = XB_OPEN; + return XB_NO_ERROR; +} +/************************************************************************/ +//! Get a record from the data file +/*! + This method attempts to retrieve the record specified by RecNo from the + data file into the record buffer. + + \param RecNo Record number to retrieve + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_LOCK_FAILED</td><td>Couldn't lock file</td></tr> + <tr><td>XB_NOT_OPEN</td><td>File is not open</td></tr> + <tr><td>XB_INVALID_RECORD</td><td>Invalid record number</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Error writing to file</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_LOCK\_FAILED & Couldn't lock file \\ \hline + XB\_NOT\_OPEN & File is not open \\ \hline + XB\_INVALID\_RECORD & Invalid record number \\ \hline + XB\_WRITE\_ERROR & Error writing to file \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::GetRecord( xbULong RecNo ) +{ + xbShort rc; + if( DbfStatus == XB_CLOSED ) + return XB_NOT_OPEN; + +#ifdef XB_LOCKING_ON +// if( AutoLock ) +// if(( rc = LockDatabase( XB_LOCK, RecNo )) != 0 ) return rc; + + rc = ReadHeader(1); + +// if(AutoLock) +// LockDatabase( XB_UNLOCK, RecNo ); + + if( rc ) + return rc; + +#endif + + if( RecNo > NoOfRecs || RecNo == 0L ) + return XB_INVALID_RECORD; + + if( _fseek( fp, (HeaderLen+(((xbOffT)RecNo-1L)*RecordLen)), SEEK_SET )){ +#ifdef XB_LOCKING_ON +// LockDatabase( XB_UNLOCK, RecNo ); +#endif + return XB_SEEK_ERROR; + } + + if( fread( RecBuf, RecordLen, 1, fp ) != 1 ){ +#ifdef XB_LOCKING_ON +// LockDatabase( XB_UNLOCK, RecNo ); +#endif + return XB_READ_ERROR; + } + +#ifdef XB_LOCKING_ON +// if( AutoLock ) +// LockDatabase( XB_LOCK, RecNo ); +#endif + + DbfStatus = XB_OPEN; + CurRec = RecNo; + return XB_NO_ERROR; +} +/************************************************************************/ +//! Get the first physical record in the data file +/*! + Attempts to retrieve the first physical record from the data file into + the record buffer. + + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_LOCK_FAILED</td><td>Couldn't lock file</td></tr> + <tr><td>XB_NOT_OPEN</td><td>File is not open</td></tr> + <tr><td>XB_INVALID_RECORD</td><td>Invalid record number</td></tr> + <tr><td>XB_SEEK_ERROR</td><td>Error seeking file</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Error writing to file</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_LOCK\_FAILED & Couldn't lock file \\ \hline + XB\_NOT\_OPEN & File is not open \\ \hline + XB\_INVALID\_RECORD & Invalid record number \\ \hline + XB\_SEEK\_ERROR & Error seeking file \\ \hline + XB\_WRITE\_ERROR & Error writing to file \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::GetFirstRecord() +{ + xbShort rc; + if( NoOfRecs == 0 ) + return XB_INVALID_RECORD; + + rc = GetRecord( 1L ); +#ifdef XB_REAL_DELETE + if(!rc && RealDelete && RecordDeleted()) + rc = GetNextRecord(); +#endif + + return rc; +} +/************************************************************************/ +//! Get the last phyiscal record in the data file +/*! + Attempts to retrieve the last physical record from the data file into + the record buffer. + + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_LOCK_FAILED</td><td>Couldn't lock file</td></tr> + <tr><td>XB_EOF</td><td>At end of file</td></tr> + <tr><td>XB_NOT_OPEN</td><td>File is not open</td></tr> + <tr><td>XB_INVALID_RECORD</td><td>Invalid record number</td></tr> + <tr><td>XB_SEEK_ERROR</td><td>Error seeking file</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Error writing to file</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_LOCK\_FAILED & Couldn't lock file \\ \hline + XB\_EOF & At end of file \\ \hline + XB\_NOT\_OPEN & File is not open \\ \hline + XB\_INVALID\_RECORD & Invalid record number \\ \hline + XB\_SEEK\_ERROR & Error seeking file \\ \hline + XB\_WRITE\_ERROR & Error writing to file \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::GetLastRecord() +{ + xbShort rc; + if( NoOfRecs == 0 ) + return XB_INVALID_RECORD; + + rc = GetRecord( NoOfRecs ); +#ifdef XB_REAL_DELETE + if(!rc && RealDelete && RecordDeleted()) + rc = GetPrevRecord(); +#endif + + return rc; +} +/************************************************************************/ +//! Get the next physical record in the data file +/*! + Attempts to retrieve the next physical record from the data file into + the record buffer. + + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_LOCK_FAILED</td><td>Couldn't lock file</td></tr> + <tr><td>XB_EOF</td><td>At end of file</td></tr> + <tr><td>XB_NOT_OPEN</td><td>File is not open</td></tr> + <tr><td>XB_INVALID_RECORD</td><td>Invalid record number</td></tr> + <tr><td>XB_SEEK_ERROR</td><td>Error seeking file</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Error writing to file</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_LOCK\_FAILED & Couldn't lock file \\ \hline + XB\_EOF & At end of file \\ \hline + XB\_NOT\_OPEN & File is not open \\ \hline + XB\_INVALID\_RECORD & Invalid record number \\ \hline + XB\_SEEK\_ERROR & Error seeking file \\ \hline + XB\_WRITE\_ERROR & Error writing to file \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::GetNextRecord() +{ + xbShort rc; + if( NoOfRecs == 0 ) + return XB_INVALID_RECORD; + else if( CurRec >= NoOfRecs ) + return XB_EOF; + + rc = GetRecord( ++CurRec ); + +#ifdef XB_REAL_DELETE + while(!rc && RealDelete && RecordDeleted()) + rc = GetRecord(++CurRec); +#endif + + return rc; +} +/************************************************************************/ +//! Get the previous physical record in the data file +/*! + Attempts to retrieve the previous physical record from the data file into + the record buffer. + + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_LOCK_FAILED</td><td>Couldn't lock file</td></tr> + <tr><td>XB_BOF</td><td>At beginning of file</td></tr> + <tr><td>XB_NOT_OPEN</td><td>File is not open</td></tr> + <tr><td>XB_INVALID_RECORD</td><td>Invalid record number</td></tr> + <tr><td>XB_SEEK_ERROR</td><td>Error seeking file</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Error writing to file</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_LOCK\_FAILED & Couldn't lock file \\ \hline + XB\_BOF & At beginning of file \\ \hline + XB\_NOT\_OPEN & File is not open \\ \hline + XB\_INVALID\_RECORD & Invalid record number \\ \hline + XB\_SEEK\_ERROR & Error seeking file \\ \hline + XB\_WRITE\_ERROR & Error writing to file \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::GetPrevRecord() +{ + xbShort rc; + if( NoOfRecs == 0 ) + return XB_INVALID_RECORD; + else if( CurRec <= 1L ) + return XB_EOF; + + rc = GetRecord( --CurRec ); + +#ifdef XB_REAL_DELETE + while(!rc && RealDelete && RecordDeleted()) + rc = GetRecord(--CurRec); +#endif + + return rc; +} +/************************************************************************/ +//! Dump record +/*! + Dump the contents of the specified record to stdout. + + \param RecNo Record number of record to be dumped. + \returns An error code (same as GetRecord()). +*/ +xbShort xbDbf::DumpRecord( xbULong RecNo ) +{ + int i, rc; + char buf[4096]; + + if( RecNo == 0 || RecNo > NoOfRecs ) + return XB_INVALID_RECORD; + + rc = GetRecord( RecNo ); + if( rc != XB_NO_ERROR ) + return rc; + + std::cout << "\nREC NUMBER " << RecNo << "\n"; + + if( RecordDeleted() ) + std::cout << "\nRecord deleted...\n"; + + for( i = 0; i < NoOfFields; i++ ){ +#ifdef XB_MEMO_FIELDS + if(SchemaPtr[i].Type == 'M'){ + if( MemoFieldExists( i )){ + std::cout << SchemaPtr[i].Type << " " << SchemaPtr[i].FieldName + << " len = " << GetMemoFieldLen( i ) << std::endl; + memset( buf, 0x00, 4095 ); + rc = GetMemoField(i, 4095, buf, 0); + if(rc != XB_NO_ERROR) + return rc; + } else { + buf[0] = 0x00; + } + } + else + GetField( i, buf ); + std::cout << SchemaPtr[i].Type << " " << SchemaPtr[i].FieldName << " = '" << buf << "'\n"; +#else + GetField( i, buf ); + std::cout << SchemaPtr[i].FieldName << " = '" << buf << "'\n"; +#endif + } + std::cout << std::endl; + return XB_NO_ERROR; +} +/************************************************************************/ +//! Write the current record buffer to the current record in the data file. +/*! + Attempts to write the contents of the record buffer to the current + record in the data file. Updates any open indexes. + + \sa PutRecord(xbULong RecNo) + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_LOCK_FAILED</td><td>Couldn't lock file</td></tr> + <tr><td>XB_NOT_OPEN</td><td>File is not open</td></tr> + <tr><td>XB_INVALID_RECORD</td><td>Invalid record number</td></tr> + <tr><td>XB_SEEK_ERROR</td><td>Error seeking file</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Error writing to file</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_LOCK\_FAILED & Couldn't lock file \\ \hline + XB\_NOT\_OPEN & File is not open \\ \hline + XB\_INVALID\_RECORD & Invalid record number \\ \hline + XB\_SEEK\_ERROR & Error seeking file \\ \hline + XB\_WRITE\_ERROR & Error writing to file \\ \hline + \end{tabular} + \endlatexonly +*/ + +/************************************************************************/ +xbShort xbDbf::PutRecord() { + return PutRecord(CurRec); +} + +//! Write the current record buffer to the specified record in the data file. +/*! + Attempts to write the contents of the record buffer to the record specified + by RecNo. Updates any open indexes. + + \param RecNo Record number to which data should be written + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_LOCK_FAILED</td><td>Couldn't lock file</td></tr> + <tr><td>XB_NOT_OPEN</td><td>File is not open</td></tr> + <tr><td>XB_INVALID_RECORD</td><td>Invalid record number</td></tr> + <tr><td>XB_SEEK_ERROR</td><td>Error seeking file</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Error writing to file</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_LOCK\_FAILED & Couldn't lock file \\ \hline + XB\_NOT\_OPEN & File is not open \\ \hline + XB\_INVALID\_RECORD & Invalid record number \\ \hline + XB\_SEEK\_ERROR & Error seeking file \\ \hline + XB\_WRITE\_ERROR & Error writing to file \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::PutRecord(xbULong RecNo) +{ + xbShort rc; + +#if defined(XB_INDEX_ANY) + xbIxList *i; +#endif + + if( DbfStatus == XB_CLOSED ) + return XB_NOT_OPEN; + +/* lock the database */ +#ifdef XB_LOCKING_ON + if( AutoLock ){ +// if(( rc = LockDatabase( XB_LOCK, RecNo )) != XB_NO_ERROR ) +// return rc; +// if(( rc = LockDatabase( XB_LOCK, 0L )) != XB_NO_ERROR ){ +// LockDatabase( XB_UNLOCK, RecNo ); +// return rc; +// } + + if((rc = ReadHeader(1)) != XB_NO_ERROR){ +// if(AutoLock){ +// LockDatabase( XB_UNLOCK, RecNo ); +// LockDatabase( XB_UNLOCK, 0L ); +// } + return rc; + } + } +#endif + + if( RecNo > NoOfRecs || RecNo == 0L ) + return XB_INVALID_RECORD; + +/* lock the indexes */ +#if defined(XB_INDEX_ANY) +#ifdef XB_LOCKING_ON + i = NdxList; + while( i && AutoLock ){ +// if(( rc = i->index->LockIndex( XB_LOCK )) != XB_NO_ERROR ) +// return rc; + i = i->NextIx; + } +#endif /* XB_LOCKING_ON */ +#endif + +#if defined(XB_INDEX_ANY) + /* for any unique indexes that were updated, verify no unique keys exist */ + i = NdxList; + while( i ){ + if( i->index->UniqueIndex() ){ + if(( i->KeyUpdated = i->index->KeyWasChanged()) == 1 ){ + i->index->CreateKey(0, 0); + if( i->index->FindKey() == XB_FOUND && i->index->GetCurDbfRec() != RecNo) + return XB_KEY_NOT_UNIQUE; + } + } + i = i->NextIx; + } +#endif + +#if defined(XB_INDEX_ANY) + /* loop through deleting old index keys and adding new index keys */ + i = NdxList; + while( i ){ + if( !i->index->UniqueIndex() ) + i->KeyUpdated = i->index->KeyWasChanged(); + if( i->KeyUpdated ){ + i->index->CreateKey( 1, 0 ); /* load key buf w/ old values */ + if((rc = i->index->DeleteKey( CurRec )) != XB_NO_ERROR){ +#ifdef XB_LOCKING_ON +// if( AutoLock ){ +// LockDatabase( XB_UNLOCK, RecNo ); +// LockDatabase( XB_UNLOCK, 0L ); +// } +#if defined(XB_INDEX_ANY) + i = NdxList; + while( i && AutoLock ){ +// i->index->LockIndex( XB_UNLOCK ); + i = i->NextIx; + } +#endif /* XB_INDEX_ANY */ +#endif /* XB_LOCKING_ON */ + return rc; + } + + i->index->CreateKey( 0, 0 ); + if(( rc = i->index->AddKey(CurRec)) != XB_NO_ERROR ){ +#ifdef XB_LOCKING_ON +// if( AutoLock ){ +// LockDatabase( XB_UNLOCK, RecNo ); +// LockDatabase( XB_UNLOCK, 0L ); +// } +#if defined(XB_INDEX_ANY) + i = NdxList; + while( i && AutoLock ){ +// i->index->LockIndex( XB_UNLOCK ); + i = i->NextIx; + } +#endif /* XB_INDEX_ANY */ +#endif /* XB_LOCKING_ON */ + return rc; + } + i->index->TouchIndex(); + } + i = i->NextIx; + } +#endif /* XB_INDEX_ANY */ + + if( _fseek( fp, (HeaderLen+(((xbOffT)RecNo-1L)*RecordLen)),0 )) + return XB_SEEK_ERROR; + + if( fwrite( RecBuf, RecordLen, 1, fp ) != 1 ) + return XB_WRITE_ERROR; + + /* calculate the latest header information */ + xbDate d; + UpdateYY = d.YearOf() - 1900; + if(XFV == 3) + UpdateYY %= 100; // dBASE III seems to do this, IV does not. DTB + UpdateMM = d.MonthOf(); + UpdateDD = d.DayOf( XB_FMT_MONTH ); + + /* rewrite the header record */ + if(( rc = WriteHeader( 1 )) != XB_NO_ERROR ) + return rc; + +#ifdef XB_LOCKING_ON +// if( AutoLock ){ +// LockDatabase( XB_UNLOCK, RecNo ); +// LockDatabase( XB_UNLOCK, 0L ); +// } + +#if defined(XB_INDEX_ANY) + i = NdxList; + while( i && AutoLock ){ +// i->index->LockIndex( XB_UNLOCK ); + i = i->NextIx; + } +#endif /* XB_INDEX_ANY */ +#endif /* XB_LOCKING_ON */ + + CurRec = RecNo; + DbfStatus = XB_OPEN; + return XB_NO_ERROR; +} +/************************************************************************/ +//! Delete the current record +/*! + Marks the current record as deleted or if "real" deletes are turned + on (xbDbf::RealDeleteOn()) will delete the record and add it to the + free record list. Normal dBase behavior is to simply mark the record + as deleted; the record will actually be deleted when the the DBF file + "packed" (xbDbf::PackDatabase()). If "real" deletes are not on, a + record may be undeleted using xbDbf::UndeleteRecord(). + + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_INVALID_RECORD</td><td>Invalid record number</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_INVALID\_RECORD & Invalid record number \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::DeleteRecord() +{ + xbULong newCurRec = 0; + xbShort rc = XB_NO_ERROR; + +#if defined(XB_INDEX_ANY) + xbIxList *i; +#endif + + if(!RecBuf) + return XB_INVALID_RECORD; + + if(CurRec < 1 || CurRec > NoOfRecs) + return XB_INVALID_RECORD; + +/* lock the database */ +#ifdef XB_LOCKING_ON + + if( AutoLock ){ +/* + if(( rc = LockDatabase( XB_LOCK, CurRec )) != XB_NO_ERROR ) + return rc; + if(( rc = LockDatabase( XB_LOCK, 0L )) != XB_NO_ERROR ){ + LockDatabase( XB_UNLOCK, CurRec ); + return rc; + } + */ + if((rc = ReadHeader(1)) != XB_NO_ERROR){ +// if(AutoLock){ +// LockDatabase( XB_UNLOCK, CurRec ); +// LockDatabase( XB_UNLOCK, 0L ); +// } + return rc; + } + } +#endif + +/* lock the indexes */ +#if defined(XB_INDEX_ANY) && defined(XB_LOCKING_ON) && defined(XB_REAL_DELETE) + i = NdxList; + while( i && AutoLock ){ +// if(( rc = i->index->LockIndex( XB_LOCK )) != XB_NO_ERROR ) +// return rc; + i = i->NextIx; + } +#endif + +/* remove keys from indexes */ +#if defined(XB_REAL_DELETE) && defined(XB_INDEX_ANY) + + if(RealDelete){ + i = NdxList; + while(i){ + i->index->CreateKey(0, 0); /* load key buf */ + if(i->index->GetCurDbfRec() == (xbULong)CurRec){ + i->index->DeleteKey(CurRec); + newCurRec = i->index->GetCurDbfRec(); + } + else + i->index->DeleteKey(CurRec); + i->index->TouchIndex(); + i = i->NextIx; + } + } + +#endif + + RecBuf[0] = 0x2a; + + +#ifdef XB_REAL_DELETE + if(RealDelete){ +#ifdef XB_MEMO_FIELDS + // + // Delete memo data for memo fields. + // + for(int f = 0; f < NoOfFields; f++ ) + if(GetFieldType(f) == 'M' && MemoFieldExists(f)) + UpdateMemoData(f, 0, 0, XB_LOCK); +#endif + xbase->PutULong(&RecBuf[1], FirstFreeRec); + FirstFreeRec = CurRec; + RealNumRecs--; + WriteHeader(1); + } +#endif + + if(!RealDelete){ + if( DbfStatus != XB_UPDATED ){ + DbfStatus = XB_UPDATED; + memcpy( RecBuf2, RecBuf, RecordLen ); + } + rc = PutRecord( CurRec ); + } + else + { + if(_fseek( fp, (HeaderLen+(((xbOffT)CurRec-1L)*RecordLen)), 0)) + return XB_SEEK_ERROR; + if(fwrite( RecBuf, RecordLen, 1, fp ) != 1 ) + return XB_WRITE_ERROR; + + // + // Attempt to read in the record for the current location + // in the active index. + // + CurRec = newCurRec; + if(CurRec) + rc = GetRecord(CurRec); + else + BlankRecord(); + } + +#ifdef XB_LOCKING_ON +// if(AutoLock){ +// LockDatabase( XB_UNLOCK, CurRec ); +// LockDatabase( XB_UNLOCK, 0L ); +// } + +#if defined(XB_INDEX_ANY) && defined(XB_REAL_DELETE) + i = NdxList; + while( i && AutoLock ){ +// i->index->LockIndex( XB_UNLOCK ); + i = i->NextIx; + } +#endif /* XB_INDEX_ANY */ +#endif /* XB_LOCKING_ON */ + + return rc; +} +/************************************************************************/ +//! Undelete the current record +/*! + Marks the currect record as not deleted (i.e. removes the flag indicating + the record is deleted). This method may not be used (and will return + an error code) if "real" deletes are on. + + \returns One of the following: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_INVALID_RECORD</td><td>Invalid record number</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No error \\ \hline + XB\_INVALID\_RECORD & Invalid record number \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::UndeleteRecord() +{ + xbShort rc; + +#ifdef XB_REAL_DELETE + if(RealDelete) + return XB_INVALID_RECORD; +#endif + if( RecBuf ){ + if( DbfStatus != XB_UPDATED ){ + DbfStatus = XB_UPDATED; + memcpy( RecBuf2, RecBuf, RecordLen ); + } + + RecBuf[0] = 0x20; + if(( rc = PutRecord( CurRec )) != 0 ) + return rc; + } + else + return XB_INVALID_RECORD; + + return 0; +} +/************************************************************************/ +//! Determine if current record is deleted +/*! + \returns TRUE (1) if the current record is marked as deleted or FALSE + (0) if not. +*/ +xbShort xbDbf::RecordDeleted() +{ + if( RecBuf && RecBuf[0] == 0x2a ) + return 1; + else + return 0; +} +/************************************************************************/ +//! Create a unique file name +/*! +*/ +xbShort xbDbf::CreateUniqueDbfName( xbString & sDbfn, xbString & sDbtn ) +{ + xbShort dnf; /* directory in name flag */ + xbShort unique = 0; + xbLong l = 1; + char dbfn[13]; + char dbtn[13]; + + dnf = xbase->DirectoryExistsInName( GetFileName() ); + sprintf( dbfn, "xb%06d.dbf", l ); + sprintf( dbtn, "xb%06d.dbt", l++ ); + + if( dnf ){ + sDbfn.assign( GetFileName(), 0, dnf ); + sDbfn += dbfn; + sDbtn.assign( GetFileName(), 0, dnf ); + sDbtn += dbtn; + } else { + sDbfn = dbfn; + sDbtn = dbtn; + } + + while( !unique ){ + if( access( sDbfn.getData(), 0 ) == -1 && + access( sDbtn.getData(), 0 ) == -1 ) + unique++; + else{ + sprintf( dbfn, "xb%06d.dbf", l ); + sprintf( dbtn, "xb%06d.dbt", l++ ); + + if( dnf ){ + sDbfn.assign( GetFileName(), 0, dnf ); + sDbfn += dbfn; + sDbtn.assign( GetFileName(), 0, dnf ); + sDbtn += dbtn; + } else { + sDbfn = dbfn; + sDbtn = dbtn; + } + } + } + return 0; +} + +/************************************************************************/ +//! Pack data file +/*! +*/ +xbShort xbDbf::PackDatafiles(void (*statusFunc)(xbLong itemNum, xbLong numItems)) +{ + xbShort rc, i; + FILE *t; + xbLong l; + char *target, *source; + xbString TempDbfName; + xbString TempDbtName; + char * Buf = 0; + +#ifdef XB_MEMO_FIELDS + char tbuf[4]; +#endif + +#ifdef XB_MEMO_FIELDS + xbLong len, BufSize; + xbShort MemoFields; +#endif /* XB_MEMO_FIELDS */ + + xbDbf Temp( xbase ); + CreateUniqueDbfName( TempDbfName, TempDbtName ); + + if(( t = fopen( TempDbfName, "w+b" )) == NULL ) + return XB_OPEN_ERROR; + + /* copy file header */ + if(( rc = _fseek( fp, 0, SEEK_SET )) != 0 ) + return XB_SEEK_ERROR; + + for( i = 0; i < HeaderLen; i++ ) + fputc( fgetc( fp ), t ); + fputc( 0x1a, t ); + + if( fclose( t ) != 0 ) + return XB_CLOSE_ERROR; + +#ifdef XB_MEMO_FIELDS + if(( MemoFields = MemoFieldsPresent()) > 0 ){ + + if((t = fopen( TempDbtName, "w+b" )) == NULL) + return XB_OPEN_ERROR; + + l = 1L; + memset( tbuf, 0x00, 4 ); + xbase->PutLong( tbuf, l ); + + if((fwrite(&tbuf, 4, 1, t)) != 1) + return XB_WRITE_ERROR; + + if( MemoHeader.Version == 0x03 ){ + for( i = 0; i < 12; i++ ) fputc( 0x00, t ); + fputc( 0x03, t ); + for( i = 0; i < 495; i++ ) fputc( 0x00, t ); + } else { + for( i = 0; i < 4; i++ ) fputc( 0x00, t ); + if ((fwrite(&MemoHeader.FileName, 8, 1, t)) != 1) + return XB_WRITE_ERROR; + for( i = 0; i < 4; i++ ) fputc( 0x00, t ); + memset( tbuf, 0x00, 2 ); + xbase->PutShort( tbuf, MemoHeader.BlockSize ); + if ((fwrite(&tbuf, 2, 1, t)) != 1) + return XB_WRITE_ERROR; + + for( i = 22; i < MemoHeader.BlockSize; i++ ) fputc( 0x00, t ); + } + + if( fclose( t ) != 0 ) + return XB_CLOSE_ERROR; + } +#endif /* XB_MEMO_FIELDS */ + + /* reopen as database */ + if(( rc = Temp.OpenDatabase( TempDbfName )) != XB_NO_ERROR ) + return rc; + +#ifdef XB_REAL_DELETE + if(RealDelete) + Temp.RealDeleteOn(); + Temp.FirstFreeRec = 0; + Temp.RealNumRecs = 0; +#endif + Temp.ResetNoOfRecs(); + Temp.WriteHeader(2); // flush NoOfRecs=0 to disk + target = Temp.GetRecordBuf(); + source = GetRecordBuf(); + + for( l = 1; l <= PhysicalNoOfRecords(); l++ ){ + if(statusFunc && (l == 1 || !(l % 100) || l == PhysicalNoOfRecords())) + statusFunc(l, PhysicalNoOfRecords()); + + if(( rc = GetRecord( l )) != XB_NO_ERROR ) + return rc; + + if( !RecordDeleted() ){ + memcpy( target, source, GetRecordLen()); + +#ifdef XB_MEMO_FIELDS + BufSize = 0L; +// Buf = NULL; Already set to 0, this statement flags as memory leak + + for( i = 0; i < NoOfFields; i++ ){ + if( GetFieldType( i ) == 'M' && MemoFieldExists( i )){ + Temp.PutLongField(i, 0L); + len = GetMemoFieldLen( i ); + if( len > BufSize ){ + if( Buf ) + free( Buf ); + if((Buf = (char *)malloc(len)) == NULL) + return XB_NO_MEMORY; + BufSize = len; + } + GetMemoField( i, len, Buf, -1 ); + Temp.UpdateMemoData( i, len, Buf, -1 ); + } + } +#endif + if(( rc = Temp.AppendRecord()) != XB_NO_ERROR ){ + if(Buf) free(Buf); + return rc; + } + } + } + if( Buf ) free( Buf ); + Temp.CloseDatabase(); + + if(fclose(fp) != 0) + return XB_CLOSE_ERROR; + + if(remove(GetFileName()) != 0) + return XB_WRITE_ERROR; + + if(rename(TempDbfName, GetFileName()) != 0) + return XB_WRITE_ERROR; + +#ifdef XB_MEMO_FIELDS + if( MemoFields ){ + if(fclose(mfp) != 0) + return XB_CLOSE_ERROR; + + if(remove(MemofileName) != 0) + return XB_WRITE_ERROR; + if( rename( TempDbtName, MemofileName ) != 0 ) + return XB_WRITE_ERROR; + if(( mfp = fopen( MemofileName, "r+b" )) == NULL ) + return XB_OPEN_ERROR; + if(( rc = GetDbtHeader(1)) != 0 ){ + fclose( mfp ); + return rc; + } +#ifdef XB_LOCKING_ON + /* no buffering in multi user mode */ + setbuf( mfp, NULL ); +#endif + } + +#endif /* XB_MEMO_FIELDS */ + + if(( fp = fopen( GetFileName(), "r+b" )) == NULL ) + return XB_OPEN_ERROR; + +#ifdef XB_LOCKING_ON + /* no buffering in multi user mode */ + setbuf( fp, NULL ); +#endif + + return XB_NO_ERROR; +} +/************************************************************************/ +//! Pack the database +/*! + This method removes all records marked for deletion from an Xbase (.DBF) + file, reindexes any open index files, and also reorganizes any memo fields + stored in a .DBT memo file. + + \param packStatusFunc status function + \param indexStatusFunc index status function + + \param LockWaitOption One of the following: + \htmlonly + <p> + <table border=2><tr><th>LockWaitOption</th><th>Description</th></tr> + <tr><td>F_SETLK</td><td>Return immediately if the DBF file cannot be locked</td></tr> + <tr><td>XB_LOCK</td><td>Wait for lock on DBF file to succeed</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{LockWaitOption} & \textbf{Description} \\ \hline \hline + F\_SETLK & Return immediately if DBF file cannot be locked \\ \hline + F\_SETLKW & Wait for lock on DBF file to succeed \\ \hline + \end{tabular} + \endlatexonly + + \returns One of the following return codes: + \htmlonly + <p> + <table border=2><tr><th>Return Code</th><th>Description</th></tr> + <tr><td>XB_NO_ERROR</td><td>No error</td></tr> + <tr><td>XB_CLOSE_ERROR</td><td>Unable to close intermediate work file</td></tr> + <tr><td>XB_OPEN_ERROR</td><td>Could not open file</td></tr> + <tr><td>XB_NO_MEMORY</td><td>Memory allocation error</td></tr> + <tr><td>XB_WRITE_ERROR</td><td>Couldn't write to disk</td></tr> + <tr><td>XB_SEEK_ERROR</td><td>Error seeking file</td></tr> + <tr><td>XB_LOCK_FAILED</td><td>Unable to lock file or index</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Return Code} & \textbf{Description} \\ \hline \hline + XB\_NO\_ERROR & No Error \\ \hline + XB\_CLOSE\_ERROR & Unable to close intermediate work file \\ \hline + XB\_OPEN\_ERROR & Couldn't open the file \\ \hline + XB\_NO\_MEMORY & Memory allocation error \\ \hline + XB\_WRITE\_ERROR & Couldn't write to disk \\ \hline + XB\_SEEK\_ERROR & Error seeking file \\ \hline + XB\_LOCK\_FAILED & Unable to lock file or index \\ \hline + \end{tabular} + \endlatexonly +*/ +xbShort xbDbf::PackDatabase(xbShort LockWaitOption, + void (*packStatusFunc)(xbLong itemNum, xbLong numItems), + void (*indexStatusFunc)(xbLong itemNum, xbLong numItems)) +{ + xbShort rc; + + /* lock all open files and indexes */ +// if(( rc = ExclusiveLock( LockWaitOption )) != XB_NO_ERROR ) return rc; + + if(( rc = PackDatafiles(packStatusFunc)) != XB_NO_ERROR ){ +// ExclusiveUnlock(); + return rc; + } + + /* refresh file header */ + if(( rc = ReadHeader(1)) != XB_NO_ERROR ) + return rc; + + if(( rc = RebuildAllIndices(indexStatusFunc)) != XB_NO_ERROR ) + return rc; + +// ExclusiveUnlock(); + return XB_NO_ERROR; +} +/************************************************************************/ +//! Copy DBF structure +/*! +*/ +xbShort xbDbf::CopyDbfStructure(const char *NewFileName, xbShort Overlay) { + + xbShort rc, i; + xbString ndfn; /* new dbf file name */ + char ch; + +#ifdef XB_MEMO_FIELDS + char buf[9]; + xbShort ct, NameLen; + xbString MemoName; +#endif + FILE *t; + + /* build the new file name */ + rc = NameSuffixMissing( 1, NewFileName ); + ndfn = NewFileName; + if( rc == 1 ) + ndfn += ".dbf"; + else if( rc == 2 ) + ndfn += ".DBF"; + + /* check if the file exists and Overlay is on */ + if(((t = fopen( ndfn, "r" )) != NULL ) && !Overlay) { + fclose(t); + return XB_FILE_EXISTS; + } + + /* open new file */ + if((t = fopen(ndfn, "w+b")) == NULL) + return XB_OPEN_ERROR; + + /* copy the file header */ + if(( rc = _fseek( fp, 0, SEEK_SET )) != 0 ) + return XB_SEEK_ERROR; + + fputc( fgetc( fp ), t ); + + /* do the date */ + xbDate d; + ch = d.YearOf() - 1900; + if(XFV == 3) + ch %= 100; // dBASE III+ does this, dBASE IV does not. + fputc( ch, t ); + ch = d.MonthOf(); + fputc( ch, t ); + ch = d.DayOf( XB_FMT_MONTH ); + fputc( ch, t ); + + /* record count */ + for( i = 0; i < 4; i++ ) fputc( 0x00, t ); + + if((rc = _fseek(fp, 7, SEEK_CUR)) != 0) { + fclose( t ); + return XB_SEEK_ERROR; + } + for( i = 0; i < 4; i++ ) + fputc( fgetc( fp ), t ); + + for( i = 0; i < 17; i++ ) + fputc( 0x00, t ); + + if((rc = _fseek( fp, 17, SEEK_CUR )) != 0) { + fclose( t ); + return XB_SEEK_ERROR; + } + + for( i = 29; i < HeaderLen; i++ ) + fputc( fgetc( fp ), t ); + + fputc( 0x1a, t ); + fclose( t ); + +#ifdef XB_MEMO_FIELDS + if( MemoFieldsPresent()){ + MemoName = ndfn; + + NameLen = MemoName.len(); + NameLen--; + if( MemoName.getCharacter( NameLen ) == 'F' ) + MemoName.putAt(NameLen, 'T'); + else + MemoName.putAt(NameLen, 't'); + + if(( t = fopen( MemoName, "w+b" )) == NULL ) + return XB_OPEN_ERROR; + + memset( buf, 0x00, 4 ); + xbase->PutLong( buf, 1L ); + if(( fwrite( &buf, 4, 1, t )) != 1 ){ + fclose( t ); + return XB_WRITE_ERROR; + } + if( MemoHeader.Version == 0x03 ){ + for( i = 0; i < 12; i++ ) fputc( 0x00, t ); + fputc( 0x03, t ); + for( i = 0; i < 495; i++ ) fputc( 0x00, t ); + } + else + { + for( i = 0; i < 4; i++ ) fputc( 0x00, t ); // put 4 bytes 0x00 + memset( buf, 0x00, 9 ); + NameLen = ndfn.len(); + for( i = 0, ct = 0; i < NameLen; i++ ) + if( ndfn.getCharacter( i ) == PATH_SEPARATOR ){ + ct = i; + ct++; + } + + for( i = 0; i < 8 && ndfn[i+ct] != '.'; i++ ) + buf[i] = ndfn[i+ct]; + + fwrite( &buf, 8, 1, t ); + for( i = 0; i < 4; i++ ) fputc( 0x00, t ); + memset( buf, 0x00, 2 ); + xbase->PutShort( buf, MemoHeader.BlockSize ); + if(( fwrite( &buf, 2, 1, t )) != 1 ){ + fclose(t); + return XB_WRITE_ERROR; + } + for( i = 22; i < MemoHeader.BlockSize; i++ ) fputc( 0x00, t ); + } + } + fclose( t ); +#endif // XB_MEMO_FIELDS + return XB_NO_ERROR; +} +/************************************************************************/ +//! Add index to list +/*! + Adds the specified index to the list of indexes maintained by the + dbf. + + \param n index to add + \param IndexName name of index +*/ +#if defined(XB_INDEX_ANY) +xbShort xbDbf::AddIndexToIxList(xbIndex * n, const char *IndexName) +{ + xbIxList *i, *s, *t; + + if( !FreeIxList ){ + if((i = (xbIxList *) malloc(sizeof(xbIxList))) == NULL) + return XB_NO_MEMORY; + } + else + { + i = FreeIxList; + FreeIxList = i->NextIx; + } + memset(i, 0x00, sizeof(xbIxList)); + + i->IxName = IndexName; + i->index = n; + + s = NULL; + t = NdxList; + while( t && strcmp( t->IxName, IndexName ) < 0 ){ + s = t; + t = t->NextIx; + } + i->NextIx = t; + if( s == NULL ) + NdxList = i; + else + s->NextIx = i; + return 0; +} +#endif +/************************************************************************/ +//! Rebuild all index files +/*! +*/ +xbShort xbDbf::RebuildAllIndices(void (*statusFunc)(xbLong itemNum, xbLong numItems)) +{ +#if defined(XB_INDEX_ANY) + xbShort rc; + xbIxList *n; + + n = NdxList; + while( n ){ + if(( rc = n->index->ReIndex(statusFunc)) != XB_NO_ERROR ){ +// ExclusiveUnlock(); + return rc; + } + n = n->NextIx; + } +#endif + return XB_NO_ERROR; +} +/************************************************************************/ +//! Delete all records +/*! +*/ +xbShort xbDbf::DeleteAll( xbShort Option ) +{ + xbShort rc; + + if(( NoOfRecords()) == 0 ) + return XB_NO_ERROR; + if(( rc = GetFirstRecord()) != XB_NO_ERROR ) + return rc; + + if( Option == 0 ){ /* delete all option */ + while( 1 ){ + if( !RecordDeleted()) + if(( rc = DeleteRecord()) != XB_NO_ERROR ) + return rc; + if(( rc = GetNextRecord()) != XB_NO_ERROR ) + break; + } + } + else /* undelete all option */ + { + while( 1 ){ + if( RecordDeleted()) + if(( rc = UndeleteRecord()) != XB_NO_ERROR ) + return rc; + if(( rc = GetNextRecord()) != XB_NO_ERROR ) + break; + } + } + if( rc == XB_EOF ) + return XB_NO_ERROR; + else + return rc; +} +/************************************************************************/ +//! Delete all records and pack data file +/*! +*/ +xbShort xbDbf::Zap( xbShort WaitOption ) +{ + xbShort rc; + xbString TempDbfName, TempDbtName; + + CreateUniqueDbfName( TempDbfName, TempDbtName ); + if(( rc = CopyDbfStructure( TempDbfName, 1 )) != XB_NO_ERROR) { + return rc; + } + + if( fp ){ + fclose( fp ); + fp = 0; + } + + if(( rc = remove( GetFileName() )) != 0 ) + return XB_WRITE_ERROR; + + if(( rc = rename( TempDbfName, GetFileName() )) != 0 ) + return XB_WRITE_ERROR; + + if((fp = fopen( GetFileName(), "r+b" )) == NULL) + return XB_OPEN_ERROR; + +#ifdef XB_LOCKING_ON + setbuf( fp, NULL ); +#endif + ReadHeader( 1 ); + +#ifdef XB_MEMO_FIELDS + if( MemoFieldsPresent() ){ + fclose( mfp ); + + if(( rc = remove( MemofileName )) != 0 ) + return XB_WRITE_ERROR; + + if(( rc = rename( TempDbtName, MemofileName )) != 0 ) + return XB_WRITE_ERROR; + + if(( mfp = fopen( MemofileName, "r+b" )) == NULL) + return XB_OPEN_ERROR; + + } +#endif // XB_MEMO_FIELDS + + if(( rc = RebuildAllIndices()) != XB_NO_ERROR ) + return rc; + + return XB_NO_ERROR; +} +/************************************************************************/ +//! Remove an index from the list +/*! +*/ +#if defined(XB_INDEX_ANY) +xbShort xbDbf::RemoveIndexFromIxList(xbIndex * n) { + xbIxList *i, *s; + + i = NdxList; + s = NULL; + while( i ){ + if( i->index == n ){ + /* remove it from current chain */ + if( s ) + s->NextIx = i->NextIx; + else + NdxList = i->NextIx; + + /* add i to the current free chain */ + i->NextIx = FreeIxList; + FreeIxList = i; + FreeIxList->IxName = (const char *)NULL; + FreeIxList->index = NULL; + break; + } + else + { + s = i; + i = i->NextIx; + } + } + return XB_NO_ERROR; +} +#endif + +/************************************************************************/ +//! Gets the number of records in the data file +/*! +*/ +xbLong xbDbf::NoOfRecords() +{ + xbLong numRecs; + +/* lock the database */ +#ifdef XB_LOCKING_ON + xbShort rc; + + if( AutoLock ){ +// if(( rc = LockDatabase( XB_LOCK, 0L )) != XB_NO_ERROR ) +// return rc; + + if((rc = ReadHeader(1)) != XB_NO_ERROR){ +// if(AutoLock) +// LockDatabase( XB_UNLOCK, 0L ); + return rc; + } + } +#endif + +#ifndef XB_REAL_DELETE + numRecs = NoOfRecs; +#else + numRecs = RealDelete ? RealNumRecs : NoOfRecs; +#endif + +#ifdef XB_LOCKING_ON +// if(AutoLock) +// LockDatabase( XB_UNLOCK, 0L ); +#endif + + return numRecs; +} +/************************************************************************/ +//! Get the physical number of records in the data file +/*! +*/ +xbLong xbDbf::PhysicalNoOfRecords() +{ + xbShort rc; + +/* lock the database */ +#ifdef XB_LOCKING_ON +// if( AutoLock ) +// if(( rc = LockDatabase( XB_LOCK, 0L )) != XB_NO_ERROR ) +// return rc; +#endif + + rc = ReadHeader(1); + +#ifdef XB_LOCKING_ON +// if(AutoLock) +// if(( rc = LockDatabase( XB_UNLOCK, 0L )) != XB_NO_ERROR ) +// return rc; +#endif + + if( rc ) + return rc; + + return NoOfRecs; +} + +/************************************************************************/ +#if defined(XB_INDEX_ANY) +//! Get the number of currently open indexes for data file +/*! +*/ +xbShort xbDbf::IndexCount() +{ + xbShort count; + xbIxList *i; + + for(count = 0, i = NdxList; i; i = i->NextIx, count++) ; + + return count; +} +/************************************************************************/ +//! Get a specific index +/*! +*/ +xbIndex * xbDbf::GetIndex(xbShort indexNum) +{ + xbIxList *i; + + i = NdxList; + while(indexNum && i){ + indexNum--; + i = i->NextIx; + } + + if(i) + return i->index; + + return 0; +} + +#endif // XB_INDEX_ANY +/************************************************************************/ +void xbDbf::Flush() +{ + if(fp) + fflush(fp); + +#ifdef XB_MEMO_FIELDS + if(mfp) + fflush(mfp); +#endif + +#if defined(XB_INDEX_ANY) + xbIxList + *i; + + i = NdxList; + while(i) { + i->index->Flush(); + i = i->NextIx; + } +#endif +} +/************************************************************************/ +#ifdef XB_LOCKING_ON +xbShort xbDbf::SetLockMode( xbShort nlm ) +{ +/* + xbShort rc; + if( LockMode != XB_XBASE_LOCK_MODE && + nlm == XB_XBASE_LOCK_MODE && + !xblfh ){ + rc = OpenXbLockFile(); + if( rc ) + return rc; + } +*/ + LockMode = nlm; + return XB_NO_ERROR; +} +#endif +/************************************************************************/ +const char * xbDbf::GetExtWithDot( bool lower ) +{ + return lower ? ".dbf" : ".DBF"; +} diff --git a/xbase64/xbdbf.h b/xbase64/xbdbf.h new file mode 100755 index 0000000..ce28e9a --- /dev/null +++ b/xbase64/xbdbf.h @@ -0,0 +1,533 @@ +/* xbdbf.h + + Xbase64 project source code + + This file contains the Class definition for a xbDBF object. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifndef __XB_DBF_H__ +#define __XB_DBF_H__ + +#ifdef __GNU LesserG__ +#pragma interface +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbtypes.h> +#include <xbase64/xbdate.h> +#include <xbase64/xbfile.h> + +#include <iostream> +#include <stdio.h> + +/*! \file xbdbf.h +*/ + +#if defined(XB_INDEX_ANY) + class XBDLLEXPORT xbIndex; + class XBDLLEXPORT xbNdx; + class XBDLLEXPORT xbNtx; +#endif + +/*****************************/ +/* Field Types */ + +#define XB_CHAR_FLD 'C' +#define XB_LOGICAL_FLD 'L' +#define XB_NUMERIC_FLD 'N' +#define XB_DATE_FLD 'D' +#define XB_MEMO_FLD 'M' +#define XB_FLOAT_FLD 'F' + +/*****************************/ +/* File Status Codes */ + +#define XB_CLOSED 0 +#define XB_OPEN 1 +#define XB_UPDATED 2 + +/*****************************/ +/* Other defines */ + +#define XB_OVERLAY 1 +#define XB_DONTOVERLAY 0 + +#define XB_CHAREOF '\x1A' /* end of DBF */ +#define XB_CHARHDR '\x0D' /* header terminator */ + +//! Used to define the fields in a database (DBF file). +/*! + Generally one would define an xbSchema array to be passed + to xbDbf::CreateDatabase() to define the fields in the database. + + For example, one might create a declaration as follows: + + \code + xbSchema MyRecord[] = + { + { "FIRSTNAME", XB_CHAR_FLD, 15, 0 }, + { "LASTNAME", XB_CHAR_FLD, 20, 0 }, + { "BIRTHDATE", XB_DATE_FLD, 8, 0 }, + { "AMOUNT", XB_NUMERIC_FLD, 9, 2 }, + { "SWITCH", XB_LOGICAL_FLD, 1, 0 }, + { "FLOAT1", XB_FLOAT_FLD, 9, 2 }, + { "FLOAT2", XB_FLOAT_FLD, 9, 1 }, + { "FLOAT3", XB_FLOAT_FLD, 9, 2 }, + { "FLOAT4", XB_FLOAT_FLD, 9, 3 }, + { "MEMO1", XB_MEMO_FLD, 10, 0 }, + { "ZIPCODE", XB_NUMERIC_FLD, 5, 0 }, + { "",0,0,0 } + }; + \endcode + + Note that the last xbSchema in an array must be a "null" entry like the + one above: + + \code + { "",0,0,0 } + \endcode + + To indicate the end of the array. +*/ +struct XBDLLEXPORT xbSchema { + char FieldName[11]; + char Type; +// xbUShort FieldLen; /* does not work */ +// xbUShort NoOfDecs; /* does not work */ + unsigned char FieldLen; /* fields are stored as one byte on record*/ + unsigned char NoOfDecs; +}; + +//! Defines a field in an XBase file header (DBF file header) +/*! + This structure is only used internally by the xbDbf class. +*/ +struct XBDLLEXPORT xbSchemaRec { + char FieldName[11]; + char Type; /* field type */ + char *Address; /* pointer to field in record buffer 1 */ +// xbUShort FieldLen; /* does not work */ +// xbUShort NoOfDecs; /* does not work */ + unsigned char FieldLen; /* fields are stored as one byte on record */ + unsigned char NoOfDecs; + char *Address2; /* pointer to field in record buffer 2 */ + char *fp; /* pointer to null terminated buffer for field */ + /* see method GetString */ + xbShort LongFieldLen; /* to handle long field lengths */ +}; + +//! xbIxList struct +/*! + Internal use only. +*/ +struct XBDLLEXPORT xbIxList { + xbIxList * NextIx; + xbString IxName; +#if defined(XB_INDEX_ANY) + xbIndex * index; + xbShort Unique; + xbShort KeyUpdated; +#endif +}; + +//! xbMH struct +/*! + Internal use only. +*/ + +#ifdef XB_MEMO_FIELDS +struct XBDLLEXPORT xbMH{ /* memo header */ + xbLong NextBlock; /* pointer to next block to write */ + char FileName[8]; /* name of dbt file */ + char Version; /* not sure */ + xbShort BlockSize; /* memo file block size */ +}; +#endif + +//! xbDbf class +/*! + The xbDbf class encapsulates an xbase DBF database file. It includes + all dbf access, field access, and locking methods. +*/ +class XBDLLEXPORT xbDbf : protected xbFile{ + +public: + xbDbf( xbXBase * ); + virtual ~xbDbf(); + + xbXBase *xbase; /* linkage to main base class */ + +/* datafile methods */ +#if defined(XB_INDEX_ANY) + xbShort AddIndexToIxList(xbIndex *, const char *IndexName); + xbShort RemoveIndexFromIxList( xbIndex * ); +#endif + xbShort AppendRecord(); + xbShort BlankRecord(); + xbShort CloseDatabase( xbBool deleteIndexes = 0 ); + xbShort CopyDbfStructure( const char *, xbShort ); + xbShort CreateDatabase( const char * Name, xbSchema *, xbShort Overlay ); + //! Delete all records + /*! + */ + xbShort DeleteAllRecords() { return DeleteAll(0); } + xbShort DeleteRecord(); +#ifdef XBASE_DEBUG + xbShort DumpHeader( xbShort ); +#endif + xbShort DumpRecord( xbULong ); + //! Return number of fields + /*! + */ + xbLong FieldCount() { return NoOfFields; } + //! Return Dbf name + /*! + */ + const xbString& GetDbfName() { return GetFileName(); } + //! Return status + /*! + */ + xbShort GetDbfStatus() { return DbfStatus; } + xbShort GetFirstRecord(); + xbShort GetLastRecord(); + xbShort GetNextRecord(); + xbShort GetPrevRecord(); + //! Return current record number + /*! + */ + xbLong GetCurRecNo() { return CurRec; } + xbShort GetRecord( xbULong ); + //! Return a pointer to the record buffer + /*! + */ + char * GetRecordBuf() { return RecBuf; } + //! Return record length + /*! + */ + xbShort GetRecordLen() { return RecordLen; } + xbShort NameSuffixMissing( xbShort, const char * ); + xbLong GetRecCnt() { return NoOfRecords(); } + xbLong NoOfRecords(); + xbLong PhysicalNoOfRecords(); + xbShort OpenDatabase( const char * ); + xbShort PackDatabase(xbShort LockWaitOption, + void (*packStatusFunc)(xbLong itemNum, xbLong numItems) = 0, + void (*indexStatusFunc)(xbLong itemNum, xbLong numItems) = 0); + xbShort PutRecord(); // Put record to current position + xbShort PutRecord(xbULong); + xbShort RebuildAllIndices( + void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0); + xbShort RecordDeleted(); + //! Set number of records to zero???? + /*! + */ + void ResetNoOfRecs() { NoOfRecs = 0L; } + xbShort SetVersion( xbShort ); + //! Undelete all records + /*! + */ + xbShort UndeleteAllRecords() { return DeleteAll(1); } + xbShort UndeleteRecord(); + xbShort Zap( xbShort ); + +/* field methods */ + const char *GetField(xbShort FieldNo) const; // Using internal static buffer + const char *GetField(const char *Name) const; + xbShort GetField( xbShort FieldNo, char *Buf) const; + xbShort GetRawField( xbShort FieldNo, char *Buf) const; + xbShort GetField( xbShort FieldNo, char *Buf, xbShort RecBufSw) const; + xbShort GetField( const char *Name, char *Buf) const; + xbShort GetRawField(const char *Name, char *Buf) const; + xbShort GetField( const char *Name, char *Buf, xbShort RecBufSw) const; + xbShort GetField(xbShort FieldNo, xbString&, xbShort RecBufSw ) const; + xbShort GetFieldDecimal( xbShort ); + xbShort GetFieldLen( xbShort ); + char * GetFieldName( xbShort ); + xbShort GetFieldNo( const char * FieldName ) const; + char GetFieldType( xbShort FieldNo ) const; + xbShort GetLogicalField( xbShort FieldNo ); + xbShort GetLogicalField( const char * FieldName ); + char * GetStringField( xbShort FieldNo ); + char * GetStringField( const char * FieldName ); + xbShort PutField( xbShort, const char * ); + xbShort PutRawField( xbShort FieldNo, const char *buf ); + xbShort PutField( const char *Name, const char *buf); + xbShort PutRawField( const char *Name, const char *buf ); + xbShort ValidLogicalData( const char * ); + xbShort ValidNumericData( const char * ); + + xbLong GetLongField( const char *FieldName) const; + xbLong GetLongField( const xbShort FieldNo) const; + xbShort PutLongField( const xbShort, const xbLong ); + xbShort PutLongField( const char *, const xbLong); + + xbFloat GetFloatField( const char * FieldName ); + xbFloat GetFloatField( xbShort FieldNo ); + xbShort PutFloatField( const char *, const xbFloat); + xbShort PutFloatField( const xbShort, const xbFloat); + + xbDouble GetDoubleField( const char *); + xbDouble GetDoubleField( xbShort, xbShort RecBufSw = 0); + xbShort PutDoubleField( const char *, xbDouble); + xbShort PutDoubleField( const xbShort, xbDouble); + +#ifdef XB_LOCKING_ON + xbShort GetLockMode() { return LockMode; } + xbShort SetLockMode( xbShort ); +// xbShort OpenXbLockFile(); +// xbShort GetTableLockCnt() { return TableLockCnt; } +// xbShort LockIndex( xbShort LockType ); /* for XB_XBASE_LOCK_MODE */ + int GetDbfFileNo() { return fileno( fp ); } + int GetMemoFileNo() { return fileno( mfp ); } + +#ifdef XB_MEMO_FIELDS +// xbShort GetMemoLockCnt() { return MemoLockCnt; } +#endif + +/* + xbShort LockTable( xbShort LockType ); + xbShort LockXbaseTable( xbShort LockType ); + xbShort LockClipperTable( xbShort LockType ); + xbShort LockFoxproTable( xbShort LockType ); + xbShort LockDbaseTable( xbShort LockType ); + + xbShort LockRecord( xbShort LockType, xbULong RecNo, xbULong RecCnt ); + xbShort LockXbaseRecord( xbShort LockType, xbULong RecNo, xbULong RecCnt ); + xbShort LockClipperRecord( + xbShort LockType, xbULong RecNo, xbULong RecCnt ); + xbShort LockFoxproRecord( xbShort LockType, xbULong RecNo, xbULong RecCnt ); + xbShort LockDbaseRecord( xbShort LockType, xbULong RecNo, xbULong RecCnt ); + + xbShort LockDatabase( xbShort, xbShort, xbULong ); + xbShort ExclusiveLock( xbShort ); + xbShort ExclusiveUnlock(); + xbShort LockDatabase( xbShort cmd, xbULong recNo ) { return 0; } +*/ + +#ifndef HAVE_FCNTL + xbShort UnixToDosLockCommand( xbShort WaitOption, + xbShort LockType ) const; +#endif + +#else + xbShort LockDatabase( xbShort, xbShort, xbLong ) + { return XB_NO_ERROR; } + xbShort ExclusiveLock( xbShort ) { return XB_NO_ERROR; }; + xbShort ExclusiveUnlock() { return XB_NO_ERROR; }; +#endif + + //! Turn autolock on + /*! + */ + void AutoLockOn() { AutoLock = 1; } + //! Turn autolock off + /*! + */ + void AutoLockOff() { AutoLock = 0; } + //! Return whether or not autolocking is on or off + /*! + */ + xbShort GetAutoLock() { return AutoLock; } + +#ifdef XB_MEMO_FIELDS + xbShort GetMemoField( xbShort FieldNo, xbLong len, + char * Buf, xbShort LockOption ); + xbLong GetMemoFieldLen( xbShort FieldNo ); + xbShort GetFPTField( xbShort FieldNo, xbLong len, + char * Buf, xbShort LockOption ); + xbLong GetFPTFieldLen( xbShort FieldNo ); + xbShort UpdateMemoData( xbShort FieldNo, xbLong len, + const char * Buf, xbShort LockOption ); + xbShort MemoFieldExists( xbShort FieldNo ) const; + xbShort LockMemoFile( xbShort WaitOption, xbShort LockType ); + + xbShort MemoFieldsPresent() const; + xbLong CalcLastDataBlock(); + xbShort FindBlockSetInChain( xbLong BlocksNeeded, xbLong + LastDataBlock, xbLong & Location, xbLong &PreviousNode ); + xbShort GetBlockSetFromChain( xbLong BlocksNeeded, xbLong + Location, xbLong PreviousNode ); + xbString & GetDbtName() { return MemofileName; } + +#ifdef XBASE_DEBUG + xbShort DumpMemoFreeChain(); + void DumpMemoHeader() const; + void DumpMemoBlock() const; +#endif +#endif + + //! Turn on "real" deletes + /*! + This should be done before creating a database (with + xbDbf::CreateDatatabase()) and thereafter before opening + a database with xbDbfCreateDatabase(). + + You cannot "turn on" real deletes once a database has been created + and records added. + */ + void RealDeleteOn() { RealDelete = 1; if(fp) ReadHeader(1); } + /*! Turn off "real" deletes + */ + void RealDeleteOff() { RealDelete = 0; if(fp) ReadHeader(1); } + //! Return whether "real" deletes are on or off + /*! + Use this to determine if "real deletes" are being used with +the database. + */ + xbShort GetRealDelete() { return RealDelete; } + +#if defined(XB_INDEX_ANY) + xbShort IndexCount(); + xbIndex *GetIndex(xbShort indexNum); +#endif + + void Flush(); + virtual const char* GetExtWithDot( bool lower ); + + private: + + xbShort DeleteAll( xbShort ); + void InitVars(); + xbShort PackDatafiles(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0); + xbShort ReadHeader( xbShort ); + xbShort WriteHeader( xbShort ); + +#ifdef XB_MEMO_FIELDS + xbShort AddMemoData( xbShort FieldNo, xbLong Len, const char * Buf ); + xbShort CreateMemoFile(); + xbShort DeleteMemoField( xbShort FieldNo ); + xbShort GetDbtHeader( xbShort Option ); + xbShort GetMemoBlockSize() { return MemoHeader.BlockSize; } + xbShort OpenMemoFile(); + xbShort OpenFPTFile(); + xbShort PutMemoData( xbLong StartBlock, xbLong BlocksNeeded, + xbLong Len, const char * Buf ); + xbShort ReadMemoBlock( xbLong BlockNo, xbShort Option); + xbShort SetMemoBlockSize( xbShort ); + xbShort UpdateHeadNextNode() const; + xbShort WriteMemoBlock( xbLong BlockNo, xbShort Option ); + xbShort IsType3Dbt() const { return( Version==(char)0x83 ? 1:0 ); } + xbShort IsType4Dbt() const + {return (( Version==(char)0x8B || Version==(char)0x8E ) ? 1:0 );} + xbShort CreateUniqueDbfName( xbString &, xbString & ); +#endif + + +// xbString DatabaseName; + xbShort XFV; /* xBASE file version */ + xbShort NoOfFields; + char DbfStatus; /* 0 = closed + 1 = open + 2 = updates pending */ + FILE *fp; /* file pointer */ + xbSchemaRec *SchemaPtr; /* Pointer to field data */ + char *RecBuf; /* Pointer to record buffer */ + char *RecBuf2; /* Pointer to original rec buf */ + +#ifdef XB_MEMO_FIELDS + xbString MemofileName; /* memo file name */ + FILE *mfp; /* memo file pointer */ + void *mbb; /* memo block buffer */ + xbMH MemoHeader; /* memo header structure */ + xbShort mfield1; /* memo block field one FF */ + xbShort MStartPos; /* memo start pos of data */ + xbLong MFieldLen; /* memo length of data */ + xbLong NextFreeBlock; /* next free block in free chain */ + xbLong FreeBlockCnt; /* count of free blocks this set */ + xbLong MNextBlockNo; /* free block chain */ + xbLong MNoOfFreeBlocks; /* free block chain */ + xbLong CurMemoBlockNo; /* Current block no loaded */ +#endif + +/* Next seven variables are read directly off the database header */ +/* Don't change the order of the following seven items */ + char Version; + char UpdateYY; + char UpdateMM; + char UpdateDD; +// xbLong NoOfRecs; +// xbShort HeaderLen; +// xbShort RecordLen; + + xbULong NoOfRecs; + xbUShort HeaderLen; + xbUShort RecordLen; + +//#ifdef XB_REAL_DELETE + xbULong FirstFreeRec; + xbULong RealNumRecs; +//#endif + +// xbIxList * MdxList; + xbIxList * NdxList; + xbIxList * FreeIxList; + xbULong CurRec; /* Current record or zero */ + xbShort AutoLock; /* Auto update option 0 = off */ + +//#ifdef XB_REAL_DELETE + xbShort RealDelete; /* real delete option 0 = off */ +//#endif + +#ifdef XB_LOCKING_ON + FILE *xblfh; /* xbase lock file pointer for xbase locking */ + xbShort LockMode; /* lock mode for this table */ + xbString lfn; /* xbase lock file name for xbase locking */ + xbShort TableLockCnt; /* number of table locks */ + xbShort IndexLockCnt; /* no of index locks XB_XBASE_LOCK_MODE only */ + +#ifdef XB_MEMO_FIELDS + xbShort MemoLockCnt; /* number of memo file locks */ +#endif + + /* old locking stuff */ + xbShort CurLockType; /* current type of file lock */ + xbShort CurLockCount; /* number of current file locks */ + xbULong CurLockedRecNo; /* currently locked record no */ + xbShort CurRecLockType; /* current type of rec lock held (F_RDLOCK or F_WRLCK) */ + xbShort CurRecLockCount; /* number of current record locks */ + xbShort CurMemoLockType; /* current type of memo lock */ + xbShort CurMemoLockCount; /* number of current memo locks */ +#endif + +}; +#endif // __XB_DBF_H__ + + diff --git a/xbase64/xbexp.cpp b/xbase64/xbexp.cpp new file mode 100755 index 0000000..a3e1fa5 --- /dev/null +++ b/xbase64/xbexp.cpp @@ -0,0 +1,1323 @@ +/* xbexp.cpp + + Xbase64 project source code + + This file contains logic for handling Xbase expressions. + + Copyright (C) 1997,2003,2004 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbexp.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> +#ifdef XB_EXPRESSIONS +#include <ctype.h> +#include <string.h> + +//#include <xbase64/xbexcept.h> + + +/*! \file xbexp.cpp +*/ + +// set the default date format +//xbString xbExpn::DefaultDateFormat = "MM/DD/YY"; + +/************************************************************************/ +/* putting this part in EXP did not work */ + +/* No of parms + + value meaning + + 0 0 + 1 1 + 2 2 + 100 0 or more + 101 1 or more + 102 2 or more + + + Return Type + N Numeric + C Char or string + 1 Varies, if sibling 1 is C, set to C, otherwise N + + +*/ + + + + + + +static xbFuncDtl FuncList[] = +{ + /* Func # of Return + Name parms Type */ + { "ABS", 1, 'N' }, + { "ASC", 1, 'N' }, + { "AT", 2, 'N' }, + { "CDOW", 1, 'C' }, + { "CHR", 1, 'C' }, + { "CMONTH", 1, 'C' }, + { "CTOD", 1, 'C' }, + { "DATE", 0, 'C' }, + { "DAY", 1, 'N' }, + { "DESCEND", 1, '1' }, + { "DOW", 1, 'N' }, + { "DTOC", 1, 'C' }, + { "DTOS", 1, 'C' }, + { "EXP", 1, 'N' }, + { "IIF", 3, 'C' }, + { "INT", 1, 'N' }, + { "ISALPHA", 1, 'L' }, + { "ISLOWER", 1, 'L' }, + { "ISUPPER", 1, 'L' }, + { "LEFT", 2, 'C' }, + { "LEN", 1, 'N' }, + { "LOG", 1, 'N' }, + { "LOWER", 1, 'C' }, + { "LTRIM", 1, 'C' }, + { "MAX", 2, 'N' }, + { "MIN", 2, 'N' }, + { "MONTH", 1, 'N' }, + { "RECNO", 0, 'N' }, + { "REPLICATE", 2, 'C' }, + { "RIGHT", 2, 'C' }, + { "RTRIM", 1, 'C' }, + { "SPACE", 1, 'C' }, + { "SQRT", 1, 'N' }, + { "STR", 101, 'C' }, + { "STRZERO", 1, 'C' }, + { "SUBSTR", 3, 'C' }, + { "TRIM", 1, 'C' }, + { "UPPER", 1, 'C' }, + { "VAL", 1, 'N' }, + { "YEAR", 1, 'N' }, + { 0, 0, 0 }, +}; + +/*************************************************************************/ +//! xbExpn Constructor +/*! +*/ +xbExpn::xbExpn( xbXBase * x ) +{ + xbase = x; + TokenType = 0; + Tree = 0; + TokenLen = 0; + OpLen1 = 0; + OpLen2 = 0; + OpDataLen1 = 0; + OpDataLen2 = 0; + Op1 = 0; + Op2 = 0; + First = 0; + Last = 0; + StackDepth = 0; + XbaseFuncList = FuncList; + memset( WorkBuf, 0x00, WorkBufMaxLen+1 ); +} +/*************************************************************************/ +//! xbExpn Destructor +/*! +*/ +xbExpn::~xbExpn() +{ + InitStack(); + + delete Tree; + + if(Op1) + free(Op1); + + if(Op2) + free(Op2); + +} + +/*************************************************************************/ +//! Get information on a function. +/*! + Returns the information specifed (Option) for the specified function. + + \param Function name of function to get information about + \param Option One of the following: + \htmlonly + <p> + <table border=2><tr><th>Option</th><th>Description</th></tr> + <tr><td>1</td><td>Return minimum number of parms</td></tr> + <tr><td>2</td><td>Return function result type</td></tr> + <tr><td>?</td><td>Return 0 if valid function</td></tr> + </table> + \endhtmlonly + \latexonly + \\ + \\ + \begin{tabular}{|l|l|} \hline + \textbf{Option} & \textbf{Description} \\ \hline \hline + 1 & Return minimum number of parms \\ \hline + 2 & Return function result type \\ \hline + ? & Return 0 if valid function \\ \hline + \end{tabular} + \endlatexonly + + \returns requested information or -1 on failure. +*/ +xbShort xbExpn::GetFuncInfo( const char * Function, xbShort Option ) +{ +/* Option = + 1 - return minimum number of needed parms + 2 - return function result type + ? - return 0 if valid function +*/ + xbFuncDtl * f; + xbShort i, len; + const char *s; + + if(( Option<1 )||( Option>2 )) + return XB_INVALID_OPTION; + + s = Function; + len = 0; + while( *s && *s != '(' ) { s++; len++; } + + f = XbaseFuncList; + i = 0; + while( f[i].FuncName ){ + if( strncmp( f[i].FuncName, Function, len ) == 0 ) + return( (Option==1) ? f[i].ParmCnt : f[i].ReturnType ); + i++; + } + return -1; +} + +/*************************************************************************/ +//! IsWhiteSpace +/*! +*/ +xbShort xbExpn::IsWhiteSpace( char c ) +{ + return(( c == 0x20 )? 1 : 0 ); +} + +/*************************************************************************/ +//! GetNextToken +/*! +*/ +xbShort xbExpn::GetNextToken( const char * s, xbShort MaxLen ) +{ + /* TreeResultType Settings + Token Action/ + Was Type Result + Unv N N + Unv C C + Unv Function Table Lookup + Unv Field Field Type + Not L Any Logical L + */ + + xbShort Wctr, Wtype, Wsw, EmptyCtr, MaxCtr, MaxCtrSave; + const char *sp, *np, *pp; /* save, next and previous pointer */ + + LogicalType = 0; + TokenType = 0; + TokenLen = 0; + EmptyCtr = 0; + MaxCtr = 0; + + if( !s || ! *s ) + return XB_NO_DATA; + + /* go past any initial white space */ + while( s && *s && IsWhiteSpace( *s )){ + s++; + MaxCtr++; + if (MaxCtr >= MaxLen) + return XB_NO_ERROR; + } + +/* 1 - check for parens */ +/* '(', if found go to corresponding ')', if no ')', return -1 */ + if( *s == '(' || *s == '{' ){ + if( *s == '{' ) Wtype = 0; else Wtype = 1; + Wctr = 1; + s++; + + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_PARSE_ERROR; + + while( s && *s ){ + if(( *s == ')' && Wtype == 1 ) || (*s == '}' && Wtype == 0 )){ + Wctr--; + if( Wctr == 0 ){ + if( EmptyCtr != 0 ) { + TokenType = 'E'; + PreviousType = 'E'; + } else + return XB_PARSE_ERROR; + + TokenLen += 2; + return XB_NO_ERROR; + } + } + else if(( *s == '(' && Wtype == 1 ) || (*s == '{' && Wtype == 0 )){ + Wctr++; + EmptyCtr++; + } else if( *s != ' ' ) + EmptyCtr++; + + s++; + TokenLen++; + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_PARSE_ERROR; + } + return XB_PARSE_ERROR; + } + + +/* 2 - Check for Constants */ +/* check for "'" or """, if no corresponding quote return -1 */ + if( *s == '"' || *s == '\'' ){ + if( *s == '"' ) Wtype = 0; else Wtype = 1; + TokenType = 'C'; /* set to constant */ + PreviousType = 'C'; + s++; + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_NO_ERROR; + while( s && *s ){ + if(( *s == '"' && Wtype == 0 ) || (*s == '\'' && Wtype == 1 )) + return XB_NO_ERROR; + s++; + TokenLen++; + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_NO_ERROR; + } + return XB_PARSE_ERROR; + } + + +/* 3 - check for .T. .F. .TRUE. or .FALSE. */ + if( s && *s && *s == '.' ){ + if(( strncmp( s, ".T.", 3 ) == 0 ) || ( strncmp( s, ".F.", 3 ) == 0 )){ + TokenLen = 3; + TokenType = 'C'; /* constant */ + PreviousType = 'C'; + LogicalType = 1; + return XB_NO_ERROR; + } else if( strncmp( s, ".TRUE.", 6 ) == 0 ){ + TokenLen = 6; + TokenType = 'C'; /* constant */ + PreviousType = 'C'; + LogicalType = 1; + return XB_NO_ERROR; + } else if( strncmp( s, ".FALSE.", 7 ) == 0 ){ + TokenLen = 7; + TokenType = 'C'; /* constant */ + PreviousType = 'C'; + LogicalType = 1; + return XB_NO_ERROR; + } + } + +/* 4 - check for positive, negative or decimal number constants */ + if(( *s == '-' && ( PreviousType == 'O' || PreviousType == 0 )) || + ( *s == '+' && ( PreviousType == 'O' || PreviousType == 0 )) || + *s == '.' || isdigit( *s )){ + sp = s; + MaxCtrSave = MaxCtr; + Wsw = Wctr = 0; + if( *s == '.' ){ + Wctr++; + s++; + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_PARSE_ERROR; + + if( s && *s && isdigit( *s )) + TokenLen++; + else + Wsw++; + } else if( *s == '-' ){ + s++; + TokenLen++; + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_PARSE_ERROR; + + /* go past any white space between sign and number */ + while( s && *s && IsWhiteSpace( *s )){ + s++; + TokenLen++; + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_PARSE_ERROR; + } + } + + if( isdigit( *s ) || (*s == '.' && !Wsw )){ + while(s && *s && ((*s == '.' && Wctr < 2 ) || isdigit(*s)) && !Wsw ){ + if( *s == '.' ) { + Wctr++; + if( Wctr > 1 ) break; + s++; + + MaxCtr++; + if( MaxCtr >= MaxLen ){ + TokenType = 'N'; + PreviousType = 'N'; + return XB_NO_ERROR; + } + + if( s && *s && isdigit( *s )) + TokenLen++; + else + Wsw++; + } else { + s++; + TokenLen++; + MaxCtr++; + if( MaxCtr >= MaxLen ) { + TokenType = 'N'; + PreviousType = 'N'; + return XB_NO_ERROR; + } + } + } + TokenType = 'N'; /* constant */ + PreviousType = 'N'; + return XB_NO_ERROR; + } else { + s = sp; + MaxCtr = MaxCtrSave; + } + } + +/* 5 - Check for operators */ + if( *s == '+' || *s == '-' || *s == '/' || *s == '^'){ + TokenLen = 1; + TokenType = 'O'; + PreviousType = 'O'; + return XB_NO_ERROR; + } + if(*s == '=' || *s == '$' || *s == '#' ){ + LogicalType = 1; + TokenLen = 1; + TokenType = 'O'; + PreviousType = 'O'; + return XB_NO_ERROR; + } + if( strncmp( s, "!=", 2 ) == 0 ){ + LogicalType = 1; + TokenLen = 2; + TokenType = 'O'; + PreviousType = 'O'; + return XB_NO_ERROR; + } + if( *s == '*' ){ + s++; + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_PARSE_ERROR; + + TokenType = 'O'; + PreviousType = 'O'; + if( *s == '*' ){ + TokenLen = 2; + return XB_NO_ERROR; + } else { + TokenLen = 1; + return XB_NO_ERROR; + } + } + if( *s == '<' || *s == '>' ) { + s++; + + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_PARSE_ERROR; + + LogicalType = 1; // added 3/25/00 dtb + TokenType = 'O'; + PreviousType = 'O'; + if( *s == '<' || *s == '>' || *s == '=' ){ + TokenLen = 2; + return XB_NO_ERROR; + } else { + TokenLen = 1; + return XB_NO_ERROR; + } + } + +/* check for .NOT. .OR. .AND. */ + + if( s && *s && *s == '.' ){ + if( strncmp( s, ".NOT.", 5 ) == 0 ){ + TokenLen = 5; + TokenType = 'O'; /* constant */ + PreviousType = 'O'; + LogicalType = 1; + return XB_NO_ERROR; + } else if( strncmp( s, ".AND.", 5 ) == 0 ){ + TokenLen = 5; + TokenType = 'O'; /* constant */ + PreviousType = 'O'; + LogicalType = 1; + return XB_NO_ERROR; + } else if( strncmp( s, ".OR.", 4 ) == 0 ){ + TokenLen = 4; + TokenType = 'O'; /* constant */ + PreviousType = 'O'; + LogicalType = 1; + return XB_NO_ERROR; + } + } + + /* If get this far, must be function or database field */ + while( s && *s ){ + s++; + TokenLen++; + MaxCtr++; + if( MaxCtr >= MaxLen ) { + TokenType = 'D'; + PreviousType = 'D'; + return XB_NO_ERROR; + } + + if( s && *s && *s == '(' ) { + /* look for corresponding ) */ + Wctr = 1; + s++; + TokenLen++; + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_PARSE_ERROR; + + while( s && *s ) { + if( *s == ')' ) { + Wctr--; + if( !Wctr ) { + TokenType = 'F'; /* function */ + PreviousType = 'F'; + TokenLen++; + return XB_NO_ERROR; + } + } + if( *s == '(' ) Wctr++; + s++; + TokenLen++; + MaxCtr++; + if( MaxCtr >= MaxLen ) + return XB_PARSE_ERROR; + } + return XB_PARSE_ERROR; + } else { + np = s + 1; + pp = s - 1; + if( !s || !*s || (IsSeparator( *s ) && + !(*s == '-' && *np == '>' ) && !(*s == '>' && *pp == '-' ))) { + if( TokenLen > 0 ){ + TokenType = 'D'; /* database field */ + PreviousType = 'D'; + return XB_NO_ERROR; + } + } + } + } + return XB_NO_ERROR; +} +/*************************************************************************/ +//! IsSeparator +/*! +*/ +char xbExpn::IsSeparator( char c ) +{ + if( c == '-' || c == '+' || c == '*' || c == '/' || c == '$' || + c == ' ' || c == '#' || c == '<' || c == '>' || c == '^' || + c == '=' || c == '.' || c == '!' /* || c == ')' */ ) + return c; + else + return 0; +} + +/*************************************************************************/ +//! GetExpNode +/*! +*/ +/* +xbExpNode * xbExpn::GetExpNode(xbShort Len) { + xbExpNode * Temp; + + Temp = new xbExpNode; + if( Temp && Len > 0 ) + Temp->ResultLen = Len; + return Temp; +} +*/ +/*************************************************************************/ +//! LoadExpNode +/*! +*/ +xbExpNode * xbExpn::LoadExpNode( + const char *ENodeText, /* pointer to text data */ + const char EType, /* Operand type */ + const xbShort ELen, /* length of node text data */ + const xbShort BufLen ) /* length needed in the buffer*/ +{ +// xbExpNode * CurNode; +// if(( CurNode = GetExpNode(BufLen)) == NULL ) return NULL; + + xbExpNode * CurNode = new xbExpNode; + if( !CurNode ) + return NULL; + CurNode->ResultLen = BufLen; + + CurNode->NodeText = strdup( ENodeText ); + CurNode->Type = EType; + CurNode->Len = ELen; + CurNode->InTree = 1; + CurNode->ResultLen = BufLen; + return CurNode; +} + +/*************************************************************************/ +//! BuildExpressionTree +/*! +*/ +xbShort xbExpn::BuildExpressionTree( const char * Expression, + xbShort MaxTokenLen, xbDbf * d ) +{ + /* previous node is the node to insert under */ + xbExpNode * CurNode = 0; + xbExpNode * PreviousNode; + xbShort rc, FieldNo=0, BufLen; + xbShort TokenLenCtr; + char c; + const char *p; + char TempField[11]; + char TableName[31]; + xbDbf * TempDbf=0; + int LocTokenLen; + + if( Tree ) { + delete Tree; + Tree = NULL; + } + + p = Expression; + PreviousNode = NULL; + PreviousType = TokenLenCtr = 0; + + while( IsWhiteSpace( *p )) { + p++; + TokenLenCtr++; + if(TokenLenCtr >= MaxTokenLen) + return XB_NO_ERROR; + } + + rc = GetNextToken( p, MaxTokenLen-TokenLenCtr ); + LocTokenLen = TokenLen; + if( rc != XB_NO_DATA && rc != XB_NO_ERROR ) + return rc; + + while( rc == 0 ){ + if( TokenType == 'D' && d ){ + if( TokenLen > 30 ) + strncpy( TableName, p, 30 ); + else + strncpy( TableName, p, TokenLen ); + + memset( TempField, 0x00, 11 ); + + if( strstr( p, "->" ) != NULL ) { + if(( TempDbf = d->xbase->GetDbfPtr( TableName )) == NULL ) + return XB_INVALID_FIELD; + xbShort tlen = 0; + while( TableName[tlen] != '-' && TableName[tlen+1] != '>' ) + tlen++; + tlen = TokenLen - tlen - 2; // length of field name + const char * fp = strstr( p, "->" ); + fp += 2; // ptr to beginning of field name + strncpy( TempField, fp, tlen ); + } else { + TempDbf = d; + if( TokenLen > 10 ) + return XB_INVALID_FIELD; + strncpy( TempField, p, TokenLen ); + } + if(( FieldNo = TempDbf->GetFieldNo( TempField )) == -1 ) + return XB_INVALID_FIELD; + BufLen = TempDbf->GetFieldLen( FieldNo ) + 1; + } + else if( TokenType == 'C' || TokenType == 'N' ) + BufLen = TokenLen + 1; + else + BufLen = 0; + + if( TokenType == 'C' ) p++; /* go past first ' */ + + if( TokenType != 'O' ){ + if( !Tree ) { /* create root node with this token */ + CurNode = LoadExpNode( p, TokenType, TokenLen, BufLen ); + Tree = CurNode; + } else { /* put as child 2 of previous node */ + CurNode = LoadExpNode( p, TokenType, TokenLen, BufLen ); + PreviousNode->Sibling2 = CurNode; + CurNode->Node = PreviousNode; + } + + if( TokenType == 'E' ){ + if((rc=ReduceComplexExpression(p,TokenLen,CurNode,d))!=0) + return rc; + if(PreviousNode) + CurNode = PreviousNode->Sibling2; + else + CurNode = Tree; + } else if( TokenType == 'F' ){ + if(( rc = ReduceFunction( p, CurNode, d)) != 0 ) + return rc; + + xbShort parmCnt = GetFuncInfo( p, 1 ); + if( (parmCnt == 1 || parmCnt == 101 ) && !CurNode->Sibling1 || + (parmCnt == 2 || parmCnt == 201 ) && !CurNode->Sibling2 || + (parmCnt == 3 ) && !CurNode->Sibling3 ) + return XB_INSUFFICIENT_PARMS; + else if( parmCnt == 0 && CurNode->Sibling1 ) + return XB_TOO_MANY_PARMS; + else if( parmCnt == 1 && CurNode->Sibling2 ) + return XB_TOO_MANY_PARMS; + else if( parmCnt == 2 && CurNode->Sibling3 ) + return XB_TOO_MANY_PARMS; + + CurNode->ExpressionType = GetFuncInfo( p, 2 ); + if( CurNode->ExpressionType == '1' ){ + if( CurNode->Sibling1 ) + if( CurNode->Sibling1->ExpressionType == 'C' ) + CurNode->ExpressionType = 'C'; + else + CurNode->ExpressionType = 'N'; + else + return XB_INSUFFICIENT_PARMS; + } + + CurNode->dbf = d; + } + else if( TokenType == 'D' && d ) { + CurNode->DataLen = BufLen - 1; + CurNode->FieldNo = FieldNo; + CurNode->dbf = TempDbf; + c = TempDbf->GetFieldType( FieldNo ); + if( c == 'C' || c == 'M' ) CurNode->ExpressionType = 'C'; + else if( c == 'L' ) CurNode->ExpressionType = 'L'; + else if( c == 'N' || c == 'F' ) CurNode->ExpressionType = 'N'; + else if( c == 'D' ) CurNode->ExpressionType = 'D'; + } else if( TokenType == 'C' || TokenType == 'N' ) { + CurNode->DataLen = CurNode->Len; + CurNode->StringResult = CurNode->NodeText; + CurNode->StringResult.resize( CurNode->DataLen+1 ); + if( TokenType == 'N' ) { + CurNode->DoubResult = strtod( CurNode->StringResult, 0 ); + CurNode->ExpressionType = 'N'; + } else + CurNode->ExpressionType = 'C'; + } + } + else /* it is an operator */ + { + if(!Tree){ + if(*p == '-'){ + CurNode = LoadExpNode( p, TokenType, TokenLen, 0 ); + CurNode->ExpressionType = 'C'; + } else + return XB_EXP_SYNTAX_ERROR; + } else { + if( Tree->Type != 'O' ){ + CurNode = LoadExpNode( p, TokenType, TokenLen, 0 ); + Tree->Node = CurNode; /* link the new parent to old tree */ + CurNode->Sibling1 = Tree; /* connect the sibling */ + Tree = CurNode; /* root in tree */ + } else { + PreviousNode = CurNode->Node; + CurNode = LoadExpNode( p, TokenType, TokenLen, 0 ); + while( PreviousNode && + (( OperatorWeight( PreviousNode->NodeText, TokenLen ) == 0 ) || + ( OperatorWeight( CurNode->NodeText, TokenLen ) <= + OperatorWeight( PreviousNode->NodeText, TokenLen )))) + PreviousNode = PreviousNode->Node; + + if( PreviousNode ) { + CurNode->Node = PreviousNode; + CurNode->Sibling1 = PreviousNode->Sibling2; + PreviousNode->Sibling2 = CurNode; + CurNode->Sibling1->Node = CurNode; + } else { /* insert at root */ + CurNode->Sibling1 = Tree; + Tree = CurNode; + CurNode->Sibling1->Node = CurNode; + } + } + if( LogicalType ) + CurNode->ExpressionType = 'L'; + } + } + PreviousNode = CurNode; +// p += CurNode->Len; // 2/20/04 - not sure when this was updated - gk + p += LocTokenLen; + +// if( TokenType == 'C' ) { gk - 2/20/04 func("fff") + 4 didn't work + if( TokenType == 'C' && CurNode->Type != 'F' ){ + p++; /* go past last ' */ + TokenLenCtr+=2; /* add the quotes */ + } + +// TokenLenCtr += CurNode->Len; // 2/20/04 - not sure when this was updated - gk + TokenLenCtr += LocTokenLen; + if( TokenLenCtr >= MaxTokenLen ) + return XB_NO_ERROR; + if( p && *p && TokenType == 'E' ) { + p++; + TokenLenCtr++; + } + + while( IsWhiteSpace( *p )) { + p++; + TokenLenCtr++; + if( TokenLenCtr >= MaxTokenLen ) + return XB_NO_ERROR; + } + rc = GetNextToken( p, MaxTokenLen-TokenLenCtr ); + LocTokenLen = TokenLen; + if( rc != XB_NO_DATA && rc != XB_NO_ERROR ) + return rc; + } + return XB_NO_ERROR; +} +/*************************************************************************/ +//! GetExpressionResultType +/*! +*/ +char xbExpn::GetExpressionResultType( xbExpNode * e ) { + xbExpNode * Temp = 0; + if( e ) + Temp = e; + else if( !Temp ) + Temp = Tree; + else + return 0; + + if( e->Type == 'O' && + ( *e->NodeText == '<' || *e->NodeText == '>' || *e->NodeText == '=' || + *e->NodeText == '#' || *e->NodeText == '$' || + strncmp( e->NodeText, "!=", 2 ) == 0 )) + return 'L'; + + /* go down to second lowest level */ + while( Temp && Temp->Sibling1 && Temp->Sibling1->Sibling1 ) + Temp = Temp->Sibling1; + + /* if subtracting dates, return numeric type */ + if( Temp->Type == 'O' && *Temp->NodeText == '-' && + Temp->Sibling1 && Temp->Sibling2 && + Temp->Sibling1->ExpressionType == 'D' && + Temp->Sibling2->ExpressionType == 'D' ) + return 'N'; + + /* else return the type of the lowest left node */ + while( Temp && !Temp->ExpressionType && Temp->Sibling1 ) + Temp = Temp->Sibling1; + return Temp->ExpressionType; +} +/*************************************************************************/ +//! GetExpressionHandle +/*! +*/ +xbExpNode * xbExpn::GetExpressionHandle() { + xbExpNode * e; + e = Tree; + Tree = NULL; + return e; +} +/*************************************************************************/ +//! OperatorWeight +/*! This function determines the priority of an operator +*/ +xbShort xbExpn::OperatorWeight( const char * Oper, xbShort len ) +{ + /* operator precendence + + not all are implemented yet, but the structure is here + + 10 .AND. .OR. .NOT. (not really an operator) + 9 > or < (includes <= or >=) + 6 unary plus or minus (+,-) + 5 prefix increment and/or decrement (++,--) + 4 exponentiation ** or ^ + 3 multiplication,division or modulus (*,/,%) + 2 Addition, subtraction (+,-) + 1 Postfix increment and/or decrement (++,--) + */ + + if( len < 1 || len > 5 ) return 0; + + + if( Oper[0] == '>' || Oper[0] == '<' ) + return 13; + + if( strncmp( Oper, ".AND.", 5 ) == 0 || + strncmp( Oper, ".OR.", 4 ) == 0 || + strncmp( Oper, ".NOT.", 5 )) + return 10; + + if( strncmp( Oper, "**", 2 ) == 0 || Oper[0] == '^' ) + return 4; + + if( Oper[0] == '*' || Oper[0] == '/' || Oper[0] == '%' ) + return 3; + + if( Oper[0] == '+' || Oper[0] == '-' ) + return 1; + + return 0; +} +/*************************************************************************/ +//! ReduceComplexExpression +/*! +*/ +xbShort xbExpn::ReduceComplexExpression(const char *NextToken, xbShort Len, + xbExpNode *cn, xbDbf *d) { + const char *p; + xbShort rc; + xbExpNode * SaveTree; + + SaveTree = Tree; + Tree = NULL; + + p = NextToken; + p++; + + if(( rc = BuildExpressionTree( p, Len-2, d )) != XB_NO_ERROR ) + return rc; + + if(cn->Node) { /* then this is the base tree */ + cn->Node->Sibling2 = Tree; + Tree->Node = cn->Node; + delete cn; + Tree = SaveTree; + } else + delete cn; + + return XB_NO_ERROR; +} +/*************************************************************************/ +//! GetFunctionTokenLen +/*! +*/ +xbShort xbExpn::GetFunctionTokenLen( const char * s ) +{ + xbShort cnt, LeftParenCtr; + const char *p; + + cnt = LeftParenCtr = 0; + p = s; + + while( p && ( *p != ',' || ( *p == ',' && LeftParenCtr > 0 )) && + !( LeftParenCtr == 0 && *p == ')')) { + if( *p == '(' ) + LeftParenCtr++; + else if( *p == ')' ) + LeftParenCtr--; + p++; + cnt++; + } + return cnt; +} +/*************************************************************************/ +//! ReduceFunction +/*! +*/ +xbShort xbExpn::ReduceFunction(const char *NextToken, xbExpNode *cn, xbDbf *d) +{ + const char *p; + xbShort rc; + xbShort FuncTokenLen; + xbExpNode * SaveTree; + + p = strchr( NextToken, '(' ); + if (!p) + return XB_PARSE_ERROR; + + p++; + while( IsWhiteSpace( *p )) p++; + if (*p == ')') + return XB_NO_ERROR; + + /* do function paramater 1 */ + FuncTokenLen = GetFunctionTokenLen( p ); + SaveTree = Tree; + Tree = NULL; + if(( rc = BuildExpressionTree( p, FuncTokenLen, d )) != XB_NO_ERROR ) + return rc; + cn->Sibling1 = Tree; + Tree->Node = cn; + Tree = SaveTree; + + /* do function paramater 2 */ + + p += FuncTokenLen; + while( IsWhiteSpace( *p )) p++; + if(*p == ')') + return XB_NO_ERROR; + if( *p != ',' ) + return XB_PARSE_ERROR; + + p++; + while( IsWhiteSpace( *p )) p++; + FuncTokenLen = GetFunctionTokenLen( p ); + SaveTree = Tree; + Tree = NULL; + if(( rc = BuildExpressionTree( p, FuncTokenLen, d )) != XB_NO_ERROR ) + return rc; + + cn->Sibling2 = Tree; + Tree->Node = cn; + Tree = SaveTree; + + /* do function paramater 3 */ + p += FuncTokenLen; + while( IsWhiteSpace( *p )) p++; + if (*p == ')') + return XB_NO_ERROR; + if( *p != ',' ) + return XB_PARSE_ERROR; + + p++; + while( IsWhiteSpace( *p )) p++; + FuncTokenLen = GetFunctionTokenLen( p ); + SaveTree = Tree; + Tree = NULL; + if(( rc = BuildExpressionTree( p, FuncTokenLen, d )) != XB_NO_ERROR ) + return rc; + + cn->Sibling3 = Tree; + Tree->Node = cn; + Tree = SaveTree; + + return XB_NO_ERROR; +} +/*************************************************************************/ +//! ParseExpression +/*! +*/ +xbShort xbExpn::ParseExpression(const char *exp, xbDbf *d) { + return BuildExpressionTree(exp, strlen(exp), d); +} +/*************************************************************************/ +//! ProcessExpression +/*! +*/ +xbShort xbExpn::ProcessExpression(const char *e, xbDbf *d) { + xbShort rc; + if(( rc = BuildExpressionTree( e, strlen( e ), d )) != XB_NO_ERROR ) + return rc; + if(( rc = ProcessExpression( Tree )) != XB_NO_ERROR ) + return rc; + return XB_NO_ERROR; +} +/*************************************************************************/ +#ifdef XBASE_DEBUG +//! DumpExpressionTree +/*! +*/ +void xbExpn::DumpExpressionTree( xbExpNode * E, xbShort printOption ) +{ + if( !E ) E = Tree; + if( !E ) return; + DumpExpNode( E, printOption ); + + if( E->Sibling1 ) DumpExpressionTree( E->Sibling1, printOption ); + if( E->Sibling2 ) DumpExpressionTree( E->Sibling2, printOption ); + if( E->Sibling3 ) DumpExpressionTree( E->Sibling3, printOption ); + return; +} +/*************************************************************************/ +//! DumpExpNode +/*! +*/ +void xbExpn::DumpExpNode(xbExpNode *e, xbShort printOption) +{ + xbString ntext; + + ntext = e->NodeText; + ntext.resize( e->Len + 1 ); + + if( printOption ){ + FILE * dmp; + if(( dmp = fopen( "xbase64.log", "a" )) == NULL ) + return; + + fprintf( dmp, "******* Exp Node *******\n" ); + fprintf( dmp, "Exp Node Address = %x\n", e ); + fprintf( dmp, "Node Text = %s\n", ntext.getData()); + fprintf( dmp, "Type = %c\n", e->Type ); + fprintf( dmp, "Len = %d\n", e->Len ); + fprintf( dmp, "InTree = %d\n", e->InTree ); + fprintf( dmp, "Field No = %d\n", e->FieldNo ); + fprintf( dmp, "ExpressionType = %c\n", e->ExpressionType ); + fprintf( dmp, "StringResult = %s\n", e->StringResult.getData()); + fprintf( dmp, "DoubResult = %d\n", e->DoubResult ); + fprintf( dmp, "IntResult = %d\n", e->IntResult ); + fprintf( dmp, "ResultLen = %d\n", e->ResultLen ); + fprintf( dmp, "DataLen = %x\n", e->DataLen ); + + if( e->Node ) + fprintf( dmp, "Parent = %x\n", e->Node ); + if( e->Sibling1 ) + fprintf( dmp, "Sibling 1 = %x\n", e->Sibling1 ); + if( e->Sibling2 ) + fprintf( dmp, "Sibling 2 = %x\n", e->Sibling2 ); + if( e->Sibling3 ) + fprintf( dmp, "Sibling 3 = %x\n", e->Sibling3 ); + fprintf( dmp, "\n" ); + fclose( dmp ); + } + else + { + std::cout << "****** Exp Node ******"; + std::cout << "Exp Node Address = " << e << std::endl; + std::cout << "Node Text = " << ntext << std::endl; + std::cout << "Type = " << e->Type << std::endl; + std::cout << "Len = " << e->Len << std::endl; + std::cout << "InTree = " << e->InTree << std::endl; + std::cout << "Field No = " << e->FieldNo << std::endl; + std::cout << "ExpressionType = " << e->ExpressionType << std::endl; + std::cout << "StringResult = " << e->StringResult << std::endl; + std::cout << "DoubResult = " << e->DoubResult << std::endl; + std::cout << "IntResult = " << e->IntResult << std::endl; + std::cout << "ResultLen = " << e->ResultLen << std::endl; + std::cout << "DataLen = " << e->DataLen << std::endl; + if( e->Node ) + std::cout << "Parent = " << e->Node << std::endl; + if( e->Sibling1 ) + std::cout << "Sibling 1 = " << e->Sibling1 << std::endl; + if( e->Sibling2 ) + std::cout << "Sibling 2 = " << e->Sibling2 << std::endl; + if( e->Sibling3 ) + std::cout << "Sibling3 = " << e->Sibling3 << std::endl; + } + return; +} +#endif + +/*************************************************************************/ +//! xbExpNode() +/*! +*/ +xbExpNode::xbExpNode() : + NodeText(0), + Type(0), + Len(0), + InTree(0), + Node(0), + Sibling1(0), + Sibling2(0), + Sibling3(0), + DataLen(0), + ResultLen(0), + DoubResult(0), + IntResult(0), + dbf(0), + FieldNo(-1), + ExpressionType(0) +{ +} +/*************************************************************************/ +//! ~xbExpNode() +/*! +*/ +xbExpNode::~xbExpNode() +{ + if(NodeText) + free(NodeText); + + if(Sibling1) + delete Sibling1; + + if(Sibling2) + delete Sibling2; + + if(Sibling3) + delete Sibling3; +} +/*************************************************************************/ +//! Constructor. +/*! +*/ +xbStackElement::xbStackElement() +{ + Next = 0; + Previous = 0; + NodePtr = 0; +} +/*************************************************************************/ +//! Destructor. +/*! +*/ +xbStackElement::~xbStackElement() +{ +} +/*************************************************************************/ + +//! Destructor. +/*! +*/ + +/*************************************************************************/ +//! Short description. +/*! +*/ +void xbExpn::InitStack() +{ + xbStackElement *next; + + while(First){ + next = First->Next; + + if( First->NodePtr->InTree == 0 ) + delete First->NodePtr; + + delete First; + First = next; + } + + Last = 0; + StackDepth = 0; + return; +} +/*************************************************************************/ +//! Push a value onto the stack. +/*! + \param p +*/ +xbShort xbExpn::Push( xbExpNode *p ) +{ + xbStackElement *Temp = new xbStackElement; + + if(!Temp) + return XB_NO_MEMORY; + + Temp->NodePtr = p; + + if( !First ){ + First = Temp; + Last = Temp; + StackDepth = 1; + } else { + Last->Next = Temp; + Temp->Previous = Last; + Last = Temp; + StackDepth++; + } + return XB_NO_ERROR; +} +/*************************************************************************/ +//! Pop the top value from the stack. +/*! +*/ +xbExpNode * xbExpn::Pop() +{ + xbExpNode *p; + xbStackElement *Save; + + if( StackDepth == 0 ) + return 0; + else { + p = Last->NodePtr; + if( StackDepth == 1 ){ + delete First; + First = 0; + Last = 0; + } else { /* number of items in Stack must be > 1 */ + Last->Previous->Next = 0; + Save = Last; + Last = Last->Previous; + delete Save; + } + StackDepth--; + return p; + } +} +/*************************************************************************/ +//! Short description. +/*! +*/ +#ifdef XBASE_DEBUG +void xbExpn::DumpStack() +{ + xbStackElement * e; + if( StackDepth == 0 ){ + std::cout << "\nStack is empty..."; + return; + } + + std::cout << "\nThere are " << StackDepth << " entries."; + std::cout << "\nFirst = " << First << " Last = " << Last; + + e = First; + while( e ){ + std::cout << "\n*****************************"; + std::cout << "\nThis = " << e; + std::cout << "\nNext = " << e->Next; + std::cout << "\nPrevious = " << e->Previous; + std::cout << "\nNode Ptr = " << e->NodePtr; + e = e->Next; + } + return; +} +#endif // XB_EXPRESSIONS +#endif +/*************************************************************************/ diff --git a/xbase64/xbexp.h b/xbase64/xbexp.h new file mode 100755 index 0000000..ec769a9 --- /dev/null +++ b/xbase64/xbexp.h @@ -0,0 +1,290 @@ +/* xbexp.h + + Xbase64 project source code + + This file contains a header file for the EXP object, which is + used for expression processing. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifndef __XB_EXP_H__ +#define __XB_EXP_H__ + +#ifdef __GNU LesserG__ +#pragma interface +#endif + +#include <xbase64/xbase64.h> + +#ifdef XB_EXPRESSIONS /* compile if expression logic on */ +#include <xbase64/xbtypes.h> + +/*! \file xbexp.h +*/ + +#undef ABS +#undef MIN +#undef MAX + +class XBDLLEXPORT xbDbf; + +/************************************************************************/ +//! xbFuncDtl struct +/*! This structure defines function information +*/ + +struct XBDLLEXPORT xbFuncDtl { + const char * FuncName; /* function name */ + xbShort ParmCnt; /* no of parms it needs */ + char ReturnType; /* return type of function */ + void (*ExpFuncPtr)(); /* pointer to function routine */ +}; + +/************************************************************************/ +//! xbExpNode struct +/*! This class defines a node within a tree of nodes, each token + in an expression gets placed onto its own node +*/ + +class XBDLLEXPORT xbExpNode { + public: + xbExpNode(); + virtual ~xbExpNode(); + + public: + char * NodeText; /* expression text */ + char Type; /* same as TokenType below */ + xbShort Len; /* length of expression text */ + xbShort InTree; /* this node in the tree? 1=yes */ + xbExpNode * Node; /* pointer to parent */ + xbExpNode * Sibling1; /* pointer to sibling 1 */ + xbExpNode * Sibling2; /* pointer to sibling 2 */ + xbExpNode * Sibling3; /* pointe/r to sibling 3 */ + xbShort DataLen; /* length of data in result buffer */ + xbShort ResultLen; /* length of result buffer */ + xbString StringResult; /* string result */ + xbDouble DoubResult; /* Numeric Result */ + xbShort IntResult; /* logical result */ + xbDbf * dbf; /* pointer to datafile */ + xbShort FieldNo; /* field no if DBF field */ + char ExpressionType; /* used in head node C,N,L or D */ +}; +/************************************************************************/ +//! xbStackElement class +/*! +*/ + +class XBDLLEXPORT xbStackElement +{ + public: + xbStackElement(); + ~xbStackElement(); + + friend class xbExpn; + + private: + xbStackElement *Previous; + xbStackElement *Next; + xbExpNode *NodePtr; +}; +/************************************************************************/ +//! xbExpn class +/*! This class is used for processing expressions +*/ + +/* Expression handler */ + +class XBDLLEXPORT xbExpn{ + public: + xbExpn( xbXBase * ); + virtual ~xbExpn(); + + xbShort GetNextToken( const char *s, xbShort MaxLen ); + xbShort ProcessExpression( xbExpNode *n, xbShort ); + xbShort ProcessExpression( xbShort opt ) + { return ProcessExpression( Tree, opt ); } + + xbExpNode * GetTree() { return Tree; } + void SetTreeToNull() { Tree = NULL; } + xbExpNode * GetFirstTreeNode( xbExpNode * ); + xbExpNode * GetFirstTreeNode() + { return GetFirstTreeNode( Tree ); } + xbShort ProcessExpression( const char *exp, xbDbf * d ); + xbShort ParseExpression( const char *exp, xbDbf * d ); + xbExpNode * GetExpressionHandle(); + char GetExpressionResultType( xbExpNode * ); + char GetExpressionResultType() + { return GetExpressionResultType( Tree ); } + char * GetCharResult(); + xbString & GetStringResult(); + xbDouble GetDoubleResult(); + xbLong GetIntResult(); + xbShort ProcessExpression( xbExpNode * ); + xbShort ProcessExpression() { return ProcessExpression( Tree ); } + xbShort BuildExpressionTree( const char * Expression, xbShort MaxTokenLen, + xbDbf *d ); + + /* stack functions */ + void InitStack(); + xbExpNode * Pop(); + xbShort Push(xbExpNode *); + xbShort GetStackDepth() { return StackDepth; } + void DumpStack(); + const char * GetValidFuncName( xbShort funcNo ) + { return XbaseFuncList[funcNo].FuncName; } + +#ifdef XBASE_DEBUG + void DumpExpressionTree( xbShort printOption ) + { DumpExpressionTree( Tree, printOption ); } + void DumpExpressionTree( xbExpNode *, xbShort printOption ); + void DumpExpNode( xbExpNode *, xbShort printOption ); +#endif + + /* expression methods */ + xbDouble ABS( xbDouble ); + xbLong ASC( const char * ); + xbLong AT( const char *, const char * ); + char * CDOW( const char * ); + char * CHR( xbLong ); + char * CMONTH( const char * ); + char * CTOD( const char * ); + char * DATE(); + xbLong DAY( const char * ); + char * DESCEND( const char * ); + xbLong DESCEND( const xbDate & ); + xbDouble DESCEND( xbDouble ); + xbLong DOW( const char * ); + char * DTOC( const char * ); + char * DTOS( const char * ); + xbDouble EXP( xbDouble ); + char * IIF( xbShort, const char *, const char * ); + xbLong INT( xbDouble ); + xbLong ISALPHA( const char * ); + xbLong ISLOWER( const char * ); + xbLong ISUPPER( const char * ); + char * LEFT( const char *, xbShort ); + xbLong LEN( const char * ); + xbDouble LOG( xbDouble ); + char * LOWER( const char * ); + char * LTRIM( const char * ); + xbDouble MAX( xbDouble, xbDouble ); + xbLong MONTH( const char * ); /* MONTH() */ + xbDouble MIN( xbDouble, xbDouble ); + xbLong RECNO( xbDbf * ); + char * REPLICATE( const char *, xbShort ); + char * RIGHT( const char *, xbShort ); + char * RTRIM( const char * ); + char * SPACE( xbShort ); + xbDouble SQRT( xbDouble ); + char * STR( const char * ); + char * STR( const char *, xbShort ); + char * STR( const char *, xbShort, xbShort ); + char * STR( xbDouble ); + char * STR( xbDouble, xbShort ); + char * STR(xbDouble, xbUShort length, xbShort numDecimals ); + char * STRZERO( const char * ); + char * STRZERO( const char *, xbShort ); + char * STRZERO( const char *, xbShort, xbShort ); + char * STRZERO( xbDouble ); + char * STRZERO( xbDouble, xbShort ); + char * STRZERO( xbDouble, xbShort, xbShort ); + char * SUBSTR( const char *, xbShort, xbShort ); + char * TRIM( const char * ); + char * UPPER( const char * ); + xbLong VAL( const char * ); + xbLong YEAR( const char * ); + + protected: + xbShort IsWhiteSpace( char ); + char IsSeparator( char ); + xbExpNode * LoadExpNode( const char * ENodeText, const char EType, + const xbShort ELen, const xbShort BufLen ); + xbShort OperatorWeight( const char *Oper, xbShort len ); + xbShort ReduceComplexExpression( const char * NextToken, xbShort Len, + xbExpNode * cn, xbDbf *d ); + xbShort GetFunctionTokenLen( const char *s ); + xbShort ReduceFunction( const char *NextToken, xbExpNode *cn, xbDbf *d ); + xbExpNode * GetNextTreeNode( xbExpNode * ); + xbShort ProcessOperator( xbShort ); + xbShort ProcessFunction( char * ); + xbShort ValidOperation( char *, char, char ); + char GetOperandType( xbExpNode * ); + xbShort AlphaOperation( char * ); + xbShort NumericOperation( char * ); + xbShort GetFuncInfo( const char *Function, xbShort Option ); + xbDouble GetDoub( xbExpNode * ); + xbLong GetInt( xbExpNode * ); + + private: + xbXBase *xbase; + xbFuncDtl *XbaseFuncList; /* pointer to list of Xbase functions */ + xbExpNode *Tree; /* pointer to tree of parsed nodes */ + xbShort LogicalType; /* set to 1 for logical type nodes */ + char TokenType; /* E - Expression, not in simplest form */ + /* C - Constant */ + /* N - Numeric Constant */ + /* O - Operator */ + /* F - Function */ + /* D - Database Field */ + /* s - character string result */ + /* l - logical or short int result */ + /* d - double result */ + char PreviousType; /* used to see if "-" follows operator */ + char * Op1; /* pointer to operand 1 */ + char * Op2; /* pointer to operand 2 */ + xbDouble Opd1; /* double result 1 */ + xbDouble Opd2; /* double result 2 */ + xbShort OpLen1; /* length of memory allocated to operand 1 */ + xbShort OpLen2; /* length of memory allocated to operand 2 */ + xbShort OpDataLen1; /* length of data in op1 */ + xbShort OpDataLen2; /* length of data in op2 */ + char OpType1; /* type of operand 1 */ + char OpType2; /* type of operand 2 */ + xbShort TokenLen; /* length of token */ + +// static xbString DefaultDateFormat; /*default date format for DTOC func*/ + enum { WorkBufMaxLen = 200 }; + char WorkBuf[WorkBufMaxLen+1]; + + /* stack variables */ + xbShort StackDepth; + xbStackElement *First; + xbStackElement *Last; +}; + +#endif // XB_EXPRESSIONS +#endif // __XB_EXP_H__ + + diff --git a/xbase64/xbexpfnc.cpp b/xbase64/xbexpfnc.cpp new file mode 100755 index 0000000..91b6074 --- /dev/null +++ b/xbase64/xbexpfnc.cpp @@ -0,0 +1,1092 @@ +/* xbexpfnc.cpp + + Xbase64 project source code + + This file contains logic for handling Xbase expressions. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> +#ifdef XB_EXPRESSIONS + +#include <ctype.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> + +#include <xbase64/xbexp.h> +//#include <xbase64/xbexcept.h> + + +/*! \file xbexpfnc.cpp +*/ + +/*************************************************************************/ +//! Short description. +/*! + \param Func +*/ +xbShort xbExpn::ProcessFunction( char * Func ) +{ +/* 1 - pop function from stack + 2 - verify function name and get no of parms needed + 3 - verify no of parms >= remainder of stack + 4 - pop parms off stack + 5 - execute function + 6 - push result back on stack +*/ + + + char *buf = 0; + xbExpNode *p1, *p2, *p3, *WorkNode, *FuncNode; + xbShort ParmsNeeded,len; + char ptype = 0; /* process type s=string, l=logical, d=double */ + xbDouble DoubResult = 0; + xbLong IntResult = 0; + FuncNode = (xbExpNode *) Pop(); + + ParmsNeeded = GetFuncInfo( Func, 1 ); + + if( ParmsNeeded == -1 ) { + return XB_INVALID_FUNCTION; + } + else { + ParmsNeeded = 0; + if( FuncNode->Sibling1 ) ParmsNeeded++; + if( FuncNode->Sibling2 ) ParmsNeeded++; + if( FuncNode->Sibling3 ) ParmsNeeded++; + } + + if( ParmsNeeded > GetStackDepth()) + return XB_INSUFFICIENT_PARMS; + + p1 = p2 = p3 = NULL; + if( ParmsNeeded > 2 ) p3 = (xbExpNode *) Pop(); + if( ParmsNeeded > 1 ) p2 = (xbExpNode *) Pop(); + if( ParmsNeeded > 0 ) p1 = (xbExpNode *) Pop(); + memset( WorkBuf, 0x00, WorkBufMaxLen+1); + + if( strncmp( Func, "ABS", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = ABS( GetDoub( p1 )); + } + else if( strncmp( Func, "ASC", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = ASC( p1->StringResult ); + } + else if( strncmp( Func, "AT", 2 ) == 0 ) { + ptype = 'd'; + DoubResult = AT( p1->StringResult, p2->StringResult ); + } + else if( strncmp( Func, "CDOW", 4 ) == 0 ) { + ptype = 's'; + buf = CDOW( p1->StringResult ); + } + else if( strncmp( Func, "CHR", 3 ) == 0 ) { + ptype = 's'; + buf = CHR( GetInt( p1 )); + } + else if( strncmp( Func, "CMONTH", 6 ) == 0 ) { + ptype = 's'; + buf = CMONTH( p1->StringResult ); + } + else if( strncmp( Func, "CTOD", 4 ) == 0 ) { + ptype = 's'; + buf = CTOD( p1->StringResult ); + } + else if( strncmp( Func, "DATE", 4 ) == 0 ) { + ptype = 's'; + buf = DATE(); + } + else if( strncmp( Func, "DAY", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = DAY( p1->StringResult ); + } + else if( strncmp( Func, "DESCEND", 7 ) == 0 && p1->ExpressionType == 'C' ) { + ptype = 's'; + buf = DESCEND( p1->StringResult.c_str() ); + } + else if( strncmp( Func, "DESCEND", 7 ) == 0 && p1->ExpressionType == 'N' ) { + ptype = 'd'; + DoubResult = DESCEND( GetDoub( p1 )); + } + else if( strncmp( Func, "DESCEND", 7 ) == 0 && p1->ExpressionType == 'D' ) { + xbDate d( p1->StringResult ); + ptype = 'd'; + DoubResult = DESCEND( d ); + } + else if( strncmp( Func, "DOW", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = DOW( p1->StringResult ); + } + else if( strncmp( Func, "DTOC", 4 ) == 0 ) { + ptype = 's'; + buf = DTOC( p1->StringResult ); + } + else if( strncmp( Func, "DTOS", 4 ) == 0 ) { + ptype = 's'; + buf = DTOS( p1->StringResult ); + } + else if( strncmp( Func, "EXP", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = EXP( GetDoub( p1 )); + } + else if( strncmp( Func, "IIF", 3 ) == 0 ){ + ptype = 's'; + buf = IIF( p1->IntResult, p2->StringResult, p3->StringResult ); + } + else if( strncmp( Func, "INT", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = INT( GetDoub( p1 )); + } + else if( strncmp( Func, "ISALPHA", 7 ) == 0 ) { + ptype = 'l'; + IntResult = ISALPHA( p1->StringResult ); + } + else if( strncmp( Func, "ISLOWER", 7 ) == 0 ) { + ptype = 'l'; + IntResult = ISLOWER( p1->StringResult ); + } + else if( strncmp( Func, "ISUPPER", 7 ) == 0 ) { + ptype = 'l'; + IntResult = ISUPPER( p1->StringResult ); + } + else if( strncmp( Func, "LEN", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = LEN( p1->StringResult ); + } + else if( strncmp( Func, "LEFT", 4 ) == 0 ) { + ptype = 's'; + buf = LEFT( p1->StringResult, INT( p2->DoubResult )); + } + else if( strncmp( Func, "LTRIM", 5 ) == 0 ) { + ptype = 's'; + buf = LTRIM( p1->StringResult ); + } + else if( strncmp( Func, "LOG", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = LOG( GetDoub( p1 )); + } + else if( strncmp( Func, "LOWER", 5 ) == 0 ) { + ptype = 's'; + buf = LOWER( p1->StringResult ); + } + else if( strncmp( Func, "MAX", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = MAX( GetDoub( p1 ), GetDoub( p2 )); + } + else if( strncmp( Func, "MIN", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = MIN( GetDoub( p1 ), GetDoub( p2 )); + } + else if( strncmp( Func, "MONTH", 5 ) == 0 ) { + ptype = 'd'; + DoubResult = MONTH( p1->StringResult ); + } + + else if( strncmp( Func, "RECNO", 5 ) == 0 ) + { + ptype = 'd'; + DoubResult = RECNO( FuncNode->dbf ); + } + + else if( strncmp( Func, "REPLICATE", 9 ) == 0 ) { + ptype = 's'; + buf = REPLICATE( p1->StringResult, GetInt( p2 )); + } + else if( strncmp( Func, "RIGHT", 5 ) == 0 ) { + ptype = 's'; + buf = RIGHT( p1->StringResult, GetInt( p2 )); + } + else if( strncmp( Func, "RTRIM", 5 ) == 0 ) { + ptype = 's'; + buf = RTRIM( p1->StringResult ); + } + else if( strncmp( Func, "SPACE", 5 ) == 0 ) { + ptype = 's'; + buf = SPACE( INT( GetDoub( p1 ))); + } + else if( strncmp( Func, "SQRT", 4 ) == 0 ) { + ptype = 'd'; + DoubResult = SQRT( GetDoub( p1 )); + } + else if( strncmp( Func, "STRZERO", 7 ) == 0 && ParmsNeeded == 1 ) { + ptype = 's'; + buf = STRZERO( p1->StringResult ); + } + else if( strncmp( Func, "STRZERO", 7 ) == 0 && ParmsNeeded == 2 ) { + ptype = 's'; + buf = STRZERO( p1->StringResult, GetInt( p2 )); + } + else if( strncmp( Func, "STRZERO", 7 ) == 0 && ParmsNeeded == 3 ) { + ptype = 's'; + buf = STRZERO( p1->StringResult, GetInt( p2 ), GetInt( p3 )); + } + + else if( strncmp( Func, "STR", 3 ) == 0 && p3 ) { + ptype = 's'; + if(p1->ExpressionType == 'N') + buf = STR( p1->DoubResult, GetInt( p2 ), GetInt( p3 )); + else + buf = STR( p1->StringResult, GetInt( p2 ), GetInt( p3 )); + } + + else if( strncmp( Func, "STR", 3 ) == 0 && p2 ) { + ptype = 's'; + buf = STR( p1->StringResult, GetInt( p2 )); + } + + else if( strncmp( Func, "STR", 3 ) == 0 && p1 ) { + ptype = 's'; + buf = STR( p1->StringResult ); + } + + else if( strncmp( Func, "SUBSTR", 6 ) == 0 ) { + ptype = 's'; + buf = SUBSTR( p1->StringResult, GetInt( p2 ), GetInt( p3 )); + } + else if( strncmp( Func, "TRIM", 4 ) == 0 ) { + ptype = 's'; + buf = TRIM( p1->StringResult ); + } + else if( strncmp( Func, "UPPER", 5 ) == 0 ) { + ptype = 's'; + buf = UPPER( p1->StringResult ); + } + else if( strncmp( Func, "VAL", 3 ) == 0 ) { + ptype = 'd'; + DoubResult = VAL( p1->StringResult ); + } + else if( strncmp( Func, "YEAR", 4 ) == 0 ) { + ptype = 'd'; + DoubResult = YEAR( p1->StringResult ); + } + if( p1 && !p1->InTree ) delete p1; + if( p2 && !p2->InTree ) delete p2; + if( p3 && !p3->InTree ) delete p3; + if( !FuncNode->InTree ) delete FuncNode; + if( buf ){ + len = strlen( buf ); + WorkNode = new xbExpNode; + if( !WorkNode ) + return XB_NO_MEMORY; + WorkNode->ResultLen = len + 1; + + } else { + len = 0; + WorkNode = new xbExpNode; + if( !WorkNode ) + return XB_NO_MEMORY; + WorkNode->ResultLen = 0; + } + + switch( ptype ){ + case 's': /* string or char result */ + WorkNode->DataLen = len; + WorkNode->ExpressionType = 'C'; + WorkNode->Type = 's'; + WorkNode->StringResult = buf; + break; + case 'd': /* numeric result */ + WorkNode->DataLen = 0; + WorkNode->ExpressionType = 'N'; + WorkNode->Type = 'd'; + WorkNode->DoubResult = DoubResult; + break; + case 'l': /* logical result */ + WorkNode->DataLen = 0; + WorkNode->ExpressionType = 'L'; + WorkNode->Type = 'l'; + WorkNode->IntResult = IntResult; + break; + default: + std::cout << "\nInternal error. " << ptype; + break; + } + Push(WorkNode); + return XB_NO_ERROR; +} +/*************************************************************************/ +//! Short description. +/*! +*/ +xbString & xbExpn::GetStringResult() +{ + xbString *s = 0; + xbExpNode *e; + if( GetStackDepth() < 1 ) return *s; + e = (xbExpNode *) Pop(); + s = &e->StringResult; + Push(e); + return *s; +} +/*************************************************************************/ +//! Short description. +/*! +*/ +xbLong xbExpn::GetIntResult() +{ + xbLong l; + xbExpNode * e; + if( GetStackDepth() < 1 ) return 0L; + e = (xbExpNode *) Pop(); + l = e->IntResult; + Push(e); + return l; +} +/*************************************************************************/ +//! Short description. +/*! +*/ +xbDouble xbExpn::GetDoubleResult() +{ + xbDouble d; + xbExpNode * e; + if( GetStackDepth() < 1 ) return (xbDouble) 0; + e = (xbExpNode *) Pop(); + d = e->DoubResult; + Push(e); + return d; +} +/*************************************************************************/ +//! Short description. +/*! + \param p +*/ +xbDouble xbExpn::GetDoub( xbExpNode * p ) +{ + if( p->Type == 'd' ) + return p->DoubResult; + else if( p->Type == 'N' || p->Type == 's' ) + return( strtod( p->StringResult, NULL )); + else if( p->Type == 'D' ) + return( p->dbf->GetDoubleField( p->FieldNo )); + else + return 0; +} +/*************************************************************************/ +//! Short description. +/*! + \param p +*/ +xbLong xbExpn::GetInt( xbExpNode *p ) +{ + if( p->Type == 'l' || p->Type == 'i' ) + return p->IntResult; + else if( p->Type == 'N' || p->Type == 's' ) + return atoi( p->StringResult ); + else if( p->Type == 'D' ) + return p->dbf->GetLongField( p->FieldNo ); + else + return 0L; +} +/*************************************************************************/ +//! Short description. +/*! + \param d +*/ +xbDouble xbExpn::ABS( xbDouble d ) +{ + if( d < (xbDouble) 0 ) + return d * -1; + else + return d; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +xbLong xbExpn::ASC( const char * String ) +{ + return *String; +} +/*************************************************************************/ +//! Short description. +/*! + \param s1 + \param s2 +*/ +xbLong xbExpn::AT( const char * s1, const char *s2 ) +{ + /* looks for s1 in s2 */ + xbLong cnt; + const char *p; + if( strlen( s1 ) > strlen( s2 )) return 0; + if(( p = strstr( s2, s1 )) == NULL ) + return 0; + cnt = 1; + while( s2++ != p ) cnt++; + return cnt; +} +/*************************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +char * xbExpn::CDOW( const char * Date8 ) +{ + static char buf[10]; + xbDate d; + xbShort len,i; + strcpy( buf, d.FormatDate( "DDDD", Date8 )); + len = strlen( buf ); + for( i = len; i < 9; i++ ) buf[i] = 0x20; + buf[9] = 0x00; + return buf; +} +/*************************************************************************/ +//! Short description. +/*! + \param l +*/ +char * xbExpn::CHR( xbLong l ) +{ + static char buf[2]; + xbShort i; + i = (xbShort) l; + buf[0] = i; + buf[1] = 0x00; + return buf; +} +/*************************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +char * xbExpn::CMONTH( const char * Date8 ) +{ + static char buf[10]; + xbShort len,i; + xbDate d; + strcpy( buf, d.FormatDate( "MMMM", Date8 )); + len = strlen( buf ); + for( i = len; i < 9; i++ ) buf[i] = 0x20; + buf[9] = 0x00; + return buf; +} +/*************************************************************************/ +//! Short description. +/*! + \param indate +*/ +char * xbExpn::CTOD( const char * indate ) +{ + xbDate d; + strcpy( WorkBuf, d.FormatCTODdate( indate )); + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +xbLong xbExpn::DAY( const char * Date8 ) +{ + xbDate d; + return d.DayOf( XB_FMT_MONTH, Date8 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param date +*/ +xbLong xbExpn::DESCEND( const xbDate & date ) +{ + return 2415021 + date.JulianDays( "29991231" ) - date.JulianDays(); +} +/*************************************************************************/ +//! Short description. +/*! + \param num +*/ +xbDouble xbExpn::DESCEND( xbDouble d ) +{ + return d * -1; +} +/*************************************************************************/ +//! Short description. +/*! + \param str +*/ +char * xbExpn::DESCEND( const char * str ) +{ + xbShort i; + xbShort len = strlen( str ); + + for( i = 0; i < len; i++ ) + WorkBuf[i] = 255 - str[i]; + WorkBuf[i] = 0x00; + + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +xbLong xbExpn::DOW( const char * Date8 ) +{ + xbDate d; + return d.DayOf( XB_FMT_WEEK, Date8 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +char * xbExpn::DTOC( const char * Date8 ) +{ + xbDate d; + strcpy( WorkBuf, d.FormatDate( xbase->GetDefaultDateFormat(), Date8 )); + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +char * xbExpn::DTOS( const char * Date8 ) +{ + xbDate d; + strcpy( WorkBuf, d.FormatDate( "YYYYMMDD", Date8 )); + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param d +*/ +xbDouble xbExpn::EXP( xbDouble d ) +{ + return exp( d ); +} +/*************************************************************************/ +//! Short description. +/*! + \param ifCondition + \param trueRslt + \param falseRslt +*/ +char * xbExpn::IIF( xbShort ifCondition, + const char * trueRslt, const char * falseRslt ) +{ + if( ifCondition ) + strcpy( WorkBuf, trueRslt ); + else + strcpy( WorkBuf, falseRslt ); + + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param d +*/ +xbLong xbExpn::INT( xbDouble d ) +{ + return (xbLong) d; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +xbLong xbExpn::ISALPHA( const char * String ) +{ + if( isalpha(*String) ) return 1; + else return 0; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +xbLong xbExpn::ISLOWER( const char * String ) +{ + if( islower(*String) ) return 1; + else return 0; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +xbLong xbExpn::ISUPPER( const char * String ) +{ + if( isupper(*String) ) return 1; + else return 0; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +xbLong xbExpn::LEN( const char * String ) +{ + xbLong len; + len = strlen( String ); + len--; + while( len >= 0 && String[len] == 0x20 ) len--; + return ++len; +} +/*************************************************************************/ +//! Short description. +/*! + \param String + \param Len +*/ +char * xbExpn::LEFT( const char * String, xbShort Len ) +{ + xbShort i; + for( i = 0; i < Len && i < 100; i++ ) + WorkBuf[i] = String[i]; + WorkBuf[i] = 0x00; + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +/* This method removes any leading spaces from String */ +char * xbExpn::LTRIM( const char *String) { + WorkBuf[0] = 0x00; + if (!String) + return WorkBuf; + + xbShort i; + i = 0; + while( *String && *String == 0x20 ) String++; + while( *String && i < WorkBufMaxLen ){ + WorkBuf[i++] = *String; + String++; + } + WorkBuf[i] = 0x00; + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param d +*/ +xbDouble xbExpn::LOG( xbDouble d ) +{ + return log( d ); +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +char *xbExpn::LOWER( const char *String ) +{ + WorkBuf[0] = 0x00; + if (!String) + return WorkBuf; + xbShort i = 0; + while( *String && i < WorkBufMaxLen) { + WorkBuf[i++] = tolower( *String ); + String++; + } + WorkBuf[i] = 0x00; + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param d1 + \param d2 +*/ +xbDouble xbExpn::MAX( xbDouble d1, xbDouble d2 ) +{ + if( d1 > d2 ) + return d1; + else + return d2; +} +/*************************************************************************/ +//! Short description. +/*! + \param d1 + \param d2 +*/ +xbDouble xbExpn::MIN( xbDouble d1, xbDouble d2 ) +{ + if( d1 < d2 ) + return d1; + else + return d2; +} +/*************************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +xbLong xbExpn::MONTH( const char * Date8 ) +{ + xbDate d; + return d.MonthOf( Date8 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param d +*/ +xbLong xbExpn::RECNO( xbDbf * d ) { + return d->GetCurRecNo(); +} +/*************************************************************************/ +//! Short description. +/*! + \param String + \param Cnt +*/ +char * xbExpn::REPLICATE( const char * String, xbShort Cnt ) +{ + xbShort len, i; + len = strlen( String ); + if(( len * Cnt ) > 100 ) return NULL; + memset( WorkBuf, 0x00, len+1 ); + for( i = 0; i < Cnt; i++ ) + strcat( WorkBuf, String ); + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param String + \paran cnt +*/ +char * xbExpn::RIGHT( const char * String, xbShort cnt ) +{ + xbShort len; + strcpy( WorkBuf, String ); + len = strlen( String ); + if( len < cnt ) return WorkBuf; + len = LEN( String ); + if( len < cnt ) return WorkBuf; + strcpy( WorkBuf, String + len - cnt ); + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +char * xbExpn::RTRIM( const char * String ) +{ + return TRIM( String ); +} +/*************************************************************************/ +//! Short description. +/*! + \param Cnt +*/ +char * xbExpn::SPACE( xbShort Cnt ) +{ + if( Cnt > 100 ) return NULL; + memset( WorkBuf, 0x20, Cnt ); + WorkBuf[Cnt] = 0x00; + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param d +*/ +xbDouble xbExpn::SQRT( xbDouble d ) +{ + return sqrt( d ); +} +/*************************************************************************/ +//! Short description. +/*! + \param d + \param length + \param numDecimals +*/ +char * xbExpn::STR(xbDouble d, xbUShort length, xbShort numDecimals) { + // sanity check for length arg + if (length > WorkBufMaxLen) + { + // maybe should generate an error here instead ? + length = WorkBufMaxLen; + } + + // check the length required + sprintf(WorkBuf, "%.*f", numDecimals, d); + + if ((xbUShort) strlen(WorkBuf) > length) { + memset(WorkBuf, '*', length); + WorkBuf[length] = 0x00; + } else + sprintf( WorkBuf, "%*.*f", length, numDecimals, d ); + + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param d + \param length +*/ +char * xbExpn::STR( xbDouble d, xbShort length ) +{ + return STR( d, length, 0 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param d +*/ +char * xbExpn::STR( xbDouble d ) +{ + return STR( d, 10, 0 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param String + \param length + \param +*/ +char * xbExpn::STR( const char * String, xbShort length, xbShort dec ) +{ + xbShort len, i; + double d; + d = strtod( String, NULL ); + return STR( d, length, dec ); +} +/*************************************************************************/ +//! Short description. +/*! + \param String + \param length +*/ +char * xbExpn::STR( const char *String, xbShort length ) +{ + return STR( String, length, 0 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +char * xbExpn::STR( const char * String ) +{ + return STR( String, 10, 0 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param d + \param length + \param +*/ +char * xbExpn::STRZERO( xbDouble d, xbShort length, xbShort ) +{ + xbShort len,i; + sprintf(WorkBuf, "%*.*g", length, length, d); +// gcvt( d, length, WorkBuf ); + len = strlen( WorkBuf ); + if( len > length ) + strcpy( WorkBuf, "**********" ); + else if( len < length ) + { + for( i = len; i < length; i++ ) + WorkBuf[i] = 0x30; + WorkBuf[i] = 0x00; + } + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param d + \param length +*/ +char * xbExpn::STRZERO( xbDouble d, xbShort length ) +{ + return STRZERO( d, length, 0 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param d +*/ +char * xbExpn::STRZERO( xbDouble d ) +{ + return STRZERO( d, 10, 0 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param String + \param length + \param +*/ +char * xbExpn::STRZERO( const char * String, xbShort length, xbShort ) +{ + xbShort i, len ; + while( *String == ' ' ) String++; + len = strlen(String); + for( i = 0; i < abs( length-len); i++ ) + WorkBuf[i] = 0x30; + WorkBuf[i] = 0x00; + strcat( WorkBuf, String ); + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param String + \param length +*/ +char * xbExpn::STRZERO( const char * String, xbShort length ) +{ + return STRZERO( String, length, 0 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +char * xbExpn::STRZERO( const char * String ) +{ + return STRZERO( String, 10, 0 ); +} +/*************************************************************************/ +//! Short description. +/*! + \param String + \param StartPos + \param Len +*/ +char * xbExpn::SUBSTR( const char * String, xbShort StartPos, xbShort Len ) +{ + xbShort i; + if( StartPos < 1 ) return NULL; + String += (StartPos - 1); + for( i = 0; i < Len; i++ ) + WorkBuf[i] = *String++; + WorkBuf[i] = 0x00; + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! +*/ +char * xbExpn::DATE() +{ + xbDate d; + strcpy( WorkBuf, d.Sysdate()); + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +char * xbExpn::TRIM( const char * String ) +{ + WorkBuf[0] = 0x00; + if( !String ) + return WorkBuf; + char *sp; + xbShort len; + len = strlen( String ); + if( len < WorkBufMaxLen ) { + strcpy( WorkBuf, String ); + } + else { + strncpy( WorkBuf, String, WorkBufMaxLen ); + WorkBuf[ WorkBufMaxLen ] = 0x00; + len = WorkBufMaxLen; + } + sp = WorkBuf + len - 1; + while( *sp == 0x20 && sp >= WorkBuf ) { + *sp = 0x00; + sp--; + } + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +char *xbExpn::UPPER( const char *String ) +{ + WorkBuf[0] = 0x00; + if (!String) + return WorkBuf; + xbShort i; + i = 0; + while(*String && i < WorkBufMaxLen) { + WorkBuf[i++] = toupper(*String); + String++; + } + WorkBuf[i] = 0x00; + return WorkBuf; +} +/*************************************************************************/ +//! Short description. +/*! + \param String +*/ +xbLong xbExpn::VAL( const char * String ) +{ + if( String ) + return (xbLong) *String; + else + return 0; +} +/*************************************************************************/ +//! Short description. +/*! + \param Date8 +*/ +xbLong xbExpn::YEAR( const char * Date8 ){ + xbDate d; + return d.YearOf( Date8 ); +} +/*************************************************************************/ +#endif // XB_EXPRESSIONS diff --git a/xbase64/xbexpprc.cpp b/xbase64/xbexpprc.cpp new file mode 100755 index 0000000..8334ea4 --- /dev/null +++ b/xbase64/xbexpprc.cpp @@ -0,0 +1,549 @@ +/* xbexpprc.cpp + + Xbase64 project source code + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> + +#ifdef XB_EXPRESSIONS + +#include <ctype.h> +#include <math.h> + +/*! \file xbexpprc.cpp +*/ + +/*************************************************************************/ +//! Short description +/*! + \param e +*/ +xbExpNode * xbExpn::GetFirstTreeNode( xbExpNode * e ) +{ + xbExpNode * WorkNode; + if( !e ) return e; + WorkNode = e; + while( WorkNode->Sibling1 ) + WorkNode = WorkNode->Sibling1; + return WorkNode; +} +/*************************************************************************/ +//! Short description +/*! + \param Operand + \param Op1 + \pamam Op2 +*/ +xbShort xbExpn::ValidOperation( char * Operand, char Op1, char Op2 ) +{ + /* Valid operation table + + operator Op1 Op2 operator Op1 Op2 + + ** N N = N N + * N N = C C + / N N = D D + + N N <>,# N N + + C C <>,# C C + + D N <>,# D D + - N N <= N N + - C C <= D D + - D D <= C C + - D N >= N N + < N N >= D D + < C C >= C C + < D D $ C C + > N N + > C C + > D D + + C = Character + D = Date + N = Numeric + + Maybe reversed to what you are thinking ==> think OP2 - OP1 + + */ + + // check for ** + if( Operand[0] == '*' && Operand[1] == '*' && Op1 == 'N' && Op2 == 'N' ) + return 1; + + // check for != + if(( Operand[0] == '!' && Operand[1] == '=' ) && + (( Op1 == 'N' && Op2 == 'N' ) || + ( Op1 == 'C' && Op2 == 'C' ) || + ( Op1 == 'D' && Op2 == 'D' ))) + return 1; + + switch( Operand[0] ) { + case '*': + case '/': + if( Op1 == 'N' && Op2 == 'N' ) + return 1; + else + return 0; + + case '+': + if(( Op1 == 'N' && Op2 == 'N' ) || + ( Op1 == 'C' && Op2 == 'C' ) || + ( Op1 == 'N' && Op2 == 'D' )) + return 1; + else + return 0; + + case '-': + if(( Op1 == 'N' && Op2 == 'N' ) || + ( Op1 == 'C' && Op2 == 'C' ) || + ( Op1 == 'D' && Op2 == 'D' ) || + ( Op1 == 'N' && Op2 == 'D' )) + return 1; + else + return 0; + + case '<': + case '>': + case '=': + case '#': + if(( Op1 == 'N' && Op2 == 'N' ) || + ( Op1 == 'C' && Op2 == 'C' ) || + ( Op1 == 'D' && Op2 == 'D' )) + return 1; + else + return 0; + + case '$': + if( Op1 == 'C' && Op2 == 'C' ) + return 1; + else + return 0; + + case '.' : + if( (strncmp( Operand, ".AND.", 5 ) == 0 ) || + (strncmp( Operand, ".OR.", 4 ) == 0 ) || + (strncmp( Operand, ".NOT.", 5 ) == 0 )) + return 1; + else + return 0; + + default: + return 0; + } +} +/*************************************************************************/ +//! Short description +/*! + \param e +*/ +xbExpNode * xbExpn::GetNextTreeNode( xbExpNode * e ) +{ + if( !e->Node ) return NULL; + + /* sibling 1 && sibling 2 exists */ + if( e == e->Node->Sibling1 && e->Node->Sibling2 ) + return GetFirstTreeNode( e->Node->Sibling2 ); + + /* sibling2 && sibling3 exists */ + else if( e == e->Node->Sibling2 && e->Node->Sibling3 ) + return GetFirstTreeNode( e->Node->Sibling3 ); + + else + return e->Node; +} +/*************************************************************************/ +//! Short description +/*! + \param e +*/ +xbShort xbExpn::ProcessExpression( xbExpNode * e ) +{ + return ProcessExpression( e, 0 ); +} +/*************************************************************************/ +//! Short description +/*! + \param Wtree + \param RecBufSw +*/ +xbShort xbExpn::ProcessExpression( xbExpNode * Wtree, xbShort RecBufSw ) +{ + xbExpNode * WorkNode; + xbShort rc; + if( Wtree == 0 ) + Wtree = Tree; + memset(WorkBuf, 0x00, WorkBufMaxLen+1 ); + /* initialize the stack - free any expnodes */ + while( GetStackDepth() > 0 ) { + WorkNode = (xbExpNode *) Pop(); + if( !WorkNode->InTree ) + delete WorkNode; + } + if(( WorkNode = GetFirstTreeNode( Wtree )) == NULL ) + return XB_NO_DATA; + + while( WorkNode ) { + Push(WorkNode); + if( WorkNode->Type == 'D' && WorkNode->dbf ) { + WorkNode->dbf->GetField( WorkNode->FieldNo, WorkNode->StringResult, RecBufSw ); + if( WorkNode->dbf->GetFieldType( WorkNode->FieldNo ) == 'N' || + WorkNode->dbf->GetFieldType( WorkNode->FieldNo ) == 'F' ) + WorkNode->DoubResult = WorkNode->dbf->GetDoubleField( WorkNode->FieldNo, RecBufSw ); + } else if( WorkNode->Type == 'O' ) { + if(( rc = ProcessOperator( RecBufSw )) != XB_NO_ERROR ) + return rc; + } else if( WorkNode->Type == 'F' ) + if(( rc = ProcessFunction( WorkNode->NodeText )) != XB_NO_ERROR ) + return rc; + WorkNode = GetNextTreeNode( WorkNode ); + } + if( GetStackDepth() != 1 ) /* should only have result left in stack */ + return XB_PARSE_ERROR; + return XB_NO_ERROR; +} +/*************************************************************************/ +//! Short description +/*! + \param e +*/ +char xbExpn::GetOperandType( xbExpNode * e ) +{ + /* this routine returns + L - logical + N - Numeric + C - Character + 0 - error + */ + char WorkType; + if( e->Type == 'd' || e->Type == 'N' || e->Type == 'i' ) return 'N'; + if( e->Type == 'l' ) return 'L'; + if( e->Type == 's' ) return 'C'; + if( e->Type == 'C' ) { + if(e->NodeText[0]=='-' || e->NodeText[0]=='+' || + (isdigit(e->NodeText[0]) && + !(e->NodeText[e->DataLen] == '\'' || e->NodeText[e->DataLen] == '"'))) + return 'N'; + else + return 'C'; + } else if( e->Type == 'D' && e->dbf ){ + WorkType = e->dbf->GetFieldType( e->FieldNo ); + if( WorkType == 'C' ) return 'C'; + else if( WorkType == 'F' || WorkType == 'N' ) return 'N'; + else if( WorkType == 'L' ) return 'L'; + else if( WorkType == 'D' ) return 'D'; + else return 0; + } else + return 0; +} +/*************************************************************************/ +//! Short description +/*! + \param RecBufSw +*/ +xbShort xbExpn::ProcessOperator( xbShort RecBufSw ) +{ + xbExpNode * WorkNode; + char Operator[6]; + char t; + if( GetStackDepth() < 3 ) + return XB_PARSE_ERROR; + WorkNode = (xbExpNode *) Pop(); + if( WorkNode->Len > 5 ) + return XB_PARSE_ERROR; + + memset( Operator, 0x00, 6 ); + strncpy( Operator, WorkNode->NodeText, WorkNode->Len ); + if( !WorkNode->InTree ) + delete WorkNode; + + /* load up operand 1 */ + WorkNode = (xbExpNode *) Pop(); + if(( OpType1 = GetOperandType( WorkNode )) == 0 ) + return XB_PARSE_ERROR; + + if( OpLen1 < WorkNode->DataLen+1 && WorkNode->Type != 'd' ) { + if( OpLen1 > 0 ) free( Op1 ); + if(( Op1 = (char *) malloc( WorkNode->DataLen+1 )) == NULL ) { + return XB_NO_MEMORY; + } + OpLen1 = WorkNode->DataLen+1; + } + OpDataLen1 = WorkNode->DataLen; + memset( Op1, 0x00, WorkNode->DataLen+1 ); + if( WorkNode->Type == 'D' && WorkNode->dbf ) { /* database field */ + WorkNode->dbf->GetField( WorkNode->FieldNo, Op1, RecBufSw ); + t = WorkNode->dbf->GetFieldType( WorkNode->FieldNo ); + if( t == 'N' || t == 'F' ) + Opd1 = strtod( WorkNode->StringResult, 0 ); + else if( t == 'D' ){ // date field + xbDate d; + Opd1 = d.JulianDays( WorkNode->StringResult ); + } + } + else if( WorkNode->Type == 'C' ) /* constant */ + memcpy( Op1, WorkNode->NodeText, WorkNode->DataLen ); + else if( WorkNode->Type == 's' ) /* previous result */ + memcpy( Op1, WorkNode->StringResult, WorkNode->DataLen+1 ); + else if( WorkNode->Type == 'd' ) /* previous numeric result */ + Opd1 = WorkNode->DoubResult; + else if( WorkNode->Type == 'N' ) /* previous numeric result */ + Opd1 = strtod( WorkNode->StringResult, 0 ); + else if(WorkNode->Type == 'l') /* previous logical result 3/26/00 dtb */ + Opd1 = WorkNode->IntResult; + if( !WorkNode->InTree ) + delete WorkNode; + + /* load up operand 2 */ + WorkNode = (xbExpNode *) Pop(); + if(( OpType2 = GetOperandType( WorkNode )) == 0 ) + return XB_PARSE_ERROR; + + if( OpLen2 < WorkNode->DataLen+1 && WorkNode->Type != 'd' ) { + if( OpLen2 > 0 ) free( Op2 ); + if(( Op2 = (char *) malloc( WorkNode->DataLen+1 )) == NULL ) { + return XB_NO_MEMORY; + } + OpLen2 = WorkNode->DataLen+1; + } + OpDataLen2 = WorkNode->DataLen; + memset( Op2, 0x00, WorkNode->DataLen+1 ); + if( WorkNode->Type == 'D' && WorkNode->dbf ) { /* database field */ + WorkNode->dbf->GetField( WorkNode->FieldNo, Op2, RecBufSw ); + t = WorkNode->dbf->GetFieldType( WorkNode->FieldNo ); + if( t == 'N' || t == 'F' ) + Opd2 = strtod( WorkNode->StringResult, 0 ); + else if( t == 'D' ){ // date field + xbDate d; + Opd2 = d.JulianDays( WorkNode->StringResult ); + } + } + else if( WorkNode->Type == 'C' ) /* constant */ + memcpy( Op2, WorkNode->NodeText, WorkNode->DataLen ); + else if( WorkNode->Type == 's' ) /* previous result */ + memcpy( Op2, WorkNode->StringResult, WorkNode->DataLen+1 ); + else if( WorkNode->Type == 'd' ) /* previous numeric result */ + Opd2 = WorkNode->DoubResult; + else if( WorkNode->Type == 'N' ) /* previous numeric result */ + Opd2 = strtod( WorkNode->StringResult, 0 ); + else if(WorkNode->Type == 'l') /* previous logical result 3/26/00 dtb*/ + Opd2 = WorkNode->IntResult; + if( !WorkNode->InTree ) + delete WorkNode; + if( !ValidOperation( Operator, OpType1, OpType2 )) + return XB_PARSE_ERROR; + + if( OpType1 == 'N' || OpType1 == 'L' || OpType1 == 'D' ) /* numeric procesing */ + return NumericOperation( Operator ); + else /* must be character */ + return AlphaOperation( Operator ); +} +/*************************************************************************/ +//! Short description +/*! + \param Operator +*/ +xbShort xbExpn::NumericOperation( char * Operator ) +{ + xbDouble Operand1, Operand2; + xbExpNode * WorkNode; + xbShort ResultLen; + char SaveType; + ResultLen = 0; + +/* This function assumes a valid operation coming in */ + + if( Operator[0] == '=' || Operator[0] == '<' || + Operator[0] == '>' || Operator[0] == '#' || + Operator[0] == '.' || (strncmp( Operator, "!=", 2 ) == 0 )) + SaveType = 'l'; + else + SaveType = 'd'; + + WorkNode = new xbExpNode; + + if( !WorkNode ) + return XB_PARSE_ERROR; + WorkNode->ResultLen = ResultLen; + WorkNode->Type = SaveType; + WorkNode->DataLen = ResultLen; + + if( OpType1 == 'd' || OpType1 == 'N' || OpType2 == 'D' ) + Operand1 = Opd1; + else + Operand1 = strtod( Op1, NULL ); + + if( OpType2 == 'd' || OpType2 == 'N' || OpType2 == 'D' ) + Operand2 = Opd2; + else + Operand2 = strtod( Op2, NULL ); + + if( Operator[0] == '*' && Operator[1] == '*' ) + WorkNode->DoubResult = pow( Operand2, Operand1 ); + else if( Operator[0] == '*' ) + WorkNode->DoubResult = Operand2 * Operand1; + else if( Operator[0] == '/') + WorkNode->DoubResult = Operand2 / Operand1; + else if( Operator[0] == '+' ){ + WorkNode->DoubResult = Operand2 + Operand1; + xbDate d; + WorkNode->StringResult = d.JulToDate8((xbLong) WorkNode->DoubResult ); + } else if( Operator[0] == '-' ){ + WorkNode->DoubResult = Operand2 - Operand1; + xbDate d; + WorkNode->StringResult = d.JulToDate8((xbLong) WorkNode->DoubResult ); + } + + /* = */ + else if( Operator[0]== '=' && Operand1 == Operand2 ) + WorkNode->IntResult = 1; + else if( Operator[0] == '=' ) + WorkNode->IntResult = 0; + /* not = */ + else if(( Operator[0] == '<' && Operator[1] == '>' )|| + ( Operator[0] == '!' && Operator[1] == '=' )|| + Operator[0] == '#' || (strncmp( Operator, "!=", 2 ) == 0 )) + WorkNode->IntResult = ( Operand1 != Operand2 ) ? 1 : 0; + /* less than */ + else if( Operator[0] == '<' ) + WorkNode->IntResult = ( Operand2 < Operand1 ) ? 1 : 0; + /* greater than */ + else if( Operator[0] == '>' ) + WorkNode->IntResult = ( Operand2 > Operand1 ) ? 1 : 0; + else if(Operator[0] == '.'){ // logical operators, added 3/26/00 dtb + switch(Operator[1]){ + case 'A' : // and + WorkNode->IntResult = (Opd1 && Opd2) ? 1 : 0; + break; + + case 'N' : // not + WorkNode->IntResult = (!(Opd1 && Opd2)) ? 1 : 0; + break; + + case 'O' : // or + WorkNode->IntResult = (Opd1 || Opd2) ? 1 : 0; + break; + + default : + return XB_PARSE_ERROR; + } + } else + return XB_PARSE_ERROR; + + Push(WorkNode); + return 0; +} +/*************************************************************************/ +//! Short description +/*! + \param Operator +*/ +xbShort xbExpn::AlphaOperation( char * Operator ) +{ + xbShort ResultLen, i; + char SaveType; + xbExpNode * WorkNode; + + if( Operator[0] == '=' || Operator[0] == '<' || + Operator[0] == '>' || Operator[0] == '#' || + (strncmp( Operator, "!=", 2 ) == 0 ) || + Operator[0] == '$'){ + ResultLen = 0; + SaveType = 'l'; + } else { + ResultLen = OpDataLen1 + OpDataLen2 + 1; + SaveType = 's'; + } + + WorkNode = new xbExpNode; + if( !WorkNode ) + return XB_PARSE_ERROR; + WorkNode->ResultLen = ResultLen; + WorkNode->Type = SaveType; + if( WorkNode->Type == 'l' ) + WorkNode->DataLen = 0; + else + WorkNode->DataLen = ResultLen - 1; + + if( Operator[0] == '+' ){ + WorkNode->StringResult = Op2; + WorkNode->StringResult += Op1; + } else if( Operator[0] == '-' ) { + WorkNode->StringResult = RTRIM( Op2 ); + WorkNode->StringResult += Op1; + i = WorkNode->StringResult.len(); + for( ; i < ResultLen-1; i++) + WorkNode->StringResult += " "; + } + /* == */ + else if(( strncmp( Operator, "==", 2 ) == 0 ) && strcmp(Op1,Op2) == 0) + WorkNode->IntResult = 1; + + else if(( strncmp( Operator, "==", 2 ) == 0 )) + WorkNode->IntResult = 0; + + /* = */ + else if( Operator[0] == '=' && strcmp(Op1,Op2) == 0 ) + WorkNode->IntResult = 1; + + else if( Operator[0] == '=' ) + WorkNode->IntResult = 0; + + /* not = */ + else if(( strncmp( Operator, "<>", 2 ) == 0 ) || + Operator[0] == '#' || + strncmp( Operator, "!=", 2 ) == 0 ) + WorkNode->IntResult = ( strcmp( Op1, Op2 ) != 0 ) ? 1 : 0; + /* less than */ + else if( Operator[0] == '<' ) + WorkNode->IntResult = ( strcmp( Op2, Op1 ) < 0 ) ? 1 : 0; + /* greater than */ + else if( Operator[0] == '>' ) + WorkNode->IntResult = ( strcmp( Op2, Op1 ) > 0 ) ? 1 : 0; + else if(Operator[0] == '$') + WorkNode->IntResult = (strstr(Op1,Op2)) ? 1 : 0; + else + return XB_PARSE_ERROR; + + Push(WorkNode); + return XB_NO_ERROR; +} +/*************************************************************************/ +#endif // XB_EXPRESSIONS diff --git a/xbase64/xbfields.cpp b/xbase64/xbfields.cpp new file mode 100755 index 0000000..d3e2388 --- /dev/null +++ b/xbase64/xbfields.cpp @@ -0,0 +1,672 @@ +/* xbfields.cpp + + Xbase64 project source code + + This file contains the basic X-Base routines for reading and writing + Xbase fields. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> + +/*! \file xbfields.cpp +*/ +/************************************************************************/ +/* This function returns true if the data is valid logical data */ +//! Determines if data is valid logical data. +/*! Determines if the data in buf is valid for a logical field value. + + \param buf data to be tested + \returns TRUE (non-zero) if valid, FALSE (zero) if not. +*/ +xbShort xbDbf::ValidLogicalData(const char * buf) { + if( buf[0] ) + if( buf[0] == 'T' || buf[0] == 't' || buf[0] == 'F' || buf[0] == 'f' || + buf[0] == 'Y' || buf[0] == 'y' || buf[0] == 'N' || buf[0] == 'n' || + buf[0] == '?' ) + return 1; + return 0; +} +/************************************************************************/ +/* This function returns true if the data is valid numeric data */ +//! Determines if data is valid numeric data. +/*! Determines if the data in buf is valid for a numeric field value. + + \param buf + \returns TRUE (non-zero) if valid, FALSE (zero) if not. +*/ +xbShort xbDbf::ValidNumericData(const char * buf) { + const char *p; + + p = buf; + while( *p ){ + if( *p != '+' && *p != '-' && *p != '.' && *p != '0' && *p != '1' && + *p != '2' && *p != '3' && *p != '4' && *p != '5' && *p != '6' && + *p != '7' && *p != '8' && *p != '9' ) + return 0; + else + p++; + } + return 1; +} +/************************************************************************/ +/* This function returns a fields length */ +//! Returns the length of the specified field. +/*! Returns the length of the field specified by FieldNo. + + \param FieldNo Number of field. + \returns Length of the specified field in bytes. +*/ +xbShort xbDbf::GetFieldLen( xbShort FieldNo ) +{ + if( FieldNo >= 0 && FieldNo < NoOfFields ){ + if( SchemaPtr[FieldNo].Type == 'C' && SchemaPtr[FieldNo].NoOfDecs > 0 ) + return SchemaPtr[FieldNo].LongFieldLen; + else + return SchemaPtr[FieldNo].FieldLen; + } + else + return 0; +} +/************************************************************************/ +/* This function returns a fields decimal length */ +//! Returns the number of decimals in the specified field. +/*! Returns the number of decimals in the field specified by FieldNo. + + \param FieldNo Number of field. + \returns Length of the specified field in bytes. +*/ + +xbShort xbDbf::GetFieldDecimal( xbShort FieldNo ) +{ + if( FieldNo >= 0 && FieldNo < NoOfFields ) + return SchemaPtr[FieldNo].NoOfDecs; + else + return 0; +} +/************************************************************************/ +/* This function returns a fields type */ +//! Returns the type of the specified field. +/*! Returns the type of the field specified by FieldNo. + + \param FieldNo Number of field. + \returns Type of specified field. +*/ +char xbDbf::GetFieldType( xbShort FieldNo ) const +{ + if( FieldNo >= 0 && FieldNo < NoOfFields ) + return SchemaPtr[FieldNo].Type; + else + return 0; +} +/************************************************************************/ +/* This function returns a fields name */ +//! Returns the name of the specified field. +/*! Returns a pointer to the name for the field specified by FieldNo. + + \param FieldNo Number of field. + \returns A pointer to the name of the field. +*/ +char * xbDbf::GetFieldName( xbShort FieldNo ) +{ + if( FieldNo >= 0 && FieldNo < NoOfFields ) + return SchemaPtr[FieldNo].FieldName; + else + return 0; +} +/************************************************************************/ +/* This function returns the field ID number for a given field + or -1 if the field is not one of the fields of the database */ +//! Returns the field number of the specified field. +/*! Returns the field number for the named field. + + \param name Name of field. + \returns Number of field named name. +*/ +xbShort xbDbf::GetFieldNo( const char * name ) const +{ + int i, len1, len2; + + if(( len1 = strlen( name )) > 10 ) + return -1; + + for( i = 0; i < NoOfFields; i++ ){ + len2 = strlen( SchemaPtr[i].FieldName ); + if( len1 == len2 ) + +//#ifndef __WIN32__ +#ifdef HAVE_STRCASECMP + if(!strcasecmp( SchemaPtr[i].FieldName, name )) +#else + if(!stricmp( SchemaPtr[i].FieldName, name )) +#endif + + return i; + } + return -1; +} +/************************************************************************/ +/* + Helpers +*/ + +//! Get the value of the specified field. +/*! Get the value of the field referenced by Name and place its value + in buf. + + \param Name Name of field. + \param buf Buffer to hold field value. Must be large enough to hold + the entire field value. Use GetFieldLen() to determine + the length of the field, if necessary. + \param RecBufSw + \returns One of the following: +*/ +xbShort xbDbf::GetField(const char *Name, char *buf, + const xbShort RecBufSw ) const +{ + return GetField(GetFieldNo(Name), buf, RecBufSw); +} + +/************************************************************************/ +//! Get the value of the specified field. +/*! Get the value of the field specified by Name and place its value + in buf. + + \param Name Name of field. + \param buf Buffer to hold field value. Must be large enough to hold + the entire field value. Use GetFieldLen() to determine + the length of the field, if necessary. + \returns One of the following: +*/ +xbShort xbDbf::GetField(const char *Name, char *buf) const +{ + return GetField(GetFieldNo(Name), buf); +} +/************************************************************************/ +//! Get the raw value of the specified field. +/*! Get the value of the field specified by Name and place its value + in buf. + + \param Name Name of field. + \param buf Buffer to hold field value. Must be large enough to hold + the entire field value. Use GetFieldLen() to determine + the length of the field, if necessary. + \returns One of the following: +*/ +xbShort xbDbf::GetRawField(const char *Name, char *buf) const +{ + return GetRawField(GetFieldNo(Name), buf); +} + +/************************************************************************/ + +// FIXME this function doesn't follow look and feel of the rest of the lib +// GAK + +static char __buf[1024]; + +static void trim(char *s) { + int len = strlen(s)-1; + if (len > 0) { + while ((len != 0) && (s[len] == ' ')) + len--; + s[len+1] = 0; + } +} + +//! Get the value of the specified field. +/*! Returns the value of the field specified by Name. + + \param Name Name of field. + \returns Value of the specified field. +*/ +const char *xbDbf::GetField(const char *Name) const { + GetField(GetFieldNo(Name), __buf); + trim(__buf); + return __buf; +} + +//! Get the value of the specified field. +/*! Returns the value of the field specified by FieldNo. + + \param FieldNo Number of field. + \returns Value of the specified field. +*/ +const char *xbDbf::GetField(xbShort FieldNo) const { + GetField(FieldNo, __buf); + trim(__buf); + return __buf; +} +/************************************************************************/ +/* This function fills a buffer with data from the record buffer + for a particular field number. + + Use GetFieldNo to get a number based on a field's name + + If successful, this function returns the field size. +*/ + +//! Get the value of the specified field. +/*! Get the value of the field specified by FieldNo and place its value + in buf. + + \param FieldNo Number of field. + \param buf Buffer to hold field value. Must be large enough to hold + the entire field value. Use GetFieldLen() to determine + the length of the field, if necessary. + \param RecBufSw + \returns The length of the field. +*/ +xbShort xbDbf::GetField( xbShort FieldNo, char * buf, xbShort RecBufSw) const +{ + xbShort length; + if( FieldNo < 0 || FieldNo >= NoOfFields ) { + buf[0] = 0x00; + return 0x00; + } + +// Check for existence of a long field length + if( SchemaPtr[FieldNo].Type == 'C' && SchemaPtr[FieldNo].NoOfDecs > 0 ) + length = SchemaPtr[FieldNo].LongFieldLen; + else + length = SchemaPtr[FieldNo].FieldLen; + + if( RecBufSw ) + memcpy( buf, SchemaPtr[FieldNo].Address2, length ); + else + memcpy( buf, SchemaPtr[FieldNo].Address, length ); + buf[length] = 0x00; + return( length ); +} +/************************************************************************/ +xbShort xbDbf::GetField( xbShort FieldNo, xbString & sf, xbShort RecBufSw) const +{ + xbShort length; + if( FieldNo < 0 || FieldNo >= NoOfFields ) { + sf = ""; + return 0; + } + + // Check for existence of a long field length + if( SchemaPtr[FieldNo].Type == 'C' && SchemaPtr[FieldNo].NoOfDecs > 0 ) + length = SchemaPtr[FieldNo].LongFieldLen; + else + length = SchemaPtr[FieldNo].FieldLen; + + if( RecBufSw ) + sf.assign( xbString(SchemaPtr[FieldNo].Address2, length), 0, length ); + else + sf.assign( xbString(SchemaPtr[FieldNo].Address, length), 0, length ); + + return( length ); +} +/************************************************************************/ +/* This function fills a field in the record buffer with data from + a buffer for a particular field. + + Use GetFieldNo to get a number based on a field's name + + Field type N or F is loaded as right justified, left blank filled. + Other fields are loaded as left justified, right blank filled. + + This method does check the data's validity. + + If successful, this function returns 0, if invalid data, it returns -1 + or XB_INVALID_FIELDNO +*/ + +//! Put a value into the specified field. +/*! +*/ +xbShort xbDbf::PutField(const char *Name, const char *buf) { + return PutField(GetFieldNo(Name), buf); +} +/************************************************************************/ +//! Put a raw value into the specified field. +/*! +*/ +xbShort xbDbf::PutRawField(const char *Name, const char *buf) { + return PutRawField(GetFieldNo(Name), buf); +} +/************************************************************************/ +//! Put a value into the specified field. +/*! +*/ +xbShort xbDbf::PutField(const xbShort FieldNo, const char *buf) { + xbShort len, i; + char * startpos; + char * tp; /* target pointer */ + const char * sp; /* source pointer */ + + if( FieldNo < 0 || FieldNo >= NoOfFields ) + return XB_INVALID_FIELDNO; + + if( DbfStatus != XB_UPDATED ){ + DbfStatus = XB_UPDATED; + memcpy( RecBuf2, RecBuf, RecordLen ); + } + + if( SchemaPtr[FieldNo].Type == 'L' && !ValidLogicalData( buf )) + return XB_INVALID_DATA; + + else if(( SchemaPtr[FieldNo].Type == 'F' || SchemaPtr[FieldNo].Type == 'N' ) + && !ValidNumericData( buf )) + return XB_INVALID_DATA; + + else if( SchemaPtr[FieldNo].Type == 'D' ){ + xbDate d; + if( !d.DateIsValid( buf )) + return XB_INVALID_DATA; + } + + if( SchemaPtr[FieldNo].Type == 'C' && SchemaPtr[FieldNo].NoOfDecs > 0 ) + memset( SchemaPtr[FieldNo].Address, 0x20, SchemaPtr[FieldNo].LongFieldLen ); + else + memset( SchemaPtr[FieldNo].Address, 0x20, SchemaPtr[FieldNo].FieldLen ); + + len = strlen( buf ); + + if(( SchemaPtr[FieldNo].Type == 'N' || SchemaPtr[FieldNo].Type == 'F') + && len > SchemaPtr[FieldNo].FieldLen ) + return XB_INVALID_DATA; + else if( len > SchemaPtr[FieldNo].FieldLen ) + len = SchemaPtr[FieldNo].FieldLen; + + if( SchemaPtr[FieldNo].Type == 'F' || SchemaPtr[FieldNo].Type == 'N' + || SchemaPtr[FieldNo].Type == 'M') { + + const char *sdp = strchr( buf, '.' ); /* source decimal point */ + len = 0; + sp =buf; + while( *sp && *sp != '.' ) { len++; sp++; } + if( SchemaPtr[FieldNo].NoOfDecs > 0 ){ + /* do the right of decimal area */ + tp = SchemaPtr[FieldNo].Address; + tp += SchemaPtr[FieldNo].FieldLen - SchemaPtr[FieldNo].NoOfDecs - 1; + *tp++ = '.'; + sp = sdp; + if( sp ) sp++; + for( i = 0; i < SchemaPtr[FieldNo].NoOfDecs; i++ ) + if( sp && *sp ) *tp++ = *sp++; else *tp++ = '0'; + + startpos= SchemaPtr[FieldNo].Address + + SchemaPtr[FieldNo].FieldLen - + SchemaPtr[FieldNo].NoOfDecs - len - 1; + } + else + { + startpos=SchemaPtr[FieldNo].Address+SchemaPtr[FieldNo].FieldLen-len; + } + } + else + startpos = SchemaPtr[FieldNo].Address; + + memcpy( startpos, buf, len ); + return 0; +} + +/************************************************************************/ +//! Put a raw value into the specified field. +/*! +*/ +xbShort xbDbf::PutRawField(const xbShort FieldNo, const char *buf) { + xbShort len; + char * startpos; + + if( FieldNo < 0 || FieldNo >= NoOfFields ) + return XB_INVALID_FIELDNO; + + if( DbfStatus != XB_UPDATED ){ + DbfStatus = XB_UPDATED; + memcpy( RecBuf2, RecBuf, RecordLen ); + } + + startpos = SchemaPtr[FieldNo].Address; + len = SchemaPtr[FieldNo].FieldLen; + memcpy( startpos, buf, len ); + + return 0; +} + +/************************************************************************/ +//! Get the value of the specified field. +/*! +*/ +xbShort xbDbf::GetField( xbShort FieldNo, char *buf) const { + return GetField(FieldNo, buf, 0); +} +/************************************************************************/ +//! Get the raw value of the specified field. +/*! +*/ +xbShort xbDbf::GetRawField( xbShort FieldNo, char *buf ) const { + return GetField(FieldNo, buf, 0); +} +/************************************************************************/ +//! Get the long value of the specified field. +/*! +*/ +xbLong xbDbf::GetLongField( xbShort FieldNo ) const +{ + char buf[18]; + memset( buf, 0x00, 18 ); + GetField( FieldNo, buf ); + return atol( buf ); +} +/************************************************************************/ +//! Get the long value of the specified field. +/*! +*/ +xbLong xbDbf::GetLongField( const char * FieldName ) const +{ + return( GetLongField( GetFieldNo( FieldName ))); +} +/************************************************************************/ +//! Put a long value into the specified field. +/*! +*/ +xbShort xbDbf::PutLongField( xbShort FieldNo, xbLong Val ) +{ + char buf[18]; + memset( buf, 0x00, 18 ); + sprintf( buf, "%ld", Val ); + return( PutField( FieldNo, buf )); +} +/************************************************************************/ +//! Put a long value into the specified field. +/*! +*/ +xbShort xbDbf::PutLongField(const char *FieldName, xbLong Val) { + return ( PutLongField( GetFieldNo( FieldName ), Val )); +} +/************************************************************************/ +//! Get the float value of the specified field. +/*! +*/ +xbFloat xbDbf::GetFloatField( xbShort FieldNo ) +{ + char buf[21]; + memset( buf, 0x00, 21 ); + if( GetField( FieldNo, buf ) != 0 ) + return atof( buf ); + else + return 0; +} +/************************************************************************/ +//! Get the float value of the specified field. +/*! +*/ +xbFloat xbDbf::GetFloatField(const char * FieldName) { + xbShort fnum; + if((fnum = GetFieldNo(FieldName)) != -1) + return GetFloatField(fnum); + else + return 0; +} +/************************************************************************/ +//! Put a float value into the specified field. +/*! +*/ +xbShort xbDbf::PutFloatField( xbShort FldNo, xbFloat f ) +{ + char buf[25]; + char buf2[12]; + memset( buf, 0x00, 25 ); + memset( buf2, 0x00, 12 ); + sprintf( buf, "%d.%df", GetFieldLen( FldNo ), GetFieldDecimal( FldNo )); + strcpy( buf2, "%-" ); + strcat( buf2, buf ); + sprintf( buf, buf2, f ); + + /* remove trailing space */ + xbShort i = 0; + while( i < 25 ) + if( buf[i] == 0x20 ){ + buf[i] = 0x00; + break; + } else + i++; + return PutField( FldNo, buf ); +} +/************************************************************************/ +//! Put a float value into the specified field. +/*! +*/ +xbShort xbDbf::PutFloatField(const char *FieldName, xbFloat f) { + xbShort fnum; + if ((fnum = GetFieldNo(FieldName)) != -1) + return PutFloatField(fnum, f); + else + return 0; +} +/************************************************************************/ +//! Get the double value of the specified field. +/*! +*/ +xbDouble xbDbf::GetDoubleField( xbShort FieldNo, xbShort RecBufSw ) +{ + char buf[21]; + memset( buf, 0x00, 21 ); + if( GetField( FieldNo, buf, RecBufSw ) != 0 ) + return strtod( buf, NULL ); + else + return 0; +} +/************************************************************************/ +//! Get the double value of the specified field. +/*! +*/ +xbDouble xbDbf::GetDoubleField(const char *FieldName) { + xbShort fnum; + if ((fnum = GetFieldNo(FieldName)) != -1) + return GetDoubleField(fnum); + else + return 0; +} +/************************************************************************/ +//! Put a double value into the specified field. +/*! +*/ +xbShort xbDbf::PutDoubleField( xbShort FieldNo, xbDouble d) { + return PutFloatField(FieldNo, (xbFloat)d); +} +/************************************************************************/ +//! Put a double value into the specified field. +/*! +*/ +xbShort xbDbf::PutDoubleField(const char *FieldName, xbDouble d) { + xbShort fnum; + if ((fnum = GetFieldNo(FieldName)) != -1) + return PutFloatField(fnum, (xbFloat)d); + else + return 0; +} +/************************************************************************/ +//! Get the logical value of the specified field. +/*! +*/ +xbShort xbDbf::GetLogicalField( xbShort FieldNo ) +{ + char buf[3]; + if( GetFieldType( FieldNo ) != 'L' ) return -1; + memset( buf, 0x00, 3 ); + GetField( FieldNo, buf ); + if( buf[0] == 'Y' || buf[0] == 'y' || buf[0] == 'T' || buf[0] == 't' ) + return 1; + else + return 0; +} +/************************************************************************/ +//! Get the logical value of the specified field. +/*! +*/ +xbShort xbDbf::GetLogicalField( const char * FieldName ) +{ + xbShort fnum; + if(( fnum = GetFieldNo( FieldName )) != -1 ) + return GetLogicalField( fnum ); + else + return -1; +} +/************************************************************************/ +//! Get the string value of the specified field. +/*! +*/ +char * xbDbf::GetStringField( const char * FieldName ) +{ + return GetStringField(GetFieldNo(FieldName)); +} +/************************************************************************/ +//! Get the string value of the specified field. +/*! +*/ +char * xbDbf::GetStringField( xbShort FieldNo ) +{ + /* allocate memory if needed */ + if( !SchemaPtr[FieldNo].fp ) + SchemaPtr[FieldNo].fp = new char[GetFieldLen(FieldNo)+1]; + + if( !SchemaPtr[FieldNo].fp ) + return 0; + + GetField( FieldNo, SchemaPtr[FieldNo].fp ); + return SchemaPtr[FieldNo].fp; +} +/************************************************************************/ diff --git a/xbase64/xbfile.cpp b/xbase64/xbfile.cpp new file mode 100755 index 0000000..0064a88 --- /dev/null +++ b/xbase64/xbfile.cpp @@ -0,0 +1,69 @@ +/* xbfile.cpp + + Xbase64 project source code + + This file contains logic for the basic Xbase class. + + Copyright (C) 1997,2003,2004 Gary A Kunkel + Sergiy Yakovin + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbfile.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> +
+xbString xbFile::MakeFileName(const char *name)
+{
+ xbString file=name;
+ if (file.isEmpty()) return file;
+ int len=strlen(name);
+ const char *extLower=GetExtWithDot(true);
+ const char *extUpper=GetExtWithDot(false);
+ int lenLower=strlen(extLower);
+ int lenUpper=strlen(extUpper);
+ if (len>lenLower && strcmp(&name[len-lenLower], extLower)==0 ||
+ len>lenUpper && strcmp(&name[len-lenUpper], extUpper)==0) return file;
+ char lastSymbol=name[len-1];
+ file+=GetExtWithDot(lastSymbol<'A' || lastSymbol>'Z');
+ return file;
+}
+ diff --git a/xbase64/xbfile.h b/xbase64/xbfile.h new file mode 100755 index 0000000..50c69e9 --- /dev/null +++ b/xbase64/xbfile.h @@ -0,0 +1,70 @@ +/* xbfile.h + + Xbase project source code + + This file conatains a header file for the xbLock virtual objects which + is used for controlling file and record locking. Record and file + locking has been rewritten in version 3. + + Copyright (C) 1997,2003,2004 Gary A Kunkel + Sergio Yakovin + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +/*! \file xblock.h +*/ + +#ifndef __XB_FILE_H__
+#define __XB_FILE_H__
+ +#ifdef __GNU LesserG__ +#pragma interface +#endif + +class XBDLLEXPORT xbFile
+{
+ public:
+ xbFile(){}
+ virtual const char* GetExtWithDot(bool lower)=0;
+ const xbString& GetFileName() {return fileName_;}
+ xbString MakeFileName(const char* filename);
+ + protected:
+ void SetFileName(const char *filename)
+ {
+ fileName_=MakeFileName(filename);
+ }
+
+ private:
+ xbString fileName_;
+};
+
+#endif
// XBFILE_H diff --git a/xbase64/xbfilter.cpp b/xbase64/xbfilter.cpp new file mode 100755 index 0000000..104e113 --- /dev/null +++ b/xbase64/xbfilter.cpp @@ -0,0 +1,231 @@ +/* xbfilter.cpp + + Xbase project source code + + This file conatains logic for the xbfilter class. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbfilter.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> +//#include <xbase64/xbexcept.h> + +/*! \file xbfilter.cpp +*/ + +#ifdef XB_FILTERS +/************************************************************************/ +//! Constructor. +/*! + \param dbf + \param index + \param exp +*/ +xbFilter::xbFilter( xbDbf * dbf, xbIndex * index, char * exp ) +{ + xbShort rc; + Status = 0; + CurFilterRecNo = 0L; + d = dbf; + i = index; +// e = 0; + + + flExpn = new xbExpn( d->xbase ); + if(( rc = flExpn->ParseExpression( exp, d )) != XB_NO_ERROR ) + Status = rc; + else{ + if( flExpn->GetExpressionResultType() != 'L' ) + Status = XB_PARSE_ERROR; + } +} + +/***********************************************************************/ +//! Destructor. +/*! +*/ +xbFilter::~xbFilter() +{ + if( flExpn ) + delete flExpn; +} + +/***********************************************************************/ +//! Short description. +/*! +*/ +xbShort xbFilter::GetFirstFilterRec() +{ + xbShort rc; + + if( Status ) + return Status; + + if( i ) + rc = i->GetFirstKey(); + else + rc = d->GetFirstRecord(); + + while( rc == XB_NO_ERROR ){ + if(( rc = flExpn->ProcessExpression()) != XB_NO_ERROR ) + return rc; + + if( flExpn->GetIntResult() ) + { + CurFilterRecNo = d->GetCurRecNo(); + return XB_NO_ERROR; + } + if( i ) + rc = i->GetNextKey(); + else + rc = d->GetNextRecord(); + } + return rc; +} +/***********************************************************************/ +//! Short description. +/*! +*/ +xbShort xbFilter::GetLastFilterRec() +{ + xbShort rc; + + if( Status ) + return Status; + + if( i ) + rc = i->GetLastKey(); + else + rc = d->GetLastRecord(); + + while( rc == XB_NO_ERROR ){ + if(( rc = flExpn->ProcessExpression()) != XB_NO_ERROR ) + return rc; + + if( flExpn->GetIntResult() ) + { + CurFilterRecNo = d->GetCurRecNo(); + return XB_NO_ERROR; + } + if( i ) + rc = i->GetPrevKey(); + else + rc = d->GetPrevRecord(); + } + return rc; +} +/***********************************************************************/ +//! Short description. +/*! +*/ +xbShort xbFilter::GetNextFilterRec() +{ + xbShort rc; + + if( Status ) + return Status; + + if( !CurFilterRecNo ) + return GetFirstFilterRec(); + + if( i ){ + rc = i->GetNextKey(); + } + else + rc = d->GetNextRecord(); + + while( rc == XB_NO_ERROR ){ + if(( rc = flExpn->ProcessExpression()) != XB_NO_ERROR ) + return rc; + + if( flExpn->GetIntResult()) + { + CurFilterRecNo = d->GetCurRecNo(); + return XB_NO_ERROR; + } + if( i ) + rc = i->GetNextKey(); + else + rc = d->GetNextRecord(); + } + return rc; +} +/***********************************************************************/ +//! Short description. +/*! +*/ +xbShort xbFilter::GetPrevFilterRec() +{ + xbShort rc; + + if( Status ) + return Status; + + if( !CurFilterRecNo ) + return GetLastFilterRec(); + + if( i ){ + rc = i->GetPrevKey(); + } + else + rc = d->GetPrevRecord(); + + while( rc == XB_NO_ERROR ){ + if(( rc = flExpn->ProcessExpression()) != XB_NO_ERROR ) + return rc; + + if( flExpn->GetIntResult()) + { + CurFilterRecNo = d->GetCurRecNo(); + return XB_NO_ERROR; + } + if( i ) + rc = i->GetPrevKey(); + else + rc = d->GetPrevRecord(); + } + return rc; +} +/***********************************************************************/ +#endif // XB_FILTERS_ON diff --git a/xbase64/xbfilter.h b/xbase64/xbfilter.h new file mode 100755 index 0000000..578a1da --- /dev/null +++ b/xbase64/xbfilter.h @@ -0,0 +1,75 @@ +/* xbfilter.h + + Xbase project source code + + This file conatains a header file for the xbFilter object which + is used for filtering data. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +/*! \file xbfilter.h +*/ + +#ifndef __XB_FILTER_H__ +#define __XB_FILTER_H__ + +#ifdef __GNU LesserG__ +#pragma interface +#endif + +//! xbFilter class +/*! +*/ + +class XBDLLEXPORT xbFilter +{ +public: + xbFilter( xbDbf * dbf, xbIndex * index, char * expression ); + virtual ~xbFilter(); + + xbShort GetFirstFilterRec(); + xbShort GetLastFilterRec(); + xbShort GetNextFilterRec(); + xbShort GetPrevFilterRec(); + xbShort GetStatus() { return Status; } + +protected: + xbULong CurFilterRecNo; + xbShort Status; + xbExpn * flExpn; + xbDbf *d; + xbIndex *i; +}; + +#endif diff --git a/xbase64/xbindex.cpp b/xbase64/xbindex.cpp new file mode 100755 index 0000000..f3a9c17 --- /dev/null +++ b/xbase64/xbindex.cpp @@ -0,0 +1,220 @@ +/* xbindex.cpp + + Xbase64 project source code + + This file contains the implementation of the xbIndex class. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbindex.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> + +#include <stdio.h> +#include <stdlib.h> + +/*! \file xbindex.cpp +*/ + +#ifdef XB_INDEX_ANY +//! Constructor +/*! + \param pdbf +*/ +xbIndex::xbIndex(xbDbf * pdbf) +{ + index = this; + dbf = pdbf; +// ExpressionTree = NULL; + IxExp = NULL; + indexfp = NULL; +// IndexStatus = 0; + CurDbfRec = 0L; + KeyBuf = NULL; + KeyBuf2 = NULL; +#ifdef XB_LOCKING_ON + LockCnt = 0; + + CurLockCount = 0; + CurLockType = -1; +#endif // XB_LOCKING_ON +} + +/*************************************************************************/ + +//! Destructor +/*! + \param pdbf +*/ +xbIndex::~xbIndex() +{ + if( IxExp ){ + delete IxExp; + IxExp = NULL; + } +} +/*************************************************************************/ + +void xbIndex::Flush() +{ + if(indexfp) fflush(indexfp); +} + +/*************************************************************************/ +xbShort xbIndex::OpenIndex(const char* FileName) +{ + if (IsOpen()) return XB_ALREADY_OPEN; + + int rc; + + SetFileName(FileName); + + /* open the file */ + if(( indexfp = fopen( GetFileName(), "r+b" )) == NULL ){ + // + // Try to open read only if can't open read/write + // + if(( indexfp = fopen( GetFileName(), "rb" )) == NULL ) + return XB_OPEN_ERROR; + } + +#ifdef XB_LOCKING_ON + /* + ** Must turn off buffering when multiple programs may be accessing + ** index files. + */ + setbuf( indexfp, NULL ); +#endif + +// IndexStatus = 1; + if(( rc = GetHeadNode()) != 0){ + fclose( indexfp ); + return rc; + } + + /* parse the expression */ +/* pre 3.0 + if(( rc = dbf->xbase->BuildExpressionTree( HeadNode.KeyExpression, + strlen( HeadNode.KeyExpression ), dbf )) != XB_NO_ERROR ){ + return rc; + } + ExpressionTree = dbf->xbase->GetTree(); + dbf->xbase->SetTreeToNull(); +*/ + IxExp = new xbExpn( dbf->xbase ); + if(( rc = IxExp->BuildExpressionTree( GetKeyExpression(), + strlen( GetKeyExpression() ), dbf )) != XB_NO_ERROR ){ + fclose( indexfp ); + return rc; + } + + rc=AllocKeyBufs(); + if(rc){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + fclose(indexfp); + return rc; + } + +#ifdef XBASE_DEBUG +// CheckIndexIntegrity( 0 ); +#endif + +#ifdef XB_LOCKING_ON + //if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + + rc = dbf->AddIndexToIxList( index, GetFileName() ); + return rc; +} +/*************************************************************************/ +//! Short description. +/*! +*/ +xbShort xbIndex::AllocKeyBufs() +{ + KeyBuf = (char *) malloc( GetKeyLen() + 1 ); + if(KeyBuf==NULL) { + return XB_NO_MEMORY; + }; + KeyBuf2 = (char *) malloc( GetKeyLen() + 1); + if(KeyBuf2==NULL) { + free(KeyBuf); + return XB_NO_MEMORY; + }; + memset( KeyBuf, 0x00, GetKeyLen() + 1 ); + memset( KeyBuf2, 0x00, GetKeyLen() + 1 ); + return XB_NO_ERROR; +} +/***********************************************************************/ + +xbShort xbIndex::CloseIndex( void ) +{ + if(KeyBuf){ + free(KeyBuf); + KeyBuf = NULL; + } + if(KeyBuf2){ + free(KeyBuf2); + KeyBuf2 = NULL; + } + + dbf->RemoveIndexFromIxList( index ); // why not 'this'? + FreeNodesMemory(); + if( IxExp ){ + delete IxExp; + IxExp = 0; + } + + if(indexfp){ + fclose( indexfp ); + indexfp = NULL; + } +// IndexStatus = 0; + return 0; +} +/***********************************************************************/ + +#endif // XB_INDEX_ANY diff --git a/xbase64/xbindex.h b/xbase64/xbindex.h new file mode 100755 index 0000000..69f55dc --- /dev/null +++ b/xbase64/xbindex.h @@ -0,0 +1,137 @@ +/* xbindex.h
+
+ Xbase64 project source code
+
+ This file contains a header file for the NTX object, which is used
+ for handling NTX type indices. NTX are the Clipper equivalant of xbNdx
+ files.
+
+ Copyright (C) 1998 SynXis Corp., Bob Cotton
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser 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
+
+
+ Contact:
+
+ Email:
+
+ xdb-devel@lists.sourceforge.net
+ xdb-users@lists.sourceforge.net
+
+
+ Regular Mail:
+
+ XBase Support
+ 149C South Main St
+ Keller Texas, 76248
+ USA
+
+*/
+
+#ifndef __XB_INDEX_H__
+#define __XB_INDEX_H__
+
+#ifdef __GNU LesserG__
+#pragma interface
+#endif
+
+#include <xbase64/xbase64.h>
+#include <string.h>
+/*! \file xbindex.h
+*/
+
+#define XB_UNIQUE 1
+#define XB_NOT_UNIQUE 0
+
+//! xbIndex class
+/*!
+*/
+
+class XBDLLEXPORT xbIndex: protected xbFile
+{
+ public:
+ xbIndex() {}
+ xbIndex(xbDbf *);
+
+ virtual ~xbIndex();
+
+ xbShort OpenIndex ( const char * );
+ xbShort CloseIndex();
+ virtual xbShort CreateIndex( const char *, const char *, xbShort, xbShort ) = 0; + virtual xbLong GetTotalNodes() = 0;
+ virtual xbULong GetCurDbfRec() = 0;
+ virtual xbShort CreateKey( xbShort, xbShort ) = 0;
+ virtual xbShort GetCurrentKey(char *key) = 0;
+ virtual xbShort AddKey( xbLong ) = 0;
+ virtual xbShort UniqueIndex() = 0;
+ virtual xbShort DeleteKey( xbLong ) = 0;
+ virtual xbShort KeyWasChanged() = 0;
+ virtual xbShort FindKey( const char * ) = 0;
+ virtual xbShort FindKey() = 0;
+ virtual xbShort FindKey( xbDouble ) = 0;
+ virtual xbShort GetNextKey() = 0;
+ virtual xbShort GetLastKey() = 0;
+ virtual xbShort GetFirstKey() = 0;
+ virtual xbShort GetPrevKey() = 0;
+ virtual xbShort ReIndex(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0) = 0;
+// virtual xbShort KeyExists( char * Key ) { return FindKey( Key, strlen( Key ), 0 ); }
+ virtual xbShort KeyExists( xbDouble ) = 0;
+ virtual xbShort TouchIndex() { return XB_NO_ERROR; }
+ virtual void SetNodeSize(xbShort size) {}
+ virtual xbShort GetNodeSize() { return NodeSize; }
+ virtual void GetExpression(char *buf, int len) = 0;
+ virtual void Flush();
+ virtual const char * GetIxName() {return GetFileName().getData();}
+ xbShort AllocKeyBufs();
+ xbBool IsOpen() {return indexfp!=NULL;}
+
+#ifdef XBASE_DEBUG
+ virtual void DumpHdrNode( xbShort Option ) = 0;
+ virtual void DumpNodeRec( xbLong ) = 0;
+ virtual void DumpNodeChain() = 0;
+ virtual xbShort CheckIndexIntegrity( xbShort ) = 0;
+#endif
+
+#ifdef XB_LOCKING_ON
+// xbShort LockIndex( xbShort LockType );
+// virtual xbShort LockIndex( const xbShort, const xbShort );
+#else
+// virtual xbShort LockIndex( const xbShort, const xbShort ) const { return XB_NO_ERROR; }
+#endif
+
+ protected:
+ virtual xbShort GetHeadNode()=0;
+ virtual xbUShort GetKeyLen()=0;
+ virtual const char* GetKeyExpression()=0;
+ virtual void FreeNodesMemory()=0;
+
+ xbIndex *index;
+ xbDbf *dbf;
+ xbExpn *IxExp; /* index expression defines keys */
+ FILE *indexfp;
/* NULL = closed, other = open */ +// int IndexStatus; /* old - 0 = closed, 1 = open */
+ xbULong CurDbfRec; /* current Dbf record number */
+ char *KeyBuf; /* work area key buffer */
+ char *KeyBuf2; /* work area key buffer */
+ xbShort NodeSize;
+
+#ifdef XB_LOCKING_ON
+ int LockCnt; /* current index lock count */
+ int CurLockCount; /* old locking field */
+ int CurLockType; /* old locking field */
+#endif
+};
+
+#endif /* __XB_INDEX_H__ */
diff --git a/xbase64/xblock.cpp b/xbase64/xblock.cpp new file mode 100755 index 0000000..c44cbb9 --- /dev/null +++ b/xbase64/xblock.cpp @@ -0,0 +1,580 @@ +/* xblock.cpp + + Xbase64 project source code + written at 35000 feet on SWA + + This file contains the implementation of the xbLock. + + This file conatains a header file for the xbLock virtual objects which + is used for controlling file and record locking. Record and file + locking has been rewritten in version 3. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xblock.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> + +#ifdef HAVE_IO_H // windows locking +#include <io.h> +#endif + +#ifdef HAVE_DOS_H // _sleep +#include <dos.h> +#endif + +//#include <stdio.h> +//#include <stdlib.h> + +/*! \file xblock.cpp +*/ +#ifdef XB_LOCKING_ON + +//! Constructor +/*! + \param pdbf +*/ + +/*************************************************************************/ +xbLock::xbLock(xbDbf * pdbf) +{ + dbf = pdbf; + HdrLockCnt = 0; + TableLockCnt = 0; + MemoLockCnt = 0; + IndexLockCnt = 0; + std::cout << "xbLock constructor" << std::cout; +} +/*************************************************************************/ +xbLock::~xbLock() +{ + std::cout << "xbLock destructor" << std::endl; +} +/*************************************************************************/ + +//! File lock routine +/*! + Lowest level lock routine + Locks/unlocks a database,memo or index file. + This function assumes the file position has been correctly set + + \param fn file to lock/unlock + \param LockType lock type, one of: XB_LOCK or XB_UNLOCK + \param lockLen byte count to lock +*/ + +#ifdef __WIN32__ +xbShort xbLock::LockFile( int fn, xbShort LockType, xbOffT lockLen) +{ + int mode; + int rc; + int tries = 0; + + /* convert the xbase locking command into a windows locking command */ + if( LockType == XB_UNLOCK ) + mode = LK_UNLCK; + else if( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) + mode = LK_NBLCK; + else + return XB_INVALID_LOCK_OPTION; + + do{ + rc = locking( fn, mode, lockLen ); + if( rc ) + _sleep( 1 ); + } while( rc == -1 && tries < dbf->xbase->GetLockRetryCount()); + + if( rc ) + return XB_LOCK_FAILED; + + return 0; +} + +#elif HAVE_FCNTL_H + +xbShort xbLock::LockFile( int fn, xbShort LockType, xbOffT lockLen ) +{ + xbShort cmd, rc; + xbShort tries = 0; + +/* convert cross platform xbase lock type to unix lock type */ + if( LockType == XB_UNLOCK ) + cmd = F_ULOCK; +else if( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) + cmd = F_TLOCK; + else + return XB_INVALID_LOCK_OPTION; + +/* do the actual lock */ + do{ + #ifdef _LARGEFILE64_SOURCE + rc = lockf64( fn, cmd, lockLen ); + #else + rc = lockf( fn, cmd, lockLen ); + #endif + if( rc == -1 && errno != EINTR ){ + tries++; + sleep(1); + } + } while( rc == -1 && tries < dbf->xbase->GetLockRetryCount()); + + if( rc ) + return XB_LOCK_FAILED; + + return XB_NO_ERROR; +} +#endif // HAVE_FCNTL +/*************************************************************************/ +/*************************************************************************/ +xbaseLock::xbaseLock( xbDbf * pdbf ) : xbLock( pdbf ) +{ + std::cout << "xbaseLock constructor" << std::cout; +} +/*************************************************************************/ +xbShort xbaseLock::LockTableHeader( xbShort LockType ) +{ + if( LockType == XB_UNLOCK ) + return XB_NO_ERROR; + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +xbShort xbaseLock::LockTable( xbShort LockType ) +{ + if(( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) && TableLockCnt ){ + TableLockCnt++; + return XB_NO_ERROR; + } + if( LockType == XB_UNLOCK && TableLockCnt > 1 ){ + TableLockCnt--; + return XB_NO_ERROR; + } + +#ifdef _LARGEFILE64_SOURCE + if( lseek64( fileno( lfh ), 1, SEEK_SET ) != 1 ) + return XB_LOCK_FAILED; + + if( LockFile( fileno( lfh ), LockType, 4294967295LL ) != XB_NO_ERROR ) + return XB_LOCK_FAILED; +#else + if( lseek( fileno( lfh ), 1, SEEK_SET ) != 1 ) + return XB_LOCK_FAILED; + + if( LockFile( fileno( lfh ), LockType, 4294967295L ) != XB_NO_ERROR ) + return XB_LOCK_FAILED; +#endif + + if( LockType == XB_UNLOCK ) + TableLockCnt--; + else + TableLockCnt++; + + return XB_NO_ERROR; +} +/*************************************************************************/ +xbShort xbaseLock::LockRecord(xbShort LockType,xbULong RecNo,xbOffT RecCnt) +{ + +#ifdef _LARGEFILE64_SOURCE + if( lseek64( fileno( lfh ), 100L + RecNo, SEEK_SET ) == -1 ){ + return XB_LOCK_FAILED; + } +#else + if( lseek( fileno( lfh ), 100L + RecNo, SEEK_SET ) == -1 ){ + return XB_LOCK_FAILED; + } +#endif + + return LockFile( fileno( lfh ), LockType, (xbOffT) RecCnt ); +} +/*************************************************************************/ +xbShort xbaseLock::LockMemo( xbShort LockType ) +{ + xbShort rc; + + if(( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) && MemoLockCnt ){ + MemoLockCnt++; + return XB_NO_ERROR; + } + else if ( LockType == XB_UNLOCK && MemoLockCnt > 1 ){ + MemoLockCnt--; + return XB_NO_ERROR; + } + +#ifdef _LARGEFILE64_SOURCE + if( lseek64( fileno( lfh ), 2, SEEK_SET ) != 2 ) + return XB_LOCK_FAILED; +#else + if( lseek( fileno( lfh ), 2, SEEK_SET ) != 2 ) + return XB_LOCK_FAILED; +#endif + rc = LockFile( fileno( lfh ), LockType, 1 ); + + if( rc == XB_NO_ERROR ){ + if( LockType == XB_UNLOCK ) + MemoLockCnt--; + else + MemoLockCnt++; + } + return rc; +} +/*************************************************************************/ +//! Lock Index +/*! + Locks all indices for a table when using lock mode XB_XBASE_LOCK_MODE + + \param LockType is one of XB_LOCK, XB_LOCK_HOLD or XB_UNLOCK +*/ + +xbShort xbaseLock::LockIndex( xbShort LockType ) +{ + xbShort rc; + +// if( !NdxList ) +// printf( "no index\n" ); + + if(( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) && IndexLockCnt ){ + IndexLockCnt++; + return XB_NO_ERROR; + } + if( LockType == XB_UNLOCK && IndexLockCnt > 1 ){ + IndexLockCnt--; + return XB_NO_ERROR; + } + +#ifdef _LARGEFILE64_SOURCE + if( lseek64( fileno( lfh ), 3, SEEK_SET ) == -1 ){ + printf( "here cp1\n"); + return XB_LOCK_FAILED; + } +#else + if( lseek( fileno( lfh ), 3, SEEK_SET ) == -1 ){ + printf( "here cp2\n" ); + return XB_LOCK_FAILED; + } +#endif + + rc = LockFile( fileno( lfh ), LockType, 1 ); + + if( rc == XB_NO_ERROR ) + if( LockType == XB_UNLOCK ) + IndexLockCnt--; + else + IndexLockCnt++; + + return rc; +} +/*************************************************************************/ +xbShort xbaseLock::UnlockAll() +{ + return XB_INVALID_LOCK_OPTION; +} +/************************************************************************/ +xbShort xbaseLock::LockInit() +{ + xbShort len; + xbString lfn; + + lfn = dbf->GetDbfName(); + lfn.resize( lfn.len() - 3 ); + + lfn += ".lck"; + +#ifdef _LARGEFILE_SOURCE + if(( lfh = fopen64( lfn.getData(), "w+b" )) == NULL ) + return XB_OPEN_ERROR; +#else + if(( lfh = fopen( lfn.getData(), "w+b" )) == NULL ) + return XB_OPEN_ERROR; +#endif + + else + return XB_NO_ERROR; +} + +/*************************************************************************/ +/*************************************************************************/ +dbaseLock::dbaseLock( xbDbf * pdbf ) : xbLock( pdbf ) +{ + std::cout << "dbaseLock constructor" << std::cout; +} +/*************************************************************************/ +xbShort dbaseLock::LockTableHeader( xbShort LockType ) +{ + if( LockType == XB_UNLOCK ) + return XB_NO_ERROR; + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +xbShort dbaseLock::LockTable( xbShort LockType ) +{ + + if(( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) && TableLockCnt ){ + TableLockCnt++; + return XB_NO_ERROR; + } + if( LockType == XB_UNLOCK && TableLockCnt > 1 ){ + TableLockCnt--; + return XB_NO_ERROR; + } + +#ifdef _LARGEFILE64_SOURCE + if( lseek64( dbf->GetDbfFileNo(), 4026531838LL, SEEK_SET )) + return XB_LOCK_FAILED; + + if( LockFile( dbf->GetDbfFileNo(), LockType, 1 ) != XB_NO_ERROR ) + return XB_LOCK_FAILED; + + if( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ){ + if( LockRecord( XB_LOCK, 1, 4294967295LL ) != XB_NO_ERROR ) + return LockTable( XB_UNLOCK ); + LockRecord( XB_UNLOCK, 1, 4294967295LL ); + } + + if( LockType == XB_UNLOCK ) + TableLockCnt--; + else + TableLockCnt++; + + return XB_NO_ERROR; +#else + /* I couldn't figure out how Dbase locks a file at offset 4026531838 + for a 32 bit platform - if you know how, please let me know + + Gary - gkunkel@zhsac.com + + */ + + return XB_INVALID_LOCK_OPTION; +#endif + +} + +/*************************************************************************/ +xbShort dbaseLock::LockRecord( xbShort LockType, xbULong RecNo, xbOffT RecCnt ) +{ +#ifdef _LARGEFILE64_SOURCE + + if( lseek64( dbf->GetDbfFileNo(), 4026531838LL - (RecNo+RecCnt-1), SEEK_SET ) == -1 ) + return XB_LOCK_FAILED; + + return LockFile( dbf->GetDbfFileNo(), LockType, RecCnt ); + +#else + + /* I couldn't figure out how dbase locks a file at offset 4026531838 + for a 32 bit platform - if you know how, please let me know + + Gary - gkunkel@zhsac.com + + */ + + return XB_INVALID_LOCK_OPTION; +#endif +} + +/*************************************************************************/ +xbShort dbaseLock::LockMemo( xbShort LockType ) +{ + + xbShort rc; + + if(( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) && MemoLockCnt ){ + MemoLockCnt++; + return XB_NO_ERROR; + } + else if ( LockType == XB_UNLOCK && MemoLockCnt > 1 ){ + MemoLockCnt--; + return XB_NO_ERROR; + } + +#ifdef _LARGEFILE_SOURCE + if( lseek64( dbf->GetMemoFileNo(), 4026531838LL, SEEK_SET ) == -1 ) + return XB_LOCK_FAILED; + rc = LockFile( dbf->GetMemoFileNo(), LockType, 1 ); +#else + rc = XB_INVALID_OPTION; +#endif + + if( rc == XB_NO_ERROR ){ + if( LockType == XB_UNLOCK ) + MemoLockCnt--; + else + MemoLockCnt++; + } + return rc; +} +/*************************************************************************/ +xbShort dbaseLock::LockIndex( xbShort LockType ) +{ + if( LockType == XB_NO_ERROR ) + return XB_NO_ERROR; + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +xbShort dbaseLock::UnlockAll() +{ + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +/*************************************************************************/ +clipperLock::clipperLock( xbDbf * pdbf ) : xbLock( pdbf ) +{ + std::cout << "clipperLock constructor" << std::cout; +} +/*************************************************************************/ +xbShort clipperLock::LockTableHeader( xbShort LockType ) +{ + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +xbShort clipperLock::LockTable( xbShort LockType ) +{ + if(( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) && TableLockCnt ){ + TableLockCnt++; + return XB_NO_ERROR; + } + if( LockType == XB_UNLOCK && TableLockCnt > 1 ){ + TableLockCnt--; + return XB_NO_ERROR; + } + + if( LockRecord( LockType, 1L, 1000000000L ) != XB_NO_ERROR ) + return XB_LOCK_FAILED; + + if( LockType == XB_UNLOCK ) + TableLockCnt--; + else + TableLockCnt++; + + return XB_NO_ERROR; +} +/*************************************************************************/ +xbShort clipperLock::LockRecord( + xbShort LockType, xbULong RecNo, xbOffT RecCnt ) +{ + +#ifdef _LARGEFILE64_SOURCE + if( lseek64( dbf->GetDbfFileNo(), 1000000000L + RecNo, SEEK_SET )) + return XB_LOCK_FAILED; +#else + if( lseek( dbf->GetDbfFileNo(), 1000000000L + RecNo, SEEK_SET )) + return XB_LOCK_FAILED; +#endif + + return LockFile( dbf->GetDbfFileNo(), LockType, RecCnt ); +} +/*************************************************************************/ +xbShort clipperLock::LockMemo( xbShort LockType ) +{ + return XB_NO_ERROR; +} +/*************************************************************************/ +xbShort clipperLock::LockIndex( xbShort LockType ) +{ + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +xbShort clipperLock::UnlockAll() +{ + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +/*************************************************************************/ +foxproLock::foxproLock( xbDbf * pdbf ) : xbLock( pdbf ) +{ + std::cout << "foxproLock constructor" << std::cout; +} +/*************************************************************************/ +xbShort foxproLock::LockTableHeader( xbShort LockType ) +{ + + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +xbShort foxproLock::LockTable( xbShort LockType ) +{ + + if(( LockType == XB_LOCK || LockType == XB_LOCK_HOLD ) && TableLockCnt ){ + TableLockCnt++; + return XB_NO_ERROR; + } + if( LockType == XB_UNLOCK && TableLockCnt > 1 ){ + TableLockCnt--; + return XB_NO_ERROR; + } + + +// something goes in here + + + if( LockType == XB_UNLOCK ) + TableLockCnt--; + else + TableLockCnt++; + + return XB_NO_ERROR; + +} +/*************************************************************************/ +xbShort foxproLock::LockRecord( xbShort LockType, xbULong RecNo, xbOffT len ) +{ + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +xbShort foxproLock::LockMemo( xbShort LockType ) +{ + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +xbShort foxproLock::LockIndex( xbShort LockType ) +{ + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ +xbShort foxproLock::UnlockAll() +{ + return XB_INVALID_LOCK_OPTION; +} +/*************************************************************************/ + +#endif // XB_LOCKING_ON + diff --git a/xbase64/xblock.h b/xbase64/xblock.h new file mode 100755 index 0000000..50dfcf2 --- /dev/null +++ b/xbase64/xblock.h @@ -0,0 +1,159 @@ +/* xblock.h + + Xbase project source code + + This file conatains a header file for the xbLock virtual objects which + is used for controlling file and record locking. Record and file + locking has been rewritten in version 3. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +/*! \file xblock.h +*/ + +#ifndef __XB_XBLOCK_H__ +#define __XB_XBLOCK_H__ + +#ifdef __GNU LesserG__ +#pragma interface +#endif + +#ifdef XB_LOCKING_ON + +//! xbLock class +/*! +*/ + +class XBDLLEXPORT xbLock +{ +public: + xbLock( xbDbf * dbf ); + virtual ~xbLock(); + virtual xbShort LockTableHeader( xbShort LockType ) = 0; + virtual xbShort LockTable( xbShort LockType ) = 0; + virtual xbShort LockRecord( xbShort LockType, xbULong RecNo, xbOffT len ) = 0; + virtual xbShort LockMemo( xbShort LockType ) = 0; + virtual xbShort LockIndex( xbShort LockType ) = 0; + virtual xbShort UnlockAll() = 0; + virtual xbShort LockInit() { return XB_NO_ERROR; } + +protected: + xbDbf *dbf; + xbShort HdrLockCnt; + xbShort TableLockCnt; + xbShort MemoLockCnt; + xbShort IndexLockCnt; + xbShort LockFile( int fn, xbShort LockType, xbOffT lockLen ); +}; + +class XBDLLEXPORT xbaseLock : xbLock +{ +public: + xbaseLock( xbDbf * pdbf ); + virtual ~xbaseLock() {} + virtual xbShort LockTableHeader( xbShort LockType ); + virtual xbShort LockTable( xbShort LockType ); + virtual xbShort LockRecord( xbShort LockType, xbULong RecNo, xbOffT len ); + virtual xbShort LockMemo( xbShort LockType ); + virtual xbShort LockIndex( xbShort LockType ); + virtual xbShort UnlockAll(); + virtual xbShort LockInit(); +private: + FILE *lfh; /* lock file handle */ + +}; + +class XBDLLEXPORT dbaseLock : xbLock +{ +public: + dbaseLock( xbDbf * pdbf ); + virtual ~dbaseLock() {} + virtual xbShort LockTableHeader( xbShort LockType ); + virtual xbShort LockTable( xbShort LockType ); + virtual xbShort LockRecord( xbShort LockType, xbULong RecNo, xbOffT len ); + virtual xbShort LockMemo( xbShort LockType ); + virtual xbShort LockIndex( xbShort LockType ); + virtual xbShort UnlockAll(); +}; + + +class XBDLLEXPORT clipperLock : xbLock +{ +public: + clipperLock( xbDbf * pdbf ); + virtual ~clipperLock() {} + virtual xbShort LockTableHeader( xbShort LockType ); + virtual xbShort LockTable( xbShort LockType ); + virtual xbShort LockRecord( xbShort LockType, xbULong RecNo, xbOffT len ); + virtual xbShort LockMemo( xbShort LockType ); + virtual xbShort LockIndex( xbShort LockType ); + virtual xbShort UnlockAll(); +}; + +class XBDLLEXPORT foxproLock : xbLock +{ +public: + foxproLock( xbDbf * pdbf ); + virtual ~foxproLock() {} + virtual xbShort LockTableHeader( xbShort LockType ); + virtual xbShort LockTable( xbShort LockType ); + virtual xbShort LockRecord( xbShort LockType, xbULong RecNo, xbOffT len ); + virtual xbShort LockMemo( xbShort LockType ); + virtual xbShort LockIndex( xbShort LockType ); + virtual xbShort UnlockAll(); +}; + +class XBDLLEXPORT noLock : xbLock +{ +public: + noLock( xbDbf * pdbf ) : xbLock( pdbf ) {}; + virtual ~noLock() {} + virtual xbShort LockTableHeader( xbShort LockType ) + { return XB_NO_ERROR; } + virtual xbShort LockTable( xbShort LockType ) + { return XB_NO_ERROR; } + virtual xbShort LockRecord( xbShort LockType, xbULong RecNo ) + { return XB_NO_ERROR; } + virtual xbShort LockMemo( xbShort LockType ) + { return XB_NO_ERROR; } + virtual xbShort LockIndex( xbShort LockType ) + { return XB_NO_ERROR; } + virtual xbShort UnlockAll() + { return XB_NO_ERROR; } +}; + + + + +#endif // XB_LOCKING_ON +#endif // __XB_XBLOCK_H__ diff --git a/xbase64/xbmemo.cpp b/xbase64/xbmemo.cpp new file mode 100755 index 0000000..75956dd --- /dev/null +++ b/xbase64/xbmemo.cpp @@ -0,0 +1,1173 @@ +/* xbmemo.cpp + + Xbase64 project source code + + This file contains the basic Xbase64 routines for handling + dBASE III+ and dBASE IV style memo .dbt files + + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> +#ifdef XB_MEMO_FIELDS + +#include <stdio.h> +//#include <xbase64/xbexcept.h> + +#ifdef HAVE_IO_H +#include <io.h> +#endif + + +/*! \file xbmemo.cpp +*/ + +/************************************************************************/ +//! Short description +/*! +*/ +xbLong xbDbf::CalcLastDataBlock() +{ + if( _fseek( mfp, 0, SEEK_END ) != 0 ) + return XB_SEEK_ERROR; + return ( _ftell( mfp ) / MemoHeader.BlockSize ); +} +/************************************************************************/ +//! Short description +/*! + \param BlocksNeeded + \param Location + \param PrevNode +*/ +xbShort xbDbf::GetBlockSetFromChain( xbLong BlocksNeeded, + xbLong Location, xbLong PrevNode ) + +/* this routine grabs a set of blocks out of the free block chain */ +{ + xbShort rc; + xbLong NextFreeBlock2, NewFreeBlocks, SaveNextFreeBlock; + + if(( rc = ReadMemoBlock( Location, 2 )) != XB_NO_ERROR ) + return rc; + + if( BlocksNeeded == FreeBlockCnt ){ /* grab this whole set of blocks */ + if( PrevNode == 0 ){ /* first in the chain */ + MemoHeader.NextBlock = NextFreeBlock; + if(( rc = UpdateHeadNextNode()) != XB_NO_ERROR ) + return rc; + } + else /* remove out of the middle or end */ + { + NextFreeBlock2 = NextFreeBlock; + if(( rc = ReadMemoBlock( PrevNode, 2 )) != XB_NO_ERROR ) + return rc; + NextFreeBlock = NextFreeBlock2; + if(( rc = WriteMemoBlock( PrevNode, 2 )) != XB_NO_ERROR ) + return rc; + } + } + + else /* only take a portion of this set */ + { + if( PrevNode == 0 ){ /* first in the set */ + MemoHeader.NextBlock = Location + BlocksNeeded; + if(( rc = UpdateHeadNextNode()) != XB_NO_ERROR ) + return rc; + FreeBlockCnt -= BlocksNeeded; + if(( rc = WriteMemoBlock( MemoHeader.NextBlock, 2 )) != XB_NO_ERROR ) + return rc; + } + else /* remove out of the middle or end */ + { + NewFreeBlocks = FreeBlockCnt - BlocksNeeded; + SaveNextFreeBlock = NextFreeBlock; + NextFreeBlock2= Location + BlocksNeeded; + if(( rc = ReadMemoBlock( PrevNode, 2 )) != XB_NO_ERROR ) + return rc; + NextFreeBlock = NextFreeBlock2; + if(( rc = WriteMemoBlock( PrevNode, 2 )) != XB_NO_ERROR ) + return rc; + FreeBlockCnt = NewFreeBlocks; + NextFreeBlock = SaveNextFreeBlock; + if(( rc = WriteMemoBlock( NextFreeBlock2, 2 )) != XB_NO_ERROR ) + return rc; + } + } + return 0; +} +/************************************************************************/ +//! Short description +/*! + \param BlocksNeeded + \param LastDataBlock + \param Location + \param PreviousNode +*/ +xbShort xbDbf::FindBlockSetInChain( xbLong BlocksNeeded, + xbLong LastDataBlock, xbLong &Location, xbLong &PreviousNode ) + +/* this routine searches thru the free node chain in a dbase IV type + memo file searching for a place to grab some free blocks for reuse + + LastDataBlock- is the last data block in the file, enter 0 + for the routine to calculate it. + BlocksNeeded - is the size to look in the chain for + Location - is the location it finds + PreviousNode - is the block number of the node imediately previous + to this node in the chain - 0 if header node + returns - 0 if no spot in chain found + 1 if spot in chain is found +*/ +{ + xbShort rc; + xbLong LDB, PrevNode, CurNode; + + if( LastDataBlock == 0 ) + LDB = CalcLastDataBlock(); + else + LDB = LastDataBlock; + + if( MemoHeader.NextBlock < LDB ){ + PrevNode = 0L; + CurNode = MemoHeader.NextBlock; + if(( rc = ReadMemoBlock( MemoHeader.NextBlock, 2 )) != XB_NO_ERROR ) + return rc; + while( BlocksNeeded > FreeBlockCnt && NextFreeBlock < LDB ){ + PrevNode = CurNode; + CurNode = NextFreeBlock; + if(( rc = ReadMemoBlock( NextFreeBlock, 2 )) != XB_NO_ERROR ) + return rc; + } + if( BlocksNeeded <= FreeBlockCnt ){ + Location = CurNode; + PreviousNode = PrevNode; + return 1; + } + else{ /* no data found and at end of chain */ + PreviousNode = CurNode; + return 0; + } + } + else{ + PreviousNode = 0; + return 0; + } +} +/************************************************************************/ +//! Short description +/*! + \param BlockSize +*/ +xbShort xbDbf::SetMemoBlockSize( xbShort BlockSize ) +{ + if(IsType3Dbt()) + return XB_NO_ERROR; // not applicable for type 3 + if( BlockSize % 512 != 0 ) + return XB_INVALID_BLOCK_SIZE; + + MemoHeader.BlockSize = BlockSize; + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param Option +*/ +xbShort xbDbf::GetDbtHeader( xbShort Option ) +{ + char *p; + xbShort i; + char MemoBlock[24]; + + /* Option = 0 --> read only first four bytes + 1 --> read the entire thing */ + + if( !mfp ) + return XB_NOT_OPEN; + + if( _fseek( mfp, 0, SEEK_SET )) + return XB_SEEK_ERROR; + + if(( fread( MemoBlock, 24, 1, mfp )) != 1 ) + return XB_READ_ERROR; + + p = MemoBlock; + MemoHeader.NextBlock = xbase->GetLong( p ); + if(IsType3Dbt() || Option == 0) + return XB_NO_ERROR; + + /* version IV stuff follows */ + p+=8; + for( i = 0; i < 8; i++, p++ ) + MemoHeader.FileName[i] = *p; + MemoHeader.Version = *p; + p+=4; + MemoHeader.BlockSize = xbase->GetShort( p ); + return XB_NO_ERROR; +} + +/***********************************************************************/ +xbShort xbDbf::OpenFPTFile() +{ + if (GetFileName().len() < 3) + return XB_INVALID_NAME; + + xbShort len = GetFileName().len() - 1; + xbString ext = GetFileName().mid(len-2, 3); + MemofileName = GetFileName().mid(0, len-2); + if (ext == "DBF") + MemofileName += "FPT"; + else + if (ext = "dbf") + MemofileName += "fpt"; + else + return XB_INVALID_NAME; + if ((mfp = fopen(MemofileName, "r+b" )) == NULL){ + // + // Try to open read only if can't open read/write + // + if ((mfp = fopen(MemofileName, "rb" )) == NULL) + return XB_OPEN_ERROR; + } + char header[8]; + if ((fread(header, 8, 1, mfp)) != 1) + return XB_READ_ERROR; + + char *p = header; + MemoHeader.NextBlock = xbase->GetHBFULong(p); + p += 6; + MemoHeader.BlockSize = xbase->GetHBFShort(p); + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbShort xbDbf::OpenMemoFile() +{ + if (Version == (char)0xf5 || Version == (char)0x30) + return OpenFPTFile(); + + xbShort len, rc; + xbOffT Size, NewSize, l; + MemofileName = GetFileName(); + len = GetFileName().len() - 1; + if( MemofileName[len] == 'F' ) + MemofileName.putAt(len, 'T'); + else if( MemofileName[len] == 'f' ) + MemofileName.putAt(len, 't'); + else + return XB_INVALID_NAME; + + if(( mfp = fopen( MemofileName, "r+b" )) == NULL ){ + // + // Try to open read only if can't open read/write + // + if(( mfp = fopen( MemofileName, "rb" )) == NULL ) + return XB_OPEN_ERROR; + } +#ifdef XB_LOCKING_ON + setbuf( mfp, NULL ); +#endif + if(( rc = GetDbtHeader(1)) != 0 ){ + fclose( mfp ); + return rc; + } + + len = GetMemoBlockSize(); + if( len == 0 || ((len % 512) != 0 )){ + fclose( mfp ); + return XB_INVALID_BLOCK_SIZE; + } + + /* logic to verify file size is a multiple of block size */ + if(( rc = _fseek( mfp, 0, SEEK_END )) != 0 ){ + fclose( mfp ); + return XB_SEEK_ERROR; + } + + /* if the file is not a multiple of block size, fix it, append nulls */ + Size = _ftell( mfp ); + if(( Size % MemoHeader.BlockSize ) != 0 ){ + NewSize = ( Size / MemoHeader.BlockSize + 1) * MemoHeader.BlockSize; + for( l = Size; l < NewSize; l++ ) + fputc( 0x00, mfp ); + } + + if(( mbb = (void *) malloc(len)) == NULL ){ + fclose( mfp ); + return XB_NO_MEMORY; + } + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbShort xbDbf::CreateMemoFile( void ) +{ + xbShort len,i; + char *sp; + char buf[4]; + + len = GetMemoBlockSize(); + if( len == 0 || len % 512 != 0 ) + return XB_INVALID_BLOCK_SIZE; + + if(( sp = (char*)strrchr(GetFileName(), PATH_SEPARATOR)) != NULL ) + sp++; + else + sp = MemoHeader.FileName; + + memset( MemoHeader.FileName, 0x00, 8 ); + + for( i = 0; i < 8 && *sp != '.'; i++ ) + MemoHeader.FileName[i] = *sp++; + + MemofileName = GetFileName(); + + len = GetFileName().len() - 1; + if( MemofileName[len] == 'F' ) + MemofileName.putAt(len, 'T'); + else if( MemofileName[len] == 'f' ) + MemofileName.putAt(len, 't'); + else + return XB_INVALID_NAME; + + /* Initialize the variables */ + MemoHeader.NextBlock = 1L; + + if(( mfp = fopen( MemofileName, "w+b" )) == NULL ) + return XB_OPEN_ERROR; +#ifdef XB_LOCKING_ON + setbuf( mfp, NULL ); +#endif + + if(( _fseek( mfp, 0, SEEK_SET )) != 0 ){ + fclose( mfp ); + return XB_SEEK_ERROR; + } + + memset( buf, 0x00, 4 ); + xbase->PutLong( buf, MemoHeader.NextBlock ); + if(( fwrite( &buf, 4, 1, mfp )) != 1 ){ + fclose( mfp ); + return XB_WRITE_ERROR; + } + + if( IsType3Dbt() ){ /* dBASE III+ */ + for( i = 0; i < 12; i++ ) fputc( 0x00, mfp ); + fputc( 0x03, mfp ); + for( i = 0; i < 495; i++ ) fputc( 0x00, mfp ); + } + else + { + for( i = 0; i < 4; i++ ) fputc( 0x00, mfp ); + fwrite( &MemoHeader.FileName, 8, 1, mfp ); + for( i = 0; i < 4; i++ ) fputc( 0x00, mfp ); + memset( buf, 0x00, 2 ); + xbase->PutShort( buf, MemoHeader.BlockSize ); + if(( fwrite( &buf, 2, 1, mfp )) != 1 ){ + fclose( mfp ); + return XB_WRITE_ERROR; + } + for( i = 22; i < MemoHeader.BlockSize; i++ ) fputc( 0x00, mfp ); + } + + if(( mbb = (void *) malloc( MemoHeader.BlockSize )) == NULL ){ + fclose( mfp ); + return XB_NO_MEMORY; + } + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param BlockNo + \param Option +*/ + +/* Option = 0 - 1st Block of a set of valid data blocks, load buckets */ +/* Option = 1 - subsequant block of data in a multi block set or db III*/ +/* Option = 2 - 1st block of a set of free blocks, load buckets */ +/* Option = 3 - read 8 bytes of a block, don't load any buckets */ +/* Option = 4 - read 8 bytes of a block, load data buckets */ + +xbShort xbDbf::ReadMemoBlock( xbLong BlockNo, xbShort Option ) +{ + size_t ReadSize; + CurMemoBlockNo = -1; + + if( BlockNo < 1L ) + return XB_INVALID_BLOCK_NO; + + if( _fseek( mfp,((xbOffT)BlockNo*MemoHeader.BlockSize), SEEK_SET )) + return XB_SEEK_ERROR; + + + if( Option == 0 || Option == 1 ) + ReadSize = MemoHeader.BlockSize; + else + ReadSize = 8L; + + if(fread( mbb, ReadSize, 1, mfp ) != 1 ) + return XB_READ_ERROR; + + if( Option == 0 || Option == 4){ // 1st block of a set of valid data blocks + mfield1 = xbase->GetShort( (char *) mbb ); + MStartPos = xbase->GetShort( (char *) mbb+2 ); + MFieldLen = xbase->GetLong ( (char *) mbb+4 ); + } + else if( Option == 2 ){ // 1st block of a set of free blocks + NextFreeBlock = xbase->GetLong( (char *) mbb ); + FreeBlockCnt = xbase->GetLong( (char *) mbb+4 ); + } + + if( Option == 0 || Option == 1 ) + CurMemoBlockNo = BlockNo; + + return XB_NO_ERROR; +} +/************************************************************************/ +//! Short description +/*! + \param BlockNo + \param Option +*/ +xbShort xbDbf::WriteMemoBlock( xbLong BlockNo, xbShort Option ) +{ +/* Option = 0 - 1st Block of a set of valid data blocks, set buckets */ +/* Option = 1 - subsequant block of data in a multi block set or db III */ +/* Option = 2 - 1st block of a set offree blocks, set buckets */ + + xbLong WriteSize; + + if( BlockNo < 1L ) + return XB_INVALID_BLOCK_NO; + + CurMemoBlockNo = -1; + + if( Option == 0 ){ + xbase->PutShort( (char *) mbb, mfield1 ); + xbase->PutShort( (char *) mbb+2, MStartPos ); + xbase->PutLong ( (char *) mbb+4, MFieldLen ); + WriteSize = MemoHeader.BlockSize; + } + else if( Option == 2 ){ + xbase->PutLong((char *) mbb, NextFreeBlock ); + xbase->PutLong((char *) mbb+4, FreeBlockCnt ); + WriteSize = 8L; + } + else + WriteSize = MemoHeader.BlockSize; + + if( _fseek( mfp,((xbOffT)BlockNo*MemoHeader.BlockSize), SEEK_SET )) + return XB_SEEK_ERROR; + + if(( fwrite( mbb, WriteSize, 1, mfp )) != 1 ) + return XB_WRITE_ERROR; + + if( Option == 0 || Option == 1 ) + CurMemoBlockNo = BlockNo; + + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param FieldNo + \param len + \param Buf + \param LockOpt +*/ +xbShort xbDbf::GetFPTField(xbShort FieldNo, xbLong len, + char * Buf, xbShort LockOpt) { + + if (FieldNo < 0 || FieldNo > (NoOfFields - 1)) + return XB_INVALID_FIELDNO; + + if (GetFieldType(FieldNo) != 'M') + return XB_NOT_MEMO_FIELD; + +#ifdef XB_LOCKING_ON +// if( LockOpt != -1 ) +// if( LockMemoFile( XB_LOCK ) != XB_NO_ERROR ) +// return XB_LOCK_FAILED; +#endif + + xbLong BlockNo; + char buf[18]; + + if( Version == (char)0x30 ) { + memset( buf, 0x00, 18 ) ; + GetField( FieldNo, buf ); + BlockNo = xbase->GetLong((char*) buf); + } else { + BlockNo = GetLongField(FieldNo); + } + + if ( BlockNo == 0L ) + return 0L; + + // Seek to start_of_block + 4 + + +// FIXME LOCK + +#ifdef XB_LOCKING_ON +// try { +#endif + if (_fseek(mfp, ((xbOffT)BlockNo * MemoHeader.BlockSize + 4), SEEK_SET) != 0) + return XB_SEEK_ERROR; + char h[4]; + if ((fread(h, 4, 1, mfp)) != 1) + return XB_READ_ERROR; + + xbULong fLen = xbase->GetHBFULong(h); + + xbULong l = (fLen < (xbULong)len) ? fLen : len; + if ((fread(Buf, l, 1, mfp)) != 1) + return XB_READ_ERROR; + Buf[l]=0; +#ifdef XB_LOCKING_ON +// } +// catch (...) { +// if (LockOpt != -1) +// LockMemoFile( XB_UNLOCK ); +// throw; +// } +#endif + +#ifdef XB_LOCKING_ON +// if (LockOpt != -1) +// LockMemoFile( XB_UNLOCK ); +#endif + + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param FieldNo + \param len + \param Buf + \param LockOpt +*/ +xbShort xbDbf::GetMemoField( xbShort FieldNo, xbLong len, + char * Buf, xbShort LockOpt ) +{ + if( Version == (char)0xf5 || Version == (char)0x30 ) + return GetFPTField(FieldNo, len, Buf, LockOpt); + + xbLong BlockNo, Tcnt, Scnt; + char *tp, *sp; /* target and source pointers */ + xbShort rc; + xbShort Vswitch; + xbLong MemoLen; + + if( FieldNo < 0 || FieldNo > ( NoOfFields - 1 )) + return XB_INVALID_FIELDNO; + + if( GetFieldType( FieldNo ) != 'M' ) + return XB_NOT_MEMO_FIELD; + +#ifdef XB_LOCKING_ON +// if( LockOpt != -1 ) +// if(( rc = LockMemoFile( LockOpt, XB_LOCK )) != XB_NO_ERROR ) +// return XB_LOCK_FAILED; +#endif + + if(( BlockNo = GetLongField( FieldNo )) == 0 ){ +#ifdef XB_LOCKING_ON +// if( LockOpt != -1 ) +// LockMemoFile( XB_UNLOCK ); +#endif + return XB_NO_MEMO_DATA; + } + + if( IsType3Dbt() ) + Vswitch = 1; + else + Vswitch = 0; + + if(( rc = ReadMemoBlock( BlockNo, Vswitch )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( LockOpt != -1 ) +// LockMemoFile( XB_UNLOCK ); +#endif + return rc; + } + + tp = Buf; + sp = (char *) mbb; + + if( IsType4Dbt() ){ + sp+=8; + Scnt = 8L; + } + else + Scnt = 0L; + + Tcnt = 0L; + MemoLen = GetMemoFieldLen( FieldNo ); + while( Tcnt < len && Tcnt < MemoLen ){ + *tp++ = *sp++; + Scnt++; + Tcnt++; + if( Scnt >= MemoHeader.BlockSize ){ + BlockNo++; + if(( rc = ReadMemoBlock( BlockNo, 1 )) != 0 ) + return rc; + Scnt = 0; + sp = (char *) mbb; + } + } +#ifdef XB_LOCKING_ON + //if( LockOpt != -1 ) +// LockMemoFile( XB_LOCK ); +#endif + + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param FieldNo +*/ +xbLong xbDbf::GetFPTFieldLen( xbShort FieldNo ) +{ + xbLong BlockNo; + if(( BlockNo = GetLongField(FieldNo)) == 0L ) + return 0L; + // Seek to start_of_block + 4 + if(_fseek(mfp, ((xbOffT)BlockNo * MemoHeader.BlockSize + 4), SEEK_SET) != 0) + return XB_SEEK_ERROR; + char h[4]; + if((fread(h, 4, 1, mfp)) != 1) + return XB_READ_ERROR; + + return xbase->GetHBFULong(h); +} +/***********************************************************************/ +//! Short description +/*! + \param FieldNo +*/ +xbLong xbDbf::GetMemoFieldLen( xbShort FieldNo ) { + if (Version == (char)0xf5 || Version == (char)0x30 ) + return GetFPTFieldLen(FieldNo); + + xbLong BlockNo, ByteCnt; + xbShort scnt, NotDone; + char *sp, *spp; + + if(( BlockNo = GetLongField( FieldNo )) == 0L ) + return 0L; + + if( IsType4Dbt()){ /* dBASE IV */ + if( BlockNo == CurMemoBlockNo && CurMemoBlockNo != -1 ) + return MFieldLen - MStartPos; + if( ReadMemoBlock( BlockNo, 0 ) != XB_NO_ERROR ) + return 0L; + return MFieldLen - MStartPos; + } else { /* version 0x03 dBASE III+ */ + ByteCnt = 0L; + spp = NULL; + NotDone = 1; + while( NotDone ){ + if( ReadMemoBlock( BlockNo++, 1 ) != XB_NO_ERROR ) + return 0L; + scnt = 0; + sp = (char *) mbb; + while( scnt < 512 && NotDone ){ + if( *sp == 0x1a && *spp == 0x1a ) + NotDone = 0; + else{ + ByteCnt++; scnt++; spp = sp; sp++; + } + } + } + if( ByteCnt > 0 ) ByteCnt--; + return ByteCnt; + } +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbShort xbDbf::MemoFieldsPresent() const +{ + xbShort i; + for( i = 0; i < NoOfFields; i++ ) + if( GetFieldType( i ) == 'M' ) + return 1; + + return 0; +} +/***********************************************************************/ +//! Short description +/*! + \param FieldNo +*/ +xbShort xbDbf::DeleteMemoField( xbShort FieldNo ) +{ + xbLong SBlockNo, SNoOfBlocks, SNextBlock; + xbLong LastFreeBlock, LastFreeBlockCnt, LastDataBlock; + xbShort rc; + + NextFreeBlock = 0L; + LastFreeBlockCnt = 0L; + LastFreeBlock = 0L; + + if( IsType3Dbt() ){ /* type III */ + PutField( FieldNo, " " ); + return XB_NO_ERROR; + } + + /* Get Block Number */ + if(( SBlockNo = GetLongField( FieldNo )) == 0 ) + return XB_INVALID_BLOCK_NO; + + /* Load the first block */ + + if(( rc = ReadMemoBlock( SBlockNo, 4 )) != XB_NO_ERROR ) + return rc; + + if( (MFieldLen+2) % MemoHeader.BlockSize ) + SNoOfBlocks = (MFieldLen+2)/MemoHeader.BlockSize+1L; + else + SNoOfBlocks = (MFieldLen+2)/MemoHeader.BlockSize; + + /* Determine last good data block */ + LastDataBlock = CalcLastDataBlock(); + + /* position to correct location in chain */ + NextFreeBlock = MemoHeader.NextBlock; + while( SBlockNo > NextFreeBlock && SBlockNo < LastDataBlock ){ + LastFreeBlock = NextFreeBlock; + if(( rc = ReadMemoBlock( NextFreeBlock, 2 )) != XB_NO_ERROR ) + return rc; + LastFreeBlockCnt = FreeBlockCnt; + } + + + /* if next block should be concatonated onto the end of this set */ + + if((SBlockNo+SNoOfBlocks) == NextFreeBlock && NextFreeBlock < LastDataBlock ) + { + if(( rc = ReadMemoBlock( NextFreeBlock, 2 )) != XB_NO_ERROR ) + return XB_NO_ERROR; + SNoOfBlocks += FreeBlockCnt; + SNextBlock = NextFreeBlock; + } else if( LastFreeBlock == 0L ) + SNextBlock = MemoHeader.NextBlock; + else + SNextBlock = NextFreeBlock; + + /* if this is the first set of free blocks */ + if( LastFreeBlock == 0L ){ + /* 1 - write out the current block */ + /* 2 - update header block */ + /* 3 - write header block */ + /* 4 - update data field */ + + NextFreeBlock = SNextBlock; + FreeBlockCnt = SNoOfBlocks; + if(( rc = WriteMemoBlock( SBlockNo, 2 )) != XB_NO_ERROR ) + return rc; + + MemoHeader.NextBlock = SBlockNo; + if(( rc = UpdateHeadNextNode()) != XB_NO_ERROR ) + return rc; + PutField( FieldNo, " " ); + return XB_NO_ERROR; + } + +/* determine if this block set should be added to the previous set */ + + if(( LastFreeBlockCnt + LastFreeBlock ) == SBlockNo ){ + if(( rc = ReadMemoBlock( LastFreeBlock, 2 )) != XB_NO_ERROR ) + return rc; + NextFreeBlock = SNextBlock; + FreeBlockCnt += SNoOfBlocks; + if(( rc = WriteMemoBlock( LastFreeBlock, 2 )) != XB_NO_ERROR ) + return rc; + PutField( FieldNo, " " ); + return XB_NO_ERROR; + } + + /* insert into the chain */ + /* 1 - set the next bucket on the current node */ + /* 2 - write this node */ + /* 3 - go to the previous node */ + /* 4 - insert this nodes id into the previous node set */ + /* 5 - write previous node */ + + FreeBlockCnt = SNoOfBlocks; + if(( rc = WriteMemoBlock( SBlockNo, 2 )) != XB_NO_ERROR ) + return rc; + if(( rc = ReadMemoBlock( LastFreeBlock, 2 )) != XB_NO_ERROR ) + return rc; + NextFreeBlock = SBlockNo; + if(( rc = WriteMemoBlock( LastFreeBlock, 2 )) != XB_NO_ERROR ) + return rc; + PutField( FieldNo, " " ); + + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param FieldNo + \param DataLen + \param Buf +*/ + +xbShort xbDbf::AddMemoData( xbShort FieldNo, xbLong DataLen, + const char * Buf ) +{ + xbShort rc; + xbLong BlocksNeeded, LastDataBlock; + xbLong PrevNode, HeadBlock; + xbLong TotalLen; /* total length of needed area for memo field */ + + TotalLen = DataLen+2; + LastDataBlock = CalcLastDataBlock(); + + if( IsType3Dbt() || /* always append to end */ + ( LastDataBlock == MemoHeader.NextBlock )){ /* no free space */ + if( TotalLen % MemoHeader.BlockSize ) + BlocksNeeded = TotalLen / MemoHeader.BlockSize + 1; + else + BlocksNeeded = TotalLen / MemoHeader.BlockSize; + + MemoHeader.NextBlock = LastDataBlock + BlocksNeeded; /* reset to eof */ + if(( rc = PutMemoData( LastDataBlock, BlocksNeeded, DataLen, Buf )) + != XB_NO_ERROR ) + return rc; + HeadBlock = LastDataBlock; + if(( rc = UpdateHeadNextNode()) != XB_NO_ERROR ) + return rc; + }else{ + TotalLen += 8; + if( TotalLen % MemoHeader.BlockSize ) + BlocksNeeded = TotalLen / MemoHeader.BlockSize + 1; + else + BlocksNeeded = TotalLen / MemoHeader.BlockSize; + + if(( rc = FindBlockSetInChain( BlocksNeeded, LastDataBlock, + HeadBlock, PrevNode )) == 1 ){ + if(( rc = GetBlockSetFromChain( BlocksNeeded, HeadBlock, PrevNode )) + != XB_NO_ERROR ) + return rc; + if(( rc = PutMemoData( HeadBlock, BlocksNeeded, DataLen, Buf )) + != XB_NO_ERROR ) + return rc; + } else { /* append to the end */ + /* if header block needed updated, already done by here */ + if(( rc = PutMemoData( LastDataBlock, BlocksNeeded, DataLen, Buf )) + != XB_NO_ERROR ) + return rc; + HeadBlock = LastDataBlock; + if(( rc = ReadMemoBlock( PrevNode, 2 )) != XB_NO_ERROR ) + return rc; + NextFreeBlock += BlocksNeeded; + if(( rc = WriteMemoBlock( PrevNode, 2 )) != XB_NO_ERROR ) + return rc; + } + } + PutLongField( FieldNo, HeadBlock ); + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbShort xbDbf::UpdateHeadNextNode() const +{ + char buf[4]; + memset( buf, 0x00, 4 ); + xbase->PutLong( buf, MemoHeader.NextBlock ); + if(( _fseek( mfp, 0, SEEK_SET )) != 0 ) + return XB_SEEK_ERROR; + + if(( fwrite( &buf, 4, 1, mfp )) != 1 ) + return XB_WRITE_ERROR; + + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param StartBlock First block to write + \param BlocksNeeded Total number of blocks needed + \param DataLen Length of data to write + \param Buf Actual data +*/ +xbShort xbDbf::PutMemoData( xbLong StartBlock, xbLong BlocksNeeded, + xbLong DataLen, const char *Buf ) +{ + xbShort i, rc, Tctr; + xbShort BytesProcessed; // bytes processed so far + xbShort TotalLen; // total length of data + xbLong CurBlock; + char *tp; + const char *sp; + + TotalLen = DataLen + 2; + CurBlock = StartBlock; + memset( (char *) mbb, 0x00, MemoHeader.BlockSize ); + tp = (char *) mbb; + sp = Buf; + BytesProcessed = 0; /* total length processed */ + + + if( IsType3Dbt() ) + Tctr = 0; + else{ /* dBASE IV */ + tp += 8; + Tctr = 8; + } + + for( i = 0; i < BlocksNeeded; i++ ){ + while( Tctr < MemoHeader.BlockSize && BytesProcessed < TotalLen ){ + if( BytesProcessed >= DataLen ) + *tp++ = 0x1a; /* end of data marker */ + else + *tp++ = *sp++; /* copy data to memo block buffer */ + Tctr++; + BytesProcessed++; + } + + /* if incomplete block, finish it out with 0x00 */ + while( Tctr++ < MemoHeader.BlockSize ) + *tp++ = 0x00; + + if( i == 0 && IsType4Dbt() ){ + mfield1 = -1; + MStartPos = 8; + MFieldLen = DataLen + MStartPos; + if(( rc = WriteMemoBlock( CurBlock++, 0 )) != XB_NO_ERROR ) + return rc; + } else { + if(( rc = WriteMemoBlock( CurBlock++, 1 )) != XB_NO_ERROR ) + return rc; + } + Tctr = 0; + tp = (char *) mbb; + } + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param FieldNo + \param DataLen + \param Buf + \param LockOpt +*/ +xbShort xbDbf::UpdateMemoData( xbShort FieldNo, xbLong DataLen, + const char * Buf, xbShort LockOpt ) +{ + xbShort rc; + xbLong TotalLen; + xbLong BlocksNeeded, BlocksAvailable; + + #ifdef XB_LOCKING_ON + if( LockOpt != -1 ) +// if(( rc = LockMemoFile( XB_LOCK )) != XB_NO_ERROR ) +// return XB_LOCK_FAILED; + #endif + + if( DataLen ){ + TotalLen = DataLen + 2; // add 2 eod 0x1a chars + if( IsType4Dbt()) TotalLen += 8; // leading fields for dbase iv + } + else + TotalLen = 0; + + if( DataLen == 0L ){ /* handle delete */ + if( MemoFieldExists( FieldNo )){ + if(( rc = DeleteMemoField( FieldNo )) != XB_NO_ERROR ){ + #ifdef XB_LOCKING_ON +// LockMemoFile( XB_UNLOCK ); + #endif + return rc; + } + } + } else if((IsType3Dbt() || GetMemoFieldLen(FieldNo)==0L)){ + if(( rc = AddMemoData( FieldNo, DataLen, Buf )) != XB_NO_ERROR ){ + #ifdef XB_LOCKING_ON +// LockMemoFile( XB_UNLOCK ); + #endif + return rc; + } + } else { /* version IV type files, reuse unused space */ + if( TotalLen % MemoHeader.BlockSize ) + BlocksNeeded = TotalLen / MemoHeader.BlockSize + 1; + else + BlocksNeeded = TotalLen / MemoHeader.BlockSize; + + if(( rc = ReadMemoBlock( GetLongField( FieldNo ), 4 )) != XB_NO_ERROR ){ + #ifdef XB_LOCKING_ON +// LockMemoFile( XB_UNLOCK ); + #endif + return rc; + } + + if( (MFieldLen+2) % MemoHeader.BlockSize ) + BlocksAvailable = (MFieldLen+2) / MemoHeader.BlockSize + 1; + else + BlocksAvailable = (MFieldLen+2) / MemoHeader.BlockSize; + + if( BlocksNeeded == BlocksAvailable ){ + if(( rc = PutMemoData( GetLongField( FieldNo ), BlocksNeeded, + DataLen, Buf )) != XB_NO_ERROR ){ + #ifdef XB_LOCKING_ON +// LockMemoFile( XB_UNLOCK ); + #endif + return rc; + } + } else { + if(( rc = DeleteMemoField( FieldNo )) != XB_NO_ERROR ){ + #ifdef XB_LOCKING_ON +// LockMemoFile( XB_UNLOCK ); + #endif + return rc; + } + if(( rc = AddMemoData( FieldNo, DataLen, Buf )) != XB_NO_ERROR ){ + #ifdef XB_LOCKING_ON +// LockMemoFile( XB_UNLOCK ); + #endif + return rc; + } + } + } + + + #ifdef XB_LOCKING_ON +// if( LockOpt != -1 ) +// if(( rc = LockMemoFile( XB_UNLOCK )) != XB_NO_ERROR ) +// return XB_LOCK_FAILED; + #endif + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param FieldNo +*/ +xbShort xbDbf::MemoFieldExists( xbShort FieldNo ) const +{ + if( GetLongField( FieldNo ) == 0L ) + return 0; + else + return 1; +} +/***********************************************************************/ +//! Short description +/*! +*/ +#ifdef XBASE_DEBUG +void xbDbf::DumpMemoHeader() const +{ + xbShort i; + std::cout << "\n*********************************"; + std::cout << "\nMemo header data..."; + std::cout << "\nNext Block " << MemoHeader.NextBlock; + if( IsType4Dbt() ){ + std::cout << "\nFilename "; + for( i = 0; i < 8; i++ ) + std::cout << MemoHeader.FileName[i]; + } + std::cout << "\nBlocksize " << MemoHeader.BlockSize; + return; +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbShort xbDbf::DumpMemoFreeChain() +{ + xbShort rc; + xbLong CurBlock, LastDataBlock; + + if(( rc = GetDbtHeader(1)) != XB_NO_ERROR ) + return rc; + LastDataBlock = CalcLastDataBlock(); + CurBlock = MemoHeader.NextBlock; + std::cout << "Total blocks in file = " << LastDataBlock << std::endl; + std::cout << "Head Next Block = " << CurBlock << std::endl;; + while( CurBlock < LastDataBlock ){ + if(( rc = ReadMemoBlock( CurBlock, 2 )) != XB_NO_ERROR ) + return rc; + std::cout << "**********************************" << std::endl; + std::cout << "This Block = " << CurBlock << std::endl; + std::cout << "Next Block = " << NextFreeBlock << std::endl; + std::cout << "No Of Blocks = " << FreeBlockCnt << std::endl; + CurBlock = NextFreeBlock; + } + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! +*/ +void xbDbf::DumpMemoBlock() const +{ + xbShort i; + char *p; + p = (char *) mbb; + if( IsType3Dbt() ){ + for( i = 0; i < 512; i++ ) + std::cout << *p++; + } else { + std::cout << "\nField1 => " << mfield1; + std::cout << "\nStart Pos => " << MStartPos; + std::cout << "\nField Len => " << MFieldLen; + std::cout << "\nBlock data => "; + p += 8; + for( i = 8; i < MemoHeader.BlockSize; i++ ) + std::cout << *p++; + } + return; +} +#endif /* XBASE_DEBUG */ +#endif /* MEMO_FIELD */ diff --git a/xbase64/xbmindex.h b/xbase64/xbmindex.h new file mode 100755 index 0000000..2cda630 --- /dev/null +++ b/xbase64/xbmindex.h @@ -0,0 +1,14 @@ +#ifndef xbMultiIndex_h
+#define xbMultiIndex_h
+
+#include <xbase64/xbase64.h>
+
+class xbMultiIndex: public xbIndex
+{
+ public:
+ xbMultiIndex(xbDbf* dbf): xbIndex(dbf) {}
+ virtual ~xbMultiIndex() {}
+ virtual xbShort CreateIndex(const char * filename, const char* tag,
+ const char* expr, xbShort unique, xbShort overwrite)=0;
+};
+#endif
diff --git a/xbase64/xbndx.cpp b/xbase64/xbndx.cpp new file mode 100755 index 0000000..e89bc7a --- /dev/null +++ b/xbase64/xbndx.cpp @@ -0,0 +1,2402 @@ +/* xbndx.cpp + + Xbase64 project source code + + NDX indexing routines for X-Base + + Copyright (C) 1997,2003,2004 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbndx.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> +#include <iostream> + +#ifdef XB_INDEX_NDX + +#ifdef HAVE_IO_H +#include <io.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +//#include <xbase64/xbexcept.h> + +/*! \file xbndx.cpp +*/ + +/***********************************************************************/ +//! Short description +/*! +*/ +/* This routine dumps the node chain to stdout */ +#ifdef XBASE_DEBUG +void xbNdx::DumpNodeChain() +{ + xbNdxNodeLink *n; + std::cout << std::endl << "*************************" << std::endl; + std::cout << "xbNodeLinkCtr = " << xbNodeLinkCtr << std::endl; + std::cout << "Reused = " << ReusedxbNodeLinks << std::endl; + + n = NodeChain; + while(n){ + std::cout << "xbNodeLink Chain ->" << n->NodeNo << std::endl; + std::cout << " CurKeyNo ->" << n->CurKeyNo << std::endl; + n = n->NextNode; + } + n = FreeNodeChain; + while(n){ + std::cout << "FreexbNodeLink Chain " << n->NodeNo << std::endl; + n = n->NextNode; + } + n = DeleteChain; + while(n){ + std::cout << "DeleteLink Chain " << n->NodeNo << std::endl; + n = n->NextNode; + } +} +#endif +/***********************************************************************/ +//! Short description +/*! + \param n +*/ +/* This routine returns a chain of one or more index nodes back to the */ +/* free node chain */ + +void xbNdx::ReleaseNodeMemory(xbNdxNodeLink *n, xbBool doFree) +{ + xbNdxNodeLink *temp; + + if(doFree){ + while(n){ + temp = n->NextNode; + free(n); + n = temp; + } + } else { + if( !FreeNodeChain ) + FreeNodeChain = n; + else { /* put this list at the end */ + temp = FreeNodeChain; + while( temp->NextNode ) + temp = temp->NextNode; + temp->NextNode = n; + } + } +} +/***********************************************************************/ +//! Short description +/*! +*/ +/* This routine returns a node from the free chain if available, */ +/* otherwise it allocates new memory for the requested node */ + +xbNdxNodeLink * xbNdx::GetNodeMemory() +{ + xbNdxNodeLink * temp; + if( FreeNodeChain ){ + temp = FreeNodeChain; + FreeNodeChain = temp->NextNode; + ReusedxbNodeLinks++; + } else { + temp = (xbNdxNodeLink *) malloc( sizeof( xbNdxNodeLink )); + xbNodeLinkCtr++; + } + memset( temp, 0x00, sizeof( xbNdxNodeLink )); + return temp; +} +/***********************************************************************/ +//! Short description +/*! +*/ +#ifdef XBASE_DEBUG +void xbNdx::DumpHdrNode( xbShort opt ) +{ + if( opt ){ + FILE * log; + if(( log = fopen( "xbase64.log", "a+t" )) == NULL ) return; + fprintf( log, "Index Header Node for %s\n", GetFileName().getData()); + fprintf( log, "--------------------------------\n" ); + fprintf( log, "Start node = %ld\n", HeadNode.StartNode ); + fprintf( log, "Total nodes = %ld\n", HeadNode.TotalNodes ); + fprintf( log, "No of keys = %ld\n", HeadNode.NoOfKeys ); + fprintf( log, "Key Length = %d\n", HeadNode.KeyLen ); + fprintf( log, "Keys Per Node = %d\n", HeadNode.KeysPerNode ); + fprintf( log, "Key type = %d\n", HeadNode.KeyType ); + fprintf( log, "Key size = %ld\n", HeadNode.KeySize ); + fprintf( log, "Unknown 2 = %d\n", HeadNode.Unknown2 ); + fprintf( log, "Unique = %d\n", HeadNode.Unique ); + fprintf( log, "KeyExpression = %s\n", HeadNode.KeyExpression ); + fclose( log ); + } + else + { + std::cout << "Start node = " << HeadNode.StartNode << std::endl; + std::cout << "Total nodes = " << HeadNode.TotalNodes << std::endl; + std::cout << "No of keys = " << HeadNode.NoOfKeys << std::endl; + std::cout << "Key Length = " << HeadNode.KeyLen << std::endl; + std::cout << "Keys Per Node = " << HeadNode.KeysPerNode << std::endl; + std::cout << "Key type = " << HeadNode.KeyType << std::endl; + std::cout << "Key size = " << HeadNode.KeySize << std::endl; + std::cout << "Unknown 2 = " << HeadNode.Unknown2 << std::endl; + std::cout << "Unique = " << HeadNode.Unique << std::endl; + std::cout << "KeyExpression = " << HeadNode.KeyExpression << std::endl; +#ifdef XB_VAR_NODESIZE + std::cout << "NodeSize = " << NodeSize << std::endl; +#endif // XB_VAR_NODESIZE + std::cout << std::endl; + } +} +#endif + +/***********************************************************************/ +//! Constructor +/*! + \param pdbf +*/ +xbNdx::xbNdx() : xbIndex() +{ +} + +/***********************************************************************/ +//! Constructor +/*! + \param pdbf +*/ +xbNdx::xbNdx(xbDbf *pdbf) : xbIndex(pdbf) { +#ifndef XB_VAR_NODESIZE + memset( Node, 0x00, XB_NDX_NODE_SIZE ); +#else + memset( Node, 0x00, XB_MAX_NDX_NODE_SIZE ); +#endif + memset( &HeadNode, 0x00, sizeof( xbNdxHeadNode )); + NodeChain = NULL; + FreeNodeChain = NULL; + DeleteChain = NULL; + CurNode = NULL; + xbNodeLinkCtr = 0L; + ReusedxbNodeLinks = 0L; +#ifndef XB_VAR_NODESIZE + NodeSize = XB_NDX_NODE_SIZE; +#else + NodeSize = XB_DEFAULT_NDX_NODE_SIZE; +#endif // XB_VAR_NODESIZE +} + +/***********************************************************************/ +//! Destructor +/*! +*/ +xbNdx::~xbNdx() +{ + CloseIndex(); +} + +/***********************************************************************/ +//! Short description +/*! +*/ +xbShort xbNdx::GetHeadNode( void ) +{ + char *p, *q; + xbShort i; + + if( !IsOpen() ) + return XB_NOT_OPEN; + + if( _fseek( indexfp, 0, SEEK_SET )) + return XB_SEEK_ERROR; + + if(( fread( Node, XB_NDX_NODE_SIZE, 1, indexfp )) != 1 ) + return XB_READ_ERROR; + + /* load the head node structure */ + p = Node; + HeadNode.StartNode = dbf->xbase->GetLong ( p ); p+=4; + HeadNode.TotalNodes = dbf->xbase->GetLong ( p ); p+=4; + HeadNode.NoOfKeys = dbf->xbase->GetLong ( p ); p+=4; + HeadNode.KeyLen = dbf->xbase->GetShort( p ); p+=2; + HeadNode.KeysPerNode = dbf->xbase->GetShort( p ); p+=2; + HeadNode.KeyType = dbf->xbase->GetShort( p ); p+=2; + HeadNode.KeySize = dbf->xbase->GetLong ( p ); p+=4; + HeadNode.Unknown2 = *p++; + HeadNode.Unique = *p++; + +#ifdef XB_VAR_NODESIZE + // + // Automagically determine the node size. Note the (2 * sizeof(xbLong)) + // is taken directly from CreateIndex(). I don't understand it exactly, + // but this is the value used to calculate the number of keys per node. + // DTB. + // + NodeSize = (2 * sizeof(xbLong)) + HeadNode.KeySize * HeadNode.KeysPerNode; + if(NodeSize % XB_NDX_NODE_MULTIPLE) + NodeSize = ((NodeSize + XB_NDX_NODE_MULTIPLE) / XB_NDX_NODE_MULTIPLE) * + XB_NDX_NODE_MULTIPLE; +#endif + + q = HeadNode.KeyExpression; + for( i = XB_NDX_NODE_BASESIZE; i < XB_NDX_NODE_SIZE && *p; i++ ) + *q++ = *p++; + + return 0; +} +/***********************************************************************/ +//! Short description +/*! + \param NodeNo + \param SetNodeChain +*/ +/* This routine reads a leaf node from disk */ +/* */ +/* If SetNodeChain 2, then the node is not appended to the node chain */ +/* but the CurNode pointer points to the node read */ +/* If SetNodeChain 1, then the node is appended to the node chain */ +/* If SetNodeChain 0, then record is only read to Node memory */ + +xbShort xbNdx::GetLeafNode( xbLong NodeNo, xbShort SetNodeChain ) +{ + xbNdxNodeLink *n; + + if( !IsOpen() ) + return XB_NOT_OPEN; + + if( _fseek( indexfp, (xbOffT)NodeNo * XB_NDX_NODE_SIZE, SEEK_SET )) + return XB_SEEK_ERROR; + + if(( fread( Node, XB_NDX_NODE_SIZE, 1, indexfp )) != 1 ) + return XB_READ_ERROR; + + if( !SetNodeChain ) return 0; + + if(( n = GetNodeMemory()) == NULL ) + return XB_NO_MEMORY; + + n->NodeNo = NodeNo; + n->CurKeyNo = 0L; + n->NextNode = NULL; + n->Leaf.NoOfKeysThisNode = dbf->xbase->GetLong( Node ); + memcpy( n->Leaf.KeyRecs, Node+4, XB_NDX_NODE_SIZE - 4 ); + + /* put the node in the chain */ + if( SetNodeChain == 1 ){ + if( NodeChain == NULL ){ /* first one ? */ + NodeChain = n; + CurNode = n; + CurNode->PrevNode = NULL; + } else { + n->PrevNode = CurNode; + CurNode->NextNode = n; + CurNode = n; + } + } + else + CurNode = n; + return 0; +} +/***********************************************************************/ +//! Short description +/*! + \param n +*/ +#ifdef XBASE_DEBUG +void xbNdx::DumpNodeRec( xbLong n ) +{ + char *p; + xbLong NoOfKeys, LeftBranch, RecNo, NodeType; + xbShort i,j; + FILE * log; + + if(( log = fopen( "xbase64.log", "a+t" )) == NULL ) return; + GetLeafNode( n, 0 ); + NoOfKeys = dbf->xbase->GetLong( Node ); + p = Node + 4; /* go past no of keys */ + + fprintf( log, "----------------------------------------------------\n" ); + fprintf( log, "Node # %ld\n", n ); + fprintf( log, "Number of keys = %ld\n", NoOfKeys ); + fprintf( log, " Key Left Dbf Rec Key\n" ); + fprintf( log, "Number Branch Number Data\n" ); + + NodeType = 0; + for( i = 0; i < (NoOfKeys+NodeType); i++ ){ + LeftBranch = dbf->xbase->GetLong( p ); + if( i == 0 && LeftBranch ){ + NodeType = 1; /* print one extra entry for interior nodes */ + fprintf( log, "Interior node\n" ); + } + + p+=4; + RecNo = dbf->xbase->GetLong( p ); + p+=4; + + fprintf( log, " %3d %9ld %9ld ", i, LeftBranch, RecNo ); + + if( NodeType == 1 && i == NoOfKeys ) + fprintf( log, "...\n" ); + + else if( !HeadNode.KeyType ){ + for( j = 0; j < HeadNode.KeyLen; j++ ) + fputc( *p++, log ); + fputc( '\n', log ); + } + + else { + fprintf( log, "??????\n" /*, dbf->xbase->GetDouble( p )*/ ); + p += 8; + } + } + fclose( log ); +} +#endif +/***********************************************************************/ +#ifndef XB_INLINE_GETDBFNO +xbLong xbNdx::GetDbfNo( xbShort RecNo, xbNdxNodeLink * n ) +{ + xbNdxLeafNode *temp; + char *p; + if( !n ) return 0L; + temp = &n->Leaf; + if( RecNo < 0 || RecNo > ( temp->NoOfKeysThisNode - 1 )) return 0L; + p = temp->KeyRecs + 4; + p += RecNo * ( 8 + HeadNode.KeyLen ); + return( dbf->xbase->GetLong( p )); +} +#endif +/***********************************************************************/ +//! Short description +/*! + \param RecNo + \param n +*/ +xbLong xbNdx::GetLeftNodeNo( xbShort RecNo, xbNdxNodeLink * n ) +{ + xbNdxLeafNode *temp; + char *p; + if( !n ) return 0L; + temp = &n->Leaf; + if( RecNo < 0 || RecNo > temp->NoOfKeysThisNode ) return 0L; + p = temp->KeyRecs; + p += RecNo * ( 8 + HeadNode.KeyLen ); + return( dbf->xbase->GetLong( p )); +} +/***********************************************************************/ +//! Short description +/*! + \param RecNo + \param n +*/ +char * xbNdx::GetKeyData( xbShort RecNo, xbNdxNodeLink * n ) +{ + xbNdxLeafNode *temp; + char *p; + if( !n ) return 0L; + temp = &n->Leaf; + if( RecNo < 0 || RecNo > ( temp->NoOfKeysThisNode - 1 )) return 0L; + p = temp->KeyRecs + 8; + p += RecNo * ( 8 + HeadNode.KeyLen ); + return( p ); +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbLong xbNdx::GetTotalNodes( void ) +{ + if( &HeadNode ) + return HeadNode.TotalNodes; + else + return 0L; +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbUShort xbNdx::GetKeysPerNode( void ) +{ + if( &HeadNode ) + return HeadNode.KeysPerNode; + else + return 0L; +} +/***********************************************************************/ +//! Short description +/*! + \param RetrieveSw +*/ +xbShort xbNdx::GetFirstKey( xbShort RetrieveSw ) +{ +/* This routine returns 0 on success and sets CurDbfRec to the record */ +/* corresponding to the first index pointer */ + + xbLong TempNodeNo; + xbShort rc; + + /* initialize the node chain */ + if( NodeChain ){ + ReleaseNodeMemory( NodeChain ); + NodeChain = NULL; + } + + if(( rc = GetHeadNode()) != 0 ){ + CurDbfRec = 0L; + return rc; + } + + /* get a node and add it to the link */ + if(( rc = GetLeafNode( HeadNode.StartNode, 1 )) != 0 ){ + return rc; + } + +/* traverse down the left side of the tree */ + while( GetLeftNodeNo( 0, CurNode )){ + TempNodeNo = GetLeftNodeNo( 0, CurNode ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ + CurDbfRec = 0L; + return rc; + } + CurNode->CurKeyNo = 0; + } + CurDbfRec = GetDbfNo( 0, CurNode ); + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param RetrieveSw +*/ +xbShort xbNdx::GetNextKey( xbShort RetrieveSw ) +{ +/* This routine returns 0 on success and sets CurDbfRec to the record */ +/* corresponding to the next index pointer */ + + xbNdxNodeLink * TempxbNodeLink; + xbLong TempNodeNo; + xbShort rc; + + if( !IsOpen() ){ + CurDbfRec = 0L; + return XB_NOT_OPEN; + } + + if( !CurNode ){ + rc = GetFirstKey( RetrieveSw ); + return rc; + } + + /* more keys on this node ? */ + if(( CurNode->Leaf.NoOfKeysThisNode-1) > CurNode->CurKeyNo ){ + CurNode->CurKeyNo++; + CurDbfRec = GetDbfNo( CurNode->CurKeyNo, CurNode ); + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; + } + + /* if head node we are at eof */ + if( CurNode->NodeNo == HeadNode.StartNode ) { + return XB_EOF; + } + + /* this logic assumes that interior nodes have n+1 left node no's where */ + /* n is the number of keys in the node */ + + /* pop up one node to the interior node level & free the leaf node */ + + TempxbNodeLink = CurNode; + CurNode = CurNode->PrevNode; + CurNode->NextNode = NULL; + ReleaseNodeMemory( TempxbNodeLink ); + + /* while no more right keys && not head node, pop up one node */ + while(( CurNode->CurKeyNo >= CurNode->Leaf.NoOfKeysThisNode ) && + ( CurNode->NodeNo != HeadNode.StartNode )){ + TempxbNodeLink = CurNode; + CurNode = CurNode->PrevNode; + CurNode->NextNode = NULL; + ReleaseNodeMemory( TempxbNodeLink ); + } + + /* if head node && right most key, return end-of-file */ + if(( HeadNode.StartNode == CurNode->NodeNo ) && + ( CurNode->CurKeyNo >= CurNode->Leaf.NoOfKeysThisNode )) { + return XB_EOF; + } + + /* move one to the right */ + CurNode->CurKeyNo++; + TempNodeNo = GetLeftNodeNo( CurNode->CurKeyNo, CurNode ); + + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ + return rc; + } + +/* traverse down the left side of the tree */ + while( GetLeftNodeNo( 0, CurNode )){ + TempNodeNo = GetLeftNodeNo( 0, CurNode ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ + CurDbfRec = 0L; + return rc; + } + CurNode->CurKeyNo = 0; + } + CurDbfRec = GetDbfNo( 0, CurNode ); + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param NodeNo + \param RetrieveSw +*/ +xbShort xbNdx::GetLastKey( xbLong NodeNo, xbShort RetrieveSw ) +{ +/* This routine returns 0 on success and sets CurDbfRec to the record */ +/* corresponding to the last index pointer */ + +/* If NodeNo = 0, start at head node, otherwise start at NodeNo */ + + xbLong TempNodeNo; + xbShort rc; + + if( NodeNo < 0 || NodeNo > HeadNode.TotalNodes ) + return XB_INVALID_NODE_NO; + + /* initialize the node chain */ + if( NodeChain ){ + ReleaseNodeMemory( NodeChain ); + NodeChain = NULL; + } + if( NodeNo == 0L ) + if(( rc = GetHeadNode()) != 0 ){ + CurDbfRec = 0L; + return rc; + } + + /* get a node and add it to the link */ + if( NodeNo == 0L ){ + if(( rc = GetLeafNode( HeadNode.StartNode, 1 )) != 0 ){ + CurDbfRec = 0L; + return rc; + } + } else { + if(( rc = GetLeafNode( NodeNo, 1 )) != 0 ) { + CurDbfRec = 0L; + return rc; + } + } + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + +/* traverse down the right side of the tree */ + while( GetLeftNodeNo( CurNode->Leaf.NoOfKeysThisNode, CurNode )){ + TempNodeNo = GetLeftNodeNo( CurNode->Leaf.NoOfKeysThisNode, CurNode ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ + CurDbfRec = 0L; + return rc; + } + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + } + CurNode->CurKeyNo--; /* leaf node has one fewer ix recs */ + CurDbfRec = GetDbfNo( CurNode->Leaf.NoOfKeysThisNode-1, CurNode ); + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param RetrieveSw +*/ +xbShort xbNdx::GetPrevKey( xbShort RetrieveSw ) +{ +/* This routine returns 0 on success and sets CurDbfRec to the record */ +/* corresponding to the previous index pointer */ + + xbNdxNodeLink * TempxbNodeLink; + xbLong TempNodeNo; + xbShort rc; + + if( !IsOpen() ){ + CurDbfRec = 0L; + return XB_NOT_OPEN; + } + + if( !CurNode ){ + CurDbfRec = 0L; + return GetFirstKey( RetrieveSw ); + } + + /* more keys on this node ? */ + if( CurNode->CurKeyNo > 0 ){ + CurNode->CurKeyNo--; + CurDbfRec = GetDbfNo( CurNode->CurKeyNo, CurNode ); + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; + } + + /* this logic assumes that interior nodes have n+1 left node no's where */ + /* n is the number of keys in the node */ + /* pop up one node to the interior node level & free the leaf node */ + + if( !CurNode->PrevNode ) { /* michael - make sure prev node exists */ + return XB_EOF; + } + + TempxbNodeLink = CurNode; + CurNode = CurNode->PrevNode; + CurNode->NextNode = NULL; + ReleaseNodeMemory( TempxbNodeLink ); + + /* while no more left keys && not head node, pop up one node */ + while(( CurNode->CurKeyNo == 0 ) && + ( CurNode->NodeNo != HeadNode.StartNode )) { + TempxbNodeLink = CurNode; + CurNode = CurNode->PrevNode; + CurNode->NextNode = NULL; + ReleaseNodeMemory( TempxbNodeLink ); + } + + /* if head node && left most key, return beginning-of-file */ + if(( HeadNode.StartNode == CurNode->NodeNo ) && + ( CurNode->CurKeyNo == 0 )) { + return XB_BOF; + } + + /* move one to the left */ + CurNode->CurKeyNo--; + TempNodeNo = GetLeftNodeNo( CurNode->CurKeyNo, CurNode ); + + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ) { + return rc; + } + + if( GetLeftNodeNo( 0, CurNode )) /* if interior node */ + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + else /* leaf node */ + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode - 1; + +/* traverse down the right side of the tree */ + while( GetLeftNodeNo( 0, CurNode )){ /* while interior node */ + TempNodeNo = GetLeftNodeNo( CurNode->Leaf.NoOfKeysThisNode, CurNode ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ + CurDbfRec = 0L; + return rc; + } + if( GetLeftNodeNo( 0, CurNode )) /* if interior node */ + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + else /* leaf node */ + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode - 1; + } + CurDbfRec = GetDbfNo( CurNode->Leaf.NoOfKeysThisNode - 1, CurNode ); + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; +} +/**************************************************************************/ +//! Short description +/*! + \param key + \param klen + \param node + \param comp +*/ +/* +** This is a pretty basic binary search with two exceptions: 1) it will +** find the first of duplicate key values and 2) will return the index +** and the value of the last comparision even if it doesn't find a +** match. +*/ +xbShort +xbNdx::BSearchNode(const char *key, xbShort klen, const xbNdxNodeLink *node, + xbShort *comp) +{ + xbShort c, p, start = 0, end = node->Leaf.NoOfKeysThisNode - 1; + + if(start > end){ + *comp = 2; + return 0; + } + + do { + p = (start + end) / 2; + c = CompareKey(key, GetKeyData(p, (xbNdxNodeLink *)node), klen); + switch(c){ + + case 1 : /* greater than */ + start = p + 1; + break; + + case 2 : /* less than */ + end = p - 1; + break; + } + } while(start <= end && c); + + + if(c == 1) + while(p < node->Leaf.NoOfKeysThisNode && + (c = CompareKey(key, GetKeyData(p, (xbNdxNodeLink *)node), klen)) == 1) + p++; + + *comp = c; + + if(!c) + while(p > 0 && !CompareKey(key, GetKeyData(p - 1, (xbNdxNodeLink *)node), klen)) + p--; + + return p; +} +/***********************************************************************/ +//! Short description +/*! + \param Tkey + \param Klen +*/ +xbLong xbNdx::GetLeafFromInteriorNode( const char * Tkey, xbShort Klen ) +{ + /* This function scans an interior node for a key and returns the */ + /* correct interior leaf node no */ + + xbShort p, c; + + /* if Tkey > any keys in node, return right most key */ + p = CurNode->Leaf.NoOfKeysThisNode - 1; + if( CompareKey( Tkey, GetKeyData( p, CurNode ), Klen ) == 1 ) { + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + return GetLeftNodeNo( CurNode->Leaf.NoOfKeysThisNode, CurNode ); + } + + p = BSearchNode(Tkey, Klen, CurNode, &c); + CurNode->CurKeyNo = p; + return GetLeftNodeNo( p, CurNode ); +} +/***********************************************************************/ +//! Short description +/*! + \param d +*/ +xbShort xbNdx::KeyExists( xbDouble d ) +{ + char buf[9]; + memset( buf, 0x00, 9 ); + dbf->xbase->PutDouble( buf, d ); + return FindKey( buf, 8, 0 ); +} +/***********************************************************************/ +//! Short description +/*! + \param d +*/ +xbShort xbNdx::FindKey( xbDouble d ) +{ + char buf[9]; + memset( buf, 0x00, 9 ); + dbf->xbase->PutDouble( buf, d ); + return FindKey( buf, 8, 1 ); +} +/***********************************************************************/ +//! Short description +/*! + \param Key +*/ +xbShort xbNdx::FindKey( const char * Key ) +{ + return FindKey( Key, strlen( Key ), 1 ); +} +/***********************************************************************/ +//! Short description +/*! + \param Tkey + \param DbfRec +*/ +xbShort xbNdx::FindKey( const char * Tkey, xbLong DbfRec ) +{ + /* find a key with a specifc DBF record number */ + xbShort rc; + + xbLong CurDbfRecNo; + xbLong CurNdxDbfNo; + + /* if we are already on the correct key, return XB_FOUND */ + if( CurNode ) { + CurDbfRecNo = dbf->GetCurRecNo(); + CurNdxDbfNo = GetDbfNo( CurNode->CurKeyNo, CurNode ); + if( CurDbfRecNo == CurNdxDbfNo && + (strncmp(Tkey, GetKeyData( CurNode->CurKeyNo, CurNode ), + HeadNode.KeyLen ) == 0 )) { + return XB_FOUND; + } + } + rc = FindKey( Tkey, HeadNode.KeyLen, 0 ); + + while( rc == 0 || rc == XB_FOUND ) { + if( strncmp( Tkey, GetKeyData( CurNode->CurKeyNo, CurNode ), + HeadNode.KeyLen ) == 0 ){ + if( DbfRec == GetDbfNo( CurNode->CurKeyNo, CurNode )) { + return XB_FOUND; + } + else + rc = GetNextKey( 0 ); + } else { + return XB_NOT_FOUND; + } + } + return XB_NOT_FOUND; +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbShort xbNdx::FindKey( void ) +{ + /* if no paramaters given, use KeyBuf */ + return( FindKey( KeyBuf, HeadNode.KeyLen, 0 )); +} +/***********************************************************************/ +//! Short description +/*! + \param Tkey + \param Klen + \param RetrieveSw +*/ +xbShort xbNdx::FindKey( const char * Tkey, xbShort Klen, xbShort RetrieveSw ) +{ + /* This routine sets the current key to the found key */ + /* if RetrieveSw is true, the method positions the dbf record */ + xbShort rc,i; + xbLong TempNodeNo; + + if( NodeChain ) { + ReleaseNodeMemory( NodeChain ); + NodeChain = NULL; + } + + if(( rc = GetHeadNode()) != 0 ){ + CurDbfRec = 0L; + return rc; + } + + /* load first node */ + if(( rc = GetLeafNode( HeadNode.StartNode, 1 )) != 0 ){ + CurDbfRec = 0L; + return rc; + } + + /* traverse down the tree until it hits a leaf */ + while( GetLeftNodeNo( 0, CurNode )){ /* while interior node */ + TempNodeNo = GetLeafFromInteriorNode( Tkey, Klen ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ + CurDbfRec = 0L; + return rc; + } + } + + i = BSearchNode(Tkey, Klen, CurNode, &rc); + switch(rc) { + case 0 : /* found! */ + CurNode->CurKeyNo = i; + CurDbfRec = GetDbfNo( i, CurNode ); + if( RetrieveSw ) + dbf->GetRecord(CurDbfRec); + return XB_FOUND; + + case 1 : /* less than */ +// if(i < CurNode->Leaf.NoOfKeysThisNode) + break; +// i++; + + case 2 : /* greater than */ + CurNode->CurKeyNo = i; + CurDbfRec = GetDbfNo( i, CurNode ); + if( RetrieveSw ) + dbf->GetRecord(CurDbfRec); + return XB_NOT_FOUND; + } + + CurNode->CurKeyNo = i; + if(i >= CurNode->Leaf.NoOfKeysThisNode){ + CurDbfRec = 0; + return XB_EOF; + } + + CurDbfRec = GetDbfNo( i, CurNode ); + if((RetrieveSw) && (CurDbfRec > 0)) + dbf->GetRecord( CurDbfRec ); + + return XB_NOT_FOUND; +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbShort xbNdx::CalcKeyLen() +{ + xbShort rc; + xbExpNode * TempNode; + char FieldName[11]; + char Type; + + TempNode = IxExp->GetFirstTreeNode(); + + if( !TempNode ) + return 0; + + if( TempNode->Type == 'd' ) return -8; + if( TempNode->Type == 'D' ){ + memset( FieldName, 0x00, 11 ); + memcpy( FieldName, TempNode->NodeText, TempNode->Len ); + Type = dbf->GetFieldType( dbf->GetFieldNo( FieldName )); + if( Type == 'N' || Type == 'F' ) + return -8; + } + + if(( rc = IxExp->ProcessExpression()) != XB_NO_ERROR ) + return 0; + + TempNode = (xbExpNode *) IxExp->Pop(); + if( !TempNode ) + return 0; + rc = TempNode->DataLen; + + if( !TempNode->InTree ) + delete TempNode; + + return rc; +} +/***********************************************************************/ +//! Short description +/*! + \param IxName + \param Exp + \param Unique + \param Overlay +*/ +xbShort xbNdx::CreateIndex(const char * IxName, const char * Exp, + xbShort Unique, xbShort Overlay ) +{ + xbShort i, KeyLen, rc; + + if( IsOpen()) CloseIndex(); + if( strlen( Exp ) > 488 ) + return XB_INVALID_KEY_EXPRESSION; + + if( dbf->GetDbfStatus() == 0 ) + return XB_NOT_OPEN; + + /* Get the index file name and store it in the class */ + SetFileName(IxName); + + /* check if the file already exists */ + if (((indexfp = fopen( GetFileName(), "r" )) != NULL ) && !Overlay ) { + fclose( indexfp ); + return XB_FILE_EXISTS; + } + + if (indexfp) + fclose(indexfp); + + if(( indexfp = fopen( GetFileName(), "w+b" )) == NULL ) + return XB_OPEN_ERROR; + +#ifdef XB_LOCKING_ON + /* + ** Must turn off buffering when multiple programs may be accessing + ** index files. + */ + setbuf( indexfp, NULL ); +#endif + + /* parse the expression */ + IxExp = new xbExpn( dbf->xbase ); + if(( rc = IxExp->BuildExpressionTree( Exp, strlen( Exp ), dbf )) != XB_NO_ERROR ) + return rc; + + /* build the header record */ + memset( &HeadNode, 0x00, sizeof( xbNdxHeadNode )); + HeadNode.StartNode = 1L; + HeadNode.TotalNodes = 2L; + HeadNode.NoOfKeys = 1L; + KeyLen = CalcKeyLen(); + + if( KeyLen == 0 || KeyLen > 100 ) /* 100 byte key length limit */ + return XB_INVALID_KEY; + else if( KeyLen == -8 ){ + HeadNode.KeyType = 1; /* numeric key */ + HeadNode.KeyLen = 8; + } else { + HeadNode.KeyType = 0; /* character key */ + HeadNode.KeyLen = KeyLen; + } + +// HeadNode.KeysPerNode = (xbUShort) ( XB_NDX_NODE_SIZE - (2*sizeof( xbLong ))) / +// (HeadNode.KeyLen + 8 ); +// HeadNode.KeySize = HeadNode.KeyLen + 8; +// while(( HeadNode.KeySize % 4 ) != 0 ) HeadNode.KeySize++; /* multiple of 4*/ + +/* above code replaced with following by Paul Koufalis pkoufalis@cogicom.com */ +// while(( HeadNode.KeyLen % 4 ) != 0 ) HeadNode.KeyLen++; /* multiple of 4*/ +// HeadNode.KeySize = HeadNode.KeyLen + 8; + + +/* above two lines commented out by gary 4/14/99 and replaced w/ following + For compatibility with other Xbase tools + KeyLen is the length of the key data + KeySize = KeyLen+8, rounded up until divisible by 4 +*/ + + HeadNode.KeySize = HeadNode.KeyLen + 8; + while(( HeadNode.KeySize % 4 ) != 0 ) HeadNode.KeySize++; /* multiple of 4*/ + + HeadNode.KeysPerNode = (xbUShort) + (XB_NDX_NODE_SIZE - (2*sizeof( xbLong ))) / HeadNode.KeySize; + + HeadNode.Unique = Unique; + strncpy( HeadNode.KeyExpression, Exp, 488 ); + KeyBuf = (char *) malloc( HeadNode.KeyLen + 1 ); + KeyBuf2 = (char *) malloc( HeadNode.KeyLen + 1 ); + memset( KeyBuf, 0x00, HeadNode.KeyLen + 1 ); + memset( KeyBuf2, 0x00, HeadNode.KeyLen + 1 ); + + if(( rc = PutHeadNode( &HeadNode, indexfp, 0 )) != 0 ){ + return rc; + } + /* write node #1 all 0x00 */ + for( i = 0; i < XB_NDX_NODE_SIZE; i++ ){ + if ((fwrite("\x00", 1, 1, indexfp)) != 1){ + fclose( indexfp ); + return XB_WRITE_ERROR; + } + } +// IndexStatus = XB_OPEN; + return dbf->AddIndexToIxList( index, GetFileName() ); +} +/***********************************************************************/ +//! Short description +/*! + \param RecNo + \param n + \param NodeNo +*/ +xbShort xbNdx::PutLeftNodeNo( xbShort RecNo, xbNdxNodeLink *n, xbLong NodeNo ) +{ + /* This routine sets n node's leftnode number */ + xbNdxLeafNode *temp; + char *p; + if( !n ) + return XB_INVALID_NODELINK; + + temp = &n->Leaf; + if( RecNo < 0 || RecNo > HeadNode.KeysPerNode) + return XB_INVALID_KEY; + + p = temp->KeyRecs; + p+= RecNo * ( 8 + HeadNode.KeyLen ); + dbf->xbase->PutLong( p, NodeNo ); + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param RecNo + \param n + \param DbfNo +*/ +xbShort xbNdx::PutDbfNo( xbShort RecNo, xbNdxNodeLink *n, xbLong DbfNo ) +{ + /* This routine sets n node's dbf number */ + xbNdxLeafNode *temp; + char *p; + if( !n ) + return XB_INVALID_NODELINK; + + temp = &n->Leaf; + if( RecNo < 0 || RecNo > (HeadNode.KeysPerNode-1)) + return XB_INVALID_KEY; + + p = temp->KeyRecs + 4; + p+= RecNo * ( 8 + HeadNode.KeyLen ); + dbf->xbase->PutLong( p, DbfNo ); + return XB_NO_ERROR; +} +/************************************************************************/ +//! Short description +/*! + \param l + \param n +*/ +xbShort xbNdx::PutLeafNode( xbLong l, xbNdxNodeLink *n ) +{ + if ((_fseek(indexfp, (xbOffT)l * XB_NDX_NODE_SIZE , SEEK_SET)) != 0) { + fclose( indexfp ); + return XB_SEEK_ERROR; + } + dbf->xbase->PutLong( Node, n->Leaf.NoOfKeysThisNode ); + + if(( fwrite( Node, 4, 1, indexfp )) != 1 ){ + fclose( indexfp ); + return XB_WRITE_ERROR; + } + if(( fwrite( &n->Leaf.KeyRecs, XB_NDX_NODE_SIZE-4, 1, indexfp )) != 1 ){ + fclose( indexfp ); + return XB_WRITE_ERROR; + } + return 0; +} +/************************************************************************/ +//! Short description +/*! + \param Head + \param f + \param UpdateOnly +*/ +xbShort xbNdx::PutHeadNode( xbNdxHeadNode * Head, FILE * f, xbShort UpdateOnly ) +{ + char buf[4]; + + if(( _fseek( f, 0L, SEEK_SET )) != 0 ){ + fclose( f ); + return XB_SEEK_ERROR; + } + memset( buf, 0x00, 4 ); + dbf->xbase->PutLong( buf, Head->StartNode ); + if(( fwrite( &buf, 4, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + memset( buf, 0x00, 4 ); + dbf->xbase->PutLong( buf, Head->TotalNodes ); + if(( fwrite( &buf, 4, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + memset( buf, 0x00, 4 ); + dbf->xbase->PutLong( buf, Head->NoOfKeys ); + if(( fwrite( &buf, 4, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + if( UpdateOnly ) + return XB_NO_ERROR; + memset( buf, 0x00, 2 ); + dbf->xbase->PutLong( buf, Head->KeyLen ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + memset( buf, 0x00, 2 ); + dbf->xbase->PutLong( buf, Head->KeysPerNode ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + memset( buf, 0x00, 2 ); + dbf->xbase->PutLong( buf, Head->KeyType ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + memset( buf, 0x00, 4 ); + dbf->xbase->PutLong( buf, Head->KeySize ); + if(( fwrite( &buf, 4, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + if(( fwrite( &Head->Unknown2, XB_NDX_NODE_SIZE - 22, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + return 0; +} +/************************************************************************/ +//! Short description +/*! + \param RecNo + \param n +*/ +xbShort xbNdx::PutKeyData( xbShort RecNo, xbNdxNodeLink *n ) +{ + /* This routine copies the KeyBuf data into xbNdxNodeLink n */ + xbNdxLeafNode *temp; + char *p; + xbShort i; + if( !n ) + return XB_INVALID_NODELINK; + + temp = &n->Leaf; + if( RecNo < 0 || RecNo > (HeadNode.KeysPerNode-1)) + return XB_INVALID_KEY; + + p = temp->KeyRecs + 8; + p+= RecNo * ( 8 + HeadNode.KeyLen ); + for( i = 0; i < HeadNode.KeyLen; i++ ) { + *p = KeyBuf[i]; + p++; + } + return XB_NO_ERROR; +} +/************************************************************************/ +//! Short description +/*! + \param n + \param pos + \param d + \param l + \param w +*/ +xbShort xbNdx::PutKeyInNode( xbNdxNodeLink * n, xbShort pos, xbLong d, + xbLong l, xbShort w ) +{ + xbShort i; + + /* check the node */ + if (!n) + return XB_INVALID_NODELINK; + + if(pos < 0 || pos > HeadNode.KeysPerNode) + return XB_INVALID_RECORD; + + if(n->Leaf.NoOfKeysThisNode >= HeadNode.KeysPerNode) + return XB_NODE_FULL; + + /* if key movement, save the original key */ + if( pos < n->Leaf.NoOfKeysThisNode ) + memcpy( KeyBuf2, KeyBuf, HeadNode.KeyLen + 1); + + /* if interior node, handle the right most left node no */ + if( GetLeftNodeNo( 0, n )) + PutLeftNodeNo( n->Leaf.NoOfKeysThisNode+1, n, + GetLeftNodeNo( n->Leaf.NoOfKeysThisNode, n )); + + for( i = n->Leaf.NoOfKeysThisNode; i > pos; i-- ){ + memcpy( KeyBuf, GetKeyData(i-1,n), HeadNode.KeyLen ); + PutKeyData( i, n ); + PutDbfNo( i, n, GetDbfNo(i-1,n)); + PutLeftNodeNo(i, n, GetLeftNodeNo(i-1,n)); + } + + /* put new key in node */ + if( pos < n->Leaf.NoOfKeysThisNode ) + memcpy( KeyBuf, KeyBuf2, HeadNode.KeyLen + 1); + + PutKeyData( pos, n ); + PutDbfNo( pos, n, d ); + PutLeftNodeNo( pos, n, l ); + n->Leaf.NoOfKeysThisNode++; + if( w ) + return PutLeafNode( n->NodeNo, n ); + else + return 0; +} +/************************************************************************/ +//! Short description +/*! + \param curNode Current Node + \param newNode New Empty Node + \param pos Position of new key in current node + \param d dbf record number +*/ +/* This function splits a full index leaf node into two parts + as of 2/13/04, this split logic was modified to cause an + even split in order to keep the index tree balanced + +*/ + +xbShort xbNdx::SplitLeafNode( xbNdxNodeLink *curNode, + xbNdxNodeLink *newNode, xbShort pos, xbLong d ) +{ + xbShort curNodeNewSize; + xbShort newNodeSize; + xbShort i,j,rc,startPos; + + curNodeNewSize = (curNode->Leaf.NoOfKeysThisNode + 1) / 2; + newNodeSize = curNode->Leaf.NoOfKeysThisNode + 1 - curNodeNewSize; + + /* save off the current key buffer */ + memcpy( KeyBuf2, KeyBuf, HeadNode.KeyLen + 1 ); + if( pos < curNodeNewSize ){ /* new key goes in current node */ + + /* copy second half of current node to beginning of new node */ + /* memcpy( dst, src, len ); */ + startPos = curNode->Leaf.NoOfKeysThisNode - newNodeSize; + + for( i = startPos, j = 0; i < CurNode->Leaf.NoOfKeysThisNode; i++, j++){ + memcpy( KeyBuf, GetKeyData( i, curNode ), HeadNode.KeyLen ); + PutKeyData( j, newNode ); + PutDbfNo( j, newNode, GetDbfNo( i, curNode )); + } + + /* make a hole for the new key */ + for( i = curNodeNewSize - 1; i > pos; i-- ){ + memcpy( KeyBuf, GetKeyData( i-1, curNode ), HeadNode.KeyLen ); + PutKeyData( i, curNode ); + PutDbfNo( i, curNode, GetDbfNo( i-1, curNode )); + } + + /* insert key appropriately */ + memcpy( KeyBuf, KeyBuf2, HeadNode.KeyLen + 1 ); + PutKeyData( pos, curNode ); + PutDbfNo( pos, curNode, d ); + } + else + { + pos -= curNodeNewSize; + + /* do part one of the key migration */ + if( pos ){ + +/* was originally + + startPos = curNode->Leaf.NoOfKeysThisNode - curNodeNewSize + 1; + + + then was changed to +*/ + +/* + if( ((pos + curNodeNewSize) == HeadNode.KeysPerNode) && + (pos == newNodeSize) ){ // off the right end + startPos = curNode->Leaf.NoOfKeysThisNode - curNodeNewSize; + } + else + { + startPos = curNode->Leaf.NoOfKeysThisNode - curNodeNewSize + 1; + } + +*/ + +/* + and this didn't work + + + startPos = curNode->Leaf.NoOfKeysThisNode - curNodeNewSize; + +*/ + + startPos = curNodeNewSize; + for( i = startPos, j = 0; + j < pos && i < curNode->Leaf.NoOfKeysThisNode; i++, j++){ + memcpy( KeyBuf, GetKeyData( i, curNode ), HeadNode.KeyLen ); + PutKeyData( j, newNode ); + PutDbfNo( j, newNode, GetDbfNo( i, curNode )); + } + } + + /* insert new key appropriately */ + memcpy( KeyBuf, KeyBuf2, HeadNode.KeyLen + 1 ); + PutKeyData( pos, newNode ); + PutDbfNo( pos, newNode, d ); + + /* Load the remainder of the keys on the new node past the new key */ + if( pos < (newNodeSize-1) ){ + +// startPos = curNode->Leaf.NoOfKeysThisNode - curNodeNewSize + pos + 1; + + startPos = curNodeNewSize + pos; + for( i = startPos, j = pos+1; j < newNodeSize; i++, j++){ + memcpy( KeyBuf, GetKeyData( i, curNode ), HeadNode.KeyLen ); + PutKeyData( j, newNode ); + PutDbfNo( j, newNode, GetDbfNo( i, curNode )); + } + } + } + + curNode->Leaf.NoOfKeysThisNode = curNodeNewSize; + newNode->Leaf.NoOfKeysThisNode = newNodeSize; + + /* write the new nodes to disk */ + if(( rc = PutLeafNode( curNode->NodeNo, curNode )) != 0 ) + return rc; + if(( rc = PutLeafNode( newNode->NodeNo, newNode )) != 0 ) + return rc; + + return 0; +} +/************************************************************************/ +//! Short description +/*! + \param nodeToSplit Interior node to split + \param newNode New empty node to use + \param dscNodeNo Descendant node number +*/ +/* This routine splits an interior node */ + +xbShort xbNdx::SplitINode( xbNdxNodeLink *nodeToSplit, + xbNdxNodeLink *newNode, xbLong dscNodeNo ) +{ + xbShort i,j,rc; + xbNdxNodeLink * SaveNodeChain; + xbNdxNodeLink * SaveCurNode; + xbLong newNodeToSplitSize; + xbLong newNodeSize; + xbShort pos, startPos, offset; + + newNodeToSplitSize = (nodeToSplit->Leaf.NoOfKeysThisNode + 2 ) / 2; + newNodeSize = nodeToSplit->Leaf.NoOfKeysThisNode + 2 - newNodeToSplitSize; + pos = nodeToSplit->CurKeyNo; + + if( pos < (newNodeToSplitSize-1) ){ + /* copy second half of nodeToSplit to newNode */ + startPos = nodeToSplit->Leaf.NoOfKeysThisNode - newNodeSize +1; + for(i=startPos, j=0; i <= nodeToSplit->Leaf.NoOfKeysThisNode; i++, j++ ){ + if( i < nodeToSplit->Leaf.NoOfKeysThisNode ){ + memcpy( KeyBuf, GetKeyData( i, nodeToSplit ), HeadNode.KeyLen ); + PutKeyData( j, newNode ); + } + PutLeftNodeNo( j, newNode, GetLeftNodeNo( i, nodeToSplit )); + } + + /* make a hole for the new key */ + for( i = newNodeToSplitSize; i > pos; i-- ){ + memcpy( KeyBuf, GetKeyData( i-1, nodeToSplit ), HeadNode.KeyLen ); + PutKeyData( i, nodeToSplit ); + PutLeftNodeNo( i, nodeToSplit, GetLeftNodeNo( i-1, nodeToSplit )); + } + + /* load new high key value into current position on nodeToSplit */ + if( pos < (newNodeToSplitSize - 1 )){ + SaveNodeChain = NodeChain; + NodeChain = NULL; + SaveCurNode = CurNode; + GetLastKey( GetLeftNodeNo( pos, nodeToSplit ), 0 ); + memcpy( KeyBuf, GetKeyData( CurNode->CurKeyNo, CurNode ), HeadNode.KeyLen ); + PutKeyData( pos, nodeToSplit ); + ReleaseNodeMemory( NodeChain ); + NodeChain = SaveNodeChain; + CurNode = SaveCurNode; + } + PutLeftNodeNo( pos+1, nodeToSplit, dscNodeNo ); + } + +/*************/ +/* part b */ +/*************/ + + else + { + pos -= newNodeToSplitSize-1; + /* do part one of the key migration */ + if( pos ){ +// startPos = nodeToSplit->Leaf.NoOfKeysThisNode - newNodeToSplitSize + 2; + +// 5/29/04 gak changed the following line for index probs +// startPos = nodeToSplit->Leaf.NoOfKeysThisNode - newNodeToSplitSize + 1; + + if( HeadNode.KeysPerNode % 2 ) + offset = 2; + else + offset = 1; + + startPos = nodeToSplit->Leaf.NoOfKeysThisNode - newNodeToSplitSize + offset; + + for( i = startPos, j = 0; j < pos; i++, j++ ){ + if( i < nodeToSplit->Leaf.NoOfKeysThisNode && j < (pos-1)){ + memcpy( KeyBuf, GetKeyData( i, nodeToSplit ), HeadNode.KeyLen ); + PutKeyData( j, newNode ); + } + else + { + SaveNodeChain = NodeChain; + NodeChain = NULL; + SaveCurNode = CurNode; + GetLastKey( GetLeftNodeNo( i, nodeToSplit ), 0 ); + memcpy(KeyBuf,GetKeyData(CurNode->CurKeyNo,CurNode),HeadNode.KeyLen); + PutKeyData( j, newNode ); + ReleaseNodeMemory( NodeChain ); + NodeChain = SaveNodeChain; + CurNode = SaveCurNode; + } + PutLeftNodeNo( j, newNode, GetLeftNodeNo( i, nodeToSplit )); + } + } + + /* insert new key appropriately */ + if( pos < (newNodeSize - 1)){ + SaveNodeChain = NodeChain; + NodeChain = NULL; + SaveCurNode = CurNode; + GetLastKey( dscNodeNo, 0 ); + memcpy(KeyBuf,GetKeyData(CurNode->CurKeyNo,CurNode),HeadNode.KeyLen); + PutKeyData( pos, newNode ); + ReleaseNodeMemory( NodeChain ); + NodeChain = SaveNodeChain; + CurNode = SaveCurNode; + } + PutLeftNodeNo( pos, newNode, dscNodeNo ); + + /* load remainder of the keys */ + if( pos < (newNodeSize - 1)){ + + +// startPos=nodeToSplit->Leaf.NoOfKeysThisNode-newNodeToSplitSize+pos+2; +// 5/29/04 gak changed the following line for index probs + + startPos=nodeToSplit->Leaf.NoOfKeysThisNode-newNodeToSplitSize+pos+offset; + + for( i = startPos, j = pos+1; j < newNodeSize; i++, j++ ){ + if( i < nodeToSplit->Leaf.NoOfKeysThisNode ){ + memcpy( KeyBuf, GetKeyData( i, nodeToSplit ), HeadNode.KeyLen ); + PutKeyData( j, newNode ); + } + PutLeftNodeNo( j, newNode, GetLeftNodeNo( i, nodeToSplit )); + } + } + } + + nodeToSplit->Leaf.NoOfKeysThisNode = newNodeToSplitSize - 1; + newNode->Leaf.NoOfKeysThisNode = newNodeSize - 1; + + if((rc = PutLeafNode( nodeToSplit->NodeNo, nodeToSplit )) != 0) return rc; + if((rc = PutLeafNode( newNode->NodeNo, newNode )) != 0) return rc; + return 0; +} +/************************************************************************/ +//! Short description +/*! + \param RecBufSw + \param KeyBufSw +*/ +xbShort xbNdx::CreateKey( xbShort RecBufSw, xbShort KeyBufSw ) +{ + /* RecBufSw 0 Use RecBuf */ + /* 1 Use RecBuf2 */ + /* KeyBufSw 0 Use KeyBuf */ + /* 1 Use KeyBuf2 */ + + xbShort rc; + xbExpNode * TempNode; + + if(( rc = IxExp->ProcessExpression( RecBufSw )) != XB_NO_ERROR ) + return rc; + TempNode = (xbExpNode *) IxExp->Pop(); + if( !TempNode ) + return XB_INVALID_KEY; + + if( KeyBufSw ){ + if( HeadNode.KeyType == 1 ) /* numeric key */ + dbf->xbase->PutDouble( KeyBuf2, TempNode->DoubResult ); + else{ /* character key */ + memset( KeyBuf2, 0x00, HeadNode.KeyLen + 1 ); + memcpy( KeyBuf2, TempNode->StringResult, XB_MIN(HeadNode.KeyLen + 1, TempNode->DataLen) ); + } + } else { + if( HeadNode.KeyType == 1 ) /* numeric key */ + dbf->xbase->PutDouble( KeyBuf, TempNode->DoubResult ); + else { /* character key */ + memset( KeyBuf, 0x00, HeadNode.KeyLen + 1 ); + memcpy( KeyBuf, TempNode->StringResult.c_str(), XB_MIN(HeadNode.KeyLen + 1, TempNode->DataLen) ); + } + } +// if( !TempNode->InTree ) dbf->xbase->FreeExpNode( TempNode ); + if( !TempNode->InTree ) delete TempNode; + return 0; +} +/************************************************************************/ +//! Short description +/*! + \param key +*/ +xbShort +xbNdx::GetCurrentKey(char *key) +{ + CreateKey(0, 0); + if(HeadNode.KeyType == 1) + memcpy(key, KeyBuf, 8); + else + memcpy(key, KeyBuf, HeadNode.KeyLen + 1); + return 0; +} +/************************************************************************/ +//! Short description +/*! + \param DbfRec +*/ +xbShort xbNdx::AddKey( xbLong DbfRec ) +{ + /* This routine assumes KeyBuf contains the contents of the index to key */ + + char *p; + xbShort i,rc; + xbNdxNodeLink * TempNode; + xbNdxNodeLink * Tparent; + xbLong TempNodeNo; /* new, unattached leaf node no */ + xbNdxNodeLink * SaveNodeChain; + xbNdxNodeLink * SaveCurNode; + + /* find node key belongs in */ + rc = FindKey( KeyBuf, HeadNode.KeyLen, 0 ); + if( rc == XB_FOUND && HeadNode.Unique ) + return XB_KEY_NOT_UNIQUE; + + if( CurNode->Leaf.NoOfKeysThisNode > 0 && rc == XB_FOUND ){ + rc = 0; + while( rc == 0 ){ + if(( p = GetKeyData( CurNode->CurKeyNo, CurNode )) == NULL ) + rc = -1; + else { + rc = CompareKey( KeyBuf, p, HeadNode.KeyLen ); + if( rc == 0 && DbfRec >= GetDbfNo( CurNode->CurKeyNo, CurNode )){ + if((rc = GetNextKey(0)) == XB_EOF) { + if((rc = GetLastKey(0, 0)) != XB_NO_ERROR) + return rc; + CurNode->CurKeyNo++; + } + } + else + rc = -1; + } + } + } + + /* update header node */ + HeadNode.NoOfKeys++; + /************************************************/ + /* section A - if room in node, add key to node */ + /************************************************/ + + if( CurNode->Leaf.NoOfKeysThisNode < HeadNode.KeysPerNode ){ + if(( rc = PutKeyInNode( CurNode,CurNode->CurKeyNo,DbfRec,0L,1)) != 0) + return rc; + if(( rc = PutHeadNode( &HeadNode, indexfp, 1 )) != 0) + return rc; + return XB_NO_ERROR; + } + + /***********************************************************************/ + /* section B - split leaf node if full and put key in correct position */ + /***********************************************************************/ + + TempNode = GetNodeMemory(); + TempNode->NodeNo = HeadNode.TotalNodes++; + rc = SplitLeafNode( CurNode, TempNode, CurNode->CurKeyNo, DbfRec ); + if( rc ) + return rc; + + TempNodeNo = TempNode->NodeNo; + ReleaseNodeMemory( TempNode ); + + /*****************************************************/ + /* section C go up tree splitting nodes as necessary */ + /*****************************************************/ + Tparent = CurNode->PrevNode; + + while( Tparent && + Tparent->Leaf.NoOfKeysThisNode >= HeadNode.KeysPerNode-1) { + + TempNode = GetNodeMemory(); + + if( !TempNode ) + return XB_NO_MEMORY; + TempNode->NodeNo = HeadNode.TotalNodes++; + + rc = SplitINode( Tparent, TempNode, TempNodeNo ); + if( rc ) return rc; + + TempNodeNo = TempNode->NodeNo; + ReleaseNodeMemory( TempNode ); + ReleaseNodeMemory( CurNode ); + CurNode = Tparent; + CurNode->NextNode = NULL; + Tparent = CurNode->PrevNode; + } + + /************************************************************/ + /* Section D if CurNode is split root, create new root */ + /************************************************************/ + + /* at this point + CurNode = The node that was just split + TempNodeNo = The new node split off from CurNode */ + + if(CurNode->NodeNo == HeadNode.StartNode ){ + TempNode = GetNodeMemory(); + if( !TempNode ) + return XB_NO_MEMORY; + + SaveNodeChain = NodeChain; + NodeChain = NULL; + SaveCurNode = CurNode; + GetLastKey( CurNode->NodeNo, 0 ); + memcpy( KeyBuf, GetKeyData( CurNode->CurKeyNo,CurNode ),HeadNode.KeyLen ); + ReleaseNodeMemory( NodeChain ); + NodeChain = SaveNodeChain; + CurNode = SaveCurNode; + PutKeyData( 0, TempNode ); + PutLeftNodeNo( 0, TempNode, CurNode->NodeNo ); + PutLeftNodeNo( 1, TempNode, TempNodeNo ); + TempNode->NodeNo = HeadNode.TotalNodes++; + TempNode->Leaf.NoOfKeysThisNode++; + HeadNode.StartNode = TempNode->NodeNo; + rc = PutLeafNode( TempNode->NodeNo, TempNode ); + if( rc ) return rc; + rc = PutHeadNode( &HeadNode, indexfp, 1 ); + if( rc ) return rc; + ReleaseNodeMemory( TempNode ); + return XB_NO_ERROR; + } + /**********************************/ + /* Section E make room in parent */ + /**********************************/ + for( i = Tparent->Leaf.NoOfKeysThisNode; i > Tparent->CurKeyNo; i-- ){ + memcpy( KeyBuf, GetKeyData( i-1, Tparent ), HeadNode.KeyLen ); + PutKeyData( i, Tparent ); + PutLeftNodeNo( i+1, Tparent, GetLeftNodeNo( i, Tparent )); + } + + /* put key in parent */ + SaveNodeChain = NodeChain; + NodeChain = NULL; + SaveCurNode = CurNode; + GetLastKey( CurNode->NodeNo, 0 ); + memcpy( KeyBuf,GetKeyData( CurNode->CurKeyNo, CurNode ), HeadNode.KeyLen ); + ReleaseNodeMemory( NodeChain ); + NodeChain = SaveNodeChain; + CurNode = SaveCurNode; + PutKeyData( i, Tparent ); + PutLeftNodeNo( i+1, Tparent, TempNodeNo ); + Tparent->Leaf.NoOfKeysThisNode++; + rc = PutLeafNode( Tparent->NodeNo, Tparent ); + if( rc ) return rc; + rc = PutHeadNode( &HeadNode, indexfp, 1 ); + if( rc ) return rc; + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param pos + \param n +*/ +xbShort xbNdx::RemoveKeyFromNode( xbShort pos, xbNdxNodeLink *n ) +{ + xbShort i; + /* check the node */ + if( !n ) + return XB_INVALID_NODELINK; + + if( pos < 0 || pos > HeadNode.KeysPerNode ) + return XB_INVALID_KEY; + + for( i = pos; i < n->Leaf.NoOfKeysThisNode-1; i++ ){ + memcpy( KeyBuf, GetKeyData( i+1, n), HeadNode.KeyLen ); + PutKeyData( i, n ); + PutDbfNo( i, n, GetDbfNo( i+1, n )); + PutLeftNodeNo( i, n, GetLeftNodeNo( i+1, n )); + } + PutLeftNodeNo( i, n, GetLeftNodeNo( i+1, n )); + n->Leaf.NoOfKeysThisNode--; + /* if last key was deleted, decrement CurKeyNo */ + if( n->CurKeyNo > n->Leaf.NoOfKeysThisNode ) + n->CurKeyNo--; + return PutLeafNode( n->NodeNo, n ); +} +/***********************************************************************/ +//! Short description +/*! + \param n +*/ +xbShort xbNdx::UpdateParentKey( xbNdxNodeLink * n ) +{ +/* this routine goes backwards thru the node chain looking for a parent + node to update */ + + xbNdxNodeLink * TempNode; + if( !n ) + return XB_INVALID_NODELINK; + + if( !GetDbfNo( 0, n )) + return XB_NOT_LEAFNODE; + + TempNode = n->PrevNode; + while( TempNode ){ + if( TempNode->CurKeyNo < TempNode->Leaf.NoOfKeysThisNode ){ + memcpy(KeyBuf,GetKeyData(n->Leaf.NoOfKeysThisNode-1,n),HeadNode.KeyLen); + PutKeyData( TempNode->CurKeyNo, TempNode ); + return PutLeafNode( TempNode->NodeNo, TempNode ); + } + TempNode = TempNode->PrevNode; + } + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param n +*/ +/* This routine queues up a list of nodes which have been emptied */ +void xbNdx::UpdateDeleteList( xbNdxNodeLink *n ) +{ + n->NextNode = DeleteChain; + DeleteChain = n; +} +/***********************************************************************/ +//! Short description +/*! +*/ +/* Delete nodes from the node list - for now we leave the empty nodes */ +/* dangling in the file. Eventually we will remove nodes from the file */ + +void xbNdx::ProcessDeleteList( void ) +{ + if( DeleteChain ){ + ReleaseNodeMemory( DeleteChain ); + DeleteChain = NULL; + } +} +/***********************************************************************/ +//! Short description +/*! +*/ +xbShort xbNdx::KeyWasChanged( void ) +{ + CreateKey( 0, 0 ); /* use KeyBuf, RecBuf */ + CreateKey( 1, 1 ); /* use KeyBuf2, RecBuf2 */ + if( CompareKey( KeyBuf, KeyBuf2, HeadNode.KeyLen ) != 0 ) + return 1; + else + return 0; +} +/***********************************************************************/ +//! Short description +/*! + \param n +*/ +xbNdxNodeLink * xbNdx::LeftSiblingHasSpace( xbNdxNodeLink * n ) +{ + xbNdxNodeLink * TempNode; + xbNdxNodeLink * SaveCurNode; + + /* returns a Nodelink to xbNdxNodeLink n's left sibling if it has space */ + /* if left most node in parent return NULL */ + if( n->PrevNode->CurKeyNo == 0 ) + return NULL; + + SaveCurNode = CurNode; + GetLeafNode( GetLeftNodeNo( n->PrevNode->CurKeyNo-1, n->PrevNode ), 2 ); + if( CurNode->Leaf.NoOfKeysThisNode < HeadNode.KeysPerNode ){ + TempNode = CurNode; + CurNode = SaveCurNode; + TempNode->PrevNode = n->PrevNode; + return TempNode; + } else { /* node is already full */ + ReleaseNodeMemory( CurNode ); + CurNode = SaveCurNode; + return NULL; + } +} +/***********************************************************************/ +//! Short description +/*! + \param n +*/ +xbNdxNodeLink * xbNdx::RightSiblingHasSpace( xbNdxNodeLink * n ) +{ + /* returns a Nodelink to xbNdxNodeLink n's right sibling if it has space */ + + xbNdxNodeLink * TempNode; + xbNdxNodeLink * SaveCurNode; + + /* if left most node in parent return NULL */ + if( n->PrevNode->CurKeyNo >= n->PrevNode->Leaf.NoOfKeysThisNode ) + return NULL; + SaveCurNode = CurNode; + /* point curnode to right sib*/ + GetLeafNode( GetLeftNodeNo( n->PrevNode->CurKeyNo+1, n->PrevNode ), 2 ); + if( CurNode->Leaf.NoOfKeysThisNode < HeadNode.KeysPerNode ){ + TempNode = CurNode; + CurNode = SaveCurNode; + TempNode->PrevNode = n->PrevNode; + return TempNode; + } else { /* node is already full */ + ReleaseNodeMemory( CurNode ); + CurNode = SaveCurNode; + return NULL; + } +} +/*************************************************************************/ +//! Short description +/*! + \param n + \param Right +*/ +xbShort xbNdx::MoveToRightNode( xbNdxNodeLink * n, xbNdxNodeLink * Right ) +{ + xbShort j; + xbNdxNodeLink * TempNode; + xbNdxNodeLink * SaveCurNode; + xbNdxNodeLink * SaveNodeChain; + + if( n->CurKeyNo == 0 ){ + j = 1; + SaveNodeChain = NodeChain; + SaveCurNode = CurNode; + NodeChain = NULL; + GetLastKey( n->NodeNo, 0 ); + memcpy( KeyBuf, GetKeyData( CurNode->CurKeyNo, CurNode),HeadNode.KeyLen); + ReleaseNodeMemory( NodeChain ); + NodeChain = SaveNodeChain; + CurNode = SaveCurNode; + } else { + j = 0; + memcpy( KeyBuf, GetKeyData( j, n ), HeadNode.KeyLen); + } + PutKeyInNode( Right, 0, 0L, GetLeftNodeNo( j, n ), 1 ); + ReleaseNodeMemory( Right ); + TempNode = n; + CurNode = n->PrevNode; + n = n->PrevNode; + n->NextNode = NULL; + UpdateDeleteList( TempNode ); + DeleteSibling( n ); + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param n + \param Left +*/ +xbShort xbNdx::MoveToLeftNode( xbNdxNodeLink * n, xbNdxNodeLink * Left ) +{ + xbShort j, rc; + xbNdxNodeLink * SaveNodeChain; + xbNdxNodeLink * TempNode; + + if( n->CurKeyNo == 0 ) + j = 1; + else + j = 0; + + /* save the original node chain */ + SaveNodeChain = NodeChain; + NodeChain = NULL; + + /* determine new right most key for left node */ + GetLastKey( Left->NodeNo, 0 ); + memcpy( KeyBuf, GetKeyData( CurNode->CurKeyNo, CurNode ), HeadNode.KeyLen); + ReleaseNodeMemory( NodeChain ); + NodeChain = NULL; /* for next GetLastKey */ + PutKeyData( Left->Leaf.NoOfKeysThisNode, Left); + PutLeftNodeNo( Left->Leaf.NoOfKeysThisNode+1, Left, GetLeftNodeNo( j,n )); + Left->Leaf.NoOfKeysThisNode++; + Left->CurKeyNo = Left->Leaf.NoOfKeysThisNode; + if(( rc = PutLeafNode( Left->NodeNo, Left )) != 0 ) + return rc; + n->PrevNode->NextNode = NULL; + UpdateDeleteList( n ); + + /* get the new right most key for left to update parents */ + GetLastKey( Left->NodeNo, 0 ); + + /* assemble the chain */ + TempNode = Left->PrevNode; + TempNode->CurKeyNo--; + NodeChain->PrevNode = Left->PrevNode; + UpdateParentKey( CurNode ); + ReleaseNodeMemory( NodeChain ); + ReleaseNodeMemory( Left ); + CurNode = TempNode; + NodeChain = SaveNodeChain; + TempNode->CurKeyNo++; + DeleteSibling( TempNode ); + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param n +*/ +xbShort xbNdx::DeleteSibling( xbNdxNodeLink * n ) +{ + xbNdxNodeLink * Left; + xbNdxNodeLink * Right; + xbNdxNodeLink * SaveCurNode; + xbNdxNodeLink * SaveNodeChain; + xbNdxNodeLink * TempNode; + xbShort rc; + + /* this routine deletes sibling CurRecNo out of xbNodeLink n */ + if( n->Leaf.NoOfKeysThisNode > 1 ){ + RemoveKeyFromNode( n->CurKeyNo, n ); + if( n->CurKeyNo == n->Leaf.NoOfKeysThisNode ){ + SaveNodeChain = NodeChain; + SaveCurNode = CurNode; + NodeChain = NULL; + GetLastKey( n->NodeNo, 0 ); + /* assemble the node chain */ + TempNode = NodeChain->NextNode; + NodeChain->NextNode = NULL; + ReleaseNodeMemory( NodeChain ); + TempNode->PrevNode = n; + UpdateParentKey( CurNode ); + /* take it back apart */ + ReleaseNodeMemory( TempNode ); + NodeChain = SaveNodeChain; + CurNode = SaveCurNode; + } + } else if( n->NodeNo == HeadNode.StartNode ) { + /* get here if root node and only one child remains */ + /* make remaining node the new root */ + if( n->CurKeyNo == 0 ) + HeadNode.StartNode = GetLeftNodeNo( 1, n ); + else + HeadNode.StartNode = GetLeftNodeNo( 0, n ); + UpdateDeleteList( n ); + NodeChain = NULL; + CurNode = NULL; + } + else if (( Left = LeftSiblingHasSpace( n )) != NULL ) + return MoveToLeftNode( n, Left ); + else if (( Right = RightSiblingHasSpace( n )) != NULL ) + return MoveToRightNode( n, Right ); + /* else if left sibling exists */ + else if( n->PrevNode->CurKeyNo > 0 ) { + /* move right branch from left sibling to this node */ + SaveCurNode = CurNode; + SaveNodeChain = NodeChain; + NodeChain = NULL; + GetLeafNode( GetLeftNodeNo( n->PrevNode->CurKeyNo-1, n->PrevNode ), 2 ); + Left = CurNode; + Left->PrevNode = SaveCurNode->PrevNode; + GetLastKey( Left->NodeNo, 0 ); + strncpy( KeyBuf, GetKeyData( CurNode->CurKeyNo,CurNode),HeadNode.KeyLen ); + if( n->CurKeyNo == 1 ) + PutLeftNodeNo( 1, n, GetLeftNodeNo( 0, n )); + PutKeyData( 0, n ); + PutLeftNodeNo( 0, n, GetLeftNodeNo( Left->Leaf.NoOfKeysThisNode, Left )); + if(( rc = PutLeafNode( n->NodeNo, n )) != XB_NO_ERROR ) return rc; + SaveCurNode = n->PrevNode; + SaveCurNode->NextNode = NULL; + ReleaseNodeMemory( n ); + Left->Leaf.NoOfKeysThisNode--; + if(( rc = PutLeafNode( Left->NodeNo, Left )) != XB_NO_ERROR ) return rc; + /* rebuild left side of tree */ + GetLastKey( Left->NodeNo, 0 ); + NodeChain->PrevNode = SaveCurNode; + SaveCurNode->CurKeyNo--; + UpdateParentKey( CurNode ); + ReleaseNodeMemory( NodeChain ); + ReleaseNodeMemory( Left ); + CurNode = SaveCurNode; + NodeChain = SaveNodeChain; + } + /* right sibling must exist */ + else if( n->PrevNode->CurKeyNo <= n->PrevNode->Leaf.NoOfKeysThisNode ){ + /* move left branch from left sibling to this node */ + SaveCurNode = CurNode; + SaveNodeChain = NodeChain; + NodeChain = NULL; + + /* move the left node number one to the left if necessary */ + if( n->CurKeyNo == 0 ){ + PutLeftNodeNo( 0, n, GetLeftNodeNo( 1, n )); + GetLastKey( GetLeftNodeNo( 0, n ), 0 ); + memcpy(KeyBuf,GetKeyData(CurNode->CurKeyNo,CurNode),HeadNode.KeyLen); + PutKeyData( 0, n ); + ReleaseNodeMemory( NodeChain ); + NodeChain = NULL; + } + GetLeafNode( GetLeftNodeNo( n->PrevNode->CurKeyNo+1, n->PrevNode ), 2 ); + /* put leftmost node number from right node in this node */ + PutLeftNodeNo( 1, n, GetLeftNodeNo( 0, CurNode )); + if(( rc = PutLeafNode( n->NodeNo, n )) != XB_NO_ERROR ) return rc; + + /* remove the key from the right node */ + RemoveKeyFromNode( 0, CurNode ); + if(( rc = PutLeafNode( CurNode->NodeNo, CurNode )) != XB_NO_ERROR ) + return rc; + ReleaseNodeMemory( CurNode ); + + /* update new parent key value */ + GetLastKey( n->NodeNo, 0 ); + NodeChain->PrevNode = n->PrevNode; + UpdateParentKey( CurNode ); + ReleaseNodeMemory( NodeChain ); + NodeChain = SaveNodeChain; + CurNode = SaveCurNode; + } else { + /* this should never be true-but could be if 100 byte limit is ignored*/ + std::cout << "Fatal index error" << std::endl; + exit(0); + } + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description +/*! + \param DbfRec +*/ +xbShort xbNdx::DeleteKey( xbLong DbfRec ) +{ +/* this routine assumes the key to be deleted is in KeyBuf */ + + xbNdxNodeLink * TempNode; + xbShort rc; + +#if 0 + // Not sure why this check is here, but it prevents numeric keys + // from being deleted (and thus index updates will also fail). + // I have removed it for now. Derry Bryson + if( HeadNode.KeyType != 0x00 ) + xb_error(XB_INVALID_KEY_TYPE); +#endif + + if(( rc = FindKey( KeyBuf, DbfRec )) != XB_FOUND ) + return rc; + + /* found the record to delete at this point */ + HeadNode.NoOfKeys--; + + /* delete the key from the node */ + if(( rc = RemoveKeyFromNode( CurNode->CurKeyNo, CurNode )) != 0 ) + return rc; + + /* if root node, we are done */ + if( !( CurNode->NodeNo == HeadNode.StartNode )){ + /* if leaf node now empty */ + if( CurNode->Leaf.NoOfKeysThisNode == 0 ){ + TempNode = CurNode->PrevNode; + TempNode->NextNode = NULL; + UpdateDeleteList( CurNode ); + CurNode = TempNode; + DeleteSibling( CurNode ); + ProcessDeleteList(); + } + + /* if last key of leaf updated, update key in parent node */ + /* this logic updates the correct parent key */ + + else if( CurNode->CurKeyNo == CurNode->Leaf.NoOfKeysThisNode ) + UpdateParentKey( CurNode ); + } + + if(CurNode) + CurDbfRec = GetDbfNo( CurNode->CurKeyNo, CurNode ); + else + CurDbfRec = 0; + + if(( rc = PutHeadNode( &HeadNode, indexfp, 1 )) != 0 ) + return rc; + return XB_NO_ERROR; +} +/************************************************************************/ +//! Short description +/*! + \param option +*/ +#ifdef XBASE_DEBUG +xbShort xbNdx::CheckIndexIntegrity( const xbShort option ) +{ + /* if option = 1, print out some stats */ + xbShort rc; + xbLong ctr = 1L; + while( ctr <= dbf->NoOfRecords()){ + if( option ) std::cout << "Checking Record " << ctr << std::endl; + if(( rc = dbf->GetRecord(ctr++)) != XB_NO_ERROR ) + return rc; + if(!dbf->RecordDeleted()){ + CreateKey( 0, 0 ); + rc = FindKey( KeyBuf, dbf->GetCurRecNo()); + if( rc != XB_FOUND ){ + if( option ){ + std::cout << "Record number " << dbf->GetCurRecNo() + << " Not Found" << std::endl; + std::cout << "Key = " << KeyBuf << std::endl; + } + return rc; + } + } + } + if( option ) + std::cout << std::endl << "Total records checked = " + << ctr - 1 << std::endl; + return XB_NO_ERROR; +} +#endif +/***********************************************************************/ +//! Short description +/*! + \param statusFunc +*/ +xbShort xbNdx::ReIndex(void (*statusFunc)(xbLong itemNum, xbLong numItems)) +{ + /* this method assumes the index has been locked in exclusive mode */ + xbLong l; + xbShort rc, i, saveAutoLock; + xbNdxHeadNode TempHead; + FILE *t; + xbString TempName; + memcpy( &TempHead, &HeadNode, sizeof( struct xbNdxHeadNode )); + TempHead.NoOfKeys = 1L; + TempHead.TotalNodes = 2L; + TempHead.StartNode = 1L; + rc = dbf->xbase->DirectoryExistsInName( GetFileName() ); + if( rc ){ + TempName.assign(GetFileName(), 0, rc); + TempName += "TEMPFILE.NDX"; + } else + TempName = "TEMPFILE.NDX"; + + if(( t = fopen( TempName, "w+b" )) == NULL ) + return XB_OPEN_ERROR; + + if(( rc = PutHeadNode( &TempHead, t, 0 )) != 0 ){ + fclose( t ); + remove(TempName); + return rc; + } + + for( i = 0; i < XB_NDX_NODE_SIZE; i++ ){ + if(( fwrite( "\x00", 1, 1, t )) != 1 ){ + fclose( t ); + remove(TempName); + return XB_WRITE_ERROR; + } + } + if( fclose( indexfp ) != 0 ) + return XB_CLOSE_ERROR; + if( fclose( t ) != 0 ) + return XB_CLOSE_ERROR; + if( remove( GetFileName() ) != 0 ) + return XB_CLOSE_ERROR; + if( rename(TempName, GetFileName() ) != 0 ) + return XB_WRITE_ERROR; + if(( indexfp = fopen( GetFileName(), "r+b" )) == NULL ) + return XB_OPEN_ERROR; + + saveAutoLock = dbf->GetAutoLock(); + dbf->AutoLockOff(); + for( l = 1; l <= dbf->PhysicalNoOfRecords(); l++ ){ + if(statusFunc && (l == 1 || !(l % 100) || l == dbf->PhysicalNoOfRecords())) + statusFunc(l, dbf->PhysicalNoOfRecords()); + if(( rc = dbf->GetRecord(l)) != XB_NO_ERROR ){ + if(saveAutoLock) + dbf->AutoLockOn(); + return rc; + } + + if(!dbf->GetRealDelete() || !dbf->RecordDeleted()){ + /* Create the key */ + CreateKey( 0, 0 ); + /* add key to index */ + if(( rc = AddKey( l )) != XB_NO_ERROR ){ + if(saveAutoLock) + dbf->AutoLockOn(); + return rc; + } + } + } + return rc; +} + +/***********************************************************************/ +//! Short description +/*! + \param size +*/ +void xbNdx::SetNodeSize(xbShort size) +{ +#ifdef XB_VAR_NODESIZE + if(size >= XB_DEFAULT_NDX_NODE_SIZE) + { + if(size % XB_NDX_NODE_MULTIPLE) + NodeSize = ((size + XB_NDX_NODE_MULTIPLE) / XB_NDX_NODE_MULTIPLE) * + XB_NDX_NODE_MULTIPLE; + else + NodeSize = size; + } + else + NodeSize = XB_DEFAULT_NDX_NODE_SIZE; +#endif +} + +/***********************************************************************/ +//! Short description +/*! + \param buf + \param len +*/ +void xbNdx::GetExpression(char *buf, int len) +{ + memcpy(buf, HeadNode.KeyExpression, + len < XB_NDX_NODE_SIZE ? len : XB_NDX_NODE_SIZE - XB_NDX_NODE_BASESIZE); +} + +const char* xbNdx::GetExtWithDot(bool lower) +{ + return lower? ".ndx": ".NDX"; +} + +xbUShort xbNdx::GetKeyLen() +{ + return HeadNode.KeyLen; +} + +const char* xbNdx::GetKeyExpression() +{ + return HeadNode.KeyExpression; +} + +void xbNdx::FreeNodesMemory() +{ + ReleaseNodeMemory(NodeChain, true); + NodeChain = 0; +// ReleaseNodeMemory(CloneChain, true); +// CloneChain = 0; + ReleaseNodeMemory(FreeNodeChain, true); + FreeNodeChain = 0; + ReleaseNodeMemory(DeleteChain, true); + DeleteChain = 0; +} + +#endif /* XB_INDEX_NDX */ diff --git a/xbase64/xbndx.h b/xbase64/xbndx.h new file mode 100755 index 0000000..9f9d2d7 --- /dev/null +++ b/xbase64/xbndx.h @@ -0,0 +1,292 @@ +/* xbndx.h
+
+ Xbase64 project source code
+
+ This file contains a header file for the xbNdx object, which is used
+ for handling NDX type indices.
+
+ Copyright (C) 1997,2003 Gary A Kunkel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser 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
+
+ Contact:
+
+ Email:
+
+ xdb-devel@lists.sourceforge.net
+ xdb-users@lists.sourceforge.net
+
+
+ Regular Mail:
+
+ XBase Support
+ 149C South Main St
+ Keller Texas, 76248
+ USA
+
+*/
+
+#ifndef __XB_NDX_H__
+#define __XB_NDX_H__
+
+#ifdef __GNU LesserG__
+#pragma interface
+#endif
+
+#include <xbase64/xbase64.h>
+#include <string.h>
+
+/*! \file xbndx.h
+*/
+
+//
+// Define the following to use inline versions of the respective methods.
+//
+#define XB_INLINE_GETDBFNO
+
+#define XB_NDX_NODE_BASESIZE 24 // size of base header data
+
+#define XB_VAR_NODESIZE // define to enable variable node sizes
+
+#ifndef XB_VAR_NODESIZE
+#define XB_NDX_NODE_SIZE 2048
+//#define XB_NDX_NODE_SIZE 512 // standard dbase node size
+#else
+#define XB_DEFAULT_NDX_NODE_SIZE 512
+#define XB_MAX_NDX_NODE_SIZE 4096
+#define XB_NDX_NODE_SIZE NodeSize
+#define XB_NDX_NODE_MULTIPLE 512
+#endif // XB_VAR_NODESIZE
+
+//! xbNdxHeadnode struct
+/*!
+*/
+
+struct XBDLLEXPORT xbNdxHeadNode { /* ndx header on disk */
+ xbLong StartNode; /* header node is node 0 */
+ xbLong TotalNodes; /* includes header node */
+ xbLong NoOfKeys; /* actual count + 1 */
+ /* not updated by borland dbe? */
+ xbUShort KeyLen; /* length of key data */
+ xbUShort KeysPerNode;
+ xbUShort KeyType; /* 00 = Char, 01 = Numeric */
+ xbLong KeySize; /* key len + 8 bytes */
+ char Unknown2;
+ char Unique;
+// char KeyExpression[488];
+#ifndef XB_VAR_NODESIZE
+ char KeyExpression[XB_NDX_NODE_SIZE - 24];
+#else
+ char KeyExpression[XB_MAX_NDX_NODE_SIZE - 24];
+#endif // XB_VAR_NODESIZE
+};
+
+//! xbNdxLeafNode struct
+/*!
+*/
+
+struct XBDLLEXPORT xbNdxLeafNode { /* ndx node on disk */
+ xbLong NoOfKeysThisNode;
+#ifndef XB_VAR_NODESIZE
+ char KeyRecs[XB_NDX_NODE_SIZE-4];
+#else
+ char KeyRecs[XB_MAX_NDX_NODE_SIZE - 4];
+#endif // XB_VAR_NODESIZE
+};
+
+//! xbNdxNodeLink struct
+/*!
+*/
+
+struct XBDLLEXPORT xbNdxNodeLink { /* ndx node memory */
+ xbNdxNodeLink * PrevNode;
+ xbNdxNodeLink * NextNode;
+ xbLong CurKeyNo; /* 0 - KeysPerNode-1 */
+ xbLong NodeNo;
+ struct xbNdxLeafNode Leaf;
+};
+
+//! xbNdx class
+/*!
+*/
+
+class XBDLLEXPORT xbNdx : public xbIndex
+{
+ public:
+ xbNdx();
+ xbNdx(xbDbf *);
+ virtual ~xbNdx();
+
+/* don't uncomment next line - it causes seg faults for some undiagnosed reason*/
+// ~NDX() { if( NdxStatus ) CloseIndex(); }
+
+ xbShort CreateIndex( const char *IxName, const char *Exp,
+ xbShort Unique, xbShort OverLay );
+ xbLong GetTotalNodes();
+ xbULong GetCurDbfRec() { return CurDbfRec; }
+ xbShort CreateKey( xbShort, xbShort );
+ xbShort GetCurrentKey(char *key);
+ xbShort AddKey( xbLong );
+ xbShort UniqueIndex() { return HeadNode.Unique; }
+ xbShort DeleteKey( xbLong );
+ xbShort KeyWasChanged();
+ xbShort FindKey( const char *Key );
+ xbShort FindKey();
+ xbShort FindKey( xbDouble );
+#ifdef XBASE_DEBUG
+ void DumpHdrNode( xbShort Option );
+ void DumpNodeRec( xbLong NodeNo );
+ void DumpNodeChain();
+ xbShort CheckIndexIntegrity( xbShort Option );
+#endif
+ //! Short description.
+ /*!
+ */
+ xbShort GetNextKey() { return GetNextKey( 1 ); }
+ //! Short description.
+ /*!
+ */
+ xbShort GetLastKey() { return GetLastKey( 0, 1 ); }
+ //! Short description.
+ /*!
+ */
+ xbShort GetFirstKey() { return GetFirstKey( 1 ); }
+ //! Short description.
+ /*!
+ */
+ xbShort GetPrevKey() { return GetPrevKey( 1 ); }
+ xbShort ReIndex(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0);
+ xbShort KeyExists( const char * Key ) { return FindKey( Key, strlen( Key ), 0 ); }
+ xbShort KeyExists( xbDouble );
+
+ virtual void SetNodeSize(xbShort size);
+
+ virtual void GetExpression(char *buf, int len);
+ virtual const char* GetExtWithDot(bool lower);
+
+ protected:
+ virtual xbUShort GetKeyLen();
+ virtual const char* GetKeyExpression();
+ virtual void FreeNodesMemory();
+
+ protected:
+ xbNdxHeadNode HeadNode;
+ xbNdxLeafNode LeafNode;
+ xbLong xbNodeLinkCtr;
+ xbLong ReusedxbNodeLinks;
+
+#ifndef XB_VAR_NODESIZE
+ char Node[XB_NDX_NODE_SIZE];
+#else
+ char Node[XB_MAX_NDX_NODE_SIZE];
+#endif // XB_VAR_NODESIZE
+
+ xbNdxNodeLink * NodeChain; /* pointer to node chain of index nodes */
+ xbNdxNodeLink * FreeNodeChain; /* pointer to chain of free index nodes */
+ xbNdxNodeLink * CurNode; /* pointer to current node */
+ xbNdxNodeLink * DeleteChain; /* pointer to chain to delete */
+// xbNdxNodeLink * CloneChain; /* pointer to node chain copy (add dup) */
+
+/* private functions */
+ xbLong GetLeftNodeNo( xbShort, xbNdxNodeLink * );
+
+
+ // in line functions for performance reasons
+ //! Short description.
+ /*!
+ */
+ inline xbShort CompareKey( const char *Key1, const char *Key2, xbShort Klen )
+ {
+ xbDouble d1, d2;
+ int c;
+
+ if(!( Key1 && Key2 )) return -1;
+
+ if( Klen > HeadNode.KeyLen ) Klen = HeadNode.KeyLen;
+
+ if( HeadNode.KeyType == 0 )
+ {
+ c = memcmp(Key1, Key2, Klen);
+ if(c < 0)
+ return 2;
+ else if(c > 0)
+ return 1;
+ return 0;
+ }
+ else /* key is numeric */
+ {
+ d1 = dbf->xbase->GetDouble( Key1 );
+ d2 = dbf->xbase->GetDouble( Key2 );
+ if( d1 == d2 ) return 0;
+ else if( d1 > d2 ) return 1;
+ else return 2;
+ }
+ }
+
+#ifndef XB_INLINE_GETDBFNO
+ xbLong GetDbfNo( xbShort, xbNdxNodeLink * );
+#else
+ //! Short description.
+ /*!
+ */
+ inline xbLong GetDbfNo( xbShort RecNo, xbNdxNodeLink *n )
+ {
+ xbNdxLeafNode *temp;
+ char *p;
+ if( !n ) return 0L;
+ temp = &n->Leaf;
+ if( RecNo < 0 || RecNo > ( temp->NoOfKeysThisNode - 1 )) return 0L;
+ p = temp->KeyRecs + 4;
+ p += RecNo * ( 8 + HeadNode.KeyLen );
+ return( dbf->xbase->GetLong( p ));
+ }
+#endif
+ char * GetKeyData( xbShort, xbNdxNodeLink * );
+ xbUShort GetKeysPerNode();
+ virtual xbShort GetHeadNode();
+ xbShort GetLeafNode( xbLong, xbShort );
+ xbNdxNodeLink * GetNodeMemory();
+ void ReleaseNodeMemory(xbNdxNodeLink *n, xbBool doFree = false);
+ xbShort BSearchNode(const char *key, xbShort klen,
+ const xbNdxNodeLink *node, xbShort *comp);
+ xbLong GetLeafFromInteriorNode( const char *Tkey, xbShort Klen );
+ xbShort CalcKeyLen();
+ xbShort PutKeyData( xbShort, xbNdxNodeLink * );
+ xbShort PutLeftNodeNo( xbShort, xbNdxNodeLink *, xbLong );
+ xbShort PutLeafNode( xbLong, xbNdxNodeLink * );
+ xbShort PutHeadNode( xbNdxHeadNode *, FILE *, xbShort );
+ xbShort PutDbfNo( xbShort, xbNdxNodeLink *, xbLong );
+ xbShort PutKeyInNode( xbNdxNodeLink *, xbShort, xbLong, xbLong, xbShort );
+ xbShort SplitLeafNode( xbNdxNodeLink *, xbNdxNodeLink *, xbShort, xbLong );
+ xbShort SplitINode( xbNdxNodeLink *, xbNdxNodeLink *, xbLong );
+ xbShort AddToIxList();
+ xbShort RemoveFromIxList();
+ xbShort RemoveKeyFromNode( xbShort, xbNdxNodeLink * );
+ xbShort FindKey( const char *Tkey, xbShort Klen, xbShort RetrieveSw );
+ xbShort UpdateParentKey( xbNdxNodeLink * );
+ xbShort GetFirstKey( xbShort );
+ xbShort GetNextKey( xbShort );
+ xbShort GetLastKey( xbLong, xbShort );
+ xbShort GetPrevKey( xbShort );
+ void UpdateDeleteList( xbNdxNodeLink * );
+ void ProcessDeleteList();
+ xbNdxNodeLink * LeftSiblingHasSpace( xbNdxNodeLink * );
+ xbNdxNodeLink * RightSiblingHasSpace( xbNdxNodeLink * );
+ xbShort DeleteSibling( xbNdxNodeLink * );
+ xbShort MoveToLeftNode( xbNdxNodeLink *, xbNdxNodeLink * );
+ xbShort MoveToRightNode( xbNdxNodeLink *, xbNdxNodeLink * );
+ xbShort FindKey( const char *Tkey, xbLong DbfRec ); /* for a specific dbf no */
+};
+#endif /* __XB_NDX_H__ */
diff --git a/xbase64/xbnode.cpp b/xbase64/xbnode.cpp new file mode 100755 index 0000000..5e688c1 --- /dev/null +++ b/xbase64/xbnode.cpp @@ -0,0 +1,6 @@ +#include "xbNode.h"
+
+void xbNodeLink::AddNode(xbNodeLink* node)
+{
+ nextNode_=node;
+}
diff --git a/xbase64/xbnode.h b/xbase64/xbnode.h new file mode 100755 index 0000000..b1c3fdf --- /dev/null +++ b/xbase64/xbnode.h @@ -0,0 +1,19 @@ +#ifndef xbNode_h
+#define xbNode_h
+
+class xbNodeLink
+{
+ public:
+ xbNodeLink(): nextNode_(0) {}
+ void AddNode(xbNodeLink* node);
+ xbNodeLink* GetNext() {return nextNode_;}
+
+ private:
+ xbNodeLink(const xbNodeLink&);
+ xbNodeLink& operator=(const xbNodeLink&);
+
+ private:
+ xbNodeLink* nextNode_;
+};
+
+#endif
diff --git a/xbase64/xbntx.cpp b/xbase64/xbntx.cpp new file mode 100755 index 0000000..673aa68 --- /dev/null +++ b/xbase64/xbntx.cpp @@ -0,0 +1,2604 @@ +/* xbntx.xpp + + Xbase64 project source code + + NTX (Clipper) indexing routines for X-Base + + Copyright (C) 1999 SynXis Corp., Bob Cotton + email - bob@synxis.com + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbntx.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> + +#ifdef XB_INDEX_NTX + +#ifdef HAVE_IO_H +#include <io.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <ctype.h> +#include <sys/stat.h> + +//#include <xbase64/xbexcept.h> + +/*! \file xbntx.cpp +*/ + +/***********************************************************************/ +//! Short description. +/*! +*/ +/* This routine dumps the node chain to stdout */ +#ifdef XBASE_DEBUG +void xbNtx::DumpNodeChain( void ) +{ + xbNodeLink *n; + std::cout << "*************************" << std::endl; + std::cout << "NodeLinkCtr = " << NodeLinkCtr << std::endl; + std::cout << "Reused = " << ReusedNodeLinks << std::endl; + + n = NodeChain; + while(n){ + std::cout << "xbNodeLink Chain" << n->NodeNo << std::endl; + n = n->NextNode; + } + n = FreeNodeChain; + while(n){ + std::cout << "FreeNodeLink Chain" << n->NodeNo << std::endl; + n = n->NextNode; + } + n = DeleteChain; + while(n){ + std::cout << "DeleteLink Chain" << n->NodeNo << std::endl; + n = n->NextNode; + } +} +#endif +/***********************************************************************/ +//! Short description. +/*! + \param n +*/ +/* This routine returns a chain of one or more index nodes back to the */ +/* free node chain */ + +void xbNtx::ReleaseNodeMemory( xbNodeLink * n, xbBool doFree ) +{ + xbNodeLink *temp; + + if(doFree){ + while(n){ + temp = n->NextNode; + if(n->offsets) + free(n->offsets); + free(n); + n = temp; + } + } else { + if(!FreeNodeChain ) + FreeNodeChain = n; + else { /* put this list at the end */ + temp = FreeNodeChain; + while( temp->NextNode ) + temp = temp->NextNode; + temp->NextNode = n; + } + } +} +/***********************************************************************/ +//! Short description. +/*! +*/ +/* This routine returns a node from the free chain if available, */ +/* otherwise it allocates new memory for the requested node */ + +xbNodeLink * xbNtx::GetNodeMemory( void ) +{ + xbNodeLink * temp; + if( FreeNodeChain ){ + temp = FreeNodeChain; + temp->offsets = FreeNodeChain->offsets; + FreeNodeChain = temp->NextNode; + ReusedNodeLinks++; + memset( temp->Leaf.KeyRecs, 0x00, XB_NTX_NODE_SIZE ); + temp->Leaf.NoOfKeysThisNode = 0; + temp->PrevNode = 0x00; + temp->NextNode = 0x00; + temp->CurKeyNo = 0L; + temp->NodeNo = 0L; + + for (int i = 0; i < HeadNode.KeysPerNode + 1; i++){ + temp->offsets[i] = 2 + ((HeadNode.KeysPerNode + 1) * 2) + (HeadNode.KeySize * i); + } + } else { + temp = (xbNodeLink *) malloc( sizeof( xbNodeLink )); + if(temp==NULL) return NULL; + memset( temp, 0x00, sizeof( xbNodeLink )); + temp->offsets = (xbUShort *)malloc( (HeadNode.KeysPerNode + 1) * sizeof(xbUShort)); + if (temp->offsets==NULL) { + free(temp); + return NULL; + }; + NodeLinkCtr++; + } + return temp; +} +/***********************************************************************/ +//! Short description. +/*! +*/ +#ifdef XBASE_DEBUG +void xbNtx::DumpHdrNode( xbShort Option ) +{ + if( Option == 0 ){ + std::cout << "Signature = " << HeadNode.Signature << std::endl; + std::cout << "Version = " << HeadNode.Version << std::endl; + std::cout << "StartPahe = " << HeadNode.StartNode << std::endl; + std::cout << "UnusedOffset = " << HeadNode.UnusedOffset << std::endl; + std::cout << "KeySize = " << HeadNode.KeySize << std::endl; + std::cout << "KeyLen = " << HeadNode.KeyLen << std::endl; + std::cout << "DecimalCount = " << HeadNode.DecimalCount << std::endl; + std::cout << "KeysPerNode = " << HeadNode.KeysPerNode << std::endl; + std::cout << "HalfKeysPerPage = " << HeadNode.HalfKeysPerNode << std::endl; + std::cout << "KeyExpression = " << HeadNode.KeyExpression << std::endl; + std::cout << "Unique = " << HeadNode.Unique << std::endl; + } else + std::cout << "Print Hdr Node option not implemented yet" << std::endl; +} +#endif +/***********************************************************************/ +//! Constructor +/*! +*/ +xbNtx::xbNtx() : xbIndex() +{ +} +/***********************************************************************/ +//! Constructor +/*! + \param pdbf +*/ +xbNtx::xbNtx( xbDbf * pdbf ) : xbIndex (pdbf) +{ + memset( Node, 0x00, XB_NTX_NODE_SIZE ); + memset( &HeadNode, 0x00, sizeof( NtxHeadNode )); + NodeChain = NULL; +// CloneChain = NULL; + FreeNodeChain = NULL; + DeleteChain = NULL; + CurNode = NULL; + NodeLinkCtr = 0L; + ReusedNodeLinks = 0L; +} +/***********************************************************************/ +//! Destructor +/*! +*/ +xbNtx::~xbNtx() +{ + CloseIndex(); +} +/***********************************************************************/ +//! Short description. +/*! +*/ +xbShort xbNtx::GetHeadNode( void ) +{ + char *p; + if( !IsOpen() ) + return XB_NOT_OPEN; + if( _fseek( indexfp, 0, SEEK_SET )) + return XB_SEEK_ERROR; + if(( fread( Node, XB_NTX_NODE_SIZE, 1, indexfp )) != 1 ) + return XB_READ_ERROR; + + /* load the head node structure */ + p = Node; + HeadNode.Signature = dbf->xbase->GetShort( p ); p += sizeof(xbUShort); + HeadNode.Version = dbf->xbase->GetShort( p ); p += sizeof(xbUShort); + HeadNode.StartNode = dbf->xbase->GetULong( p ); p += sizeof(xbULong); + HeadNode.UnusedOffset = dbf->xbase->GetULong( p ); p += sizeof(xbULong); + HeadNode.KeySize = dbf->xbase->GetShort( p ); p += sizeof(xbUShort); + HeadNode.KeyLen = dbf->xbase->GetShort( p ); p += sizeof(xbUShort); + HeadNode.DecimalCount = dbf->xbase->GetShort( p ); p += sizeof(xbUShort); + HeadNode.KeysPerNode = dbf->xbase->GetShort( p ); p += sizeof(xbUShort); + HeadNode.HalfKeysPerNode = dbf->xbase->GetShort( p ); p += sizeof(xbUShort); + strncpy(HeadNode.KeyExpression, p, 256); p+= 256; +// HeadNode.Unique = *p++; ++ is unused code 8/19/03 - gkunkel + HeadNode.Unique = *p; + + p = HeadNode.KeyExpression; + while (*p){ + *p = toupper(*p); + p++; + } + return 0; +} +/***********************************************************************/ +//! Short description. +/*! + \param NodeNo + \param SetNodeChain +*/ +/* This routine reads a leaf node from disk */ +/* */ +/* If SetNodeChain 2, then the node is not appended to the node chain */ +/* but the CurNode pointer points to the node read */ +/* If SetNodeChain 1, then the node is appended to the node chain */ +/* If SetNodeChain 0, then record is only read to Node memory */ + +xbShort xbNtx::GetLeafNode( xbLong NodeNo, xbShort SetNodeChain ) +{ + xbNodeLink *n; + char *p; + + if( !IsOpen() ) + return XB_NOT_OPEN; + + if( _fseek( indexfp, (xbOffT)NodeNo, SEEK_SET )) + return XB_SEEK_ERROR; + + if(( fread( Node, XB_NTX_NODE_SIZE, 1, indexfp )) != 1 ) + return XB_READ_ERROR; + + if( !SetNodeChain ) return 0; + + if(( n = GetNodeMemory()) == NULL ) + return XB_NO_MEMORY; + + n->NodeNo = NodeNo; + n->CurKeyNo = 0L; + n->NextNode = NULL; + + // The offsets at the head of each leaf are not necessarly in order. + p = Node + 2; + for( int i = 0; i < HeadNode.KeysPerNode + 1; i++){ + n->offsets[i] = dbf->xbase->GetShort( p ); + p += 2; + } + + // Do the edian translation correctly + n->Leaf.NoOfKeysThisNode = dbf->xbase->GetShort( Node ); + memcpy( n->Leaf.KeyRecs, Node, XB_NTX_NODE_SIZE ); + + /* put the node in the chain */ + if( SetNodeChain == 1 ){ + if( NodeChain == NULL ){ /* first one ? */ + NodeChain = n; + CurNode = n; + CurNode->PrevNode = NULL; + } else { + n->PrevNode = CurNode; + CurNode->NextNode = n; + CurNode = n; + } + } + else + CurNode = n; + + return 0; +} +/***********************************************************************/ +//! Short description. +/*! + \param n +*/ +#ifdef XBASE_DEBUG +void xbNtx::DumpNodeRec( xbLong n ) +{ + char *p; + xbShort NoOfKeys; + xbLong LeftBranch, RecNo; + xbShort i,j; + + GetLeafNode( n, 0 ); + NoOfKeys = dbf->xbase->GetShort( Node ); + p = Node + 4; /* go past no of keys */ +std::cout << "-----------------------------------------------" << std::endl; + std::cout << "Node # " << n; + std::cout << "Number of keys = " << NoOfKeys << std::endl; + std::cout << " Key Left Rec Key" << std::endl; + std::cout << "Number Branch Number Data" << std::endl; + + for( i = 0; i < GetKeysPerNode()+1 /*NoOfKeys*/; i++ ){ + LeftBranch = dbf->xbase->GetLong( p ); + p+=4; + RecNo = dbf->xbase->GetLong( p ); + p+=4; + std::cout << i << " " + << LeftBranch << " " + << RecNo << " " << std::endl; + for( j = 0; j < HeadNode.KeyLen; j++ ) std::cout << *p++; + } +} +#endif +/***********************************************************************/ +//! Short description. +/*! + \param RecNo + \param n +*/ +xbLong xbNtx::GetDbfNo( xbShort RecNo, xbNodeLink * n ) +{ + NtxLeafNode *temp; + char *p; + xbUShort itemOffset; + + if( !n ) return 0L; + temp = &n->Leaf; + p = temp->KeyRecs; + if( RecNo < 0 || RecNo > ( temp->NoOfKeysThisNode )) return 0L; + itemOffset = GetItemOffset(RecNo, n, 0); + // ItemOffset is from the beginning of the record. + p += itemOffset; + p += 4; + return( dbf->xbase->GetLong( p )); +} +/***********************************************************************/ +//! Short description. +/*! + \param RecNo + \param n +*/ +xbLong xbNtx::GetLeftNodeNo( xbShort RecNo, xbNodeLink * n ) +{ + NtxLeafNode *temp; + char *p; + xbUShort itemOffset; + + if( !n ) return 0L; + temp = &n->Leaf; + p = temp->KeyRecs; + if( RecNo < 0 || RecNo > temp->NoOfKeysThisNode ) return 0L; + itemOffset = GetItemOffset(RecNo, n, 0); + // ItemOffset is from the beginning of the record. + p += itemOffset; + return( dbf->xbase->GetULong( p )); +} + +/***********************************************************************/ +//! Short description. +/*! + \param RecNo + \param n +*/ +char * xbNtx::GetKeyData( xbShort RecNo, xbNodeLink * n ) +{ + NtxLeafNode *temp; + char *p; + xbUShort itemOffset; + if( !n ) return 0L; + temp = &n->Leaf; + p = temp->KeyRecs; + if( RecNo < 0 || RecNo > ( temp->NoOfKeysThisNode )) return 0L; + itemOffset = GetItemOffset(RecNo, n, 0); + // ItemOffset is from the beginning of the record. + p += itemOffset + 8; + return( p ); +} +/***********************************************************************/ +//! Short description. +/*! + \param RecNo + \param n + \param +*/ +xbUShort +xbNtx::GetItemOffset(xbShort RecNo, xbNodeLink *n, xbShort) { + if( RecNo > (this->HeadNode.KeysPerNode + 1) ){ + std::cout << "RecNo = " << RecNo << std::endl; + std::cout << "this->HeadNode.KeysPerNode = " + << this->HeadNode.KeysPerNode << std::endl; + std::cout << "********************* BUG ***********************" + << std::endl; + // ;-) + exit(1); + } + + return n->offsets[RecNo]; +} + +//! Short description. +/*! + \param pos + \param n +*/ +xbUShort +xbNtx::InsertKeyOffset(xbShort pos, xbNodeLink *n) +{ + xbUShort temp; + + // save the new offset + temp = n->offsets[n->Leaf.NoOfKeysThisNode + 1]; + + for( int i = n->Leaf.NoOfKeysThisNode + 1; i > pos; i-- ){ + n->offsets[i] = n->offsets[i-1]; + } + n->offsets[pos] = temp; + + return n->offsets[pos]; +} + +//! Short description. +/*! + \param pos + \param n +*/ +xbUShort +xbNtx::DeleteKeyOffset(xbShort pos, xbNodeLink *n) +{ + xbUShort temp; + xbShort i; + // save the old offset + temp = n->offsets[pos]; + + for( i = pos; i < n->Leaf.NoOfKeysThisNode; i++ ){ + n->offsets[i] = n->offsets[i+1]; + } + n->offsets[i] = temp; + return n->offsets[i]; +} +/***********************************************************************/ +//! Short description. +/*! +*/ +xbLong xbNtx::GetTotalNodes( void ) +{ +// if( &HeadNode ) +// return HeadNode.TotalNodes; +// else + return 0L; +} +/***********************************************************************/ +//! Short description. +/*! +*/ +xbUShort xbNtx::GetKeysPerNode( void ) +{ + if( &HeadNode ) + return HeadNode.KeysPerNode; + else + return 0L; +} +/***********************************************************************/ +//! Short description. +/*! + \param RetrieveSw +*/ +xbShort xbNtx::GetFirstKey( xbShort RetrieveSw ) +{ +/* This routine returns 0 on success and sets CurDbfRec to the record */ +/* corresponding to the first index pointer */ + + xbLong TempNodeNo; + xbShort rc; + +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// if((rc = LockIndex( XB_LOCK )) != 0) +// return rc; +#endif + + /* initialize the node chain */ + if( NodeChain ){ + ReleaseNodeMemory( NodeChain ); + NodeChain = NULL; + } + + if(( rc = GetHeadNode()) != 0 ){ + CurDbfRec = 0L; +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return rc; + } + + /* get a node and add it to the link */ + + if(( rc = GetLeafNode( HeadNode.StartNode, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return rc; + } + +/* traverse down the left side of the tree */ + while( GetLeftNodeNo( 0, CurNode )){ + TempNodeNo = GetLeftNodeNo( 0, CurNode ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return rc; + } + CurNode->CurKeyNo = 0; + } + CurDbfRec = GetDbfNo( 0, CurNode ); +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description. +/*! + \param RetrieveSw +*/ +xbShort xbNtx::GetNextKey( xbShort RetrieveSw ) +{ +/* This routine returns 0 on success and sets CurDbfRec to the record */ +/* corresponding to the next index pointer */ + + xbNodeLink * TempNodeLink; + xbLong TempNodeNo; + xbShort rc; + +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) + // if((rc = LockIndex( XB_LOCK )) != 0) + // return rc; +#endif + + if( !IsOpen() ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return XB_NOT_OPEN; + } + + if( !CurNode ){ + rc = GetFirstKey( RetrieveSw ); +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return rc; + } + + /* more keys on this node ? */ + if(( CurNode->Leaf.NoOfKeysThisNode -1 ) > CurNode->CurKeyNo ){ + CurNode->CurKeyNo++; + CurDbfRec = GetDbfNo( CurNode->CurKeyNo, CurNode ); +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; + } + + /* if head node we are at eof */ + if( CurNode->NodeNo == HeadNode.StartNode ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return XB_EOF; + } + + /* this logic assumes that interior nodes have n+1 left node no's where */ + /* n is the number of keys in the node */ + /* pop up one node to the interior node level & free the leaf node */ + TempNodeLink = CurNode; + CurNode = CurNode->PrevNode; + CurNode->NextNode = NULL; + ReleaseNodeMemory( TempNodeLink ); + + /* while no more right keys && not head node, pop up one node */ + while(( CurNode->CurKeyNo >= CurNode->Leaf.NoOfKeysThisNode ) && + ( CurNode->NodeNo != HeadNode.StartNode )){ + TempNodeLink = CurNode; + CurNode = CurNode->PrevNode; + CurNode->NextNode = NULL; + ReleaseNodeMemory( TempNodeLink ); + } + + /* if head node && right most key, return end-of-file */ + if(( HeadNode.StartNode == CurNode->NodeNo ) && + ( CurNode->CurKeyNo >= CurNode->Leaf.NoOfKeysThisNode )){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return XB_EOF; + } + + /* move one to the right */ + CurNode->CurKeyNo++; + TempNodeNo = GetLeftNodeNo( CurNode->CurKeyNo, CurNode ); + + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return rc; + } + +/* traverse down the left side of the tree */ + while( GetLeftNodeNo( 0, CurNode )){ + TempNodeNo = GetLeftNodeNo( 0, CurNode ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return rc; + } + CurNode->CurKeyNo = 0; + } + CurDbfRec = GetDbfNo( 0, CurNode ); +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description. +/*! + \param NodeNo + \param RetrieveSw +*/ +xbShort xbNtx::GetLastKey( xbLong NodeNo, xbShort RetrieveSw ) +{ +/* This routine returns 0 on success and sets CurDbfRec to the record */ +/* corresponding to the last index pointer */ + +/* If NodeNo = 0, start at head node, otherwise start at NodeNo */ + + xbLong TempNodeNo; + xbShort rc; + +// TODO +// NTX files keep no TotalNode count. +// if( NodeNo < 0 || NodeNo > HeadNode.TotalNodes ) +// return XB_INVALID_NODE_NO; + +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// if((rc = LockIndex( XB_LOCK )) != 0) +// return rc; +#endif + + /* initialize the node chain */ + if( NodeChain ){ + ReleaseNodeMemory( NodeChain ); + NodeChain = NULL; + } + if( NodeNo == 0L ) + if(( rc = GetHeadNode()) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return rc; + } + + /* get a node and add it to the link */ + if( NodeNo == 0L ){ + if(( rc = GetLeafNode( HeadNode.StartNode, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK); +#endif + CurDbfRec = 0L; + return rc; + } + } else { + if(( rc = GetLeafNode( NodeNo, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return rc; + } + } + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + +/* traverse down the right side of the tree */ + while( GetLeftNodeNo( CurNode->Leaf.NoOfKeysThisNode, CurNode )){ + TempNodeNo = GetLeftNodeNo( CurNode->Leaf.NoOfKeysThisNode, CurNode ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return rc; + } + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + } + CurNode->CurKeyNo--; /* leaf node has one fewer ix recs */ + CurDbfRec = GetDbfNo( CurNode->Leaf.NoOfKeysThisNode-1, CurNode ); +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description. +/*! + \param RetrieveSw +*/ +xbShort xbNtx::GetPrevKey( xbShort RetrieveSw ) +{ +/* This routine returns 0 on success and sets CurDbfRec to the record */ +/* corresponding to the previous index pointer */ + + xbNodeLink * TempNodeLink; + xbLong TempNodeNo; + xbShort rc; + +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// if((rc = LockIndex( XB_LOCK )) != 0) +// return rc; +#endif + + if( !IsOpen() ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return XB_NOT_OPEN; + } + + if( !CurNode ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return GetFirstKey( RetrieveSw ); + } + + /* more keys on this node ? */ + if( CurNode->CurKeyNo > 0 ){ + CurNode->CurKeyNo--; + CurDbfRec = GetDbfNo( CurNode->CurKeyNo, CurNode ); +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; + } + + /* this logic assumes that interior nodes have n+1 left node no's where */ + /* n is the number of keys in the node */ + /* pop up one node to the interior node level & free the leaf node */ + + if( !CurNode->PrevNode ){ /* michael - make sure prev node exists */ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return XB_EOF; + } + + TempNodeLink = CurNode; + CurNode = CurNode->PrevNode; + CurNode->NextNode = NULL; + ReleaseNodeMemory( TempNodeLink ); + + /* while no more left keys && not head node, pop up one node */ + while(( CurNode->CurKeyNo == 0 ) && + ( CurNode->NodeNo != HeadNode.StartNode )){ + TempNodeLink = CurNode; + CurNode = CurNode->PrevNode; + CurNode->NextNode = NULL; + ReleaseNodeMemory( TempNodeLink ); + } + + /* if head node && left most key, return end-of-file */ + if(( HeadNode.StartNode == CurNode->NodeNo ) && + ( CurNode->CurKeyNo == 0 )){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return XB_EOF; + } + + /* move one to the left */ + CurNode->CurKeyNo--; + TempNodeNo = GetLeftNodeNo( CurNode->CurKeyNo, CurNode ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return rc; + } + + if( GetLeftNodeNo( 0, CurNode )) /* if interior node */ + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + else /* leaf node */ + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode -1; + +/* traverse down the right side of the tree */ + while( GetLeftNodeNo( 0, CurNode )){ /* while interior node */ + TempNodeNo = GetLeftNodeNo( CurNode->Leaf.NoOfKeysThisNode, CurNode ); + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return rc; + } + if( GetLeftNodeNo( 0, CurNode )) /* if interior node */ + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + else /* leaf node */ + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode -1; + } + CurDbfRec = GetDbfNo( CurNode->Leaf.NoOfKeysThisNode -1, CurNode ); +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if( RetrieveSw ) + return dbf->GetRecord( CurDbfRec ); + else + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description. +/*! + \param Key1 + \param Key2 + \param Klen +*/ +xbShort xbNtx::CompareKey( const char * Key1, const char * Key2, xbShort Klen ) +{ +/* if key1 = key2 --> return 0 */ +/* if key1 > key2 --> return 1 */ +/* if key1 < key2 --> return 2 */ + + const char *k1, *k2; + xbShort i; + + if( Klen > HeadNode.KeyLen ) Klen = HeadNode.KeyLen; + k1 = Key1; + k2 = Key2; + for( i = 0; i < Klen; i++ ){ + if( *k1 > *k2 ) return 1; + if( *k1 < *k2 ) return 2; + k1++; + k2++; + } + return 0; +} +/***********************************************************************/ +//! Short description. +/*! + \param Key1 + \param Key2 +*/ +xbShort xbNtx::CompareKey( const char * Key1, const char * Key2) +{ +/* if key1 = key2 --> return 0 */ +/* if key1 > key2 --> return 1 */ +/* if key1 < key2 --> return 2 */ + + int rc; + rc = strcmp(Key1, Key2); + if( rc < 0 ) + return 2; + else if( rc > 0 ) + return 1; + else + return 0; +} +/***********************************************************************/ +//! Short description. +/*! + \param Tkey + \param +*/ +xbULong xbNtx::GetLeafFromInteriorNode( const char * Tkey, xbShort ) +{ + /* This function scans an interior node for a key and returns the */ + /* correct interior leaf node no */ + + xbShort rc, p; + + /* if Tkey > any keys in node, return right most key */ + p = CurNode->Leaf.NoOfKeysThisNode -1 ; + if( CompareKey( Tkey, GetKeyData( p, CurNode )) == 1 ){ + CurNode->CurKeyNo = CurNode->Leaf.NoOfKeysThisNode; + return GetLeftNodeNo( CurNode->Leaf.NoOfKeysThisNode, CurNode ); + } + + /* otherwise, start at the beginning and scan up */ + p = 0; + while( p < CurNode->Leaf.NoOfKeysThisNode){ + rc = CompareKey( Tkey, GetKeyData( p, CurNode ) ); + if (rc == 2) break; + else if (rc == 0){ + CurNode->CurKeyNo = p; + CurDbfRec = GetDbfNo( p, CurNode ); + return 0; + } + p++; + } + + CurNode->CurKeyNo = p; + return GetLeftNodeNo( p, CurNode ); +} +/***********************************************************************/ +//! Short description. +/*! + \param d +*/ +xbShort xbNtx::KeyExists( xbDouble d ) +{ + char buf[9]; + memset( buf, 0x00, 9 ); + dbf->xbase->PutDouble( buf, d ); + return FindKey( buf, 8, 0 ); +} +/***********************************************************************/ +//! Short description. +/*! + \param d +*/ +xbShort xbNtx::FindKey( xbDouble d ) +{ + char buf[9]; + memset( buf, 0x00, 9 ); + dbf->xbase->PutDouble( buf, d ); + return FindKey( buf, 8, 1 ); +} +/***********************************************************************/ +//! Short description. +/*! + \param Key +*/ +xbShort xbNtx::FindKey( const char * Key ) +{ + return FindKey( Key, strlen( Key ), 1 ); +} +/***********************************************************************/ +//! Short description. +/*! + \param Tkey + \param DbfRec +*/ +xbShort xbNtx::FindKey( const char * Tkey, xbLong DbfRec ) +{ + /* find a key with a specifc xbDbf record number */ + xbShort rc; + xbLong CurDbfRecNo; + xbLong CurNtxDbfNo; + +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// if((rc = LockIndex( XB_LOCK )) != 0) +// return rc; +#endif + + /* if we are already on the correct key, return XB_FOUND */ + if( CurNode ){ + CurDbfRecNo = dbf->GetCurRecNo(); + CurNtxDbfNo = GetDbfNo( CurNode->CurKeyNo, CurNode ); + if( CurDbfRecNo == CurNtxDbfNo ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return XB_FOUND; + } + } + + rc = FindKey( Tkey, HeadNode.KeyLen, 0 ); + + while( rc == 0 || rc == XB_FOUND ){ + if( strncmp( Tkey, GetKeyData( CurNode->CurKeyNo, CurNode ), + HeadNode.KeyLen ) == 0 ){ + if( DbfRec == GetDbfNo( CurNode->CurKeyNo, CurNode )){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) + // LockIndex( XB_UNLOCK ); +#endif + return XB_FOUND; + } else + rc = GetNextKey( 0 ); + } else { +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return XB_NOT_FOUND; + } + } +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return XB_NOT_FOUND; +} +/***********************************************************************/ +//! Short description. +/*! +*/ +xbShort xbNtx::FindKey( void ) +{ + /* if no paramaters given, use KeyBuf */ + return( FindKey( KeyBuf, HeadNode.KeyLen, 0 )); +} +/***********************************************************************/ +//! Short description. +/*! + \param Tkey + \param Klen + \param RetrieveSw +*/ +xbShort xbNtx::FindKey( const char * Tkey, xbShort Klen, xbShort RetrieveSw ) +{ + /* This routine sets the current key to the found key */ + /* if RetrieveSw is true, the method positions the dbf record */ + + xbShort rc,i; + xbLong TempNodeNo; + +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// if((rc = LockIndex( XB_LOCK )) != 0) +// return rc; +#endif + if( NodeChain ){ + ReleaseNodeMemory( NodeChain ); + NodeChain = NULL; + } + + if(( rc = GetHeadNode()) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return rc; + } + + // If the index is empty + if( HeadNode.StartNode == 0){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return XB_NOT_FOUND; + } + + /* load first node */ + if(( rc = GetLeafNode( HeadNode.StartNode, 1 )) != 0 ){ + CurDbfRec = 0L; +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return rc; + } + + /* traverse down the tree until it hits a leaf */ + while( GetLeftNodeNo( 0, CurNode )){ /* while interior node */ + TempNodeNo = GetLeafFromInteriorNode( Tkey, Klen ); + +#if 1 + // GetLeafFromInteriorNode will return 0 if the key is found on + // an inode. But the leftNodeNo will not be 0. + if (TempNodeNo == 0 && GetLeftNodeNo( 0, CurNode ) != 0){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if( RetrieveSw ) dbf->GetRecord( CurDbfRec ); + return XB_FOUND; + } +#endif + + if(( rc = GetLeafNode( TempNodeNo, 1 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + CurDbfRec = 0L; + return rc; + } + } + + /* leaf level */ + for( i = 0; i < CurNode->Leaf.NoOfKeysThisNode; i++ ){ + rc = CompareKey( Tkey, GetKeyData( i, CurNode ) ); + if( rc == 0 ){ + CurNode->CurKeyNo = i; + CurDbfRec = GetDbfNo( i, CurNode ); +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if( RetrieveSw ) dbf->GetRecord( CurDbfRec ); + return XB_FOUND; + } else if( rc == 2 ) { + CurNode->CurKeyNo = i; + CurDbfRec = GetDbfNo( i, CurNode ); + if( RetrieveSw ) dbf->GetRecord( CurDbfRec ); + // If key is lessthan, without length involved, + // Check to see if the substring match +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if(CompareKey( Tkey, GetKeyData( i, CurNode ), Klen ) == 0) + return XB_FOUND; + else + return XB_NOT_FOUND; + } + } + CurNode->CurKeyNo = i; + CurDbfRec = GetDbfNo( i, CurNode ); +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + if( RetrieveSw ) dbf->GetRecord( CurDbfRec ); + return XB_NOT_FOUND; +} +/***********************************************************************/ +//! Short description. +/*! +*/ +xbShort xbNtx::CalcKeyLen( void ) +{ + xbShort rc; + xbExpNode * TempNode; + char FieldName[11]; + char Type; + TempNode = IxExp->GetFirstTreeNode(); + + if( !TempNode ) return 0; + if( TempNode->Type == 'd' ) return TempNode->ResultLen; + if( TempNode->Type == 'D' ) { + memset( FieldName, 0x00, 11 ); + memcpy( FieldName, TempNode->NodeText, TempNode->Len ); + Type = dbf->GetFieldType( dbf->GetFieldNo( FieldName )); + if( Type == 'N' || Type == 'F' ) + return TempNode->ResultLen; + } + + if(( rc = IxExp->ProcessExpression()) != XB_NO_ERROR ) + return 0; + + TempNode = (xbExpNode *) IxExp->Pop(); + if( !TempNode ) return 0; + rc = TempNode->DataLen; + +// if( !TempNode->InTree ) dbf->xbase->FreeExpNode( TempNode ); + if( !TempNode->InTree ) delete TempNode; + return rc; +} +/***********************************************************************/ +//! Short description. +/*! + \param IxName + \param Exp + \param Unique + \param Overlay +*/ +xbShort xbNtx::CreateIndex(const char * IxName, const char * Exp, xbShort Unique, xbShort Overlay ) +{ + xbShort i, KeyLen, rc; + + if( IsOpen()) CloseIndex(); + if( strlen( Exp ) > 255 ) return XB_INVALID_KEY_EXPRESSION; + if( dbf->GetDbfStatus() == 0 ) return XB_NOT_OPEN; + + /* Get the index file name and store it in the class */ + SetFileName(IxName); + + /* check if the file already exists */ + if(((indexfp = fopen( GetFileName(), "r" )) != NULL ) && !Overlay ){ + fclose( indexfp ); + return XB_FILE_EXISTS; + } + else if( indexfp ) fclose( indexfp ); + + if(( indexfp = fopen( GetFileName(), "w+b" )) == NULL ){ + return XB_OPEN_ERROR; + } + +#ifdef XB_LOCKING_ON + /* + ** Must turn off buffering when multiple programs may be accessing + ** index files. + */ + setbuf( indexfp, NULL ); +#endif + +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// if((rc = LockIndex( XB_LOCK )) != 0) +// return rc; +#endif + + /* parse the expression */ + IxExp = new xbExpn( dbf->xbase ); + if(( rc = IxExp->BuildExpressionTree( Exp, strlen( Exp ), dbf )) != XB_NO_ERROR ) + return rc; + +// ExpressionTree = dbf->xbase->GetTree(); +// dbf->xbase->SetTreeToNull(); + + /* build the header record */ + memset( &HeadNode, 0x00, sizeof( NtxHeadNode )); + HeadNode.Signature = 0x6; // Clipper 5.x + HeadNode.Version = 1; + HeadNode.StartNode = 1024L; + KeyLen = CalcKeyLen(); + + // TODO + // What is the Clipper key length limit? + if( KeyLen == 0 || KeyLen > 100 ){ /* 100 byte key length limit */ + +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return XB_INVALID_KEY; + } else { + HeadNode.KeyLen = KeyLen; + } + + // This is not the algorithm that Clipper uses. I cant figure out + // what they use from looking at the examples. + // This is correct tho. + HeadNode.KeysPerNode = (xbUShort) + (( XB_NTX_NODE_SIZE - (2 * sizeof( xbUShort ))) / (HeadNode.KeyLen + 10 )) - 1; + if( HeadNode.KeysPerNode % 2 ) + HeadNode.KeysPerNode--; + + HeadNode.HalfKeysPerNode = (xbUShort) HeadNode.KeysPerNode / 2; + HeadNode.KeySize = HeadNode.KeyLen + 8; +// while(( HeadNode.KeySize % 4 ) != 0 ) HeadNode.KeySize++; /* multiple of 4*/ + HeadNode.Unique = Unique; + strncpy( HeadNode.KeyExpression, Exp, 255 ); + + rc=AllocKeyBufs(); + if(rc) { + fclose(indexfp); + return rc; + }; + + if(( rc = PutHeadNode( &HeadNode, indexfp, 0 )) != 0 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return rc; + } + /* write node #1 all 0x00 */ + for( i = 0; i < XB_NTX_NODE_SIZE; i++ ){ + if(( fwrite( "\x00", 1, 1, indexfp )) != 1 ){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + fclose( indexfp ); + return XB_WRITE_ERROR; + } + } + + if((rc = GetLeafNode(HeadNode.StartNode, 1)) != 0){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return rc; + } + + for( i = 0; i < HeadNode.KeysPerNode + 1; i++ ) + CurNode->offsets[i] = (i * HeadNode.KeySize) + + 2 + (2 * (HeadNode.KeysPerNode + 1)); + + if((rc = PutLeafNode(HeadNode.StartNode, CurNode )) != 0){ +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return rc; + } + +#ifdef XB_LOCKING_ON +// if( dbf->GetAutoLock() ) +// LockIndex( XB_UNLOCK ); +#endif + return dbf->AddIndexToIxList( index, GetFileName()); +} +/***********************************************************************/ +//! Short description. +/*! + \param RecNo + \param n + \param NodeNo +*/ +xbShort xbNtx::PutLeftNodeNo( xbShort RecNo, xbNodeLink *n, xbLong NodeNo ) +{ + /* This routine sets n node's leftnode number */ + NtxLeafNode *temp; + char *p; + xbUShort itemOffset; + if( !n ) return XB_INVALID_NODELINK; + temp = &n->Leaf; + if( RecNo < 0 || RecNo > HeadNode.KeysPerNode) + return XB_INVALID_KEY; + p = temp->KeyRecs; + itemOffset = GetItemOffset(RecNo, n, 1); + p += itemOffset; + dbf->xbase->PutLong( p, NodeNo ); + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description. +/*! + \param RecNo + \param n + \param DbfNo +*/ +xbShort xbNtx::PutDbfNo( xbShort RecNo, xbNodeLink *n, xbLong DbfNo ) +{ + /* This routine sets n node's dbf number */ + + NtxLeafNode *temp; + char *p; + xbUShort itemOffset; + if( !n ) return XB_INVALID_NODELINK; + temp = &n->Leaf; + if( RecNo < 0 || RecNo > (HeadNode.KeysPerNode)) + return XB_INVALID_KEY; + itemOffset = GetItemOffset(RecNo, n, 1); + p = temp->KeyRecs; + p += itemOffset; + p += 4; + dbf->xbase->PutLong( p, DbfNo ); + return XB_NO_ERROR; +} +/************************************************************************/ +//! Short description. +/*! + \param l + \param n +*/ +xbShort xbNtx::PutLeafNode( xbLong l, xbNodeLink *n ) +{ + NtxLeafNode *temp; + char *p; + + if(( _fseek( indexfp, (xbOffT)l , SEEK_SET )) != 0 ){ + fclose( indexfp ); + return XB_SEEK_ERROR; + } + + temp = &n->Leaf; + p = temp->KeyRecs; + dbf->xbase->PutShort( p, temp->NoOfKeysThisNode ); + + // The offsets at the head of each leaf are not necessarly in order. + p += 2; + for( int i = 0; i < HeadNode.KeysPerNode + 1; i++){ + dbf->xbase->PutShort( p, n->offsets[i] ); + p += 2; + } + + if(( fwrite( &n->Leaf.KeyRecs, XB_NTX_NODE_SIZE, 1, indexfp )) != 1 ){ + fclose( indexfp ); + return XB_WRITE_ERROR; + } + + PutHeadNode(&HeadNode, indexfp, 1); + return 0; +} +/************************************************************************/ +//! Short description. +/*! + \param Head + \param f + \param UpdateOnly +*/ +xbShort xbNtx::PutHeadNode( NtxHeadNode * Head, FILE * f, xbShort UpdateOnly ) +{ + char buf[4]; + char *p; + + if(( _fseek( f, 0L, SEEK_SET )) != 0 ){ + fclose( f ); + return XB_SEEK_ERROR; + } + + memset( buf, 0x00, 2 ); + dbf->xbase->PutUShort( buf, Head->Signature ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + memset( buf, 0x00, 2 ); + dbf->xbase->PutUShort( buf, Head->Version ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + memset( buf, 0x00, 4 ); + dbf->xbase->PutULong( buf, Head->StartNode ); + if(( fwrite( &buf, 4, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + memset( buf, 0x00, 4 ); + dbf->xbase->PutULong( buf, Head->UnusedOffset ); + if(( fwrite( &buf, 4, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + if( UpdateOnly ){ + fflush(indexfp); + return XB_NO_ERROR; + } + + memset( buf, 0x00, 2 ); + dbf->xbase->PutUShort( buf, Head->KeySize ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + memset( buf, 0x00, 2 ); + dbf->xbase->PutUShort( buf, Head->KeyLen ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + memset( buf, 0x00, 2 ); + dbf->xbase->PutUShort( buf, Head->DecimalCount ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + memset( buf, 0x00, 2 ); + dbf->xbase->PutUShort( buf, Head->KeysPerNode ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + memset( buf, 0x00, 2 ); + dbf->xbase->PutUShort( buf, Head->HalfKeysPerNode ); + if(( fwrite( &buf, 2, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + p = HeadNode.KeyExpression; + while(*p){ + *p = tolower(*p); + p++; + } + + if(( fwrite( &Head->KeyExpression, 256, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + memset( buf, 0x00, 1 ); + buf[0] = Head->Unique; + if(( fwrite( &buf, 1, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + + if(( fwrite( &Head->NotUsed, 745, 1, f )) != 1 ){ + fclose( f ); + return XB_WRITE_ERROR; + } + return 0; +} + +xbShort xbNtx::TouchIndex( void ) +{ + xbShort rc; + if (( rc = GetHeadNode()) != XB_NO_ERROR) return rc; + HeadNode.Version++; + if (( rc = PutHeadNode(&HeadNode, indexfp, 1)) != XB_NO_ERROR) return rc; + return XB_NO_ERROR; +} +/************************************************************************/ +//! Short description. +/*! + \param RecNo + \param n +*/ +xbShort xbNtx::PutKeyData( xbShort RecNo, xbNodeLink *n ) +{ + /* This routine copies the KeyBuf data into xbNodeLink n */ + NtxLeafNode *temp; + char *p; + xbShort i; + xbUShort itemOffset; + if( !n ) return XB_INVALID_NODELINK; + temp = &n->Leaf; + if( RecNo < 0 || RecNo > (HeadNode.KeysPerNode)) + return XB_INVALID_KEY; + itemOffset = GetItemOffset(RecNo, n, 1); + p = temp->KeyRecs; + p += itemOffset; + p += 8; + for( i = 0; i < HeadNode.KeyLen; i++ ){ + *p = KeyBuf[i]; + p++; + } + return XB_NO_ERROR; +} +/************************************************************************/ +//! Short description. +/*! + \param n + \param pos + \param d + \param l + \param w +*/ +xbShort xbNtx::PutKeyInNode( xbNodeLink * n, xbShort pos, xbLong d, xbLong l, xbShort w ) +{ + /* check the node */ + if( !n ) return XB_INVALID_NODELINK; + if( pos < 0 || pos > HeadNode.KeysPerNode ) return XB_INVALID_RECORD; + if( n->Leaf.NoOfKeysThisNode >= HeadNode.KeysPerNode ) return XB_NODE_FULL; + + InsertKeyOffset(pos, n); + PutKeyData( pos, n ); + PutDbfNo( pos, n, d ); + PutLeftNodeNo( pos, n, l ); + n->Leaf.NoOfKeysThisNode++; + if( w ) + return PutLeafNode( n->NodeNo, n ); + else + return 0; +} +/************************************************************************/ +//! Short description. +/*! + \param n1 + \param n2 + \param pos + \param d +*/ +xbShort xbNtx::SplitLeafNode( xbNodeLink *n1, xbNodeLink *n2, xbShort pos, xbLong d ) +{ + xbShort i,j,rc; + xbShort temp; + xbShort start; + xbShort end; +// xbShort length; + + if( !n1 || !n2 ) return XB_INVALID_NODELINK; + if( pos < 0 || pos > HeadNode.KeysPerNode ) return XB_INVALID_RECORD; + +// length = strlen(KeyBuf); + + // If the new key goes in the first node. + if( pos < HeadNode.HalfKeysPerNode ){ + // Setup key to insert into parent + memcpy(PushItem.Key, + GetKeyData(HeadNode.HalfKeysPerNode -1, n1), HeadNode.KeyLen); + PushItem.RecordNumber = GetDbfNo(HeadNode.HalfKeysPerNode -1, n1); + PushItem.Node = 0L; + start = pos; + end = HeadNode.HalfKeysPerNode - 1; + temp = n1->offsets[end]; + for( i = end; i > start; i--) + n1->offsets[i] = n1->offsets[i-1]; + + n1->offsets[start] = temp; + // Insert new key + PutKeyData( start , n1 ); + PutDbfNo ( start , n1, d ); + } else { + // If the passed-in key IS median key, just copy it. + if( pos == HeadNode.HalfKeysPerNode ){ + memcpy(PushItem.Key, KeyBuf, HeadNode.KeyLen); + PushItem.RecordNumber = d; + start = pos; + end = pos; + } else { + // Otherwise, the median key will be middle key because the + // new key will be inserted somewhere above the middle. + memcpy( PushItem.Key, + GetKeyData(HeadNode.HalfKeysPerNode, n1), + HeadNode.KeyLen); + PushItem.RecordNumber = GetDbfNo(HeadNode.HalfKeysPerNode, n1); + start = HeadNode.HalfKeysPerNode ; + end = pos -1; + } + temp = n1->offsets[start]; + for( i = start; i < end; i++) + n1->offsets[i] = n1->offsets[i+1]; + + n1->offsets[end] = temp; + + // Insert new key + PutKeyData( pos -1 , n1 ); + PutDbfNo ( pos -1 , n1, d ); + } + + // Dup the node data + memcpy(n2->Leaf.KeyRecs, n1->Leaf.KeyRecs, XB_NTX_NODE_SIZE); + + // Dup the offsets + for( i = 0; i < HeadNode.KeysPerNode +1; i++) + n2->offsets[i] = n1->offsets[i]; + + // Setup the second node + for(j=0, i=HeadNode.HalfKeysPerNode; i < HeadNode.KeysPerNode; i++, j++ ){ + temp = n2->offsets[j]; + n2->offsets[j] = n2->offsets[i]; + n2->offsets[i] = temp; + } + + // Get the last offset for both nodes + temp = n2->offsets[j]; + n2->offsets[j] = n2->offsets[HeadNode.KeysPerNode]; + n2->offsets[HeadNode.KeysPerNode] = temp; + + // Set the new count of both nodes + n2->Leaf.NoOfKeysThisNode = HeadNode.HalfKeysPerNode; + n1->Leaf.NoOfKeysThisNode = HeadNode.HalfKeysPerNode; + + if(( rc = PutLeafNode( n1->NodeNo, n1 )) != 0 ) + return rc; + if(( rc = PutLeafNode( n2->NodeNo, n2 )) != 0 ) + return rc; + return 0; +} +/************************************************************************/ +//! Short description. +/*! + \param n1 + \param n2 + \param +*/ +xbShort xbNtx::SplitINode( xbNodeLink *n1, xbNodeLink *n2, xbLong ) + /* parent, tempnode, tempnodeno */ +{ + xbShort i,j,rc; + xbShort temp; + xbShort pos = n1->CurKeyNo; + xbShort start; + xbShort end; + xbLong n1LastNodeNo = 0; + + NtxItem oldPushItem; + oldPushItem.Node = PushItem.Node; + oldPushItem.RecordNumber = PushItem.RecordNumber; + memcpy(oldPushItem.Key, PushItem.Key, sizeof(PushItem.Key)); + + // n2->NodeNo = HeadNode.TotalNodes++; + n2->NodeNo = GetNextNodeNo(); + + // If the new key goes in the first node. + if( pos < HeadNode.HalfKeysPerNode ){ + // Setup key to insert into parent + memcpy(PushItem.Key, + GetKeyData(HeadNode.HalfKeysPerNode -1, n1), HeadNode.KeyLen); + PushItem.RecordNumber = GetDbfNo(HeadNode.HalfKeysPerNode -1, n1); + PushItem.Node = n2->NodeNo; + n1LastNodeNo = GetLeftNodeNo(HeadNode.HalfKeysPerNode -1, n1); + start = pos; + end = HeadNode.HalfKeysPerNode - 1; + + // Insert the new key. + temp = n1->offsets[end]; + for( i = end; i > start; i--) + n1->offsets[i] = n1->offsets[i-1]; + n1->offsets[start] = temp; + } else { + // If the passed-in key IS median key, just copy it. + if( pos == HeadNode.HalfKeysPerNode ){ + PutLeftNodeNo(0, n2, oldPushItem.Node); + // PushItem should remain the same, except for its left pointer + PushItem.Node = n2->NodeNo; +// start = pos; unused code +// end = pos; unused code + } else { + // Otherwise, the median key will be middle key becasue the + // new key will be inserted somewhere above the middle. + memcpy( PushItem.Key, + GetKeyData(HeadNode.HalfKeysPerNode, n1), + HeadNode.KeyLen); + PushItem.RecordNumber = GetDbfNo(HeadNode.HalfKeysPerNode, n1); + PushItem.Node = n2->NodeNo; + n1LastNodeNo = GetLeftNodeNo(HeadNode.HalfKeysPerNode, n1); + +// start = HeadNode.HalfKeysPerNode + 1; + start = HeadNode.HalfKeysPerNode; + end = pos -1; + + // Insert the new key. + temp = n1->offsets[start]; + for( i = start; i < end; i++) + n1->offsets[i] = n1->offsets[i+1]; + n1->offsets[end] = temp; + pos--; + } + } + + /* restore original key */ + memcpy( KeyBuf, oldPushItem.Key, HeadNode.KeyLen + 1); + + // Insert new key + PutKeyData( pos, n1 ); + PutDbfNo ( pos, n1, oldPushItem.RecordNumber); + PutLeftNodeNo( pos, n1, GetLeftNodeNo (pos + 1, n1)); + PutLeftNodeNo( pos + 1 /* +1 ?*/, n1, oldPushItem.Node /* t */ ); + + // Dup the node data into the new page + memcpy(n2->Leaf.KeyRecs, n1->Leaf.KeyRecs, XB_NTX_NODE_SIZE); + + // Dup the offsets + for( i = 0; i < HeadNode.KeysPerNode +1; i++){ + n2->offsets[i] = n1->offsets[i]; + } + + // Setup the second node + for( j = 0, i = HeadNode.HalfKeysPerNode; i<HeadNode.KeysPerNode; i++,j++ ){ + temp = n2->offsets[j]; + n2->offsets[j] = n2->offsets[i]; + n2->offsets[i] = temp; + } + + // Get the last offset for both nodes + temp = n2->offsets[j]; + n2->offsets[j] = n2->offsets[HeadNode.KeysPerNode]; + n2->offsets[HeadNode.KeysPerNode] = temp; + PutLeftNodeNo(HeadNode.HalfKeysPerNode, n1, n1LastNodeNo); + + // Set the new count of both nodes + n2->Leaf.NoOfKeysThisNode = HeadNode.HalfKeysPerNode; + n1->Leaf.NoOfKeysThisNode = HeadNode.HalfKeysPerNode; + + if((rc = PutLeafNode( n1->NodeNo,n1 )) != 0) return rc; + if((rc = PutLeafNode( n2->NodeNo,n2 )) != 0) return rc; + return 0; +} +/************************************************************************/ +//! Short description. +/*! + \param RecBufSw + \param KeyBufSw +*/ +xbShort xbNtx::CreateKey( xbShort RecBufSw, xbShort KeyBufSw ) +{ + /* RecBufSw 0 Use RecBuf */ + /* 1 Use RecBuf2 */ + /* KeyBufSw 0 Use KeyBuf */ + /* 1 Use KeyBuf2 */ + + xbShort rc; + xbExpNode * TempNode; + + if(( rc = IxExp->ProcessExpression( RecBufSw )) != XB_NO_ERROR ) + return rc; + TempNode = (xbExpNode *) IxExp->Pop(); + if( !TempNode ) return XB_INVALID_KEY; + + if( KeyBufSw ){ + memset( KeyBuf2, 0x00, HeadNode.KeyLen + 1 ); + memcpy( KeyBuf2, TempNode->StringResult, XB_MIN(HeadNode.KeyLen + 1, TempNode->DataLen) ); + } else { + memset( KeyBuf, 0x00, HeadNode.KeyLen + 1 ); + memcpy( KeyBuf, TempNode->StringResult, XB_MIN(HeadNode.KeyLen + 1, TempNode->DataLen) ); + } +// if( !TempNode->InTree ) dbf->xbase->FreeExpNode( TempNode ); + if( !TempNode->InTree ) delete TempNode; + return 0; +} +/************************************************************************/ +//! Short description. +/*! + \param key +*/ +xbShort +xbNtx::GetCurrentKey(char *key) +{ + CreateKey(0, 0); + memcpy(key, KeyBuf, HeadNode.KeyLen + 1); + return 0; +} +/************************************************************************/ +//! Short description. +/*! + \param DbfRec +*/ +xbShort xbNtx::AddKey( xbLong DbfRec ) +{ + /* This routine assumes KeyBuf contains the contents of the index to key */ + + xbShort i,rc; + xbNodeLink * TempNode; + xbNodeLink * Tparent; + xbLong TempNodeNo; /* new, unattached leaf node no */ + + /* find node key belongs in */ + rc = FindKey( KeyBuf, HeadNode.KeyLen, 0 ); + if( rc == XB_FOUND && HeadNode.Unique ) + return XB_KEY_NOT_UNIQUE; + + /************************************************/ + /* section A - if room in node, add key to node */ + /************************************************/ + + if( CurNode->Leaf.NoOfKeysThisNode < HeadNode.KeysPerNode ){ + if(( rc = PutKeyInNode( CurNode,CurNode->CurKeyNo,DbfRec,0L,1)) != 0) + return rc; + if(( rc = PutHeadNode( &HeadNode, indexfp, 1 )) != 0) + return rc; + return XB_NO_ERROR; + } + + /***********************************************************************/ + /* section B - split leaf node if full and put key in correct position */ + /***********************************************************************/ + + TempNode = GetNodeMemory(); + // Create a new page + TempNode->NodeNo = GetNextNodeNo(); + + rc = SplitLeafNode( CurNode, TempNode, CurNode->CurKeyNo, DbfRec ); + if( rc ) return rc; + + /* TempNode is on disk, now we have to point someone above to + that node. Keep the NodeNo of the on disk new node. + */ + TempNodeNo = TempNode->NodeNo; + ReleaseNodeMemory( TempNode ); + + /* + PushItem also contains the key to put into the parent + PushItem should point at TempNode + */ + PushItem.Node = TempNodeNo; + + /*****************************************************/ + /* section C go up tree splitting nodes as necessary */ + /*****************************************************/ + + Tparent = CurNode->PrevNode; + + while( Tparent && Tparent->Leaf.NoOfKeysThisNode >= HeadNode.KeysPerNode ){ + TempNode = GetNodeMemory(); + if( !TempNode ) + return XB_NO_MEMORY; + + rc = SplitINode( Tparent, TempNode, TempNodeNo ); + if( rc ) return rc; + TempNodeNo = TempNode->NodeNo; + ReleaseNodeMemory( TempNode ); + ReleaseNodeMemory( CurNode ); + CurNode = Tparent; + CurNode->NextNode = NULL; + Tparent = CurNode->PrevNode; + } + + /************************************************************/ + /* Section D if CurNode is split root, create new root */ + /************************************************************/ + + /* at this point + CurNode = The node that was just split + TempNodeNo = The new node split off from CurNode */ + + if(CurNode->NodeNo == HeadNode.StartNode ){ + TempNode = GetNodeMemory(); + if( !TempNode ) + return XB_NO_MEMORY; + + memcpy( KeyBuf, PushItem.Key, HeadNode.KeyLen ); + PutKeyData( 0, TempNode ); + PutDbfNo ( 0, TempNode, PushItem.RecordNumber ); + PutLeftNodeNo( 0, TempNode, CurNode->NodeNo ); + PutLeftNodeNo( 1, TempNode, PushItem.Node ); + TempNode->NodeNo = GetNextNodeNo(); + TempNode->Leaf.NoOfKeysThisNode++; + HeadNode.StartNode = TempNode->NodeNo; + rc = PutLeafNode( TempNode->NodeNo, TempNode ); + if( rc ) return rc; + rc = PutHeadNode( &HeadNode, indexfp, 1 ); + if( rc ) return rc; + ReleaseNodeMemory( TempNode ); + return XB_NO_ERROR; + } + /**********************************/ + /* Section E make room in parent */ + /**********************************/ + InsertKeyOffset(Tparent->CurKeyNo, Tparent); + + /* put key in parent */ + + i = Tparent->CurKeyNo; + memcpy( KeyBuf, PushItem.Key, HeadNode.KeyLen); + PutKeyData( i, Tparent ); + + PutDbfNo( i, Tparent, PushItem.RecordNumber); + PutLeftNodeNo( i , Tparent, CurNode->NodeNo ); + PutLeftNodeNo( i + 1 , Tparent, TempNodeNo ); + Tparent->Leaf.NoOfKeysThisNode++; + + rc = PutLeafNode( Tparent->NodeNo, Tparent ); + if( rc ) return rc; + rc = PutHeadNode( &HeadNode, indexfp, 1 ); + if( rc ) return rc; + + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description. +/*! + \param n +*/ +xbShort xbNtx::UpdateParentKey( xbNodeLink * n ) +{ +/* this routine goes backwards thru the node chain looking for a parent + node to update */ + + xbNodeLink * TempNode; + + if( !n ) return XB_INVALID_NODELINK; + if( !GetDbfNo( 0, n )){ + std::cout << "Fatal index error - Not a leaf node" << n->NodeNo << std::endl; +// exit(0); + return XB_NOT_LEAFNODE; + } + TempNode = n->PrevNode; + + while( TempNode ){ + if( TempNode->CurKeyNo < TempNode->Leaf.NoOfKeysThisNode ){ + memcpy(KeyBuf,GetKeyData(n->Leaf.NoOfKeysThisNode-1,n),HeadNode.KeyLen); + PutKeyData( TempNode->CurKeyNo, TempNode ); + return PutLeafNode( TempNode->NodeNo, TempNode ); + } + TempNode = TempNode->PrevNode; + } + return XB_NO_ERROR; +} +/***********************************************************************/ +//! Short description. +/*! + \param n +*/ +/* This routine queues up a list of nodes which have been emptied */ +void xbNtx::UpdateDeleteList( xbNodeLink *n ) +{ + n->NextNode = DeleteChain; + DeleteChain = n; +} +/***********************************************************************/ +//! Short description. +/*! +*/ +/* Delete nodes from the node list - for now we leave the empty nodes */ +/* dangling in the file. Eventually we will remove nodes from the file */ + +void xbNtx::ProcessDeleteList( void ) +{ + if( DeleteChain ){ + ReleaseNodeMemory( DeleteChain ); + DeleteChain = NULL; + } +} +/***********************************************************************/ +//! Short description. +/*! +*/ +xbShort xbNtx::KeyWasChanged( void ) +{ + CreateKey( 0, 0 ); /* use KeyBuf, RecBuf */ + CreateKey( 1, 1 ); /* use KeyBuf2, RecBuf2 */ + if( CompareKey( KeyBuf, KeyBuf2, HeadNode.KeyLen ) != 0 ) + return 1; + else + return 0; +} +/***********************************************************************/ +//! Short description. +/*! + \param DbfRec +*/ +xbShort xbNtx::DeleteKey( xbLong DbfRec ) +{ +/* this routine assumes the key to be deleted is in KeyBuf */ + + xbShort rc; + + // FindKey will set CurNodeNo on evey page down to the + // key being deleted. This is important. Plus we + // need to be able to find the key to delete it. + CurNode = NULL; + if(( rc = FindKey( KeyBuf, DbfRec )) != XB_FOUND ) + return rc; + + // Then delete it + // next sentence modified 8/20/03 - gkunkel + if(( rc = DeleteKeyFromNode( CurNode->CurKeyNo, CurNode )) != XB_NO_ERROR ) + return rc; + + CurDbfRec = GetDbfNo( CurNode->CurKeyNo, CurNode ); + if(( rc = PutHeadNode( &HeadNode, indexfp, 1 )) != 0 ) + return rc; + return XB_NO_ERROR; +} + +//! Short description. +/*! + \param pos + \param n +*/ +xbShort +xbNtx::DeleteKeyFromNode(xbShort pos, xbNodeLink *n ) +{ + xbNodeLink *TempNode; + xbShort rc; + + // Check to see if this is an inode + if( GetLeftNodeNo( 0 , n ) != 0 ){ + // Copy the rightmost key from the left node. + TempNode = n; + GetLeafNode ( GetLeftNodeNo (n->CurKeyNo, n), 1); + while(( rc = GetLeftNodeNo( 0, CurNode )) != 0 ) + GetLeafNode ( GetLeftNodeNo (CurNode->Leaf.NoOfKeysThisNode, CurNode), 1); + + // Get the key Data + strcpy (KeyBuf , GetKeyData( CurNode->Leaf.NoOfKeysThisNode -1, CurNode)); + PutKeyData( pos, TempNode ); + + // Get the xbDbf no + PutDbfNo (pos, TempNode, GetDbfNo( CurNode->Leaf.NoOfKeysThisNode -1, CurNode) ); + + // We don't change the LeftNodeNo. determined later + // Write the changed node + PutLeafNode( TempNode->NodeNo, TempNode ); + + // Now delete the key from the child + TempNode = CurNode; + + if((rc = PutLeafNode( n->NodeNo,n )) != 0) return rc; + + return DeleteKeyFromNode( TempNode->Leaf.NoOfKeysThisNode -1, TempNode); + } else { + return RemoveKeyFromNode(pos, n); + } +} + +//! Short description. +/*! + \param pos + \param n +*/ +xbShort xbNtx::RemoveKeyFromNode( xbShort pos, xbNodeLink *n ) +{ + xbNodeLink *TempNode; + xbNodeLink *sibling; + xbNodeLink *parent; + xbShort rc; + xbLong newHeadNode = 0; + xbBool harvest = false; + + // Here we are a leaf node.. + + if( n->NodeNo == HeadNode.StartNode && n->Leaf.NoOfKeysThisNode == 1) + // we are about to delete the last node from the head node. + newHeadNode = GetLeftNodeNo( 0 , n ); + + // Remove the key from the current node. + DeleteKeyOffset(pos, n); + n->Leaf.NoOfKeysThisNode--; + + // Check to see if the number of keys left is less then + // 1/2 KeysPerNode + if( ! ( n->NodeNo == HeadNode.StartNode ) + && n->Leaf.NoOfKeysThisNode < HeadNode.HalfKeysPerNode){ + // This observed clipper behavior. + // If less then 1/2 keys per node, then merge with right sibling. + // If no right sibling, merge with left sibling. + parent = n->PrevNode; + + // If the parents cur key is the last key, then take the left node + if( parent->CurKeyNo == parent->Leaf.NoOfKeysThisNode ){ + TempNode = CurNode; + GetLeafNode( GetLeftNodeNo(parent->CurKeyNo -1, parent), 2 ); + sibling = CurNode; + CurNode = TempNode; + + rc = JoinSiblings(parent, parent->CurKeyNo -1, sibling, n); + + // Harvest the empty node, if necessary Clipper keeps the old key + // count on the node, to we can't set it to 0 + if( rc == XB_HARVEST_NODE ) + harvest = true; + + if((rc = PutLeafNode( n->NodeNo,n )) != 0) return rc; + if((rc = PutLeafNode( sibling->NodeNo,sibling )) != 0) return rc; + if((rc = PutLeafNode( parent->NodeNo,parent )) != 0) return rc; + + if(harvest){ + HeadNode.UnusedOffset = n->NodeNo; + // Save the empty xbNodeLink + // ReleaseNodeMemory(n); + // We may have to delete a node from the parent + return RemoveKeyFromNode( parent->CurKeyNo, parent); + } + } else { + // Take the right node + TempNode = CurNode; + GetLeafNode( GetLeftNodeNo(parent->CurKeyNo + 1, parent), 2 ); + sibling = CurNode; + CurNode = TempNode; + + rc = JoinSiblings(parent, parent->CurKeyNo, n, sibling); + // Harvest the empty node, if necessary Clipper keeps the old key + // count on the node, to we can't set it to 0 + if( rc == XB_HARVEST_NODE ) + harvest = true; + + if((rc = PutLeafNode( n->NodeNo,n )) != 0) return rc; + if((rc = PutLeafNode( sibling->NodeNo,sibling )) != 0) return rc; + if((rc = PutLeafNode( parent->NodeNo,parent )) != 0) return rc; + + if( harvest ){ + HeadNode.UnusedOffset = sibling->NodeNo; + // Save the empty xbNodeLink + ReleaseNodeMemory( sibling ); + + // Now the parents->CurKeyNo+1 left pointer is empty, and + // we are about to delete the parent. So move the left node no + // from the parents->CurKeyNo+1 to the parent->CurNodeNo + PutLeftNodeNo( parent->CurKeyNo +1 , parent, + GetLeftNodeNo( parent->CurKeyNo, parent )); + // We may have to delete a node from the parent + return RemoveKeyFromNode( parent->CurKeyNo, parent); + } + } + } else { + if( n->NodeNo == HeadNode.StartNode && n->Leaf.NoOfKeysThisNode == 0 ){ + // we are about to delete the last node from the head node. + HeadNode.UnusedOffset = HeadNode.StartNode; + HeadNode.StartNode = newHeadNode; + } + + if((rc = PutLeafNode( n->NodeNo,n )) != 0) return rc; + // If more then 1/2 keys per node -> done. + return XB_NO_ERROR; + } + return XB_NO_ERROR; +} + +//! Short description. +/*! + \param parent + \param parentPos + \param n1 + \param n2 +*/ +xbShort +xbNtx::JoinSiblings(xbNodeLink *parent, xbShort parentPos, xbNodeLink *n1, xbNodeLink* n2) +{ + // ASSUMES: keys in n1 are less then keys in n2 + // + // Here, the contents of n1 need to be merged with n2. If n1 + parent_key + // + n2 can all fit in n1, then leave n2 empty, and remove the key from the + // parent. + // Otherwise evenly distribute the keys from n1 and n2 over both, resetting + // the parent. + + xbShort i, j; + int totalKeys; + int median; + + // if n1 has exactly (it will never have less) 1/2 keys per node + // then put everything into n1. + if((n1->Leaf.NoOfKeysThisNode + n2->Leaf.NoOfKeysThisNode + 1) <= HeadNode.KeysPerNode){ + int n1LastNodeNo = GetLeftNodeNo(n2->Leaf.NoOfKeysThisNode, n2); + // Bring down the parent + strcpy(KeyBuf, GetKeyData( parentPos, parent )); + PutKeyData( n1->Leaf.NoOfKeysThisNode , n1); + PutDbfNo ( n1->Leaf.NoOfKeysThisNode, n1, GetDbfNo( parentPos, parent ) ); + n1->Leaf.NoOfKeysThisNode++; + + // Copy over the rest of the keys + for(i = n1->Leaf.NoOfKeysThisNode, j = 0; j < n2->Leaf.NoOfKeysThisNode; i++, j++){ + strcpy(KeyBuf, GetKeyData( j, n2 )); + PutKeyData( i, n1); + PutLeftNodeNo( i, n1, GetLeftNodeNo( j, n2) ); + PutDbfNo ( i , n1, GetDbfNo( j, n2 ) ); + } + n1->Leaf.NoOfKeysThisNode += j; + PutLeftNodeNo(n1->Leaf.NoOfKeysThisNode, n1, n1LastNodeNo); + + // We need a way to signal that this node will be harvested. + // Clipper keeps the KeyCount on harvested nodes, it does NOT + // set them to 0. + return XB_HARVEST_NODE; + } else { + // Distribute the keys evenly. Of off by one, the extra + // goes to n1. + + // If n1 contains the greater than keys, then at this point we + // know that n1 has more than 1/2MKPN. therefore we copy + // over untill we get to median. All the while removing + // keys from n2. Then + + totalKeys = n1->Leaf.NoOfKeysThisNode + n2->Leaf.NoOfKeysThisNode + 1; + median = (int) totalKeys/2; + + // If n1 has more keys then n2, then we need to copy the last keys + // of n1 to the beginning of n2. + // Leave HalfKeysPerNode+1 keys in n1, then the last key will + // be copied up to the parent. + if( n1->Leaf.NoOfKeysThisNode > HeadNode.HalfKeysPerNode ){ + // Bring down the parent + InsertKeyOffset(0, n2); + strcpy(KeyBuf, GetKeyData( parentPos, parent )); + PutKeyData( 0 , n2); + PutDbfNo ( 0, n2, GetDbfNo( parentPos, parent ) ); + n2->Leaf.NoOfKeysThisNode++; + PutLeftNodeNo(0, n2, GetLeftNodeNo(n1->Leaf.NoOfKeysThisNode, n1)); + for( i = n1->Leaf.NoOfKeysThisNode -1; i > median; i-- ){ + // Put the key in n2 + InsertKeyOffset(0, n2); + strcpy(KeyBuf, GetKeyData( i, n1 )); + PutKeyData( 0, n2); + PutLeftNodeNo( 0, n2, GetLeftNodeNo( i, n1) ); + PutDbfNo ( 0 , n2, GetDbfNo( i, n1 ) ); + + // Remove the key from the current node. + n1->Leaf.NoOfKeysThisNode--; + n2->Leaf.NoOfKeysThisNode++; + } + // Copy up the last key from n1, that will become the new parent key. + strcpy(KeyBuf, GetKeyData( n1->Leaf.NoOfKeysThisNode -1 , n1 )); + PutKeyData( parentPos, parent); + PutDbfNo ( parentPos , parent, GetDbfNo( n1->Leaf.NoOfKeysThisNode -1, n1) ); + n1->Leaf.NoOfKeysThisNode--; + } else { + xbLong n1LastLeftNodeNo; + xbShort medianOffset = n2->Leaf.NoOfKeysThisNode - median -1; + // Bring down the parent + strcpy(KeyBuf, GetKeyData( parentPos, parent )); + PutKeyData( n1->Leaf.NoOfKeysThisNode , n1); + PutDbfNo ( n1->Leaf.NoOfKeysThisNode, n1, GetDbfNo( parentPos, parent ) ); + n1->Leaf.NoOfKeysThisNode++; + +// 8/20/03 gkunkel n1LastLeftNodeNo = GetLeftNodeNo(medianOffset, n2); + PutLeftNodeNo( n1->Leaf.NoOfKeysThisNode, n1, GetLeftNodeNo(medianOffset, n2)); + + // Moving the median to the parent may have to occur + // before moving the other keys to n1. This we would have + // to calcualte the correct offset from the median + // Copy up the first key from n2 (the median), + // that will become the new parent key. + strcpy(KeyBuf, GetKeyData( medianOffset, n2 )); + PutKeyData( parentPos, parent); + PutDbfNo ( parentPos , parent, GetDbfNo(medianOffset, n2 ) ); + n1LastLeftNodeNo = GetLeftNodeNo(medianOffset, n2); + +// Still investigating the -1 thing with clipper, If anyone has clues, +// please let me know - bob@synxis.com +// if ( n1->Leaf.NoOfKeysThisNode >= (median - 1)) +// { +// // Clipper, don't know why +// PutLeftNodeNo(0, n2 , -1 ); +// std::cout << "Clipper hack" << std::endl; +// } + + DeleteKeyOffset(medianOffset, n2); + n2->Leaf.NoOfKeysThisNode--; + +// xbShort clipperMessedUpIndex = n1->Leaf.NoOfKeysThisNode; + for( i = n1->Leaf.NoOfKeysThisNode, j = 0; j < medianOffset; i++, j++ ){ + strcpy(KeyBuf, GetKeyData( 0, n2 )); + PutKeyData( i, n1); + PutLeftNodeNo( i, n1, GetLeftNodeNo( 0, n2) ); + PutDbfNo ( i , n1, GetDbfNo( 0, n2 ) ); + +// if( i == clipperMessedUpIndex){ +// // Clipper, don't know why +// PutLeftNodeNo(0, n2 , -1 ); +// std::cout << "Clipper hack in loop i = " << i << std::endl; +// } + + // Remove the key from the current node. + DeleteKeyOffset(0, n2); + n2->Leaf.NoOfKeysThisNode--; + n1->Leaf.NoOfKeysThisNode++; + } + PutLeftNodeNo(n1->Leaf.NoOfKeysThisNode, n1, n1LastLeftNodeNo); + + } + } + return XB_NO_ERROR; +} +/************************************************************************/ +//! Short description. +/*! + \param option +*/ +#ifdef XBASE_DEBUG +xbShort xbNtx::CheckIndexIntegrity( const xbShort option ) +{ + /* if option = 1, print out some stats */ + + xbShort rc; + xbLong ctr = 1L; + + if ( option ) std::cout << "Checking NTX " << GetFileName() << std::endl; + rc = dbf->GetRecord( ctr ); + while( ctr < dbf->NoOfRecords() ){ + ctr++; + if( option ) std::cout << "Checking Record " << ctr << std::endl; + if( !dbf->RecordDeleted() ){ + CreateKey( 0, 0 ); + rc = FindKey( KeyBuf, dbf->GetCurRecNo()); + if( rc != XB_FOUND ){ + if( option ){ + std::cout << "Record number " << dbf->GetCurRecNo() + << " Not Found" << std::endl; + std::cout << "Key = " << KeyBuf << std::endl; + } + return rc; + } + } + if(( rc = dbf->GetRecord( ctr )) != XB_NO_ERROR ) + return rc; + } + + if( option ) + std::cout << "Exiting with rc = " << rc << std::endl; + return XB_NO_ERROR; +} +#endif +/***********************************************************************/ +//! Short description. +/*! + \param statusFunc +*/ +xbShort xbNtx::ReIndex(void (*statusFunc)(xbLong itemNum, xbLong numItems)) +{ + /* this method assumes the index has been locked in exclusive mode */ + xbLong l; + xbShort rc, i, saveAutoLock; + NtxHeadNode TempHead; + FILE *t, *temp; + xbString TempName; + + memcpy( &TempHead, &HeadNode, sizeof( struct NtxHeadNode )); + TempHead.StartNode = 1024L; + rc = dbf->xbase->DirectoryExistsInName( GetFileName() ); + if( rc ) { + TempName.assign(GetFileName(), 0, rc); + TempName += "TEMPFILE.NTX"; + } else + TempName = "TEMPFILE.NTX"; + + if(( t = fopen( TempName, "w+b" )) == NULL ) + return XB_OPEN_ERROR; + + if(( rc = PutHeadNode( &TempHead, t, 0 )) != 0 ){ + fclose( t ); + remove( TempName ); + return rc; + } + + for( i = 0; i < XB_NTX_NODE_SIZE; i++ ){ + if(( fwrite( "\x00", 1, 1, t )) != 1 ){ + fclose( t ); + remove( TempName ); + return XB_WRITE_ERROR; + } + } + + temp = indexfp; + indexfp = t; + + if(( rc = GetLeafNode(TempHead.StartNode, 1)) != 0 ) + return rc; + + for(i = 0; i < TempHead.KeysPerNode + 1; i++) + CurNode->offsets[i] = (i * HeadNode.KeySize) + + 2 + (2 * (HeadNode.KeysPerNode + 1)); + + HeadNode.StartNode = TempHead.StartNode; + if((rc = PutLeafNode(TempHead.StartNode, CurNode )) != 0) + return rc; + + indexfp = temp; + + if( fclose( indexfp ) != 0 ) + return XB_CLOSE_ERROR; + + if( fclose( t ) != 0 ) + return XB_CLOSE_ERROR; + + if( remove( GetFileName() ) != 0 ) + return XB_CLOSE_ERROR; + + if( rename( TempName, GetFileName()) != 0 ) + return XB_WRITE_ERROR; + + if(( indexfp = fopen( GetFileName(), "r+b" )) == NULL ) + return XB_OPEN_ERROR; + + saveAutoLock = dbf->GetAutoLock(); + dbf->AutoLockOff(); + + for( l = 1; l <= dbf->NoOfRecords(); l++ ){ + if(statusFunc) + statusFunc(l, dbf->NoOfRecords()); + + if(( rc = dbf->GetRecord(l)) != XB_NO_ERROR ) + return rc; + + if(!dbf->GetRealDelete() || !dbf->RecordDeleted()){ + /* Create the key */ + CreateKey( 0, 0 ); + + /* add key to index */ + if(( rc = AddKey( l )) != XB_NO_ERROR ) + return rc; + } + } + if(saveAutoLock) + dbf->AutoLockOn(); + + return XB_NO_ERROR; +} + +//! Short description. +/*! +*/ +xbLong +xbNtx::GetNextNodeNo() +{ + struct stat FileStat; + int rc; + xbULong FileSize; + + if( HeadNode.UnusedOffset != 0){ + FileSize = HeadNode.UnusedOffset; + HeadNode.UnusedOffset = 0; + PutHeadNode(&HeadNode, indexfp, 1); + return FileSize; + } + + rc = fstat(fileno(indexfp), &FileStat); + if( rc != 0 ) + return 0; + + + FileSize = (xbULong)FileStat.st_size; + // File offset is zero based, so the file size will be the + // offset of the next page. + return FileSize; +} + +//! Short description. +/*! + \param buf + \param len +*/ +void xbNtx::GetExpression(char *buf, int len) +{ + memcpy(buf, HeadNode.KeyExpression, len < 256 ? len : 256); +} + +const char* xbNtx::GetExtWithDot(bool lower) +{ + return lower? ".ntx": ".NTX"; +} + +xbUShort xbNtx::GetKeyLen() +{ + return HeadNode.KeyLen; +} + +const char* xbNtx::GetKeyExpression() +{ + return HeadNode.KeyExpression; +} + +void xbNtx::FreeNodesMemory() +{ + ReleaseNodeMemory(NodeChain, true); + NodeChain = 0; +// ReleaseNodeMemory(CloneChain, true); +// CloneChain = 0; + ReleaseNodeMemory(FreeNodeChain, true); + FreeNodeChain = 0; + ReleaseNodeMemory(DeleteChain, true); + DeleteChain = 0; +} + +#endif /* XB_INDEX_NTX */ diff --git a/xbase64/xbntx.h b/xbase64/xbntx.h new file mode 100755 index 0000000..daa1aa7 --- /dev/null +++ b/xbase64/xbntx.h @@ -0,0 +1,213 @@ +/* xbntx.h
+
+ Xbase64 project source code
+
+ This file contains a header file for the xbNdx object, which is used
+ for handling xbNdx type indices.
+
+ Copyright (C) 1997,2003 Bob Cotton
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser 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
+
+
+ Contact:
+
+ Email:
+
+ xdb-devel@lists.sourceforge.net
+ xdb-users@lists.sourceforge.net
+
+
+ Regular Mail:
+
+ XBase Support
+ 149C South Main St
+ Keller Texas, 76248
+ USA
+
+*/
+
+#ifndef __XB_NTX_H__
+#define __XB_NTX_H__
+
+#ifdef __GNU LesserG__
+#pragma interface
+#endif
+
+#include <xbase64/xbase64.h>
+#include <string.h>
+
+/*! \file xbntx.h
+*/
+
+#define XB_NTX_NODE_SIZE 1024
+
+//! xbNtxHeadNode struct
+/*!
+*/
+
+struct NtxHeadNode { /* ntx header on disk */
+ xbUShort Signature; /* Clipper 5.x or Clipper 87 */
+ xbUShort Version; /* Compiler Version */
+ /* Also turns out to be a last modified counter */
+ xbLong StartNode; /* Offset in file for first index */
+ xbULong UnusedOffset; /* First free page offset */
+ xbUShort KeySize; /* Size of items (KeyLen + 8) */
+ xbUShort KeyLen; /* Size of the Key */
+ xbUShort DecimalCount; /* Number of decimal positions */
+ xbUShort KeysPerNode; /* Max number of keys per page */
+ xbUShort HalfKeysPerNode; /* Min number of keys per page */
+ char KeyExpression[256]; /* Null terminated key expression */
+ unsigned Unique; /* Unique Flag */
+ char NotUsed[745];
+};
+
+//! xbNtxLeafNode struct
+/*!
+*/
+
+struct NtxLeafNode { /* ndx node on disk */
+ xbUShort NoOfKeysThisNode;
+ char KeyRecs[XB_NTX_NODE_SIZE];
+};
+
+
+//! xbNtxItem struct
+/*!
+*/
+
+struct NtxItem
+{
+ xbULong Node;
+ xbULong RecordNumber;
+ char Key[256];
+};
+
+//! xbNtxNodeLink struct
+/*!
+*/
+
+struct xbNodeLink { /* ndx node memory */
+ xbNodeLink * PrevNode;
+ xbNodeLink * NextNode;
+ xbUShort CurKeyNo; /* 0 - KeysPerNode-1 */
+ xbLong NodeNo;
+ struct NtxLeafNode Leaf;
+ xbUShort * offsets;
+};
+
+//! xbNtx class
+/*!
+*/
+
+class XBDLLEXPORT xbNtx : public xbIndex
+{
+protected:
+ NtxHeadNode HeadNode;
+ NtxLeafNode LeafNode;
+ xbLong NodeLinkCtr;
+ xbLong ReusedNodeLinks;
+ char Node[XB_NTX_NODE_SIZE];
+ xbNodeLink * NodeChain; /* pointer to node chain of index nodes */
+ xbNodeLink * FreeNodeChain; /* pointer to chain of free index nodes */
+ xbNodeLink * CurNode; /* pointer to current node */
+ xbNodeLink * DeleteChain; /* pointer to chain to delete */
+// xbNodeLink * CloneChain; /* pointer to node chain copy (add dup) */
+ NtxItem PushItem;
+
+/* private functions */
+ xbLong GetLeftNodeNo( xbShort, xbNodeLink * );
+ xbShort CompareKey( const char *, const char *, xbShort );
+ xbShort CompareKey( const char *, const char * );
+ xbLong GetDbfNo( xbShort, xbNodeLink * );
+ char * GetKeyData( xbShort, xbNodeLink * );
+ xbUShort GetItemOffset ( xbShort, xbNodeLink *, xbShort );
+ xbUShort InsertKeyOffset ( xbShort, xbNodeLink * );
+ xbUShort GetKeysPerNode();
+ virtual xbShort GetHeadNode();
+ xbShort GetLeafNode( xbLong, xbShort );
+ xbNodeLink * GetNodeMemory();
+ xbLong GetNextNodeNo();
+ void ReleaseNodeMemory(xbNodeLink *n, xbBool doFree = false);
+ xbULong GetLeafFromInteriorNode( const char *, xbShort );
+ xbShort CalcKeyLen();
+ xbShort PutKeyData( xbShort, xbNodeLink * );
+ xbShort PutLeftNodeNo( xbShort, xbNodeLink *, xbLong );
+ xbShort PutLeafNode( xbLong, xbNodeLink * );
+ xbShort PutHeadNode( NtxHeadNode *, FILE *, xbShort );
+ xbShort TouchIndex();
+ xbShort PutDbfNo( xbShort, xbNodeLink *, xbLong );
+ xbShort PutKeyInNode( xbNodeLink *, xbShort, xbLong, xbLong, xbShort );
+ xbShort SplitLeafNode( xbNodeLink *, xbNodeLink *, xbShort, xbLong );
+ xbShort SplitINode( xbNodeLink *, xbNodeLink *, xbLong );
+ xbShort AddToIxList();
+ xbShort RemoveFromIxList();
+ xbShort RemoveKeyFromNode( xbShort, xbNodeLink * );
+ xbShort DeleteKeyFromNode( xbShort, xbNodeLink * );
+ xbShort JoinSiblings(xbNodeLink *, xbShort, xbNodeLink *, xbNodeLink *);
+ xbUShort DeleteKeyOffset( xbShort, xbNodeLink *);
+ xbShort FindKey( const char *, xbShort, xbShort );
+ xbShort UpdateParentKey( xbNodeLink * );
+ xbShort GetFirstKey( xbShort );
+ xbShort GetNextKey( xbShort );
+ xbShort GetLastKey( xbLong, xbShort );
+ xbShort GetPrevKey( xbShort );
+ void UpdateDeleteList( xbNodeLink * );
+ void ProcessDeleteList();
+ xbShort FindKey( const char *, xbLong ); /* for a specific dbf no */
+
+public:
+ xbNtx();
+ xbNtx(xbDbf *);
+ virtual ~xbNtx();
+
+/* note to gak - don't uncomment next line - it causes seg faults */
+// ~NTX() { if( NtxStatus ) CloseIndex(); }
+
+ void DumpHdrNode ( xbShort Option );
+ void DumpNodeRec ( xbLong );
+ xbShort CreateIndex( const char *, const char *, xbShort, xbShort );
+ xbLong GetTotalNodes();
+ xbULong GetCurDbfRec() { return CurDbfRec; }
+ void DumpNodeChain();
+ xbShort CreateKey( xbShort, xbShort );
+ xbShort GetCurrentKey(char *key);
+ xbShort AddKey( xbLong );
+ xbShort UniqueIndex() { return HeadNode.Unique; }
+ xbShort DeleteKey( xbLong DbfRec );
+ xbShort KeyWasChanged();
+ xbShort FindKey( const char * );
+ xbShort FindKey();
+ xbShort FindKey( xbDouble );
+ xbShort GetNextKey() { return GetNextKey( 1 ); }
+ xbShort GetLastKey() { return GetLastKey( 0, 1 ); }
+ xbShort GetFirstKey() { return GetFirstKey( 1 ); }
+ xbShort GetPrevKey() { return GetPrevKey( 1 ); }
+ xbShort ReIndex(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0) ;
+ xbShort KeyExists( char * Key ) { return FindKey( Key, strlen( Key ), 0 ); }
+ xbShort KeyExists( xbDouble );
+ virtual void GetExpression(char *buf, int len);
+#ifdef XBASE_DEBUG
+ xbShort CheckIndexIntegrity( xbShort Option );
+#endif
+
+ virtual const char* GetExtWithDot(bool lower);
+
+ protected:
+ virtual xbUShort GetKeyLen();
+ virtual const char* GetKeyExpression();
+ virtual void FreeNodesMemory();
+};
+#endif /* __XB_NTX_H__ */
diff --git a/xbase64/xbretcod.h b/xbase64/xbretcod.h new file mode 100755 index 0000000..dd0748a --- /dev/null +++ b/xbase64/xbretcod.h @@ -0,0 +1,99 @@ +/* xbretcod.h + + Xbase64 project source code + + This file contains a listing of all the Xbase return codes. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +/*! \file xbretcod.h +*/ + +#ifndef __XB_RETCODES_H__ +#define __XB_RETCODES_H__ + +/***********************************************/ +/* Return Codes and Error Messages */ + +#define XB_NO_ERROR 0 +#define XB_EOF -100 +#define XB_BOF -101 +#define XB_NO_MEMORY -102 +#define XB_FILE_EXISTS -103 +#define XB_OPEN_ERROR -104 +#define XB_WRITE_ERROR -105 +#define XB_UNKNOWN_FIELD_TYPE -106 +#define XB_ALREADY_OPEN -107 +#define XB_NOT_XBASE -108 +#define XB_INVALID_RECORD -109 +#define XB_INVALID_OPTION -110 +#define XB_NOT_OPEN -111 +#define XB_SEEK_ERROR -112 +#define XB_READ_ERROR -113 +#define XB_NOT_FOUND -114 +#define XB_FOUND -115 +#define XB_INVALID_KEY -116 +#define XB_INVALID_NODELINK -117 +#define XB_KEY_NOT_UNIQUE -118 +#define XB_INVALID_KEY_EXPRESSION -119 +#define XB_DBF_FILE_NOT_OPEN -120 +#define XB_INVALID_KEY_TYPE -121 +#define XB_INVALID_NODE_NO -122 +#define XB_NODE_FULL -123 +#define XB_INVALID_FIELDNO -124 +#define XB_INVALID_DATA -125 +#define XB_NOT_LEAFNODE -126 +#define XB_LOCK_FAILED -127 +#define XB_CLOSE_ERROR -128 +#define XB_INVALID_SCHEMA -129 +#define XB_INVALID_NAME -130 +#define XB_INVALID_BLOCK_SIZE -131 +#define XB_INVALID_BLOCK_NO -132 +#define XB_NOT_MEMO_FIELD -133 +#define XB_NO_MEMO_DATA -134 +#define XB_EXP_SYNTAX_ERROR -135 +#define XB_PARSE_ERROR -136 +#define XB_NO_DATA -137 +#define XB_UNKNOWN_TOKEN_TYPE -138 +#define XB_INVALID_FIELD -140 +#define XB_INSUFFICIENT_PARMS -141 +#define XB_TOO_MANY_PARMS -142 +#define XB_INVALID_FUNCTION -143 +#define XB_INVALID_FIELD_LEN -144 +#define XB_HARVEST_NODE -145 +#define XB_INVALID_DATE -146 +#define XB_INVALID_LOCK_OPTION -147 +#endif /* __XB_RETCODES_H__ */ + diff --git a/xbase64/xbstring.cpp b/xbase64/xbstring.cpp new file mode 100755 index 0000000..419014f --- /dev/null +++ b/xbase64/xbstring.cpp @@ -0,0 +1,1041 @@ +/* xbstring.cpp + + Xbase64 project source code + + This file contains the xbString object methods + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifdef __GNU LesserG__ + #pragma implementation "xbstring.h" +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <xbase64/xbase64.h> + +#include <stdlib.h> +#include <stdio.h> + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +#ifdef STDC_HEADERS +#include <stdarg.h> +#endif + +#ifdef HAVE_CTYPE_H +#include <ctype.h> +#endif + +#include <xbase64/xbstring.h> +//#include <xbase64/xbexcept.h> + +//#define free(x) + +/*! \file xbstring.cpp +*/ + +const char * xbString::NullString = ""; + +//! Short description. +/*! +*/ +xbString::xbString() { + ctor(NULL); +} + +//! Short description. +/*! + \param size +*/ +xbString::xbString(size_t size) { + data = (char *)calloc(1, size); + this->size = size; +} + +//! Short description. +/*! + \param c +*/ +xbString::xbString(char c) { + ctor(NULL); + *this = c; +} + +//! Short description. +/*! + \param s +*/ +xbString::xbString(const char *s) { + ctor(s); +} + +//! Short description. +/*! + \param s +*/ +xbString::xbString(const xbString &s) { + ctor((const char *)s); +} + +//! Short description. +/*! + \param s + \param maxlen +*/ +xbString::xbString(const char *s, size_t maxlen) { +#if 0 + size_t len = strlen(s); + + if(len < maxlen) + maxlen = len; +#endif + + size = maxlen + 1; + data = (char *)calloc(1, size); + strncpy(data, s, maxlen); + data[maxlen] = 0; +} + +//! Short description. +/*! +*/ +xbString::~xbString() { + if (data != NULL) + free(data); +} + +//! Short description. +/*! + \param s +*/ +void xbString::ctor(const char *s) { + if (s == NULL) { + data = NULL; + size = 0; + return; + } + + size = strlen(s) + 1; + + data = (char *)calloc(1, size); + strcpy(data, s); +} + +//! Short description. +/*! + \param s + \param maxlen +*/ +void xbString::ctor(const char *s, size_t maxlen) { + + if (s == NULL) { + data = NULL; + size =0; + return; + } + size = maxlen + 1; + data = (char *)calloc(1, size); + strncpy(data, s, maxlen); + data[maxlen] = 0; +} + +//! Short description. +/*! +*/ +xbString &xbString::operator=(char c) { + if (data != NULL) + free(data); + + data = (char *)calloc(1, 2); + data[0] = c; + data[1] = 0; + + size = 2; + + return (*this); +} + +//! Short description. +/*! +*/ +xbString &xbString::operator=(const xbString &s) { + if (data != NULL) + free(data); + + const char *sd = s; + if (sd == NULL) { + data = NULL; + size = 0; + return (*this); + } + + data = (char *)calloc(1, strlen(s) + 1); + strcpy(data, s); + + size = strlen(data)+1; + + return (*this); +} + +//! Short description. +/*! +*/ +xbString &xbString::operator=(const char *s) { + if(data != NULL) + free(data); + + if(s == NULL) { + data = NULL; + size = 0; + return (*this); + } + data = (char *)calloc(1, strlen(s) + 1); + strcpy(data, s); + size = strlen(data) + 1; + return (*this); +} + +//! Short description. +/*! + \param size +*/ +void xbString::resize(size_t size) { + data = (char *)realloc(data, size); + if( size > 0 ) + data[size-1] = 0; + this->size = size; +} + +//! Short description. +/*! +*/ +xbBool xbString::isNull() const { + return( data == NULL ); +} + +//! Short description. +/*! +*/ +xbBool xbString::isEmpty() const { + if( data == NULL ) + return true; + if( data[0] == 0 ) + return true; + return false; +} + +//! Short description. +/*! +*/ +size_t xbString::len() const { + return( data ? strlen(data) : 0 ); +} + +//! Short description. +/*! +*/ +size_t xbString::length() const { + return len(); +} + +//! Short description. +/*! +*/ +xbString xbString::copy() const { + return( *this ); +} + +//! Short description. +/*! + \param format +*/ +xbString &xbString::sprintf(const char *format, ...) { + va_list ap; + va_start(ap, format); + + if (size < 256) + resize(256); // make string big enough + +#ifdef HAVE_VSNPRINTF + if (vsnprintf(data, size, format, ap) == -1) + data[size-1] = 0; +#else +# if HAVE_VSPRINTF + vsprintf(data, format, ap); +# else +# error "You have neither vsprintf nor vsnprintf!!!" +# endif +#endif + + resize(strlen(data)+1); // truncate + va_end(ap); + return (*this); +} + +//! Short description. +/*! +*/ +xbString::operator const char *() const { + return (data != NULL) ? data : NullString; +} + +//! Short description. +/*! +*/ +xbString &xbString::operator-=(const char *s) { + if( s == NULL ) return (*this); + int len = strlen(s); + int oldlen = this->len(); + + data = (char *)realloc(data, oldlen+len+1); + if( oldlen == 0 ) data[0] = 0; + + // looking for an occurence of space in the first string + char *lftspc = strchr(data,' '); + if( lftspc==NULL ) { // left string has no spaces + strcat(data,s); + } else { // left string has one or more spaces + int numspc = strlen(lftspc); + strcpy(lftspc,s); + while( numspc-- > 0 ) strcat(lftspc," "); + } + + size += len; + return (*this); +} + +//! Short description. +/*! +*/ +xbString &xbString::operator+=(const char *s) { + if (s == NULL) + return (*this); + int len = strlen(s); + int oldlen = this->len(); + + data = (char *)realloc(data, oldlen+len+1); + if (oldlen == 0) + data[0] = 0; + strcat(data, s); + + size += len; + return (*this); +} + +//! Short description. +/*! +*/ +xbString &xbString::operator+=(char c) { + int len = 1; + int oldlen = this->len(); + + data = (char *)realloc(data, oldlen+len+1); + data[oldlen] = c; + data[oldlen+1] = 0; + + size++; + + return (*this); +} + +//! Short description. +/*! +*/ +const char *xbString::getData() const { + return data ? data : NullString; +} + +//! Short description. +/*! +*/ +const char *xbString::c_str() const { + return data ? data : NullString; +} + +//! Short description. +/*! +*/ +void xbString::toLowerCase() { + int len = this->len(); + for (int i=0;i<len;i++) + data[i] = (char)tolower(data[i]); +} + + +//! Short description. +/*! +*/ +void xbString::toUpperCase() { + int len = this->len(); + for (int i=0;i<len;i++) + data[i] = (char)toupper(data[i]); +} + + +//! Short description. +/*! + \param c +*/ +int xbString::pos(char c) { + if (data == NULL) + return (-1); + + const char *p = strchr(data, c); + + if (p == NULL) + return (-1); + + return p-data; +} + +//! Short description. +/*! + \param s +*/ +int xbString::pos(const char* s) { + if (data == NULL) + return (-1); + + const char *p = strstr(data, s); + + if (p == NULL) + return (-1); + + return p-data; +} + +//! Short description. +/*! + \param num +*/ +void xbString::setNum(long num) { + sprintf("%ld", num); +} + +//! Short description. +/*! + \param fmt + \param num +*/ + +void xbString::setNum( char * fmt, double num) { + xbString f; + f = "%"; + f += fmt; + f += "f"; + sprintf( f.getData(), num); +} + + +//! Short description. +/*! +*/ +XBDLLEXPORT xbBool operator==(const xbString &s1, const char *s2) { + if (s2 == NULL) { + if (s1.getData() == NULL) + return true; + return false; + } + + if ((s2[0] == 0) && s1.getData() == NULL) + return true; + + if (s1.getData() == NULL) + return false; + + return (strcmp(s1, s2) == 0); +} + +//! Short description. +/*! +*/ +XBDLLEXPORT xbBool operator!=(const xbString &s1, const char *s2) { + if (s2 == NULL) { + if (s1.getData() == NULL) + return false; + return true; + } + + if ((s2[0] == 0) && s1.getData() == NULL) + return false; + + if (s1.getData() == NULL) + return true; + + return (strcmp(s1, s2) != 0); +} + +//! Short description. +/*! +*/ +xbBool xbString::operator==( const xbString &s2 ) const { + if( data == NULL || data[0] == 0 ) { + if( s2.data == NULL || s2.data[0] == 0 ) return true; // NULL == NULL + return false; // NULL == !NULL + } else { + if( s2.data == NULL || s2.data[0] == 0 ) return false; // !NULL == NULL + return strcmp(data,s2.data) == 0; //!NULL == !NULL + } +} + +//! Short description. +/*! +*/ +xbBool xbString::operator!=( const xbString &s2 ) const { + if( data == NULL || data[0] == 0 ) { + if( s2.data == NULL || s2.data[0] == 0 ) return false; // NULL != NULL + return true; // NULL != !NULL + } else { + if( s2.data == NULL || s2.data[0] == 0 ) return true; // !NULL != NULL + return strcmp(data,s2.data) != 0; //!NULL != !NULL + } +} + +//! Short description. +/*! +*/ +xbBool xbString::operator< ( const xbString &s2 ) const { + if( data == NULL || data[0] == 0 ) { + if( s2.data == NULL || s2.data[0] == 0 ) return false; // NULL < NULL + return true; // NULL < !NULL + } else { + if( s2.data == NULL || s2.data[0] == 0 ) return false; // !NULL < NULL + return strcmp(data,s2.data) < 0; //!NULL < !NULL + } +} + +//! Short description. +/*! +*/ +xbBool xbString::operator> ( const xbString &s2 ) const { + if( data == NULL || data[0] == 0 ) { + if( s2.data == NULL || s2.data[0] == 0 ) return false; // NULL > NULL + return false; // NULL > !NULL + } else { + if( s2.data == NULL || s2.data[0] == 0 ) return true; // !NULL > NULL + return strcmp(data,s2.data) > 0; //!NULL > !NULL + } +} + +//! Short description. +/*! +*/ +xbBool xbString::operator<=( const xbString &s2 ) const { + if( data == NULL || data[0] == 0 ) { + if( s2.data == NULL || s2.data[0] == 0 ) return true; // NULL <= NULL + return true; // NULL <= !NULL + } else { + if( s2.data == NULL || s2.data[0] == 0 ) return false; // !NULL <= NULL + return strcmp(data,s2.data) <= 0; //!NULL <= !NULL + } +} + +//! Short description. +/*! +*/ +xbBool xbString::operator>=( const xbString &s2 ) const { + if( data == NULL || data[0] == 0 ) { + if( s2.data == NULL || s2.data[0] == 0 ) return true; // NULL >= NULL + return false; // NULL >= !NULL + } else { + if( s2.data == NULL || s2.data[0] == 0 ) return true; // !NULL >= NULL + return strcmp(data,s2.data) >= 0; //!NULL >= !NULL + } +} + +//! Short description. +/*! +*/ +XBDLLEXPORT std::ostream& operator<< ( std::ostream& os, + const xbString& xbs ) { + return os << xbs.data; +} + +//! Short description. +/*! +*/ +XBDLLEXPORT xbString operator-(const xbString &s1, const xbString &s2) { + xbString tmp(s1.getData()); + tmp -= s2; + return tmp; +} + +//! Short description. +/*! +*/ +XBDLLEXPORT xbString operator+(const xbString &s1, const xbString &s2) { + xbString tmp(s1.getData()); + tmp += s2; + return tmp; +} + +//! Short description. +/*! +*/ +XBDLLEXPORT xbString operator+(const xbString &s1, const char *s2) { + xbString tmp(s1.getData()); + tmp += s2; + return tmp; +} + +//! Short description. +/*! +*/ +XBDLLEXPORT xbString operator+(const char *s1, const xbString &s2) { + xbString tmp(s1); + tmp += s2; + return tmp; +} + +//! Short description. +/*! +*/ +XBDLLEXPORT xbString operator+(const xbString &s1, char c2) { + xbString tmp(s1.getData()); + tmp += c2; + return tmp; +} + +//! Short description. +/*! +*/ +XBDLLEXPORT xbString operator+(char c1, const xbString &s2) { + xbString tmp(c1); + tmp += s2; + return tmp; +} + +//! Short description. +/*! + \param pos + \param c +*/ +void xbString::putAt(size_t pos, char c) { + if (pos>len()) + return; + + data[pos] = c; +} + +//! Short description. +/*! + \param str + \param pos + \param n +*/ +xbString& xbString::assign(const xbString& str, size_t pos, int n) +{ + if(data){ + free(data); + data = 0; + } + + if(str.len() <= pos){ + size = 0; + return (*this); + } + + if(str.len() < pos + n){ + n = str.len() - pos; + } + + const char *d = str; + + if (n == -1){ +// data = (char *)malloc(str.len()-pos+1); ms win/nt bug fix + data = (char *)calloc(str.len()-pos+1, sizeof( char )); + strcpy(data, d+pos); + size = str.len()-pos+1; + } + else + { +// data = (char *)malloc(n); ms win/nt bug fix +// boundschecker flags the next line as a memory leak +// but this is a valid memory allocation + data = (char *)calloc(n + 1, sizeof(char)); + strncpy(data, d + pos, n); + data[n] = '\0'; + size = n + 1; + } + + return (*this); +} + +//! Short description. +/*! + \param str + \param n +*/ +xbString& xbString::assign(char* str, int n) +{ + if(data) + { + free(data); + data = 0; + } + + data = (char *)calloc(n + 1, sizeof(char)); + strncpy(data, str, n); + data[n] = 0; + size = n + 1; + + return (*this); +} + +//! Short description. +/*! +*/ +void xbString::trim() { + int l = len()-1; + + for (;;) { + if (data[l] != ' ') + break; + data[l] = 0; + if (l == 0) + break; + l--; + } +} + +//! Short description. +/*! + \param pos + \param n +*/ +xbString &xbString::remove(size_t pos, int n) { + if (data == NULL) + return (*this); + if (data[0] == 0) + return (*this); + + size_t l = len(); + + if (pos>l) + return (*this); + if (n == 0) + return (*this); + if (n > int(l-pos)) + n = l-pos; + if (n<0) + n = l-pos; + memcpy(data+pos, data+pos+n, l-pos-n+1); + + return (*this); +} + +//! Short description. +/*! + \param pos + \param n +*/ +xbString xbString::mid(size_t pos, int n) const { + if (data == NULL) + return (*this); + if (data[0] == 0) + return (*this); + + size_t l = len(); + + if (pos>l) + return (*this); + if (n == 0) + return (*this); + if (n > int(l-pos)) + n = l-pos; + if (n<0) + n = l-pos; + + xbString s; + s.data = (char *)malloc(n+1); + strncpy(s.data, data+pos, n); + s.data[n] = 0; + + return s; +} + +//! Short description. +/*! + \param from + \param to +*/ +void xbString::swapChars( char from, char to ) +{ + size_t i; + for( i = 0; i < size; i++ ) + if( data[i] == from ) + data[i] = to; +} + +//! Short description. +/*! + \param c +*/ +void xbString::zapChar( char c ) +{ + /* routine zaps every occurrence of a given character from the string */ + int p; + size_t s; + p = pos( c ); + while( p != -1 ){ + for( s = (size_t) p; s < size; s++ ) + putAt( s, data[s+1]); + resize( size-1 ); + p = pos( c ); + } +} + +//! Short description. +/*! + \param c +*/ +int xbString::countChar( char c ) const +{ + int i,j; + + for( i = 0,j = 0; i < (int) size; i++ ) + if( data[i] == c ) + j++; + + return j; +} + + +//! Short description. +/*! + \param c +*/ + +void xbString::addBackSlash( char c ) +{ + /* prefixes all char "c" with a backslash */ + int i, t, cnt; + xbString ws; + + cnt = countChar( c ); + if( !cnt ) + return; + + ws.resize( size+cnt ); + for( i = 0, t = 0; i < (int)size; i++ ){ + if( data[i] == c ) + ws.putAt( t++, '\\' ); + ws.putAt( t++, data[i] ); + } + ws.putAt( t, 0 ); + *this = ws.getData(); +} + +//! Short description. +/*! + \param cnt +*/ +void xbString::lTrunc( size_t cnt ) +{ + /* left truncate cnt butes */ + + char * ndata; + char * p; + if( cnt >= size ){ + ctor(0); + return; + } + ndata = (char *) malloc( size - cnt ); + p = data; + p += cnt; + strcpy( ndata, p ); + free( data ); + data = ndata; + size = size - cnt; +} + + +//! Short description. +/*! + \param c +*/ +void xbString::zapLeadingChar( char c ) +{ + /* left truncate all of character c */ + + int len = 0; + char *p; + p = data; + while( *p && *p == c ){ + len++; + p++; + } + if( len ) + lTrunc( len ); +} + + +//! Short description. +/*! +*/ +xbBool xbString::hasAlphaChars() const +{ + for( int i = 0; i < (int) size; i++ ) + if( isalpha( data[i] )) + return 1; + return 0; +} + + +//! Short description. +/*! + \param out +*/ + +int xbString::cvtHexChar( char & out ) +{ + /* this routine converts a four byte string in the format of 0x00 + to a one byte char value + + the first four bytes of the string must be in the format 0x00 + anything past the first four bytes is disregarded + + returns -1 on error + 0 on success + */ + + int j, k; + char c; + + if( len() < 4 || data[0] != '0' || (data[1]!='X' && data[1]!='x' )) + return -1; + + c = toupper( data[2] ); + j = ( c > '9' ? c - 'A' + 10 : c - '0' ); + c = toupper( data[3] ); + k = ( c > '9' ? c - 'A' + 10 : c - '0' ); + j = ( j << 4 ) + k; + + out = ( char ) j; + return 0; +} + +//! Short description. +/*! + \param out +*/ +int xbString::cvtHexString( xbString & out ) +{ + /* this routine converts a string of four byte format of 0x00 + to a string of one byte chars + + returns -1 on error + 0 on success + */ + + char c; + xbString ws; + ws = data; + out = ""; + while( ws.len()){ + if( ws.cvtHexChar( c )) + return -1; + out += c; + ws.lTrunc( 4 ); + } + return 0; +} +//! Short description. +/*! + \param src + \param delim + \param skipcnt + \param opt +*/ +int xbString::setFromDelimitedInput( const char * src, + char delim, int skipcnt, int opt ) +{ + /* opt values + + 1 - ignore delimiters between quotes + 2 - treat crlf characters as delimters + 3 - both options 1 and 2 + */ + + int len; + int curpos = 0; + int quotesw = 0; + const char * s; + const char * anchor; + + /* skip past skipcnt delimiters */ + s = src; + while( *s && curpos < skipcnt ){ + if( *s == delim && !quotesw ) + curpos++; + else if (( opt == 1 || opt == 3 ) && *s == '"' ) + quotesw = (quotesw) ? 0 : 1; + s++; + } + /* at the beginning of the field */ + anchor = s; + while( *s && ( *s != delim || ( *s == delim && quotesw ))){ + if( *s == '"' ) + quotesw = (quotesw) ? 0 : 1; + s++; + } + len = s - anchor; + + /* copy data */ + data = (char *) realloc( data, len+1 ); + memcpy( data, anchor, len ); + data[len] = 0; + this->size = len+1; + + if( opt == 2 || opt == 3 ){ + zapChar( 0x0a ); + zapChar( 0x0c ); + zapChar( 0x0d ); + } + + return len; +} + diff --git a/xbase64/xbstring.h b/xbase64/xbstring.h new file mode 100755 index 0000000..9896cdc --- /dev/null +++ b/xbase64/xbstring.h @@ -0,0 +1,145 @@ +/* xbstring.h + + Xbase64 project source code + + This file contains the Class definition for a xbString object. + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifndef __XBSTRING_H__ +#define __XBSTRING_H__ + +#ifdef __GNU LesserG__ +#pragma interface +#endif + +#ifdef __WIN32__ +#include <xbase64/xbwincfg.h> +#else +#include <xbase64/xbconfig.h> +#endif + +#include <stdlib.h> +#include <iostream> + +/*! \file xbstring.h +*/ + +//! xbString class +/*! +*/ +class XBDLLEXPORT xbString { +public: + enum {npos = -1}; + + xbString(); + xbString(size_t size); + xbString(char c); + xbString(const char *s); + xbString(const char *s, size_t maxlen); + xbString(const xbString &s); + virtual ~xbString(); + + operator const char *() const; + char operator[](int n) { return data[n]; } + + xbString &operator=(const xbString &s); + xbString &operator=(const char *s); + xbString &operator=(char c); + xbString &operator+=(const char *s); + xbString &operator+=(char c); + xbString &operator-=(const char *s); + + xbBool operator == ( const xbString& ) const; + xbBool operator != ( const xbString& ) const; + xbBool operator < ( const xbString& ) const; + xbBool operator > ( const xbString& ) const; + xbBool operator <= ( const xbString& ) const; + xbBool operator >= ( const xbString& ) const; + + friend XBDLLEXPORT std::ostream& operator << ( std::ostream&, + const xbString& ); + void addBackSlash( char c ); + xbString &assign(const xbString& str, size_t pos = 0, int n = npos); + xbString &assign(char* str, int n); + xbString copy() const; + const char *c_str() const; + int countChar( char c ) const; + int cvtHexChar( char & out ); + int cvtHexString( xbString & out ); + char getCharacter( int n ) const { return data[n]; } + const char *getData() const; + xbBool hasAlphaChars() const; + xbBool isEmpty() const; + xbBool isNull() const; + size_t len() const; + size_t length() const; + xbString mid(size_t pos = 0, int n = npos) const; + void lTrunc( size_t cnt ); + int pos(char c); + int pos(const char* s); + void putAt(size_t pos, char c); + xbString &remove(size_t pos = 0, int n = npos); + void resize(size_t size); + void setNum(long num); + void setNum(char * fmt, double num); + xbString &sprintf(const char *format, ...); + void swapChars( char from, char to ); + void toLowerCase(); + void toUpperCase(); + void trim(); + void zapChar( char c ); + void zapLeadingChar( char c ); + int setFromDelimitedInput(const char *,char, int, int ); + +protected: + void ctor(const char *s); + void ctor(const char *s, size_t maxlen); + char *data; + size_t size; + static const char * NullString; +}; + +XBDLLEXPORT xbString operator-(const xbString &s1, const xbString &s2); +XBDLLEXPORT xbString operator+(const xbString &s1, const xbString &s2); +XBDLLEXPORT xbString operator+(const xbString &s1, const char *s2); +XBDLLEXPORT xbString operator+(const char *s1, const xbString &s2); +XBDLLEXPORT xbString operator+(const xbString &s1, char c2); +XBDLLEXPORT xbString operator+(char c1, const xbString &s2); +XBDLLEXPORT xbBool operator==(const xbString &s1, const char *s2); +XBDLLEXPORT xbBool operator!=(const xbString &s1, const char *s2); + +#endif + diff --git a/xbase64/xbtypes.h b/xbase64/xbtypes.h new file mode 100755 index 0000000..de5f08c --- /dev/null +++ b/xbase64/xbtypes.h @@ -0,0 +1,99 @@ +/* xbtypes.h + + Xbase64 project source code + + Copyright (C) 1997,2003 Gary A Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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 + + + Contact: + + Email: + + xdb-devel@lists.sourceforge.net + xdb-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#ifndef __XB_XTYPES_H__ +#define __XB_XTYPES_H__ + +#include <stdio.h> + +/*! \file xbtypes.h +*/ + +//! xbULong type +/*! +*/ +typedef unsigned long int xbULong; + +//! xbUShort type +/*! +*/ +typedef unsigned short int xbUShort; + +//! xbShort type +/*! +*/ +typedef short int xbShort; +typedef long xbLong; + + +//! xbFloat type +/*! +*/ +typedef float xbFloat; + + +//! xbDouble type +/*! +*/ +typedef double xbDouble; + +//! xbBool type +/*! +*/ +typedef short int xbBool; + +//! xbOffT type +/*! +*/ +#ifdef XB_LOCKING_ON +#ifdef __WIN32__ +#else +#endif +#endif // XB_LOCKING_ON +#endif // __XB_XTYPES_H__ + +// 64 bit file processing +#if defined(HAVE_FSEEKO) && defined(HAVE_FTELLO) && defined(XB_LARGEFILE_SUPPORT) + #define _ftell ftello + #define _fseek fseeko + typedef off_t xbOffT; +#else + #define _ftell ftell + #define _fseek fseek + typedef long xbOffT; +#endif diff --git a/xbase64/xbwincfg.h b/xbase64/xbwincfg.h new file mode 100755 index 0000000..df2d187 --- /dev/null +++ b/xbase64/xbwincfg.h @@ -0,0 +1,82 @@ +/* config file for windows environments */ + +/* Name of package */ +#define PACKAGE "xbase64" + +/* Version number of package */ +#define VERSION "3.1.2" + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you have io.h */ +#define HAVE_IO_H 1 + +/* Define if you need to have .ndx indexes */ +#define XB_INDEX_NDX 1 + +/* Define if you need to have .ntx indexes */ +#define XB_INDEX_NTX 1 + +/* Define if you need to have .cdx indexes */ +#define XB_INDEX_CDX 1 + +/* Define if you need to support memo fields */ +#define XB_MEMO_FIELDS 1 + +/* Define if you need expressions */ +#define XB_EXPRESSIONS 1 + +/* Define if you need locking support */ +#undef XB_LOCKING_ON + +/* Define if you need to turn on XBase specific debug */ +#define XBASE_DEBUG 1 + +/* Define if using real deletes */ +#define XB_REAL_DELETE 1 + +/* Define if need filters */ +#define XB_FILTERS 1 + +/* Define if you have the fcntl function. */ +#define HAVE_FCNTL 1 + +/* Define if you have the vsnprintf function. */ +//#define HAVE_VSNPRINTF 1 + +/* Define if you have the vsprintf function. */ +#define HAVE_VSPRINTF 1 + +/* Define if you have the <ctype.h> header file. */ +#define HAVE_CTYPE_H 1 + +/* Define if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Should we include generic index support? */ +#if defined(XB_INDEX_NDX) || defined(XB_INDEX_NTX) +#define XB_INDEX_ANY 1 +#endif + +/* expressions required for indexes */ +#if defined(XB_INDEX_ANY) && !defined(XB_EXPRESSIONS) +#define XB_EXPRESSIONS 1 +#endif + +/* default memo block size */ +#define XB_DBT_BLOCK_SIZE 512 + +/* filename path separator */ +#define PATH_SEPARATOR '/' + +/* MS uses WIN32, Borland uses __WIN32__ */ +#ifdef WIN32 + #ifndef __WIN32__ + #define __WIN32__ + #endif +#endif + |