stimfit-0.16.0/0000775000175000017500000000000013567226445010276 500000000000000stimfit-0.16.0/install-sh0000755000175000017500000003546313567226345012232 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2014-09-12.12; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) # $RANDOM is not portable (e.g. dash); use it when possible to # lower collision chance tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # As "mkdir -p" follows symlinks and we work in /tmp possibly; so # create the $tmpdir first (and fail if unsuccessful) to make sure # that nobody tries to guess the $tmpdir name. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: stimfit-0.16.0/aclocal.m40000664000175000017500000014653413567226343012070 00000000000000# generated automatically by aclocal 1.15.1 -*- Autoconf -*- # Copyright (C) 1996-2017 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. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- dnl serial 11 (pkg-config-0.29.1) dnl dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29.1]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR # Copyright (C) 2002-2017 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. # 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. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.15.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.15.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2017 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2017 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. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl 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])]) # Copyright (C) 1999-2017 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. # 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", "OBJC", "OBJCXX", "UPC", or "GJC". # 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 m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$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". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # 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. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; 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 ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2017 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. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf 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. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; 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"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2017 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 macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])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]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2017 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. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2017 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. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2017 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. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2017 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. # 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 is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2017 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. # _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], [m4_foreach_w([_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])]) # Copyright (C) 1999-2017 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. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2017 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. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2017 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. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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 if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done 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]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2017 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. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2017 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. # AM_PROG_INSTALL_STRIP # --------------------- # 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="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2017 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. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2017 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. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/acsite.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) stimfit-0.16.0/README0000664000175000017500000000000013277303534011055 00000000000000stimfit-0.16.0/COPYING0000664000175000017500000004313113277303516011244 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. stimfit-0.16.0/configure0000775000175000017500000233477613567226344012151 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for stimfit 0.16.0. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= 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 IFS=$as_save_IFS ;; 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 $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # 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 as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # 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 sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='stimfit' PACKAGE_TARNAME='stimfit' PACKAGE_VERSION='0.16.0' PACKAGE_STRING='stimfit 0.16.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="src/stimfit/gui/main.cpp" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS GT_LDFLAGS GT_LIBS GT_CXXFLAGS GT_CPPFLAGS OPT_CXXFLAGS LIBHDF5_LDFLAGS HDF5_LIBS HDF5_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG MACSETFILE POSTLINK_COMMAND SETFILE REZ WX_CXXFLAGS WX_CPPFLAGS WX_LIBS LIBLAPACK_LDFLAGS LIBBIOSIG_LDFLAGS WITH_BIOSIGLITE_FALSE WITH_BIOSIGLITE_TRUE WITH_BIOSIG2_FALSE WITH_BIOSIG2_TRUE WITH_BIOSIG_FALSE WITH_BIOSIG_TRUE STFIO_PYTHON_LIBNAME STF_PYTHON_LIBNAME LIBSTF_LDFLAGS LIBWXPYTHON_INCLUDES LIBNUMPY_INCLUDES LIBPYTHON_INCLUDES LIBPYTHON_LDFLAGS SWIG_PYTHON_CPPFLAGS SWIG_PYTHON_OPT SWIG_LIB SWIG PYTHON_EXTRA_LDFLAGS PYTHON_EXTRA_LIBS PYTHON_WXPYTHON_INCLUDE PYTHON_NUMPY_INCLUDE PYTHON_DIST_PKG PYTHON_PRE_DIST_PKG PYTHON_SITE_PKG PY_AC_VERSION PYTHON_LDFLAGS PYTHON_CPPFLAGS PYTHON PYTHON_VERSION BUILD_PYTHON_FALSE BUILD_PYTHON_TRUE ISDARWIN_FALSE ISDARWIN_TRUE BUILD_DEBIAN_FALSE BUILD_DEBIAN_TRUE BUILD_MODULE_FALSE BUILD_MODULE_TRUE CXXCPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_module enable_debian enable_python enable_ipython with_pslope with_biosig with_biosig2 with_biosiglite with_lapack_lib enable_aui with_wx_config with_hdf5_prefix enable_debug ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CPP CXX CXXFLAGS CCC CXXCPP PYTHON_VERSION PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR HDF5_CFLAGS HDF5_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= 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 case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -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) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$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 ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) 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 ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=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 ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_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'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" 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 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 ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # 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 the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | 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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # 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 stimfit 0.16.0 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 \`..'] 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] --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] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/stimfit] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _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 stimfit 0.16.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --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) --enable-module build a standalone python module; implies --enable-python --enable-debian special build for pbuilder --enable-python enable python console (default="yes") --enable-ipython enable ipython as the default shell (experimental); implies --enable-python --enable-aui enable AUI for the doc/view architecture (experimental) --enable-debug build stimfit in debug mode Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-pslope include slope measure cursors --with-biosig build with libbiosig support --with-biosig2 equivalent to --with-biosig --with-biosiglite use builtin biosig library --with-lapack-lib=LAPACKLIB Provide full path to custom lapack library --with-wx-config=FILE Use the given path to wx-config when determining wxWidgets configuration; defaults to "wx-config" --with-hdf5-prefix=HDF5_PREFIX Provide full path to hdf5 prefix Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor PYTHON_VERSION The installed Python version to use, for example '2.3'. This string will be appended to the Python interpreter canonical name. PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path HDF5_CFLAGS C compiler flags for HDF5, overriding pkg-config HDF5_LIBS linker flags for HDF5, overriding pkg-config 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 the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested 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 else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF stimfit configure 0.16.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 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 fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* 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_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by stimfit $as_me 0.16.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { 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` /usr/bin/hostinfo = `(/usr/bin/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=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > 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 cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } 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. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_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 $ac_precious_vars; 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,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_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 # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_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. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.15' 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 as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_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 rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir 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. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$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' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file 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 $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='stimfit' VERSION='0.16.0' 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"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_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" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" 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 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-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='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&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". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # 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. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; 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 ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi enable_dlopen=yes case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. 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' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST 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_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&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. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname 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 yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs 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 variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_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 # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) 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 ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&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 # that responds to the $file_magic_cmd with a given extended 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 aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) 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*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) 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|DragonFly)/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 ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) 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_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' 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 ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) 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 ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&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]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$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=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && 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 $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_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 -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST 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_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else 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 fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; 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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h 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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_win32_dll=no # Check whether --enable-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. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi # Check whether --enable-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. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-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. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF 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 set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs 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 <<_LT_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 _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs 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 <<_LT_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 _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC 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 # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # 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_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # 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). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # 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_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && 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 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && 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 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # 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 extended regexp 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_|_GLOBAL__F[ID]_.*' # 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. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # 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 yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, 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 install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) 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 ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach 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* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) 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 $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_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. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' 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 ;; 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 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $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 no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= 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 yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; 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 # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : 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' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; 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' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; 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 $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) 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 ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # 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. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''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' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=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* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi link_all_deplibs=no else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd* | netbsdelf*-gnu) 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 ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; 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" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$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='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' 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' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; 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) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) 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 ;; esac 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' ;; 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*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$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=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so 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" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' 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 # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # 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$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) 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=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $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' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$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" # 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* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # 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 library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' 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. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") 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" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # 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 dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # 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 # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # 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' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_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$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$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 # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' 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 ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$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$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=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 ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; 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 ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; 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 <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #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 /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 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; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 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_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; 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 <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #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 /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 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; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 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_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$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 striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&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" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } 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 CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi ac_ext=cpp 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 -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$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 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= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&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". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_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 am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # 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. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; 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 ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi func_stripname_cnf () { case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; esac } # func_stripname_cnf if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then ac_ext=cpp 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } 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 else _lt_caught_CXX_error=yes fi ac_ext=cpp 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 archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC func_cc_basename $compiler cc_basename=$func_cc_basename_result if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&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. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname 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 yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs 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 variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test ia64 = "$host_cpu"; 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=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_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec_CXX='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. no_undefined_flag_CXX='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' $wl-bernotok' allow_undefined_flag_CXX=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='$wl--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi else ld_shlibs_CXX=no fi ;; os2*) hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_minus_L_CXX=yes allow_undefined_flag_CXX=unsupported shrext_cmds=.dll archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='$wl-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='$wl-E' whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then no_undefined_flag_CXX=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='$wl-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='$wl-z,text' allow_undefined_flag_CXX='$wl-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX LD_CXX=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX=$prev$p else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX=$prev$p else postdeps_CXX="${postdeps_CXX} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$predep_objects_CXX"; then predep_objects_CXX=$p else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX=$p else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi lt_prog_compiler_pic_CXX='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # 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_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # 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). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static_CXX='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # 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_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && 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 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && 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 $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds_CXX 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so 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" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' 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 # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # 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$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) 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=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $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' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$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" # 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* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # 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 library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' 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. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") 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" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # 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 dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec_CXX='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # 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 # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # 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' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_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$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$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 # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' 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 ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$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$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=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 ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test yes = "$hardcode_automatic_CXX"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct_CXX" && # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && test no != "$hardcode_minus_L_CXX"; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" 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 # BUILDDATE=`date` # Build a standalone python module # Check whether --enable-module was given. if test "${enable_module+set}" = set; then : enableval=$enable_module; fi if test "$enable_module" = "yes"; then BUILD_MODULE_TRUE= BUILD_MODULE_FALSE='#' else BUILD_MODULE_TRUE='#' BUILD_MODULE_FALSE= fi # pbuilder debian package build # Check whether --enable-debian was given. if test "${enable_debian+set}" = set; then : enableval=$enable_debian; fi if test "$enable_debian" = "yes"; then BUILD_DEBIAN_TRUE= BUILD_DEBIAN_FALSE='#' else BUILD_DEBIAN_TRUE='#' BUILD_DEBIAN_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kernel" >&5 $as_echo_n "checking for kernel... " >&6; } case `uname` in Darwin) { $as_echo "$as_me:${as_lineno-$LINENO}: result: darwin" >&5 $as_echo "darwin" >&6; } CXXFLAGS="${CXXFLAGS} -fPIC" CFLAGS="${CFLAGS} -fPIC" STFKERNEL="darwin" ;; *) # treat everything else (kfreebsd, hurd) as linux { $as_echo "$as_me:${as_lineno-$LINENO}: result: linux or similar" >&5 $as_echo "linux or similar" >&6; } CXXFLAGS="-fPIC" CFLAGS="-fPIC" STFKERNEL="linux" ;; esac if test $STFKERNEL = "darwin"; then ISDARWIN_TRUE= ISDARWIN_FALSE='#' else ISDARWIN_TRUE='#' ISDARWIN_FALSE= fi # Checks for python libraries. # Check whether --enable-python was given. if test "${enable_python+set}" = set; then : enableval=$enable_python; else enable_python="yes" fi if test "$enable_python" = "yes"; then BUILD_PYTHON_TRUE= BUILD_PYTHON_FALSE='#' else BUILD_PYTHON_TRUE='#' BUILD_PYTHON_FALSE= fi if (test "$enable_python" = "yes") || (test "$enable_module" = "yes"); then # # Allow the use of a (user set) custom python version # # Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args. set dummy python$PYTHON_VERSION; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$PYTHON"; then as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5 PYTHON_VERSION="" fi # # Check for a version of Python >= 2.1.0 # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5 $as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; } ac_supports_python_ver=`$PYTHON -c "import sys, string; \ ver = sys.version.split()[0]; \ print(ver >= '2.1.0')"` if test "$ac_supports_python_ver" != "True"; then if test -z "$PYTHON_NOVERSIONCHECK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? " This version of the AC_PYTHON_DEVEL macro doesn't work properly with versions of Python before 2.1.0. You may need to re-run configure, setting the variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. Moreover, to disable this check, set PYTHON_NOVERSIONCHECK to something else than an empty string. See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5 $as_echo "skip at user request" >&6; } fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi # # if the macro parameter ``version'' is set, honour it # if test -n ""; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python " >&5 $as_echo_n "checking for a version of Python ... " >&6; } ac_supports_python_ver=`$PYTHON -c "import sys, string; \ ver = sys.version.split()[0]; \ sys.stdout.write(ver + '' + '\n')"` if test "$ac_supports_python_ver" = "True"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "this package requires Python . If you have it installed, but it isn't the default Python interpreter in your system path, please pass the PYTHON_VERSION variable to configure. See \`\`configure --help'' for reference. " "$LINENO" 5 PYTHON_VERSION="" fi fi # # Check if you have distutils, else fail # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` if test -z "$ac_distutils_result"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "cannot import Python module \"distutils\". Please check your Python installation. The error was: $ac_distutils_result" "$LINENO" 5 PYTHON_VERSION="" fi # # Check for Python include path # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5 $as_echo_n "checking for Python include path... " >&6; } if test -z "$PYTHON_CPPFLAGS"; then python_path=`$PYTHON -c "import distutils.sysconfig, sys; \ sys.stdout.write(distutils.sysconfig.get_python_inc() + '\n');"` if test -n "${python_path}"; then python_path="-I$python_path" fi PYTHON_CPPFLAGS=$python_path fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5 $as_echo "$PYTHON_CPPFLAGS" >&6; } # # Check for Python library path # # # Check for Python library path # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5 $as_echo_n "checking for Python library path... " >&6; } if test -z "$PYTHON_LDFLAGS"; then # (makes two attempts to ensure we've got a version number # from the interpreter) py_version=`$PYTHON -c \ "import sys; from distutils.sysconfig import * if get_config_vars('LDVERSION')[0] is None: sys.stdout.write(' '.join(get_config_vars('VERSION'))+'\n') else: sys.stdout.write(' '.join(get_config_vars('LDVERSION'))+'\n')"` if test "$py_version" == "None"; then if test -n "$PYTHON_VERSION"; then py_version=$PYTHON_VERSION else py_version=`$PYTHON -c "import sys; \ sys.stdout.write(sys.version[:3] + '\n')"` fi fi PY_AC_VERSION=$py_version PYTHON_LDFLAGS=`$PYTHON -c "import sys; from distutils.sysconfig import *; \ sys.stdout.write('-L' + get_config_vars()['LIBDIR'] + \ ' -lpython' + '\n');"`$py_version fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LDFLAGS" >&5 $as_echo "$PYTHON_LDFLAGS" >&6; } # # Check for prefixed site packages # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prefixed Python site-packages path" >&5 $as_echo_n "checking for prefixed Python site-packages path... " >&6; } if test -z "$PYTHON_SITE_PKG"; then PYTHON_SITE_PKG=`$PYTHON -c \ "import sys, distutils.sysconfig; \ acprefix = \"${prefix}\" if acprefix is \"NONE\": acprefix=\"/usr/local/\" sys.stdout.write(distutils.sysconfig.get_python_lib(0,1,prefix=acprefix)+'\n');"` PYTHON_SITE_PKG="${PYTHON_SITE_PKG}/dist-packages" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5 $as_echo "$PYTHON_SITE_PKG" >&6; } # # Check for prefixed dist packages # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prefixed Python dist-packages path" >&5 $as_echo_n "checking for prefixed Python dist-packages path... " >&6; } if test -z "$PYTHON_PRE_DIST_PKG"; then PYTHON_PRE_DIST_PKG=`$PYTHON -c \ "import sys, distutils.sysconfig; \ acprefix = \"${prefix}\" if acprefix is \"NONE\": acprefix=\"/usr/local/\" sys.stdout.write(distutils.sysconfig.get_python_lib(0,0,prefix=acprefix)+'\n');"` PYTHON_PRE_DIST_PKG=${PYTHON_PRE_DIST_PKG} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_PRE_DIST_PKG" >&5 $as_echo "$PYTHON_PRE_DIST_PKG" >&6; } # # Check for unprefixed dist packages path # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unprefixed Python dist-packages path" >&5 $as_echo_n "checking for unprefixed Python dist-packages path... " >&6; } if test -z "$PYTHON_DIST_PKG"; then PYTHON_DIST_PKG=`$PYTHON -c \ "import sys, distutils.sysconfig; \ sys.stdout.write(distutils.sysconfig.get_python_lib(0,0)+'\n');"` PYTHON_DIST_PKG=${PYTHON_DIST_PKG} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_DIST_PKG" >&5 $as_echo "$PYTHON_DIST_PKG" >&6; } # # Check if you have numpy, else fail # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for numpy" >&5 $as_echo_n "checking for numpy... " >&6; } ac_numpy_result=`$PYTHON -c "import numpy" 2>&1` if test -z "$ac_numpy_result"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "cannot import Python module \"numpy\". Please check your numpy installation. The error was: $ac_numpy_result" "$LINENO" 5 PYTHON_VERSION="" fi # # Check for numpy headers # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for numpy include path" >&5 $as_echo_n "checking for numpy include path... " >&6; } if test -z "$PYTHON_NUMPY_INCLUDE"; then PYTHON_NUMPY_INCLUDE=-I`$PYTHON -c "import sys, numpy; \ sys.stdout.write(numpy.lib.get_include() + '\n');"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_NUMPY_INCLUDE" >&5 $as_echo "$PYTHON_NUMPY_INCLUDE" >&6; } # # Check if you have wxPython, else fail # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wxPython" >&5 $as_echo_n "checking for wxPython... " >&6; } ac_wxpython_result=`$PYTHON -c "import wx" 2>&1` if test -z "$ac_wxpython_result"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "cannot import Python module \"wxpython\". Please check your wxpython installation. The error was: $ac_wxpython_result" "$LINENO" 5 PYTHON_VERSION="" fi # # Check for wxpython headers # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wxpython include path" >&5 $as_echo_n "checking for wxpython include path... " >&6; } if test -z "$PYTHON_WXPYTHON_INCLUDE"; then PYTHON_WXPYTHON_INCLUDE=-I`$PYTHON -c "import os, sys, wx; \ sys.stdout.write(os.path.join(os.path.dirname(wx.__spec__.origin), 'include') + '\n');"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_WXPYTHON_INCLUDE" >&5 $as_echo "$PYTHON_WXPYTHON_INCLUDE" >&6; } # # libraries which must be linked in when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5 $as_echo_n "checking python extra libraries... " >&6; } if test -z "$PYTHON_EXTRA_LIBS"; then PYTHON_EXTRA_LIBS=`$PYTHON -c "import sys, distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ sys.stdout.write(conf('LOCALMODLIBS') + ' ' + conf('LIBS') + ' ' + '\n')"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5 $as_echo "$PYTHON_EXTRA_LIBS" >&6; } # # linking flags needed when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5 $as_echo_n "checking python extra linking flags... " >&6; } if test -z "$PYTHON_EXTRA_LDFLAGS"; then PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import sys, distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ sys.stdout.write(conf('LINKFORSHARED')+'\n')"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5 $as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; } # # final check to see if everything compiles alright # { $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5 $as_echo_n "checking consistency of all components of python development environment... " >&6; } 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 # save current global flags LIBS="$ac_save_LIBS $PYTHON_LDFLAGS -lm" CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { Py_Initialize(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : pythonexists=yes else pythonexists=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5 $as_echo "$pythonexists" >&6; } if test ! "$pythonexists" = "yes"; then as_fn_error $? " Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable. Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\" ============================================================================ ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================ " "$LINENO" 5 PYTHON_VERSION="" 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 # turn back to default flags CPPFLAGS="$ac_save_CPPFLAGS" LIBS="$ac_save_LIBS" # # all done! # # Extract the first word of "swig", so it can be a program name with args. set dummy swig; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_SWIG+:} false; then : $as_echo_n "(cached) " >&6 else case $SWIG in [\\/]* | ?:[\\/]*) ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path. ;; *) 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi SWIG=$ac_cv_path_SWIG if test -n "$SWIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5 $as_echo "$SWIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$SWIG" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find 'swig' program. You should look at http://www.swig.org" >&5 $as_echo "$as_me: WARNING: cannot find 'swig' program. You should look at http://www.swig.org" >&2;} SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false' elif test -n "1.3.17" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG version" >&5 $as_echo_n "checking for SWIG version... " >&6; } swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5 $as_echo "$swig_version" >&6; } if test -n "$swig_version" ; then # Calculate the required version number components required=1.3.17 required_major=`echo $required | sed 's/[^0-9].*//'` if test -z "$required_major" ; then required_major=0 fi required=`echo $required | sed 's/[0-9]*[^0-9]//'` required_minor=`echo $required | sed 's/[^0-9].*//'` if test -z "$required_minor" ; then required_minor=0 fi required=`echo $required | sed 's/[0-9]*[^0-9]//'` required_patch=`echo $required | sed 's/[^0-9].*//'` if test -z "$required_patch" ; then required_patch=0 fi # Calculate the available version number components available=$swig_version available_major=`echo $available | sed 's/[^0-9].*//'` if test -z "$available_major" ; then available_major=0 fi available=`echo $available | sed 's/[0-9]*[^0-9]//'` available_minor=`echo $available | sed 's/[^0-9].*//'` if test -z "$available_minor" ; then available_minor=0 fi available=`echo $available | sed 's/[0-9]*[^0-9]//'` available_patch=`echo $available | sed 's/[^0-9].*//'` if test -z "$available_patch" ; then available_patch=0 fi if test $available_major -ne $required_major \ -o $available_minor -ne $required_minor \ -o $available_patch -lt $required_patch ; then if test $available_major -lt $required_major ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >= 1.3.17 is required. You have $swig_version. You should look at http://www.swig.org" >&5 $as_echo "$as_me: WARNING: SWIG version >= 1.3.17 is required. You have $swig_version. You should look at http://www.swig.org" >&2;} SWIG='echo "Error: SWIG version >= 1.3.17 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' fi else { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG executable is '$SWIG'" >&5 $as_echo "$as_me: SWIG executable is '$SWIG'" >&6;} SWIG_LIB=`$SWIG -swiglib` { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG library directory is '$SWIG_LIB'" >&5 $as_echo "$as_me: SWIG library directory is '$SWIG_LIB'" >&6;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5 $as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;} SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false' fi fi SWIG="$SWIG -c++" test "x" != "xno" || swig_shadow=" -noproxy" SWIG_PYTHON_OPT=-python$swig_shadow SWIG_PYTHON_CPPFLAGS=$PYTHON_CPPFLAGS CXXFLAGS="${CXXFLAGS}" CFLAGS="${CFLAGS}" LIBPYTHON_LDFLAGS=$PYTHON_LDFLAGS LIBPYTHON_INCLUDES=$PYTHON_CPPFLAGS LIBNUMPY_INCLUDES=$PYTHON_NUMPY_INCLUDE LIBWXPYTHON_INCLUDES=$PYTHON_WXPYTHON_INCLUDE else LIBPYTHON_LDFLAGS= LIBPYTHON_INCLUDES= LIBNUMPY_INCLUDES= LIBWXPYTHON_INCLUDES= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kernel" >&5 $as_echo_n "checking for kernel... " >&6; } case ${STFKERNEL} in darwin) LIBSTF_LDFLAGS="-avoid-version" if test "$enable_module" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DMODULE_ONLY" else CPPFLAGS="${CPPFLAGS}" fi STF_PYTHON_LIBNAME="libpystf.dylib" STFIO_PYTHON_LIBNAME="libpystfio.dylib" ARCH_FLAGS="" CFLAGS="${CFLAGS} ${ARCH_FLAGS}" CXXFLAGS="${CXXFLAGS} ${ARCH_FLAGS}" LDFLAGS="${LDFLAGS} ${ARCH_FLAGS}" OBJCFLAGS="${OBJCFLAGS} ${ARCH_FLAGS}" OBJCXXFLAGS="${OBJCXXFLAGS} ${ARCH_FLAGS}" ;; *) if test "$enable_module" = "yes" ; then LIBSTF_LDFLAGS="-avoid-version" CPPFLAGS="${CPPFLAGS} -DMODULE_ONLY" else if test "$enable_debian" = "yes" ; then LIBSTF_LDFLAGS="-Wl,-rpath,/usr/lib/stimfit -avoid-version" else LIBSTF_LDFLAGS="-Wl,-rpath,${prefix}/lib/stimfit -avoid-version" fi CPPFLAGS="${CPPFLAGS}" fi if test "$enable_debian" = "yes" ; then CPPFLAGS="${CPPFLAGS} `dpkg-buildflags --get CPPFLAGS`" CFLAGS="${CFLAGS} `dpkg-buildflags --get CFLAGS`" CXXFLAGS="${CXXFLAGS} `dpkg-buildflags --get CXXFLAGS`" LDFLAGS="${LDFLAGS} `dpkg-buildflags --get LDFLAGS`" fi STF_PYTHON_LIBNAME="libpystf.so" STFIO_PYTHON_LIBNAME="libpystfio.so" ;; esac # Checks for python libraries. if test "$enable_python" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_PYTHON" fi # Check whether --enable-ipython was given. if test "${enable_ipython+set}" = set; then : enableval=$enable_ipython; fi if test "$enable_ipython" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DIPYTHON" fi # Build the exotic Stimfit flavour with Slope cursors # Check whether --with-pslope was given. if test "${with_pslope+set}" = set; then : withval=$with_pslope; fi if test "$with_pslope" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_PSLOPE" fi # Check whether --with-biosig was given. if test "${with_biosig+set}" = set; then : withval=$with_biosig; fi if test "$with_biosig" = "yes"; then WITH_BIOSIG_TRUE= WITH_BIOSIG_FALSE='#' else WITH_BIOSIG_TRUE='#' WITH_BIOSIG_FALSE= fi # Check whether --with-biosig2 was given. if test "${with_biosig2+set}" = set; then : withval=$with_biosig2; fi if test "$with_biosig2" = "yes"; then WITH_BIOSIG2_TRUE= WITH_BIOSIG2_FALSE='#' else WITH_BIOSIG2_TRUE='#' WITH_BIOSIG2_FALSE= fi # Check whether --with-biosiglite was given. if test "${with_biosiglite+set}" = set; then : withval=$with_biosiglite; fi if test "$with_biosiglite" = "yes"; then WITH_BIOSIGLITE_TRUE= WITH_BIOSIGLITE_FALSE='#' else WITH_BIOSIGLITE_TRUE='#' WITH_BIOSIGLITE_FALSE= fi if test "$with_biosig2" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_BIOSIG2" LIBBIOSIG_LDFLAGS="-lbiosig -lcholmod" elif test "$with_biosig" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_BIOSIG" LIBBIOSIG_LDFLAGS="-lbiosig -lcholmod" elif test "$with_biosiglite" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_BIOSIG2 -DWITH_BIOSIGLITE" LIBBIOSIG_LDFLAGS="-lcholmod" fi # Check whether --with-lapack-lib was given. if test "${with_lapack_lib+set}" = set; then : withval=$with_lapack_lib; if test "$withval" != "yes" -a "$withval" != ""; then LAPACKLIB=$withval LIBLAPACK_LDFLAGS="$LAPACKLIB" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK" fi fi # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fftw_malloc in -lfftw3" >&5 $as_echo_n "checking for fftw_malloc in -lfftw3... " >&6; } if ${ac_cv_lib_fftw3_fftw_malloc+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfftw3 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char fftw_malloc (); int main () { return fftw_malloc (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_fftw3_fftw_malloc=yes else ac_cv_lib_fftw3_fftw_malloc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fftw3_fftw_malloc" >&5 $as_echo "$ac_cv_lib_fftw3_fftw_malloc" >&6; } if test "x$ac_cv_lib_fftw3_fftw_malloc" = xyes; then : HAVE_FFTW3="yes" fi if test "${HAVE_FFTW3}" != "yes" ; then as_fn_error $? "Couldn't find fftw3." "$LINENO" 5 fi if test "$LAPACKLIB" = ""; then if test "$STFKERNEL" = "darwin" ; then # System LAPACK LIBLAPACK_LDFLAGS="/usr/lib/liblapack.dylib -framework Accelerate" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK -DHAVE_LAPACK_SUFFIX" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgemm_ in -llapack" >&5 $as_echo_n "checking for dgemm_ in -llapack... " >&6; } if ${ac_cv_lib_lapack_dgemm_+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-llapack $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dgemm_ (); int main () { return dgemm_ (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lapack_dgemm_=yes else ac_cv_lib_lapack_dgemm_=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lapack_dgemm_" >&5 $as_echo "$ac_cv_lib_lapack_dgemm_" >&6; } if test "x$ac_cv_lib_lapack_dgemm_" = xyes; then : HAVE_LAPACKX="yes" fi if test "${HAVE_LAPACKX}" != "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgemm_ in -llapack3" >&5 $as_echo_n "checking for dgemm_ in -llapack3... " >&6; } if ${ac_cv_lib_lapack3_dgemm_+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-llapack3 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dgemm_ (); int main () { return dgemm_ (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lapack3_dgemm_=yes else ac_cv_lib_lapack3_dgemm_=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lapack3_dgemm_" >&5 $as_echo "$ac_cv_lib_lapack3_dgemm_" >&6; } if test "x$ac_cv_lib_lapack3_dgemm_" = xyes; then : HAVE_LAPACK3="yes" fi if test "${HAVE_LAPACK3}" != "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgemm_ in -llapack-3" >&5 $as_echo_n "checking for dgemm_ in -llapack-3... " >&6; } if ${ac_cv_lib_lapack_3_dgemm_+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-llapack-3 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dgemm_ (); int main () { return dgemm_ (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lapack_3_dgemm_=yes else ac_cv_lib_lapack_3_dgemm_=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lapack_3_dgemm_" >&5 $as_echo "$ac_cv_lib_lapack_3_dgemm_" >&6; } if test "x$ac_cv_lib_lapack_3_dgemm_" = xyes; then : HAVE_LAPACK_3="yes" fi if test "${HAVE_LAPACK_3}" != "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgemm_ in -lblas" >&5 $as_echo_n "checking for dgemm_ in -lblas... " >&6; } if ${ac_cv_lib_blas_dgemm_+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lblas $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dgemm_ (); int main () { return dgemm_ (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_blas_dgemm_=yes else ac_cv_lib_blas_dgemm_=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blas_dgemm_" >&5 $as_echo "$ac_cv_lib_blas_dgemm_" >&6; } if test "x$ac_cv_lib_blas_dgemm_" = xyes; then : HAVE_ATLAS="yes" fi if test "${HAVE_ATLAS}" != "yes" ; then as_fn_error $? "Couldn't find lapack." "$LINENO" 5 else LIBLAPACK_LDFLAGS="-llapack -lblas" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " fi else LIBLAPACK_LDFLAGS="-llapack-3" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " fi else LIBLAPACK_LDFLAGS=-llapack3 CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " fi else LIBLAPACK_LDFLAGS="-llapack -lblas" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " fi fi fi # stuff not required for standalone module if test "$enable_module" != "yes"; then # Optionally enables aui for doc/view architecture # Check whether --enable-aui was given. if test "${enable_aui+set}" = set; then : enableval=$enable_aui; fi if test "$enable_aui" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_AUIDOCVIEW" fi WXCONFIG=wx-config # Check whether --with-wx-config was given. if test "${with_wx_config+set}" = set; then : withval=$with_wx_config; if test "$withval" != "yes" -a "$withval" != ""; then WXCONFIG=$withval fi fi wxversion=0 # Call WXTEST func { $as_echo "$as_me:${as_lineno-$LINENO}: checking wxWidgets version" >&5 $as_echo_n "checking wxWidgets version... " >&6; } if wxversion=`$WXCONFIG --version`; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $wxversion" >&5 $as_echo "$wxversion" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } as_fn_error $? "wxWidgets is required. Try --with-wx-config." "$LINENO" 5 fi # Verify minimus requires { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wxWidgets libraries" >&5 $as_echo_n "checking for wxWidgets libraries... " >&6; } vers=`echo $wxversion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'` if test -n "$vers" && test "$vers" -ge 2008000; then WX_CPPFLAGS="`$WXCONFIG --cppflags`" WX_CXXFLAGS="`$WXCONFIG --cxxflags`" if test "$STFKERNEL" = "darwin" ; then if test "${PY_AC_VERSION:0:1}" -ge 3; then WX_LIBS="`$WXCONFIG --libs base`" else WX_LIBS="`$WXCONFIG --libs propgrid,aui,adv,core,net,base`" fi else WX_LIBS="`$WXCONFIG --libs base,core,adv,aui,net`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WX_LIBS" >&5 $as_echo "$WX_LIBS" >&6; } else as_fn_error $? "wxWidgets 2.8.0 or newer is required" "$LINENO" 5 fi # CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" # CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS" dnl included in cppflags POSTLINK_COMMAND="@true" MACSETFILE="@true" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wxWidgets platform" >&5 $as_echo_n "checking for wxWidgets platform... " >&6; } WX_BASENAME="`$WXCONFIG --basename`" case $WX_BASENAME in *wx_osx*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WX_BASENAME" >&5 $as_echo "$WX_BASENAME" >&6; } # Extract the first word of "Rez", so it can be a program name with args. set dummy Rez; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_REZ+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$REZ"; then ac_cv_prog_REZ="$REZ" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_REZ="Rez" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_REZ" && ac_cv_prog_REZ="/Developer/Tools/Rez" fi fi REZ=$ac_cv_prog_REZ if test -n "$REZ"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $REZ" >&5 $as_echo "$REZ" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL -o" # Extract the first word of "SetFile", so it can be a program name with args. set dummy SetFile; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_SETFILE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$SETFILE"; then ac_cv_prog_SETFILE="$SETFILE" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_SETFILE="SetFile" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_SETFILE" && ac_cv_prog_SETFILE="/Developer/Tools/SetFile" fi fi SETFILE=$ac_cv_prog_SETFILE if test -n "$SETFILE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SETFILE" >&5 $as_echo "$SETFILE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi MACSETFILE="\$(SETFILE)" ;; *wx_mac*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WX_BASENAME" >&5 $as_echo "$WX_BASENAME" >&6; } # Extract the first word of "Rez", so it can be a program name with args. set dummy Rez; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_REZ+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$REZ"; then ac_cv_prog_REZ="$REZ" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_REZ="Rez" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_REZ" && ac_cv_prog_REZ="/Developer/Tools/Rez" fi fi REZ=$ac_cv_prog_REZ if test -n "$REZ"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $REZ" >&5 $as_echo "$REZ" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL -o" # Extract the first word of "SetFile", so it can be a program name with args. set dummy SetFile; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_SETFILE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$SETFILE"; then ac_cv_prog_SETFILE="$SETFILE" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_SETFILE="SetFile" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_SETFILE" && ac_cv_prog_SETFILE="/Developer/Tools/SetFile" fi fi SETFILE=$ac_cv_prog_SETFILE if test -n "$SETFILE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SETFILE" >&5 $as_echo "$SETFILE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi MACSETFILE="\$(SETFILE)" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: other" >&5 $as_echo "other" >&6; } ;; esac fi # Checks for hdf5 libraries. # Check whether --with-hdf5-prefix was given. if test "${with_hdf5_prefix+set}" = set; then : withval=$with_hdf5_prefix; if test "$withval" != "yes" -a "$withval" != ""; then HDF5_PREFIX=${withval} LDFLAGS="${LDFLAGS} -L${HDF5_PREFIX}/lib" CPPFLAGS="${CPPFLAGS} -I${HDF5_PREFIX}/include" fi fi if test "${HDF5PREFIX}" = ""; then if test "$STFKERNEL" = "linux" ; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HDF5" >&5 $as_echo_n "checking for HDF5... " >&6; } if test -n "$HDF5_CFLAGS"; then pkg_cv_HDF5_CFLAGS="$HDF5_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"hdf5\""; } >&5 ($PKG_CONFIG --exists --print-errors "hdf5") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_HDF5_CFLAGS=`$PKG_CONFIG --cflags "hdf5" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$HDF5_LIBS"; then pkg_cv_HDF5_LIBS="$HDF5_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"hdf5\""; } >&5 ($PKG_CONFIG --exists --print-errors "hdf5") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_HDF5_LIBS=`$PKG_CONFIG --libs "hdf5" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then HDF5_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "hdf5" 2>&1` else HDF5_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "hdf5" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$HDF5_PKG_ERRORS" >&5 HDF5_CFLAGS="" HDF5_LIBS="" elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } HDF5_CFLAGS="" HDF5_LIBS="" else HDF5_CFLAGS=$pkg_cv_HDF5_CFLAGS HDF5_LIBS=$pkg_cv_HDF5_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CPPFLAGS="${CPPFLAGS} ${HDF5_CFLAGS} -DH5_USE_16_API" LIBHDF5_LDFLAGS="${HDF5_LIBS} -lhdf5_hl" LDFLAGS="${LDFLAGS} ${LIBHDF5_LDFLAGS}" fi fi fi ac_fn_c_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default" if test "x$ac_cv_header_hdf5_h" = xyes; then : else as_fn_error $? "Couldn't find hdf5 header" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5Fopen in -lhdf5" >&5 $as_echo_n "checking for H5Fopen in -lhdf5... " >&6; } if ${ac_cv_lib_hdf5_H5Fopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lhdf5 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char H5Fopen (); int main () { return H5Fopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_hdf5_H5Fopen=yes else ac_cv_lib_hdf5_H5Fopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_H5Fopen" >&5 $as_echo "$ac_cv_lib_hdf5_H5Fopen" >&6; } if test "x$ac_cv_lib_hdf5_H5Fopen" = xyes; then : HAVE_HDF5="yes" fi if test "${HAVE_HDF5}" != "yes" ; then as_fn_error $? "Couldn't find hdf5 libraries." "$LINENO" 5 else if test "${HDF5_CFLAGS}" = ""; then CPPFLAGS="${CPPFLAGS} -DH5_USE_16_API" LIBHDF5_LDFLAGS="-lhdf5 -lhdf5_hl" fi fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; fi if test "$enable_debug" = "yes" ; then CPPFLAGS="${CPPFLAGS} -D_STFDEBUG " OPT_CXXFLAGS="-O0 -g3" CFLAGS="${CFLAGS} -O0 -g3" else OPT_CXXFLAGS="-O2 -g" CFLAGS="${CFLAGS} -O2 -g" fi # gtest GT_CPPFLAGS="" GT_CXXFLAGS="" GT_LIBS="-lpthread" GT_LDFLAGS="" # end gtest # CPPFLAGS="${CPPFLAGS} -DSTFDATE='\"${BUILDDATE}\"'" CXXFLAGS="${CXXFLAGS} -Wall" ac_config_headers="$ac_config_headers stfconf.h" ac_config_files="$ac_config_files Makefile src/Makefile src/libstfio/Makefile src/libstfnum/Makefile src/libbiosiglite/Makefile src/pystfio/Makefile src/stimfit/Makefile src/stimfit/py/Makefile dist/macosx/stimfit.plist" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # 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. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} 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}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_MODULE_TRUE}" && test -z "${BUILD_MODULE_FALSE}"; then as_fn_error $? "conditional \"BUILD_MODULE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_DEBIAN_TRUE}" && test -z "${BUILD_DEBIAN_FALSE}"; then as_fn_error $? "conditional \"BUILD_DEBIAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ISDARWIN_TRUE}" && test -z "${ISDARWIN_FALSE}"; then as_fn_error $? "conditional \"ISDARWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_PYTHON_TRUE}" && test -z "${BUILD_PYTHON_FALSE}"; then as_fn_error $? "conditional \"BUILD_PYTHON\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_BIOSIG_TRUE}" && test -z "${WITH_BIOSIG_FALSE}"; then as_fn_error $? "conditional \"WITH_BIOSIG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_BIOSIG2_TRUE}" && test -z "${WITH_BIOSIG2_FALSE}"; then as_fn_error $? "conditional \"WITH_BIOSIG2\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_BIOSIGLITE_TRUE}" && test -z "${WITH_BIOSIGLITE_FALSE}"; then as_fn_error $? "conditional \"WITH_BIOSIGLITE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= 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 IFS=$as_save_IFS ;; 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 $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # 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 ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by stimfit $as_me 0.16.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ stimfit config.status 0.16.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "stfconf.h") CONFIG_HEADERS="$CONFIG_HEADERS stfconf.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/libstfio/Makefile") CONFIG_FILES="$CONFIG_FILES src/libstfio/Makefile" ;; "src/libstfnum/Makefile") CONFIG_FILES="$CONFIG_FILES src/libstfnum/Makefile" ;; "src/libbiosiglite/Makefile") CONFIG_FILES="$CONFIG_FILES src/libbiosiglite/Makefile" ;; "src/pystfio/Makefile") CONFIG_FILES="$CONFIG_FILES src/pystfio/Makefile" ;; "src/stimfit/Makefile") CONFIG_FILES="$CONFIG_FILES src/stimfit/Makefile" ;; "src/stimfit/py/Makefile") CONFIG_FILES="$CONFIG_FILES src/stimfit/py/Makefile" ;; "dist/macosx/stimfit.plist") CONFIG_FILES="$CONFIG_FILES dist/macosx/stimfit.plist" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #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. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # 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. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf 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. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 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. # GNU Libtool 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 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # 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 # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # 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 # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # 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 # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # 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 # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # 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 # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # 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 a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # 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\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # 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 # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # 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 # 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 # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # 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 set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # 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" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # 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_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi stimfit-0.16.0/doc/0000775000175000017500000000000013567226445011043 500000000000000stimfit-0.16.0/doc/Doxyfile0000664000175000017500000020175613567226230012474 00000000000000# Doxyfile 1.5.8 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = Stimfit # 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 = 0.16.0 # 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 = doxygen # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = YES # 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: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, # Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, # Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, # Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # 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 # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # 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. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the 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 regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = 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 # 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 = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = 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 # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # 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 = NO # 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 EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = 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 classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # 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 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 # and Mac users are advised 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 SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = 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 the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = YES # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # 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 # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # 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. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ../src/stimfit/gui/app.h \ ../src/stimfit/gui/copygrid.h \ ../src/stimfit/gui/copygrid.h \ ../src/stimfit/gui/doc.h \ ../src/stimfit/gui/childframe.h \ ../src/stimfit/gui/parentframe.h \ ../src/stimfit/gui/graph.h \ ../src/stimfit/gui/printout.h \ ../src/stimfit/gui/stfcheckbox.h \ ../src/stimfit/gui/table.h \ ../src/stimfit/gui/view.h \ ../src/stimfit/gui/zoom.h \ ../src/stimfit/gui/dlgs/convertdlg.h \ ../src/stimfit/gui/dlgs/cursorsdlg.h \ ../src/stimfit/gui/dlgs/eventdlg.h \ ../src/stimfit/gui/dlgs/fitseldlg.h \ ../src/stimfit/gui/dlgs/smalldlgs.h \ ../src/stimfit/gui/usrdlg/usrdlg.h \ ../src/libstfnum/fit.h \ ../src/libstfnum/measure.h \ ../src/libstfnum/funclib.h \ ../src/libstfnum/stfnum.h \ ../src/libstfio/channel.h \ ../src/libstfio/recording.h \ ../src/libstfio/section.h \ ../src/libstfio/stfio.h \ ../src/stimfit/stf.h ../src/libstfio/abf/abflib.h \ ../src/libstfio/ascii/asciilib.h \ ../src/libstfio/atf/atflib.h \ ../src/libstfio/axg/axglib.h \ ../src/libstfio/biosig/biosig.h \ ../src/libstfio/cfs/cfslib.h \ ../src/libstfio/heka/heka.h \ ../src/libstfio/hdf5/hdf5lib.h \ ../src/libstfio/igor/igorlib.h \ ../src/libstfio/son/sonlib.h \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = # 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 = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # 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 REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = 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 #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # 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. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! 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 HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # 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 compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # 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 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to FRAME, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. Other possible values # for this tag are: HIERARCHIES, which will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list; # ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which # disables this behavior completely. For backwards compatibility with previous # releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE # respectively. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. # FORMULA_FONTSIZE = 10 #--------------------------------------------------------------------------- # 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 # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = lmodern \ textcomp \ amsmath # 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 = YES # 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 = YES # 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 # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = 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 optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML 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 `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # 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_DEFINED 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. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = _WINDOWS \ __UNIX__ \ WITH_PYTHON # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # 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 GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # 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 # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Options 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 = YES # Enable the USE_MATHJAX option to render $\mbox{\LaTeX}$ formulas using # MathJax (see http://www.mathjax.org) which uses client side Javascript # for the rendering instead of using prerendered bitmaps. Use this if you # do not have LaTeX installed or if you want to formulas look prettier # in the HTML output. USE_MATHJAX = YES # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = teX/AMSmath TeX/AMSsymbols # Use this tag to change the font size of LaTeX formulas included as images # in the HTML documentation. The default is 10. when you change the font # size after a successful doxygen run you need to manually remove any # form_*.png images from the HTML output directory to force them to be # regenerated. FORMULA_FONTISZE = 16 stimfit-0.16.0/ltmain.sh0000644000175000017500000117147413567226341012046 00000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 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. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.6 Debian-2.4.6-2" package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 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. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 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. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --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 --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message 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. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname $scriptversion Debian-2.4.6-2 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # 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= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; 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 no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= 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 yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; 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." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && 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." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && 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." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [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: $progname [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 -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler 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: $progname [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: $progname [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: $progname [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 following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [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 -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -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 -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -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 -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 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: $progname [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." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" 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 -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # 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 $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 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" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; 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. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append 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 -e "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. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" 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 func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append 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 func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # 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" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | 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/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) 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*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; 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 "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # 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. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' 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 file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED '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 \"\$file\" | $SED '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 \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ 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 "\ # 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 "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # 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 \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${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\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that 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 base_compile="$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= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_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 func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append 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 # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir 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 func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework 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* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # 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 ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*|-fsanitize=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" 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. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'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\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$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 $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; 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 $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append 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 dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $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" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append 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 func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # 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 "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; 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 "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 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* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 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 prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; 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 yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; 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 prog = "$linkmode"; then # 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 unsupported != "$hardcode_direct"; 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 yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; 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 system cannot link to static lib archive $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 yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 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 no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # 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 "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=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 # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. 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 "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type '$version_type'" ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" 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 func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= 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 no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "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 func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; 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 "*) ;; *) func_append 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 "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append 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 behavior. 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. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi 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 "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $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" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; 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 potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $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" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; 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 ;; esac ;; 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 with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; 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 no = "$build_old_libs"; 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 no = "$allow_undefined"; 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 no = "$build_old_libs"; 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 # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # 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 yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result 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"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append 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 func_append 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 relink = "$opt_mode" || 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 shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_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 yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_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= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${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" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append 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 "*) ;; *) func_append 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"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; 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"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append 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 yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } 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 func_append 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 func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; 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 "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "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}\" || $lt_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 func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "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}\" || $lt_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 func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; 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) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # 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' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false 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) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; 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 $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$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 func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: stimfit-0.16.0/INSTALL0000664000175000017500000001547213277303516011251 00000000000000Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, 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. Type `make install' to install the programs and any data files and documentation. 4. You can remove the program binaries and object files from the source code directory by typing `make clean'. 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/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. 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. stimfit-0.16.0/config.sub0000755000175000017500000010645013567226345012204 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-22' # 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 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # 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. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # 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 or ALIAS Canonicalize a configuration name. Options: -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 ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 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 ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # 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 ;; * ) 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* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) 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 | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -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 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -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/'` ;; -sco5v6*) # 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*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -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 \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # 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-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # 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-pc 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 ;; abacus) basic_machine=abacus-unknown ;; 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 ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; 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 ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; 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 | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; 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 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; 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 ;; 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 ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; 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 ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; 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 ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) 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) 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 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-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 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; 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=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; 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 ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; 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 ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; 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 ;; *-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. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now 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* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -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 ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -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 score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. 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 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-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 ;; *-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 ;; -cnk*|-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 ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) 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 # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: stimfit-0.16.0/configure.ac0000664000175000017500000002746613567226230012513 00000000000000AC_INIT([stimfit],[0.16.0]) AC_CONFIG_SRCDIR(src/stimfit/gui/main.cpp) AM_INIT_AUTOMAKE([1.11]) AM_SILENT_RULES([yes]) AC_CONFIG_MACRO_DIR([m4]) AC_PROG_CC AC_PROG_INSTALL _LT_SET_OPTION([LT_INIT],[dlopen]) AC_DIAGNOSE([obsolete],[AC_LIBTOOL_DLOPEN: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) LT_INIT AC_PROG_CPP AC_PROG_AWK AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_MKDIR_P AC_PROG_CXX AC_PROG_LIBTOOL # BUILDDATE=`date` # Build a standalone python module AC_ARG_ENABLE([module], AS_HELP_STRING([--enable-module],[build a standalone python module; implies --enable-python]),[]) AM_CONDITIONAL(BUILD_MODULE, test "$enable_module" = "yes") # pbuilder debian package build AC_ARG_ENABLE([debian], AS_HELP_STRING([--enable-debian],[special build for pbuilder]),[]) AM_CONDITIONAL(BUILD_DEBIAN, test "$enable_debian" = "yes") AC_MSG_CHECKING(for kernel) case `uname` in Darwin) AC_MSG_RESULT(darwin) CXXFLAGS="${CXXFLAGS} -fPIC" CFLAGS="${CFLAGS} -fPIC" STFKERNEL="darwin" ;; *) # treat everything else (kfreebsd, hurd) as linux AC_MSG_RESULT(linux or similar) CXXFLAGS="-fPIC" CFLAGS="-fPIC" STFKERNEL="linux" ;; esac AM_CONDITIONAL([ISDARWIN], [test $STFKERNEL = "darwin"]) # Checks for python libraries. AC_ARG_ENABLE([python], AS_HELP_STRING( [--enable-python], [enable python console (default="yes")]),, [enable_python="yes"]) AM_CONDITIONAL(BUILD_PYTHON, test "$enable_python" = "yes") if (test "$enable_python" = "yes") || (test "$enable_module" = "yes"); then AC_PYTHON_DEVEL() AC_PROG_SWIG(1.3.17) SWIG_ENABLE_CXX SWIG_PYTHON AC_SUBST(SWIG) CXXFLAGS="${CXXFLAGS}" CFLAGS="${CFLAGS}" LIBPYTHON_LDFLAGS=$PYTHON_LDFLAGS LIBPYTHON_INCLUDES=$PYTHON_CPPFLAGS LIBNUMPY_INCLUDES=$PYTHON_NUMPY_INCLUDE LIBWXPYTHON_INCLUDES=$PYTHON_WXPYTHON_INCLUDE else LIBPYTHON_LDFLAGS= LIBPYTHON_INCLUDES= LIBNUMPY_INCLUDES= LIBWXPYTHON_INCLUDES= fi AC_SUBST(LIBPYTHON_LDFLAGS) AC_SUBST(LIBPYTHON_INCLUDES) AC_SUBST(LIBNUMPY_INCLUDES) AC_SUBST(LIBWXPYTHON_INCLUDES) AC_MSG_CHECKING(for kernel) case ${STFKERNEL} in darwin) LIBSTF_LDFLAGS="-avoid-version" if test "$enable_module" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DMODULE_ONLY" else CPPFLAGS="${CPPFLAGS}" fi STF_PYTHON_LIBNAME="libpystf.dylib" STFIO_PYTHON_LIBNAME="libpystfio.dylib" ARCH_FLAGS="" CFLAGS="${CFLAGS} ${ARCH_FLAGS}" CXXFLAGS="${CXXFLAGS} ${ARCH_FLAGS}" LDFLAGS="${LDFLAGS} ${ARCH_FLAGS}" OBJCFLAGS="${OBJCFLAGS} ${ARCH_FLAGS}" OBJCXXFLAGS="${OBJCXXFLAGS} ${ARCH_FLAGS}" ;; *) if test "$enable_module" = "yes" ; then LIBSTF_LDFLAGS="-avoid-version" CPPFLAGS="${CPPFLAGS} -DMODULE_ONLY" else if test "$enable_debian" = "yes" ; then LIBSTF_LDFLAGS="-Wl,-rpath,/usr/lib/stimfit -avoid-version" else LIBSTF_LDFLAGS="-Wl,-rpath,${prefix}/lib/stimfit -avoid-version" fi CPPFLAGS="${CPPFLAGS}" fi if test "$enable_debian" = "yes" ; then CPPFLAGS="${CPPFLAGS} `dpkg-buildflags --get CPPFLAGS`" CFLAGS="${CFLAGS} `dpkg-buildflags --get CFLAGS`" CXXFLAGS="${CXXFLAGS} `dpkg-buildflags --get CXXFLAGS`" LDFLAGS="${LDFLAGS} `dpkg-buildflags --get LDFLAGS`" fi STF_PYTHON_LIBNAME="libpystf.so" STFIO_PYTHON_LIBNAME="libpystfio.so" ;; esac AC_SUBST(LIBSTF_LDFLAGS) AC_SUBST(STF_PYTHON_LIBNAME) AC_SUBST(STFIO_PYTHON_LIBNAME) # Checks for python libraries. if test "$enable_python" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_PYTHON" fi AC_ARG_ENABLE([ipython], AS_HELP_STRING([--enable-ipython],[enable ipython as the default shell (experimental); implies --enable-python]),[]) if test "$enable_ipython" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DIPYTHON" fi # Build the exotic Stimfit flavour with Slope cursors AC_ARG_WITH([pslope], AS_HELP_STRING([--with-pslope],[include slope measure cursors]),[]) if test "$with_pslope" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_PSLOPE" fi AC_ARG_WITH([biosig], AS_HELP_STRING([--with-biosig],[build with libbiosig support]),[]) AM_CONDITIONAL(WITH_BIOSIG, test "$with_biosig" = "yes") AC_ARG_WITH([biosig2], AS_HELP_STRING([--with-biosig2],[equivalent to --with-biosig]),[]) AM_CONDITIONAL(WITH_BIOSIG2, test "$with_biosig2" = "yes") AC_ARG_WITH([biosiglite], AS_HELP_STRING([--with-biosiglite], [use builtin biosig library]), []) AM_CONDITIONAL(WITH_BIOSIGLITE, test "$with_biosiglite" = "yes") if test "$with_biosig2" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_BIOSIG2" LIBBIOSIG_LDFLAGS="-lbiosig -lcholmod" elif test "$with_biosig" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_BIOSIG" LIBBIOSIG_LDFLAGS="-lbiosig -lcholmod" elif test "$with_biosiglite" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_BIOSIG2 -DWITH_BIOSIGLITE" LIBBIOSIG_LDFLAGS="-lcholmod" fi AC_SUBST(LIBBIOSIG_LDFLAGS) AC_ARG_WITH([lapack-lib], AS_HELP_STRING([--with-lapack-lib=LAPACKLIB],[Provide full path to custom lapack library]), [ if test "$withval" != "yes" -a "$withval" != ""; then LAPACKLIB=$withval LIBLAPACK_LDFLAGS="$LAPACKLIB" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK" fi ]) # Checks for libraries. AC_CHECK_LIB([fftw3], [fftw_malloc], HAVE_FFTW3="yes") if test "${HAVE_FFTW3}" != "yes" ; then AC_MSG_ERROR([Couldn't find fftw3.]) fi if test "$LAPACKLIB" = ""; then if test "$STFKERNEL" = "darwin" ; then # System LAPACK LIBLAPACK_LDFLAGS="/usr/lib/liblapack.dylib -framework Accelerate" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK -DHAVE_LAPACK_SUFFIX" else AC_CHECK_LIB([lapack], [dgemm_], HAVE_LAPACKX="yes") if test "${HAVE_LAPACKX}" != "yes" ; then AC_CHECK_LIB([lapack3], [dgemm_], HAVE_LAPACK3="yes") if test "${HAVE_LAPACK3}" != "yes" ; then AC_CHECK_LIB([lapack-3], [dgemm_], HAVE_LAPACK_3="yes") if test "${HAVE_LAPACK_3}" != "yes" ; then AC_CHECK_LIB([blas], [dgemm_], HAVE_ATLAS="yes") if test "${HAVE_ATLAS}" != "yes" ; then AC_MSG_ERROR([Couldn't find lapack.]) else LIBLAPACK_LDFLAGS="-llapack -lblas" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " fi else LIBLAPACK_LDFLAGS="-llapack-3" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " fi else LIBLAPACK_LDFLAGS=-llapack3 CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " fi else LIBLAPACK_LDFLAGS="-llapack -lblas" CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " fi fi fi AC_SUBST(LIBLAPACK_LDFLAGS) # stuff not required for standalone module if test "$enable_module" != "yes"; then # Optionally enables aui for doc/view architecture AC_ARG_ENABLE([aui], AS_HELP_STRING([--enable-aui],[enable AUI for the doc/view architecture (experimental)]),[]) if test "$enable_aui" = "yes" ; then CPPFLAGS="${CPPFLAGS} -DWITH_AUIDOCVIEW" fi WXCONFIG=wx-config AC_ARG_WITH(wx-config, [[ --with-wx-config=FILE Use the given path to wx-config when determining wxWidgets configuration; defaults to "wx-config"]], [ if test "$withval" != "yes" -a "$withval" != ""; then WXCONFIG=$withval fi ]) wxversion=0 AC_DEFUN([WXTEST], [ AC_REQUIRE([AC_PROG_AWK]) AC_MSG_CHECKING([wxWidgets version]) if wxversion=`$WXCONFIG --version`; then AC_MSG_RESULT([$wxversion]) else AC_MSG_RESULT([not found]) AC_MSG_ERROR([wxWidgets is required. Try --with-wx-config.]) fi]) # Call WXTEST func WXTEST # Verify minimus requires AC_MSG_CHECKING(for wxWidgets libraries) vers=`echo $wxversion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'` if test -n "$vers" && test "$vers" -ge 2008000; then WX_CPPFLAGS="`$WXCONFIG --cppflags`" WX_CXXFLAGS="`$WXCONFIG --cxxflags`" if test "$STFKERNEL" = "darwin" ; then if test "${PY_AC_VERSION:0:1}" -ge 3; then WX_LIBS="`$WXCONFIG --libs base`" else WX_LIBS="`$WXCONFIG --libs propgrid,aui,adv,core,net,base`" fi else WX_LIBS="`$WXCONFIG --libs base,core,adv,aui,net`" fi AC_MSG_RESULT([$WX_LIBS]) else AC_MSG_ERROR([wxWidgets 2.8.0 or newer is required]) fi # CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" # CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS" dnl included in cppflags AC_SUBST(WX_LIBS) AC_SUBST(WX_CPPFLAGS) AC_SUBST(WX_CXXFLAGS) dnl default value is to (silently) do nothing in the makefile POSTLINK_COMMAND="@true" MACSETFILE="@true" AC_MSG_CHECKING(for wxWidgets platform) WX_BASENAME="`$WXCONFIG --basename`" case $WX_BASENAME in *wx_osx*) AC_MSG_RESULT($WX_BASENAME) AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez) POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL -o" AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile) MACSETFILE="\$(SETFILE)" ;; *wx_mac*) AC_MSG_RESULT($WX_BASENAME) AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez) POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL -o" AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile) MACSETFILE="\$(SETFILE)" ;; *) AC_MSG_RESULT(other) ;; esac AC_SUBST(POSTLINK_COMMAND) AC_SUBST(MACSETFILE) fi # Checks for hdf5 libraries. AC_ARG_WITH([hdf5-prefix], AS_HELP_STRING([--with-hdf5-prefix=HDF5_PREFIX],[Provide full path to hdf5 prefix]), [ if test "$withval" != "yes" -a "$withval" != ""; then HDF5_PREFIX=${withval} LDFLAGS="${LDFLAGS} -L${HDF5_PREFIX}/lib" CPPFLAGS="${CPPFLAGS} -I${HDF5_PREFIX}/include" fi ]) if test "${HDF5PREFIX}" = ""; then if test "$STFKERNEL" = "linux" ; then PKG_CHECK_MODULES([HDF5], [hdf5], [ CPPFLAGS="${CPPFLAGS} ${HDF5_CFLAGS} -DH5_USE_16_API" LIBHDF5_LDFLAGS="${HDF5_LIBS} -lhdf5_hl" LDFLAGS="${LDFLAGS} ${LIBHDF5_LDFLAGS}" ], [ HDF5_CFLAGS="" HDF5_LIBS="" ]) fi fi AC_CHECK_HEADER([hdf5.h], [], [AC_MSG_ERROR([Couldn't find hdf5 header])]) AC_CHECK_LIB([hdf5],[H5Fopen],HAVE_HDF5="yes") if test "${HAVE_HDF5}" != "yes" ; then AC_MSG_ERROR([Couldn't find hdf5 libraries.]) else if test "${HDF5_CFLAGS}" = ""; then CPPFLAGS="${CPPFLAGS} -DH5_USE_16_API" LIBHDF5_LDFLAGS="-lhdf5 -lhdf5_hl" fi fi AC_SUBST(LIBHDF5_LDFLAGS) AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug],[build stimfit in debug mode]),[ ]) if test "$enable_debug" = "yes" ; then CPPFLAGS="${CPPFLAGS} -D_STFDEBUG " OPT_CXXFLAGS="-O0 -g3" CFLAGS="${CFLAGS} -O0 -g3" else OPT_CXXFLAGS="-O2 -g" CFLAGS="${CFLAGS} -O2 -g" fi AC_SUBST(OPT_CXXFLAGS) # gtest GT_CPPFLAGS="" GT_CXXFLAGS="" GT_LIBS="-lpthread" GT_LDFLAGS="" AC_SUBST(GT_CPPFLAGS) AC_SUBST(GT_CXXFLAGS) AC_SUBST(GT_LIBS) AC_SUBST(GT_LDFLAGS) # end gtest # CPPFLAGS="${CPPFLAGS} -DSTFDATE='\"${BUILDDATE}\"'" CXXFLAGS="${CXXFLAGS} -Wall" AC_CONFIG_HEADERS([stfconf.h]) AC_CONFIG_FILES([Makefile src/Makefile src/libstfio/Makefile src/libstfnum/Makefile src/libbiosiglite/Makefile src/pystfio/Makefile src/stimfit/Makefile src/stimfit/py/Makefile dist/macosx/stimfit.plist]) AC_OUTPUT stimfit-0.16.0/src/0000775000175000017500000000000013567226445011065 500000000000000stimfit-0.16.0/src/stimfit/0000775000175000017500000000000013567226445012544 500000000000000stimfit-0.16.0/src/stimfit/stf.cpp0000664000175000017500000000620213277303516013755 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file stf.cpp * \author Christoph Schmidt-Hieber * \date 2011-10-01 * \brief General functions for stf * * * Implements some general functions within the stf namespace */ #include "stf.h" #if 0 wxString stf::sectionToString(const Section& section) { wxString retString; retString << (int)section.size() << wxT("\n"); for (int n=0;n<(int)section.size();++n) { retString << section.GetXScale()*n << wxT("\t") << section[n] << wxT("\n"); } return retString; } wxString stf::CreatePreview(const wxString& fName) { ifstreamMan ASCIIfile( fName ); // Stop reading if we are either at the end or at line 100: wxString preview; ASCIIfile.myStream.ReadAll( &preview ); return preview; } #endif stf::wxProgressInfo::wxProgressInfo(const std::string& title, const std::string& message, int maximum, bool verbose) : ProgressInfo(title, message, maximum, verbose), pd(stf::std2wx(title), stf::std2wx(message), maximum, NULL, wxPD_SMOOTH | wxPD_AUTO_HIDE | wxPD_APP_MODAL ) { } bool stf::wxProgressInfo::Update(int value, const std::string& newmsg, bool* skip) { return pd.Update(value, stf::std2wx(newmsg), skip); } std::string stf::wx2std(const wxString& wxs) { #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) return wxs.ToStdString(); #else return std::string(wxs.mb_str()); #endif } wxString stf::std2wx(const std::string& sst) { #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) /* Problems with direct constructor; copying each character for the time being. return wxString(sst); */ wxString wxs; std::string::const_iterator it; for (it = sst.begin(); it != sst.end(); ++it) { if (*it < 0) wxs += ' '; else wxs += (char)*it; } return wxs; #else return wxString(sst.c_str(), wxConvUTF8); #endif } stf::SectionAttributes::SectionAttributes() : eventList(),pyMarkers(),isFitted(false), isIntegrated(false),fitFunc(NULL),bestFitP(0),quad_p(0),storeFitBeg(0),storeFitEnd(0), storeIntBeg(0),storeIntEnd(0),bestFit(0,0) {} stf::SectionPointer::SectionPointer(Section* pSec, const stf::SectionAttributes& sa) : pSection(pSec), sec_attr(sa) {} stf::Event::Event(std::size_t start, std::size_t peak, std::size_t size, wxCheckBox* cb) : eventStartIndex(start), eventPeakIndex(peak), eventSize(size), checkBox(cb) { checkBox->Show(true); checkBox->SetValue(true); } stf::Event::~Event() { } stimfit-0.16.0/src/stimfit/py/0000775000175000017500000000000013567226446013175 500000000000000stimfit-0.16.0/src/stimfit/py/ivtools.py0000775000175000017500000000756613277303516015177 00000000000000""" Some functions to create I-V curves 2008-03-26, C. Schmidt-Hieber Indices are zero-based! """ import numpy as np # stimfit python module: import stf def analyze_iv( pulses, trace_start = 0, factor = 1.0 ): """Creates an IV for the currently active channel. Keyword arguments: pulses -- Number of pulses for the IV. trace_start -- ZERO-BASED index of the first trace to be used for the IV. Note that this is one less than what is diplayed in the drop-down box. factor -- Multiply result with an optional factor, typically from some external scaling. Returns: True upon success, False otherwise. """ if (stf.check_doc() == False): print("Couldn\'t find an open file; aborting now.") return False if (pulses < 1): print("Number of pulses has to be greater or equal 1.") return False # create an empty array (will contain random numbers) channel = list() for m in range(pulses): # A temporary array to calculate the average: set = np.empty( (int((stf.get_size_channel()-m-1-trace_start)/pulses)+1, stf.get_size_trace( trace_start+m )) ) n_set = 0 for n in range( trace_start+m, stf.get_size_channel(), pulses ): # Add this trace to set: set[n_set,:] = stf.get_trace( n ) n_set = n_set+1 # calculate average and create a new section from it, multiply: channel.append( np.average(set, 0) * factor ) stf.new_window_list( channel ) return True def select_pon( pon_pulses = 8 ): """Selects correction-subtracted pulses from FPulse-generated files. Keyword arguments: pon_pulses -- Number of p-over-n correction pulses. This is typically 4 (for PoN=5 in the FPulse script) or 8 (for PoN=9). Returns: True upon success, False otherwise. """ # Zero-based indices! Hence, for P over N = 8, the first corrected # trace index is 9. for n in range( pon_pulses+1, stf.get_size_channel(), pon_pulses+2 ): if ( stf.select_trace( n ) == False ): # Unselect everything and break if there was an error: stf.unselect_all() return False return True def pon_batch( iv_pulses, pon_pulses = 8, trace_start = 0, subtract_base = False, factor = 1.0 ): """Extracts p-over-n corrected traces in FPulse-generated files, and then creates an IV for the currently active channel. Keyword arguments: iv_pulses -- Number of pulses for the IV. pon_pulses -- Number of p-over-n correction pulses. This is typically 4 (for PoN=5 in the FPulse script) or 8 (for PoN=9). trace_start -- ZERO-BASED index of the first trace to be used for the IV. Note that this is one less than what is diplayed in the drop-down box. subtract_base -- Set to True if you want to subtract the baseline at the end. You will need to set the baseline cursors in the original file to appropriate positions if you want to do this. factor -- Multiply result with an optional factor, typically from some external scaling. Returns: True upon success, False otherwise. """ # Extract corrected pulses: if ( select_pon( pon_pulses ) == False ): return False if ( stf.new_window_selected_this( ) == False ): return False # Create IV: if ( analyze_iv( iv_pulses, trace_start, factor ) == False ): return False # Subtract base: if ( subtract_base == True ): stf.select_all( ) if ( stf.subtract_base( ) == False ): return False return True stimfit-0.16.0/src/stimfit/py/embedded_init.py0000664000175000017500000000235713277303516016242 00000000000000#========================================================================= # embedded_init.py # 2009.12.31 # # This file loads both Numpy and stf modules into the current namespace. # Additionally, it loads the custom initialization script (stf_init.py) # # 2010.06.12 # Major stf classes were added (Recording, Channel, Section) # # It is used by embedded_stf.py and embedded_ipython.py # Please, do not modify this file unless you know what you are doing # #========================================================================= import numpy as np import stf from stf import * from os.path import basename try: from stf_init import * except ImportError: # let the user know stf_init does not work! pass except SyntaxError: pass else: pass def intro_msg(): """ this is the starting message of the embedded Python shell. Contains the current Stimfit version, together with the NumPy and wxPython version. """ # access current versions of wxWidgets and NumPy from wx import version as wx_version from numpy.version import version as numpy_version version_s = 'NumPy %s, wxPython %s' % (numpy_version, wx_version()) intro = '%s, using %s' % (stf.get_versionstring(), version_s) return intro stimfit-0.16.0/src/stimfit/py/pystf.h0000775000175000017500000001126313277303516014431 00000000000000#ifndef _PYSTF_H #define _PYSTF_H #undef _DEBUG #include #undef _DEBUG #include std::string get_versionstring( ); #ifdef WITH_PYTHON PyObject* get_trace(int trace=-1, int channel=-1); #endif bool new_window( double* invec, int size ); bool new_window_matrix( double* inarr, int traces, int size ); bool new_window_selected_this( ); bool new_window_selected_all( ); #ifdef WITH_PYTHON bool show_table( PyObject* dict, const char* caption = "Python table" ); bool show_table_dictlist( PyObject* dict, const char* caption = "Python table", bool reverse = true ); #endif int get_size_trace( int trace = -1, int channel = -1 ); int get_size_channel( int channel = -1 ); int get_size_recording( ); double get_sampling_interval( ); bool set_sampling_interval( double si ); const char* get_xunits( ); const char* get_yunits( int trace = -1, int channel = -1 ); bool set_xunits( const char* units ); bool set_yunits( const char* units, int trace = -1, int channel = -1 ); double get_maxdecay(); double get_maxrise(); const char* get_recording_time( ); const char* get_recording_date( ); std::string get_recording_comment( ); bool set_recording_comment( const char* comment ); bool set_recording_time( const char* time ); bool set_recording_date( const char* date ); bool select_trace( int trace = -1 ); void select_all( ); void unselect_all( ); #ifdef WITH_PYTHON PyObject* get_selected_indices( ); #endif bool set_trace( int trace ); int get_trace_index(); const char* get_trace_name( int trace = -1, int channel = -1 ); bool set_channel( int channel); int get_channel_index( bool active = true ); const char* get_channel_name( int index = -1 ); bool set_channel_name( const char* name, int index = -1 ); void align_selected( double (*alignment)( bool ), bool active = false ); bool subtract_base( ); int leastsq_param_size( int fselect ); #ifdef WITH_PYTHON PyObject* leastsq( int fselect, bool refresh = true ); PyObject* get_fit( int trace = -1, int channel = -1 ); #endif bool check_doc( bool show_dialog = true ); std::string get_filename( ); bool file_open( const char* filename ); bool file_save( const char* filename ); bool close_all( ); bool close_this( ); bool measure( ); double get_base( bool active = true ); double get_base_SD( ); double get_peak( ); double get_halfwidth (bool active = true); #ifdef WITH_PSLOPE double get_pslope(); #endif double get_threshold_time( bool is_time = false ); double get_threshold_value( ); double get_latency(); double get_risetime(); double peak_index( bool active = true ); double maxrise_index( bool active = true ); double maxdecay_index( ); double foot_index( bool active = true ); double rtlow_index( bool active = true ); double rthigh_index( bool active = true ); double t50left_index( bool active = true ); double t50right_index( bool active = true ); double get_risetime_factor(); bool set_risetime_factor(double factor); bool set_marker(double x, double y); bool erase_markers(); double get_fit_start( bool is_time = false ); bool set_fit_start( double pos, bool is_time = false ); double get_fit_end( bool is_time = false ); bool set_fit_end( double pos, bool is_time = false ); double get_peak_start( bool is_time = false ); bool set_peak_start( double pos, bool is_time = false ); double get_peak_end( bool is_time = false ); bool set_peak_end( double pos, bool is_time = false ); int get_peak_mean( ); bool set_peak_mean( int pts ); const char* get_peak_direction( ); bool set_peak_direction( const char* direction ); double get_base_start( bool is_time = false ); bool set_base_start( double pos, bool is_time = false ); double get_base_end( bool is_time = false ); bool set_base_end( double pos, bool is_time = false ); const char* get_baseline_method( ); bool set_baseline_method( const char* method); const char* get_latency_start_mode( ); bool set_latency_start_mode( const char* direction ); const char* get_latency_end_mode( ); bool set_latency_end_mode( const char* direction ); double get_latency_start( bool is_time = false ); bool set_latency_start( double pos, bool is_time = false ); double get_latency_end( bool is_time = false ); bool set_latency_end( double pos, bool is_time = false ); bool set_slope(double slope); double plot_xmin(); double plot_xmax(); double plot_ymin(); double plot_ymax(); double plot_y2min(); double plot_y2max(); void _gMatrix_resize( std::size_t channels, std::size_t sections ); void _gNames_resize( std::size_t channels ); void _gMatrix_at( double* invec, int size, int channel, int section ); void _gNames_at( const char* name, int channel ); bool _new_window_gMatrix( ); extern double _figsize[]; #ifdef WITH_PYTHON PyObject* mpl_panel(const std::vector& figsize = std::vector(_figsize, _figsize+2)); #endif #endif stimfit-0.16.0/src/stimfit/py/pystf.i0000775000175000017500000020342613277303516014436 00000000000000#if defined(__WXMAC__) || defined(__WXGTK__) #pragma GCC diagnostic ignored "-Wwrite-strings" #endif %define DOCSTRING "The stf module allows to access a running stimfit application from the embedded python shell." %enddef %module(docstring=DOCSTRING) stf %{ #define SWIG_FILE_WITH_INIT #include "pystf.h" %} %include "numpy.i" %include "std_string.i" %include "std_vector.i" namespace std { %template(vectord) vector; }; %init %{ import_array(); %} %define %apply_numpy_typemaps(TYPE) %apply (TYPE* IN_ARRAY1, int DIM1) {(TYPE* invec, int size)}; %apply (TYPE* IN_ARRAY2, int DIM1, int DIM2) {(TYPE* inarr, int traces, int size)}; %enddef /* %apply_numpy_typemaps() macro */ %apply_numpy_typemaps(double) //-------------------------------------------------------------------- %feature("autodoc", 0) get_versionstring; %feature("docstring", "Returns the current version of Stimfit.") get_versionstring; std::string get_versionstring( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_trace; %feature("kwargs") get_trace; %feature("docstring", """Returns a trace as a 1-dimensional NumPy array. Arguments: trace -- ZERO-BASED index of the trace within the channel. Note that this is one less than what is shown in the drop-down box. The default value of -1 returns the currently displayed trace. channel -- ZERO-BASED index of the channel. This is independent of whether a channel is active or not. The default value of -1 returns the currently active channel. Returns: The trace as a 1D NumPy array.""") get_trace; PyObject* get_trace(int trace=-1, int channel=-1); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) new_window; %feature("docstring", "Creates a new window showing a 1D NumPy array. Arguments: invec -- The NumPy array to be shown. Returns: True upon successful completion, false otherwise.") new_window; bool new_window( double* invec, int size ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) _new_window_gMatrix; %feature("docstring", "Creates a new window from the global matrix. Do not use directly.") _new_window_gMatrix; bool _new_window_gMatrix( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) new_window_matrix; %feature("docstring", "Creates a new window showing a 2D NumPy array. Arguments: inarr -- The NumPy array to be shown. First dimension are the traces, second dimension the sampling points within the traces. Returns: True upon successful completion, false otherwise.") new_window_matrix; bool new_window_matrix( double* inarr, int traces, int size ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) new_window_selected_this; %feature("docstring", "Creates a new window showing the selected traces of the current file. Returns: True if successful.") new_window_selected_this; bool new_window_selected_this( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) new_window_selected_all; %feature("docstring", "Creates a new window showing the selected traces of all open files. Returns: True if successful.") new_window_selected_all; bool new_window_selected_all( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) show_table; %feature("kwargs") show_table; %feature("docstring", "Shows a python dictionary in a results table. The dictionary has to have the form \"string\" : float Arguments: dict -- A dictionary with strings as key values and floating point numbers as values. caption -- An optional caption for the table. Returns: True if successful.") show_table; bool show_table( PyObject* dict, const char* caption = "Python table" ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) show_table_dictlist; %feature("kwargs") show_table_dictlist; %feature("docstring", "Shows a python dictionary in a results table. The dictionary has to have the form \"string\" : list. Arguments: dict -- A dictionary with strings as key values and lists of floating point numbers as values. caption -- An optional caption for the table. reverse -- If True, The table will be filled in column-major order, i.e. dictionary keys will become column titles. Setting it to False has not been implemented yet. Returns: True if successful.") show_table_dictlist; bool show_table_dictlist( PyObject* dict, const char* caption = "Python table", bool reverse = true ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_size_trace; %feature("kwargs") get_size_trace; %feature("docstring", "Retrieves the number of sample points of a trace. Arguments: trace -- ZERO-BASED index of the trace. Default value of -1 will use the currently displayed trace. Note that this is one less than what is displayed in the drop- down list. channel -- ZERO-BASED index of the channel. Default value of -1 will use the current channel. Returns: The number of sample points.") get_size_trace; int get_size_trace( int trace = -1, int channel = -1 ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_size_channel; %feature("kwargs") get_size_channel; %feature("docstring", "Retrieves the number of traces in a channel. Note that at present, stimfit only supports equal-sized channels, i.e. all channels within a file need to have the same number of traces. The channel argument is only for future extensions. Arguments: channel -- ZERO-BASED index of the channel. Default value of -1 will use the current channel. Returns: The number traces in a channel.") get_size_channel; int get_size_channel( int channel = -1 ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_maxdecay; %feature("docstring", "Retrieves the maximal slope of the decay between the peak cursors in the current trace. Uses the currently measured values, i.e. does not update measurements if the peak window cursors have changed. Returns: The maximal slope of the decay, -1.0 upon failure.") get_maxdecay; double get_maxdecay( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_maxrise; %feature("docstring", "Retrieves the maximal slope of the rise between the peak cursors in the current trace. Uses the currently measured values, i.e. does not update measurements if the peak window cursors have changed. Returns: The maximal slope of the rise, -1.0 upon failure.") get_maxrise; double get_maxrise( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_size_recording; %feature("docstring", "Retrieves the number of channels in a recording. Returns: The number of channels in a recording.") get_size_recording; int get_size_recording( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_sampling_interval; %feature("docstring", "Returns the sampling interval. Returns: The sampling interval.") get_sampling_interval; double get_sampling_interval( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_xunits; %feature("docstring", "Returns the x units of the specified section. X units are assumed to be the same for the entire file. Returns: The x units as a string.") get_xunits; const char* get_xunits( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_yunits; %feature("kwargs") get_yunits; %feature("docstring", "Returns the y units of the specified trace. Y units are not allowed to change between traces at present. Arguments: trace -- The zero-based index of the trace of interest. If < 0, the name of the active trace will be returned. channel -- The zero-based index of the channel of interest. If < 0, the active channel will be used. Returns: The x units as a string.") get_yunits; const char* get_yunits( int trace = -1, int channel = -1 ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_yunits; %feature("kwargs") set_yunits; %feature("docstring", "Sets the y unit string of the specified trace. Y units are not allowed to change between traces at present. Arguments: units -- The new y unit string. trace -- The zero-based index of the trace of interest. If < 0, the name of the active trace will be returned. channel -- The zero-based index of the channel of interest. If < 0, the active channel will be used. Returns: True if successful.") set_yunits; bool set_yunits( const char* units, int trace = -1, int channel = -1 ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_xunits; %feature("kwargs") set_xunits; %feature("docstring", "Sets the x unit string for the entire file. Arguments: units -- The new x unit string. Returns: True if successful.") set_xunits; bool set_xunits( const char* units ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_sampling_interval; %feature("docstring", "Sets a new sampling interval. Argument: si -- The new sampling interval. Returns: False upon failure.") set_sampling_interval; bool set_sampling_interval( double si ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) select_trace; %feature("kwargs") select_trace; %feature("docstring", "Selects a trace. Checks for out-of-range indices and stores the baseline along with the trace index. Arguments: trace -- ZERO-BASED index of the trace. Default value of -1 will select the currently displayed trace. Note that this is one less than what is displayed in the drop- down list. Returns: True if the trace could be selected, False otherwise.") select_trace; bool select_trace( int trace = -1 ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) select_all; %feature("docstring", "Selects all traces in the current file. Stores the baseline along with the trace index.") select_all; void select_all( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) unselect_all; %feature("docstring", "Unselects all previously selected traces in the current file.") unselect_all; void unselect_all( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) subtract_base; %feature("docstring", "Subtracts the baseline from the selected traces of the current file, then displays the subtracted traces in a new window. Returns: True if the subtraction was successful, False otherwise.") subtract_base; bool subtract_base( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) subtract_base; %feature("docstring", "Subtracts the baseline from the selected traces of the current file, then displays the subtracted traces in a new window. Returns: True if the subtraction was successful, False otherwise.") subtract_base; bool subtract_base( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) leastsq; %feature("kwargs") leastsq; %feature("docstring", "Fits a function to the data between the current fit cursors. Arguments: fselect -- Zero-based index of the function as it appears in the fit selection dialog. refresh -- To avoid flicker during batch analysis, this may be set to False so that the fitted function will not immediately be drawn. Returns: A dictionary with the best-fit parameters and the least-squared error, or a null pointer upon failure.") leastsq; PyObject* leastsq( int fselect, bool refresh = true ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_fit; %feature("kwargs") get_fit; %feature("docstring", "Get the waveform resulted from the fitting, if available. Arguments: trace -- The zero-based index of the trace of interest. If < 0, the name of the active trace will be returned. channel -- The zero-based index of the channel of interest. If < 0, the active channel will be used. Returns: A 2D Numpy array with the x-values of the fit in the first dimension, and the y-values in the second dimension. None if no fit is available.") get_fit; PyObject* get_fit( int trace = -1, int channel = -1 ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) leastsq_param_size; %feature("docstring", "Retrieves the number of parameters for a function. Arguments: fselect -- Zero-based index of the function as it appears in the fit selection dialog. Returns: The number of parameters for the function with index fselect, or a negative value upon failure.") leastsq_param_size; int leastsq_param_size( int fselect ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) check_doc; %feature("docstring", "Checks whether a file is open. Arguments: show_dialog -- True if an error dialog should be shown if no file is open. Returns: True if a file is open, False otherwise.") check_doc; bool check_doc( bool show_dialog=true ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_filename; %feature("docstring", "Returns the name of the current file.") get_filename; std::string get_filename( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) _gMatrix_resize; %feature("docstring", "Resizes the global matrix. Do not use directly. Arguments: channels -- New number of channels of the global matrix. sections -- New number of sections of the global matrix. ") _gMatrix_resize; void _gMatrix_resize( std::size_t channels, std::size_t sections ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) _gMatrix_at; %feature("docstring", "Sets the valarray at the specified position of the global matrix. Do not use directly. Arguments: invec -- The NumPy array to be used. channel -- The channel index within the global matrix. section -- The seciton index within the global matrix. ") _gMatrix_at; void _gMatrix_at( double* invec, int size, int channel, int section ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) _gNames_resize; %feature("docstring", "Resizes the global names. Do not use directly. Arguments: channels -- New number of channels of the global names. ") _gNames_resize; void _gNames_resize( std::size_t channels ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) _gNames_at; %feature("docstring", "Sets the channel name of the specifies channel. Do not use directly. Arguments: name -- The new channel name channel -- The channel index within the global names. ") _gNames_at; void _gNames_at( const char* name, int channel ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) file_open; %feature("docstring", "Opens a file. Arguments: filename -- The file to be opened. On Windows, use double back- slashes (\"\\\\\\\\\") between directories to avoid con- version to special characters such as \"\\\\t\" or \"\\\\n\". Example usage in Windows: file_open(\"C:\\\\\\data\\\\\\datafile.dat\") Example usage in Linux: file_open(\"/home/cs/data/datafile.dat\") This is surprisingly slow when called from python. Haven't figured out the reason yet. Returns: True if the file could be opened, False otherwise.") file_open; bool file_open( const char* filename ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) file_save; %feature("docstring", "Saves a file. Arguments: filename -- The file to be saved. On Windows, use double back- slashes (\"\\\\\\\\\") between directories to avoid con- version to special characters such as \"\\\\t\" or \"\\\\n\". Example usage in Windows: file_save(\"C:\\\\\\data\\\\\\datafile.dat\") Example usage in Linux: file_save(\"/home/cs/data/datafile.dat\") This is surprisingly slow when called from python. Haven't figured out the reason yet. Returns: True if the file could be saved, False otherwise.") file_save; bool file_save( const char* filename ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_recording_time; %feature("docstring", "Returns the time at which the recording was started as a string.") get_recording_time; const char* get_recording_time( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_recording_date; %feature("docstring", "Returns the date at which the recording was started as a string.") get_recording_date; const char* get_recording_date( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_recording_comment; %feature("docstring", "Returns a comment about the recording. ") get_recording_comment; std::string get_recording_comment( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_recording_date; %feature("docstring", "Sets a date about the recording. Argument: date -- A date string. Returns: True upon successful completion.") set_recording_date; bool set_recording_date( const char* date ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_recording_time; %feature("docstring", "Sets a time about the recording. Argument: time -- A time string. Returns: True upon successful completion.") set_recording_time; bool set_recording_time( const char* time ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_recording_comment; %feature("docstring", "Sets a comment about the recording. Argument: comment -- A comment string. Returns: True upon successful completion.") set_recording_comment; bool set_recording_comment( const char* comment ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_recording_comment; %feature("docstring", "Sets a comment about the recording. Argument: comment -- A comment string. Returns: True upon successful completion.") set_recording_comment; bool set_recording_comment( const char* comment ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) close_all; %feature("docstring", "Closes all open files. Returns: True if all files could be closed.") close_all; bool close_all( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) close_this; %feature("docstring", "Closes the currently active file. Returns: True if the file could be closed.") close_this; bool close_this( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_base; %feature("kwargs") get_base; %feature("docstring", "Returns the current baseline value. Uses the currently measured values, i.e. does not update measurements if the peak or base window cursors have changed. Arguments: active -- If True, returns the baseline in the active channel. If False returns the baseline within the reference channel. Returns: The current baseline.") get_base; double get_base( bool active = true); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_peak; %feature("docstring", "Returns the current peak value, measured from zero (!). Uses the currently measured values, i.e. does not update measurements if the peak or base window cursors have changed. Returns: The current peak value, measured from zero (again: !).") get_peak; double get_peak( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- #ifdef WITH_PSLOPE %feature("autodoc", 0) get_pslope; %feature("docstring", "Returns the slope, measured from slope cursor values defined in the cursors settings menu(!). This option is only available under GNU/Linux. Returns: The current slope value.") get_pslope; double get_pslope( ); #endif //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) peak_index; %feature("kwargs") peak_index; %feature("docstring", "Returns the zero-based index of the current peak position in the specified channel. Uses the currently measured values, i.e. does not update measurements if the peak window cursors have changed. Arguments: active -- If True, returns the current peak index of the active channel. Otherwise, returns the current peak index of the reference channel. Returns: The zero-based index in units of sampling points. May be interpolated if more than one point is used for the peak calculation. Returns a negative value upon failure.") peak_index; %callback("%s_cb"); double peak_index( bool active = true ); %nocallback; //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) maxrise_index; %feature("kwargs") maxrise_index; %feature("docstring", "Returns the zero-based index of the maximal slope of rise in the specified channel. Uses the currently measured values, i.e. does not update measurements if the peak window cursors have changed. Arguments: active -- If True, returns the current index of the maximal slope of rise within the active channel. Otherwise, returns the current index of the maximal slope of rise within the reference channel. Returns: The zero-based index of the maximal slope of rise in units of sampling points interpolated between adjacent sampling points. Returns a negative value upon failure.") maxrise_index; %callback("%s_cb"); double maxrise_index( bool active = true ); %nocallback; //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) maxdecay_index; %feature("docstring", "Returns the zero-based index of the maximal slope of decay in the current channel. Uses the currently measured values, i.e. does not update measurements if the peak window cursors have changed. Note that in contrast to maxrise_index, this function only works on the active channel. Returns: The zero-based index of the maximal slope of decay in units of sampling points interpolated between adjacent sampling points. Returns a negative value upon failure.") maxdecay_index; double maxdecay_index( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) foot_index; %feature("kwargs") foot_index; %feature("docstring", "Returns the zero-based index of the foot of an event in the active channel. The foot is the intersection of an interpolated line through the points of 20 and 80% rise with the baseline. Uses the currently measured values, i.e. does not update measurements if the peak or base window cursors have changed. Arguments: active -- If True, returns the current index of the foot within the active channel. Only implemented for the active channel at this time. Will return a negative value and show an error message if active == False. Returns: The zero-based index of the foot of an event in units of sampling points. Interpolates between sampling points. Returns a negative value upon failure.") foot_index; %callback("%s_cb"); double foot_index( bool active = true ); %nocallback; //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) t50left_index; %feature("kwargs") t50left_index; %feature("docstring", "Returns the zero-based index of the left half- maximal amplitude of an event in the specified channel. Uses the currently measured values, i.e. does not update measurements if the peak or base window cursors have changed. Arguments: active -- If True, returns the current index of the left half- maximal amplitude within the active channel. If False, returns the current index of the left half-maximal amplitude within the reference channel. Returns: The zero-based index of the left half-maximal amplitude in units of sampling points. Interpolates between sampling points. Returns a negative value upon failure.") t50left_index; %callback("%s_cb"); double t50left_index( bool active = true ); %nocallback; //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) t50right_index; %feature("kwargs") t50right_index; %feature("docstring", "Returns the zero-based index of the right half- maximal amplitude of an event in the active channel. Uses the currently measured values, i.e. does not update measurements if the peak or base window cursors have changed. Arguments: active -- If True, returns the current index of the right half- maximal amplitude within the active channel. Only implemented for the active channel at this time. Will return a negative value and show an error message if active == False. Returns: The zero-based index of the right half-maximal amplitude in units of sampling points. Interpolates between sampling points. Returns a negative value upon failure.") t50right_index; %callback("%s_cb"); double t50right_index( bool active = true ); %nocallback; //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_halfwidth; %feature("kwargs") get_halfwidth; %feature("docstring", "Returns the half-maximal amplitude of an event in the specified channel. Uses the currently measured values, i.e. does not update measurements if the peak or base window cursors have changed. Only implemented for the active channel. Arguments: active -- If True, returns the current half-maximal amplitude within the active channel. Returns: The half-maximal amplitude in units of x-units. Returns a negative value upon failure.") get_halfwidth; %callback("%s_cb"); double get_halfwidth( bool active = true ); %nocallback; //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) rtlow_index; %feature("kwargs") rtlow_index; %feature("docstring", "Returns the zero-based index of the lower rise- time of an event in the specified channel. Uses the currently measured values, i.e. does not update measurements if the peak or base window cursors have changed. Arguments: active -- If True, returns the current index within the active channel. If False, returns the current index within the reference channel. Returns: The zero-based index of the lower rise time in units of sampling points. Interpolates between sampling points. Returns a negative value upon failure.") rtlow_index; %callback("%s_cb"); double rtlow_index( bool active = true ); %nocallback; //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) rthigh_index; %feature("kwargs") rthigh_index; %feature("docstring", "Returns the zero-based index of the higher rise time of an event in the specified channel. Uses the currently measured values, i.e. does not update measurements if the peak or base window cursors have changed. Arguments: active -- If True, returns the current index within the active channel. If False, returns the current index within the reference channel. Returns: The zero-based index of the higher rise time in units of sampling points. Interpolates between sampling points. Returns a negative value upon failure.") rthigh_index; %callback("%s_cb"); double rthigh_index( bool active = true ); %nocallback; //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_threshold_time; %feature("kwargs") get_threshold_time; %feature("docstring", "Returns the crossing value of the threshold slope. Note that this value is not updated after changing the AP threshold. Call measure() or hit enter to update the cursors. Arguments: is_time -- If False (default), returns the zero-based index at which the threshold slope is crossed (e.g in mV). If True, returns the time point at which the threshold slope is crossed. A negative number is returned upon failure. ") get_threshold_time; double get_threshold_time( bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_latency; %feature("docstring", "Returns the latency value (in x-units) determined by the latency cursors set in the cursors settings menu. Call measure() or hit enter to update the cursors. ") get_latency; double get_latency( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_risetime; %feature("docstring", "Returns the rise time (in x-units) determined by the linear interpolation between sampling points (e.g at 20% and 80% of the peak amplitude. ) Call measure() or hit enter to update the cursors. ") get_risetime; double get_risetime( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_risetime_factor; %feature("docstring", "Returns the lower proportion factor used to calculate the rise time (e.g 0.2 if we calculate the 20--80% rise time. ) ") get_risetime_factor; double get_risetime_factor( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_risetime_factor; %feature("kwargs") set_risetime_factor; %feature("docstring", "Sets the lower proportion factor to calculate the rise time (e.g 0.2 if we want to calculate the 20--80% rise time. ) It will update the rise time measurement. Arguments: factor -- the low proportion factor to calculate rise time Returns: False upon failure (such as factor lower than 0.05 or larger than 0.5) ") set_risetime_factor; bool set_risetime_factor(double factor); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_threshold_value; %feature("docstring", "Returns the value found at the threshold slope. Note that this value is not updated after changing the AP threshold. Call measure or hit enter to update the threshold. ") get_threshold_value; double get_threshold_value( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_fit_start; %feature("kwargs") get_fit_start; %feature("docstring", "Returns the zero-based index or the time point of the fit start cursor. Arguments: is_time -- If False (default), returns the zero-based index. If True, returns the time from the beginning of the trace to the cursor position. ") get_fit_start; double get_fit_start( bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_fit_end; %feature("kwargs") get_fit_end; %feature("docstring", "Returns the zero-based index or the time point of the fit end cursor. Arguments: is_time -- If False (default), returns the zero-based index. If True, returns the time from the beginning of the trace to the cursor position. ") get_fit_end; double get_fit_end( bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_fit_start; %feature("kwargs") set_fit_start; %feature("docstring", "Sets the fit start cursor to a new position. Arguments: pos -- The new cursor position, either in units of sampling points if is_time == False (default) or in units of time if is_time == True. is_time -- see above. Returns: False upon failure (such as out-of-range).") set_fit_start; bool set_fit_start( double pos, bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_fit_end; %feature("kwargs") set_fit_end; %feature("docstring", "Sets the fit end cursor to a new position. Arguments: pos -- The new cursor position, either in units of sampling points if is_time == False (default) or in units of time if is_time == True. is_time -- see above. Returns: False upon failure (such as out-of-range).") set_fit_end; bool set_fit_end( double pos, bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_peak_start; %feature("kwargs") get_peak_start; %feature("docstring", "Returns the zero-based index or the time point of the peak start cursor. Arguments: is_time -- If False (default), returns the zero-based index. If True, returns the time from the beginning of the trace to the cursor position. ") get_peak_start; double get_peak_start( bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_peak_end; %feature("kwargs") get_peak_end; %feature("docstring", "Returns the zero-based index or the time point of the peak end cursor. Arguments: is_time -- If False (default), returns the zero-based index. If True, returns the time from the beginning of the trace to the cursor position. ") get_peak_end; double get_peak_end( bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_peak_start; %feature("kwargs") set_peak_start; %feature("docstring", "Sets the peak start cursor to a new position. This will NOT update the peak calculation. You have to either call measure() or hit enter in the main window to achieve that. Arguments: pos -- The new cursor position, either in units of sampling points if is_time == False (default) or in units of time if is_time == True. is_time -- see above. Returns: False upon failure (such as out-of-range).") set_peak_start; bool set_peak_start( double pos, bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_peak_end; %feature("kwargs") set_peak_end; %feature("docstring", "Sets the peak end cursor to a new position. This will NOT update the peak calculation. You have to either call measure() or hit enter in the main window to achieve that. Arguments: pos -- The new cursor position, either in units of sampling points if is_time == False (default) or in units of time if is_time == True. is_time -- see above. Returns: False upon failure (such as out-of-range).") set_peak_end; bool set_peak_end( double pos, bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_peak_mean; %feature("docstring", "Sets the number of points used for the peak calculation. Arguments: pts -- A moving average (aka sliding, boxcar or running average) is used to determine the peak value. Pts specifies the number of sampling points used for the moving window. Passing a value of -1 will calculate the average of all sampling points within the peak window. Returns: False upon failure (such as out-of-range).") set_peak_mean; bool set_peak_mean( int pts ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_peak_mean; %feature("docstring", "Returns the number of sampling points used for the peak calculation. Returns: 0 upon failure (i.e no file opened). -1 means average of all sampling points within the peak window.") get_peak_mean; int get_peak_mean( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_peak_direction; %feature("docstring", "Sets the direction of the peak detection. Arguments: direction -- A string specifying the peak direction. Can be one of: \"up\", \"down\" or \"both\" Returns: False upon failure.") set_peak_direction; bool set_peak_direction( const char* direction ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_peak_direction; %feature("docstring", "Gets the current direction of the detection for the peak cursors. Returns: A string specifying the peak direction. Can be one of: \"up\", \"down\" or \"both\"") get_peak_direction; const char* get_peak_direction( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_latency_start; %feature("kwargs") set_latency_start; %feature("docstring", "Sets the first latency cursor to a new position. Arguments: pos -- The new cursor position, either in units of sampling points if is_time == False (default) or in units of time if is_time == True. is_time -- see above. Returns: False upon failure (such as out-of-range).") set_latency_start; bool set_latency_start( double pos, bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_latency_start_mode; %feature("docstring", "Sets the mode of the latency start cursor. Arguments: direction -- A string specifying the mode for the latency start cursor. Can be one of \"manual\", \"peak\", \"rise\" or \"half\" Returns: False upon failure.") set_latency_start_mode; bool set_latency_start_mode( const char* mode ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_baseline_method; %feature("docstring", "Gets the method used to compute the baseline Returns: A string specifying the method to compute the baseline. Can be one of \"mean\" or \"median\"") get_baseline_method; const char* get_baseline_method( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_baseline_method; %feature("docstring", "Sets the method to compute the baseline. Arguments: method -- A string specifying the method to calculate the baseline. Can be one of \"mean\" or \"median\" Returns: False upon failure.") set_baseline_method; bool set_baseline_method( const char* method ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_latency_start_mode; %feature("docstring", "Gets the latency start mode Returns: A string specifying the latency start mode. Can be one of \"manual\", \"peak\", \"rise\" or \"half\"") get_latency_start_mode; const char* get_latency_start_mode( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_latency_end; %feature("kwargs") set_latency_end; %feature("docstring", "Sets the second latency cursor to a new position. Arguments: pos -- The new cursor position, either in units of sampling points if is_time == False (default) or in units of time if is_time == True. is_time -- see above. Returns: False upon failure (such as out-of-range).") set_latency_end; bool set_latency_end( double pos, bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_latency_end_mode; %feature("docstring", "Sets the mode of the latency end cursor. Arguments: direction -- A string specifying the mode for the latency end cursor. Can be one of \"manual\", \"peak\", \"rise\", \"foot\" or \"half\" Returns: False upon failure.") set_latency_end_mode; bool set_latency_end_mode( const char* mode ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_latency_end_mode; %feature("docstring", "Gets the latency end mode Returns: A string specifying the latency end mode. Can be one of \"manual\", \"peak\", \"rise\", \"foot\" or \"half\"") get_latency_end_mode; const char* get_latency_end_mode( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_latency_start; %feature("kwargs") get_latency_start; %feature("docstring", "Returns the zero-based index or the time point of the latency start cursor. Arguments: is_time -- If False (default), returns the zero-based index. If True, returns the time from the beginning of the trace to the cursor position.") get_latency_start; double get_latency_start( bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_latency_end; %feature("kwargs") get_latency_end; %feature("docstring", "Returns the zero-based index or the time point of the latency end cursor. Arguments: is_time -- If False (default), returns the zero-based index. If True, returns the time from the beginning of the trace to the cursor position.") get_latency_end; double get_latency_end( bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_base_SD; %feature("docstring", "Returns the standard deviation of the baseline in the current (active) channel. Uses the currently measured values, i.e. does not update measurements if the baseline cursors have changed. Returns: 0.0 upon failure (i.e no file opened), otherwise, the standard deviation of the baseline.") get_base_SD; double get_base_SD( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_base_start; %feature("kwargs") get_base_start; %feature("docstring", "Returns the zero-based index or the time point of the base start cursor. Arguments: is_time -- If False (default), returns the zero-based index. If True, returns the time from the beginning of the trace to the cursor position.") get_base_start; double get_base_start( bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_base_end; %feature("kwargs") get_base_end; %feature("docstring", "Returns the zero-based index or the time point of the base end cursor. Arguments: is_time -- If False (default), returns the zero-based index. If True, returns the time from the beginning of the trace to the cursor position.") get_base_end; double get_base_end( bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_base_start; %feature("kwargs") set_base_start; %feature("docstring", "Sets the base start cursor to a new position. This will NOT update the baseline calculation. You have to either call measure() or hit enter in the main window to achieve that. Arguments: pos -- The new cursor position, either in units of sampling points if is_time == False (default) or in units of time if is_time == True. is_time -- see above. Returns: False upon failure (such as out-of-range).") set_base_start; bool set_base_start( double pos, bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_base_end; %feature("kwargs") set_base_end; %feature("docstring", "Sets the base end cursor to a new position. This will NOT update the baseline calculation. You have to either call measure() or hit enter in the main window to achieve that. Arguments: pos -- The new cursor position, either in units of sampling points if is_time == False (default) or in units of time if is_time == True. is_time -- see above. Returns: False upon failure (such as out-of-range).") set_base_end; bool set_base_end( double pos, bool is_time = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_slope; %feature("docstring", "Sets the AP threshold to the value given by the slope and takes it as reference for AP kinetic measurements. Note that you have to either call measure() or hit enter to update calculations. Arguments: slope -- slope value in mV/ms Returns: False upon failure (such as out-of-range).") set_slope; bool set_slope( double slope); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) measure; %feature("docstring", "Updates all measurements (e.g. peak, baseline, latency) according to the current cursor settings. As if you had pressed \"Enter\" in the main window. Returns: False upon failure, True otherwise.") measure; bool measure( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_selected_indices; %feature("docstring", "Returns a tuple with the indices (ZERO-BASED) of the selected traces.") get_selected_indices; PyObject* get_selected_indices( ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_trace; %feature("docstring", "Sets the currently displayed trace to a new index. Subsequently updates all measurements (e.g. peak, base, latency, i.e. you don't need to call measure() yourself.) Arguments: trace -- The zero-based index of the new trace to be displayed. Returns: True upon success, false otherwise (such as out-of-range).") set_trace; bool set_trace( int trace ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_trace_index; %feature("docstring", "Returns the ZERO-BASED index of the currently displayed trace (this is one less than what is shown in the combo box). ") get_trace_index; int get_trace_index(); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_channel_index; %feature("kwargs") get_channel_index; %feature("docstring", "Returns the ZERO-BASED index of the specified channel. Arguments: active -- If True, returns the index of the active (black) channel. If False, returns the index of the reference (red) channel. ") get_channel_index; int get_channel_index( bool active = true ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_channel_name; %feature("kwargs") get_channel_name; %feature("docstring", "Returns the name of the channel with the specified index. Arguments: index -- The zero-based index of the channel of interest. If < 0, the name of the active channel will be returned. Returns: the name of the channel with the specified index.") get_channel_name; const char* get_channel_name( int index = -1 ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_channel; %feature("docstring", "Sets the currently displayed channel to a new index. Subsequently updates all measurements (e.g. peak, base, latency, i.e. you don't need to call measure() yourself.) Arguments: channel -- The zero-based index of the new trace to be displayed. Returns: True upon success, false otherwise (such as out-of-range).") set_channel; bool set_channel( int channel); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_channel_name; %feature("kwargs") set_channel_name; %feature("docstring", "Sets the name of the channel with the specified index. Arguments: name -- The new name of the channel. index -- The zero-based index of the channel of interest. If < 0, the active channel will be used. Returns: True upon success.") set_channel_name; bool set_channel_name( const char* name, int index = -1 ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) get_trace_name; %feature("kwargs") get_trace_name; %feature("docstring", "Returns the name of the trace with the specified index. Arguments: trace -- The zero-based index of the trace of interest. If < 0, the name of the active trace will be returned. channel -- The zero-based index of the channel of interest. If < 0, the active channel will be used. Returns: the name of the trace with the specified index.") get_trace_name; const char* get_trace_name( int trace = -1, int channel = -1 ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) align_selected; %feature("kwargs") align_selected; %feature("docstring", "Aligns the selected traces to the index that is returned by the alignment function, and then creates a new window showing the aligned traces. This function requires to select the traces of interest and the presence of a second (i.e reference) channel. Arguments: alignment -- The alignment function to be used. Accepts any function returning a valid index within a trace. These are some predefined possibilities: maxrise_index (default; maximal slope during rising phase) peak_index (Peak of an event) foot_index (Beginning of an event) t50left_index t50right_index (Left/right half-maximal amplitude) active -- If True, the alignment function will be applied to the active channel. If False (default), it will be applied to the reference channel. zeropad -- Not yet implemented: If True, missing parts at the beginning or end of a trace will be padded with zeros after the alignment. If False (default), traces will be cropped so that all traces have equal sizes. ") align_selected; void align_selected( double (*alignment)( bool ), bool active = false ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) set_marker; %feature("docstring", "Sets a marker to the specified position in the current trace. Arguments: x -- The horizontal marker position in units of sampling points. y -- The vertical marker position in measurement units (e.g. mV). Returns: False upon failure (such as out-of-range).") set_marker; bool set_marker( double x, double y ); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) erase_markers; %feature("docstring", "Erases all markers in the current trace. Returns: False upon failure.") erase_marker; bool erase_markers(); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) plot_xmin; %feature("docstring", "Returns x value of the left screen border") plot_xmin; double plot_xmin(); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) plot_xmax; %feature("docstring", "Returns x value of the right screen border") plot_xmax; double plot_xmax(); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) plot_ymin; %feature("docstring", "Returns y value of the bottom screen border") plot_ymin; double plot_ymin(); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) plot_ymax; %feature("docstring", "Returns y value of the top screen border") plot_ymax; double plot_ymax(); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) plot_y2min; %feature("docstring", "Returns y value of the bottom screen border for the reference channel") plot_y2min; double plot_y2min(); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) plot_y2max; %feature("docstring", "Returns y value of the top screen border for the reference channel") plot_y2max; double plot_y2max(); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %feature("autodoc", 0) mpl_panel; %feature("kwargs") mpl_panel; %feature("docstring", "Returns a pointer to the parent window") mpl_panel; PyObject* mpl_panel(const std::vector& figsize = std::vector(_figsize, _figsize+2)); //-------------------------------------------------------------------- //-------------------------------------------------------------------- %pythoncode { class StfException(Exception): """ raises Exceptions for the Stfio module """ def __init__(self, error_msg): self.msg = error_msg def __str__(self): return repr(self.msg) def new_window_list( array_list ): """Creates a new window showing a sequence of 1D NumPy arrays, or a sequence of a sequence of 1D NumPy arrays. As opposed to new_window_matrix(), this has the advantage that the arrays need not have equal sizes. Arguments: array_list -- A sequence (e.g. list or tuple) of numpy arrays, or a sequence of a sequence of numpy arrays. Returns: True upon successful completion, false otherwise. """ try: it = iter(array_list) except TypeError: print( "Argument is not a sequence" ) return False try: it = iter(array_list[0]) except TypeError: print( "Argument is not a sequence of sequences." ) print( "You can either pass a sequence of 1D NumPy arrays," ) print( "Or a sequence of sequences of 1D NumPy arrays." ) return False is_3d = True try: it = iter(array_list[0][0]) except TypeError: is_3d = False n_channels = 1 if is_3d: n_channels = len(array_list) _gMatrix_resize( n_channels, len(array_list[0]) ) for (n_c, c) in enumerate(array_list): for (n_s, s) in enumerate(c): _gMatrix_at( s, n_c, n_s ) else: _gMatrix_resize( n_channels, len(array_list) ) for (n, a) in enumerate(array_list): _gMatrix_at( a, 0, n ) return _new_window_gMatrix( ) def stfio_open(stfio_rec): """Open an stfio recording object with Stimfit Arguments: stfio_rec -- An stfio recording object, e.g. opened with stfio.read("filename") Returns: True upon successful completion, false otherwise. """ n_channels = len(stfio_rec) _gMatrix_resize( n_channels, len(stfio_rec[0]) ) for n_c, c in enumerate(stfio_rec): for n_s, s in enumerate(c): _gMatrix_at( c[n_s].asarray(), n_c, n_s ) succ = _new_window_gMatrix( ) if not succ: return False for n_c, c in enumerate(stfio_rec): set_channel_name(c.name, n_c) set_yunits(c.yunits, n_c) set_recording_date(stfio_rec.date) set_recording_time(stfio_rec.time) set_recording_comment(stfio_rec.comment) set_xunits(stfio_rec.xunits) set_sampling_interval(stfio_rec.dt) measure() return True def cut_traces( pt ): """Cuts the selected traces at the sampling point pt, and shows the cut traces in a new window. Returns True upon success, False upon failure.""" if not get_selected_indices(): print( "Trace is not selected!" ) return False new_list = list() for n in get_selected_indices(): if not set_trace(n): return False if pt < get_size_trace(): new_list.append( get_trace()[:pt] ) new_list.append( get_trace()[pt:] ) else: print( "Cutting point %d is out of range" %pt ) if len(new_list) > 0: new_window_list( new_list ) return True def cut_traces_multi( pt_list ): """Cuts the selected traces at the sampling points in pt_list and shows the cut traces in a new window. Returns True upon success, False upon failure.""" if not get_selected_indices(): print( "Trace is not selected!" ) return False new_list = list() for n in get_selected_indices(): if not set_trace(n): return False old_pt = 0 for pt in pt_list: if pt < get_size_trace(): new_list.append( get_trace()[old_pt:pt] ) old_pt = pt else: print( "Cutting point %d is out of range" %pt ) if len(new_list) > 0: new_list.append( get_trace()[old_pt:] ) new_window_list( new_list ) return True def template_matching(template, mode="criterion", norm=True, lowpass=0.5, highpass=0.0001): import sys sys.stderr.write("template_matching is deprecated. Use detect_events instead.\n") return detect_events(template, mode, norm, lowpass, highpass) def detect_events(template, mode="criterion", norm=True, lowpass=0.5, highpass=0.0001): if not check_doc(): return None import stfio return stfio.detect_events(get_trace(), template, get_sampling_interval(), mode, norm, lowpass, highpass) def peak_detection(data, threshold, min_distance): import stfio return stfio.peak_detection(data, threshold, min_distance) class _cursor_pair(object): def __init__(self, get_start, set_start, get_end, set_end, get_value=None, index=None): self._get_start = get_start self._set_start = set_start self._get_end = get_end self._set_end = set_end self._get_value = get_value self._index = index def _get_cursors(self, is_time): if not check_doc(show_dialog=False): raise StfException("Couldn't find open file") return (self._get_start(is_time=is_time), self._get_end(is_time=is_time)) def _set_cursors(self, cursors, is_time): if not check_doc(show_dialog=False): raise StfException("Couldn't find open file") try: if len(cursors) != 2: raise ValueError("cursors has to have length 2 when setting the time value") except TypeError: raise TypeError("cursors has to be a tuple or list of length 2") if cursors[0] is not None: self._set_start(cursors[0], is_time=is_time) if cursors[1] is not None: self._set_end(cursors[1], is_time=is_time) @property def cursor_time(self): return self._get_cursors(True) @cursor_time.setter def cursor_time(self, cursors): self._set_cursors(cursors, True) @property def cursor_index(self): return self._get_cursors(False) @cursor_index.setter def cursor_index(self, cursors): self._set_cursors(cursors, False) @property def value(self): if self._get_value is None: raise AttributeError("Missing _get_value function") return self._get_value() @property def index(self): if self._index is None: raise AttributeError("Missing _index function") return self._index() base = _cursor_pair(get_base_start, set_base_start, get_base_end, set_base_end, get_base) peak = _cursor_pair(get_peak_start, set_peak_start, get_peak_end, set_peak_end, get_peak, peak_index) fit = _cursor_pair(get_fit_start, set_fit_start, get_fit_end, set_fit_end) latency = _cursor_pair( get_latency_start, set_latency_start, get_latency_end, set_latency_end, get_latency) } //-------------------------------------------------------------------- stimfit-0.16.0/src/stimfit/py/gccwarn0000664000175000017500000000023413277303516014453 00000000000000#if defined(__WXMAC__) || defined(__WXGTK__) #pragma GCC diagnostic ignored "-Wuninitialized" #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif stimfit-0.16.0/src/stimfit/py/minidemo.py0000775000175000017500000000322413354367041015263 00000000000000""" minidemo.py This script sets base, peak and fit cursors to perform events detection as decribed in the Stimfit manual [1] It creates a preliminary and final templates from a file 'minis.dat'. You can download the file here: http://stimfit.org/tutorial/minis.dat last revision: Wed Sep 5 09:38:41 CEST 2018 C. Schmidt-Hieber [1] https://neurodroid.github.io/stimfit/manual/event_extraction.html """ import stf from wx import MessageBox if stf.get_filename()[-9:] != 'minis.dat': MessageBox('Use minis.dat for this demo.', 'Warning') def preliminary(): """ Sets peak, base and fit cursors around a synaptic event and performs a biexponential fit to create the preliminary template for event detection. """ stf.base.cursor_index = (209600, 209900) stf.peak.cursor_index = (209900, 210500) stf.fit.cursor_index = (209900, 210400) stf.set_peak_mean(3) stf.measure() # update cursors return stf.leastsq(5) def final(): """ Sets peak, base and fit cursors around a synaptic event and performs a biexponetial fit to create the final template for event detection. """ stf.base.cursor_index = (000, 100) stf.peak.cursor_index = (100, 599) stf.fit.cursor_index = (100, 599) stf.set_peak_mean(3) stf.measure() # update cursors return stf.leastsq(5) def batch_cursors(): """ Sets peak, base and fit cursors around a synaptic event for the batch analysis of the extracted events. """ stf.base.cursor_index = (000, 100) stf.peak.cursor_index = (100, 598) stf.fit.cursor_index = (120, 598) stf.set_peak_mean(3) stf.measure() # update cursors stimfit-0.16.0/src/stimfit/py/mintools.py0000775000175000017500000000200413277303516015322 00000000000000""" 2008-04-11, C. Schmidt-Hieber Some helper functions for least-squares mimization using SciPy """ from scipy.optimize import leastsq import numpy as np import stf def fexpbde(p,x): tpeak = p[3]*p[1]*np.log(p[3]/p[1])/(p[3]-p[1]) adjust = 1.0/((1.0-np.exp(-tpeak/p[3]))-(1.0-np.exp(-tpeak/p[1]))); e1=np.exp((p[0]-x)/p[1]); e2=np.exp((p[0]-x)/p[3]); # normalize the amplitude so that the peak really is the peak: ret = adjust*p[2]*e1 - adjust*p[2]*e2 + stf.get_base(); start_index = 0 for elem in x: if ( elem < p[0] ): start_index = start_index+1 else: break ret[ 0 : start_index ] = stf.get_base() return ret def leastsq_stf(p,y,lsfunc,x): return y - lsfunc(p,x) def stf_fit( p0, lsfunc ): data = stf.get_trace()[ stf.get_fit_start() : stf.get_fit_end() ] dt = stf.get_sampling_interval() x = np.arange(0, len(data)*dt, dt) plsq = leastsq(leastsq_stf, p0, args=(data, lsfunc, x)) return plsq[0] stimfit-0.16.0/src/stimfit/py/heka.py0000664000175000017500000000530213277303516014367 00000000000000import sys import numpy as np def read_heka(filename): ascfile = open(filename) nchannels = 0 nsweeps = 0 newsweep = True header = True channels = [] channelnames = [] channelunits = [] channeldt = [] istext=False sys.stdout.write("Reading") sys.stdout.flush() for line in ascfile: words = line.replace('\r','').replace('\n','').split(",") try: np = int(words[0]) istext=False except: istext = True if not header: newsweep=True else: prevline = words if not istext: if header: nchannels = (len(words)-1)/2 channels = [list() for i in range(nchannels)] for nc in range(nchannels): channelnames.append( prevline[nc*2+2].replace("\"",'').strip()[:-3]) channelunits.append( prevline[nc*2+2][prevline[nc*2+2].find('[')+1: \ prevline[nc*2+2].find(']')]) header=False if newsweep: for channel in channels: channel.append(list()) nsweeps += 1 sys.stdout.write(".") sys.stdout.flush() newsweep=False if len(channels[-1][-1])==0: dt0 = float(words[1]) if len(channels[-1][-1])==1: dt1 = float(words[1]) channeldt.append(dt1-dt0) for nc, channel in enumerate(channels): channel[-1].append(float(words[nc*2+2])) return channels, channelnames, channelunits, channeldt def read_heka_stf(filename): channels, channelnames, channelunits, channeldt = read_heka(filename) for nc, channel in enumerate(channels): if channelunits[nc]=="V": for ns, sweep in enumerate(channel): channels[nc][ns] = np.array(channels[nc][ns]) channels[nc][ns] *= 1.0e3 channelunits[nc]="mV" if channelunits[nc]=="A": for ns, sweep in enumerate(channel): channels[nc][ns] = np.array(channels[nc][ns]) channels[nc][ns] *= 1.0e12 channelunits[nc]="pA" import stf stf.new_window_list(channels) for nc, name in enumerate(channelnames): stf.set_channel_name(name, nc) for nc, units in enumerate(channelunits): for ns in range(stf.get_size_channel()): stf.set_yunits(units, ns, nc) stf.set_sampling_interval(channeldt[0]*1e3) if __name__=="__main__": read_heka("JK100205aa.asc") stimfit-0.16.0/src/stimfit/py/tdms.py0000664000175000017500000000026413277303516014430 00000000000000import numpy as np import stf import stfio def tdms_open(fn): record = stfio.read_tdms(fn) if record is None: return None return record['data'], record['dt'] stimfit-0.16.0/src/stimfit/py/pystf.cxx0000775000175000017500000015166513567226230015016 00000000000000#include #include #ifndef WX_PRECOMP #include "wx/wx.h" #endif #ifdef _WINDOWS #ifdef _DEBUG #undef _DEBUG #define _UNDEBUG #endif #endif #ifdef _POSIX_C_SOURCE #define _POSIX_C_SOURCE_WAS_DEF #undef _POSIX_C_SOURCE #endif #ifdef _XOPEN_SOURCE #define _XOPEN_SOURCE_WAS_DEF #undef _XOPEN_SOURCE #endif #ifdef WITH_PYTHON #include #endif #ifdef _POSIX_C_SOURCE_WAS_DEF #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE #endif #endif #ifdef _XOPEN_SOURCE_WAS_DEF #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE #endif #endif #if defined(__WXMAC__) || defined(__WXGTK__) #pragma GCC diagnostic ignored "-Wwrite-strings" #endif #ifdef WITH_PYTHON #if PY_MAJOR_VERSION >= 3 #include #include #define PyInt_FromLong PyLong_FromLong #define PyString_AsString PyBytes_AsString #else #include #endif #endif // revert to previous behaviour #if defined(__WXMAC__) || defined(__WXGTK__) #pragma GCC diagnostic warning "-Wwrite-strings" #endif #ifdef _WINDOWS #ifdef _UNDEBUG #define _DEBUG #endif #endif #ifdef WITH_PYTHON #include #endif #include "pystf.h" #include "./../gui/app.h" #include "./../gui/doc.h" #include "./../gui/view.h" #include "./../gui/graph.h" #include "./../gui/parentframe.h" #include "./../gui/childframe.h" #include "./../gui/dlgs/cursorsdlg.h" #include "./../../libstfnum/fit.h" #ifdef WITH_PYTHON #define array_data(a) (((PyArrayObject *)a)->data) #endif std::vector< std::vector< Vector_double > > gMatrix; std::vector< std::string > gNames; double _figsize[] = {8.0,6.0}; #if PY_MAJOR_VERSION >= 3 int wrap_array() { #ifdef WITH_PYTHON import_array(); return 0; #else return 0; #endif } #else void wrap_array() { #ifdef WITH_PYTHON import_array(); #endif } #endif void ShowExcept(const std::exception& e) { wxString msg; msg << wxT("Caught an exception in the python module:\n") << wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg( msg ); return; } void ShowError( const wxString& msg ) { wxString fullmsg; fullmsg << wxT("Error in the python module:\n") << msg; wxGetApp().ErrorMsg( msg ); return; } wxStfDoc* actDoc() { return wxGetApp().GetActiveDoc(); } wxStfGraph* actGraph() { if ( !check_doc() ) return NULL; wxStfView* pView=(wxStfView*)actDoc()->GetFirstView(); if ( !pView ) return NULL; return pView->GetGraph(); } bool refresh_graph() { wxStfGraph* pGraph = actGraph(); if ( !pGraph ) { ShowError( wxT("Pointer to graph is zero") ); return false; } pGraph->Refresh(); return true; } // update data and labels in the results box bool update_results_table(){ wxStfChildFrame* pFrame = (wxStfChildFrame*)actDoc()->GetDocumentWindow(); if (!pFrame) { ShowError( wxT("Error in update_results_table()") ); return false; } wxGetApp().OnPeakcalcexecMsg(); pFrame->UpdateResults(); return true; } void write_stf_registry(const wxString& item, int value){ wxGetApp().wxWriteProfileInt(wxT("Settings"), item, value); } bool update_cursor_dialog( ) { if (wxGetApp().GetCursorsDialog()!=NULL && wxGetApp().GetCursorsDialog()->IsShown()) { try { wxGetApp().GetCursorsDialog()->UpdateCursors(); } catch (const std::runtime_error& e) { ShowExcept( e ); // We don't necessarily need to return false here. } } return refresh_graph(); } bool check_doc( bool show_dialog ) { if (actDoc() == NULL) { if (show_dialog) ShowError( wxT("Couldn't find open file") ); return false; } return true; } std::string get_filename( ) { if ( !check_doc() ) return 0; #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) return std::string(actDoc()->GetFilename()); #else return std::string(actDoc()->GetFilename().mb_str()); #endif } std::string get_versionstring() { #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) return std::string(wxGetApp().GetVersionString()); #else return std::string(wxGetApp().GetVersionString().mb_str()); #endif } #ifdef WITH_PYTHON PyObject* get_trace(int trace, int channel) { wrap_array(); if ( !check_doc() ) return NULL; if ( trace == -1 ) { trace = actDoc()->GetCurSecIndex(); } if ( channel == -1 ) { channel = actDoc()->GetCurChIndex(); } npy_intp dims[1] = {(int)actDoc()->at(channel).at(trace).size()}; PyObject* np_array = PyArray_SimpleNew(1, dims, NPY_DOUBLE); double* gDataP = (double*)array_data(np_array); /* fill */ std::copy( (*actDoc())[channel][trace].get().begin(), (*actDoc())[channel][trace].get().end(), gDataP); return np_array; } #endif bool new_window( double* invec, int size ) { bool open_doc = actDoc() != NULL; std::vector< double > va(size); std::copy( &invec[0], &invec[size], va.begin() ); Section sec(va); Channel ch(sec); if (open_doc) { ch.SetYUnits( actDoc()->at( actDoc()->GetCurChIndex() ).GetYUnits() ); } Recording new_rec( ch ); if (open_doc) { new_rec.SetXScale( actDoc()->GetXScale() ); } wxStfDoc* testDoc = wxGetApp().NewChild( new_rec, actDoc(), wxT("From python") ); if ( testDoc == NULL ) { ShowError( wxT("Failed to create a new window.") ); return false; } return true; } bool _new_window_gMatrix( ) { bool open_doc = actDoc() != NULL; Recording new_rec( gMatrix.size() ); for (std::size_t n_c=0; n_c < new_rec.size(); ++n_c) { Channel ch( gMatrix[n_c].size() ); for ( std::size_t n_s = 0; n_s < ch.size(); ++n_s ) { ch.InsertSection( Section(gMatrix[n_c][n_s]), n_s ); } std::string yunits = ""; if (open_doc) { yunits = actDoc()->at( actDoc()->GetCurChIndex() ).GetYUnits(); } ch.SetYUnits( yunits ); if ( !gNames.empty() ) { ch.SetChannelName(gNames[n_c]); } new_rec.InsertChannel( ch, n_c ); } gNames.resize(0); double xscale = 1.0; if (open_doc) { xscale = actDoc()->GetXScale(); } new_rec.SetXScale( xscale ); wxStfDoc* pDoc = NULL; if ( open_doc ) { pDoc = actDoc(); } wxStfDoc* testDoc = wxGetApp().NewChild( new_rec, pDoc, wxT("From python") ); if ( testDoc == NULL ) { ShowError( wxT("Failed to create a new window.") ); return false; } return true; } bool new_window_matrix( double* invec, int traces, int size ) { bool open_doc = actDoc() != NULL; Channel ch( traces ); for (int n = 0; n < traces; ++n) { std::size_t offset = n * size; std::vector< double > va(size); std::copy( &invec[offset], &invec[offset+size], &va[0] ); Section sec(va); ch.InsertSection(sec, n); } if (open_doc) { ch.SetYUnits( actDoc()->at( actDoc()->GetCurChIndex() ).GetYUnits() ); } Recording new_rec( ch ); if (open_doc) { new_rec.SetXScale( actDoc()->GetXScale() ); } wxStfDoc* testDoc = wxGetApp().NewChild( new_rec, actDoc(), wxT("From python") ); if ( testDoc == NULL ) { ShowError( wxT("Failed to create a new window.") ); return false; } return true; } bool new_window_selected_this( ) { if ( !check_doc() ) return false; if ( !actDoc()->OnNewfromselectedThis( ) ) { return false; } return true; } bool new_window_selected_all( ) { if ( !check_doc() ) return false; try { wxCommandEvent wce; wxGetApp().OnNewfromselected( wce ); } catch ( const std::exception& e) { ShowExcept( e ); return false; } return true; } int get_size_trace( int trace, int channel ) { if ( !check_doc() ) return 0; if ( trace == -1 ) { trace = actDoc()->GetCurSecIndex(); } if ( channel == -1 ) { channel = actDoc()->GetCurChIndex(); } int size = 0; try { size = actDoc()->at(channel).at(trace).size(); } catch ( const std::out_of_range& e) { ShowExcept( e ); return 0; } return size; } int get_size_channel( int channel ) { if ( !check_doc() ) return 0; if ( channel == -1 ) { channel = actDoc()->GetCurChIndex(); } int size = 0; try { size = actDoc()->at(channel).size(); } catch ( const std::out_of_range& e) { ShowExcept( e ); return 0; } return size; } int get_size_recording( ) { if ( !check_doc() ) return 0; return actDoc()->size(); } double get_maxdecay() { if ( !check_doc() ) return -1.0; return actDoc()->GetMaxDecay(); } double get_maxrise() { if ( !check_doc() ) return -1.0; return actDoc()->GetMaxRise(); } const char* get_recording_time( ) { if ( !check_doc() ) return 0; return actDoc()->GetTime().c_str(); } const char* get_recording_date( ) { if ( !check_doc() ) return 0; return actDoc()->GetDate().c_str(); } std::string get_recording_comment( ) { if ( !check_doc() ) return ""; std::ostringstream comment; comment << actDoc()->GetFileDescription() << actDoc()->GetGlobalSectionDescription(); return comment.str(); } bool set_recording_comment( const char* comment ) { if ( !check_doc() ) return false; actDoc()->SetFileDescription(comment); return true; } bool set_recording_date( const char* date ) { if ( !check_doc() ) return false; actDoc()->SetDate(date); return true; } bool set_recording_time( const char* time ) { if ( !check_doc() ) return false; actDoc()->SetTime(time); return true; } bool select_trace( int trace ) { if ( !check_doc() ) return false; int max_size = (int)actDoc()->at(actDoc()->GetCurChIndex()).size(); if (trace < -1 || trace >= max_size) { wxString msg; msg << wxT("Select a trace with a zero-based index between 0 and ") << max_size-1; ShowError( msg ); return false; } if ((int)actDoc()->GetSelectedSections().size() == max_size) { ShowError(wxT("No more traces can be selected\nAll traces are selected")); return false; } if ( trace == -1 ) { trace = actDoc()->GetCurSecIndex(); } // control whether trace has already been selected: bool already=false; for (c_st_it cit = actDoc()->GetSelectedSections().begin(); cit != actDoc()->GetSelectedSections().end() && !already; ++cit) { if ((int)*cit == trace) { already = true; } } // add trace number to selected numbers, print number of selected traces if (!already) { actDoc()->SelectTrace(trace, actDoc()->GetBaseBeg(), actDoc()->GetBaseEnd()); //String output in the trace navigator wxStfChildFrame* pFrame = (wxStfChildFrame*)actDoc()->GetDocumentWindow(); if ( !pFrame ) { ShowError( wxT("Pointer to frame is zero") ); return false; } pFrame->SetSelected(actDoc()->GetSelectedSections().size()); } else { ShowError( wxT("Trace is already selected") ); return false; } return true; } void select_all( ) { if ( !check_doc() ) return; wxCommandEvent wce; actDoc()->Selectall( wce ); } void unselect_all( ) { if ( !check_doc() ) return; wxCommandEvent wce; actDoc()->Deleteselected( wce ); } #ifdef WITH_PYTHON PyObject* get_selected_indices() { if ( !check_doc() ) return NULL; PyObject* retObj = PyTuple_New( (int)actDoc()->GetSelectedSections().size() ); c_st_it cit; int n=0; for ( cit = actDoc()->GetSelectedSections().begin(); cit != actDoc()->GetSelectedSections().end(); ++cit ) { PyTuple_SetItem(retObj, n++, PyInt_FromLong( (long)*cit ) ); } // The main program apparently takes the ownership of the tuple; // no reference count decrement should be performed here. return retObj; } #endif bool set_trace( int trace ) { if ( !check_doc() ) return false; // use only with open document if ( !actDoc()->SetSection( trace ) ) { return false; } wxGetApp().OnPeakcalcexecMsg(); wxStfChildFrame* pFrame = (wxStfChildFrame*)actDoc()->GetDocumentWindow(); if ( !pFrame ) { ShowError( wxT("Pointer to frame is zero") ); return false; } pFrame->SetCurTrace( trace ); return refresh_graph(); } int get_trace_index() { if ( !check_doc() ) return -1; return actDoc()->GetCurSecIndex(); } int get_channel_index( bool active ) { if ( !check_doc() ) return -1; if ( active ) return actDoc()->GetCurChIndex(); else return actDoc()->GetSecChIndex(); } bool set_channel(int channel) { if ( !check_doc() ) return false; // use only with open document // channel negative if (channel<0) { ShowError( wxT("Negative value is not allowed") ); return false; } // only if we want to change the active channel if ((unsigned int)channel == actDoc()->GetCurChIndex() ) { return true; } int reference_ch = actDoc()->GetCurChIndex(); // catch exceptions (i.e out of range) try { actDoc()->SetCurChIndex(channel); } catch (const std::out_of_range& e) { ShowError( wxT("Value exceeds the number of available channels") ); return false; } // Pointer to wxStfChildFrame to access Channel selection combo wxStfChildFrame* pFrame = (wxStfChildFrame*)actDoc()->GetDocumentWindow(); if (!pFrame) { ShowError( wxT("Pointer to frame is zero") ); return false; } // set the channel selection combo //pFrame->SetChannels( actDoc()->GetCurChIndex(), actDoc()->GetSecChIndex()); pFrame->SetChannels( actDoc()->GetCurChIndex(), reference_ch); pFrame->UpdateChannels(); // update according to the combo return refresh_graph(); } const char* get_channel_name( int index ) { if ( !check_doc() ) return ""; if (index < 0) { index = actDoc()->GetCurChIndex(); } try { return actDoc()->at( index ).GetChannelName().c_str(); } catch (const std::out_of_range& e) { wxString msg(wxT("Index out of range in get_channel_name:\n")); msg+=wxString( e.what(), wxConvLocal ); ShowError( msg ); return ""; } } bool set_channel_name( const char* name, int index ) { if ( !check_doc() ) return ""; if (index < 0) { index = actDoc()->GetCurChIndex(); } try { actDoc()->at( index ).SetChannelName(name); } catch (const std::out_of_range& e) { wxString msg(wxT("Index out of range in get_channel_name:\n")); msg+=wxString( e.what(), wxConvLocal ); ShowError( msg ); return false; } return true; } const char* get_trace_name( int trace, int channel ) { if ( !check_doc() ) return ""; if (channel < 0) { channel = actDoc()->GetCurChIndex(); } if (trace < 0) { trace = actDoc()->GetCurSecIndex(); } try { return actDoc()->at( channel ).at( trace ).GetSectionDescription().c_str(); } catch (const std::out_of_range& e) { wxString msg(wxT("Index out of range in get_trace_name:\n")); msg+=wxString( e.what(), wxConvLocal ); ShowError( msg ); return ""; } } bool subtract_base( ) { if ( !check_doc() ) return false; return actDoc()->SubtractBase(); } bool file_open( const char* filename ) { wxString wxFilename( filename, wxConvLocal ); return wxGetApp().OpenFilePy( wxFilename ); } bool file_save( const char* filename ) { if ( !check_doc() ) return false; wxString wxFilename( filename, wxConvLocal ); return actDoc()->OnSaveDocument( wxFilename ); } bool close_all( ) { return wxGetApp().CloseAll(); } bool close_this( ) { if ( !check_doc() ) return false; return actDoc()->DeleteAllViews( ); } double peak_index( bool active ) { if ( !check_doc() ) return -1.0; if ( active ) { return actDoc()->GetMaxT(); } else { // Test whether a second channel is available at all: if ( actDoc()->size() < 2 ) { ShowError( wxT("No second channel found") ); return -1.0; } return actDoc()->GetAPMaxT(); } } double maxrise_index( bool active ) { if ( !check_doc() ) return -1.0; if ( active ) { return actDoc()->GetMaxRiseT(); } else { // Test whether a second channel is available at all: if ( actDoc()->size() < 2 ) { ShowError( wxT("No second channel found") ); return -1.0; } return actDoc()->GetAPMaxRiseT(); } } double maxdecay_index( ) { if ( !check_doc() ) return -1.0; return actDoc()->GetMaxDecayT(); } double foot_index( bool active ) { if ( !check_doc() ) return -1.0; if ( active ) { return actDoc()->GetTLoReal() - (actDoc()->GetTHiReal() - actDoc()->GetTLoReal()) / 3.0; } else { ShowError( wxT("At this time, foot_index() is only implemented for the active channel") ); return -1.0; } } double t50left_index( bool active ) { if ( !check_doc() ) return -1.0; if ( active ) { return actDoc()->GetT50LeftReal(); } else { // Test whether a second channel is available at all: if ( actDoc()->size() < 2 ) { ShowError( wxT("No second channel found") ); return -1.0; } return actDoc()->GetAPT50LeftReal(); } } double t50right_index( bool active ) { if ( !check_doc() ) return -1.0; if ( active ) { return actDoc()->GetT50RightReal(); } else { ShowError( wxT("At this time, t50right_index() is only implemented for the active channel") ); return -1.0; } } double get_halfwidth( bool active ) { if ( !check_doc() ) return -1.0; if ( active ) { double dt = actDoc()->GetXScale(); double t50left = actDoc()->GetT50LeftReal(); double t50right = actDoc()->GetT50RightReal(); return ( t50right-t50left )*dt; } else { ShowError( wxT("At this time, halfwidth is only implemented for the active channel") ); return -1.0; } } double rtlow_index( bool active ) { if ( !check_doc() ) return -1.0; if ( active ) { return actDoc()->GetTLoReal(); } else { ShowError( wxT("At this time, rtlow_index() is only implemented for the active channel") ); return -1.0; } } double rthigh_index( bool active ) { if ( !check_doc() ) return -1.0; if ( active ) { return actDoc()->GetTHiReal(); } else { ShowError( wxT("At this time, rthigh_index() is only implemented for the active channel") ); return -1.0; } } double get_threshold_time( bool is_time ) { if ( !check_doc() ) return -1; if ( !is_time ) return actDoc()->GetThrT(); else return (double)actDoc()->GetThrT() * actDoc()->GetXScale(); } double get_threshold_value( ) { if ( !check_doc() ) return -1; return actDoc()->GetThreshold(); } double get_latency( ) { if ( !check_doc() ) return -1.0; double dt = actDoc()->GetXScale(); return ( actDoc()->GetLatency() )*dt; } double get_risetime( ) { if ( !check_doc() ) return -1.0; double dt = actDoc()->GetXScale(); return ( actDoc()->GetTHiReal()-actDoc()->GetTLoReal() )*dt; } double get_risetime_factor() { if ( !check_doc() ) return -1.0; return actDoc()->GetRTFactor()/100.; } double get_fit_start( bool is_time ) { if ( !check_doc() ) return -1; if ( !is_time ) return actDoc()->GetFitBeg(); else return (double)actDoc()->GetFitBeg() * actDoc()->GetXScale(); } bool set_risetime_factor(double factor) { if ( !check_doc() ) return false; if (factor > 0.45 || factor < 0.05) { ShowError( wxT("Value out of range (0.05-0.45) in set_risetime_factor()") ); return false; } int RTFactor = (int)(factor*100); actDoc()->SetRTFactor(RTFactor); // defined in wxStfApp::OnPeakcalcexecMsg update_cursor_dialog(); update_results_table(); write_stf_registry(wxT("RTFactor"), RTFactor); return true; } bool set_fit_start( double pos, bool is_time ) { if ( !check_doc() ) return false; if ( is_time ) pos /= actDoc()->GetXScale(); int posInt = stf::round( pos ); // range check: if ( posInt < 0 || posInt >= (int)actDoc()->cursec().size() ) { ShowError( wxT("Value out of range in set_fit_start()") ); return false; } //conversion of pixel on screen to time (inversion of xFormat()) if (wxGetApp().GetCursorsDialog() != NULL && wxGetApp().GetCursorsDialog()->GetStartFitAtPeak()) { ShowError( wxT("Fit will start at the peak. Change cursor settings (Edit->Cursor settings) to set manually.") ); return false; } actDoc()->SetFitBeg( posInt ); return update_cursor_dialog(); } double get_fit_end( bool is_time ) { if ( !check_doc() ) return -1; if ( !is_time ) return actDoc()->GetFitEnd(); else return (double)actDoc()->GetFitEnd() * actDoc()->GetXScale(); } bool set_fit_end( double pos, bool is_time ) { if ( !check_doc() ) return false; if ( is_time ) pos /= actDoc()->GetXScale(); int posInt = stf::round( pos ); // range check: if ( posInt < 0 || posInt >= (int)actDoc()->cursec().size() ) { ShowError( wxT("Value out of range in set_fit_end()") ); return false; } //conversion of pixel on screen to time (inversion of xFormat()) if (wxGetApp().GetCursorsDialog() != NULL && wxGetApp().GetCursorsDialog()->GetStartFitAtPeak()) { ShowError( wxT("Fit will start at the peak. Change cursor settings (Edit->Cursor settings) to set manually.") ); return false; } actDoc()->SetFitEnd( posInt ); return update_cursor_dialog(); } double get_peak_start( bool is_time ) { if ( !check_doc() ) return -1; if ( !is_time ) return actDoc()->GetPeakBeg(); else return (double)actDoc()->GetPeakBeg() * actDoc()->GetXScale(); } bool set_peak_start( double pos, bool is_time ) { if ( !check_doc() ) return false; if ( is_time ) pos /= actDoc()->GetXScale(); int posInt = stf::round( pos ); // range check: if ( posInt < 0 || posInt >= (int)actDoc()->cursec().size() ) { ShowError( wxT("Value out of range in set_peak_start()") ); return false; } actDoc()->SetPeakBeg( posInt ); return update_cursor_dialog(); } double get_peak_end( bool is_time ) { if ( !check_doc() ) return -1; if ( !is_time ) return actDoc()->GetPeakEnd(); else return (double)actDoc()->GetPeakEnd() * actDoc()->GetXScale(); } bool set_peak_end( double pos, bool is_time ) { if ( !check_doc() ) return false; if ( is_time ) pos /= actDoc()->GetXScale(); int posInt = stf::round( pos ); // range check: if ( posInt < 0 || posInt >= (int)actDoc()->cursec().size() ) { ShowError( wxT("Value out of range in set_peak_end()") ); return false; } actDoc()->SetPeakEnd( posInt ); return update_cursor_dialog(); } bool set_peak_mean( int pts ) { if ( !check_doc() ) return false; // range check (-1 is a legal value!): if ( pts == 0 || pts < -1 ) { ShowError( wxT("Value out of range in set_peak_mean()") ); return false; } actDoc()->SetPM( pts ); return update_cursor_dialog(); } int get_peak_mean() { if ( !check_doc() ) return 0; return (int)actDoc()->GetPM(); } const char* get_peak_direction( ) { if ( !check_doc() ) return ""; const char *direction = "both"; if ( actDoc()->GetDirection() == stfnum::up ) direction = "up"; else if ( actDoc()->GetDirection() == stfnum::down ) direction = "down"; else if ( actDoc()->GetDirection() == stfnum::both ) direction = "both"; return direction; } bool set_peak_direction( const char* direction ) { if ( !check_doc() ) return false; if ( strcmp( direction, "up" ) == 0 ) { actDoc()->SetDirection( stfnum::up ); return update_cursor_dialog(); } if ( strcmp( direction, "down" ) == 0 ) { actDoc()->SetDirection( stfnum::down ); return update_cursor_dialog(); } if ( strcmp( direction, "both" ) == 0 ) { actDoc()->SetDirection( stfnum::both ); return update_cursor_dialog(); } wxString msg; msg << wxT("\"") << wxString::FromAscii(direction) << wxT("\" is not a valid direction\n"); msg << wxT("Use \"up\", \"down\" or \"both\""); ShowError( msg ); return false; } const char* get_baseline_method() { if ( !check_doc() ) return ""; const char *method=" "; if ( actDoc()->GetBaselineMethod() == stfnum::mean_sd ) method = "mean"; else if ( actDoc()->GetBaselineMethod() == stfnum::median_iqr ) method = "median"; return method; } bool set_baseline_method( const char* method ) { if ( !check_doc() ) return false; const wxString myitem = wxT("BaselineMethod"); if ( strcmp( method, "mean" ) == 0 ) { actDoc()->SetBaselineMethod( stfnum::mean_sd ); update_cursor_dialog(); update_results_table(); write_stf_registry(myitem, stfnum::mean_sd); return true; } else if ( strcmp( method, "median" ) == 0 ) { actDoc()->SetBaselineMethod( stfnum::median_iqr ); update_cursor_dialog(); // update wxStfCursorsDlg update_results_table(); // update results and labels in the table write_stf_registry(myitem, stfnum::median_iqr); // write in .Stimfit return true; } else { wxString msg; msg << wxT("\"") << wxString::FromAscii(method) << wxT("\" is not a valid method\n"); msg << wxT("Use \"mean\" or \"median\""); ShowError( msg ); return false; } } const char* get_latency_start_mode( ) { if ( !check_doc() ) return ""; const char *mode = "undefined"; if ( actDoc()->GetLatencyStartMode() == stf::manualMode ) mode = "manual"; else if ( actDoc()->GetLatencyStartMode() == stf::peakMode ) mode = "peak"; else if ( actDoc()->GetLatencyStartMode() == stf::riseMode ) mode = "rise"; else if ( actDoc()->GetLatencyStartMode() == stf::halfMode ) mode = "half"; return mode; } bool set_latency_start(double pos, bool is_time) { if ( !check_doc() ) return false; if (is_time) pos /= actDoc()->GetXScale(); int posInt = stf::round( pos ); /* range check */ if ( posInt < 0 || posInt >= (int)actDoc()->cursec().size() ){ ShowError( wxT("Value out of range in set_latency_start()") ); return false; } actDoc()->SetLatencyStartMode( stf::manualMode ); actDoc()->SetLatencyBeg( posInt ); /* set start latency mode to manual and write in registry */ const wxString myitem = wxT("LatencyStartMode"); bool dlg_OK, result_OK; dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::manualMode); return true; } return false; } bool set_latency_start_mode( const char* mode ) { if ( !check_doc() ) return false; const wxString myitem = wxT("LatencyStartMode"); bool dlg_OK, result_OK; if ( strcmp( mode, "manual" ) == 0 ) { actDoc()->SetLatencyStartMode( stf::manualMode ); dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::manualMode); return true; } return false; } else if ( strcmp( mode, "peak" ) == 0 ) { actDoc()->SetLatencyStartMode( stf::peakMode ); dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::peakMode); return true; } return false; } else if ( strcmp( mode, "rise" ) == 0 ) { actDoc()->SetLatencyStartMode( stf::riseMode ); dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::riseMode); return true; } return false; } else if ( strcmp( mode, "half" ) == 0 ) { actDoc()->SetLatencyStartMode( stf::halfMode ); dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::halfMode); return true; } return false; } else { wxString msg; msg << wxT("\"") << wxString::FromAscii(mode) << wxT("\" is not a valid start latency mode\n"); msg << wxT("Use \"manual\", \"peak\", \"rise\" or \"half\""); ShowError( msg ); return false; } } const char* get_latency_end_mode( ) { if ( !check_doc() ) return ""; const char *mode = "undefined"; if ( actDoc()->GetLatencyEndMode() == stf::manualMode ) mode = "manual"; else if ( actDoc()->GetLatencyEndMode() == stf::peakMode ) mode = "peak"; else if ( actDoc()->GetLatencyEndMode() == stf::riseMode ) mode = "rise"; else if ( actDoc()->GetLatencyEndMode() == stf::halfMode ) mode = "half"; else if ( actDoc()->GetLatencyEndMode() == stf::footMode ) mode = "foot"; return mode; } bool set_latency_end(double pos, bool is_time) { if ( !check_doc() ) return false; if (is_time) pos /= actDoc()->GetXScale(); int posInt = stf::round( pos ); /* range check */ if ( posInt < 0 || posInt >= (int)actDoc()->cursec().size() ){ ShowError( wxT("Value out of range in set_latency_start()") ); return false; } actDoc()->SetLatencyEndMode( stf::manualMode ); actDoc()->SetLatencyEnd( posInt ); /* set start latency mode to manual and write in registry */ const wxString myitem = wxT("LatencyEndMode"); bool dlg_OK, result_OK; dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::manualMode); return true; } return false; } bool set_latency_end_mode( const char* mode ) { if ( !check_doc() ) return false; const wxString myitem = wxT("LatencyEndMode"); bool dlg_OK, result_OK; if ( strcmp( mode, "manual" ) == 0 ) { actDoc()->SetLatencyEndMode( stf::manualMode ); dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::manualMode); return true; } return false; } else if ( strcmp( mode, "peak" ) == 0 ) { actDoc()->SetLatencyEndMode( stf::peakMode ); dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::peakMode); return true; } return false; } else if ( strcmp( mode, "rise" ) == 0 ) { actDoc()->SetLatencyEndMode( stf::riseMode ); dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::riseMode); return true; } return false; } else if ( strcmp( mode, "half" ) == 0 ) { actDoc()->SetLatencyEndMode( stf::halfMode ); dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::halfMode); return true; } return false; } else if ( strcmp( mode, "foot" ) == 0 ) { actDoc()->SetLatencyEndMode( stf::footMode ); dlg_OK = update_cursor_dialog(); result_OK = update_results_table(); if (dlg_OK && result_OK) { write_stf_registry(myitem, stf::footMode); return true; } return false; } else { wxString msg; msg << wxT("\"") << wxString::FromAscii(mode) << wxT("\" is not a valid end latency mode\n"); msg << wxT("Use \"manual\", \"peak\", \"rise\", \"half\" or \"foot\""); ShowError( msg ); return false; } } double get_latency_start( bool is_time ) { if ( !check_doc() ) return -1; if ( !is_time ) return actDoc()->GetLatencyBeg(); else return (double)actDoc()->GetLatencyBeg() * actDoc()->GetXScale(); } double get_latency_end( bool is_time ) { if ( !check_doc() ) return -1; if ( !is_time ) return actDoc()->GetLatencyEnd(); else return (double)actDoc()->GetLatencyEnd() * actDoc()->GetXScale(); } double get_base_SD() { if ( !check_doc() ) return 0.0; return actDoc()->GetBaseSD(); } double get_base_start( bool is_time ) { if ( !check_doc() ) return -1; if ( !is_time ) return actDoc()->GetBaseBeg(); else return (double)actDoc()->GetBaseBeg() * actDoc()->GetXScale(); } bool set_base_start( double pos, bool is_time ) { if ( !check_doc() ) return false; if ( is_time ) pos /= actDoc()->GetXScale(); int posInt = stf::round( pos ); // range check: if ( posInt < 0 || posInt >= (int)actDoc()->cursec().size() ) { ShowError( wxT("Value out of range in set_base_start()") ); return false; } actDoc()->SetBaseBeg( posInt ); return update_cursor_dialog(); } double get_base_end( bool is_time ) { if ( !check_doc() ) return -1; if ( !is_time ) return actDoc()->GetBaseEnd(); else return (double)actDoc()->GetBaseEnd() * actDoc()->GetXScale(); } bool set_base_end( double pos, bool is_time ) { if ( !check_doc() ) return false; if ( is_time ) pos /= actDoc()->GetXScale(); int posInt = stf::round( pos ); // range check: if ( posInt < 0 || posInt >= (int)actDoc()->cursec().size() ) { ShowError( wxT("Value out of range in set_base_end()") ); return false; } actDoc()->SetBaseEnd( posInt ); return update_cursor_dialog(); } bool set_slope(double slope) { if ( !check_doc() ) return false; actDoc()->SetSlopeForThreshold( slope ); actDoc()->SetFromBase( false ); return update_cursor_dialog(); } double get_sampling_interval( ) { if ( !check_doc() ) return -1.0; return actDoc()->GetXScale(); } const char* get_xunits( ) { if ( !check_doc() ) return ""; return actDoc()->GetXUnits().c_str(); } const char* get_yunits( int trace, int channel ) { if ( !check_doc() ) return ""; if (channel < 0) { channel = actDoc()->GetCurChIndex(); } if (trace < 0) { trace = actDoc()->GetCurSecIndex(); } try { return actDoc()->at( channel ).GetYUnits().c_str(); } catch (const std::out_of_range& e) { wxString msg(wxT("Index out of range in get_yunits:\n")); msg+=wxString( e.what(), wxConvLocal ); ShowError( msg ); return ""; } } bool set_xunits( const char* units ) { if ( !check_doc() ) return false; actDoc()->SetXUnits(units); return true; } bool set_yunits( const char* units, int trace, int channel ) { if ( !check_doc() ) return false; if (channel < 0) { channel = actDoc()->GetCurChIndex(); } if (trace < 0) { trace = actDoc()->GetCurSecIndex(); } try { actDoc()->at( channel ).SetYUnits(units); } catch (const std::out_of_range& e) { wxString msg(wxT("Index out of range in set_yunits:\n")); msg+=wxString( e.what(), wxConvLocal ); ShowError( msg ); return false; } return true; } bool set_sampling_interval( double si ) { if ( !check_doc() ) return false; if (si <= 0) { ShowError( wxT("New sampling interval needs to be greater than 0.") ); return false; } actDoc()->SetXScale( si ); return refresh_graph(); } bool measure( ) { if ( !check_doc() ) return false; // check cursor positions: if ( actDoc()->GetPeakBeg() > actDoc()->GetPeakEnd() ) { ShowError( wxT("Peak window cursors are reversed; will abort now.") ); return false; } if ( actDoc()->GetBaseBeg() > actDoc()->GetBaseEnd() ) { ShowError( wxT("Base window cursors are reversed; will abort now.") ); return false; } if ( actDoc()->GetFitBeg() > actDoc()->GetFitEnd() ) { ShowError( wxT("Fit window cursors are reversed; will abort now.") ); return false; } wxStfChildFrame* pFrame = (wxStfChildFrame*)actDoc()->GetDocumentWindow(); if ( !pFrame ) { ShowError( wxT("Pointer to frame is zero") ); return false; } wxGetApp().OnPeakcalcexecMsg(); pFrame->UpdateResults(); return true; } double get_base( bool active ) { if ( !check_doc() ) return -1.0; if ( active ) { return actDoc()->GetBase(); } else { // Test wheter a second channel is available at all: if ( actDoc()->size() < 2) { ShowError( wxT("No second channel was found") ); return -1.0; } return actDoc()->GetAPBase(); } } #ifdef WITH_PSLOPE double get_pslope() { if (!check_doc() ) return 0.0; return actDoc()->GetPSlope(); } #endif double get_peak( ) { if ( !check_doc() ) return 0.0; return actDoc()->GetPeak(); } void _gMatrix_resize( std::size_t channels, std::size_t sections ) { gMatrix.resize( channels ); std::vector< std::vector< Vector_double > >::iterator it; for (it = gMatrix.begin(); it != gMatrix.end(); ++it) { it->resize( sections ); } } void _gMatrix_at( double* invec, int size, int channel, int section ) { std::vector< double > va(size); std::copy( &invec[0], &invec[size], va.begin() ); try{ gMatrix.at(channel).at(section).resize( va.size() ); gMatrix[channel][section] = va; } catch (const std::out_of_range& e) { wxString msg(wxT("Out of range exception in _gMatrix_at:\n")); msg+=wxString( e.what(), wxConvLocal ); ShowError( msg ); return; } } void _gNames_resize( std::size_t channels ) { gNames.resize( channels ); } void _gNames_at( const char* name, int channel ) { try{ gNames.at(channel) = std::string(name); } catch (const std::out_of_range& e) { wxString msg(wxT("Out of range exception in _gNames_at:\n")); msg+=wxString( e.what(), wxConvLocal ); ShowError( msg ); return; } } void align_selected( double (*alignment)( bool ), bool active ) { if ( !check_doc() ) return; wxStfDoc* pDoc = actDoc(); //store current section: std::size_t section_old = pDoc->GetCurSecIndex(); if ( pDoc->GetSelectedSections().empty() ) { ShowError( wxT("No selected traces") ); return; } // check for a second channel if ( actDoc()->size() < 2 ) { ShowError( wxT("No second channel found") ); return; } //initialize the lowest and the highest index: std::size_t min_index=0; try { min_index=pDoc->get()[pDoc->GetSecChIndex()].at(pDoc->GetSelectedSections().at(0)).size()-1; } catch (const std::out_of_range& e) { wxString msg(wxT("Error while aligning\nIt is safer to re-start the program\n")); msg+=wxString( e.what(), wxConvLocal ); ShowError( msg ); return; } std::size_t max_index=0; std::vector shift( pDoc->GetSelectedSections().size(), 0 ); int_it it = shift.begin(); //loop through all selected sections: for (c_st_it cit = pDoc->GetSelectedSections().begin(); cit != pDoc->GetSelectedSections().end() && it != shift.end(); cit++) { //Set the selected section as the current section temporarily: pDoc->SetSection(*cit); if ( pDoc->GetPeakAtEnd() ) { pDoc->SetPeakEnd((int)pDoc->get()[pDoc->GetSecChIndex()][*cit].size()-1); } // Calculate all variables for the current settings // APMaxSlopeT will be calculated for the second (==reference) // channel, so channels may not be changed! try { pDoc->Measure(); } catch (const std::out_of_range& e) { ShowExcept( e ); return; } //check whether the current index is a max or a min, //and if so, store it: double alignIndex = alignment( active ); *it = stf::round( alignIndex ); if (alignIndex > max_index) { max_index=alignIndex; } if (alignIndex < min_index) { min_index=alignIndex; } it++; } // now that max and min indices are known, calculate the number of // points that need to be shifted: for (int_it it2 = shift.begin(); it2 != shift.end(); it2++) { (*it2) -= (int)min_index; } //restore section and channel settings: pDoc->SetSection( section_old ); int new_size=(int)(pDoc->get()[0][pDoc->GetSelectedSections()[0]].size()-(max_index-min_index)); Recording Aligned( pDoc->size(), pDoc->GetSelectedSections().size(), new_size ); ch_it chan_it; // Channel iterator std::size_t n_ch = 0; for ( ch_it chan_it = pDoc->get().begin(); chan_it != pDoc->get().end(); ++chan_it ) { Channel ch( pDoc->GetSelectedSections().size() ); ch.SetChannelName( pDoc->at(n_ch).GetChannelName() ); ch.SetYUnits( pDoc->at(n_ch).GetYUnits() ); std::size_t n_sec = 0; int_it it3 = shift.begin(); for ( c_st_it sel_it = pDoc->GetSelectedSections().begin(); sel_it != pDoc->GetSelectedSections().end() && it3 != shift.end(); ++sel_it ) { Vector_double va( new_size ); std::copy( &(chan_it->at( *sel_it ).get_w()[ 0 + (*it3) ]), &(chan_it->at( *sel_it ).get_w()[ (*it3) + new_size ]), &va[0] ); Section sec(va); ch.InsertSection(sec, n_sec++); ++it3; } Aligned.InsertChannel( ch, n_ch++ ); } wxString title( pDoc->GetTitle() ); title += wxT(", aligned"); Aligned.CopyAttributes( *pDoc ); wxStfDoc* testDoc = wxGetApp().NewChild(Aligned, pDoc, title); if ( testDoc == NULL ) { ShowError( wxT("Failed to create a new window.") ); } return; } int leastsq_param_size( int fselect ) { int npar = 0; try { npar = (int)wxGetApp().GetFuncLib().at(fselect).pInfo.size(); } catch (const std::out_of_range& e) { wxString msg( wxT("Could not retrieve function from library:\n") ); msg << wxString( e.what(), wxConvLocal ); ShowError(msg); return -1; } return npar; } PyObject* leastsq( int fselect, bool refresh ) { if ( !check_doc() ) return NULL; wxStfDoc* pDoc = actDoc(); wxCommandEvent wce; int n_params = 0; try { n_params=(int)wxGetApp().GetFuncLib().at(fselect).pInfo.size(); } catch (const std::out_of_range& e) { wxString msg( wxT("Could not retrieve function from library:\n") ); msg << wxString( e.what(), wxConvLocal ); ShowError(msg); return NULL; } std::vector< double > x( pDoc->GetFitEnd() - pDoc->GetFitBeg() ); //fill array: std::copy(&pDoc->cursec()[pDoc->GetFitBeg()], &pDoc->cursec()[pDoc->GetFitEnd()], &x[0]); std::vector< double > params( n_params ); // initialize parameters from init function, wxGetApp().GetFuncLib().at(fselect).init( x, pDoc->GetBase(), pDoc->GetPeak(), pDoc->GetRTLoHi(), pDoc->GetHalfDuration(), pDoc->GetXScale(), params ); std::string fitInfo; int fitWarning = 0; std::vector< double > opts( 6 ); // check values in src/stimfit/gui/dlgs/fitseldlg.cpp // Respectively the scale factor for initial damping term \mu, // stopping thresholds for ||J^T e||_inf, ||Dp||_2 and ||e||_2, // maxIter, maxPass //opts[0]=5*1E-3; //default: 1E-03; opts[0] = 1E-05; //default: 1E-03; opts[1] = 1E-17; //default: 1E-17; opts[2] = 1E-17; //default: 1E-17; opts[3] = 1E-32; //default: 1E-17; opts[4] = 64; //default: 64; opts[5] = 16; double chisqr = 0.0; try { chisqr = stfnum::lmFit( x, pDoc->GetXScale(), wxGetApp().GetFuncLib().at(fselect), opts, true, params, fitInfo, fitWarning ); pDoc->SetIsFitted( pDoc->GetCurChIndex(), pDoc->GetCurSecIndex(), params, wxGetApp().GetFuncLibPtr(fselect), chisqr, pDoc->GetFitBeg(), pDoc->GetFitEnd() ); } catch (const std::out_of_range& e) { ShowExcept( e ); return NULL; } catch (const std::runtime_error& e) { ShowExcept( e ); return NULL; } catch (const std::exception& e) { ShowExcept( e ); return NULL; } if ( refresh ) { if ( !refresh_graph() ) return NULL; } // Dictionaries apparently grow as needed; no initial size is required. PyObject* retDict = PyDict_New( ); for ( std::size_t n_dict = 0; n_dict < params.size(); ++n_dict ) { PyDict_SetItemString( retDict, wxGetApp().GetFuncLib()[fselect].pInfo.at(n_dict).desc.c_str(), PyFloat_FromDouble( params[n_dict] ) ); } PyDict_SetItemString( retDict, "SSE", PyFloat_FromDouble( chisqr ) ); return retDict; } #ifdef WITH_PYTHON PyObject* get_fit( int trace, int channel ) { wrap_array(); if ( !check_doc() ) return NULL; if ( trace == -1 ) { trace = actDoc()->GetCurSecIndex(); } if ( channel == -1 ) { channel = actDoc()->GetCurChIndex(); } /* Does the specified section contain a fit at all? */ stf::SectionAttributes sec_attr; try { sec_attr = actDoc()->GetSectionAttributes(channel, trace); } catch (const std::out_of_range& e) { return NULL; } if (!sec_attr.isFitted) { return Py_None; } unsigned int size = sec_attr.storeFitEnd - sec_attr.storeFitBeg; Vector_double xy_fit(2*size); for (unsigned int x = 0; x < size; ++x) { xy_fit[x] = (x+sec_attr.storeFitBeg) * actDoc()->GetXScale(); xy_fit[x+size] = sec_attr.fitFunc->func(x*actDoc()->GetXScale(), sec_attr.bestFitP); } npy_intp dims[2] = {2, size}; PyObject* np_array = PyArray_SimpleNew(2, dims, NPY_DOUBLE); double* gDataP = (double*)array_data(np_array); /* fill */ std::copy(xy_fit.begin(), xy_fit.end(), gDataP); return np_array; } #endif bool show_table( PyObject* dict, const char* caption ) { if ( !check_doc() ) return false; // Check whether the dictionary is intact: if ( !PyDict_Check( dict ) ) { ShowError( wxT("First argument to ShowTable() is not a dictionary.") ); return false; } std::map< std::string, double > pyMap; Py_ssize_t n_dict = 0; PyObject *pkey = NULL, *pvalue = NULL; while ( PyDict_Next( dict, &n_dict, &pkey, &pvalue ) ) { if ( !pkey || !pvalue ) { ShowError( wxT("Couldn't read from dictionary in ShowTable().") ); return false; } std::string key = PyString_AsString( pkey ); double value = PyFloat_AsDouble( pvalue ); pyMap[key] = value; } stfnum::Table pyTable( pyMap ); wxStfChildFrame* pFrame = (wxStfChildFrame*)actDoc()->GetDocumentWindow(); if ( !pFrame ) { ShowError( wxT("Pointer to frame is zero") ); return false; } pFrame->ShowTable( pyTable, wxString( caption, wxConvLocal ) ); return true; } bool show_table_dictlist( PyObject* dict, const char* caption, bool reverse ) { if ( !check_doc() ) return false; if ( !reverse ) { ShowError( wxT("Row-major order (reverse = False) has not been implemented yet.") ); return false; } // Check whether the dictionary is intact: if ( !PyDict_Check( dict ) ) { ShowError( wxT("First argument to ShowTable() is not a dictionary.") ); return false; } Py_ssize_t n_dict = 0; PyObject *pkey = NULL, *pvalue = NULL; std::vector< Vector_double > pyVector; std::vector< std::string > pyStrings; while ( PyDict_Next( dict, &n_dict, &pkey, &pvalue ) ) { if ( !pkey || !pvalue ) { ShowError( wxT("Couldn't read from dictionary in ShowTable().") ); return false; } pyStrings.push_back(PyString_AsString( pkey )); if ( !PyList_Check( pvalue ) ) { ShowError( wxT("Dictionary values are not (consistently) lists.") ); return false; } Vector_double values( PyList_Size( pvalue ) ); for (int n_list = 0; n_list < (int)values.size(); ++n_list ) { PyObject* plistvalue = PyList_GetItem( pvalue, n_list ); if ( !plistvalue ) { ShowError( wxT("Can't read list elements in show_table().") ); return false; } values[n_list] = PyFloat_AsDouble( plistvalue ); } pyVector.push_back( values ); } if ( pyVector.empty() ) { ShowError( wxT("Dictionary was empty in show_table().") ); return false; } stfnum::Table pyTable( pyVector[0].size(), pyVector.size() ); std::vector< std::vector< double > >::const_iterator c_va_it; std::size_t n_col = 0; for ( c_va_it = pyVector.begin(); c_va_it != pyVector.end(); ++c_va_it ) { try { pyTable.SetColLabel( n_col, pyStrings[n_col] ); for ( std::size_t n_va=0; n_va < (*c_va_it).size(); ++n_va ) { pyTable.at( n_va, n_col ) = (*c_va_it)[n_va]; } } catch ( const std::out_of_range& e ) { ShowExcept( e ); return false; } n_col++; } wxStfChildFrame* pFrame = (wxStfChildFrame*)actDoc()->GetDocumentWindow(); if ( !pFrame ) { ShowError( wxT("Pointer to frame is zero") ); return false; } pFrame->ShowTable( pyTable, wxString( caption, wxConvLocal ) ); return true; } bool set_marker(double x, double y) { if ( !check_doc() ) return false; try { actDoc()->GetCurrentSectionAttributesW().pyMarkers. push_back(stf::PyMarker(x,y)); } catch (const std::out_of_range& e) { wxString msg( wxT("Could not set the marker:\n") ); msg << wxString( e.what(), wxConvLocal ); ShowError(msg); return false; } return refresh_graph(); } bool erase_markers() { if ( !check_doc() ) return false; try { actDoc()->GetCurrentSectionAttributesW().pyMarkers.clear(); } catch (const std::out_of_range& e) { wxString msg( wxT("Could not erase markers:\n") ); msg << wxString( e.what(), wxConvLocal ); ShowError(msg); return false; } return refresh_graph(); } double plot_xmin() { wxStfGraph* pGraph = actGraph(); if ( !pGraph ) { ShowError( wxT("Pointer to graph is zero") ); return 0; } return pGraph->get_plot_xmin(); } double plot_xmax() { wxStfGraph* pGraph = actGraph(); if ( !pGraph ) { ShowError( wxT("Pointer to graph is zero") ); return 0; } return pGraph->get_plot_xmax(); } double plot_ymin() { wxStfGraph* pGraph = actGraph(); if ( !pGraph ) { ShowError( wxT("Pointer to graph is zero") ); return 0; } return pGraph->get_plot_ymin(); } double plot_ymax() { wxStfGraph* pGraph = actGraph(); if ( !pGraph ) { ShowError( wxT("Pointer to graph is zero") ); return 0; } return pGraph->get_plot_ymax(); } double plot_y2min() { wxStfGraph* pGraph = actGraph(); if ( !pGraph ) { ShowError( wxT("Pointer to graph is zero") ); return 0; } return pGraph->get_plot_y2min(); } double plot_y2max() { wxStfGraph* pGraph = actGraph(); if ( !pGraph ) { ShowError( wxT("Pointer to graph is zero") ); return 0; } return pGraph->get_plot_y2max(); } PyObject* mpl_panel(const std::vector& figsize) { if ( !check_doc() ) return NULL; if (figsize.size() < 2) { ShowError( wxT("figsize has to have length 2") ); } wxStfParentFrame* parent = GetMainFrame(); if ( !parent ) { ShowError( wxT("Parent window is NULL") ); return 0; } std::ostringstream mpl_name; mpl_name << "mpl" << parent->GetMplFigNo(); int width = 800 * figsize[0]/8.0; int height = 600 * figsize[1]/6.0; PyObject* result = parent->MakePythonWindow("makeWindowMpl", mpl_name.str(), "Matplotlib", true, false, true, width, height, figsize[0], figsize[1]).pyWindow; return result; } stimfit-0.16.0/src/stimfit/py/hdf5tools.py0000775000175000017500000002150113277303516015370 00000000000000import sys sys.argv = "" import tables import numpy as np class Recording(): def __init__(self, channels, comment, date, time): self.channels = channels self.comment = comment self.date = date self.time = time def __getitem__( self, i ): return self.channels[i] def get_list( self ): return [ [ s.data for s in c.sections ] for c in self.channels ] def __len__( self ): return len( self.channels ) class Channel(): def __init__(self, sections, name): self.sections = sections self.name = name def __len__( self ): return len( self.sections ) def __getitem__( self, i ): return self.sections[i] class Section(): def __init__(self, data, dt, xunits, yunits): self.data = data self.dt = dt self.xunits = xunits self.yunits = yunits def __len__( self ): return len( self.data ) def __getitem__( self, i ): return self.data[i] class RecordingDescription(tables.IsDescription): channels = tables.Int32Col() date = tables.StringCol(128) time = tables.StringCol(128) class ChannelDescription(tables.IsDescription): n_sections = tables.Int32Col() class SectionDescription(tables.IsDescription): dt = tables.Float64Col() xunits = tables.StringCol(16) yunits = tables.StringCol(16) def save_hdf5( rec, filename ): h5file = tables.openFile(filename, mode = "w", title = "%s, converted to hdf5" % filename) # write global file description root_table = h5file.createTable(h5file.root, "description", RecordingDescription, "Description of %s" % filename) root_row = root_table.row root_row['channels'] = len(rec) root_row['date'] = rec.date root_row['time'] = rec.time root_row.append() root_table.flush() # write comment comment_group = h5file.createGroup("/", "comment", "multiline file comment") strarray = h5file.createArray(comment_group, "comment", [rec.comment,], "multiline file comment") # create group for channel names: chroot_group = h5file.createGroup("/", "channels", "channel names") # loop through channels: for n_c in range(len(rec)): channel_name = rec[n_c].name if channel_name == "": channel_name = "ch%d" % (n_c) channel_group = h5file.createGroup("/", channel_name, "channel%d" % (n_c)) # write channel name to root group: strarray = h5file.createArray(chroot_group, "ch%d" % n_c, [channel_name,], "channel name") channel_table = h5file.createTable(channel_group, "description", ChannelDescription, "Description of %s" % channel_name) channel_row = channel_table.row channel_row['n_sections'] = len(rec[n_c]) channel_row.append() channel_table.flush() if len(rec[n_c])==1: max_log10 = 0 else: max_log10 = int(np.log10(len(rec[n_c])-1)) for n_s in range(len(rec[n_c])): # construct a number with leading zeros: if n_s==0: n10 = 0 else: n10 = int(np.log10(n_s)) strZero = "" for n_z in range(n10,max_log10): strZero += "0" # construct a section name: section_name = "sec%d" % (n_s) # create a child group in the channel: section_group = h5file.createGroup(channel_group, "section_%s%d" % (strZero, n_s), section_name) # add data and description: array = h5file.createArray(section_group, "data", np.array(rec[n_c][n_s].data, dtype=np.float32), "data in %s" % section_name) desc_table = h5file.createTable(section_group, "description", SectionDescription, "description of %s" % section_name) desc_row = desc_table.row desc_row['dt'] = rec[n_c][n_s].dt desc_row['xunits'] = rec[n_c][n_s].xunits desc_row['yunits'] = rec[n_c][n_s].yunits desc_row.append() desc_table.flush() h5file.close() return True def export_hdf5( filename="" ): """ Exports a file in hdf5 format using PyTables. """ stf = __import__("stf") if filename=="": filename = "%s.h5" % (stf.get_filename()) # loop through channels: channel_list = list() for n_c in range(stf.get_size_recording()): section_list = [ Section( stf.get_trace(n_s, n_c), stf.get_sampling_interval(), stf.get_xunits(n_s, n_c), stf.get_yunits(n_s, n_c) ) \ for n_s in range(stf.get_size_channel(n_c)) ] channel_list.append( Channel( section_list, stf.get_channel_name() ) ) rec = Recording( channel_list, stf.get_recording_comment(), stf.get_recording_date(), stf.get_recording_time() ) save_hdf5( rec, filename ) return True def import_hdf5( filename ): """ Imports a file in hdf5 format stored by stimfit using PyTables, returns a Recording object. """ h5file = tables.openFile( filename, mode='r' ) # read global file description root_node = h5file.getNode("/", "description") date = root_node.col("date")[0] time = root_node.col("time")[0] n_channels = root_node.col("channels")[0] # read comment com = h5file.getNode("/", "comment") comment = "" for entry in h5file.walkNodes(com,classname='Array'): comment += "%s" % entry.read()[0] # read channel names channel_names = list() chan = h5file.getNode("/", "channels") for entry in h5file.walkNodes(chan, classname='Array'): channel_names.append( "%s" % entry.read()[0] ) # read data from channels: channel_list = list() for n_c in range(n_channels): channel_node = h5file.getNode("/", channel_names[n_c]) chdesc_node = h5file.getNode( channel_node, "description" ) n_sections = chdesc_node.col("n_sections")[0] # required number of zeros: if n_sections==1: max_log10 = 0 else: max_log10 = int(np.log10(n_sections-1)) # loop through sections: section_list = list() for n_s in range(n_sections): # construct a number with leading zeros: if n_s==0: n10 = 0 else: n10 = int(np.log10(n_s)) strZero = "" for n_z in range(n10,max_log10): strZero += "0" section_name = "section_%s%d" % ( strZero, n_s) section_node = h5file.getNode( channel_node, section_name ) secdesc_node = h5file.getNode( section_node, "description" ) dt = secdesc_node.col("dt")[0] xunits = secdesc_node.col("xunits")[0] yunits = secdesc_node.col("yunits")[0] data = h5file.getNode( section_node, "data").read() section_list.append( Section(data, dt, xunits, yunits) ) channel_list.append( Channel(section_list, channel_names[n_c]) ) h5file.close() return Recording( channel_list, comment, date, time ) def open_hdf5( filename ): """ Opens and shows an hdf5 file with stimfit """ rec = import_hdf5( filename ) stf = __import__("stf") stf._gNames_resize( len(rec.channels) ) for n_c in range(len(rec.channels)): stf._gNames_at( rec.channels[n_c].name, n_c ) stf.new_window_list( rec.get_list() ) n_channels = stf.get_size_recording() dt = rec.channels[0].sections[0].dt stf.set_sampling_interval( dt ) stf.set_recording_comment( rec.comment ) stf.set_recording_date( rec.date ) stf.set_recording_time( rec.time ) for n_c in range(stf.get_size_recording()): for n_s in range(stf.get_size_channel(n_c)): xunits = rec.channels[n_c].sections[n_s].xunits yunits = rec.channels[n_c].sections[n_s].yunits stf.set_xunits( xunits ) stf.set_yunits( yunits, n_s, n_c ) return True def show_rec( rec ): """ Shows recording object in a new stimfit window """ stf = __import__("stf") stf._gNames_resize( len(rec.channels) ) for n_c in range(len(rec.channels)): stf._gNames_at( rec.channels[n_c].name, n_c ) stf.new_window_list( rec.get_list() ) n_channels = stf.get_size_recording() dt = rec.channels[0].sections[0].dt stf.set_sampling_interval( dt ) stf.set_recording_comment( rec.comment ) stf.set_recording_date( rec.date ) stf.set_recording_time( rec.time ) for n_c in range(stf.get_size_recording()): for n_s in range(stf.get_size_channel(n_c)): xunits = rec.channels[n_c].sections[n_s].xunits yunits = rec.channels[n_c].sections[n_s].yunits stf.set_xunits( xunits ) stf.set_yunits( yunits, n_s, n_c ) return True def test(): export_hdf5() open_hdf5("/home/cs/data/EE07_04_11_2AC.dat.h5") stimfit-0.16.0/src/stimfit/py/charlie.py0000775000175000017500000001276213277303516015101 00000000000000""" Calculates resistances 2008-05-06, C. Schmidt-Hieber Indices are zero-based! """ import numpy as np # stimfit python module: import stf # import iv tools: import ivtools def resistance( base_start, base_end, peak_start, peak_end, amplitude ): """Calculates the resistance from a series of voltage clamp traces. Keyword arguments: base_start -- Starting index (zero-based) of the baseline cursors. base_end -- End index (zero-based) of the baseline cursors. peak_start -- Starting index (zero-based) of the peak cursors. peak_end -- End index (zero-based) of the peak cursors. amplitude -- Amplitude of the voltage command. Returns: The resistance. """ if (stf.check_doc() == False): print('Couldn\'t find an open file; aborting now.') return 0 # A temporary array to calculate the average: set = np.empty( (stf.get_size_channel(), stf.get_size_trace()) ) for n in range( 0, stf.get_size_channel() ): # Add this trace to set: set[n] = stf.get_trace( n ) # calculate average and create a new section from it: stf.new_window( np.average(set,0) ) # set peak cursors: if ( not(stf.set_peak_mean(-1)) ): return False # -1 means all points within peak window. if ( not(stf.set_peak_start(peak_start)) ): return False if ( not(stf.set_peak_end(peak_end)) ): return False # set base cursors: if ( not(stf.set_base_start(base_start)) ): return False if ( not(stf.set_base_end(base_end)) ): return False # measure everything: stf.measure() # calculate r_seal and return: return amplitude / (stf.get_peak()-stf.get_base()) def r_seal( amplitude=50 ): """Calculates the seal resistance from a series of voltage clamp traces. Keyword arguments: amplitude -- Amplitude of the voltage command. Defaults to 50 mV. Returns: The seal resistance. """ return resistance( 0, 199, 1050, 1199, amplitude ) def r_in( amplitude=-5 ): """Calculates the input resistance from a series of voltage clamp traces. Keyword arguments: amplitude -- Amplitude of the voltage command. Defaults to -5 mV. Returns: The input resistance. """ return resistance( 0, 999, 10700, 10999, amplitude ) def glu_iv( pulses = 13, subtract_base=True ): """Calculates an iv from a repeated series of fast application and voltage pulses. Keyword arguments: pulses -- Number of pulses for the iv. subtract_base -- If True (default), baseline will be subtracted. Returns: True if successful. """ # Some ugly definitions for the time being # Cursors are in ms here. gFitEnd = 330.6 # fit end cursor is variable gFSelect = 0 # Monoexp gDictSize = stf.leastsq_param_size( gFSelect ) + 2 # Parameters, chisqr, peak value gBaseStart = 220.5 # Start and end of the baseline before the control pulse, in ms gBaseEnd = 223.55 gPeakStart = 223.55 # Start and end of the peak cursors for the control pulse, in ms gPeakEnd = 253.55 if ( gDictSize < 0 ): print('Couldn\'t retrieve function id=%d, aborting now.'%gFSelect) return False if ( not(stf.check_doc()) ): print('Couldn\'t find an open file; aborting now.') return False # analyse iv, subtract baseline if requested: ivtools.analyze_iv( pulses ) if ( subtract_base == True ): if ( not(stf.set_base_start( gBaseStart, True )) ): return False if ( not(stf.set_base_end( gBaseEnd, True )) ): return False stf.measure() stf.select_all() stf.subtract_base() # set cursors: if ( not(stf.set_peak_start( gPeakStart, True )) ): return False if ( not(stf.set_peak_end( gPeakEnd, True )) ): return False if ( not(stf.set_base_start( gBaseStart, True )) ): return False if ( not(stf.set_base_end( gBaseEnd, True )) ): return False if ( not(stf.set_fit_end( gFitEnd, True )) ): return False if ( not(stf.set_peak_mean( 3 )) ): return False if ( not(stf.set_peak_direction( "both" )) ): return False # A list for dictionary keys and values: dict_keys = [] dict_values = np.empty( (gDictSize, stf.get_size_channel()) ) firstpass = True for n in range( 0, stf.get_size_channel() ): if ( stf.set_trace( n ) == False ): print('Couldn\'t set a new trace; aborting now.') return False print('Analyzing trace %d of %d'%( n+1, stf.get_size_channel() ) ) # set the fit window cursors: if ( not(stf.set_fit_start( stf.peak_index() )) ): return False # Least-squares fitting: p_dict = stf.leastsq( gFSelect ) if ( p_dict == 0 ): print('Couldn\'t perform a fit; aborting now.') return False # Create an empty list: tempdict_entry = [] row = 0 for k, v in p_dict.iteritems(): if ( firstpass == True ): dict_keys.append( k ) dict_values[row][n] = v row = row+1 if ( firstpass ): dict_keys.append( "Peak amplitude" ) dict_values[row][n] = stf.get_peak()-stf.get_base() firstpass = False retDict = dict() # Create the dictionary for the table: entry = 0 for elem in dict_keys: retDict[ elem ] = dict_values[entry].tolist() entry = entry+1 return stf.show_table_dictlist( retDict ) stimfit-0.16.0/src/stimfit/py/Makefile.am0000775000175000017500000000430413567226230015144 00000000000000if BUILD_PYTHON pkglib_LTLIBRARIES = libpystf.la $(srcdir)/pystf_wrap.cxx $(srcdir)/stf.py: $(srcdir)/pystf.i $(SWIG) $(SWIG_PYTHON_OPT) -o $@ $< cat $(srcdir)/gccwarn $(srcdir)/pystf_wrap.cxx > $(srcdir)/pystf_wrap_tmp.cxx mv $(srcdir)/pystf_wrap_tmp.cxx $(srcdir)/pystf_wrap.cxx nodist_libpystf_la_SOURCES = $(srcdir)/pystf_wrap.cxx libpystf_la_SOURCES = $(srcdir)/pystf.cxx # $(SWIG_SOURCES) noinst_HEADERS = pystf.h INCLUDES = $(LIBNUMPY_INCLUDES) $(LIBPYTHON_INCLUDES) $(LIBWXPYTHON_INCLUDES) libpystf_la_CPPFLAGS = $(SWIG_PYTHON_CPPFLAGS) -I$(top_srcdir)/src libpystf_la_CXXFLAGS = $(OPT_CXXFLAGS) $(WX_CXXFLAGS) libpystf_la_LDFLAGS = $(LIBPYTHON_LDFLAGS) $(LIBSTF_LDFLAGS) $(LIBBIOSIG_LDFLAGS) libpystf_la_LIBADD = ../libstimfit.la ../../libstfio/libstfio.la $(WX_LIBS) if WITH_BIOSIGLITE libpystf_la_LIBADD += ../../libbiosiglite/libbiosiglite.la endif EXTRA_DIST = pystf.i numpy.i ivtools.py mintools.py natools.py minidemo.py charlie.py mintools.py hdf5tools.py spells.py tdms.py embedded_init.py embedded_stf.py embedded_mpl.py embedded_ipython.py heka.py extensions.py gccwarn install-exec-hook: cd ${prefix}/lib/stimfit && ln -sf ${STF_PYTHON_LIBNAME} _stf.so rm -f ${prefix}/lib/stimfit/*.la rm -f ${prefix}/lib/stimfit/*.a cp -p $(srcdir)/ivtools.py ${prefix}/lib/stimfit cp -p $(srcdir)/mintools.py ${prefix}/lib/stimfit cp -p $(srcdir)/natools.py ${prefix}/lib/stimfit cp -p $(srcdir)/minidemo.py ${prefix}/lib/stimfit cp -p $(srcdir)/charlie.py ${prefix}/lib/stimfit cp -p $(srcdir)/hdf5tools.py ${prefix}/lib/stimfit cp -p $(srcdir)/stf.py ${prefix}/lib/stimfit cp -p $(srcdir)/spells.py ${prefix}/lib/stimfit cp -p $(srcdir)/tdms.py ${prefix}/lib/stimfit cp -p $(srcdir)/embedded_init.py ${prefix}/lib/stimfit cp -p $(srcdir)/embedded_stf.py ${prefix}/lib/stimfit cp -p $(srcdir)/embedded_mpl.py ${prefix}/lib/stimfit cp -p $(srcdir)/embedded_ipython.py ${prefix}/lib/stimfit cp -p $(srcdir)/heka.py ${prefix}/lib/stimfit cp -p $(srcdir)/extensions.py ${prefix}/lib/stimfit cp -p $(srcdir)/../../pystfio/stfio_plot.py ${prefix}/lib/stimfit chmod -x ${prefix}/lib/stimfit/*.py uninstall-hook: rm -rf ${prefix}/lib/stimfit clean_local: rm -f $(srcdir)/pystf_wrap.cxx $(srcdir)/stf.py endif stimfit-0.16.0/src/stimfit/py/Makefile.in0000664000175000017500000006654713567226345015202 00000000000000# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2017 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @BUILD_PYTHON_TRUE@@WITH_BIOSIGLITE_TRUE@am__append_1 = ../../libbiosiglite/libbiosiglite.la subdir = src/stimfit/py ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acsite.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__noinst_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/stfconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = @BUILD_PYTHON_TRUE@libpystf_la_DEPENDENCIES = ../libstimfit.la \ @BUILD_PYTHON_TRUE@ ../../libstfio/libstfio.la \ @BUILD_PYTHON_TRUE@ $(am__DEPENDENCIES_1) $(am__append_1) am__libpystf_la_SOURCES_DIST = $(srcdir)/pystf.cxx @BUILD_PYTHON_TRUE@am_libpystf_la_OBJECTS = libpystf_la-pystf.lo @BUILD_PYTHON_TRUE@nodist_libpystf_la_OBJECTS = \ @BUILD_PYTHON_TRUE@ libpystf_la-pystf_wrap.lo libpystf_la_OBJECTS = $(am_libpystf_la_OBJECTS) \ $(nodist_libpystf_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libpystf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libpystf_la_CXXFLAGS) \ $(CXXFLAGS) $(libpystf_la_LDFLAGS) $(LDFLAGS) -o $@ @BUILD_PYTHON_TRUE@am_libpystf_la_rpath = -rpath $(pkglibdir) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(libpystf_la_SOURCES) $(nodist_libpystf_la_SOURCES) DIST_SOURCES = $(am__libpystf_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__noinst_HEADERS_DIST = pystf.h HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GT_CPPFLAGS = @GT_CPPFLAGS@ GT_CXXFLAGS = @GT_CXXFLAGS@ GT_LDFLAGS = @GT_LDFLAGS@ GT_LIBS = @GT_LIBS@ HDF5_CFLAGS = @HDF5_CFLAGS@ HDF5_LIBS = @HDF5_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBIOSIG_LDFLAGS = @LIBBIOSIG_LDFLAGS@ LIBHDF5_LDFLAGS = @LIBHDF5_LDFLAGS@ LIBLAPACK_LDFLAGS = @LIBLAPACK_LDFLAGS@ LIBNUMPY_INCLUDES = @LIBNUMPY_INCLUDES@ LIBOBJS = @LIBOBJS@ LIBPYTHON_INCLUDES = @LIBPYTHON_INCLUDES@ LIBPYTHON_LDFLAGS = @LIBPYTHON_LDFLAGS@ LIBS = @LIBS@ LIBSTF_LDFLAGS = @LIBSTF_LDFLAGS@ LIBTOOL = @LIBTOOL@ LIBWXPYTHON_INCLUDES = @LIBWXPYTHON_INCLUDES@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MACSETFILE = @MACSETFILE@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSTLINK_COMMAND = @POSTLINK_COMMAND@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_DIST_PKG = @PYTHON_DIST_PKG@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_NUMPY_INCLUDE = @PYTHON_NUMPY_INCLUDE@ PYTHON_PRE_DIST_PKG = @PYTHON_PRE_DIST_PKG@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ PYTHON_WXPYTHON_INCLUDE = @PYTHON_WXPYTHON_INCLUDE@ PY_AC_VERSION = @PY_AC_VERSION@ RANLIB = @RANLIB@ REZ = @REZ@ SED = @SED@ SETFILE = @SETFILE@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STFIO_PYTHON_LIBNAME = @STFIO_PYTHON_LIBNAME@ STF_PYTHON_LIBNAME = @STF_PYTHON_LIBNAME@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ VERSION = @VERSION@ WX_CPPFLAGS = @WX_CPPFLAGS@ WX_CXXFLAGS = @WX_CXXFLAGS@ WX_LIBS = @WX_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @BUILD_PYTHON_TRUE@pkglib_LTLIBRARIES = libpystf.la @BUILD_PYTHON_TRUE@nodist_libpystf_la_SOURCES = $(srcdir)/pystf_wrap.cxx @BUILD_PYTHON_TRUE@libpystf_la_SOURCES = $(srcdir)/pystf.cxx # $(SWIG_SOURCES) @BUILD_PYTHON_TRUE@noinst_HEADERS = pystf.h @BUILD_PYTHON_TRUE@INCLUDES = $(LIBNUMPY_INCLUDES) $(LIBPYTHON_INCLUDES) $(LIBWXPYTHON_INCLUDES) @BUILD_PYTHON_TRUE@libpystf_la_CPPFLAGS = $(SWIG_PYTHON_CPPFLAGS) -I$(top_srcdir)/src @BUILD_PYTHON_TRUE@libpystf_la_CXXFLAGS = $(OPT_CXXFLAGS) $(WX_CXXFLAGS) @BUILD_PYTHON_TRUE@libpystf_la_LDFLAGS = $(LIBPYTHON_LDFLAGS) $(LIBSTF_LDFLAGS) $(LIBBIOSIG_LDFLAGS) @BUILD_PYTHON_TRUE@libpystf_la_LIBADD = ../libstimfit.la \ @BUILD_PYTHON_TRUE@ ../../libstfio/libstfio.la $(WX_LIBS) \ @BUILD_PYTHON_TRUE@ $(am__append_1) @BUILD_PYTHON_TRUE@EXTRA_DIST = pystf.i numpy.i ivtools.py mintools.py natools.py minidemo.py charlie.py mintools.py hdf5tools.py spells.py tdms.py embedded_init.py embedded_stf.py embedded_mpl.py embedded_ipython.py heka.py extensions.py gccwarn all: all-am .SUFFIXES: .SUFFIXES: .cxx .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/stimfit/py/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/stimfit/py/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libpystf.la: $(libpystf_la_OBJECTS) $(libpystf_la_DEPENDENCIES) $(EXTRA_libpystf_la_DEPENDENCIES) $(AM_V_CXXLD)$(libpystf_la_LINK) $(am_libpystf_la_rpath) $(libpystf_la_OBJECTS) $(libpystf_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpystf_la-pystf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpystf_la-pystf_wrap.Plo@am__quote@ .cxx.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cxx.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cxx.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< libpystf_la-pystf.lo: $(srcdir)/pystf.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpystf_la_CPPFLAGS) $(CPPFLAGS) $(libpystf_la_CXXFLAGS) $(CXXFLAGS) -MT libpystf_la-pystf.lo -MD -MP -MF $(DEPDIR)/libpystf_la-pystf.Tpo -c -o libpystf_la-pystf.lo `test -f '$(srcdir)/pystf.cxx' || echo '$(srcdir)/'`$(srcdir)/pystf.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libpystf_la-pystf.Tpo $(DEPDIR)/libpystf_la-pystf.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(srcdir)/pystf.cxx' object='libpystf_la-pystf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpystf_la_CPPFLAGS) $(CPPFLAGS) $(libpystf_la_CXXFLAGS) $(CXXFLAGS) -c -o libpystf_la-pystf.lo `test -f '$(srcdir)/pystf.cxx' || echo '$(srcdir)/'`$(srcdir)/pystf.cxx libpystf_la-pystf_wrap.lo: $(srcdir)/pystf_wrap.cxx @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpystf_la_CPPFLAGS) $(CPPFLAGS) $(libpystf_la_CXXFLAGS) $(CXXFLAGS) -MT libpystf_la-pystf_wrap.lo -MD -MP -MF $(DEPDIR)/libpystf_la-pystf_wrap.Tpo -c -o libpystf_la-pystf_wrap.lo `test -f '$(srcdir)/pystf_wrap.cxx' || echo '$(srcdir)/'`$(srcdir)/pystf_wrap.cxx @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libpystf_la-pystf_wrap.Tpo $(DEPDIR)/libpystf_la-pystf_wrap.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$(srcdir)/pystf_wrap.cxx' object='libpystf_la-pystf_wrap.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libpystf_la_CPPFLAGS) $(CPPFLAGS) $(libpystf_la_CXXFLAGS) $(CXXFLAGS) -c -o libpystf_la-pystf_wrap.lo `test -f '$(srcdir)/pystf_wrap.cxx' || echo '$(srcdir)/'`$(srcdir)/pystf_wrap.cxx mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." @BUILD_PYTHON_FALSE@install-exec-hook: @BUILD_PYTHON_FALSE@uninstall-hook: clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: install-am install-exec-am install-strip uninstall-am .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-exec-hook install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-pkglibLTLIBRARIES install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-hook uninstall-pkglibLTLIBRARIES .PRECIOUS: Makefile @BUILD_PYTHON_TRUE@$(srcdir)/pystf_wrap.cxx $(srcdir)/stf.py: $(srcdir)/pystf.i @BUILD_PYTHON_TRUE@ $(SWIG) $(SWIG_PYTHON_OPT) -o $@ $< @BUILD_PYTHON_TRUE@ cat $(srcdir)/gccwarn $(srcdir)/pystf_wrap.cxx > $(srcdir)/pystf_wrap_tmp.cxx @BUILD_PYTHON_TRUE@ mv $(srcdir)/pystf_wrap_tmp.cxx $(srcdir)/pystf_wrap.cxx @BUILD_PYTHON_TRUE@install-exec-hook: @BUILD_PYTHON_TRUE@ cd ${prefix}/lib/stimfit && ln -sf ${STF_PYTHON_LIBNAME} _stf.so @BUILD_PYTHON_TRUE@ rm -f ${prefix}/lib/stimfit/*.la @BUILD_PYTHON_TRUE@ rm -f ${prefix}/lib/stimfit/*.a @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/ivtools.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/mintools.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/natools.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/minidemo.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/charlie.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/hdf5tools.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/stf.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/spells.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/tdms.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/embedded_init.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/embedded_stf.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/embedded_mpl.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/embedded_ipython.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/heka.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/extensions.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ cp -p $(srcdir)/../../pystfio/stfio_plot.py ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@ chmod -x ${prefix}/lib/stimfit/*.py @BUILD_PYTHON_TRUE@uninstall-hook: @BUILD_PYTHON_TRUE@ rm -rf ${prefix}/lib/stimfit @BUILD_PYTHON_TRUE@clean_local: @BUILD_PYTHON_TRUE@ rm -f $(srcdir)/pystf_wrap.cxx $(srcdir)/stf.py # 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: stimfit-0.16.0/src/stimfit/py/spells.py0000664000175000017500000004327213277303516014771 00000000000000""" spells.py Python recipes to solve frequently requested tasks with Stimfit. You can find a complete description of these functions in the Stimfit online documentation (http://www.stimfit.org/doc/sphinx/index.html) Check "The Stimfit Book of Spells" for details. Authors: Jose Guzman, Alois Schloegl and Christoph Schmidt-Hieber Last change: Tue Dec 16 10:50:15 CET 2014 """ import numpy as np # stimfit python module: import stf import wx # see APFrame class import wx.grid # see APFrame class from math import ceil, floor def resistance( base_start, base_end, peak_start, peak_end, amplitude): """Calculates the resistance from a series of voltage clamp traces. Keyword arguments: base_start -- Starting index (zero-based) of the baseline cursors. base_end -- End index (zero-based) of the baseline cursors. peak_start -- Starting index (zero-based) of the peak cursors. peak_end -- End index (zero-based) of the peak cursors. amplitude -- Amplitude of the voltage command. Returns: The resistance. """ if not stf.check_doc(): print('Couldn\'t find an open file; aborting now.') return 0 #A temporary array to calculate the average: array = np.empty( (stf.get_size_channel(), stf.get_size_trace()) ) for n in range( 0, stf.get_size_channel() ): # Add this trace to set: array[n] = stf.get_trace( n ) # calculate average and create a new section from it: stf.new_window( np.average(set, 0) ) # set peak cursors: # -1 means all points within peak window. if not stf.set_peak_mean(-1): return 0 if not stf.set_peak_start(peak_start): return 0 if not stf.set_peak_end(peak_end): return 0 # set base cursors: if not stf.set_base_start(base_start): return 0 if not stf.set_base_end(base_end): return 0 # measure everything: stf.measure() # calculate r_seal and return: return amplitude / (stf.get_peak()-stf.get_base()) def rmean(binwidth, trace=-1, channel=-1): """ Calculates a running mean of a single trace Arguments: binwidth -- size of the bin in sampling points (pt). Obviously, it should be smaller than the length of the trace. trace: -- ZERO-BASED index of the trace within the channel. Note that this is one less than what is shown in the drop-down box. The default value of -1 returns the currently displayed trace. channel -- ZERO-BASED index of the channel. This is independent of whether a channel is active or not. The default value of -1 returns the currently active channel. Returns: A smoothed traced in a new stf window. """ # loads the current trace of the channel in a 1D Numpy Array sweep = stf.get_trace(trace, channel) # creates a destination python list to append the data dsweep = np.empty((len(sweep))) # running mean algorithm for i in range(len(sweep)): if (len(sweep)-i) > binwidth: # append to list the running mean of `binwidth` values # np.mean(sweep) calculates the mean of list dsweep[i] = np.mean( sweep[i:(binwidth+i)] ) else: # use all remaining points for the average: dsweep[i] = np.mean( sweep[i:] ) stf.new_window(dsweep) def get_amplitude(base, peak, delta, trace=None): """ Calculates the amplitude deviation (peak-base) in units of the Y-axis Arguments: base -- Starting point (in ms) of the baseline cursor. peak -- Starting point (in ms) of the peak cursor. delta -- Time interval to calculate baseline/find the peak. trace -- Zero-based index of the trace to be processed, if None then current trace is computed. Returns: A float with the variation of the amplitude. False if Example: get_amplitude(980,1005,10,i) returns the variation of the Y unit of the trace i between peak value (10050+10) msec and baseline (980+10) msec """ # sets the current trace or the one given in trace if trace is None: sweep = stf.get_trace_index() else: if type(trace) != int: print('trace argument admits only intergers') return False sweep = trace # set base cursors: if not(stf.set_base_start(base, True)): return False # out-of range if not(stf.set_base_end(base+delta, True)): return False # set peak cursors: if not(stf.set_peak_start(peak, True)): return False # out-of range if not(stf.set_peak_end(peak+delta, True)): return False # update measurements stf.set_trace(sweep) amplitude = stf.get_peak()-stf.get_base() return amplitude def cut_sweeps(start, delta, sequence=None): """ Cuts a sequence of traces and present them in a new window. Arguments: start -- starting point (in ms) to cut. delta -- time interval (in ms) to cut sequence -- list of indices to be cut. If None, every trace in the channel will be cut. Returns: A new window with the traced cut. Examples: cut_sweeps(200,300) cut the traces between t=200 ms and t=500 ms within the whole channel. cut_sweeps(200,300,range(30,60)) the same as above, but only between traces 30 and 60. cut_sweeps(200,300,stf.get_selected_indices()) cut between 200 ms and 500 ms only in the selected traces. """ # select every trace in the channel if not selection is given in sequence if sequence is None: sequence = range(stf.get_size_channel()) # transform time into sampling points dt = stf.get_sampling_interval() pstart = int( round(start/dt) ) pdelta = int( round(delta/dt) ) # creates a destination python list dlist = [ stf.get_trace(i)[pstart:(pstart+pdelta)] for i in sequence ] return stf.new_window_list(dlist) def count_events(start, delta, threshold=0, up=True, trace=None, mark=True): """ Counts the number of events (e.g action potentials (AP)) in the current trace. Arguments: start -- starting time (in ms) to look for events. delta -- time interval (in ms) to look for events. threshold -- (optional) detection threshold (default = 0). up -- (optional) True (default) will look for upward events, False downwards. trace -- (optional) zero-based index of the trace in the current channel, if None, the current trace is selected. mark -- (optional) if True (default), set a mark at the point of threshold crossing Returns: An integer with the number of events. Examples: count_events(500,1000) returns the number of events found between t=500 ms and t=1500 ms above 0 in the current trace and shows a stf marker. count_events(500,1000,0,False,-10,i) returns the number of events found below -10 in the trace i and shows the corresponding stf markers. """ # sets the current trace or the one given in trace. if trace is None: sweep = stf.get_trace_index() else: if type(trace) !=int: print('trace argument admits only integers') return False sweep = trace # set the trace described in sweep stf.set_trace(sweep) # transform time into sampling points dt = stf.get_sampling_interval() pstart = int( round(start/dt) ) pdelta = int( round(delta/dt) ) # select the section of interest within the trace selection = stf.get_trace()[pstart:(pstart+pdelta)] # algorithm to detect events event_counter, i = 0, 0 # set counter and index to zero # choose comparator according to direction: if up: comp = lambda a, b: a > b else: comp = lambda a, b: a < b # run the loop while i < len(selection): if comp(selection[i], threshold): event_counter += 1 if mark: stf.set_marker(pstart+i, selection[i]) while i < len(selection) and comp(selection[i], threshold): i += 1 # skip until value is below/above threshold else: i += 1 return event_counter class Spike(object): """ A collection of methods to calculate AP properties from threshold (see Stuart et al., 1997). Note that all calculations are performed in the active/current channel!!! """ def __init__(self,threshold): """ Create a Spike instance with sampling rate and threshold measurements are performed in the current/active channel!!! Arguments: threshold -- slope threshold to measure AP kinetics """ self._thr = threshold # set all the necessary AP parameters at construction self._updateattributes() def _updateattributes(self): """ update base, peak, t50, max_rise and tamplitude """ self.base = self.get_base() # in Stimfit is baseline self.peak = self.get_peak() # in Stimfit peak (from threshold) self.t50 = self.get_t50() # in Stimfit t50 self.max_rise = self.get_max_rise() # in Stimfit Slope (rise) self.thr = self.get_threshold_value() # in Stimit Threshold # attributes necessary to calculate latencies self.tonset = self.get_threshold_time() self.tpeak = self.get_tamplitude() self.t50_left = self.get_t50left() def update(self): """ update current trace sampling rate, cursors position and measurements (peak, baseline & AP kinetics) according to the threshold value set at construction or when the object is called with a threshold argument. """ # set slope stf.set_slope(self._thr) # on stf v0.93 or above # update sampling rate self._dt = stf.get_sampling_interval() # update cursors and AP kinetics (peak and half-width) stf.measure() def __call__(self, threshold=None ): """ update AP kinetic parameters to a new threshold in the current trace/channel threshold (optional) -- the new threshold value Examples : dend = Spike(40) # set the spike threshold at 40mV/ms dend(20) # now we set the spike threshold at 20mV/ms The AP parameters will be thereby updated in the current trace/channel. This method allow us to use the same object to calculate AP latencies in different traces. """ if threshold is not None: self._thr = threshold # set a new threshold self.update() # update dt and sampling rate self._updateattributes() def get_base(self): """ Get baseline according to cursor possition in the given current channel/trace """ self.update() return stf.get_trace(trace = -1 ,channel = -1)[stf.get_base_start():stf.get_base_end()+1].mean() def get_peak(self): """ calculate peak measured from threshold in the current trace, (see Stuart et al (1997) """ stf.set_peak_mean(1) # a single point for the peak value stf.set_peak_direction("up") # peak direction up self.update() peak = stf.get_peak()-stf.get_threshold_value() return peak def get_t50(self): """ calculates the half-widht in ms in the current trace""" self.update() # current t50's difference to calculate half-width (t50) return (stf.t50right_index()-stf.t50left_index())*self._dt def get_max_rise(self): """ maximum rate of rise (dV/dt) of AP in the current trace, which depends on the available Na+ conductance, see Mainen et al, 1995, Schmidt-Hieber et al, 2008 """ self.update() pmaxrise = stf.maxrise_index() # in active channel trace = stf.get_trace(trace = -1, channel =-1) # current trace dV = trace[int(ceil(pmaxrise))]-trace[(int(floor(pmaxrise)))] return dV/self._dt def get_tamplitude(self): """ return the time a the peak in the current trace""" #stf.peak_index() does not update cursors!!! self.update() return stf.peak_index()*self._dt def get_t50left(self): """ return the time at the half-width """ self.update() return stf.t50left_index()*self._dt def show_threshold(self): """ return the threshold value (in mV/ms) set at construction or when the object was called""" return self._thr def get_threshold_value(self): """ return the value (in y-units) at the threshold """ self.update() # stf.get_threshold_value does not update return stf.get_threshold_value() def get_threshold_time(self): """ return the value (in x-units) at the threshold """ self.update() return stf.get_threshold_time('True') # TODO # how to get the name of the object as string # Latencies according to Schmidt-Hieber need revision!!! class APFrame(wx.Frame): def __init__(self, soma, dend): """ creates a grid and fill it with AP kinetics from soma and dendrites Arguments: soma_AP -- Spike object for the soma dend_AP -- Spike object for the dendrite see Spike() class for more details """ # first check that both soma and dend are Spike() instances if not isinstance(soma,Spike) or not isinstance(dend,Spike): print('wrong argument, did you create a Spike object???') return 0 # initialize the wxframe wx.Frame.__init__(self, None, \ title = "AP parameters (from threshold)", size = (740,135)) # wxgrid columns self.col = ["Threshold\n (mV/ms)", "Onset\n (ms)", "Onset\n (mV)", "Baseline\n (mV)", "AP Peak\n (mV)", "AP Peak\n (ms)", "Half-width\n (ms)","Vmax\n (mV/ms)"] # wxgrid rows self.row = ["Soma", "Dend", "latency"] # Grid grid = wx.grid.Grid(self) grid.CreateGrid(len(self.row), len(self.col)) # Set grid labels for i in range(len(self.col)): grid.SetColLabelValue(i, self.col[i]) for i in range(len(self.row)): grid.SetRowLabelValue(i, self.row[i]) # Create a list with the AP parameters for the dendrite somalist = [soma.show_threshold(), soma.tonset, soma.thr, soma.base, soma.peak, soma.tpeak, soma.t50, soma.max_rise] # Fill soma values in the grid for i in range(len(self.col)): grid.SetCellValue(0,i, "%.4f"%somalist[i]) # Create a list with the AP parameters for the dendrite dendlist = [dend.show_threshold(), dend.tonset, dend.thr, dend.base, dend.peak, dend.tpeak, dend.t50, dend.max_rise] # Fill dend values in the grid for i in range(len(self.col)): grid.SetCellValue(1,i, "%.4f"%dendlist[i]) # Calculate latencies with different methods # onset latency grid.SetCellValue(2,1, "%.4f"%(dend.tonset - soma.tonset)) # peak latency grid.SetCellValue(2,5, "%.4f"%(dend.tpeak - soma.tpeak)) # half-width latency grid.SetCellValue(2,6, "%.4f"%(dend.t50_left -soma.t50_left)) def latency(soma, dend): """ Shows a results table with the latencies between the somatic and dendritic object Arguments: soma -- Spike Object of a trace containing the somatic AP dend -- Spike Object of a trace containing the dendritic AP see Spike() class for more details """ frame = APFrame(soma, dend) frame.Show() def count_aps(): """ Shows a result table with the number of action potentials (i.e events whose potential is above 0 mV) in selected traces. If no trace is selected, then the current trace is analyzed. Returns: False if document is not open. """ if not stf.check_doc(): print("Open file first") return False if len( stf.get_selected_indices() )==0: sel_trace = [ stf.get_trace_index()] else: sel_trace = stf.get_selected_indices() mytable = dict() for trace in sel_trace: tstart = 0 tend = stf.get_size_trace(trace)*stf.get_sampling_interval() threshold = 0 spikes = count_events(tstart, tend, threshold, True, trace, True) mytable["Trace %.3d" %trace] = spikes stf.show_table(mytable) return True def loadnrn( file ): """ Load a NEURON datafile and opens a new Stimfit window with a trace with the default units (e.g ms and mV) Arguments: file -- (string) file to be read """ time, trace = np.loadtxt(fname = file, skiprows = 2, unpack =1) dt = time[1] # the second temporal sampling point is the sampling stf.new_window( trace ) stf.set_sampling_interval( dt ) def loadtxt(freq=400): """ Loads an ASCII file with extension *.GoR. This file contains ratiometric fluorescent measurements (i.e Green over Red fluorescence) saved in one column. This function opens a new Stimfit window and sets the x-units to "ms" and y-units to "Delta G over R". Arguments: freq -- (float) the sampling rate (in Hz) for fluorescence acquistion. the default value is 400 Hz """ fname = wx.FileSelector("Import Ca transients" , default_extension="Ratiometric" , default_path="." , wildcard = "Ratiometric fluorescence (*.GoR)|*.GoR" , flags = wx.OPEN | wx.FILE_MUST_EXIST) stf.new_window( np.loadtxt(fname) ) stf.set_xunits('ms') stf.set_yunits('Delta G/R') stf.set_sampling_interval(1.0/freq*1000) # acquisition at 400 Hz stimfit-0.16.0/src/stimfit/py/embedded_mpl.py0000775000175000017500000001001713277303516016062 00000000000000#=========================================================================== # embedded_mpl.py # 2011.02.05 # Don't modify this file unless you know what you are doing!!! #=========================================================================== """ embedded_mpl.py starting code to embed a matplotlib wx figure into the stf application. """ import sys if 'linux' in sys.platform: import wxversion try: wxversion.select('2.8') except: pass import wx import matplotlib if sys.version_info[0] < 3: matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import \ FigureCanvasWxAgg as FigCanvas, \ NavigationToolbar2WxAgg as NavigationToolbar from matplotlib.figure import Figure import matplotlib.mlab as mlab import numpy as np try: import stfio_plot except: from stfio import plot as stfio_plot class MplPanel(wx.Panel): """The matplotlib figure""" def __init__(self, parent, figsize=(8.0, 6.0)): super(MplPanel, self).__init__(parent, -1) self.fig = Figure(figsize, dpi=72) self.canvas = FigCanvas(self, -1, self.fig) # Since we have only one plot, we can use add_axes # instead of add_subplot, but then the subplot # configuration tool in the navigation toolbar wouldn't # work. # self.axes = self.fig.add_subplot(111) # Create the navigation toolbar, tied to the canvas # self.toolbar = NavigationToolbar(self.canvas) # # Layout with box sizers # self.vbox = wx.BoxSizer(wx.VERTICAL) self.vbox.Add(self.canvas, 1, wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT, 10) self.vbox.Add(self.toolbar, 0, wx.EXPAND) self.SetSizer(self.vbox) def plot_screen(self): import stf tsl = [] try: l = stf.get_selected_indices() for idx in l: tsl.append(stfio_plot.Timeseries(stf.get_trace(idx), stf.get_sampling_interval(), yunits = stf.get_yunits(), color='0.2')) fit = stf.get_fit(idx) if fit is not None: self.axes.plot(fit[0], fit[1], color='0.4', alpha=0.5, lw=5.0) except: pass tsl.append(stfio_plot.Timeseries(stf.get_trace(), stf.get_sampling_interval(), yunits = stf.get_yunits())) if stf.get_size_recording()>1: tsl2 = [stfio_plot.Timeseries(stf.get_trace(trace=-1, channel=stf.get_channel_index(False)), stf.get_sampling_interval(), yunits = stf.get_yunits(trace=-1, channel=stf.get_channel_index(False)), color='r', linestyle='-r')] stfio_plot.plot_traces(tsl, traces2=tsl2, ax=self.axes, textcolor2 = 'r', xmin=stf.plot_xmin(), xmax=stf.plot_xmax(), ymin=stf.plot_ymin(), ymax=stf.plot_ymax(), y2min=stf.plot_y2min(), y2max=stf.plot_y2max()) else: stfio_plot.plot_traces(tsl, ax=self.axes, xmin=stf.plot_xmin(), xmax=stf.plot_xmax(), ymin=stf.plot_ymin(), ymax=stf.plot_ymax()) fit = stf.get_fit() if fit is not None: self.axes.plot(fit[0], fit[1], color='0.2', alpha=0.5, lw=5.0) def plot_spectrum(self): import stf Pow, freq = mlab.psd(stf.get_trace(), Fs=(1.0/stf.get_sampling_interval())*1e3, detrend=mlab.detrend_linear) self.axes.plot(freq, 10*np.log10(Pow)) self.axes.set_xlabel("Frequency (Hz)") self.axes.set_ylabel("Power spectral density (dB/Hz)") stimfit-0.16.0/src/stimfit/py/embedded_stf.py0000664000175000017500000000324413567226230016066 00000000000000#=========================================================================== # embedded_stf.py # 2009.09.14 # Don't modify this file unless you know what you are doing!!! #=========================================================================== """ embedded_stf.py starting code to embed wxPython into the stf application. """ import sys if 'win' in sys.platform: import wxversion wxversion.select('3.0-msw') import wx wx.CallAfter = lambda x, y : (x, y) from wx.py import shell # to access the current versions of Stimfit, NumPy and wxPython from embedded_init import intro_msg # test if stf_init was loaded try: import stf_init except ImportError: LOADED = " " except SyntaxError: LOADED = " Syntax error in custom initialization script stf_init.py" else: LOADED = " Successfully loaded custom initializaton script stf_init.py" class MyPanel(wx.Panel): """ The wxPython shell application """ def __init__(self, parent): # super makes the same as wx.Panel.__init__(self, parent, etc..) # but prepares for Python 3.0 among other things... super(MyPanel, self).__init__(parent, -1, \ style = wx.BORDER_NONE | wx.MAXIMIZE) # the Pycrust shell object self.pycrust = shell.Shell(self,-1, \ introText = intro_msg() + LOADED) # Workaround for http://trac.wxwidgets.org/ticket/15008 if "darwin" in sys.platform: self.pycrust.autoCallTip = False self.pycrust.push('from embedded_init import *', silent = True) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.pycrust, 1, wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT, 10) self.SetSizer(sizer) stimfit-0.16.0/src/stimfit/py/natools.py0000775000175000017500000004457513277303516015160 00000000000000""" 2008-04-11, C. Schmidt-Hieber Batch analysis of Na IVs """ import numpy as np from scipy.io import write_array def dens_batch( nFunc = 0 ): """Fits activation and inactivation of 15 iv pulses using a biexponential funtion with a delay, creates a table showing the results. Keyword argument: nFunc -- Index of function used for fitting. At present, 10 is the HH gNa function, 5 is a sum of two exponentials with a delay.""" stf = __import__("stf") # Some ugly definitions for the time being gFitStart = 70.56 gFSelect = nFunc # HH function gDictSize = stf.leastsq_param_size( gFSelect ) + 2 # Parameters, chisqr, peak value gBaseStartCtrl = 69.5 # Start and end of the baseline before the control pulse, in ms gBaseEndCtrl = 70.5 gPeakStartCtrl = 70.64 # Start and end of the peak cursors for the control pulse, in ms gPeakWindowSize = 0.8 gFitEnd = gFitStart+4.5 dt = stf.get_sampling_interval() if ( gDictSize < 0 ): print("Couldn\'t retrieve function id=%d; aborting now." % gFSelect) return False if ( not(stf.check_doc()) ): print("Couldn\'t find an open file; aborting now.") return False # set cursors: if ( not(stf.set_peak_start( gPeakStartCtrl/dt )) ): return False if ( not(stf.set_base_start( gBaseStartCtrl/dt )) ): return False if ( not(stf.set_base_end( gBaseEndCtrl/dt )) ): return False if ( not(stf.set_peak_mean( 3 )) ): return False if ( not(stf.set_peak_direction( "both" )) ): return False # A list for dictionary keys and values: dict_keys = [] dict_values = np.empty( (gDictSize, 1) ) if ( not(stf.set_peak_end( (gPeakStartCtrl + gPeakWindowSize)/dt )) ): return False stf.measure() # set the fit window cursors: if ( not(stf.set_fit_start( stf.peak_index()+1 )) ): return False if ( not(stf.set_fit_end( gFitEnd/dt )) ): return False # Least-squares fitting: p_dict = stf.leastsq( gFSelect ) if ( p_dict == 0 ): print('Couldn\'t perform a fit; aborting now.') return False # Create an empty list: tempdict_entry = [] row = 0 for k, v in p_dict.iteritems(): dict_keys.append( k ) dict_values[row][0] = v row = row+1 dict_keys.append( "Peak amplitude" ) dict_values[row][0] = stf.get_peak()-stf.get_base() retDict = dict() # Create the dictionary for the table: entry = 0 for elem in dict_keys: retDict[ elem ] = dict_values[entry].tolist() entry = entry+1 if not stf.show_table_dictlist( retDict ): return False # divide by inactivation part: trace = stf.get_trace()[gFitStart/dt:gFitEnd/dt] l = np.empty( (3, len(trace)) ) l[1] = trace - stf.get_base() t = np.arange(0,len(l[1]))*dt l[2] = np.exp(-t/p_dict['Tau_0']) l[0] = l[1] / l[2] stf.new_window_matrix( l ) stf.set_base_start(0) stf.set_base_end(0) stf.set_peak_mean(-1) stf.set_peak_start(10) stf.set_peak_end(32) stf.measure() def act_batch( nFunc = 5, filename="", lat=60 ): """Fits activation and inactivation of 15 iv pulses using a biexponential funtion with a delay, creates a table showing the results. Keyword argument: nFunc -- Index of function used for fitting. At present, 10 is the HH gNa function, 5 is a sum of two exponentials with a delay. filename -- If not an empty string, stores the best-fit parameters in this file.""" stf = __import__("stf") # Some ugly definitions for the time being gFitStart = 70.5 + lat/1000.0 # fit end cursor is variable gFSelect = nFunc # HH function gDictSize = stf.leastsq_param_size( gFSelect ) + 2 # Parameters, chisqr, peak value gBaseStartCtrl = 69.5 # Start and end of the baseline before the control pulse, in ms gBaseEndCtrl = 70.5 gPeakStartCtrl = 70.64 # Start and end of the peak cursors for the control pulse, in ms gPeakWindowSizes = ( 2.5, 2, 1.5, 1, 1, 0.8, 0.8, 0.8, 0.6, 0.6, 0.5, 0.5, 0.4, 0.4, 0.4 ) gFitDurations = ( 8, 8, 7, 6, 5.5, 5, 4.5, 3.5, 2.5, 2, 1.5, 1.5, 1.0, 0.8, 0.8 ) gPulses = len( gFitDurations ) # Number of traces if ( gDictSize < 0 ): print("Couldn\'t retrieve function id=%d; aborting now." % gFSelect) return False if ( not(stf.check_doc()) ): print("Couldn\'t find an open file; aborting now.") return False # set cursors: if ( not(stf.set_peak_start( gPeakStartCtrl, True )) ): return False if ( not(stf.set_peak_end( stf.get_size_trace(0)-1 )) ): return False if ( not(stf.set_base_start( gBaseStartCtrl, True )) ): return False if ( not(stf.set_base_end( gBaseEndCtrl, True )) ): return False if ( not(stf.set_peak_mean( 3 )) ): return False if ( not(stf.set_peak_direction( "both" )) ): return False firstpass = True # A list for dictionary keys and values: dict_keys = [] dict_values = np.empty( (gDictSize, stf.get_size_channel()) ) if not filename=="": ls_file=np.empty((gPulses,stf.leastsq_param_size(nFunc))) for n in range( 0, gPulses ): if ( stf.set_trace( n ) == False ): print('Couldn\'t set a new trace; aborting now.') return False print('Analyzing trace %d of %d'%( n+1, stf.get_size_channel())) # set the fit window cursors: if ( not(stf.set_peak_end( gPeakStartCtrl + gPeakWindowSizes[n], True )) ): return False if ( not(stf.set_fit_start( gFitStart, True )) ): return False if ( not(stf.set_fit_end( gFitStart + gFitDurations[n], True )) ): return False stf.measure() # Least-squares fitting: p_dict = stf.leastsq( gFSelect ) if not filename=="": ls_file[n][0]=p_dict["gprime_na"] ls_file[n][1]=p_dict["tau_m"] ls_file[n][2]=p_dict["tau_h"] ls_file[n][3]=p_dict["offset"] if ( p_dict == 0 ): print('Couldn\'t perform a fit; aborting now.') return False # Create an empty list: tempdict_entry = [] row = 0 for k, v in p_dict.iteritems(): if ( firstpass == True ): dict_keys.append( k ) dict_values[row][n] = v row = row+1 if ( firstpass ): dict_keys.append( "Peak amplitude" ) dict_values[row][n] = stf.get_peak()-stf.get_base() firstpass = False if not filename=="": write_array(file(filename,'w'), ls_file, precision=15) retDict = dict() # Create the dictionary for the table: entry = 0 for elem in dict_keys: retDict[ elem ] = dict_values[entry].tolist() entry = entry+1 return stf.show_table_dictlist( retDict ) def inact_batch(): """Determines peak amplitudes for inactivation protocol.""" stf = __import__("stf") # Some ugly definitions for the time being gDictSize = 1 # Parameters, chisqr, peak value gBaseStartCtrl = 69 # Start and end of the baseline before the control pulse, in ms gBaseEndCtrl = 70 gPeakStartCtrl = 70.12 # Start and end of the peak cursors for the control pulse, in ms gPeakWindowSize = 0.2 gPeakEndCtrl = gPeakStartCtrl + gPeakWindowSize gPulses = 11 # Number of traces if ( not(stf.check_doc()) ): print('Couldn\'t find an open file; aborting now.') return False # set cursors: if ( not(stf.set_peak_start( gPeakStartCtrl, True )) ): return False if ( not(stf.set_peak_end( gPeakEndCtrl, True )) ): return False if ( not(stf.set_base_start( gBaseStartCtrl, True )) ): return False if ( not(stf.set_base_end( gBaseEndCtrl, True )) ): return False if ( not(stf.set_peak_mean( 4 )) ): return False if ( not(stf.set_peak_direction( "both" )) ): return False # A list for dictionary keys and values: dict_keys = [ "Peak amplitude", ] dict_values = np.empty( (gDictSize, gPulses) ) for n in range( 0, gPulses ): if ( stf.set_trace( n ) == False ): print('Couldn\'t set a new trace; aborting now.') return False print('Analyzing pulse %d of %d'%( n+1, stf.get_size_channel())) # Update calculations: stf.measure() # Store values: dict_values[0][n] = stf.get_peak() - stf.get_base() inactDict = dict() # Create the dictionary for the table: entry = 0 for elem in dict_keys: inactDict[ elem ] = dict_values[entry].tolist() entry = entry+1 return stf.show_table_dictlist( inactDict ) def deact_batch( filename="" ): """Fits deactivation time constants: Monoexponential until <=-70, biexponential for >-70 mV. filename -- If not an empty string, stores the best-fit parameters in this file.""" stf = __import__("stf") # Some ugly definitions for the time being gNMono = 5 # Monoexponential fits gNBi = 4 # Biexponential fits gFMono = 0 # id of monoexponential function gFBi = 3 # id of biexponential function gMonoDictSize = stf.leastsq_param_size( gFMono ) + 1 # Parameters, chisqr gBiDictSize = stf.leastsq_param_size( gFBi ) + 1 # Parameters, chisqr if ( gMonoDictSize < 0 or gBiDictSize < 0 ): print('Couldn\'t retrieve function; aborting now.') return False if ( not(stf.check_doc()) ): print('Couldn\'t find an open file; aborting now.') return False # set the test pulse window cursors: if ( not(stf.set_peak_start( 70.84, True )) ): return False if ( not(stf.set_peak_end( 74.84, True )) ): return False if ( not(stf.set_base_start( 69.5, True )) ): return False if ( not(stf.set_base_end( 70.5, True )) ): return False if ( not(stf.set_peak_mean( 1 )) ): return False if ( not(stf.set_peak_direction( "down" )) ): return False # Monoexponential loop --------------------------------------------------- firstpass = True # A list for dictionary keys... mono_keys = [] # ... and values: mono_values = np.empty( (gMonoDictSize, gNMono) ) if not filename=="": ls_file=np.empty((gNMono,stf.leastsq_param_size(gFMono))) # Monoexponential fits: for n in range( 0, gNMono ): if ( stf.set_trace( n ) == False ): print("Couldn't set a new trace; aborting now.") return False print('Analyzing trace %d of %d'%( n+1, stf.get_size_channel())) # set the fit window cursors: # use the index for the start cursor: if ( not(stf.set_fit_start( stf.peak_index( True ) )) ): return False # fit 1.5 ms: fit_end_time = stf.get_fit_start( True )+1.0 if ( not(stf.set_fit_end( fit_end_time, True)) ): return False # Least-squares fitting: p_dict = stf.leastsq( gFMono ) if not filename=="": ls_file[n][0]=p_dict["Amp_0"] ls_file[n][1]=p_dict["Tau_0"] ls_file[n][2]=p_dict["Offset"] if ( p_dict == 0 ): print('Couldn\'t perform a fit; aborting now.') return False # Create an empty list: tempdict_entry = [] row = 0 for k, v in p_dict.iteritems(): if ( firstpass == True ): mono_keys.append( k ) mono_values[row][n] = v row = row+1 firstpass = False monoDict = dict() # Create the dictionary for the table: entry = 0 for elem in mono_keys: monoDict[ elem ] = mono_values[entry].tolist() entry = entry+1 if ( not(stf.show_table_dictlist( monoDict )) ): return False # Biexponential loop --------------------------------------------------- firstpass = True # A list for dictionary keys... bi_keys = [] # ... and values: bi_values = np.empty( (gBiDictSize, gNBi) ) # Monoexponential fits: for n in range( gNMono, gNBi+gNMono ): if ( stf.set_trace( n ) == False ): print('Couldn\'t set a new trace; aborting now.') return False print('Analyzing trace %d of %d'%( n+1, stf.get_size_channel())) # set the fit window cursors: # use the index for the start cursor: if ( not(stf.set_fit_start( stf.peak_index( True ) )) ): return False # fit 4 ms: fit_end_time = stf.get_fit_start( True )+3.5 if ( not(stf.set_fit_end( fit_end_time, True)) ): return False # Least-squares fitting: p_dict = stf.leastsq( gFBi ) if ( p_dict == 0 ): print('Couldn\'t perform a fit; aborting now.') return False # Create an empty list: tempdict_entry = [] row = 0 for k, v in p_dict.iteritems(): if ( firstpass == True ): bi_keys.append( k ) bi_values[row][n-gNMono] = v row = row+1 firstpass = False biDict = dict() # Create the dictionary for the table: entry = 0 for elem in bi_keys: biDict[ elem ] = bi_values[entry].tolist() entry = entry+1 if not filename=="": write_array(file(filename,'w'), ls_file, precision=15) if ( not(stf.show_table_dictlist( biDict )) ): return False return True def inact_recov_batch( show_table = True ): """Determines recovery from inactivation.""" stf = __import__("stf") if ( not(stf.check_doc()) ): print('Couldn\'t find an open file; aborting now.') return False # Some ugly definitions for the time being gBaseStartCtrl = 69 # Start and end of the baseline before the control pulse, in ms gBaseEndCtrl = 70 gPeakStartCtrl = 70.12 # Start and end of the peak cursors for the control pulse, in ms gPeakWindowSize = 0.5 gPeakEndCtrl = gPeakStartCtrl + gPeakWindowSize gDictSize = 2 # Control peak amplitude, test peak amplitude gDurations = ( 0, 1, 2, 3, 5, 7, 9, 13, 20, 30, 50, 100 ) # Durations of the pulses gPulses = len( gDurations ) # Number of pulses # A list for dictionary keys... dict_keys = [ "Control amplitude", "Test amplitude" ] # ... and values: dict_values = np.empty( (gDictSize, gPulses) ) if ( not(stf.set_peak_mean( 3 )) ): return False if ( not(stf.set_peak_direction( "down" )) ): return False for n in range( 0, gPulses ): if ( stf.set_trace( n ) == False ): print('Couldn\'t set a new trace; aborting now.') return False # set the control pulse window cursors: if ( not(stf.set_peak_start( gPeakStartCtrl, True )) ): return False if ( not(stf.set_peak_end( gPeakEndCtrl, True )) ): return False if ( not(stf.set_base_start( gBaseStartCtrl, True )) ): return False if ( not(stf.set_base_end( gBaseEndCtrl, True )) ): return False # Update calculations: stf.measure() # Store values: dict_values[0][n] = stf.get_peak() - stf.get_base() # set the test pulse window cursors: if ( not(stf.set_peak_start( gDurations[n]+100.16, True )) ): return False if ( not(stf.set_peak_end( gDurations[n]+100.16+gPeakWindowSize, True )) ): return False if ( not(stf.set_base_start( gDurations[n]+100-1, True )) ): return False if ( not(stf.set_base_end( gDurations[n]+100, True )) ): return False # Update calculations: stf.measure() # Store values: dict_values[1][n] = stf.get_peak() - stf.get_base() inactDict = dict() # Create the dictionary for the table: entry = 0 for elem in dict_keys: inactDict[ elem ] = dict_values[entry].tolist() entry = entry+1 if show_table: if not stf.show_table_dictlist( inactDict ): return -1 return dict_values def inact_onset_batch( show_table = True ): """Determines onset of inactivation.""" stf = __import__("stf") if ( not(stf.check_doc()) ): print('Couldn\'t find an open file; aborting now.') return -1 # Some ugly definitions for the time being gPeakWindowSize = 0.5 gDictSize = 1 # Control peak amplitude, test peak amplitude gDurations = ( 0, 1, 2, 3, 5, 7, 9, 13, 20, 25, 30 ) # Durations of the pulses gPulses = len( gDurations ) # Number of pulses # A list for dictionary keys... dict_keys = [ "Test amplitude", ] # ... and values: dict_values = np.empty( (gDictSize, gPulses) ) if ( not(stf.set_peak_mean( 4 )) ): return -1 if ( not(stf.set_peak_direction( "down" )) ): return -1 for n in range( 0, gPulses ): if ( stf.set_trace( n ) == False ): print('Couldn\'t set a new trace; aborting now.') return -1 print('Analyzing pulse %d of %d'%( n+1, stf.get_size_channel())) # set the test pulse window cursors: if ( not(stf.set_peak_start( gDurations[n]+70.12, True )) ): return -1 if ( not(stf.set_peak_end( gDurations[n]+70.12+gPeakWindowSize, True )) ): return -1 if ( not(stf.set_base_start( gDurations[n]+70-1, True )) ): return -1 if ( not(stf.set_base_end( gDurations[n]+70, True )) ): return -1 # Update calculations: stf.measure() # Store values: dict_values[0][n] = stf.get_peak() - stf.get_base() inactDict = dict() # Create the dictionary for the table: entry = 0 for elem in dict_keys: inactDict[ elem ] = dict_values[entry].tolist() entry = entry+1 if show_table: if not stf.show_table_dictlist( inactDict ): return -1 return dict_values[0] stimfit-0.16.0/src/stimfit/py/embedded_ipython.py0000664000175000017500000000364113277303516016766 00000000000000#=========================================================================== # embedded_ipython.py # 2009.09.14 # Don't modify this file unless you know what you are doing!!! #=========================================================================== """ embedded_ipython.py starting code to embed wxPython into the stf application. """ import wx from IPython.frontend.wx.wx_frontend import WxController # from IPython.gui.wx.ipython_view import IPShellWidget import IPython.ipapi # test if stf_init was loaded try: import stf_init except ImportError: LOADED = " " except SyntaxError: LOADED = " Syntax error in custom initialization script stf_init.py" else: LOADED = " Successfully loaded custom initializaton script stf_init.py" class MyPanel(wx.Panel): """ The wxPython shell application """ def __init__(self, parent): # super makes the same as wx.Panel.__init__(self, parent, etc..) # but prepares for Python 3.0 among other things... super(MyPanel, self).__init__(parent, -1, \ style = wx.BORDER_NONE | wx.MAXIMIZE) # ipython_shell is the shell object # WxController provides a Wx frontend for the IPython interpreter # see in /usr/lib/pymodules/python2.5/IPython/frontend/wx # see an example in /usr/lib/modules/python2.5/IPython/gui/wx ipython_shell = WxController(self) # ipython_shell = IPShellWidget(self,background_color = "BLACK") # ipython_shell = IPShellWidget(self) ipython_shell.clear_screen() # the ip object will access the IPython functionality ip = IPython.ipapi.get() # Stimfit and NumPy are visible to the interactive sesion. # see embedded_init for details ip.ex('from embedded_init import *') sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(ipython_shell, 1, wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT, 10) self.SetSizer(sizer) stimfit-0.16.0/src/stimfit/py/numpy.i0000664000175000017500000015174213277303516014441 00000000000000/* -*- C -*- (not really, but good for syntax highlighting) */ #ifdef SWIGPYTHON %{ #ifndef SWIG_FILE_WITH_INIT # define NO_IMPORT_ARRAY #endif #include "stdio.h" #include %} /**********************************************************************/ /* The following code originally appeared in * enthought/kiva/agg/src/numeric.i written by Eric Jones. It was * translated from C++ to C by John Hunter. Bill Spotz has modified * it to fix some minor bugs, upgrade from Numeric to numpy (all * versions), add some comments and functionality, and convert from * direct code insertion to SWIG fragments. */ %fragment("NumPy_Macros", "header") { /* Macros to extract array attributes. */ %#define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a)) %#define array_type(a) (int)(PyArray_TYPE(a)) %#define array_numdims(a) (((PyArrayObject *)a)->nd) %#define array_dimensions(a) (((PyArrayObject *)a)->dimensions) %#define array_size(a,i) (((PyArrayObject *)a)->dimensions[i]) %#define array_data(a) (((PyArrayObject *)a)->data) %#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS(a)) %#define array_is_native(a) (PyArray_ISNOTSWAPPED(a)) %#define array_is_fortran(a) (PyArray_ISFORTRAN(a)) } /**********************************************************************/ %fragment("NumPy_Utilities", "header") { /* Given a PyObject, return a string describing its type. */ const char* pytype_string(PyObject* py_obj) { if (py_obj == NULL ) return "C NULL value"; if (py_obj == Py_None ) return "Python None" ; if (PyCallable_Check(py_obj)) return "callable" ; if (PyString_Check( py_obj)) return "string" ; if (PyInt_Check( py_obj)) return "int" ; if (PyFloat_Check( py_obj)) return "float" ; if (PyDict_Check( py_obj)) return "dict" ; if (PyList_Check( py_obj)) return "list" ; if (PyTuple_Check( py_obj)) return "tuple" ; if (PyModule_Check( py_obj)) return "module" ; %#if PY_MAJOR_VERSION < 3 if (PyFile_Check( py_obj)) return "file" ; if (PyInstance_Check(py_obj)) return "instance" ; %#endif return "unkown type"; } /* Given a NumPy typecode, return a string describing the type. */ const char* typecode_string(int typecode) { static const char* type_names[25] = {"bool", "byte", "unsigned byte", "short", "unsigned short", "int", "unsigned int", "long", "unsigned long", "long long", "unsigned long long", "float", "double", "long double", "complex float", "complex double", "complex long double", "object", "string", "unicode", "void", "ntypes", "notype", "char", "unknown"}; return typecode < 24 ? type_names[typecode] : type_names[24]; } /* Make sure input has correct numpy type. Allow character and byte * to match. Also allow int and long to match. This is deprecated. * You should use PyArray_EquivTypenums() instead. */ int type_match(int actual_type, int desired_type) { return PyArray_EquivTypenums(actual_type, desired_type); } } /**********************************************************************/ %fragment("NumPy_Object_to_Array", "header", fragment="NumPy_Backward_Compatibility", fragment="NumPy_Macros", fragment="NumPy_Utilities") { /* Given a PyObject pointer, cast it to a PyArrayObject pointer if * legal. If not, set the python error string appropriately and * return NULL. */ PyArrayObject* obj_to_array_no_conversion(PyObject* input, int typecode) { PyArrayObject* ary = NULL; if (is_array(input) && (typecode == NPY_NOTYPE || PyArray_EquivTypenums(array_type(input), typecode))) { ary = (PyArrayObject*) input; } else if is_array(input) { const char* desired_type = typecode_string(typecode); const char* actual_type = typecode_string(array_type(input)); PyErr_Format(PyExc_TypeError, "Array of type '%s' required. Array of type '%s' given", desired_type, actual_type); ary = NULL; } else { const char * desired_type = typecode_string(typecode); const char * actual_type = pytype_string(input); PyErr_Format(PyExc_TypeError, "Array of type '%s' required. A '%s' was given", desired_type, actual_type); ary = NULL; } return ary; } /* Convert the given PyObject to a NumPy array with the given * typecode. On success, return a valid PyArrayObject* with the * correct type. On failure, the python error string will be set and * the routine returns NULL. */ PyArrayObject* obj_to_array_allow_conversion(PyObject* input, int typecode, int* is_new_object) { PyArrayObject* ary = NULL; PyObject* py_obj; if (is_array(input) && (typecode == NPY_NOTYPE || PyArray_EquivTypenums(array_type(input),typecode))) { ary = (PyArrayObject*) input; *is_new_object = 0; } else { py_obj = PyArray_FROMANY(input, typecode, 0, 0, NPY_DEFAULT); /* If NULL, PyArray_FromObject will have set python error value.*/ ary = (PyArrayObject*) py_obj; *is_new_object = 1; } return ary; } /* Given a PyArrayObject, check to see if it is contiguous. If so, * return the input pointer and flag it as not a new object. If it is * not contiguous, create a new PyArrayObject using the original data, * flag it as a new object and return the pointer. */ PyArrayObject* make_contiguous(PyArrayObject* ary, int* is_new_object, int min_dims, int max_dims) { PyArrayObject* result; if (array_is_contiguous(ary)) { result = ary; *is_new_object = 0; } else { result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)ary, array_type(ary), min_dims, max_dims); *is_new_object = 1; } return result; } /* Given a PyArrayObject, check to see if it is Fortran-contiguous. * If so, return the input pointer, but do not flag it as not a new * object. If it is not Fortran-contiguous, create a new * PyArrayObject using the original data, flag it as a new object * and return the pointer. */ PyArrayObject* make_fortran(PyArrayObject* ary, int* is_new_object, int min_dims, int max_dims) { PyArrayObject* result; if (array_is_fortran(ary)) { result = ary; *is_new_object = 0; } else { Py_INCREF(ary->descr); result = (PyArrayObject*) PyArray_FromArray(ary, ary->descr, NPY_FORTRAN); *is_new_object = 1; } return result; } /* Convert a given PyObject to a contiguous PyArrayObject of the * specified type. If the input object is not a contiguous * PyArrayObject, a new one will be created and the new object flag * will be set. */ PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input, int typecode, int* is_new_object) { int is_new1 = 0; int is_new2 = 0; PyArrayObject* ary2; PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, &is_new1); if (ary1) { ary2 = make_contiguous(ary1, &is_new2, 0, 0); if ( is_new1 && is_new2) { Py_DECREF(ary1); } ary1 = ary2; } *is_new_object = is_new1 || is_new2; return ary1; } /* Convert a given PyObject to a Fortran-ordered PyArrayObject of the * specified type. If the input object is not a Fortran-ordered * PyArrayObject, a new one will be created and the new object flag * will be set. */ PyArrayObject* obj_to_array_fortran_allow_conversion(PyObject* input, int typecode, int* is_new_object) { int is_new1 = 0; int is_new2 = 0; PyArrayObject* ary2; PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode, &is_new1); if (ary1) { ary2 = make_fortran(ary1, &is_new2, 0, 0); if (is_new1 && is_new2) { Py_DECREF(ary1); } ary1 = ary2; } *is_new_object = is_new1 || is_new2; return ary1; } } /* end fragment */ /**********************************************************************/ %fragment("NumPy_Array_Requirements", "header", fragment="NumPy_Backward_Compatibility", fragment="NumPy_Macros") { /* Test whether a python object is contiguous. If array is * contiguous, return 1. Otherwise, set the python error string and * return 0. */ int require_contiguous(PyArrayObject* ary) { int contiguous = 1; if (!array_is_contiguous(ary)) { PyErr_SetString(PyExc_TypeError, "Array must be contiguous. A non-contiguous array was given"); contiguous = 0; } return contiguous; } /* Require that a numpy array is not byte-swapped. If the array is * not byte-swapped, return 1. Otherwise, set the python error string * and return 0. */ int require_native(PyArrayObject* ary) { int native = 1; if (!array_is_native(ary)) { PyErr_SetString(PyExc_TypeError, "Array must have native byteorder. " "A byte-swapped array was given"); native = 0; } return native; } /* Require the given PyArrayObject to have a specified number of * dimensions. If the array has the specified number of dimensions, * return 1. Otherwise, set the python error string and return 0. */ int require_dimensions(PyArrayObject* ary, int exact_dimensions) { int success = 1; if (array_numdims(ary) != exact_dimensions) { PyErr_Format(PyExc_TypeError, "Array must have %d dimensions. Given array has %d dimensions", exact_dimensions, array_numdims(ary)); success = 0; } return success; } /* Require the given PyArrayObject to have one of a list of specified * number of dimensions. If the array has one of the specified number * of dimensions, return 1. Otherwise, set the python error string * and return 0. */ int require_dimensions_n(PyArrayObject* ary, int* exact_dimensions, int n) { int success = 0; int i; char dims_str[255] = ""; char s[255]; for (i = 0; i < n && !success; i++) { if (array_numdims(ary) == exact_dimensions[i]) { success = 1; } } if (!success) { for (i = 0; i < n-1; i++) { sprintf(s, "%d, ", exact_dimensions[i]); strcat(dims_str,s); } sprintf(s, " or %d", exact_dimensions[n-1]); strcat(dims_str,s); PyErr_Format(PyExc_TypeError, "Array must have %s dimensions. Given array has %d dimensions", dims_str, array_numdims(ary)); } return success; } /* Require the given PyArrayObject to have a specified shape. If the * array has the specified shape, return 1. Otherwise, set the python * error string and return 0. */ int require_size(PyArrayObject* ary, npy_intp* size, int n) { int i; int success = 1; int len; char desired_dims[255] = "["; char s[255]; char actual_dims[255] = "["; for(i=0; i < n;i++) { if (size[i] != -1 && size[i] != array_size(ary,i)) { success = 0; } } if (!success) { for (i = 0; i < n; i++) { if (size[i] == -1) { sprintf(s, "*,"); } else { sprintf(s, "%ld,", (long int)size[i]); } strcat(desired_dims,s); } len = strlen(desired_dims); desired_dims[len-1] = ']'; for (i = 0; i < n; i++) { sprintf(s, "%ld,", (long int)array_size(ary,i)); strcat(actual_dims,s); } len = strlen(actual_dims); actual_dims[len-1] = ']'; PyErr_Format(PyExc_TypeError, "Array must have shape of %s. Given array has shape of %s", desired_dims, actual_dims); } return success; } /* Require the given PyArrayObject to to be FORTRAN ordered. If the * the PyArrayObject is already FORTRAN ordered, do nothing. Else, * set the FORTRAN ordering flag and recompute the strides. */ int require_fortran(PyArrayObject* ary) { int success = 1; int nd = array_numdims(ary); int i; if (array_is_fortran(ary)) return success; /* Set the FORTRAN ordered flag */ ary->flags = NPY_FARRAY; /* Recompute the strides */ ary->strides[0] = ary->strides[nd-1]; for (i=1; i < nd; ++i) ary->strides[i] = ary->strides[i-1] * array_size(ary,i-1); return success; } } /* Combine all NumPy fragments into one for convenience */ %fragment("NumPy_Fragments", "header", fragment="NumPy_Backward_Compatibility", fragment="NumPy_Macros", fragment="NumPy_Utilities", fragment="NumPy_Object_to_Array", fragment="NumPy_Array_Requirements") { } /* End John Hunter translation (with modifications by Bill Spotz) */ /* %numpy_typemaps() macro * * This macro defines a family of 41 typemaps that allow C arguments * of the form * * (DATA_TYPE IN_ARRAY1[ANY]) * (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) * (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) * * (DATA_TYPE IN_ARRAY2[ANY][ANY]) * (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) * (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) * * (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) * (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) * (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3) * * (DATA_TYPE INPLACE_ARRAY1[ANY]) * (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1) * (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) * * (DATA_TYPE INPLACE_ARRAY2[ANY][ANY]) * (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2) * (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2) * * (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) * (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3) * (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3) * * (DATA_TYPE ARGOUT_ARRAY1[ANY]) * (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) * (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) * * (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) * * (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) * * (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1) * (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1) * * (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) * (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2) * (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) * (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2) * * (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) * (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3) * (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) * (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3) * * where "DATA_TYPE" is any type supported by the NumPy module, and * "DIM_TYPE" is any int-like type suitable for specifying dimensions. * The difference between "ARRAY" typemaps and "FARRAY" typemaps is * that the "FARRAY" typemaps expect FORTRAN ordering of * multidimensional arrays. In python, the dimensions will not need * to be specified (except for the "DATA_TYPE* ARGOUT_ARRAY1" * typemaps). The IN_ARRAYs can be a numpy array or any sequence that * can be converted to a numpy array of the specified type. The * INPLACE_ARRAYs must be numpy arrays of the appropriate type. The * ARGOUT_ARRAYs will be returned as new numpy arrays of the * appropriate type. * * These typemaps can be applied to existing functions using the * %apply directive. For example: * * %apply (double* IN_ARRAY1, int DIM1) {(double* series, int length)}; * double prod(double* series, int length); * * %apply (int DIM1, int DIM2, double* INPLACE_ARRAY2) * {(int rows, int cols, double* matrix )}; * void floor(int rows, int cols, double* matrix, double f); * * %apply (double IN_ARRAY3[ANY][ANY][ANY]) * {(double tensor[2][2][2] )}; * %apply (double ARGOUT_ARRAY3[ANY][ANY][ANY]) * {(double low[2][2][2] )}; * %apply (double ARGOUT_ARRAY3[ANY][ANY][ANY]) * {(double upp[2][2][2] )}; * void luSplit(double tensor[2][2][2], * double low[2][2][2], * double upp[2][2][2] ); * * or directly with * * double prod(double* IN_ARRAY1, int DIM1); * * void floor(int DIM1, int DIM2, double* INPLACE_ARRAY2, double f); * * void luSplit(double IN_ARRAY3[ANY][ANY][ANY], * double ARGOUT_ARRAY3[ANY][ANY][ANY], * double ARGOUT_ARRAY3[ANY][ANY][ANY]); */ %define %numpy_typemaps(DATA_TYPE, DATA_TYPECODE, DIM_TYPE) /************************/ /* Input Array Typemaps */ /************************/ /* Typemap suite for (DATA_TYPE IN_ARRAY1[ANY]) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE IN_ARRAY1[ANY]) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE IN_ARRAY1[ANY]) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[1] = { $1_dim0 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 1) || !require_size(array, size, 1)) SWIG_fail; $1 = ($1_ltype) array_data(array); } %typemap(freearg) (DATA_TYPE IN_ARRAY1[ANY]) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[1] = { -1 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 1) || !require_size(array, size, 1)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = (DIM_TYPE) array_size(array,0); } %typemap(freearg) (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[1] = {-1}; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 1) || !require_size(array, size, 1)) SWIG_fail; $1 = (DIM_TYPE) array_size(array,0); $2 = (DATA_TYPE*) array_data(array); } %typemap(freearg) (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DATA_TYPE IN_ARRAY2[ANY][ANY]) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE IN_ARRAY2[ANY][ANY]) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE IN_ARRAY2[ANY][ANY]) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[2] = { $1_dim0, $1_dim1 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2)) SWIG_fail; $1 = ($1_ltype) array_data(array); } %typemap(freearg) (DATA_TYPE IN_ARRAY2[ANY][ANY]) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[2] = { -1, -1 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = (DIM_TYPE) array_size(array,0); $3 = (DIM_TYPE) array_size(array,1); } %typemap(freearg) (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[2] = { -1, -1 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2)) SWIG_fail; $1 = (DIM_TYPE) array_size(array,0); $2 = (DIM_TYPE) array_size(array,1); $3 = (DATA_TYPE*) array_data(array); } %typemap(freearg) (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[2] = { -1, -1 }; array = obj_to_array_fortran_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2) || !require_fortran(array)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = (DIM_TYPE) array_size(array,0); $3 = (DIM_TYPE) array_size(array,1); } %typemap(freearg) (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[2] = { -1, -1 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 2) || !require_size(array, size, 2) || !require_fortran(array)) SWIG_fail; $1 = (DIM_TYPE) array_size(array,0); $2 = (DIM_TYPE) array_size(array,1); $3 = (DATA_TYPE*) array_data(array); } %typemap(freearg) (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3)) SWIG_fail; $1 = ($1_ltype) array_data(array); } %typemap(freearg) (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, * DIM_TYPE DIM3) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[3] = { -1, -1, -1 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = (DIM_TYPE) array_size(array,0); $3 = (DIM_TYPE) array_size(array,1); $4 = (DIM_TYPE) array_size(array,2); } %typemap(freearg) (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, * DATA_TYPE* IN_ARRAY3) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[3] = { -1, -1, -1 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3)) SWIG_fail; $1 = (DIM_TYPE) array_size(array,0); $2 = (DIM_TYPE) array_size(array,1); $3 = (DIM_TYPE) array_size(array,2); $4 = (DATA_TYPE*) array_data(array); } %typemap(freearg) (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, * DIM_TYPE DIM3) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[3] = { -1, -1, -1 }; array = obj_to_array_fortran_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3) | !require_fortran(array)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = (DIM_TYPE) array_size(array,0); $3 = (DIM_TYPE) array_size(array,1); $4 = (DIM_TYPE) array_size(array,2); } %typemap(freearg) (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, * DATA_TYPE* IN_FARRAY3) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3) { $1 = is_array($input) || PySequence_Check($input); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3) (PyArrayObject* array=NULL, int is_new_object=0) { npy_intp size[3] = { -1, -1, -1 }; array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE, &is_new_object); if (!array || !require_dimensions(array, 3) || !require_size(array, size, 3) || !require_fortran(array)) SWIG_fail; $1 = (DIM_TYPE) array_size(array,0); $2 = (DIM_TYPE) array_size(array,1); $3 = (DIM_TYPE) array_size(array,2); $4 = (DATA_TYPE*) array_data(array); } %typemap(freearg) (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3) { if (is_new_object$argnum && array$argnum) { Py_DECREF(array$argnum); } } /***************************/ /* In-Place Array Typemaps */ /***************************/ /* Typemap suite for (DATA_TYPE INPLACE_ARRAY1[ANY]) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE INPLACE_ARRAY1[ANY]) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE INPLACE_ARRAY1[ANY]) (PyArrayObject* array=NULL) { npy_intp size[1] = { $1_dim0 }; array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,1) || !require_size(array, size, 1) || !require_contiguous(array) || !require_native(array)) SWIG_fail; $1 = ($1_ltype) array_data(array); } /* Typemap suite for (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1) (PyArrayObject* array=NULL, int i=1) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,1) || !require_contiguous(array) || !require_native(array)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = 1; for (i=0; i < array_numdims(array); ++i) $2 *= array_size(array,i); } /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) (PyArrayObject* array=NULL, int i=0) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,1) || !require_contiguous(array) || !require_native(array)) SWIG_fail; $1 = 1; for (i=0; i < array_numdims(array); ++i) $1 *= array_size(array,i); $2 = (DATA_TYPE*) array_data(array); } /* Typemap suite for (DATA_TYPE INPLACE_ARRAY2[ANY][ANY]) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE INPLACE_ARRAY2[ANY][ANY]) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE INPLACE_ARRAY2[ANY][ANY]) (PyArrayObject* array=NULL) { npy_intp size[2] = { $1_dim0, $1_dim1 }; array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,2) || !require_size(array, size, 2) || !require_contiguous(array) || !require_native(array)) SWIG_fail; $1 = ($1_ltype) array_data(array); } /* Typemap suite for (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) (PyArrayObject* array=NULL) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,2) || !require_contiguous(array) || !require_native(array)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = (DIM_TYPE) array_size(array,0); $3 = (DIM_TYPE) array_size(array,1); } /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2) (PyArrayObject* array=NULL) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,2) || !require_contiguous(array) || !require_native(array)) SWIG_fail; $1 = (DIM_TYPE) array_size(array,0); $2 = (DIM_TYPE) array_size(array,1); $3 = (DATA_TYPE*) array_data(array); } /* Typemap suite for (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) (PyArrayObject* array=NULL) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,2) || !require_contiguous(array) || !require_native(array) || !require_fortran(array)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = (DIM_TYPE) array_size(array,0); $3 = (DIM_TYPE) array_size(array,1); } /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2) (PyArrayObject* array=NULL) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,2) || !require_contiguous(array) || !require_native(array) || !require_fortran(array)) SWIG_fail; $1 = (DIM_TYPE) array_size(array,0); $2 = (DIM_TYPE) array_size(array,1); $3 = (DATA_TYPE*) array_data(array); } /* Typemap suite for (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) (PyArrayObject* array=NULL) { npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 }; array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,3) || !require_size(array, size, 3) || !require_contiguous(array) || !require_native(array)) SWIG_fail; $1 = ($1_ltype) array_data(array); } /* Typemap suite for (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, * DIM_TYPE DIM3) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) (PyArrayObject* array=NULL) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,3) || !require_contiguous(array) || !require_native(array)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = (DIM_TYPE) array_size(array,0); $3 = (DIM_TYPE) array_size(array,1); $4 = (DIM_TYPE) array_size(array,2); } /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, * DATA_TYPE* INPLACE_ARRAY3) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3) (PyArrayObject* array=NULL) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,3) || !require_contiguous(array) || !require_native(array)) SWIG_fail; $1 = (DIM_TYPE) array_size(array,0); $2 = (DIM_TYPE) array_size(array,1); $3 = (DIM_TYPE) array_size(array,2); $4 = (DATA_TYPE*) array_data(array); } /* Typemap suite for (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, * DIM_TYPE DIM3) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) (PyArrayObject* array=NULL) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,3) || !require_contiguous(array) || !require_native(array) || !require_fortran(array)) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); $2 = (DIM_TYPE) array_size(array,0); $3 = (DIM_TYPE) array_size(array,1); $4 = (DIM_TYPE) array_size(array,2); } /* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, * DATA_TYPE* INPLACE_FARRAY3) */ %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY, fragment="NumPy_Macros") (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3) { $1 = is_array($input) && PyArray_EquivTypenums(array_type($input), DATA_TYPECODE); } %typemap(in, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3) (PyArrayObject* array=NULL) { array = obj_to_array_no_conversion($input, DATA_TYPECODE); if (!array || !require_dimensions(array,3) || !require_contiguous(array) || !require_native(array) || !require_fortran(array)) SWIG_fail; $1 = (DIM_TYPE) array_size(array,0); $2 = (DIM_TYPE) array_size(array,1); $3 = (DIM_TYPE) array_size(array,2); $4 = (DATA_TYPE*) array_data(array); } /*************************/ /* Argout Array Typemaps */ /*************************/ /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY1[ANY]) */ %typemap(in,numinputs=0, fragment="NumPy_Backward_Compatibility,NumPy_Macros") (DATA_TYPE ARGOUT_ARRAY1[ANY]) (PyObject * array = NULL) { npy_intp dims[1] = { $1_dim0 }; array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); if (!array) SWIG_fail; $1 = ($1_ltype) array_data(array); } %typemap(argout) (DATA_TYPE ARGOUT_ARRAY1[ANY]) { $result = SWIG_Python_AppendOutput($result,array$argnum); } /* Typemap suite for (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) */ %typemap(in,numinputs=1, fragment="NumPy_Fragments") (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) (PyObject * array = NULL) { npy_intp dims[1]; if (!PyInt_Check($input)) { const char* typestring = pytype_string($input); PyErr_Format(PyExc_TypeError, "Int dimension expected. '%s' given.", typestring); SWIG_fail; } $2 = (DIM_TYPE) PyInt_AsLong($input); dims[0] = (npy_intp) $2; array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); if (!array) SWIG_fail; $1 = (DATA_TYPE*) array_data(array); } %typemap(argout) (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) { $result = SWIG_Python_AppendOutput($result,array$argnum); } /* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) */ %typemap(in,numinputs=1, fragment="NumPy_Fragments") (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) (PyObject * array = NULL) { npy_intp dims[1]; if (!PyInt_Check($input)) { const char* typestring = pytype_string($input); PyErr_Format(PyExc_TypeError, "Int dimension expected. '%s' given.", typestring); SWIG_fail; } $1 = (DIM_TYPE) PyInt_AsLong($input); dims[0] = (npy_intp) $1; array = PyArray_SimpleNew(1, dims, DATA_TYPECODE); if (!array) SWIG_fail; $2 = (DATA_TYPE*) array_data(array); } %typemap(argout) (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) { $result = SWIG_Python_AppendOutput($result,array$argnum); } /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) */ %typemap(in,numinputs=0, fragment="NumPy_Backward_Compatibility,NumPy_Macros") (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) (PyObject * array = NULL) { npy_intp dims[2] = { $1_dim0, $1_dim1 }; array = PyArray_SimpleNew(2, dims, DATA_TYPECODE); if (!array) SWIG_fail; $1 = ($1_ltype) array_data(array); } %typemap(argout) (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) { $result = SWIG_Python_AppendOutput($result,array$argnum); } /* Typemap suite for (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) */ %typemap(in,numinputs=0, fragment="NumPy_Backward_Compatibility,NumPy_Macros") (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) (PyObject * array = NULL) { npy_intp dims[3] = { $1_dim0, $1_dim1, $1_dim2 }; array = PyArray_SimpleNew(3, dims, DATA_TYPECODE); if (!array) SWIG_fail; $1 = ($1_ltype) array_data(array); } %typemap(argout) (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) { $result = SWIG_Python_AppendOutput($result,array$argnum); } /*****************************/ /* Argoutview Array Typemaps */ /*****************************/ /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1) */ %typemap(in,numinputs=0) (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1 ) (DATA_TYPE* data_temp , DIM_TYPE dim_temp) { $1 = &data_temp; $2 = &dim_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility") (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1) { npy_intp dims[1] = { *$2 }; PyObject * array = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$1)); if (!array) SWIG_fail; $result = SWIG_Python_AppendOutput($result,array); } /* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1) */ %typemap(in,numinputs=0) (DIM_TYPE* DIM1 , DATA_TYPE** ARGOUTVIEW_ARRAY1) (DIM_TYPE dim_temp, DATA_TYPE* data_temp ) { $1 = &dim_temp; $2 = &data_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility") (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1) { npy_intp dims[1] = { *$1 }; PyObject * array = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$2)); if (!array) SWIG_fail; $result = SWIG_Python_AppendOutput($result,array); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) */ %typemap(in,numinputs=0) (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 ) (DATA_TYPE* data_temp , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp) { $1 = &data_temp; $2 = &dim1_temp; $3 = &dim2_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility") (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) { npy_intp dims[2] = { *$2, *$3 }; PyObject * array = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1)); if (!array) SWIG_fail; $result = SWIG_Python_AppendOutput($result,array); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2) */ %typemap(in,numinputs=0) (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DATA_TYPE** ARGOUTVIEW_ARRAY2) (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DATA_TYPE* data_temp ) { $1 = &dim1_temp; $2 = &dim2_temp; $3 = &data_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility") (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2) { npy_intp dims[2] = { *$1, *$2 }; PyObject * array = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3)); if (!array) SWIG_fail; $result = SWIG_Python_AppendOutput($result,array); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) */ %typemap(in,numinputs=0) (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 ) (DATA_TYPE* data_temp , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp) { $1 = &data_temp; $2 = &dim1_temp; $3 = &dim2_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements") (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2) { npy_intp dims[2] = { *$2, *$3 }; PyObject * obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1)); PyArrayObject * array = (PyArrayObject*) obj; if (!array || !require_fortran(array)) SWIG_fail; $result = SWIG_Python_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2) */ %typemap(in,numinputs=0) (DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DATA_TYPE** ARGOUTVIEW_FARRAY2) (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DATA_TYPE* data_temp ) { $1 = &dim1_temp; $2 = &dim2_temp; $3 = &data_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements") (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2) { npy_intp dims[2] = { *$1, *$2 }; PyObject * obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3)); PyArrayObject * array = (PyArrayObject*) obj; if (!array || !require_fortran(array)) SWIG_fail; $result = SWIG_Python_AppendOutput($result,obj); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) */ %typemap(in,numinputs=0) (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) (DATA_TYPE* data_temp, DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp) { $1 = &data_temp; $2 = &dim1_temp; $3 = &dim2_temp; $4 = &dim3_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility") (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) { npy_intp dims[3] = { *$2, *$3, *$4 }; PyObject * array = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1)); if (!array) SWIG_fail; $result = SWIG_Python_AppendOutput($result,array); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3) */ %typemap(in,numinputs=0) (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3) (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp) { $1 = &dim1_temp; $2 = &dim2_temp; $3 = &dim3_temp; $4 = &data_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility") (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3) { npy_intp dims[3] = { *$1, *$2, *$3 }; PyObject * array = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$3)); if (!array) SWIG_fail; $result = SWIG_Python_AppendOutput($result,array); } /* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) */ %typemap(in,numinputs=0) (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) (DATA_TYPE* data_temp, DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp) { $1 = &data_temp; $2 = &dim1_temp; $3 = &dim2_temp; $4 = &dim3_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements") (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3) { npy_intp dims[3] = { *$2, *$3, *$4 }; PyObject * obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1)); PyArrayObject * array = (PyArrayObject*) obj; if (!array || require_fortran(array)) SWIG_fail; $result = SWIG_Python_AppendOutput($result,obj); } /* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3) */ %typemap(in,numinputs=0) (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3) (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp) { $1 = &dim1_temp; $2 = &dim2_temp; $3 = &dim3_temp; $4 = &data_temp; } %typemap(argout, fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements") (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3) { npy_intp dims[3] = { *$1, *$2, *$3 }; PyObject * obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$3)); PyArrayObject * array = (PyArrayObject*) obj; if (!array || require_fortran(array)) SWIG_fail; $result = SWIG_Python_AppendOutput($result,obj); } %enddef /* %numpy_typemaps() macro */ /* *************************************************************** */ /* Concrete instances of the %numpy_typemaps() macro: Each invocation * below applies all of the typemaps above to the specified data type. */ %numpy_typemaps(signed char , NPY_BYTE , int) %numpy_typemaps(unsigned char , NPY_UBYTE , int) %numpy_typemaps(short , NPY_SHORT , int) %numpy_typemaps(unsigned short , NPY_USHORT , int) %numpy_typemaps(int , NPY_INT , int) %numpy_typemaps(unsigned int , NPY_UINT , int) %numpy_typemaps(long , NPY_LONG , int) %numpy_typemaps(unsigned long , NPY_ULONG , int) %numpy_typemaps(long long , NPY_LONGLONG , int) %numpy_typemaps(unsigned long long, NPY_ULONGLONG, int) %numpy_typemaps(float , NPY_FLOAT , int) %numpy_typemaps(double , NPY_DOUBLE , int) /* *************************************************************** * The follow macro expansion does not work, because C++ bool is 4 * bytes and NPY_BOOL is 1 byte * * %numpy_typemaps(bool, NPY_BOOL, int) */ /* *************************************************************** * On my Mac, I get the following warning for this macro expansion: * 'swig/python detected a memory leak of type 'long double *', no destructor found.' * * %numpy_typemaps(long double, NPY_LONGDOUBLE, int) */ /* *************************************************************** * Swig complains about a syntax error for the following macro * expansions: * * %numpy_typemaps(complex float, NPY_CFLOAT , int) * * %numpy_typemaps(complex double, NPY_CDOUBLE, int) * * %numpy_typemaps(complex long double, NPY_CLONGDOUBLE, int) */ #endif /* SWIGPYTHON */ stimfit-0.16.0/src/stimfit/py/extensions.py0000664000175000017500000000216313277303516015660 00000000000000""" User-defined Python extensions that can be called from the menu. """ import spells # class to create a submenu of Extensions class Extension(object): """ A Python extension that can be added as a submenu in the Extensions menu of Stimfit. """ def __init__(self, menuEntryString, pyFunc, description="", requiresFile=True, parentEntry=None): """ Arguments: menuEntryString -- This will be shown as a menu entry. pyFunc -- The Python function that is to be called. Takes no arguments and returns a boolean. description -- A more verbose description of the function. requiresFile -- Whether pyFunc requires a file to be opened. """ self.menuEntryString = menuEntryString self.pyFunc = pyFunc self.description = description self.requiresFile = requiresFile self.parentEntry = parentEntry # define an Extension: it will appear as a submenu in the Extensions Menu myExt = Extension("Count APs", spells.count_aps, "Count events >0 mV in selected files", True) extensionList = [myExt,] stimfit-0.16.0/src/stimfit/res/0000775000175000017500000000000013567226445013335 500000000000000stimfit-0.16.0/src/stimfit/res/arrow_down.xpm0000775000175000017500000000246613277303516016170 00000000000000/* XPM */ static const char *arrow_down[] = { /* columns rows colors chars-per-pixel */ "16 16 60 1", " c #256421", ". c #266522", "X c #276623", "o c #286824", "O c #296925", "+ c #2C6D27", "@ c #33752D", "# c #367A31", "$ c #3D8236", "% c #3E8338", "& c #438A3C", "* c #458C3D", "= c #4A8C45", "- c #4B8D46", "; c #4D8F48", ": c #4A9242", "> c #4C9545", ", c #50924B", "< c #509A48", "1 c #539E4A", "2 c #559A4E", "3 c #579951", "4 c #57A24E", "5 c #59A650", "6 c #5DAA53", "7 c #5FAD56", "8 c #63B259", "9 c #65B45B", "0 c #68B85D", "q c #6ABB5F", "w c #6CAD65", "e c #6DBE62", "r c #7CBF76", "t c #6FC063", "y c #70C265", "u c #72C566", "i c #73C667", "p c #74C768", "a c #7EC079", "s c #80C17A", "d c #82C27D", "f c #85C37E", "g c #87C581", "h c #89C682", "j c #8CC785", "k c #8EC987", "l c #91CA8A", "z c #93CB8B", "x c #95CC8E", "c c #98CE90", "v c #9ACF93", "b c #9CD094", "n c #9FD296", "m c #A1D398", "M c #A3D49A", "N c #A5D49C", "B c #A7D69E", "V c #A9D7A0", "C c #ABD8A2", "Z c None", /* pixels */ "ZZZZZZZZZZZZZZZZ", "ZZZZZZpuyeZZZZZZ", "ZZZZZZuCC0ZZZZZZ", "ZZZZZZtBN8ZZZZZZ", "ZZZZZZqMm6ZZZZZZ", "ZZZZZZ9nn4ZZZZZZ", "ZZZZZZ7vxjh$ZZZZZZ", "ZZZZZZ2gf#ZZZZZZ", "ZZZZ:*wds,+oZZZZ", "ZZZZZ%3ar=XZZZZZ", "ZZZZZZ@;=XZZZZZZ", "ZZZZZZZoXZZZZZZZ", "ZZZZZZZZZZZZZZZZ" }; stimfit-0.16.0/src/stimfit/res/event.xpm0000775000175000017500000000074513277303516015126 00000000000000/* XPM */ static const char *event[] = { /* columns rows colors chars-per-pixel */ "16 16 4 1", " c grey32", "x c grey48", "X c grey64", ". c None", /* pixels */ "................", " X......... x", "... X........ x.", "... X....... x..", "... X...... x...", "... X..... x....", "... X....X X....", "... X.... X.....", "... X...X ......", "... X..X .......", "... X.X X.......", "...x X X.......", "...X X........", "....X ..........", "................", "................" }; stimfit-0.16.0/src/stimfit/res/ch2.xpm0000775000175000017500000000104413277303516014452 00000000000000/* XPM */ static const char * ch2_[] = { /* columns rows colors chars-per-pixel */ "16 16 8 1", "0 c #FF0000", "1 c #FF2A2A", "2 c #FF3333", "3 c #FF2000", "4 c #FF1000", "5 c #FF6347", "X c #E9967A", ". c None", /* pixels */ "................", "................", "......0000......", ".....00..00.....", "....55...X55....", "....44....44....", "..........44....", ".........44.....", "........44......", "......33........", ".....33.........", "....22222000....", "....00001111....", "................", "................", "................" }; stimfit-0.16.0/src/stimfit/res/resultset_previous.xpm0000775000175000017500000000234413277303516017770 00000000000000/* XPM */ static const char *resultset_previous[] = { /* columns rows colors chars-per-pixel */ "16 16 54 1", " c #1130B0", ". c #1233B4", "X c #1339B4", "o c #1339B7", "O c #1440B9", "+ c #1547BD", "@ c #164ABD", "# c #1752C0", "$ c #195CC4", "% c #195CC6", "& c #315FC4", "* c #1B65C9", "= c #276ECD", "- c #376BC9", "; c #2A72CF", ": c #3D77D0", "> c #3A7CD4", ", c #4180D6", "< c #4885D6", "1 c #4A87D9", "2 c #5089D9", "3 c #538DD9", "4 c #5A90DB", "5 c #5990DD", "6 c #5F95DC", "7 c #6295DA", "8 c #6095DD", "9 c #6698DB", "0 c #679ADC", "q c #6599DF", "w c #699BDC", "e c #6E9FDD", "r c #71A1DE", "t c #72A1DF", "y c #6297E1", "u c #6599E1", "i c #6B9BE1", "p c #6B9DE0", "a c #71A0E0", "s c #77A4E0", "d c #75A4E3", "f c #7AA6E1", "g c #7AA6E5", "h c #7CA9E1", "j c #81ABE3", "k c #83ADE3", "l c #86AFE5", "z c #8BB3E5", "x c #8DB2E6", "c c #95B8E8", "v c #95B9E8", "b c #99BBE9", "n c #9ABDEA", "m c None", /* pixels */ "mmmmmmmmmmmmmmmm", "mmmmmmmmmmmmmmmm", "mmmmmmmmmiummmmm", "mmmmmmmmqy5mmmmm", "mmmmmmm8gn1mmmmm", "mmmmmm4dnc>mmmmm", "mmmmm3ablx;mmmmm", "mmmm2pcjrk*mmmmm", "mmmm,7xtqt%mmmmm", "mmmmm; c #96B3CC", " ", " ", " .. .. ", " .+@..@+. ", " .+@@..@@+. ", " .+@#@..$#$%. ", " .+@#&#**#&#$+. ", ".+@#&&&==&&&-@+.", ".+@#&&&==&&&-@+.", " .+@#&#**#&#$+. ", " .+@#@..$-;>. ", " .+@@..@@+. ", " .+@..@+. ", " .. .. ", " ", " "}; stimfit-0.16.0/src/stimfit/res/camera.xpm0000775000175000017500000000560113277303516015231 00000000000000/* XPM */ static const char *camera[] = { /* columns rows colors chars-per-pixel */ "16 16 143 2", " c #2A2A2A", ". c gray17", "X c #2C2C2C", "o c #2D2D2D", "O c #313131", "+ c gray20", "@ c #343434", "# c #353535", "$ c #373737", "% c #393939", "& c gray23", "* c #3C3C3C", "= c #3E3E3E", "- c #3F3F3F", "; c gray25", ": c #414141", "> c gray26", ", c #444444", "< c #464646", "1 c gray28", "2 c gray29", "3 c #4E4E4E", "4 c #505050", "5 c #535353", "6 c #565656", "7 c gray34", "8 c #585858", "9 c #5A5A5A", "0 c #5B5B5B", "q c gray36", "w c gray37", "e c #5F5F5F", "r c #606060", "t c gray38", "y c #626262", "u c #646464", "i c #656565", "p c #676767", "a c #686868", "s c DimGray", "d c #6A6A6A", "f c #6C6C6C", "g c #6D6D6D", "h c gray43", "j c #6F6F6F", "k c #717171", "l c #727272", "z c #747474", "x c gray46", "c c #767676", "v c gray47", "b c gray48", "n c #7C7C7C", "m c #7E7E7E", "M c #857C69", "N c #9B937F", "B c #F3BE41", "V c #5C96D5", "C c #5E96D5", "Z c #5E97D6", "A c #5F98D6", "S c #6496CE", "D c #6899CE", "F c #689ACE", "G c #6397D0", "H c #6397D1", "J c #6496D0", "K c #6099D6", "L c #6299D6", "P c #609AD6", "I c #629AD7", "U c #639BD7", "Y c #669BD7", "T c #649CD7", "R c #659CD7", "E c #699AD4", "W c #6A9AD4", "Q c #619AD8", "! c #659BD8", "~ c #669CD8", "^ c #679CD8", "/ c #679DD8", "( c #669DD9", ") c #699ED9", "_ c #6A9FD9", "` c #6AA0D9", "' c #808080", "] c #818181", "[ c #848484", "{ c gray52", "} c #868686", "| c gray53", " . c #888888", ".. c #8B8B8B", "X. c gray55", "o. c #8D8D8D", "O. c #8E8E8E", "+. c #909090", "@. c #929292", "#. c #939392", "$. c #939393", "%. c gray58", "&. c #959595", "*. c gray59", "=. c #979797", "-. c #989898", ";. c #9A9A9A", ":. c #9B9B9B", ">. c #9D9D9D", ",. c gray62", "<. c #9F9F9F", "1. c #8393A3", "2. c #95A5B8", "3. c gray64", "4. c #A5A5A5", "5. c gray65", "6. c #A9A9A9", "7. c #AAAAAA", "8. c gray68", "9. c #AEAEAE", "0. c gray69", "q. c #B4B4B4", "w. c #B7B7B7", "e. c #B9B9B9", "r. c gray73", "t. c #BCBCBC", "y. c #F9E0A4", "u. c #A2B3C5", "i. c #B7C7DA", "p. c #C0C0C0", "a. c gray77", "s. c #C6C6C6", "d. c gray78", "f. c #C8C8C8", "g. c gray79", "h. c gray80", "j. c #D0D0D0", "k. c #D2D2D2", "l. c #D5D5D5", "z. c #D7D7D7", "x. c #D8D8D8", "c. c #DDDDDD", "v. c None", /* pixels */ "v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.", "v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.", "v.-.+... .] v k h c ..v.v.v.v.v.", "v.-.f.f.s.a.N y.B M +.v.q q q v.", "h 9.k.0.5.,.w.=.4.u.7.l a a a 5 ", "h t.5.t.c.z.z.h.5.[ =.q.,.o...: ", "a 5.r.i.W C V H u.=.k 9.-.a N # ", "p -.x.W L Y T A S 9.w 6.@.w b $ ", "i %.j.C ! ` ) R L 4.5 5.X.7 c % ", "y o.d.A ! ) ` ) L :.4 ,.{ 3 h $ ", "r | r.S U ! ! ! D X.2 -.' 1 a $ ", "w m ..2.S T ! D 1.0 : =.n : u O ", "7 j a b :.-.$.{ 8 ; p +.z t 9 O ", "v.$ $ , , : - * @ o . . . ", "v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.", "v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v." }; stimfit-0.16.0/src/stimfit/res/resultset_first.xpm0000775000175000017500000000314713277303516017245 00000000000000/* XPM */ static const char *resultset_first[] = { /* columns rows colors chars-per-pixel */ "16 16 80 1", " c #1233B2", ". c #1239B6", "X c #133CB7", "o c #143EB6", "O c #1441BB", "+ c #164ABD", "@ c #1752C0", "# c #1855C4", "$ c #195AC4", "% c #1859C6", "& c #195CC6", "* c #1A62C8", "= c #1E69CB", "- c #1E6BCD", "; c #3364C6", ": c #386BCA", "> c #2C74CF", ", c #3D77D0", "< c #397BD2", "1 c #4481D3", "2 c #4180D4", "3 c #4384D6", "4 c #4784D6", "5 c #4A85D6", "6 c #4584D8", "7 c #4A89D9", "8 c #4C89D8", "9 c #5089D9", "0 c #528BD9", "q c #538DD9", "w c #5E91D8", "e c #5C92DF", "r c #6397DA", "t c #6297DB", "y c #6597DB", "u c #6497DD", "i c #669ADF", "p c #6A9BDC", "a c #6B9CDD", "s c #699DDF", "d c #6E9FDD", "f c #6D9DDE", "g c #6D9EDE", "h c #709FDE", "j c #71A1DF", "k c #76A3DF", "l c #659BE1", "z c #73A2E1", "x c #70A0E2", "c c #77A4E1", "v c #77A6E6", "b c #79A7E1", "n c #7AA7E0", "m c #7BA8E1", "M c #7EA8E1", "N c #7EA9E2", "B c #7EA9E8", "V c #83ACE3", "C c #85ADE4", "Z c #86AEE4", "A c #80ABE8", "S c #80ABEA", "D c #8AB1E5", "F c #8DB2E6", "G c #8EB3E6", "H c #8FB5E7", "J c #8FB4E8", "K c #90B5E6", "L c #90B4E7", "P c #91B6E8", "I c #96B9EA", "U c #98BBE9", "Y c #9DBEEC", "T c #9EC0EB", "R c #A2C1EE", "E c #A5C4ED", "W c #ABC8EF", "Q c #B0CBF0", "! c #B4CEF2", "~ c None", /* pixels */ "~~~~~~~~~~~~~~~~", "~~~~~~~~~~~~~~~~", "~~~SSBv~~~~q0~~~", "~~~S!Rx~~~876~~~", "~~~vQYl~~5aP<~~~", "~~~xWIe~4lJF>~~~", "~~~lEJ01uKMC-~~~", "~~~eTU3xFbaM*~~~", "~~~0UF=1mrh@~~~", "~~~Vy*~~+:rO~~~", "~~~-mw%~~~o;X~~~", "~~~*&#@~~~~ .~~~", "~~~~~~~~~~~~~~~~", "~~~~~~~~~~~~~~~~" }; stimfit-0.16.0/src/stimfit/res/slope.xpm0000775000175000017500000000164013277303516015122 00000000000000/* XPM */ static const char *slope[] = { "16 16 37 1", " c None", ". c #5297DA", "+ c #3E678F", "@ c #2A80D3", "# c #6D9BC8", "$ c #2981D5", "% c #2485E1", "& c #3176B8", "* c #318AE0", "= c #2C7DCB", "- c #2A7ED0", "; c #5998D5", "> c #2A7ECF", ", c #5897D5", "' c #6099D1", ") c #6F9BC6", "! c #287FD3", "~ c #1E90FF", "{ c #2C7BC8", "] c #2783DA", "^ c #5F99D0", "/ c #2581D8", "( c #5196D8", "_ c #2E7BC6", ": c #2C8AE5", "< c #2F7AC3", "[ c #328AE0", "} c #2782DA", "| c #3488DB", "1 c #2882D7", "2 c #348ADD", "3 c #2B7FCF", "4 c #2980D4", "5 c #2486E4", "6 c #1F8DF7", "7 c #3E94E8", "8 c #4B85BC", " ", " ", " .+@ ", " #$%&# ", " *=#@-; ", " @;@#>,@ ", " @'@@)!~@ ", " @'@ @){~@ ", " @'@ @]^~@ ", " @'@ #/(@@ ", " @'@ _:~@@ ", " @'@ <[~@@", " @'@ }|@@", "@@@1'@ =2@", "34567@ @8", " "}; stimfit-0.16.0/src/stimfit/res/zoom_out.xpm0000775000175000017500000000300613277303516015651 00000000000000/* XPM */ static const char *zoom_out[] = { /* columns rows colors chars-per-pixel */ "16 16 74 1", " c #EA111C", ". c #EC1A23", "X c #EE262E", "o c #F1353A", "O c #874828", "+ c #A55C33", "@ c #AB6437", "# c #AB6737", "$ c #AB643D", "% c #B77E47", "& c #F44548", "* c #F75456", "= c #FA6362", "- c #FC6F6D", "; c #FE7874", ": c #B98048", "> c #BC854A", ", c #BC844B", "< c #BB814C", "1 c #BC834F", "2 c #BC864C", "3 c #BD864C", "4 c #BD894C", "5 c #BE894D", "6 c #BE8A4D", "7 c #BE8A4F", "8 c #BC8451", "9 c #C18E4F", "0 c #C18F4F", "q c #C28F50", "w c #C18C52", "e c #C18E58", "r c #C39150", "t c #C39153", "y c #C39156", "u c #C49555", "i c #C69655", "p c #C79757", "a c #C69956", "s c #C79A57", "d c #C89C57", "f c #C99F5B", "g c #CDA45B", "h c #CCA15D", "j c #CDA55E", "k c #CDA65E", "l c #CEA65E", "z c #CEA75E", "x c #C99B61", "c c #CDA561", "v c #CEA660", "b c #CEA761", "n c #CEA662", "m c #CFA762", "M c #CFA861", "N c #CFA864", "B c #D6B479", "V c #D7B57D", "C c #D6B57F", "Z c #DABB80", "A c #DBBF87", "S c #F3A09B", "D c #F4ABA4", "F c #F6B6AE", "G c #DEC48D", "H c #DFC58F", "J c #E0C793", "K c #E3CC99", "L c #E7D3A0", "P c #E8D5A3", "I c #E9D7A5", "U c #F7C0B7", "Y c #F8C8BF", "T c None", /* pixels */ "TTTTTTTTTTTTTTTT", "TTTzvNNhfTTTTTTT", "TTMzTTTTapTTTTTT", "TMgTTTTTTrrTTTTT", "zzTTTTTTTT97TTTT", "vTTTTTTTTTT7TTTT", "vTTTTTTTTTT7TTTT", "vTTTTTTTTTT3TTTT", "fTTTT;-=*&oXTTTT", "apTTT-YUFDS.TTTT", "Tp0TT=*&oX. TTTT", "TT97TTTTwBKG1TTT", "TTT>33,%1APIZ$TT", "TTTTTTTTTeHLJxOT", "TTTTTTTTTT8VVe#T", "TTTTTTTTTTT+:#TT" }; stimfit-0.16.0/src/stimfit/res/arrow_left.xpm0000775000175000017500000000212513277303516016143 00000000000000/* XPM */ static const char *arrow_left[] = { /* columns rows colors chars-per-pixel */ "16 16 45 1", " c #205E1D", ". c #246321", "X c #296925", "o c #2F702A", "O c #35782F", "+ c #3B8035", "@ c #42883B", "# c #499141", "$ c #4F9947", "% c #56A14D", "& c #5CA953", "* c #64AA5B", "= c #62B158", "- c #68B85D", "; c #7BBE71", ": c #78BD72", "> c #7CBE76", ", c #71C365", "< c #74C768", "1 c #7EC078", "2 c #80C17A", "3 c #83C17A", "4 c #82C27D", "5 c #84C37E", "6 c #86C87B", "7 c #87C97C", "8 c #8ACC7F", "9 c #87C581", "0 c #89C682", "q c #8BC785", "w c #8BCD80", "e c #8EC987", "r c #90CA89", "t c #93CB8B", "y c #95CC8E", "u c #98CE90", "i c #9ACF93", "p c #9DD094", "a c #9FD296", "s c #A1D398", "d c #A3D49A", "f c #A5D59C", "g c #A7D69E", "h c #ABD8A2", "j c None", /* pixels */ "jjjjjjjjjjjjjjjj", "jjjjjjjjjjjjjjjj", "jjjjjjjjjjjjjjjj", "jjjjjjjjjjjjjjjj", "jjjj:.j", "jj-;3*$#@+OoX. j", "jjj&%jjjjjjjjjjj", "jjjj$jjjjjjjjjjj", "jjjjjjjjjjjjjjjj", "jjjjjjjjjjjjjjjj", "jjjjjjjjjjjjjjjj", "jjjjjjjjjjjjjjjj" }; stimfit-0.16.0/src/stimfit/res/ch1.xpm0000775000175000017500000000110513277303516014447 00000000000000/* XPM */ static const char *ch_[] = { /* columns rows colors chars-per-pixel */ "16 16 11 1", "1 c grey8", "2 c grey12", "3 c grey16", "4 c grey20", "5 c grey24", "6 c grey28", "7 c grey32", "8 c grey36", "9 c grey40", "0 c grey44", ". c None", /* pixels */ "................", "................", "......000.......", ".......00.......", ".......99.......", ".......99.......", ".......88.......", ".......88.......", ".......88.......", ".......77.......", ".......44.......", ".......33.......", ".....111111.....", "................", "................", "................" }; stimfit-0.16.0/src/stimfit/res/zoom_in.xpm0000775000175000017500000000323313277303516015452 00000000000000/* XPM */ static const char *zoom_in[] = { /* columns rows colors chars-per-pixel */ "16 16 84 1", " c #2A6B26", ". c #2E6F29", "X c #30712B", "o c #32742C", "O c #33762E", "+ c #357930", "@ c #874828", "# c #A55C33", "$ c #AB6437", "% c #AB6737", "& c #AB643D", "* c #3E8337", "= c #448B3D", "- c #4D9645", "; c #539E4B", ": c #5A9B53", "> c #5CA852", ", c #5EAB54", "< c #5FAD56", "1 c #65A75E", "2 c #61B057", "3 c #63B259", "4 c #67B65C", "5 c #6BAC63", "6 c #76B76D", "7 c #B98048", "8 c #BC854A", "9 c #BC844B", "0 c #BC834F", "q c #BC864C", "w c #BD864C", "e c #BD894C", "r c #BE894D", "t c #BE8A4D", "y c #BE8A4F", "u c #BC8451", "i c #C18E4F", "p c #C18F4F", "a c #C28F50", "s c #C18E58", "d c #C39150", "f c #C39153", "g c #C39156", "h c #C49555", "j c #C69655", "k c #C79757", "l c #C69956", "z c #C79A57", "x c #C89C57", "c c #C99F5B", "v c #CDA45B", "b c #CCA15D", "n c #CDA55E", "m c #CDA65E", "M c #CEA65E", "N c #CEA75E", "B c #C99B61", "V c #CDA561", "C c #CEA660", "Z c #CEA761", "A c #CEA662", "S c #CFA762", "D c #CFA861", "F c #CFA864", "G c #D7B57D", "H c #D6B57F", "J c #82C27D", "K c #86C57D", "L c #DABB80", "P c #8BC683", "I c #8BC785", "U c #90CA88", "Y c #9ACF92", "T c #9ED195", "R c #9FD297", "E c #A6D59D", "W c #DEC48D", "Q c #DFC58F", "! c #E0C793", "~ c #E3CC99", "^ c #E7D3A0", "/ c #E8D5A3", "( c #E9D7A5", ") c None", /* pixels */ "))))))))))))))))", ")))NCFFbc)))))))", "))DN))))lk))))))", ")Dv))))))dd)))))", "NN))))))))iy))))", "C))))))))))y))))", "C))))))42>)y))))", "C))))))TYKUP+))))", ")ki));-1I:o.))))", "))dy)))*Jo~Q0)))", ")))9ww9+X /(L&))", ")))))))))sQ^!B@)", "))))))))))uHHg%)", ")))))))))))#7%))" }; stimfit-0.16.0/src/stimfit/res/camera_ps.xpm0000775000175000017500000000604313277303516015734 00000000000000/* XPM */ static const char *camera_ps[] = { /* columns rows colors chars-per-pixel */ "16 16 143 2", " c #2A2A2A", ". c gray17", "X c #2C2C2C", "o c #2D2D2D", "O c #313131", "+ c gray20", "@ c #343434", "# c #353535", "$ c #373737", "% c #393939", "& c gray23", "* c #3C3C3C", "= c #3E3E3E", "- c #3F3F3F", "; c gray25", ": c #414141", "> c gray26", ", c #444444", "< c #464646", "1 c gray28", "2 c gray29", "3 c #4E4E4E", "4 c #505050", "5 c #535353", "6 c #565656", "7 c gray34", "8 c #585858", "9 c #5A5A5A", "0 c #5B5B5B", "q c gray36", "w c gray37", "e c #5F5F5F", "r c #606060", "t c gray38", "y c #626262", "u c #646464", "i c #656565", "p c #676767", "a c #686868", "s c DimGray", "d c #6A6A6A", "f c #6C6C6C", "g c #6D6D6D", "h c gray43", "j c #6F6F6F", "k c #717171", "l c #727272", "z c #747474", "x c gray46", "c c #767676", "v c gray47", "b c gray48", "n c #7C7C7C", "m c #7E7E7E", "M c #857C69", "N c #9B937F", "B c #F3BE41", "V c #5C96D5", "C c #5E96D5", "Z c #5E97D6", "A c #5F98D6", "S c #6496CE", "D c #6899CE", "F c #689ACE", "G c #6397D0", "H c #6397D1", "J c #6496D0", "K c #6099D6", "L c #6299D6", "P c #609AD6", "I c #629AD7", "U c #639BD7", "Y c #669BD7", "T c #649CD7", "R c #659CD7", "E c #699AD4", "W c #6A9AD4", "Q c #619AD8", "! c #659BD8", "~ c #669CD8", "^ c #679CD8", "/ c #679DD8", "( c #669DD9", ") c #699ED9", "_ c #6A9FD9", "` c #6AA0D9", "' c #808080", "] c #818181", "[ c #848484", "{ c gray52", "} c #868686", "| c gray53", " . c #888888", ".. c #8B8B8B", "X. c gray55", "o. c #8D8D8D", "O. c #8E8E8E", "+. c #909090", "@. c #929292", "#. c #939392", "$. c #939393", "%. c gray58", "&. c #959595", "*. c gray59", "=. c #979797", "-. c #989898", ";. c #9A9A9A", ":. c #9B9B9B", ">. c #9D9D9D", ",. c gray62", "<. c #9F9F9F", "1. c #8393A3", "2. c #95A5B8", "3. c gray64", "4. c #A5A5A5", "5. c gray65", "6. c #A9A9A9", "7. c #AAAAAA", "8. c gray68", "9. c #AEAEAE", "0. c gray69", "q. c #B4B4B4", "w. c #B7B7B7", "e. c #B9B9B9", "r. c gray73", "t. c #BCBCBC", "y. c #F9E0A4", "u. c #A2B3C5", "i. c #B7C7DA", "p. c #C0C0C0", "a. c gray77", "s. c #C6C6C6", "d. c gray78", "f. c #C8C8C8", "g. c gray79", "h. c gray80", "j. c #D0D0D0", "k. c #D2D2D2", "l. c #D5D5D5", "z. c #D7D7D7", "x. c #D8D8D8", "c. c #DDDDDD", "v. c None", /* pixels */ "v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.", "v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.", "v.-.+... .] v k h c ..v.v.v.v.v.", "v.-.f.f.s.a.N y.B M +.v.q q q v.", "h 9.k.0.5.,.w.=.4.u.7.l a a a 5 ", "h t.5.t.c.z.z.h.5.[ =.q.,.o...: ", "a 5.r.i.W C V H u.=.k 9.-.a N # ", "p -.x.W L Y T A S 9.w 6.@.w b $ ", "i %.j.C ! ` ) R L 4.5 5.X.7 c % ", "y o.d.A ! ) ` v.v.v.v.v.v.v.v.v.", "r | r.S U ! ! v.. . . . v.. . . ", "w m ..2.S T ! v.. v.v.. v.. v.v.", "7 j a b :.-.$.v.. v.v.. v.. . v.", "v.$ $ , , : - v.. . . . v.v.. . ", "v.v.v.v.v.v.v.v.. v.v.v.v.v.v.. ", "v.v.v.v.v.v.v.v.. v.v.v.v.. . . " }; stimfit-0.16.0/src/stimfit/res/16-em-open.xpm0000775000175000017500000000112713277303516015564 00000000000000/* XPM */ static const char *___em_open[] = { /* columns rows colors chars-per-pixel */ "16 16 11 1", " c #678FB1", ". c #72A6D6", "X c #B8B7AD", "o c #97B4CD", "O c #9DB8CF", "+ c #97BDE1", "@ c #AFCCE8", "# c #C4D9EE", "$ c #DCE9F5", "% c #EBF2F9", "& c None", /* pixels */ "&&&&&&&&&&&&&&&&", "&&&&&&& &&&&&&&", "&&&&&& OO &&&&&&", "&&&&& O%%O &&&&&", "&&&& O%##%O &&&&", "&&& O%#@@#%O &&&", "&& O%#@@@@#%O &&", "&& $$$+..+$$$ &&", "&& o$..$o &&", "&&XXX $..$ XXX&&", "&&&&& $..$ &&&&&", "&&&&& $..$ &&&&&", "&&&&& $$$$ &&&&&", "&&&&& &&&&&", "&&&&&XXXXXX&&&&&", "&&&&&&&&&&&&&&&&" }; stimfit-0.16.0/src/stimfit/res/stimfit16x16.xpm0000664000175000017500000000317613277303516016170 00000000000000/* XPM */ static char *stimfit_16x16[] = { /* columns rows colors chars-per-pixel */ "16 16 82 1 ", " c #14162D", ". c #0F1830", "X c #0F1A33", "o c #151A34", "O c #141B37", "+ c #1C1F3E", "@ c #241E3C", "# c #1C203F", "$ c #25274E", "% c #3E264B", "& c #2B2850", "* c #302D5A", "= c #382C58", "- c #2D3060", "; c #2E376D", ": c #323060", "> c #3B366C", ", c #2A3870", "< c #452E5D", "1 c #304183", "2 c #32458B", "3 c #3A458A", "4 c #354992", "5 c #334A95", "6 c #324E9D", "7 c #3150A1", "8 c #3351A2", "9 c #3155A9", "0 c #3358AF", "q c #3658B0", "w c #3459B2", "e c #3A5AB4", "r c #395EBC", "t c #395EBD", "y c #3A5FBD", "u c #395FBE", "i c #3E5DBC", "p c #4650A1", "a c #425AB5", "s c #3961C2", "d c #3C61C2", "f c #3C65C9", "g c #3E64C9", "h c #3E65CA", "j c #3C66CC", "k c #3D66CC", "l c #3D67CD", "z c #3F66CD", "x c #3D67CE", "c c #3C67CF", "v c #3D67CF", "b c #3E67CE", "n c #3E67CF", "m c #3D68CF", "M c #3E68CF", "N c #3D68D0", "B c #3D68D1", "V c #3E68D0", "C c #3E68D1", "Z c #3D69D2", "A c #3D69D3", "S c #3E69D2", "D c #3F69D2", "F c #3D6AD3", "G c #3F6AD3", "H c #3F6AD4", "J c #3E6AD5", "K c #3F6BD6", "L c #3D6CD7", "P c #3F6CD7", "I c #3F6CD8", "U c #4167CC", "Y c #4268D1", "T c #4369D2", "R c #406AD3", "E c #406AD4", "W c #406AD5", "Q c #416BD7", "! c #406CD8", "~ c #416DDB", "^ c #426FDE", "/ c None", /* pixels */ "////////////////", "////////////////", "//rzzfzzzzfzzr//", "//SMMzMzzzzMMS//", "//MzS1-SjjjzzM//", "//zMS-%3SzjjMz//", "//zzz*e;!MMM//", "//!7.2IjU@7~SM//", "//qo5!jjI5Ow9f//", "//frSzzjMS,#+6//", "//S!zzMzMz!Y!U//", "//rSzzzMzzzz!r//", "///XX..XX.X.X///", "////////////////" }; stimfit-0.16.0/src/stimfit/res/resultset_next.xpm0000775000175000017500000000235713277303516017076 00000000000000/* XPM */ static const char *resultset_next[] = { /* columns rows colors chars-per-pixel */ "16 16 55 1", " c #1441B7", ". c #1545B9", "X c #164ABD", "o c #1750BD", "O c #164EC0", "+ c #1853C0", "@ c #1859C4", "# c #1959C6", "$ c #1A62C6", "% c #1A62C9", "& c #236ECD", "* c #2C72CD", "= c #3B71CC", "- c #3C74CF", "; c #3577D2", ": c #3D77D0", "> c #3F7AD0", ", c #437FD3", "< c #4384D6", "1 c #4784D6", "2 c #4B88D6", "3 c #538EDB", "4 c #6095DD", "5 c #6197DD", "6 c #72A1DF", "7 c #75A3DF", "8 c #6297E1", "9 c #6EA0E2", "0 c #74A3E0", "q c #74A2E2", "w c #77A4E0", "e c #75A4E3", "r c #79A6E0", "t c #79A7E6", "y c #7CA9E1", "u c #7EA8E1", "i c #7CA9E8", "p c #7EA9E8", "a c #81ABE2", "s c #80AAE3", "d c #81ABE3", "f c #87AFE4", "g c #80ABE8", "h c #80ABEA", "j c #8AB1E4", "k c #87B0E8", "l c #90B5E7", "z c #92B7E8", "x c #99BBE9", "c c #99BBEA", "v c #A1C1EC", "b c #A3C2ED", "n c #A8C7EE", "m c #ADC8EF", "M c None", /* pixels */ "MMMMMMMMMMMMMMMM", "MMMMMMMMMMMMMMMM", "MMMMhpMMMMMMMMMM", "MMMMhiqMMMMMMMMM", "MMMMtmk4MMMMMMMM", "MMMM9nbe1MMMMMMM", "MMMM8vzx5*MMMMMM", "MMMM3cssj2$MMMMM", "MMMM c #42A91F", ", c #42AB1F", "< c #42AD1F", "1 c #4C973D", "2 c #4BB426", "3 c #52B92B", "4 c #52BB2D", "5 c #54BB2D", "6 c #54BD31", "7 c #55BE34", "8 c #55C034", "9 c #59C236", "0 c #5BC239", "q c #4E9B41", "w c #52A042", "e c #5EA948", "r c #64B04C", "t c #6CB656", "y c #6DB757", "u c #6AB950", "i c #6EB558", "p c #6FB558", "a c #6FB559", "s c #70BF57", "d c #74B75B", "f c #74B75C", "g c #70B859", "h c #71B95B", "j c #72B95B", "k c #73BA5C", "l c #71BE5F", "z c #7DB766", "x c #77BC60", "c c #7CBA64", "v c #7DBC66", "b c #7DBE67", "n c #7FB869", "m c #74C259", "M c #6FC261", "N c #6FC361", "B c #6EC461", "V c #6EC462", "C c #6EC563", "Z c #6FC664", "A c #70C163", "S c #71C463", "D c #74C364", "F c #70C765", "G c #73C766", "H c #79C164", "J c #7EC169", "K c #7EC76F", "L c #72C868", "P c #74C868", "I c #75C868", "U c #76C969", "Y c #76CA6A", "T c #79C96B", "R c #7ACC6D", "E c #7FCA70", "W c #83BE6D", "Q c #87C272", "! c #85C575", "~ c #89C476", "^ c #80CA73", "/ c #80CC72", "( c #83CE77", ") c #87C979", "_ c #8BC878", "` c #90CE7F", "' c #96C783", "] c #9AC787", "[ c #96CB86", "{ c #97CC85", "} c #98CB86", "| c #9ACA87", " . c #98CC87", ".. c #96CD88", "X. c #99CD8A", "o. c #9DCE8B", "O. c #99D18B", "+. c #99D08C", "@. c #9AD48D", "#. c #9FD291", "$. c #9BD791", "%. c #9DD892", "&. c #A1D695", "*. c #A1D795", "=. c #A3D796", "-. c #ABD29B", ";. c #ABD39B", ":. c #AFD7A0", ">. c #AED7A1", ",. c #AEDCA5", "<. c #AFDCA6", "1. c #B3D9A5", "2. c #B4D9A5", "3. c #B4DAA6", "4. c #B1DDA7", "5. c #B2DBA8", "6. c #B5DBA8", "7. c #B4DDAA", "8. c #B4DFAC", "9. c #B5DFAC", "0. c #B5E1AE", "q. c #B7E1AF", "w. c #B7E1B0", "e. c #BEE3B6", "r. c #BFE3B8", "t. c #C0E4B9", "y. c #D6EED2", "u. c #D9ECD4", "i. c #E6F4E3", "p. c #EDF7EB", "a. c #F1F9F0", "s. c #F4FAF2", "d. c #FCFDFB", "f. c #FDFEFD", "g. c gray100", "h. c None", /* pixels */ "h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.", "h.h.h.h.h.h.0 6 4 3 h.h.h.h.h.h.", "h.h.h.h.9 m =.,.,.*.u < h.h.h.h.", "h.h.h.8 ` q.%.( ( %.q.~ : h.h.h.", "h.h.7 ` q.R I L I I T 8.~ - h.h.", "h.h.s q.R L Z Z Z S e.K q.e h.h.", "h.5 *.$.I Z Z M M r.g.i.O.o.= h.", "h.2 4./ L q.y.M e.g.d.+.J >.% h.", "h., ,./ ^ a.g.p.g.d...j b :.$ h.", "h.> &.+.D ) s.g.g.[ t j [ ] $ h.", "h.h.r 7.H l ! u.X.t i f 3.q h.h.", "h.h.; Q 5.x k j i i d 1.n o h.h.", "h.h.h.* W 3. .c c | 3.c h.h.h.", "h.h.h.h.= w .-.-.' 1 h.h.h.h.", "h.h.h.h.h.h.$ + O h.h.h.h.h.h.", "h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h." }; stimfit-0.16.0/src/stimfit/res/sum_new.xpm0000775000175000017500000000215513277303516015457 00000000000000/* XPM */ static const char *sum_new[] = { /* columns rows colors chars-per-pixel */ "16 16 48 1", " c black", ". c gray8", "X c gray16", "o c #2A2A2A", "O c #2D2D2D", "+ c gray18", "@ c #2F2F2F", "# c #313131", "$ c #323232", "% c #343434", "& c #353535", "* c #373737", "= c #3A3A3A", "- c gray25", "; c gray27", ": c gray28", "> c #484848", ", c #494949", "< c #4C4C4C", "1 c #4E4E4E", "2 c gray31", "3 c #515151", "4 c gray32", "5 c #555555", "6 c #565656", "7 c #585858", "8 c #5D5D5D", "9 c gray39", "0 c #646464", "q c gray40", "w c #686868", "e c #6A6A6A", "r c #6D6D6D", "t c #6F6F6F", "y c gray44", "u c #727272", "i c gray45", "p c #767676", "a c #777777", "s c #7B7B7B", "d c #7E7E7E", "f c #818181", "g c #8B8B8B", "h c gray56", "j c #9A9A9A", "k c gray62", "l c gray74", "z c None", /* pixels */ "zzzzzzzzzzzzzzzz", "zzzzzzzzzzzzzzzz", "zzfdspytw9zzzzzz", "zzdlsytwq8zzzzzz", "zzzghzzzz6zzzzzz", "zzzykqzzzzzzzzzz", "zzzzqjzzzzzzzzzz", "zzzzz74zzzzzzzzz", "zzzz64zzzzzzz zz", "zzz64,zzz%zz zzz", "zzz<:zzzz+z zzzz", "zz<::%%$+oz ---z", "zz:==%$+o. -zzz-", "zzzzzzzzz z-zzz-", "zzzzzzzz zz-zzz-", "zzzzzzz zzz-zzz-" }; stimfit-0.16.0/src/stimfit/res/resultset_last.xpm0000775000175000017500000000322313277303516017054 00000000000000/* XPM */ static const char *resultset_last[] = { /* columns rows colors chars-per-pixel */ "16 16 83 1", " c #1239B6", ". c #133AB7", "X c #133CB7", "o c #143EB9", "O c #1441BB", "+ c #164ABD", "@ c #1752C0", "# c #1855C0", "$ c #1959C4", "% c #1859C6", "& c #195CC6", "* c #1A60C6", "= c #1A62C8", "- c #1A63C8", "; c #1E6BCD", ": c #2A72CF", "> c #2C74CF", ", c #397BD1", "< c #397BD2", "1 c #4281D3", "2 c #4481D3", "3 c #4685D6", "4 c #4E80D2", "5 c #4B87D6", "6 c #4584D8", "7 c #4E89D8", "8 c #5385D4", "9 c #578BD6", "0 c #528BD9", "q c #5E92D9", "w c #5E94D8", "e c #5990DD", "r c #5C92DF", "t c #6397DA", "y c #6095DF", "u c #6297DF", "i c #6699DD", "p c #6A9BDC", "a c #699DDF", "s c #6E9DDF", "d c #709FDE", "f c #74A3DF", "g c #76A3DF", "h c #659BE1", "j c #73A2E0", "k c #70A0E2", "l c #72A2E2", "z c #77A6E6", "x c #7AA6E5", "c c #7BA8E3", "v c #7EA8E1", "b c #7FA9E3", "n c #7FAAE3", "m c #7BA7E8", "M c #7EA9E8", "N c #81ABE2", "B c #82ABE3", "V c #83ACE3", "C c #85ADE4", "Z c #84AEE4", "A c #86AEE4", "S c #80ABE8", "D c #87B0E6", "F c #89B1E4", "G c #8AB1E5", "H c #8BB2E5", "J c #89B1E6", "K c #8BB3E7", "L c #8DB2E6", "P c #88B0E8", "I c #91B6E8", "U c #92B7E8", "Y c #94B7E8", "T c #97BAEA", "R c #98BBE9", "E c #9ABCEA", "W c #9EBEEA", "Q c #9EC0EB", "! c #A6C3EE", "~ c #A5C4ED", "^ c #ABC8EF", "/ c #ADC8EF", "( c None", /* pixels */ "((((((((((((((((", "((((((((((((((((", "(((SM((((hue0(((", "(((SMk(((rJE6(((", "(((z/Pu((0AY<(((", "(((k^!x7(3cL>(((", "(((h~TWa<V2&((@8tO(((", "(((;1%(((+4tO(((", "(((=#((((Oo (((", "((((((((((((((((", "((((((((((((((((" }; stimfit-0.16.0/src/stimfit/res/arrow_right.xpm0000775000175000017500000000210713277303516016326 00000000000000/* XPM */ static const char *arrow_right[] = { /* columns rows colors chars-per-pixel */ "16 16 44 1", " c #246321", ". c #296925", "X c #35782F", "o c #3B8035", "O c #42883B", "+ c #45883F", "@ c #498B44", "# c #4A8C45", "$ c #499141", "% c #4F9947", "& c #50914A", "* c #5C9D55", "= c #56A14D", "- c #5CA953", "; c #5EA159", ": c #62A35A", "> c #62B158", ", c #68B85D", "< c #6DBE61", "1 c #7CBE76", "2 c #71C365", "3 c #74C768", "4 c #80C17A", "5 c #82C27D", "6 c #84C37E", "7 c #87C581", "8 c #89C682", "9 c #8BC785", "0 c #8EC987", "q c #90CA89", "w c #93CB8B", "e c #95CC8E", "r c #98CE90", "t c #9ACF93", "y c #9DD094", "u c #9FD296", "i c #A1D398", "p c #A3D49A", "a c #A5D59C", "s c #A7D69E", "d c #A9D7A0", "f c #ABD8A2", "g c #AEDAA5", "h c None", /* pixels */ "hhhhhhhhhhhhhhhh", "hhhhhhhhhhhhhhhh", "hhhhhhhhhhhhhhhh", "hhhhhhhhhhhhhhhh", "hhhhhhhhhhh%hhhh", "hhhhhhhhhhh$Ohhh", "h332<,>-=%$:*Xhh", "h3gfsputeq975&.h", "h2ssiytq08641# h", "h<,>-=%$Oo+;@ hh", "hhhhhhhhhhh. hhh", "hhhhhhhhhhh hhhh", "hhhhhhhhhhhhhhhh", "hhhhhhhhhhhhhhhh", "hhhhhhhhhhhhhhhh", "hhhhhhhhhhhhhhhh" }; stimfit-0.16.0/src/stimfit/res/cursor.xpm0000775000175000017500000000250613277303516015317 00000000000000/* XPM */ static const char *cursor[] = { /* columns rows colors chars-per-pixel */ "16 16 63 1", " c gray46", ". c gray47", "X c #797979", "o c #7C7C7C", "O c gray49", "+ c #848484", "@ c #868686", "# c #888888", "$ c #898989", "% c #8D8D8D", "& c #8E8E8E", "* c gray57", "= c gray58", "- c #959595", "; c gray59", ": c gray61", "> c #9D9D9D", ", c gray62", "< c #A0A0A0", "1 c #A4A4A4", "2 c #A7A7A7", "3 c #A9A9A9", "4 c #AAAAAA", "5 c gray68", "6 c #AFAFAF", "7 c #B1B1B1", "8 c gray71", "9 c #B6B6B6", "0 c #B7B7B7", "q c #B9B9B9", "w c #BBBBBB", "e c gray74", "r c gray", "t c #C1C1C1", "y c gray77", "u c #C5C5C5", "i c #C6C6C6", "p c #C8C8C8", "a c #CBCBCB", "s c #D0D0D0", "d c #D5D5D5", "f c #D7D7D7", "g c gray85", "h c gray86", "j c #DFDFDF", "k c gray88", "l c #E1E1E1", "z c #E2E2E2", "x c gray89", "c c #E4E4E4", "v c gray90", "b c #E7E7E7", "n c gray91", "m c #EAEAEA", "M c #ECECEC", "N c gray93", "B c #EEEEEE", "V c #EFEFEF", "C c gray94", "Z c gray95", "A c #F4F4F4", "S c gray97", "D c None", /* pixels */ "DDDDDDDDDDDDDDDD", "DDDDpuDDDDDDDDDD", "DDDDugeDDDDDDDDD", "DDDDtSdqDDDDDDDD", "DDDDeSVa6DDDDDDD", "DDDD0SVVp2DDDDDD", "DDDD0ZncVu,DDDDD", "DDDD6Vczzct;DDDD", "DDDD6Vzzzccq%DDD", "DDDD2Zzcc;*%$$DD", "DDDD1d,aV*DDDDDD", "DDDD,,D;gt$DDDDD", "DDDD,DDD6Z@DDDDD", "DDDDDDDD@gqODDDD", "DDDDDDDDD4g.DDDD", "DDDDDDDDDO. DDDD" }; stimfit-0.16.0/src/stimfit/res/stimfit.png0000664000175000017500000000507613277303516015443 00000000000000PNG  IHDR@@iqsRGBbKGD pHYs  tIME 6l IDATxmUϙwߺKEZ ByRhR"h5QP1  H DAF FHHR–m{޽wfy0vm.gdfdr?u#y$׳}$G\ӤG_;#0~> 2A3+b|U@.yAĉqڨ\t%]hȝS}\|{C8VjC7ԏק S WX.m jYTRFһRڷ7X Brt-\\[TI$g%_֖9ow,ӵz:/ rDi6_GU1X3~ z@m99'm]2 Sπq9u ƤT9nES 0FPm4˟sPdSu76P8T3^8d:`1#NmUuM#G 21H1 [Γ\J+2YQQx{^C.g#Vfih8qXڲt:ȻOg١ 2iAB')Оm#_f߆_L"Buo/o|2<7cbp`1_u BіC{/qud Z Iib1wY'|&O1o1 X@ KxbPO$RG 2-&i!_=u ( QDPux";Qd,l+{/Fv#0IqsϢs"A1UP܆(^) vXb7Q15  ܆pPWEpʊoa{l'bm|X0- Pj^qYjyVDRҬ*N@pP/x\Ђ_Jl 3 Q0BnC|(≡䩼p;Ќۃ?4XQs?b1ĈK(vSG`A \| 9bQ\FUZ/(eMbx_ZdC.\jͭ vtUzV|0!g)vnj6=Xy՗YDk\'\Ig0#x V-|a\ )/ |'YQ3@T" %w|"[;°9sI6o? ?1 |SGdCZ]6R!孨٫n"x~Vڃ L>47JlfT# GZz\UɋVADu8%f/I0g>P9ͩoރU[$y_9 Puo#Qhoiͬ5]4U'6*;dqhoQ:״lu1Ά |Yqԣ]d+y[8/o?yO#ͺk<ٮc /;`(D~c xzc9] /T/EQgPFvn%1C`.0W<3zV-xbiڦ4GKw c #484848", ", c #494949", "< c #4C4C4C", "1 c #4E4E4E", "2 c gray31", "3 c #515151", "4 c gray32", "5 c #555555", "6 c #565656", "7 c #585858", "8 c #5D5D5D", "9 c gray39", "0 c #646464", "q c gray40", "w c #686868", "e c #6A6A6A", "r c #6D6D6D", "t c #6F6F6F", "y c gray44", "u c #727272", "i c gray45", "p c #767676", "a c #777777", "s c #7B7B7B", "d c #7E7E7E", "f c #818181", "g c #8B8B8B", "h c gray56", "j c #9A9A9A", "k c gray62", "l c gray74", "z c None", /* pixels */ "zzzzzzzzzzzzzzzz", "zzzzzzzzzzzzzzzz", "zzfdspytw9zzzzz ", "zzdlsytwq8zz zz ", "zzzghzzzz6zzz z ", "zzzykqzzzzz ", "zzzzqjzzzzzzz z ", "zzzzz74zzzzz zz ", "zzzz64zzzzzzz z ", "zzz64,zzz%zz zzz", "zzz<:zzzz+z zzzz", "zz<::%%$+oz ---z", "zz:==%$+o. -zzz-", "zzzzzzzzz z-zzz-", "zzzzzzzz zz-zzz-", "zzzzzzz zzz-zzz-" }; stimfit-0.16.0/src/stimfit/res/arrow_up.xpm0000775000175000017500000000246413277303516015643 00000000000000/* XPM */ static const char *arrow_up[] = { /* columns rows colors chars-per-pixel */ "16 16 60 1", " c #22601E", ". c #256421", "X c #266522", "o c #296925", "O c #2B6B26", "+ c #2D6E28", "@ c #30722B", "# c #33752D", "$ c #367A31", "% c #397D33", "& c #3D8236", "* c #3F8539", "= c #438A3C", "- c #468D3F", "; c #4A9242", ": c #4C9545", "> c #509A48", ", c #539E4A", "< c #58A44F", "1 c #59A650", "2 c #5EAC55", "3 c #5FAD56", "4 c #65AC5D", "5 c #65B45B", "6 c #68B85D", "7 c #6EBF62", "8 c #78BD72", "9 c #7ABD74", "0 c #7CBF76", "q c #70C265", "w c #71C365", "e c #72C466", "r c #72C566", "t c #73C667", "y c #7DC073", "u c #7EC079", "i c #80C17A", "p c #83C679", "a c #82C27D", "s c #86C37D", "d c #85C37E", "f c #85C87B", "g c #87CA7C", "h c #88CA7E", "j c #87C581", "k c #89C682", "l c #8CC785", "z c #8EC987", "x c #91CA8A", "c c #93CB8B", "v c #95CC8E", "b c #98CE90", "n c #9ACF93", "m c #9CD094", "M c #9FD296", "N c #A1D398", "B c #A3D49A", "V c #A5D49C", "C c #A7D69E", "Z c None", /* pixels */ "ZZZZZZZZZZZZZZZZ", "ZZZZZZZrwZZZZZZZ", "ZZZZZZrhg6ZZZZZZ", "ZZZZZrgCV93ZZZZZ", "ZZZZw7pBNs<,ZZZZ", "ZZZZZZ5MM4ZZZZZZ", "ZZZZZZ3nv>ZZZZZZ", "ZZZZZZ1vc;ZZZZZZ", "ZZZZZZ,cz=ZZZZZZ", "ZZZZZZ:lk&ZZZZZZ", "ZZZZZZ-js$ZZZZZZ", "ZZZZZZ*au@ZZZZZZ", "ZZZZZZ%uuOZZZZZZ", "ZZZZZZ#98XZZZZZZ", "ZZZZZZ+oX ZZZZZZ", "ZZZZZZZZZZZZZZZZ" }; stimfit-0.16.0/src/stimfit/res/stimfit32x32.xpm0000664000175000017500000001145713277303516016165 00000000000000/* XPM */ static char *stimfit_32x32[] = { /* columns rows colors chars-per-pixel */ "32 32 164 2 ", " c black", ". c #020000", "X c #050305", "o c #090000", "O c #110000", "+ c #130103", "@ c #19070E", "# c #1E080F", "$ c #0D0D1B", "% c #160E1C", "& c #290B17", "* c #220F1E", "= c #2E0D1A", "- c #1A1021", "; c #111D3A", ": c #111E3D", "> c #201124", ", c #2E1327", "< c #2F1327", "1 c #29172E", "2 c #37152A", "3 c #30172E", "4 c #261D3A", "5 c #211F3F", "6 c #361933", "7 c #391A34", "8 c #3F1A34", "9 c #301D3A", "0 c #441831", "q c #16254B", "w c #17264B", "e c #17254C", "r c #17264C", "t c #182850", "y c #182851", "u c #182951", "i c #182952", "p c #192B56", "a c #1E2B57", "s c #232143", "d c #2D2346", "f c #2B284F", "g c #302449", "h c #2A2953", "j c #2A2F5E", "k c #2E2E5C", "l c #2F2F5E", "z c #302E5C", "x c #382C58", "c c #3D2F5E", "v c #2C305F", "b c #252F60", "n c #2A3265", "m c #2E3264", "M c #303060", "N c #313162", "B c #283871", "V c #293B77", "C c #283C78", "Z c #323C77", "A c #303C79", "S c #323F7D", "D c #4C2040", "F c #462D5B", "G c #4D2D5B", "H c #4B3264", "J c #2E468C", "K c #354284", "L c #354285", "P c #32478F", "I c #3A478E", "U c #3E478E", "Y c #3E478F", "T c #3E4C98", "R c #384E9C", "E c #3152A3", "W c #3253A6", "Q c #3253A7", "! c #3A52A4", "~ c #3454A8", "^ c #3455AA", "/ c #3356AD", "( c #3457AE", ") c #3757AE", "_ c #3857AF", "` c #3458AF", "' c #3558B1", "] c #3559B1", "[ c #3658B0", "{ c #365BB7", "} c #385DBA", "| c #385FBE", " . c #3A5FBF", ".. c #48458A", "X. c #4F458A", "o. c #4554A9", "O. c #4559B2", "+. c #4958B1", "@. c #4A5CB7", "#. c #3A62C3", "$. c #3B62C4", "%. c #3D63C8", "&. c #3B65C9", "*. c #3B67CD", "=. c #3C66CC", "-. c #3D66CC", ";. c #3C66CD", ":. c #3D66CD", ">. c #3C67CD", ",. c #3D67CD", "<. c #3C67CE", "1. c #3D67CE", "2. c #3C67CF", "3. c #3D67CF", "4. c #3E67CF", "5. c #3E68CF", "6. c #3D68D0", "7. c #3C69D1", "8. c #3E68D0", "9. c #3E68D1", "0. c #3D69D3", "q. c #3E69D2", "w. c #3F69D2", "e. c #3F69D3", "r. c #3C6AD3", "t. c #3F6AD2", "y. c #3E6AD3", "u. c #3F6AD3", "i. c #3E6AD4", "p. c #3F6AD4", "a. c #3E6AD5", "s. c #3E6BD5", "d. c #3F6BD5", "f. c #3E6BD6", "g. c #3F6BD6", "h. c #3E6BD7", "j. c #3F6BD7", "k. c #3E6CD7", "l. c #3F6CD8", "z. c #4262C3", "x. c #4562C3", "c. c #4063C7", "v. c #4466CC", "b. c #4369D3", "n. c #4468D0", "m. c #4469D3", "M. c #406BD5", "N. c #426BD5", "B. c #406BD6", "V. c #406BD7", "C. c #436BD6", "Z. c #426BD7", "A. c #436BD7", "S. c #406CD7", "D. c #426CD7", "F. c #486BD5", "G. c #406CD8", "H. c #416DDA", "J. c #446DDA", "K. c #456DDA", "L. c #426EDC", "P. c #426FDE", "I. c #4270DF", "U. c None", /* pixels */ "U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.", "U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.", "U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.", "U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.", "U.U.U.U.^ J.B.J.B.B.F.B.B.B.B.B.B.J.B.B.F.B.B.B.B.B.J.~ U.U.U.U.", "U.U.U.q B.:.:.:.:.:.v.:.v.:.v.:.:.:.:.:.:.v.%.:.v.:.:.B.t U.U.U.", "U.U.U.u n.:.:.:.:.:.:.7.:.:.:.:.:.:.:.:.:.:.%.,.:.:.:.B.u U.U.U.", "U.U.U.t 7.:.:.:.:.:.:.7.7.,.:.:.:.:.%.:.:.:.,.,.:.:.:.B.u U.U.U.", "U.U.U.u n.,.:.%.,.,.,.C b %.,.:.,.,.:.,.,.,.,.,.:.:.,.B.t U.U.U.", "U.U.U.t B.,.:.:.,.,.` * & h ,.,.:.,.%.,.,.%.:.,.%.:.,.7.t U.U.U.", "U.U.U.u B.,.:.:.,.7.P , G 3 A l.%.,.%.,.:.%.:.%.,.:.:.7.u U.U.U.", "U.U.U.t 7.,.%.:.,.B.A , O.H 7 ^ ,.,.:.,.,.,.,.,.,.:.:.n.u U.U.U.", "U.U.U.u 7.:.%.:.,.B.N 3 %.@.D x ,.7.,.,.,.,.,.,.%.:.:.B.u U.U.U.", "U.U.U.t B.:.:.:.,.7.f 9 %.7.X.0 K 7.,.,.%.:.:.%.:.:.:.7.u U.U.U.", "U.U.U.t B.:.:.:.,.:.4 d ,.,.v.G 9 ) B.:.,.,.:.:.:.:.:.B.u U.U.U.", "U.U.U.u B.:.%.:.7.%.> z B.:.7.@.0 d :.,.,.%.:.,.%.:.:.B.y U.U.U.", "U.U.U.t 7.:.:.:.B.^ @ Z 7.,.,.7...= n 7.:.:.:.:.:.:.,.B.t U.U.U.", "U.U.U.t B.:.:.:.I.V O R 7.,.,.,.n.c # J J.:.:.:.%.:.,.B.t U.U.U.", "U.U.U.t B.:.,.7.~ $ - :.7.,.:.%.,.x.1 % | 7.:.:.:.:.:.7.u U.U.U.", "U.U.U.t B.7.:.i X o U B.:.,.,.,.,.J.T O u J.:.:.:.:.:.,.u U.U.U.", "U.U.U.u 7.| ; X 5 o.B.:.,.,.,.,.:.:.B.s X ` l.7.B.7.7.B.u U.U.U.", "U.U.U.t I.B X j B.7.:.v.%.:.:.%.:.:.7.! X ; ` ^ ^ ^ | 7.y U.U.U.", "U.U.U.u B.x.U B.,.:.:.:.,.,.,.,.:.:.:.B.j X X X X X ; J.u U.U.U.", "U.U.U.t 7.:.B.:.:.:.%.:.,.%.:.,.:.:.:.,.n.U k k k k K B.u U.U.U.", "U.U.U.u B.:.:.:.:.:.:.,.,.,.:.%.:.:.:.:.:.B.J.J.J.J.B.B.t U.U.U.", "U.U.U.u B.:.:.%.%.:.:.%.%.:.:.:.:.:.:.:.:.:.:.:.:.:.:.B.t U.U.U.", "U.U.U.q B.:.:.:.:.:.:.:.,.,.,.,.:.:.:.:.:.:.:.:.:.:.:.B.t U.U.U.", "U.U.U.U.~ B.B.7.B.B.B.7.7.B.B.n.7.n.7.7.n.B.7.B.7.7.B.^ U.U.U.U.", "U.U.U.U.U.q u t u t t u t u t u t t t t u t t u u u q U.U.U.U.U.", "U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.", "U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.", "U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U." }; stimfit-0.16.0/src/stimfit/res/zoom.xpm0000775000175000017500000000263113277303516014765 00000000000000/* XPM */ static const char *zoom[] = { /* columns rows colors chars-per-pixel */ "16 16 67 1", " c #874828", ". c #9B5830", "X c #A55C33", "o c #AB6437", "O c #AB6737", "+ c #AB643D", "@ c #BE7340", "# c #B67943", "$ c #B77E47", "% c #B87F47", "& c #B98048", "* c #B98149", "= c #BC854A", "- c #BC844B", "; c #BB814C", ": c #BC834F", "> c #BC864C", ", c #BD864C", "< c #BD894C", "1 c #BE894D", "2 c #BE8A4D", "3 c #BE8A4F", "4 c #BC8451", "5 c #C18E4F", "6 c #C18F4F", "7 c #C28F50", "8 c #C18C52", "9 c #C18E58", "0 c #C39150", "q c #C39153", "w c #C39255", "e c #C39156", "r c #C49555", "t c #C69655", "y c #C79757", "u c #C69956", "i c #C79A57", "p c #C89C57", "a c #C99F5B", "s c #CDA45B", "d c #CCA15D", "f c #CDA55E", "g c #CDA65E", "h c #CEA65E", "j c #CEA75E", "k c #C99B61", "l c #CDA561", "z c #CEA660", "x c #CEA761", "c c #CEA662", "v c #CFA762", "b c #CFA861", "n c #CFA864", "m c #D2AB6F", "M c #D6B479", "N c #D7B57D", "B c #D6B57F", "V c #DABB80", "C c #DBBF87", "Z c #DEC48D", "A c #DFC58F", "S c #E0C793", "D c #E3CC99", "F c #E7D3A0", "G c #E8D5A3", "H c #E9D7A5", "J c None", /* pixels */ "JJJjxnxdaJJJJJJJ", "JJxjJJJJuyJJJJJJ", "JxsJJJJJJ00JJJJJ", "jjJJJJJJJJ7 c #6392CE", ", c #6493CE", "< c #6896D1", "1 c #6A97D1", "2 c #6E99D3", "3 c #6F9BD4", "4 c #729ED6", "5 c #74A0D7", "6 c #75A1D7", "7 c #7AA3DA", "8 c #7AA4D9", "9 c #7DA5DC", "0 c #7EA8DD", "q c #89C682", "w c #8EC987", "e c #93CB8B", "r c #98CE90", "t c #9DD094", "y c #A1D398", "u c #A5D59C", "i c #80A9DD", "p c #82AADF", "a c #84ACE0", "s c #87AEE1", "d c #88AFE2", "f c #8CB1E3", "g c #8CB2E4", "h c #8FB4E5", "j c #90B5E6", "k c #93B7E7", "l c #94B7E7", "z c #96BAE9", "x c #98BAE9", "c c #9ABCEB", "v c #9BBDEB", "b c #9DBEEB", "n c #9EBFEC", "m c #9FC0ED", "M c #A6C3E9", "N c #A1C1EE", "B c #A2C1EF", "V c #A9C4E8", "C c #AAC6E9", "Z c #ACC7E8", "A c #ACC6E9", "S c #ADC7E9", "D c #ACC7EA", "F c #ADC7EA", "G c #AEC8E8", "H c #AEC9E9", "J c #AEC9EA", "K c #B0C8E8", "L c #B0C9E9", "P c #B0C9EA", "I c #B2CBEA", "U c #B3CCEA", "Y c #B5CCE8", "T c #B5CDEA", "R c #B7CEEA", "E c #BACFEA", "W c #BAD0EB", "Q c #BBD0EB", "! c #BDD1EB", "~ c #BED2EB", "^ c #BFD3EB", "/ c #D8E2F0", "( c #DBE4F1", ") c #DBE5F1", "_ c #DEE7F2", "` c #DEE7F3", "' c #E2EAF4", "] c #E6EDF6", "[ c #EAF0F7", "{ c #EBF1F7", "} c #EDF2F8", "| c #EEF3F9", " . c #EFF3F9", ".. c #F0F4FA", "X. c #F1F6FA", "o. c #F2F6FA", "O. c #F2F6FB", "+. c #F4F7FB", "@. c gray100", "#. c None", /* pixels */ "#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.", "#.#.B m b v z k k g d a i 9 7 #.", "#.B +.+.+.+.+.+.o.o.+.+.+.+.5 #.", "#.n +.u y t r e w q X . o.4 #.", "#.v +.@.@.@.@.@.@.@.@.@.@.+.1 #.", "#.x +.M M M M M M M M M M +., #.", "#.l +.M @.C @.@.@.A @.@.@.{ : #.", "#.h o.C A A A H K Z K K Y _ * #.", "#.g O.J @.K @.@.@.H @.@.@.) @ #.", "#.a o.U U U U U Y Z A K H / @ #.", "#.a .Y @.W @.@.@.W O.@.@./ & #.", "#.9 .W E ! W E ! Y Y T Y / % #.", "#.8 .^ @.! @.@.@.A @.@.@./ & #.", "#.5 .[ ] ' ` _ / / / / / / % #.", "#.4 2 < , ; = @ O O O O O O o #.", "#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#." }; stimfit-0.16.0/src/stimfit/res/arrow_out.xpm0000775000175000017500000000426113277303516016023 00000000000000/* XPM */ static const char *arrow_out[] = { /* columns rows colors chars-per-pixel */ "16 16 96 2", " c #418A3E", ". c #428B3F", "X c #428C3F", "o c #438D40", "O c #448D40", "+ c #458E41", "@ c #458F41", "# c #469042", "$ c #479143", "% c #499445", "& c #4A9545", "* c #4C9447", "= c #4D9948", "- c #4E9948", "; c #4F9B4A", ": c #509C4A", "> c #529F4C", ", c #54A14E", "< c #55A24E", "1 c #56A34F", "2 c #57A450", "3 c #57A550", "4 c #58A651", "5 c #59A752", "6 c #5BA654", "7 c #5AA852", "8 c #5AA853", "9 c #5BA953", "0 c #5CAA54", "q c #5CAB54", "w c #5DAC55", "e c #5EAD56", "r c #5FAD56", "t c #5FAE57", "y c #5EA05A", "u c #61A55D", "i c #63A45F", "p c #64A65E", "a c #64A75F", "s c #60AF58", "d c #61B058", "f c #61B159", "g c #62B159", "h c #62B259", "j c #63B35A", "k c #64B45B", "l c #66B65C", "z c #67B45F", "x c #68B95E", "c c #69B95F", "v c #67A862", "b c #70AD6C", "n c #71AD6D", "m c #73AE6E", "M c #6ABB60", "N c #6BBC60", "B c #6DBF63", "V c #71B46A", "C c #73B46C", "Z c #73B56C", "A c #73B66C", "S c #73B66D", "D c #74B56E", "F c #75B86E", "G c #7AB773", "H c #79B375", "J c #7DBD75", "K c #7EBD76", "L c #6EC063", "P c #70C365", "I c #71C365", "U c #72C466", "Y c #72C566", "T c #73C667", "R c #74C768", "E c #75C56B", "W c #83BB7D", "Q c #82C479", "! c #84C77B", "~ c #86C07E", "^ c #87CA7E", "/ c #89BF83", "( c #8AC083", ") c #8AC084", "_ c #89C980", "` c #8CCC83", "' c #90C58A", "] c #93C78C", "[ c #94C88D", "{ c #95C98E", "} c #9BD192", "| c #A4D39B", " . c #A5D69D", ".. c #A7D69E", "X. c #A9D8A1", "o. c None", /* pixels */ "R R T T P o.o.o.o.o.o.l l g t t ", "R X...P o.o.o.o.o.o.o.o.z ] { 0 ", "U ..} ^ L o.o.o.o.o.o.g K ~ ' 8 ", "P R ` | ! N o.o.o.o.g K ] S 5 3 ", "P o.B _ Q N o.o.o.o.s F S 5 o.< ", "o.o.o.N x o.o.o.o.o.o.8 5 o.o.o.", "o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.", "o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.", "o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.", "o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.", "o.o.o.t t o.o.o.o.o.o.: ; o.o.o.", "g o.t S V 5 o.o.o.o.; a v & o.$ ", "g t V ) D 2 o.o.o.o.= p H i * O ", "t ( G D 3 o.o.o.o.o.o.& y p n X ", "q / W 6 o.o.o.o.o.o.o.o.$ n m X ", "8 5 < < > o.o.o.o.o.o.$ O X X " }; stimfit-0.16.0/src/stimfit/gui/0000775000175000017500000000000013567226445013330 500000000000000stimfit-0.16.0/src/stimfit/gui/zoom.h0000775000175000017500000000424713277303516014410 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file zoom.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares the Zoom struct. */ #ifndef _ZOOM_H #define _ZOOM_H //! Handles y-scaling of traces class YZoom { public: //! Default constructor YZoom() : startPosY(500), yZoom(0.1), isLogScaleY(false) {} //! Constructor /*! \param spy1 The y offset in pixels. * \param yz1 The y-scaling. * \param lsy Currently unused. */ YZoom(long spy1, double yz1, bool lsy=false) : startPosY(spy1), yZoom(yz1), isLogScaleY(lsy) {} long startPosY; /*!< The y offset in pixels. */ double yZoom; /*!< The y-scaling. */ bool isLogScaleY; /*!< Currently unused. */ //! Overloaded multiplication operator. YZoom operator*( double factor ); }; //! Handles x-scaling of traces class XZoom { public: //! Default constructor XZoom() : startPosX(0), xZoom(0.1), isLogScaleX(false) {} //! Constructor /*! \param spx The x offset in pixels. * \param xz The x-scaling. * \param lsx Currently unused. */ XZoom( long spx, double xz, bool lsx=false ) : startPosX(spx), xZoom(xz), isLogScaleX(lsx) {} long startPosX; /*!< The x offset in pixels. */ double xZoom; /*!< The x-scaling. */ bool isLogScaleX; /*!< Currently unused. */ //! Overloaded multiplication operator. XZoom operator*( double factor ); }; #endif stimfit-0.16.0/src/stimfit/gui/parentframe.h0000775000175000017500000002226613277303516015731 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file parentframe.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfParentFrame. */ #ifndef _PARENTFRAME_H #define _PARENTFRAME_H /*! \addtogroup wxstf * @{ */ #include #include #include #include "./../stf.h" class wxStfGraph; class wxStfTable; class wxStfGrid; class wxStfFileDrop; class wxProgressDialog; //! child frame type; depends on whether aui is used for the doc/view interface #ifdef WITH_AUIDOCVIEW typedef wxAuiDocMDIChildFrame wxStfChildType; #else typedef wxDocMDIChildFrame wxStfChildType; #endif //! parent frame type; depends on whether aui is used for the doc/view interface #ifdef WITH_AUIDOCVIEW typedef wxAuiDocMDIParentFrame wxStfParentType; #else typedef wxDocMDIParentFrame wxStfParentType; #endif typedef wxAuiToolBar wxStfToolBar; #ifdef WITH_PYTHON struct new_wxwindow { new_wxwindow(wxWindow* cppW=NULL, PyObject* pyW=NULL) : cppWindow(cppW), pyWindow(pyW) {} wxWindow* cppWindow; PyObject* pyWindow; }; #else struct new_wxwindow { new_wxwindow(wxWindow* cppW=NULL, void* pyW=NULL) : cppWindow(cppW), pyWindow(pyW) {} wxWindow* cppWindow; void* pyWindow; }; #endif //! Provides the top-level frame. /*! It is part of the of the document/view framework implemented in wxWidgets. * This class can only be used for MDI parent frames. */ class StfDll wxStfParentFrame : public wxStfParentType { DECLARE_CLASS(wxStfParentFrame) public: //! Constructor /*! \param manager Pointer to the document manager. * \param frame Pointer to the parent frame (should be NULL, because this is * the top-level frame * \param title Title of this frame. * \param pos Initial position of this frame. * \param size Initial size of this frame. * \param style Window style. */ wxStfParentFrame(wxDocManager *manager, wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long style); //! Destructor ~wxStfParentFrame(); //! Shows the "About" dialog. /*! \param event The menu event that made the call. */ void OnAbout(wxCommandEvent& event); //! Creates a new graph. /*! Called from view.cpp when a new drawing view is created. * \param view Pointer to the attached view. * \param parent Pointer to the child frame that will serve as a parent for the new graph. * \return A pointer to the newly created graph. */ wxStfGraph *CreateGraph(wxView *view, wxStfChildFrame *parent); //! Retrieve the current mouse mode. /*! \return The current mouse cursor mode. */ stf::cursor_type GetMouseQual() const; //! Sets the current mouse cursor mode. /*! \param value The new mouse cursor mode. */ void SetMouseQual(stf::cursor_type value); //! Sets status of the toolbar's selection button. /*! \param selected The desired toggle status of the selection button. */ void SetSelectedButton(bool selected); //! Retrieve which channels will be affected by scaling operations /*! \return The channels affected by scaling operations. */ stf::zoom_channels GetZoomQual() const; //! Set the channels that will be affected by scaling operations /*! \param value The channels affected by scaling operations. */ void SetZoomQual(stf::zoom_channels value); //! Set the zoom buttons to single- or multi-channel mode. /*! \param value Set to true for single- or false for multi-channel mode. */ void SetSingleChannel(bool value); //! Retrieves the print data /*! \return Pointer to the stored print data. */ wxPrintData* GetPrintData() { return m_printData.get(); } //! Retrieves the page setup /*! \return Pointer to the page setup data. */ wxPageSetupDialogData* GetPageSetup() { return m_pageSetupData.get(); } //! Retrieve the wxAuiManager. /*! \return A reference to the wxAuiManager. */ wxAuiManager& GetMgr() { return m_mgr; } //! Checks for updates. /*! \param progDlg An optional progress dialog */ void CheckUpdate( wxProgressDialog* progDlg=NULL ) const; new_wxwindow MakePythonWindow(const std::string& windowFunc, const std::string& mgr_name="pythonShell", const std::string& caption="Python Shell", bool show=true, bool full=false, bool isfloat=true, int width=-1, int height=-1, double mpl_width=8.0, double mpl_height=6.0); int GetMplFigNo() {return mpl_figno++;} private: wxAuiManager m_mgr; wxStfToolBar *m_cursorToolBar, *m_scaleToolBar; wxStfFileDrop* m_drop; #ifdef WITH_PYTHON wxString python_code2; // python import code void RedirectStdio(); #endif #if (__cplusplus < 201103) // print data, to remember settings during the session boost::shared_ptr m_printData; // page setup data boost::shared_ptr m_pageSetupData; #else // print data, to remember settings during the session std::shared_ptr m_printData; // page setup data std::shared_ptr m_pageSetupData; #endif bool firstResize; int mpl_figno; wxStfToolBar* CreateStdTb(); wxStfToolBar* CreateScaleTb(); wxStfToolBar* CreateEditTb(); wxStfToolBar* CreateCursorTb(); void OnHelp(wxCommandEvent& event); void OnCheckUpdate(wxCommandEvent& event); void OnToggleSelect(wxCommandEvent& event); void OnToolFirst(wxCommandEvent& event); void OnToolNext(wxCommandEvent& event); void OnToolPrevious(wxCommandEvent& event); void OnToolLast(wxCommandEvent& event); void OnToolXenl(wxCommandEvent& event); void OnToolXshrink(wxCommandEvent& event); void OnToolYenl(wxCommandEvent& event); void OnToolYshrink(wxCommandEvent& event); void OnToolUp(wxCommandEvent& event); void OnToolDown(wxCommandEvent& event); void OnToolFit(wxCommandEvent& event); void OnToolLeft(wxCommandEvent& event); void OnToolRight(wxCommandEvent& event); void OnToolCh1(wxCommandEvent& event); void OnToolCh2(wxCommandEvent& event); void OnToolSnapshotwmf(wxCommandEvent& event); void OnToolMeasure(wxCommandEvent& event); void OnToolPeak(wxCommandEvent& event); void OnToolBase(wxCommandEvent& event); void OnToolDecay(wxCommandEvent& event); void OnToolLatency(wxCommandEvent& event); void OnToolZoom(wxCommandEvent& event); void OnToolEvent(wxCommandEvent& event); void OnToolFitdecay(wxCommandEvent& event); #ifdef WITH_PSLOPE void OnToolPSlope(wxCommandEvent& event); #endif // void OnSwapChannels(wxCommandEvent& event); void OnCh2base(wxCommandEvent& event); void OnCh2pos(wxCommandEvent& event); void OnCh2zoom(wxCommandEvent& event); void OnCh2basezoom(wxCommandEvent& event); void OnAverage(wxCommandEvent& event); void OnAlignedAverage(wxCommandEvent& event); void OnExportfile(wxCommandEvent& event); void OnExportatf(wxCommandEvent& event); void OnExportigor(wxCommandEvent& event); void OnExporthdf5(wxCommandEvent& event); void OnConvert(wxCommandEvent& event); void OnPrint(wxCommandEvent& event); void OnScale(wxCommandEvent& event); void OnMpl(wxCommandEvent& event); void OnMplSpectrum(wxCommandEvent& event); void OnPageSetup(wxCommandEvent& event); void OnViewResults(wxCommandEvent& event); void OnSaveperspective(wxCommandEvent& event); void OnLoadperspective(wxCommandEvent& event); void OnRestoreperspective(wxCommandEvent& event); #ifdef WITH_PYTHON void OnViewshell(wxCommandEvent& event); void OnUserdef(wxCommandEvent& event); #endif void OnLStartMaxslope(wxCommandEvent& event); void OnLStartHalfrise(wxCommandEvent& event); void OnLStartPeak(wxCommandEvent& event); void OnLStartManual(wxCommandEvent& event); void OnLEndFoot(wxCommandEvent& event); void OnLEndMaxslope(wxCommandEvent& event); void OnLEndHalfrise(wxCommandEvent& event); void OnLEndPeak(wxCommandEvent& event); void OnLEndManual(wxCommandEvent& event); void OnLWindow(wxCommandEvent& event); DECLARE_EVENT_TABLE() }; /*@}*/ #endif stimfit-0.16.0/src/stimfit/gui/doc.h0000775000175000017500000012536413277303516014175 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file doc.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfDoc. */ #ifndef _DOC_H #define _DOC_H /*! \addtogroup wxstf * @{ */ #include "./../stf.h" //! The document class, derived from both wxDocument and Recording. /*! The document class can be used to model an application’s file-based data. * It is part of the document/view framework supported by wxWidgets. */ class StfDll wxStfDoc: public wxDocument, public Recording { #ifndef FROM_PYTHON DECLARE_DYNAMIC_CLASS(wxStfDoc) #endif private: bool peakAtEnd, startFitAtPeak, initialized, progress; Recording Average; int InitCursors(); void PostInit(); bool ChannelSelDlg(); void WriteToReg(); bool outOfRange(std::size_t check) { return (check >= cursec().size()); } void Focus(); void OnNewfromselectedThisMenu( wxCommandEvent& event ) { OnNewfromselectedThis( ); } void Selectsome(wxCommandEvent& event); void Unselectsome(wxCommandEvent& event); void SelectTracesOfType(wxCommandEvent& event); void UnselectTracesOfType(wxCommandEvent& event); void ConcatenateMultiChannel(wxCommandEvent& event); void OnAnalysisBatch( wxCommandEvent& event ); void OnAnalysisIntegrate( wxCommandEvent& event ); void OnAnalysisDifferentiate( wxCommandEvent& event ); //void OnSwapChannels( wxCommandEvent& event ); void Multiply(wxCommandEvent& event); void SubtractBaseMenu( wxCommandEvent& event ) { SubtractBase( ); } void LFit(wxCommandEvent& event); void LnTransform(wxCommandEvent& event); void Filter(wxCommandEvent& event); void P_over_N(wxCommandEvent& event); void Plotextraction(stf::extraction_mode mode); void Plotcriterion(wxCommandEvent& event); void Plotcorrelation(wxCommandEvent& event); void Plotdeconvolution(wxCommandEvent& event); void MarkEvents(wxCommandEvent& event); void Threshold(wxCommandEvent& event); void Viewtable(wxCommandEvent& event); void Fileinfo(wxCommandEvent& event); Recording ReorderChannels(); wxMenu* doc_file_menu; stf::latency_mode latencyStartMode, latencyEndMode; stf::latency_window_mode latencyWindowMode; stfnum::direction direction; //of peak detection: UP, DOWN or BOTH #ifdef WITH_PSLOPE stf::pslope_mode_beg pslopeBegMode; // for left mode PSlope cursor stf::pslope_mode_end pslopeEndMode; // for right mode PSlope cursor #endif std::size_t baseBeg, baseEnd, peakBeg, peakEnd, fitBeg, fitEnd; stfnum::baseline_method baselineMethod; // method for calculating baseline #ifdef WITH_PSLOPE std::size_t PSlopeBeg, PSlopeEnd; int DeltaT; // distance (number of points) from the first cursor bool viewPSlope; #endif std::size_t measCursor; bool ShowRuler; // show a ruler throught the measurement cursor? double latencyStartCursor, latencyEndCursor, latency, //time from latency cursor to beginning of event base, APBase, baseSD, threshold, slopeForThreshold, peak, APPeak, tLoReal, tHiReal, t50LeftReal, t50RightReal, maxT, thrT, maxRiseY, maxRiseT, maxDecayY, maxDecayT, maxRise, maxDecay, t50Y, APMaxT, APMaxRiseY, APMaxRiseT, APt50LeftReal, APrtLoHi, APtLoReal, APtHiReal, APt0Real, #ifdef WITH_PSLOPE PSlope, #endif rtLoHi, InnerLoRT, InnerHiRT, OuterLoRT, OuterHiRT, halfDuration, slopeRatio, t0Real; // cursor windows: int pM; //peakMean, number of points used for averaging int RTFactor; // Lower point for the rise-time calculation std::size_t tLoIndex, tHiIndex, t50LeftIndex, t50RightIndex, APt50LeftIndex, APt50RightIndex, APtLoIndex, APtHiIndex; bool fromBase, viewCrosshair,viewBaseline,viewBaseSD,viewThreshold, viewPeakzero,viewPeakbase,viewPeakthreshold, viewRTLoHi, viewInnerRiseTime, viewOuterRiseTime, viewT50,viewRD,viewSloperise,viewSlopedecay,viewLatency, viewCursors; XZoom xzoom; std::vector yzoom; std::vector< std::vector > sec_attr; public: //! Constructor. /*! Does nothing but initialising the member list. */ wxStfDoc(); //! Destructor. ~wxStfDoc(); //! Swaps active and inactive channel /*! \param event The menu event that made the call. */ void OnSwapChannels( wxCommandEvent& event ); //! Override default file opening. /*! Attempts to identify the file type from the filter extension (such as "*.dat") * \param filename Full path of the file. * \return true if successfully opened, false otherwise. */ virtual bool OnOpenDocument(const wxString& filename); //! Open document without progress dialog. /*! Attempts to identify the file type from the filter extension (such as "*.dat") * \param filename Full path of the file. * \return true if successfully opened, false otherwise. */ virtual bool OnOpenPyDocument(const wxString& filename); //! Override default file saving. /*! \return true if successfully saved, false otherwise. */ virtual bool SaveAs(); #ifndef TEST_MINIMAL //! Override default file saving. /*! \param filename Full path of the file. * \return true if successfully saved, false otherwise. */ virtual bool DoSaveDocument(const wxString& filename); #endif //! Override default file closing. /*! Writes settings to the config file or registry before closing. * \return true if successfully closed, false otherwise. */ virtual bool OnCloseDocument(); //! Override default file creation. /*! \return true if successfully closed, false otherwise. */ virtual bool OnNewDocument(); //! Sets the content of a newly created file. /*! \param c_Data The data that is used for the new file. * \param Sender Pointer to the document that generated this file. * \param title Title of the new document. */ void SetData( const Recording& c_Data, const wxStfDoc* Sender, const wxString& title ); //! Indicates whether an average has been created. /*! \return true if an average has been created, false otherwise. */ bool GetIsAverage() const { return !Average.get().empty(); } //! Indicates whether the left decay cursor should always be at the peak of the trace. /*! \return true if the left decay cursor should be at the end of the trace, false otherwise. */ bool GetStartFitAtPeak() const { return startFitAtPeak; } //! Indicates whether the right peak cursor should always be at the end of a trace. /*! \return true if the right peak cursor should be at the end, false otherwise. */ bool GetPeakAtEnd() const { return peakAtEnd; } //! Indicates whether the the document is fully initialised. /*! The document has to be fully initialized before other parts of the * program start accessing it; for example, the graph might start reading out values * before they exist. * \return true if the document is fully initialised, false otherwise. */ bool IsInitialized() const { return initialized; } //! Sets the right peak cursor to the end of a trace. /*! \param value determines whether the peak cursor should be at the end of a trace. */ void SetPeakAtEnd(bool value) { peakAtEnd=value; } //! Sets the left decay cursor to the peak of the trace. /*! \param value determines whether the left decay cursor should be at the peak of the trace. */ void SetStartFitAtPeak(bool value) { startFitAtPeak=value; } //! Retrieves the average trace(s). /*! \return The average trace as a Recording object. */ const Recording& GetAverage() const { return Average; } //! Checks whether any cursor is reversed or out of range and corrects it if required. void CheckBoundaries(); //! Sets the current section to the specified value /*! Checks for out-of-range errors * \param section The 0-based index of the new section */ bool SetSection(std::size_t section); //! Creates a new window containing the selected sections of this file. /*! \return true upon success, false otherwise. */ bool OnNewfromselectedThis( ); //! Selects all sections /*! \param event The menu event that made the call. */ void Selectall(wxCommandEvent& event); //! Unselects all sections /*! \param event The menu event that made the call. */ void Deleteselected(wxCommandEvent& event); //! Updates the status of the selection button void UpdateSelectedButton(); //! Creates an average trace from the selected sections /*! \param calcSD Set to true if the standard deviation should be calculated as well, false otherwise * \param align Set to true if traces should be aligned to the point of steepest rise of the reference channel, * false otherwise. */ void CreateAverage( bool calcSD, bool align ); #if 0 //! Applies a user-defined function to the current data set /*! \param id The id of the user-defined function */ void Userdef(std::size_t id); #endif //! Toggles the selection status of the current section void ToggleSelect( ); //! Selects the current section if previously unselected void Select(); //! Unselects the current section if previously selected void Remove(); //! Creates a new document from the checked events /*! \param event The menu event that made the call. */ void Extract(wxCommandEvent& event); //! Erases all events, independent of whether they are checked or not /*! \param event The menu event that made the call. */ void InteractiveEraseEvents(wxCommandEvent& event); //! Adds an event at the current eventPos /*! \param event The menu event that made the call. */ void AddEvent( wxCommandEvent& event ); //! Subtracts the baseline of all selected traces. /*! \return true upon success, false otherwise. */ bool SubtractBase( ); //! Fit a function to the data. /*! \param event The menu event that made the call. */ void FitDecay(wxCommandEvent& event); //! Sets a pointer to the file menu attached to this document. /*! \param menu The menu to be attached. */ void SetFileMenu( wxMenu* menu ) { doc_file_menu = menu; } //! Measure everything using functions defined in measlib.h /*! This will measure the baseline, peak values, Lo to Hi% rise time, * half duration, maximal slopes during rise and decay, the ratio of these slopes * and the latency. */ void Measure(); //! Put the current measurement results into a text table. stfnum::Table CurResultsTable(); //! Retrieves the position of the measurement cursor (crosshair). /*! \return The index of the measurement cursor within the current section. */ std::size_t GetMeasCursor() const { return measCursor; } //! Retrieves the computation mode for baseline. /*! \return The current mode for computing the baseline. */ stfnum::baseline_method GetBaselineMethod() const { return baselineMethod; } //! Retrieves the position of the left baseline cursor. /*! \return The index of the left baseline cursor within the current section. */ std::size_t GetBaseBeg() const { return baseBeg; } //! Retrieves the position of the right baseline cursor /*! \return The index of the left baseline cursor within the current section. */ std::size_t GetBaseEnd() const { return baseEnd; } //! Retrieves the position of the left peak cursor. /*! \return The index of the left peak cursor within the current section. */ std::size_t GetPeakBeg() const { return peakBeg; } //! Retrieves the position of the right peak cursor. /*! \return The index of the right peak cursor within the current section. */ std::size_t GetPeakEnd() const { return peakEnd; } //! Retrieves the position of the left fitting cursor. /*! \return The index of the left fitting cursor within the current section. */ std::size_t GetFitBeg() const { return fitBeg; } //! Retrieves the position of the right fitting cursor. /*! \return The index of the right fitting cursor within the current section. */ std::size_t GetFitEnd() const { return fitEnd; } #ifdef WITH_PSLOPE //! Retrieves the position of the left PSlope cursor. /*! \return The index of the left PSlope cursor within the current section. */ std::size_t GetPSlopeBeg() const { return PSlopeBeg; } //! Retrieves the position of the right PSlope cursor. /*! \return The index of the right PSlope cursor within the current section. */ std::size_t GetPSlopeEnd() const { return PSlopeEnd; } #endif // WITH_PSLOPE //! Retrieves the number of points used for averaging during peak calculation. /*! \return The number of points to be used. */ int GetPM() const { return pM; } #ifdef WITH_PSLOPE //! Retrieves the number of points used for distance from the first cursor. /*! \return The number of points to be used. */ int GetDeltaT() const { return DeltaT; } #endif //! Retrieves the position of the left latency cursor. /*! \return The index of the left latency cursor within the current section. Note that by contrast * to the other cursors, this is a double because the latency cursor may be set to an interpolated * position between two data points. */ double GetLatencyBeg() const { return latencyStartCursor; } //! Retrieves the position of the right latency cursor. /*! \return The interpolated index of the right latency cursor within the current section. Note that * by contrast to the other cursors, this is a double because the latency cursor may be set to an * interpolated position between two data points. */ double GetLatencyEnd() const { return latencyEndCursor; } //! Retrieves the latency. /*! \return The latency, expressed in units of data points. */ double GetLatency() const { return latency; } //! Retrieves the time point at which Lo% of the maximal amplitude have been reached. /*! \return The time point at which Lo% of the maximal amplitude have been reached, expressed in * units of data points. */ double GetTLoReal() const { return tLoReal; } //! Retrieves the time point at which Hi% of the maximal amplitude have been reached. /*! \return The time point at which Hi% of the maximal amplitude have been reached, expressed in * units of data points. */ double GetTHiReal() const { return tHiReal; } //! Retrieves the time point at which Lo% of the maximal amplitude have been reached. /*! \return The time point at which Lo% of the maximal amplitude have been reached, expressed in * units of data points. */ double GetInnerLoRT() const { return InnerLoRT; } //! Retrieves the time point at which Hi% of the maximal amplitude have been reached. /*! \return The time point at which Hi% of the maximal amplitude have been reached, expressed in * units of data points. */ double GetInnerHiRT() const { return InnerHiRT; } //! Retrieves the time point at which Lo% of the maximal amplitude have been reached. /*! \return The time point at which Lo% of the maximal amplitude have been reached, expressed in * units of data points. */ double GetOuterLoRT() const { return OuterLoRT; } //! Retrieves the time point at which Hi% of the maximal amplitude have been reached. /*! \return The time point at which Hi% of the maximal amplitude have been reached, expressed in * units of data points. */ double GetOuterHiRT() const { return OuterHiRT; } //! Retrieves the extrapolated onset time point of an event in the active channel. /*! \return The onset time point of an event, extrapolated from the crossing of a line through * 20 and 80% of the event amplitude with the baseline. Expressed in units of data points. */ double GetT0Real() const { return t0Real; } //! Retrieves the time point at which 50% of the maximal amplitude have been reached from the left of the peak. /*! \return The time point at which 50% of the maximal amplitude have been reached from the left of the peak, * expressed in units of data points. */ double GetT50LeftReal() const { return t50LeftReal; } //! Retrieves the time point at which 50% of the maximal amplitude have been reached from the right of the peak. /*! \return The time point at which 50% of the maximal amplitude have been reached from the right of the peak, * expressed in units of data points. */ double GetT50RightReal() const { return t50RightReal; } //! Retrieves the y value at 50% of the maximal amplitude. /*! \return The y value at 50% of the maximal amplitude. */ double GetT50Y() const { return t50Y; } //! Retrieves the maximal slope of the rising phase. /*! \return The maximal slope during the rising phase. */ double GetMaxRise() const { return maxRise; } //! Retrieves the maximal slope of the decaying phase. /*! \return The maximal slope of rise. */ double GetMaxDecay() const { return maxDecay; } //! Retrieves the time point of the maximal slope of the rising phase in the second channel. /*! This time point is needed as a reference for the latency calculation and for aligned averages. * \return The time point at which the maximal slope of the rising phase is reached in the second channel, * expressed in units of data points.. */ double GetAPMaxRiseT() const { return APMaxRiseT; } //! Retrieves the time point of the peak in the second channel. /*! \return The time point at which the peak is found in the second channel, * expressed in units of data points. */ double GetAPMaxT() const { return APMaxT; } //! Retrieves the time point at which 50% of the max. amplitude have been reached from the left of the peak in the reference channel. /*! \return The time point at which 50% of the maximal amplitude have been reached from the left of the peak * in the reference channel, expressed in units of data points. */ double GetAPT50LeftReal() const { return APt50LeftReal; } //! Retrieves the extrapolated onset time point of an event in the reference channel. /*! \return The onset time point of an event, extrapolated from the crossing of a line through * 20 and 80% of the event amplitude with the baseline. Expressed in units of data points. */ double GetAPT0Real() const { return APt0Real; } //! Retrieves the time point of the maximal slope during the rising phase. /*! \return The time point of the maximal slope during the rising phase, expressed in units of data points. */ double GetMaxRiseT() const { return maxRiseT; } //! Retrieves the y-value at the time point of the maximal slope during the rising phase. /*! \return The y-value at the time point of the maximal slope during the rising phase. */ double GetMaxRiseY() const { return maxRiseY; } //! Retrieves the time point of the maximal slope during the decaying phase. /*! \return The time point of the maximal slope during the decaying phase, expressed in units of data points. */ double GetMaxDecayT() const { return maxDecayT; } //! Retrieves the y-value at the time point of the maximal slope during the decaying phase. /*! \return The y-value at the time point of the maximal slope during the decaying phase. */ double GetMaxDecayY() const { return maxDecayY; } //! Retrieves the y-value at the measurement cursor (crosshair). Will update measCursor if out of range. /*! \return The y-value at the measurement cursor. */ double GetMeasValue(); //! Retrieves the peak value. /*! \return The peak value. */ double GetPeak() const { return peak; } //! Retrieves the peak time value. /*! \return The peak time value. */ double GetPeakTime() const { return maxT; } //! Retrieves the baseline. /*! \return The baseline value. */ double GetBase() const { return base; } //! Retrieves the baseline in the second channel. /*! \return The baseline value in the second channel. */ double GetAPBase() const { return APBase; } //! Retrieves the standard deviation of the baseline. /*! \return The standard deviation of the baseline. */ double GetBaseSD() const { return baseSD; } //! Retrieves the value at which the threshold slope is crossed. /*! \return The standard deviation of the baseline. */ double GetThreshold() const { return threshold; } //! Retrieves the time point at which the peak is found. /*! \return The time point at which the peak is found, expressed in units of data points. */ double GetMaxT() const { return maxT; } //! Retrieves the time point at which the threshold slope is crossed. /*! \return The time point at which the threshold slope is crossed, or * a negative value if the threshold is not attained. */ double GetThrT() const { return thrT; } //! Retrieves the Lo to Hi% rise time. /*! \return The difference between GetTHiReal() and GetTLoReal(), expressed in units o data points. */ double GetRTLoHi() const { return rtLoHi; } //! Retrieves the inner rise time. /*! expressed in units o data points. */ double GetInnerRiseTime() const { return (InnerHiRT-InnerLoRT); } //! Retrieves the outer rise time. /*! expressed in units o data points. */ double GetOuterRiseTime() const { return (OuterHiRT-OuterLoRT); } //! Retrieves the full width at half-maximal amplitude ("half duration"). /*! \return The difference between GetT50RightReal() and GetT50LeftReal(), expressed in units of data points. */ double GetHalfDuration() const { return halfDuration; } //! Retrieves ratio of the maximal slopes during the rising and decaying phase. /*! \return The ratio of GetMaxRise() and GetMaxDecay(). */ double GetSlopeRatio() const { return slopeRatio; } //! Retrieves lower factor (e.g 20) for the rise time calculation. /*! \return lower factor value for rise time calculation expressed in percentage (e.g 20). */ int GetRTFactor() const { return RTFactor; } #ifdef WITH_PSLOPE //! Retrieves the value of the Slope /*! \return slope value in y-units/x-units. */ double GetPSlope() const { return PSlope; } #endif //! Retrieves the mode of the latency start cursor. /*! \return The current mode of the latency start cursor. */ stf::latency_mode GetLatencyStartMode() const { return latencyStartMode; } //! Retrieves the mode of the latency end cursor. /*! \return The current mode of the latency end cursor. */ stf::latency_mode GetLatencyEndMode() const { return latencyEndMode; } //! Retrieves the mode of the latency window. /*! \return The current mode of the latency window. */ stf::latency_window_mode GetLatencyWindowMode() const { return latencyWindowMode; } //! Retrieves the direction of peak calculations. /*! \return The current direction of peak calculations. */ stfnum::direction GetDirection() const { return direction; } #ifdef WITH_PSLOPE //! Retrieves the mode of the left PSlope cursor. /*! \return The current mode of the left PSlope cursor. */ stf::pslope_mode_beg GetPSlopeBegMode() const { return pslopeBegMode; } //! Retrieves the mode of the right PSlope cursor. /*! \return The current mode of the right PSlope cursor. */ stf::pslope_mode_end GetPSlopeEndMode() const { return pslopeEndMode; } #endif // WITH_PSLOPE //! Indicates whether to use the baseline as a reference for AP kinetics. /*! \return true if the baseline should be used, false if the threshold should be used. */ bool GetFromBase() const { return fromBase; } //! Indicates whether the measurement cursor (crosshair) value should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewCrosshair() const { return viewCrosshair; } //! Indicates whether the baseline value should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewBaseline() const { return viewBaseline; } //! Indicates whether the baseline's standard deviation should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewBaseSD() const { return viewBaseSD; } //! Indicates whether the threshold should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewThreshold() const { return viewThreshold; } //! Indicates whether the peak value (measured from zero) should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewPeakZero() const { return viewPeakzero; } //! Indicates whether the peak value (measured from baseline) should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewPeakBase() const { return viewPeakbase; } //! Indicates whether the peak value (measured from threshold) should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewPeakThreshold() const { return viewPeakthreshold; } //! Indicates whether the Lo to Hi% rise time should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewRTLoHi() const { return viewRTLoHi; } //! Indicates whether the inner rise time should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewInnerRiseTime() const { return viewInnerRiseTime; } //! Indicates whether the outer rise time should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewOuterRiseTime() const { return viewOuterRiseTime; } //! Indicates whether the half duration should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewT50() const { return viewT50; } //! Indicates whether the ratio of the maximal slopes during rise and decay should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewRD() const { return viewRD; } //! Indicates whether the maximal slope during the rising phase should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewSlopeRise() const { return viewSloperise; } //! Indicates whether the maximal slope during the decaying phase should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewSlopeDecay() const { return viewSlopedecay; } //! Indicates whether the latency should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewLatency() const { return viewLatency; } #ifdef WITH_PSLOPE //! Indicates whether the Slope should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewPSlope() const { return viewPSlope; } #endif //! Indicates whether two additional rows showing the positions of start and end cursors should be shown in the results table. /*! \return true if it should be shown, false otherwise. */ bool GetViewCursors() const { return viewCursors; } //! Returns the slope for threshold detection. /*! \return The slope value for threshold detection. */ double GetSlopeForThreshold() const { return slopeForThreshold; } //! Returns the current zoom settings for this channel (read-only). /*! \return The current zoom settings. */ const XZoom& GetXZoom() { return xzoom; } //! Returns the current zoom settings for this channel (read & write). /*! \return The current zoom settings. */ XZoom& GetXZoomW() { return xzoom; } //! Returns the current zoom settings for this channel (read-only). /*! \return The current zoom settings. */ const YZoom& GetYZoom(int ch) { return yzoom.at(ch); } //! Returns the current zoom settings for this channel (read & write). /*! \return The current zoom settings. */ YZoom& GetYZoomW(int ch) { return yzoom.at(ch); } //! Sets the position of the measurement cursor (crosshair). /*! \param value The index of the measurement cursor within the current section. */ void SetMeasCursor(int value); //! Sets whether the measurement cursor (crosshair) should be visible. /*! \param value is true if the ruler will be visible, false otherwirse.. */ void SetMeasRuler(bool value) { ShowRuler = value; } //! Retrieves whether the measurement cursor (crosshair) is visible. /*! \param true if the ruler is visible, false otherwirse.. */ bool GetMeasRuler() const { return ShowRuler;} //! Sets the method to compute the baseline. /*! \param value The new method to calculate the baseline. */ void SetBaselineMethod(stfnum::baseline_method value) { baselineMethod = value; } //! Sets the position of the left baseline cursor. /*! \param value The index of the left baseline cursor within the current section. */ void SetBaseBeg(int value); //! Sets the position of the right baseline cursor /*! \param value The index of the left baseline cursor within the current section. */ void SetBaseEnd(int value); //! Sets the position of the left peak cursor. /*! \param value The index of the left peak cursor within the current section. */ void SetPeakBeg(int value); //! Sets the position of the right peak cursor. /*! \param value The index of the right peak cursor within the current section. */ void SetPeakEnd(int value); //! Sets the position of the left fitting cursor. /*! \param value The index of the left fitting cursor within the current section. */ void SetFitBeg(int value); //! Sets the position of the right fitting cursor. /*! \param value The index of the right fitting cursor within the current section. */ void SetFitEnd(int value); //! Sets the position of the left latency cursor. /*! \param value The index of the left latency cursor within the current section. Note that by contrast * to the other cursors, this is a double because the latency cursor may be set to an interpolated * position between two data points. */ void SetLatencyBeg(double value); //! Sets the position of the right latency cursor. /*! \param value The index of the right latency cursor within the current section. Note that by contrast * to the other cursors, this is a double because the latency cursor may be set to an interpolated * position between two data points. */ void SetLatencyEnd(double value); //! Sets the latency. /*! \param value The latency, expressed in units of data points. */ void SetLatency(double value) { latency=value; } #ifdef WITH_PSLOPE //! Sets the position of the left PSlope cursor. /*! \param value The index of the left PSlope cursor within the current section. */ void SetPSlopeBeg(int value); //! Sets the position of the right PSlope cursor. /*! \param value The index of the right PSlope cursor within the current section. */ void SetPSlopeEnd(int value); //! Sets the PSlope. /*! \param value The slope, expressed in y-units/x-units. */ void SetPSlope(double value) { PSlope=value; } //! Set the position mode of the left PSlope cursor. /*! \param value The new mode of the left PSlope cursor. */ void SetPSlopeBegMode(stf::pslope_mode_beg value) { pslopeBegMode=value; } //! Set the position mode of the right PSlope cursor. /*! \param value The new mode of the right PSlope cursor. */ void SetPSlopeEndMode(stf::pslope_mode_end value) { pslopeEndMode=value; } //! Sets the number of points used for the distance from the first cursor. /*! \param value The number of points to be used. */ void SetDeltaT(int value) { DeltaT=value; } #endif // WITH_PSLOPE //! Sets the number of points used for averaging during peak calculation. /*! \param value The number of points to be used. */ void SetPM(int value) { pM=value; } //! Sets the lower value (e.g 20) to calculate the rise time. /*! \param value The lower percentage (e.g 20) to be used to c calculate the rise time. */ void SetRTFactor(int value); //! Sets the mode of the latency start cursor. /*! \param value The new mode of the latency start cursor. */ void SetLatencyStartMode(stf::latency_mode value) { latencyStartMode=value; } //! Sets the mode of the latency end cursor. /*! \param value The new mode of the latency end cursor. */ void SetLatencyEndMode(stf::latency_mode value) { latencyEndMode=value; } //! Sets the mode of the latency end cursor. /*! \param value The new mode of the latency end cursor.. */ void SetLatencyWindowMode(stf::latency_window_mode value) { latencyWindowMode=value; } //! Sets the mode of the latency start cursor. /*! \param value The new mode of the latency start cursor.. */ void SetLatencyStartMode(int value); //! Sets the mode of the latency end cursor. /*! \param value The new mode of the latency end cursor.. */ void SetLatencyEndMode(int value); //! Sets the mode of the latency end cursor. /*! \param value The new mode of the latency end cursor.. */ void SetLatencyWindowMode(int value); //! Sets the direction of peak calculations. /*! \param value The new direction of peak calculations. */ void SetDirection(stfnum::direction value) { direction=value; } //! Sets the reference for AP kinetics measurements. /*! \param frombase true if the baseline should be used, false if the threshold should be used. */ void SetFromBase(bool frombase) { fromBase = frombase; } //! Determines whether the measurement cursor (crosshair) value should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewCrosshair(bool value) { viewCrosshair=value; } //! Determines whether the baseline value should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewBaseline(bool value) { viewBaseline=value; } //! Determines whether the baseline's standard deviation should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewBaseSD(bool value) { viewBaseSD=value; } //! Determines whether the threshold should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewThreshold(bool value) { viewThreshold=value; } //! Determines whether the peak value (measured from zero) should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewPeakZero(bool value) { viewPeakzero=value; } //! Determines whether the peak value (measured from baseline) should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewPeakBase(bool value) { viewPeakbase=value; } //! Determines whether the peak value (measured from threshold) should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewPeakThreshold(bool value) { viewPeakthreshold=value; } //! Determines whether the Lo to Hi% rise time should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewRTLoHi(bool value) { viewRTLoHi=value; } //! Determines whether the inner rise time should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewInnerRiseTime(bool value) { viewInnerRiseTime=value; } //! Determines whether the outer rise time should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewOuterRiseTime(bool value) { viewOuterRiseTime=value; } //! Determines whether the half duration should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewT50(bool value) { viewT50=value; } //! Determines whether the ratio of the maximal slopes during rise and decay should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewRD(bool value) { viewRD=value; } //! Determines whether the maximal slope during the rising phase should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewSlopeRise(bool value) { viewSloperise=value; } //! Determines whether the maximal slope during the decaying phase should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewSlopeDecay(bool value) { viewSlopedecay=value; } //! Determines whether the latency should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewLatency(bool value) { viewLatency=value; } #ifdef WITH_PSLOPE //! Determines whether the slope should be shown in the results table. /*! \param value Set to true if it should be shown, false otherwise. */ void SetViewPSlope(bool value) { viewPSlope=value; } #endif //! Determines whether two additional rows showing the positions of start and end cursors should be shown in the results table. /*! \param value Set to true if they should be shown, false otherwise. */ void SetViewCursors(bool value) { viewCursors=value; } //! Sets the slope where the baseline should be set. /*! \param value The slope value where the baseline shoudl be set. */ void SetSlopeForThreshold(double value) { slopeForThreshold=value; } //! Put the current trace into a text table. stfnum::Table CurAsTable() const; //! Copies the cursor positions from another Recording to this Recording. /*! This will copy the crosshair, base, peak and fit cursors positions as * well as the number of points for peak averaging from another Recording * and correct the new values if they are out of range. The latency cursors * will not be copied. * \param c_Recording The Recording from which to copy the cursor positions. */ void CopyCursors(const wxStfDoc& c_Recording); //! Resize the Recording to a new number of channels. /*! Resizes both the channel and the global y units arrays. * \param c_n_channels The new number of channels. */ virtual void resize(std::size_t c_n_channels); //! Insert a Channel at a given position. /*! Will throw std::out_of_range if range check fails. * \param c_Channel The Channel to be inserted. * \param pos The position at which to insert the channel (0-based). */ virtual void InsertChannel(Channel& c_Channel, std::size_t pos); const stf::SectionAttributes& GetSectionAttributes(std::size_t nchannel, std::size_t nsection) const; const stf::SectionAttributes& GetCurrentSectionAttributes() const; stf::SectionAttributes& GetCurrentSectionAttributesW(); //! Deletes the current fit, sets isFitted to false; void DeleteFit(std::size_t nchannel, std::size_t nsection); //! Sets the best-fit parameters when a fit has been performed on this section. /*! \param bestFitP_ The best-fit parameters \param fitFunc_ The function used for fitting \param chisqr The sum of squared errors \param fitBeg Sampling point index where the fit starts \param fitEnd Sampling point index where the fit ends */ void SetIsFitted( std::size_t nchannel, std::size_t nsection, const Vector_double& bestFitP_, stfnum::storedFunc* fitFunc_, double chisqr, std::size_t fitBeg, std::size_t fitEnd ); //! Determines whether an integral has been calculated in this section. /*! \return true if an integral has been calculated, false otherwise. */ void SetIsIntegrated(std::size_t nchannel, std::size_t nsection, bool value, std::size_t begin, std::size_t end, const Vector_double& quad_p_); //! Erases all events. void ClearEvents(std::size_t nchannel, std::size_t nsection); void correctRangeR(int& value); void correctRangeR(std::size_t& value); bool LoadTDMS(const std::string& filename, Recording& ReturnData); DECLARE_EVENT_TABLE() }; /*@}*/ #endif stimfit-0.16.0/src/stimfit/gui/view.cpp0000775000175000017500000001074313277303516014727 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // view.cpp // Derived from wxView to satisfy the doc/view architecture. // Doesn't do a lot in stimfit. // 2007-12-27, Christoph Schmidt-Hieber, University of Freiburg // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "wx/filename.h" #if !wxUSE_DOC_VIEW_ARCHITECTURE #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h! #endif #include "./app.h" #include "./doc.h" #include "./view.h" #include "./parentframe.h" #include "./childframe.h" #include "./graph.h" #include "./dlgs/cursorsdlg.h" IMPLEMENT_DYNAMIC_CLASS(wxStfView, wxView) BEGIN_EVENT_TABLE(wxStfView, wxView) END_EVENT_TABLE() extern wxStfParentFrame* frame; wxStfView::wxStfView() : graph((wxStfGraph *) NULL), childFrame((wxStfChildFrame *) NULL) { } // What to do when a view is created. Creates actual // windows for displaying the view. bool wxStfView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) { childFrame = wxGetApp().CreateChildFrame(doc, this); if (childFrame==NULL) { return false; } // extract file name: wxFileName fn(doc->GetFilename()); childFrame->SetTitle(fn.GetName()); graph = GetMainFrame()->CreateGraph(this, childFrame); if (graph==NULL) { return false; } childFrame->GetMgr()->AddPane( graph, wxAuiPaneInfo().Caption(wxT("Traces")).Name(wxT("Traces")).CaptionVisible(true). CloseButton(false).Centre().PaneBorder(true) ); childFrame->GetMgr()->Update(); // childFrame->ActivateGraph(); #if defined(__X__) || defined(__WXMAC__) // X seems to require a forced resize // childFrame->SetClientSize(800,600); #endif childFrame->Show(true); Activate(true); return true; } wxStfDoc* wxStfView::Doc() { return (wxStfDoc*)GetDocument(); } wxStfDoc* wxStfView::DocC() const { return (wxStfDoc*)GetDocument(); } // Sneakily gets used for default print/preview // as well as drawing on the screen. void wxStfView::OnDraw(wxDC *WXUNUSED(pDC)) { } void wxStfView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)) { if (graph) { graph->Refresh(); } } // Clean up windows used for displaying the view. bool wxStfView::OnClose(bool deleteWindow) { if ( !GetDocument()->Close() ) return false; Activate(false); if ( deleteWindow ) wxDELETE(childFrame); SetFrame(NULL); return true; } void wxStfView::OnActivateView(bool activate, wxView *activeView, wxView *deactiveView) { //this function will be called whenever the view is activated if (activeView!=NULL) { wxStfDoc *pDoc = ((wxStfView*)activeView)->Doc(); if (pDoc) { // Update menu checks: // pDoc->UpdateMenuCheckmarks(); if (frame!=NULL) frame->SetSingleChannel(pDoc->size()<2); pDoc->UpdateSelectedButton(); if (wxGetApp().GetCursorsDialog()!=NULL && wxGetApp().GetCursorsDialog()->IsShown()) { wxGetApp().GetCursorsDialog()->SetActiveDoc(Doc()); try { wxGetApp().GetCursorsDialog()->UpdateCursors(); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } } } #ifdef __WXGTK__ wxStfGraph *pGraph = ((wxStfView*)activeView)->GetGraph(); if (pGraph) pGraph->SetFocus(); #endif } #ifdef __WXMAC__ wxGetApp().SetMRActiveDoc(Doc()); #endif wxView::OnActivateView(activate,activeView,deactiveView); } stimfit-0.16.0/src/stimfit/gui/graph.cpp0000775000175000017500000024560113354367041015060 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // graph.cpp // This is where the actual drawing happens. // 2007-12-27, Christoph Schmidt-Hieber, University of Freiburg #include #ifndef WX_PRECOMP #include #endif #include #include #include #include #include #include "./app.h" #include "./doc.h" #include "./view.h" #include "./parentframe.h" #include "./childframe.h" #include "./printout.h" #include "./dlgs/cursorsdlg.h" #include "./dlgs/smalldlgs.h" #include "./usrdlg/usrdlg.h" #include "./graph.h" #include "./../../libstfnum/measure.h" #ifdef _STFDEBUG #include #endif #if defined (_WIN32) #define isnan _isnan #elif !defined(isnan) #define isnan std::isnan #endif // #define BENCHMARK // uncomment to run benchmark #ifdef BENCHMARK //def _STFDEBUG #include #include #include #include #ifdef __MACH__ #include #include #endif /* From https://gist.github.com/jbenet/1087739 */ void current_utc_time(struct timespec *ts) { #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); ts->tv_sec = mts.tv_sec; ts->tv_nsec = mts.tv_nsec; #else clock_gettime(CLOCK_REALTIME, ts); #endif } static const double BILLION = 1000000000L; double tdiff(timespec time1, timespec time0) { return ( time1.tv_sec - time0.tv_sec ) + ( time1.tv_nsec - time0.tv_nsec ) / BILLION; } double t2d(timespec time1) { return time1.tv_sec + time1.tv_nsec / BILLION; } #endif BEGIN_EVENT_TABLE(wxStfGraph, wxWindow) EVT_MENU(ID_ZOOMHV,wxStfGraph::OnZoomHV) EVT_MENU(ID_ZOOMH,wxStfGraph::OnZoomH) EVT_MENU(ID_ZOOMV,wxStfGraph::OnZoomV) EVT_MOUSE_EVENTS(wxStfGraph::OnMouseEvent) EVT_KEY_DOWN( wxStfGraph::OnKeyDown ) #if defined __WXMAC__ && !(wxCHECK_VERSION(2, 9, 0)) EVT_PAINT( wxStfGraph::OnPaint ) #endif END_EVENT_TABLE() // Define a constructor for my canvas wxStfGraph::wxStfGraph(wxView *v, wxStfChildFrame *frame, const wxPoint& pos, const wxSize& size, long style): wxScrolledWindow(frame, wxID_ANY, pos, size, style),pFrame(frame), isZoomRect(false),no_gimmicks(false),isPrinted(false),isLatex(false),firstPass(true),isSyncx(false), printRect(),boebbel(boebbelStd),boebbelPrint(boebbelStd), #ifdef __WXGTK__ printScale(1.0),printSizePen1(4),printSizePen2(8),printSizePen4(16), #else printScale(1.0),printSizePen1(4),printSizePen2(8),printSizePen4(16), #endif downsampling(1),eventPos(0), llz_x(0.0),ulz_x(1.0),llz_y(0.0),ulz_y(1.0),llz_y2(0.0),ulz_y2(1.0), results1(wxT("\0")),results2(wxT("\0")),results3(wxT("\0")),results4(wxT("\0")),results5(wxT("\0")),results6(wxT("\0")), standardPen(*wxBLACK,1,wxSOLID), //Solid black line standardPen2(*wxRED,1,wxSOLID), //Solid red line standardPen3(wxColour(255,192,192),1,wxSOLID), //Solid red line scalePen(*wxBLACK,2,wxSOLID), //Solid black line scalePen2(*wxRED,2,wxSOLID), //Solid red line peakPen(*wxRED,1,wxSHORT_DASH), //Dashed red line peakLimitPen(*wxRED,1,wxDOT), //Dotted red line basePen(*wxGREEN,1,wxSHORT_DASH), //Dashed green line baseLimitPen(*wxGREEN,1,wxDOT), //Dotted green line decayLimitPen(wxColour(127,127,127),1,wxDOT), //Dotted dark blue line ZoomRectPen(*wxLIGHT_GREY,1,wxDOT), //Dotted grey line fitPen(wxColour(127,127,127),4,wxSOLID), //Solid dark grey line fitSelectedPen(wxColour(192,192,192),2,wxSOLID), //Solid dark grey line selectPen(wxColour(127,127,127),1,wxSOLID), //Solid grey line averagePen(*wxBLUE,1,wxSOLID), //Solid light blue line rtPen(*wxGREEN,2,wxSOLID), //Solid green line hdPen(*wxCYAN,2,wxSOLID), //Solid violet line rdPen(*wxRED,2,wxSOLID), //Solid dark violet line #ifdef WITH_PSLOPE slopePen(*wxBLUE,2,wxSOLID), //Solid blue line #endif latencyPen(*wxBLUE,1,wxDOT), alignPen(*wxBLUE,1,wxSHORT_DASH), measPen(*wxBLACK,1,wxDOT), eventPen(*wxBLUE,2,wxSOLID), #ifdef WITH_PSLOPE PSlopePen(wxColor(30,144,255), 1, wxDOT), // Dotted bright blue line #endif standardPrintPen(*wxBLACK,printSizePen1,wxSOLID), //Solid black line standardPrintPen2(*wxRED,printSizePen1,wxSOLID), //Solid red line standardPrintPen3(wxColour(255,192,192),printSizePen1,wxSOLID), //Solid red line scalePrintPen(*wxBLACK,printSizePen2,wxSOLID), //Solid black line scalePrintPen2(*wxRED,printSizePen2,wxSOLID), //Solid red line measPrintPen(*wxBLACK,printSizePen1,wxDOT), peakPrintPen(*wxRED,printSizePen1,wxSHORT_DASH), //Dashed red line peakLimitPrintPen(*wxRED,printSizePen1,wxDOT), //Dotted red line basePrintPen(*wxGREEN,printSizePen1,wxSHORT_DASH), //Dashed green line baseLimitPrintPen(*wxGREEN,printSizePen1,wxDOT), //Dotted green line decayLimitPrintPen(wxColour(63,63,63),printSizePen1,wxDOT), //Dotted dark blue line fitPrintPen(wxColour(63,63,63),printSizePen2,wxSOLID), //Solid dark grey line fitSelectedPrintPen(wxColour(128,128,128),printSizePen2,wxSOLID), //Solid dark grey line selectPrintPen(wxColour(31,31,31),printSizePen1,wxSOLID), //Solid grey line averagePrintPen(*wxBLUE,printSizePen1,wxSOLID), //Solid light blue line rtPrintPen(*wxGREEN,printSizePen2,wxSOLID), //Solid green line hdPrintPen(*wxCYAN,printSizePen2,wxSOLID), //Solid violet line rdPrintPen(*wxRED,printSizePen2,wxSOLID), //Solid dark violet line #ifdef WITH_PSLOPE slopePrintPen(*wxBLUE,printSizePen4,wxSOLID), //Solid blue line #endif resultsPrintPen(*wxLIGHT_GREY,printSizePen2,wxSOLID),//Solid light grey line latencyPrintPen(*wxBLUE,printSizePen1,wxDOT),//Dotted violett line PSlopePrintPen(wxColour(30,144,255), printSizePen1, wxDOT), // Dotted bright blue line baseBrush(*wxLIGHT_GREY,wxBDIAGONAL_HATCH), zeroBrush(*wxLIGHT_GREY,wxFDIAGONAL_HATCH), lastLDown(0,0), yzoombg(), m_zoomContext( new wxMenu ), m_eventContext( new wxMenu ) { m_zoomContext->Append( ID_ZOOMHV, wxT("Expand zoom window horizontally && vertically") ); m_zoomContext->Append( ID_ZOOMH, wxT("Expand zoom window horizontally") ); m_zoomContext->Append( ID_ZOOMV, wxT("Expand zoom window vertically") ); m_eventContext->Append( ID_EVENT_ADDEVENT, wxT("Add an event that starts here") ); m_eventContext->Append( ID_EVENT_ERASE, wxT("Erase all events") ); m_eventContext->Append( ID_EVENT_EXTRACT, wxT("Extract selected events") ); SetBackgroundColour(*wxWHITE); view = (wxStfView*)v; wxString perspective=wxGetApp().wxGetProfileString(wxT("Settings"),wxT("Windows"),wxT("")); /* if (perspective != wxT("")) { // load the stored perspective: frame->GetMgr()->LoadPerspective(perspective); } else { // or the default: frame->GetMgr()->LoadPerspective(defaultPersp); } */ } wxStfParentFrame* wxStfGraph::ParentFrame() { return (wxStfParentFrame*)wxGetApp().GetTopWindow(); } // Defines the repainting behaviour void wxStfGraph::OnDraw( wxDC& DC ) { if ( !view || Doc()->get().empty() || !Doc()->IsInitialized() ) return; // ugly hack to force active document update: #if defined(__WXGTK__) || defined(__WXMAC__) view->Activate(true); #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) if (!HasFocus()) #else if (wxWindow::FindFocus()!=(wxWindow*)this) #endif SetFocus(); #endif wxRect WindowRect(GetRect()); if (isPrinted) { PrintScale(WindowRect); } if (firstPass) { firstPass = false; InitPlot(); } //Creates scale bars and labelings for display or print out //Calculate scale bars and labelings CreateScale(&DC); //Create additional rulers/lines and circles on display if (!no_gimmicks) { PlotGimmicks(DC); } //Plot all selected traces and fitted functions if at least one trace ist selected //and 'is selected' is selected in the trace navigator/control box //Polyline() is used for printing to avoid separation of traces //in postscript files //LineTo()is used for display for performance reasons //Plot fit curves (including current trace) DrawFit(&DC); if (!Doc()->GetSelectedSections().empty() && pFrame->ShowSelected()) { PlotSelected(DC); } //End plot all selected traces //Plot average if (Doc()->GetIsAverage()) { PlotAverage(DC); } //End plot average // Plot integral boundaries try { if (Doc()->GetCurrentSectionAttributes().isIntegrated) { DrawIntegral(&DC); } } catch (const std::out_of_range& e) { /* Do nothing for now */ } //Zoom window is displayed (see OnLeftButtonUp()) if (isZoomRect) { DrawZoomRect(DC); } //End zoom //Plot of the second channel //Trace one when displayed first time if ((Doc()->size()>1) && pFrame->ShowSecond()) { if (!isPrinted) { //Draw current trace on display //For display use point to point drawing DC.SetPen(standardPen2); PlotTrace(&DC,Doc()->get()[Doc()->GetSecChIndex()][Doc()->GetCurSecIndex()].get(), reference); } else { //Draw second channel for print out //For print out use polyline tool DC.SetPen(standardPrintPen2); PrintTrace(&DC,Doc()->get()[Doc()->GetSecChIndex()][Doc()->GetCurSecIndex()].get(), reference); } // End display or print out } //End plot of the second channel if ((Doc()->size()>1) && pFrame->ShowAll()) { for (std::size_t n=0; n < Doc()->size(); ++n) { if (!isPrinted) { //Draw current trace on display //For display use point to point drawing DC.SetPen(standardPen3); PlotTrace(&DC,Doc()->get()[n][Doc()->GetCurSecIndex()].get(), background, n); } } } //End plot of the second channel //Standard plot of the current trace //Trace one when displayed first time if (!isPrinted) { //Draw current trace on display //For display use point to point drawing DC.SetPen(standardPen); PlotTrace(&DC,Doc()->get()[Doc()->GetCurChIndex()][Doc()->GetCurSecIndex()].get()); } else { //For print out use polyline tool DC.SetPen(standardPrintPen); PrintTrace(&DC,Doc()->get()[Doc()->GetCurChIndex()][Doc()->GetCurSecIndex()].get()); } // End display or print out //End plot of the current trace //Ensure old scaling after print out if(isPrinted) { for (std::size_t n=0; n < Doc()->size(); ++n) { Doc()->GetYZoomW(n) = Doc()->GetYZoomW(n) * (1.0/printScale); } Doc()->GetXZoomW() = Doc()->GetXZoomW() * (1.0/printScale); WindowRect=printRect; } //End ensure old scaling after print out view->OnDraw(& DC); } void wxStfGraph::InitPlot() { if (wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewScaleBars"),1)) { if (pFrame->GetMenuBar() && pFrame->GetMenuBar()->GetMenu(2)) { pFrame->GetMenuBar()->GetMenu(2)->Check(ID_SCALE,true); } wxGetApp().set_isBars(true); } else { if (pFrame->GetMenuBar() && pFrame->GetMenuBar()->GetMenu(2)) { pFrame->GetMenuBar()->GetMenu(2)->Check(ID_SCALE,false); } wxGetApp().set_isBars(false); } if (wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewSyncx"),1)) { isSyncx=true; } else { isSyncx=false; } // Ensure proper dimensioning // Determine scaling factors and Units // Zoom and offset variables are currently not part of the settings dialog => // Read from registry // Return a negative value upon first program start so that the trace is // fit to the window dimensions YZW()=(double)(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("zoom.yZoom"), -1) / 100000.0); SPYW()=wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("zoom.startPosY"), 0); XZW()=(double)(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("zoom.xZoom"), -1) / 100000.0); SPXW()=wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("zoom.startPosX"), 0); if (XZ() <= 0 || YZ() <= 0 || fabs(double(SPY())) >= 1e15) Fittowindow(false); if ((Doc()->size()>1)) { //Second channel is not part of the settings dialog =>read from registry SPY2W() = wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("Zoom.startPosY2"), 1); YZ2W() = (double)(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("Zoom.yZoom2"), 1) / 100000.0); //Ensure proper dimensioning if (YZ2() <=0) FitToWindowSecCh(false); } } void wxStfGraph::PlotSelected(wxDC& DC) { if (!isPrinted) { //Draw traces on display DC.SetPen(selectPen); for (unsigned m=0; m < Doc()->GetSelectedSections().size(); ++m) { //For display use point to point drawing PlotTrace( &DC, Doc()->get()[Doc()->GetCurChIndex()][Doc()->GetSelectedSections()[m]].get() ); } } //End draw traces on display else { //Draw traces for print out DC.SetPen(selectPrintPen); for (unsigned m=0; m < Doc()->GetSelectedSections().size() && Doc()->GetSelectedSections().size()>0; ++m) { PrintTrace(&DC,Doc()->get()[Doc()->GetCurChIndex()][Doc()->GetSelectedSections()[m]].get()); } //End draw for print out } //End if display or print out } void wxStfGraph::PlotAverage(wxDC& DC) { //Average is calculated but not plotted if (!isPrinted) { //Draw Average on display //For display use point to point drawing DC.SetPen(averagePen); PlotTrace(&DC,Doc()->GetAverage()[0][0].get()); } //End draw Average on display else { //Draw average for print out //For print out use polyline tool DC.SetPen(averagePrintPen); PrintTrace(&DC,Doc()->GetAverage()[0][0].get()); } //End draw average for print out } void wxStfGraph::DrawZoomRect(wxDC& DC) { DC.SetPen(ZoomRectPen); wxPoint ZoomPoints[4]; wxPoint Ul_Corner((int)llz_x, (int)llz_y); wxPoint Ur_Corner((int)ulz_x, (int)llz_y); wxPoint Lr_Corner((int)ulz_x, (int)ulz_y); wxPoint Ll_Corner((int)llz_x, (int)ulz_y); ZoomPoints[0]=Ul_Corner; ZoomPoints[1]=Ur_Corner; ZoomPoints[2]=Lr_Corner; ZoomPoints[3]=Ll_Corner; DC.DrawPolygon(4,ZoomPoints); } void wxStfGraph::PlotGimmicks(wxDC& DC) { // crosshair through measurement cursor: int crosshairSize=20; DrawCrosshair(DC, measPen, measPrintPen, crosshairSize, Doc()->GetMeasCursor(), Doc()->GetMeasValue()); // crosshair through threshold: DrawCrosshair(DC, peakPen, peakPrintPen, crosshairSize/2.0, Doc()->GetThrT(), Doc()->GetThreshold()); // creates vertical ruler through measurement peak if needed if ( Doc()->GetMeasRuler() ) DrawVLine(&DC, Doc()->GetMeasCursor(), measPen, measPrintPen); //creates red vertical and horizontal dashed lines through the peak DrawVLine(&DC,Doc()->GetMaxT(), peakPen, peakPrintPen); DrawHLine(&DC,Doc()->GetPeak(), peakPen, peakPrintPen); //and red dotted lines through peak calculation limits DrawVLine(&DC,Doc()->GetPeakBeg(), peakLimitPen, peakLimitPrintPen); DrawVLine(&DC,Doc()->GetPeakEnd(), peakLimitPen, peakLimitPrintPen); //creates a green horizontal dashed line through the base DrawHLine(&DC,Doc()->GetBase(), basePen, basePrintPen); //and green dotted lines through Doc()->GetBase() calculation limits DrawVLine(&DC,Doc()->GetBaseBeg(), baseLimitPen, baseLimitPrintPen); DrawVLine(&DC,Doc()->GetBaseEnd(), baseLimitPen, baseLimitPrintPen); //Create darkblue dotted lines through decay calculation limits DrawVLine(&DC,Doc()->GetFitBeg(), decayLimitPen, decayLimitPrintPen); DrawVLine(&DC,Doc()->GetFitEnd(), decayLimitPen, decayLimitPrintPen); // Create dotted line as a latency cursor DrawVLine(&DC,Doc()->GetLatencyBeg(), latencyPen, latencyPrintPen); DrawVLine(&DC,Doc()->GetLatencyEnd(), latencyPen, latencyPrintPen); // Create double-arrow between latency cursors: int latStart=xFormat(Doc()->GetLatencyBeg()); int latEnd=xFormat(Doc()->GetLatencyEnd()); if (latStart < 0) latStart = 0; if (latEnd > GetRect().width) latEnd = GetRect().width; DC.DrawLine(latStart,20,latEnd,20); // left arrowhead: DC.DrawLine(latStart+1,20,latStart+6,15); DC.DrawLine(latStart+1,20,latStart+6,25); // right arrowhead: DC.DrawLine(latEnd-1,20,latEnd-6,15); DC.DrawLine(latEnd-1,20,latEnd-6,25); #ifdef WITH_PSLOPE // Create dotted bright blue line as slope cursor DrawVLine(&DC, Doc()->GetPSlopeBeg(), PSlopePen, PSlopePrintPen); DrawVLine(&DC, Doc()->GetPSlopeEnd(), PSlopePen, PSlopePrintPen); #endif //Set circle size depending on output if (!isPrinted) boebbel=boebbelStd; else boebbel=boebbelPrint; //draws green circles around the Lo% and the Hi% rise times double reference = Doc()->GetBase(); if ( !Doc()->GetFromBase() && Doc()->GetThrT() >= 0 ) { reference = Doc()->GetThreshold(); } double Low = Doc()->GetRTFactor()/100.; double High = 1-Low; DrawCircle( &DC,Doc()->GetTLoReal(), High*reference + Low*Doc()->GetPeak(), rtPen, rtPrintPen); DrawCircle( &DC,Doc()->GetTHiReal(), Low*reference + High*Doc()->GetPeak(), rtPen, rtPrintPen); //draws circles around the half duration limits DrawCircle(&DC,Doc()->GetT50LeftReal(),Doc()->GetT50Y(), hdPen, hdPrintPen); DrawCircle(&DC,Doc()->GetT50RightReal(),Doc()->GetT50Y(), hdPen, hdPrintPen); //draws dark violet circles around the points of steepest rise/decay DrawCircle(&DC,Doc()->GetMaxRiseT(),Doc()->GetMaxRiseY(), rdPen, rdPrintPen); DrawCircle(&DC,Doc()->GetMaxDecayT(),Doc()->GetMaxDecayY(), rdPen, rdPrintPen); try { stf::SectionAttributes sec_attr = Doc()->GetCurrentSectionAttributes(); if (!sec_attr.eventList.empty()) { PlotEvents(DC); } if (!sec_attr.pyMarkers.empty()) { DC.SetPen(eventPen); for (c_marker_it it = sec_attr.pyMarkers.begin(); it != sec_attr.pyMarkers.end(); ++it) { // Create circles indicating the peak of an event: DC.DrawRectangle( xFormat(it->x), yFormat(it->y), boebbel*2.0, boebbel*2.0 ); } } } catch (const std::out_of_range& e) { /* Do nothing for now */ } } void wxStfGraph::PlotEvents(wxDC& DC) { const int MAX_EVENTS_PLOT = 200; stf::SectionAttributes sec_attr; try { sec_attr = Doc()->GetCurrentSectionAttributes(); } catch (const std::out_of_range& e) { return; } DC.SetPen(eventPen); for (c_event_it it = sec_attr.eventList.begin(); it != sec_attr.eventList.end(); ++it) { // Create small arrows indicating the start of an event: eventArrow(&DC, (int)it->GetEventStartIndex()); // Create circles indicating the peak of an event: try { DrawCircle( &DC, it->GetEventPeakIndex(), Doc()->cursec().at(it->GetEventPeakIndex()), eventPen, eventPen ); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg( wxString( e.what(), wxConvLocal ) ); return; } } // Only draw check boxes if there are less than 1000 events (takes too long // to draw them and it's impossible to check them anyway) wxRect WindowRect=GetRect(); if (isPrinted) WindowRect=wxRect(printRect); int right=WindowRect.width; int nevents_plot = 0; for (event_it it2 = sec_attr.eventList.begin(); it2 != sec_attr.eventList.end(); ++it2) { nevents_plot += (xFormat(it2->GetEventStartIndex()) < right && xFormat(it2->GetEventStartIndex()) > 0); } if (nevents_plot < MAX_EVENTS_PLOT) { for (event_it it2 = sec_attr.eventList.begin(); it2 != sec_attr.eventList.end(); ++it2) { if (xFormat(it2->GetEventStartIndex()) < right && xFormat(it2->GetEventStartIndex()) > 0) { it2->GetCheckBox()->Move(wxPoint(xFormat(it2->GetEventStartIndex()), 0)); it2->GetCheckBox()->Show(true); } else { it2->GetCheckBox()->Show(false); } } } else { for (event_it it2 = sec_attr.eventList.begin(); it2 != sec_attr.eventList.end(); ++it2) { it2->GetCheckBox()->Show(false); } } // return focus to frame: SetFocus(); } void wxStfGraph::ClearEvents() { stf::SectionAttributes sec_attr; try { sec_attr = Doc()->GetCurrentSectionAttributes(); } catch (const std::out_of_range& e) { return; } for (event_it it2 = sec_attr.eventList.begin(); it2 != sec_attr.eventList.end(); ++it2) { it2->GetCheckBox()->Destroy(); } } void wxStfGraph::DrawCrosshair( wxDC& DC, const wxPen& pen, const wxPen& printPen, int crosshairSize, double xch, double ych) { if (isnan(xch) || isnan(ych)) { return; } wxPen chpen = pen; if (isPrinted) { chpen = printPen; crosshairSize=(int)(crosshairSize*printScale); } DC.SetPen(chpen); try { // circle: wxRect frame(wxPoint( xFormat(xch)-crosshairSize, yFormat(ych)-crosshairSize ), wxPoint( xFormat(xch)+crosshairSize, yFormat(ych)+crosshairSize )); DC.DrawEllipse(frame); // vertical part: DC.DrawLine( xFormat(xch), yFormat(ych)-crosshairSize, xFormat(xch), yFormat(ych)+crosshairSize ); if (wxGetApp().GetCursorsDialog()!=NULL && wxGetApp().GetCursorsDialog()->IsShown()) { //if (wxGetApp().GetCursorsDialog()->GetRuler()) if ( Doc()->GetMeasRuler() ) { DrawVLine(&DC,xch, pen, printPen); } } // horizontal part: DC.DrawLine( xFormat(xch)-crosshairSize, yFormat(ych), xFormat(xch)+crosshairSize, yFormat(ych) ); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg( wxString( e.what(), wxConvLocal ) ); return; } } double wxStfGraph::get_plot_xmin() const { return -SPX()/XZ() * DocC()->GetXScale(); } double wxStfGraph::get_plot_xmax() const { wxRect WindowRect=GetRect(); int right=WindowRect.width; return (right-SPX())/XZ() * DocC()->GetXScale(); } double wxStfGraph::get_plot_ymin() const { wxRect WindowRect=GetRect(); int top=WindowRect.height; return (SPY()-top)/YZ(); } double wxStfGraph::get_plot_ymax() const { return SPY()/YZ(); } double wxStfGraph::get_plot_y2min() const { wxRect WindowRect=GetRect(); int top=WindowRect.height; return (SPY2()-top)/YZ2(); } double wxStfGraph::get_plot_y2max() const { return SPY2()/YZ2(); } void wxStfGraph::PlotTrace( wxDC* pDC, const Vector_double& trace, plottype pt, int bgno ) { // speed up drawing by omitting points that are outside the window: // find point before left window border: // xFormat=toFormat * zoom.xZoom + zoom.startPosX // for xFormat==0: // toFormat=-zoom.startPosX/zoom.xZoom std::size_t start=0; int x0i=int(-SPX()/XZ()); if (x0i>=0 && x0i<(int)trace.size()-1) start=x0i; // find point after right window border: // for xFormat==right: // toFormat=(right-zoom.startPosX)/zoom.xZoom std::size_t end=trace.size(); wxRect WindowRect=GetRect(); if (isPrinted) WindowRect=wxRect(printRect); int right=WindowRect.width; int xri = int((right-SPX())/XZ())+1; if (xri>=0 && xri<(int)trace.size()-1) end=xri; // apply filter at half the new sampling frequency: DoPlot(pDC, trace, start, end, 1, pt, bgno); } void wxStfGraph::DoPlot( wxDC* pDC, const Vector_double& trace, int start, int end, int step, plottype pt, int bgno) { #if (__cplusplus < 201103) boost::function yFormatFunc; #else std::function yFormatFunc; #endif switch (pt) { case active: yFormatFunc = std::bind1st( std::mem_fun(&wxStfGraph::yFormatD), this); break; case reference: yFormatFunc = std::bind1st( std::mem_fun(&wxStfGraph::yFormatD2), this); break; case background: Vector_double::const_iterator max_el = std::max_element(trace.begin(), trace.end()); Vector_double::const_iterator min_el = std::min_element(trace.begin(), trace.end()); double min = *min_el; if (min>1.0e12) min= 1.0e12; if (min<-1.0e12) min=-1.0e12; double max = *max_el; if (max>1.0e12) max= 1.0e12; if (max<-1.0e12) max=-1.0e12; wxRect WindowRect=GetRect(); WindowRect.height /= Doc()->size(); FittorectY(yzoombg, WindowRect, min, max, 1.0); yzoombg.startPosY += bgno*WindowRect.height; yFormatFunc = std::bind1st( std::mem_fun(&wxStfGraph::yFormatDB), this); break; } int x_last = xFormat(start); int y_last = yFormatFunc( trace[start] ); int x_next = 0; int y_next = 0; #ifdef BENCHMARK //def _STFDEBUG struct timespec time0, time1; current_utc_time(&time0); #else wxRect WindowRect(GetRect()); if (end-start < 2*WindowRect.width+2) { #endif for (int n=start; nDrawLine( x_last, y_last, x_next, y_next ); x_last = x_next; y_last = y_next; } #ifdef BENCHMARK //def _STFDEBUG current_utc_time(&time1); double accum = tdiff(time1, time0)*1e3; std::string fn_platform = "plt_bench_" + stf::wx2std(wxGetOsDescription()) + ".txt"; std::ofstream plt_bench; plt_bench.open(fn_platform.c_str(), std::ios::out | std::ios::app); plt_bench << end-start << "\t" << accum << "\t"; current_utc_time(&time0); x_last = xFormat(start); #else } else { #endif double y_max = trace[start]; double y_min = trace[start]; for (int n=start; n y_max) { y_max = trace[n+1]; } } else { // plot line between extrema of previous column: pDC->DrawLine( x_last, yFormatFunc(y_min), x_last, yFormatFunc(y_max) ); // plot line between last point of previous and first point of this column: pDC->DrawLine( x_last, yFormatFunc(trace[n]), x_next, yFormatFunc(trace[n+1]) ); y_min = trace[n+1]; y_max = trace[n+1]; x_last = x_next; } } #ifdef BENCHMARK //def _STFDEBUG current_utc_time(&time1); accum = tdiff(time1, time0)*1e3; plt_bench << accum << std::endl; plt_bench.close(); #else } #endif } void wxStfGraph::PrintScale(wxRect& WindowRect) { //enhance resolution for printing - see OnPrint() //Ensures the scaling of all pixel dependent drawings for (std::size_t n=0; n < Doc()->size(); ++n) { Doc()->GetYZoomW(n) = Doc()->GetYZoomW(n) * printScale; } Doc()->GetXZoomW() = Doc()->GetXZoomW() * printScale; WindowRect=printRect; //Calculate scaling variables boebbelPrint=(int)(boebbelStd * printScale); if ( boebbelPrint < 1 ) boebbelPrint=2; printSizePen1=(int)(1 * printScale); if ( printSizePen1 < 1 ) boebbelPrint=1; printSizePen2=(int)(2 * printScale); if ( printSizePen2 < 1 ) boebbelPrint=2; printSizePen4=(int)(4 * printScale); if ( printSizePen4 < 1 ) boebbelPrint=4; } void wxStfGraph::PrintTrace( wxDC* pDC, const Vector_double& trace, plottype ptype ) { // speed up drawing by omitting points that are outside the window: // find point before left window border: // xFormat=toFormat * zoom.xZoom + zoom.startPosX // for xFormat==0: // toFormat=-zoom.startPosX/zoom.xZoom std::size_t start=0; int x0i=int(-SPX()/XZ()); if (x0i>=0 && x0i<(int)trace.size()-1) start=x0i; // find point after right window border: // for xFormat==right: // toFormat=(right-zoom.startPosX)/zoom.xZoom std::size_t end=trace.size(); wxRect WindowRect=GetRect(); if (isPrinted) WindowRect=wxRect(printRect); int right=WindowRect.width; int xri=int((right-SPX())/XZ())+1; if (xri>=0 && xri<(int)trace.size()-1) end=xri; DoPrint(pDC, trace, start, end, ptype); } void wxStfGraph::DoPrint( wxDC* pDC, const Vector_double& trace, int start, int end, plottype ptype) { #if (__cplusplus < 201103) boost::function yFormatFunc; #else std::function yFormatFunc; #endif switch (ptype) { case active: yFormatFunc = std::bind1st( std::mem_fun(&wxStfGraph::yFormatD), this); break; default: yFormatFunc = std::bind1st( std::mem_fun(&wxStfGraph::yFormatD2), this); break; } std::vector points; int x_last = xFormat(start); int y_last = yFormatFunc( trace[start] ); int y_max = y_last; int y_min = y_last; int x_next = 0; int y_next = 0; points.push_back( wxPoint(x_last,y_last) ); for (int n=start; n y_max) { y_max = y_next; } } else { // else, always draw and reset extrema: if (y_min != y_next) { points.push_back( wxPoint(x_last, y_min) ); } if (y_max != y_next) { points.push_back( wxPoint(x_last, y_max) ); } points.push_back( wxPoint(x_next, y_next) ); y_min = y_next; y_max = y_next; x_last = x_next; } } pDC->DrawLines((int)points.size(),&points[0]); } void wxStfGraph::DrawCircle(wxDC* pDC, double x, double y, const wxPen& pen, const wxPen& printPen) { if (isPrinted) { pDC->SetPen(printPen); } else { pDC->SetPen(pen); } wxRect Frame( wxPoint(xFormat(x)-boebbel,yFormat(y)-boebbel), wxPoint(xFormat(x)+boebbel,yFormat(y)+boebbel) ); pDC->DrawEllipse(Frame); } void wxStfGraph::DrawVLine(wxDC* pDC, double x, const wxPen& pen, const wxPen& printPen) { wxRect WindowRect(GetRect()); if (isPrinted) { //Set WindowRect to print coordinates (page size) WindowRect=printRect; pDC->SetPen(printPen); } else { pDC->SetPen(pen); } pDC->DrawLine(xFormat(x),0,xFormat(x),WindowRect.height); } void wxStfGraph::DrawHLine(wxDC* pDC, double y, const wxPen& pen, const wxPen& printPen) { wxRect WindowRect(GetRect()); if (isPrinted) { //Set WindowRect to print coordinates (page size) WindowRect=printRect; pDC->SetPen(printPen); } else { pDC->SetPen(pen); } pDC->DrawLine(0, yFormat(y),WindowRect.width,yFormat(y)); } void wxStfGraph::eventArrow(wxDC* pDC, int eventIndex) { // we only need that if it's within the screen: wxRect WindowRect(GetRect()); if (xFormat(eventIndex)<0 || xFormat(eventIndex)>WindowRect.width) { return; } if (isPrinted) { //Set WindowRect to print coordinates (page size) WindowRect=printRect; } pDC->DrawLine(xFormat(eventIndex), 20, xFormat(eventIndex), 0); // arrow head: pDC->DrawLine(xFormat(eventIndex)-5, 15, xFormat(eventIndex), 20); pDC->DrawLine(xFormat(eventIndex)+5, 15, xFormat(eventIndex), 20); } void wxStfGraph::DrawFit(wxDC* pDC) { try { // go through selected traces: if ( isPrinted ) pDC->SetPen(fitSelectedPrintPen); else pDC->SetPen(fitSelectedPen); for ( std::size_t n_sel = 0; n_sel < Doc()->GetSelectedSections().size(); ++n_sel ) { std::size_t sel_index = Doc()->GetSelectedSections()[ n_sel ]; // Check whether this section contains a fit: try { stf::SectionAttributes sec_attr = Doc()->GetSectionAttributes(Doc()->GetCurChIndex(), sel_index); if ( sec_attr.isFitted && pFrame->ShowSelected() ) { PlotFit( pDC, stf::SectionPointer( &((*Doc())[Doc()->GetCurChIndex()][sel_index]), sec_attr ) ); } } catch (const std::out_of_range& e) { /* Do nothing */ } } // Active trace if ( isPrinted ) pDC->SetPen(fitPrintPen); else pDC->SetPen(fitPen); stf::SectionAttributes sec_attr = Doc()->GetCurrentSectionAttributes(); if (sec_attr.isFitted) { PlotFit( pDC, stf::SectionPointer( &((*Doc())[Doc()->GetCurChIndex()][Doc()->GetCurSecIndex()]), sec_attr) ); } } catch (const std::out_of_range& e) { } } void wxStfGraph::PlotFit( wxDC* pDC, const stf::SectionPointer& Sec ) { wxRect WindowRect = GetRect(); if (isPrinted) { //Set WindowRect to print coordinates (page size) WindowRect=printRect; } int firstPixel = xFormat( Sec.sec_attr.storeFitBeg ); if ( firstPixel < 0 ) firstPixel = 0; int lastPixel = xFormat( Sec.sec_attr.storeFitEnd ); if ( lastPixel > WindowRect.width + 1 ) lastPixel = WindowRect.width + 1; if (!isPrinted) { //Draw Fit on display //For display use point to point drawing double fit_time_1 = ( ((double)firstPixel - (double)SPX()) / XZ() - (double)Sec.sec_attr.storeFitBeg )* Doc()->GetXScale(); for ( int n_px = firstPixel; n_px < lastPixel-1; n_px++ ) { // Calculate pixel back to time (GetStoreFitBeg() is t=0) double fit_time_2 = ( ((double)n_px+1.0 - (double)SPX()) / XZ() - (double)Sec.sec_attr.storeFitBeg ) * Doc()->GetXScale(); // undo xFormat = (int)(toFormat * XZ() + SPX()); pDC->DrawLine( n_px, yFormat(Sec.sec_attr.fitFunc->func( fit_time_1, Sec.sec_attr.bestFitP)), n_px + 1, yFormat(Sec.sec_attr.fitFunc->func(fit_time_2, Sec.sec_attr.bestFitP)) ); fit_time_1 = fit_time_2; } } else { //Draw Fit for print out // For print out use polyline std::vector f_print( lastPixel - firstPixel ); for ( int n_px = firstPixel; n_px < lastPixel; n_px++ ) { // Calculate pixel back to time (GetStoreFitBeg() is t=0) double fit_time = ( ((double)n_px - (double)SPX()) / XZ() -(double)Sec.sec_attr.storeFitBeg ) * Doc()->GetXScale(); // undo xFormat = (int)(toFormat * XZ() + SPX()); f_print[n_px-firstPixel].x = n_px; f_print[n_px-firstPixel].y = yFormat( Sec.sec_attr.fitFunc->func( fit_time, Sec.sec_attr.bestFitP) ); } pDC->DrawLines( f_print.size(), &f_print[0] ); } //End if display or print out } void wxStfGraph::DrawIntegral(wxDC* pDC) { // Draws a polygon around the integral. Note that the polygon will be drawn // out of screen as well. stf::SectionAttributes sec_attr; try { sec_attr = Doc()->GetCurrentSectionAttributes(); } catch (const std::out_of_range& e) { return; } if (!isPrinted) { pDC->SetPen(scalePen); } else { pDC->SetPen(scalePrintPen); } bool even = std::div((int)sec_attr.storeIntEnd-(int)sec_attr.storeIntBeg, 2).rem==0; int firstPixel=xFormat(sec_attr.storeIntBeg); // last pixel: int lastPixel= even ? xFormat(sec_attr.storeIntEnd) : xFormat(sec_attr.storeIntEnd-1); std::size_t qt_size= lastPixel-firstPixel + // part that covers the trace 2; // straight line through base or 0 if (!even) qt_size++; //straight line for trapezoidal part std::vector quadTrace; quadTrace.reserve(qt_size); quadTrace.push_back(wxPoint(firstPixel,yFormat(Doc()->GetBase()))); // "Simpson part" (piecewise quadratic functions through three adjacent points): for (int n_pixel=firstPixel; n_pixel < lastPixel; ++n_pixel) { // (lower) index corresponding to pixel: int n_relIndex = (int)(((double)n_pixel-(double)SPX())/(double)XZ()-sec_attr.storeIntBeg); if (n_relIndex >= 0 && (unsigned int)(n_relIndex/2)*3+2 < sec_attr.quad_p.size()) { double n_absIndex = ((double)n_pixel-(double)SPX())/(double)XZ(); // quadratic parameters at this point: double a = sec_attr.quad_p[(int)(n_relIndex/2)*3]; double b = sec_attr.quad_p[(int)(n_relIndex/2)*3+1]; double c = sec_attr.quad_p[(int)(n_relIndex/2)*3+2]; double y = a*n_absIndex*n_absIndex + b*n_absIndex + c; quadTrace.push_back(wxPoint(n_pixel,yFormat(y))); } } // add trapezoidal integration part if uneven: if (!even) { // draw a straight line: quadTrace.push_back( wxPoint( xFormat(sec_attr.storeIntEnd), yFormat(Doc()->cursec()[sec_attr.storeIntEnd]) )); } quadTrace.push_back( wxPoint( xFormat(sec_attr.storeIntEnd), yFormat(Doc()->GetBase()) )); // Polygon from base: pDC->SetBrush(baseBrush); pDC->DrawPolygon((int)quadTrace.size(),&quadTrace[0]); // Polygon from 0: quadTrace[0]=wxPoint(firstPixel,yFormat(0L)); quadTrace[quadTrace.size()-1]= wxPoint( xFormat(sec_attr.storeIntEnd), yFormat(0L) ); pDC->SetBrush(zeroBrush); pDC->DrawPolygon((int)quadTrace.size(),&quadTrace[0]); pDC->SetBrush(*wxTRANSPARENT_BRUSH); } void wxStfGraph::Snapshotwmf() { wxStfPreprintDlg myDlg(this,true); if (myDlg.ShowModal()!=wxID_OK) return; set_downsampling(myDlg.GetDownSampling()); // Get size of Graph, in pixels: wxRect screenRect(GetRect()); // Get size of page, in pixels: // assuming the screen is ~ 96 dpi, but we want ~ 720: printRect = wxRect(wxPoint(0,0), wxSize(GetRect().GetSize()*4)); double scale=(double)printRect.width/(double)screenRect.width; #if _WINDOWS // FIXME: for non-Windows platforms wxMetafileDC wmfDC; if (!wmfDC.IsOk()) #endif { wxGetApp().ErrorMsg(wxT("Error while creating clipboard data")); return; } set_noGimmicks(true); set_isPrinted(true); printScale=scale; #if _WINDOWS // FIXME: for non-Windows platforms OnDraw(wmfDC); #endif set_isPrinted(false); no_gimmicks=false; #if _WINDOWS // FIXME: for non-Windows platforms wxMetafile* mf = wmfDC.Close(); if (mf && mf->IsOk()) { mf->SetClipboard(); delete mf; } else #endif { wxGetApp().ErrorMsg(wxT("Error while copying to clipboard")); } } void wxStfGraph::OnMouseEvent(wxMouseEvent& event) { // event.Skip(); if (!view) return; if (event.LeftDown()) LButtonDown(event); if (event.RightDown()) RButtonDown(event); if (event.LeftUp()) LButtonUp(event); } void wxStfGraph::LButtonDown(wxMouseEvent& event) { // event.Skip(); if (!view) return; view->Activate(true); #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) if (!HasFocus()) #else if (wxWindow::FindFocus()!=(wxWindow*)this) #endif SetFocusIgnoringChildren(); wxClientDC dc(this); PrepareDC(dc); lastLDown = event.GetLogicalPosition(dc); switch (ParentFrame()->GetMouseQual()) { //Depending on the radio buttons (Mouse field) //in the (trace navigator) control box case stf::measure_cursor: //conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetMeasCursor( stf::round( ((double)lastLDown.x - (double)SPX())/XZ() ) ); //second 'double' added // in this case, update results string without waiting for "Return": pFrame->UpdateResults(); break; case stf::peak_cursor: //conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetPeakBeg( stf::round( ((double)lastLDown.x - (double)SPX())/XZ() ) ); //second 'double' added //Set x-value as lower limit of the peak calculation dialog box break; case stf::base_cursor: //conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetBaseBeg( stf::round( ((double)lastLDown.x - (double)SPX())/XZ() ) ); //second 'double' added break; case stf::decay_cursor: //conversion of pixel on screen to time (inversion of xFormat()) if (wxGetApp().GetCursorsDialog() != NULL && wxGetApp().GetCursorsDialog()->GetStartFitAtPeak()) { wxGetApp().ErrorMsg( wxT("Fit will start at the peak. Change cursor settings (Edit->Cursor settings) to set manually.") ); break; } Doc()->SetFitBeg( stf::round( ((double)lastLDown.x - (double)SPX())/XZ() ) ); //second 'double' added break; case stf::latency_cursor: if (Doc()->GetLatencyStartMode() != stf::manualMode) { Doc()->SetLatencyStartMode( stf::manualMode ); wxGetApp().ErrorMsg( wxT("The first latency cursor is set to manual mode") ); } Doc()->SetLatencyBeg(((double)lastLDown.x-(double)SPX())/XZ()); Refresh(); break; case stf::zoom_cursor: llz_x=(double)lastLDown.x; llz_y=(double)lastLDown.y; llz_y2=llz_y; break; #ifdef WITH_PSLOPE case stf::pslope_cursor: Doc()->SetPSlopeBegMode(stf::psBeg_manualMode); // set left cursor to manual // conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetPSlopeBeg( stf::round( ((double)lastLDown.x - (double)SPX())/XZ() ) ); // second 'double' added break; #endif default: break; } //End switch TraceNav->GetMouseQual() if (wxGetApp().GetCursorsDialog()!=NULL && wxGetApp().GetCursorsDialog()->IsShown()) { try { wxGetApp().GetCursorsDialog()->UpdateCursors(); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal) ); } } } void wxStfGraph::RButtonDown(wxMouseEvent& event) { // event.Skip(); if (!view) return; view->Activate(true); #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) if (!HasFocus()) #else if (wxWindow::FindFocus()!=(wxWindow*)this) #endif SetFocusIgnoringChildren(); wxClientDC dc(this); PrepareDC(dc); wxPoint point(event.GetLogicalPosition(dc)); switch (ParentFrame()->GetMouseQual()) { case stf::peak_cursor: //conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetPeakEnd( stf::round( ((double)point.x - (double)SPX())/XZ() ) ); break; case stf::base_cursor: //conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetBaseEnd( stf::round( ((double)point.x - (double)SPX())/XZ() ) ); break; case stf::decay_cursor: //conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetFitEnd( stf::round( ((double)point.x - (double)SPX())/XZ() ) ); break; case stf::latency_cursor: if (Doc()->GetLatencyEndMode() != stf::manualMode) { Doc()->SetLatencyEndMode( stf::manualMode ); wxGetApp().ErrorMsg( wxT("The second latency cursor is set to manual mode") ); } Doc()->SetLatencyEnd(((double)point.x-(double)SPX())/XZ()); Refresh(); break; case stf::zoom_cursor: if (isZoomRect) { PopupMenu(m_zoomContext.get()); } else { wxGetApp().ErrorMsg(wxT("Draw a zoom window with the left mouse button first")); } break; case stf::event_cursor: try { if (!Doc()->GetCurrentSectionAttributes().eventList.empty()) { // store the position that has been clicked: eventPos = stf::round( ((double)point.x - (double)SPX())/XZ() ); PopupMenu(m_eventContext.get()); } else { wxGetApp().ErrorMsg(wxT("No events have been detected yet")); } } catch (const std::out_of_range& e) { } break; #ifdef WITH_PSLOPE case stf::pslope_cursor: Doc()->SetPSlopeEndMode(stf::psEnd_manualMode); // set right cursor to manual mode Doc()->SetPSlopeEnd( stf::round( ((double)point.x - (double)SPX())/XZ() ) ); break; #endif default: ; } //End switch TraceNav->GetMouseQual() if (wxGetApp().GetCursorsDialog()!=NULL && wxGetApp().GetCursorsDialog()->IsShown()) { try { wxGetApp().GetCursorsDialog()->UpdateCursors(); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal) ); } } Refresh(); } void wxStfGraph::LButtonUp(wxMouseEvent& event) { // event.Skip(); wxClientDC dc(this); PrepareDC(dc); wxPoint point(event.GetLogicalPosition(dc)); if (point == lastLDown) { Refresh(); return; } switch (ParentFrame()->GetMouseQual()) { case stf::peak_cursor: //conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetPeakEnd( stf::round( ((double)point.x - (double)SPX())/XZ() ) ); break; case stf::base_cursor: //conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetBaseEnd( stf::round( ((double)point.x - (double)SPX())/XZ() ) ); break; case stf::decay_cursor: //conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetFitEnd( stf::round( ((double)point.x - (double)SPX())/XZ() ) ); break; #ifdef WITH_PSLOPE case stf::pslope_cursor: // conversion of pixel on screen to time (inversion of xFormat()) Doc()->SetPSlopeEnd( stf::round( ((double)point.x - (double)SPX())/XZ() ) ); #endif case stf::latency_cursor: if (Doc()->GetLatencyEndMode() != stf::manualMode) { wxGetApp().ErrorMsg( wxT("The latency cursor can not be set in the current mode\n \ Choose manual mode to set the latency cursor manually") ); break; } Doc()->SetLatencyEnd(((double)point.x-(double)SPX())/XZ()); break; case stf::zoom_cursor: ulz_x=(double)point.x; ulz_y=(double)point.y; ulz_y2=ulz_y; if (llz_x>ulz_x) std::swap(llz_x,ulz_x); if (llz_y>ulz_y) std::swap(llz_y,ulz_y); if (llz_y2>ulz_y2) std::swap(llz_y2,ulz_y2); isZoomRect=true; break; default: break; } Refresh(); } void wxStfGraph::OnKeyDown(wxKeyEvent& event) { // event.Skip(); if (!view) return; view->Activate(true); int kc = event.GetKeyCode(); #ifdef _STFDEBUG std::cout << "User pressed " << char(kc) << ", corresponding keycode is " << kc << std::endl; std::cout << "Mouse Cursor Mode " << ParentFrame()->GetMouseQual() << std::endl; #endif wxRect WindowRect(GetRect()); switch (kc) { case WXK_LEFT: //left cursor if (event.ControlDown()) { OnLeft(); return; } if (event.ShiftDown()) { SPXW() = SPX()-WindowRect.width; Refresh(); return; } OnPrevious(); return; case WXK_RIGHT: {//right cursor if (event.ControlDown()) { OnRight(); return; } if (event.ShiftDown()) { SPXW() = SPX()+WindowRect.width; Refresh(); return; } OnNext(); return; } case WXK_DOWN: //down cursor if (event.ControlDown()) { ChanScroll(-1); } else { OnDown(); } return; case WXK_UP: //up cursor if (event.ControlDown()) { ChanScroll(1); } else { OnUp(); } return; case 49: //1 ParentFrame()->SetZoomQual(stf::zoomch1); return; case 50: //2 if (Doc()->size()>1) ParentFrame()->SetZoomQual(stf::zoomch2); return; case 51: //3 if (Doc()->size()>1) ParentFrame()->SetZoomQual(stf::zoomboth); return; case 69: // e case 101: ParentFrame()->SetMouseQual(stf::event_cursor); return; case 70: case 102: // f Fittowindow(true); return; case 77: // m case 109: ParentFrame()->SetMouseQual(stf::measure_cursor); return; case 80: // p case 112: ParentFrame()->SetMouseQual(stf::peak_cursor); return; case 65: // 'a' case 97: // Select all traces: if (event.ControlDown()) { wxCommandEvent com; Doc()->Selectall(com); return; } return; case 66: // b case 98: ParentFrame()->SetMouseQual(stf::base_cursor); return; #ifdef WITH_PSLOPE case 79: // key 'o' to activate PSlope cursors case 111: ParentFrame()->SetMouseQual(stf::pslope_cursor); return; #endif case 68: // d case 100: ParentFrame()->SetMouseQual(stf::decay_cursor); return; case 90: // z case 122: ParentFrame()->SetMouseQual(stf::zoom_cursor); return; case 76: // l case 108: ParentFrame()->SetMouseQual(stf::latency_cursor); return; case WXK_RETURN: //Enter or Return { wxGetApp().OnPeakcalcexecMsg(); pFrame->UpdateResults(); return; } case 83: // Invalidate();//s case 115: { Doc()->Select(); return; } case 88: // x case 120: { wxCommandEvent foo; Doc()->OnSwapChannels(foo); return; } case 82: // Invalidate();//r case 114: { Doc()->Remove(); return; } } switch (char(kc)) { case '0': case '=': case '+': if (event.ControlDown()) { OnXenllo(); return; } OnYenllo(); return; case '-': if (event.ControlDown()) { OnXshrinklo(); return; } OnYshrinklo(); return; } } void wxStfGraph::OnZoomHV(wxCommandEvent& event) { OnZoomH(event); OnZoomV(event); } void wxStfGraph::OnZoomH(wxCommandEvent& WXUNUSED(event)) { wxRect WindowRect=GetRect(); llz_x=(llz_x - SPX()) / XZ(); ulz_x=(ulz_x - SPX()) / XZ(); int points=(int)(ulz_x - llz_x); XZW()=(double)WindowRect.width / points; SPXW()=(int)(-llz_x * XZ()); isZoomRect=false; } void wxStfGraph::OnZoomV(wxCommandEvent& WXUNUSED(event)) { wxRect WindowRect=GetRect(); llz_y=(SPY() - llz_y) / YZ(); ulz_y=(SPY() - ulz_y) / YZ(); YZW()=WindowRect.height/fabs(ulz_y-llz_y); SPYW()=(int)(WindowRect.height + ulz_y * YZ()); if (Doc()->size() > 1) { llz_y2=(SPY2()-llz_y2)/YZ2(); ulz_y2=(SPY2()-ulz_y2)/YZ2(); YZ2W()=WindowRect.height/fabs(ulz_y2-llz_y2); SPY2W()=(int)(WindowRect.height + ulz_y2 * YZ2()); } isZoomRect=false; } #if defined __WXMAC__ && !(wxCHECK_VERSION(2, 9, 0)) void wxStfGraph::OnPaint(wxPaintEvent &WXUNUSED(event)) { wxPaintDC PDC(this); OnDraw(PDC); } #endif double prettyNumber( double fDistance, double pixelDistance, int limit ) { double fScaled = 1.0; for (;;) { //set stepsize int nZeros = (int)log10(fScaled); int prev10e = (int)(pow(10.0, nZeros)); int next10e = prev10e * 10; int step = prev10e < 1 ? 1 : prev10e; if ( fScaled / prev10e > 5 ) { fScaled = next10e; step = next10e; } //check whether f scale is ok if ((fScaled/fDistance) * pixelDistance > limit || fScaled>1e9) break; else { //suggest a new f scale: fScaled += step; } } return fScaled; } void wxStfGraph::CreateScale(wxDC* pDC) { // catch bizarre y-Zooms: double fstartPosY=(double)SPY(); if (fabs(fstartPosY)>(double)1.0e15) SPYW()=0; if (fabs(YZ())>1e15) YZW()=1.0; if (!isPrinted) { wxFont font((int)(8*printScale), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); pDC->SetFont(font); } //Copy main window coordinates to 'WindowRect' wxRect WindowRect(GetRect()); if (isPrinted) { //Set WindowRect to print coordinates (page size) WindowRect=printRect; } //1. Creation of x-(time-)scale: //distance between two neigboured time steps in pixels: XZW()=XZ()>0 ? XZ() : 1.0; double pixelDistance=XZ(); //distance between time steps in msec: //(it might be more elegant to read out the equalspaced step size // directly from the Doc()) double timeDistance=1.0/Doc()->GetSR(); //i.e., 1 timeDistance corresponds to 1 pixelDistance //get an integer time value which comes close to 150 pixels: int limit=(int)(100*printScale); double timeScaled = prettyNumber(timeDistance, pixelDistance, limit); int barLength=(int)((timeScaled/timeDistance) * pixelDistance); //2. creation of y-(voltage- or current-)scale //distance between two neigboured yValues in pixels: YZW()=YZ()>1e-9 ? YZ() : 1.0; double pixelDistanceY=YZ(); //real distance (difference) between two neighboured Values: double realDistanceY=1.0; //get an integer y-value which comes close to 150 pixels: double yScaled = prettyNumber(realDistanceY, pixelDistanceY, limit); int barLengthY=(int)((yScaled/realDistanceY) * pixelDistanceY); //3. creation of y-scale for the second channel //Fit scale of second channel to window //distance between two neigboured yValues in pixels: int barLengthY2=100; double yScaled2 =1.0; double pixelDistanceY2= 1.0; //real distance (difference) between two neighboured Values: double realDistanceY2 = 1.0; if ((Doc()->size()>1)) { pixelDistanceY2= YZ2(); //get an entire y-value which comes close to 150 pixels: yScaled2 = prettyNumber(realDistanceY2, pixelDistanceY2, limit); barLengthY2=(int)((yScaled2/realDistanceY2) * pixelDistanceY2); } //End creation y-scale of the 2nd Channel if (wxGetApp().get_isBars()) { // Use scale bars std::vector Scale(5); // Distance of scale bar from bottom and right border of window: int bottomDist=(int)(50*printScale); int rightDist=(int)(60*printScale); // leave space for a second scale bar: if ((Doc()->size()>1)) rightDist*=2; // Set end points for the scale bar Scale[0]=wxPoint(WindowRect.width-rightDist-barLength, WindowRect.height-bottomDist); Scale[1]=wxPoint(WindowRect.width-rightDist, WindowRect.height-bottomDist); Scale[2]=wxPoint(WindowRect.width-rightDist, WindowRect.height-bottomDist-barLengthY); if (Doc()->size()>1 && pFrame->ShowSecond()) { //Set end points for the second channel y-bar Scale[3]=wxPoint(WindowRect.width-rightDist/2, WindowRect.height-bottomDist); Scale[4]=wxPoint(WindowRect.width-rightDist/2, WindowRect.height-bottomDist-barLengthY2); } // Set scalebar labels wxString scaleXString; scaleXString << (int)timeScaled << wxT(" ms"); // Center of x-scalebar: int xCenter=WindowRect.width-(Scale[1].x-Scale[0].x)/2-rightDist; wxRect TextFrameX( wxPoint(xCenter-(int)(40*printScale),WindowRect.height-bottomDist+(int)(5.0*(double)printScale)), wxPoint(xCenter+(int)(40*printScale),WindowRect.height-bottomDist+(int)(25.0*(double)printScale)) ); if (!isLatex) { pDC->DrawLabel( scaleXString,TextFrameX,wxALIGN_CENTRE_HORIZONTAL | wxALIGN_TOP ); } else { #if 0 wxLatexDC* pLatexDC = (wxLatexDC*)pDC; pLatexDC->DrawLabelLatex( scaleXString, TextFrameX,wxALIGN_CENTRE_HORIZONTAL | wxALIGN_TOP ); #endif } wxString scaleYString; #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) scaleYString << (int)yScaled << wxT(" ") << Doc()->at(Doc()->GetCurChIndex()).GetYUnits() << wxT("\0"); #else scaleYString << (int)yScaled << wxT(" ") << wxString(Doc()->at(Doc()->GetCurChIndex()).GetYUnits().c_str(), wxConvUTF8) << wxT("\0"); #endif // Center of y-scalebar: int yCenter=WindowRect.height-bottomDist-(Scale[1].y-Scale[2].y)/2; wxRect TextFrameY( wxPoint(WindowRect.width-rightDist+(int)(5*printScale),yCenter-(int)(10*printScale)), wxPoint(WindowRect.width,yCenter+(int)(10*printScale)) ); if (!isLatex) { pDC->DrawLabel(scaleYString,TextFrameY,wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL); } else { #if 0 wxLatexDC* pLatexDC = (wxLatexDC*)pDC; pLatexDC->DrawLabelLatex(scaleYString,TextFrameY,wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL); #endif } if (Doc()->size()>1 && pFrame->ShowSecond()) { wxString scaleYString2; scaleYString2 << (int)yScaled2 << wxT(" ") #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) << Doc()->at(Doc()->GetSecChIndex()).GetYUnits(); #else << wxString(Doc()->at(Doc()->GetSecChIndex()).GetYUnits().c_str(), wxConvUTF8); #endif // Center of y2-scalebar: int y2Center=WindowRect.height-bottomDist-(Scale[3].y-Scale[4].y)/2; wxRect TextFrameY2( wxPoint(WindowRect.width-rightDist/2+(int)(5*printScale),y2Center-(int)(10*printScale)), wxPoint(WindowRect.width,y2Center+(int)(10*printScale)) ); pDC->SetTextForeground(*wxRED); if (!isLatex) { pDC->DrawLabel(scaleYString2,TextFrameY2,wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); } else { #if 0 wxLatexDC* pLatexDC = (wxLatexDC*)pDC; pLatexDC->DrawLabelLatex(scaleYString2,TextFrameY2,wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); #endif } pDC->SetTextForeground(*wxBLACK); } //Set PenStyle if (!isPrinted) pDC->SetPen(scalePen); else pDC->SetPen(scalePrintPen); //Plot them pDC->DrawLine(Scale[0],Scale[1]); pDC->DrawLine(Scale[1],Scale[2]); if (Doc()->size()>1 && pFrame->ShowSecond()) { if (!isPrinted) pDC->SetPen(scalePen2); else pDC->SetPen(scalePrintPen2); pDC->DrawLine(Scale[3],Scale[4]); } } else { // Use grid // Added 11/02/2006, CSH // Distance of coordinates from bottom, left, top and right border of window: int bottomDist=(int)(50*printScale); int leftDist=(int)(50*printScale); int topDist=(int)(20*printScale); int rightDist=(int)(20*printScale); // upper left corner: pDC->DrawLine(leftDist,topDist,leftDist,WindowRect.height-bottomDist); // lower right corner: pDC->DrawLine(leftDist,WindowRect.height-bottomDist, WindowRect.width-rightDist,WindowRect.height-bottomDist); // second y-axis: if (Doc()->size()>1 && pFrame->ShowSecond()) { pDC->SetPen(scalePen2); // upper left corner: pDC->DrawLine(leftDist*2,topDist,leftDist*2,WindowRect.height-bottomDist); } //Set PenStyle if (!isPrinted) pDC->SetPen(scalePen); else pDC->SetPen(scalePrintPen); // Set ticks: int tickLength=(int)(10*printScale); // Find first y-axis tick: // Get y-value of bottomDist: double yBottom=(SPY()-(WindowRect.height-bottomDist))/YZ(); // Find next-higher integer multiple of barLengthY: int nextTickMult=(int)(yBottom/yScaled); // nextTickMult is truncated; hence, negative and positive values // have to be treated separately: if (yBottom>0) { nextTickMult++; } // pixel position of this tick: double yFirst=nextTickMult*yScaled; int yFirstTick=yFormat(yFirst); // How many times does the y-scale bar fit into the window? int yScaleInWindow=(yFirstTick-topDist)/barLengthY; // y-Axis ticks: for (int n_tick_y=0;n_tick_y<=yScaleInWindow;++n_tick_y) { pDC->DrawLine(leftDist-tickLength, yFirstTick-n_tick_y*barLengthY, leftDist, yFirstTick-n_tick_y*barLengthY); // Create a rectangle from the left window border to the tick: wxRect TextFrame( wxPoint(0,yFirstTick-n_tick_y*barLengthY-(int)(10*printScale)), wxPoint(leftDist-tickLength-1,yFirstTick-n_tick_y*barLengthY+(int)(10*printScale)) ); // Draw Text: int y=(int)(yScaled*n_tick_y+yFirst); wxString yLabel;yLabel << y; pDC->DrawLabel(yLabel,TextFrame,wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); } // Write y units: // Length of y-axis: int yLength=WindowRect.height-topDist-bottomDist; // position of vertical center: int vCenter=topDist+yLength/2; wxRect TextFrame( wxPoint(2,vCenter-(int)(10*printScale)), wxPoint(leftDist-tickLength-1,vCenter+(int)(10*printScale)) ); pDC->DrawLabel( #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) Doc()->at(Doc()->GetCurChIndex()).GetYUnits(), #else wxString(Doc()->at(Doc()->GetCurChIndex()).GetYUnits().c_str(), wxConvUTF8), #endif TextFrame, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL ); // y-Axis of second channel: if (Doc()->size()>1 && pFrame->ShowSecond()) { pDC->SetPen(scalePen2); // Find first y-axis tick: // Get y-value of bottomDist: double y2Bottom=(SPY2()-(WindowRect.height-bottomDist))/YZ2(); // Find next-higher integer multiple of barLengthY: int nextTickMult=(int)(y2Bottom/yScaled2); // nextTickMult is truncated; hence, negative and positive values // have to be treated separately: if (y2Bottom>0) { nextTickMult++; } // pixel position of this tick: double y2First=nextTickMult*yScaled2; int y2FirstTick=yFormat2(y2First); // How many times does the y-scale bar fit into the window? int y2ScaleInWindow = 1; if (barLengthY2 > 0) { y2ScaleInWindow = (y2FirstTick-topDist)/barLengthY2; } else { y2ScaleInWindow = (y2FirstTick-topDist)/1e-15; } // y-Axis ticks: for (int n_tick_y=0;n_tick_y<=y2ScaleInWindow;++n_tick_y) { pDC->DrawLine(leftDist*2-tickLength, y2FirstTick-n_tick_y*barLengthY2, leftDist*2, y2FirstTick-n_tick_y*barLengthY2); // Create a rectangle from the left window border to the tick: wxRect TextFrame2( wxPoint(0,y2FirstTick-n_tick_y*barLengthY2-(int)(10*printScale)), wxPoint(leftDist*2-tickLength-1,y2FirstTick-n_tick_y*barLengthY2+(int)(10*printScale)) ); // Draw Text: int y2=(int)(yScaled2*n_tick_y+y2First); wxString y2Label; y2Label << y2; pDC->SetTextForeground(*wxRED); pDC->DrawLabel(y2Label,TextFrame2,wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pDC->SetTextForeground(*wxBLACK); } // Write y units: // Length of y-axis: int y2Length=WindowRect.height-topDist-bottomDist; // position of vertical center: int v2Center=topDist+y2Length/2; wxRect TextFrame2( wxPoint(2+leftDist,v2Center-(int)(10*printScale)), wxPoint(leftDist*2-tickLength-1,v2Center+(int)(10*printScale)) ); pDC->SetTextForeground(*wxRED); pDC->DrawLabel( #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) Doc()->at(Doc()->GetSecChIndex()).GetYUnits(), #else wxString(Doc()->at(Doc()->GetSecChIndex()).GetYUnits().c_str(), wxConvUTF8), #endif TextFrame2, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL ); pDC->SetTextForeground(*wxBLACK); } // x-Axis ticks: // if x axis starts with the beginning of the trace, find first tick: int xFirstTick=leftDist; double xFirst=0.0; if (isSyncx) { // Find first x-axis tick: // Get x-value of leftDist: double xLeft=(leftDist-SPX())/XZ()*Doc()->GetXScale(); // Find next-higher integer multiple of barLengthX: int nextTickMult=(int)(xLeft/timeScaled); // nextTickMult is truncated; hence, negative and positive values // have to be treated separately: if (xLeft>0) { nextTickMult++; } // pixel position of this tick: xFirst=nextTickMult*timeScaled; double xFirstSamplingPoint=xFirst/Doc()->GetXScale(); // units of sampling points xFirstTick=xFormat(xFirstSamplingPoint); } // How many times does the x-scale bar fit into the window? int xScaleInWindow=(WindowRect.width-xFirstTick-rightDist)/barLength; pDC->SetPen(scalePen); for (int n_tick_x=0;n_tick_x<=xScaleInWindow;++n_tick_x) { pDC->DrawLine(xFirstTick+n_tick_x*barLength, WindowRect.height-bottomDist+tickLength, xFirstTick+n_tick_x*barLength, WindowRect.height-bottomDist); // Create a rectangle: wxRect TextFrame( wxPoint( xFirstTick+n_tick_x*barLength-(int)(40*printScale), WindowRect.height-bottomDist+tickLength ), wxPoint( xFirstTick+n_tick_x*barLength+(int)(40*printScale), WindowRect.height-bottomDist+tickLength+(int)(20*printScale) ) ); // Draw Text: int x=(int)(timeScaled*n_tick_x+xFirst); wxString xLabel; xLabel << x; pDC->DrawLabel(xLabel,TextFrame,wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); } // Draw x-units: // Length of x-axis: int xLength=WindowRect.width-leftDist-rightDist; // position of horizontal center: int hCenter=leftDist+xLength/2; wxRect xTextFrame( wxPoint( hCenter-(int)(40*printScale), WindowRect.height-bottomDist+tickLength+(int)(20*printScale) ), wxPoint( hCenter+(int)(40*printScale), WindowRect.height-bottomDist+tickLength+(int)(40*printScale) ) ); #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) pDC->DrawLabel(Doc()->GetXUnits(),xTextFrame,wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); #else pDC->DrawLabel(wxString(Doc()->GetXUnits().c_str(), wxConvUTF8),xTextFrame,wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL); #endif } } inline long wxStfGraph::xFormat(double toFormat) { return (int)(toFormat * XZ() + SPX()); } inline long wxStfGraph::xFormat(long toFormat) { return (long)(toFormat * XZ() + SPX()); } inline long wxStfGraph::xFormat(int toFormat) { return (long)(toFormat * XZ() + SPX()); } inline long wxStfGraph::xFormat(std::size_t toFormat) { return (long)(toFormat * XZ() + SPX()); } inline long wxStfGraph::yFormat(double toFormat) { return (long)(SPY() - toFormat * YZ()); } inline long wxStfGraph::yFormat(long toFormat) { return (long)(SPY() - toFormat * YZ()); } inline long wxStfGraph::yFormat(int toFormat) { return (long)(SPY() - toFormat * YZ()); } inline long wxStfGraph::yFormat2(double toFormat) { return (long)(SPY2() - toFormat * YZ2()); } inline long wxStfGraph::yFormat2(long toFormat){ return (long)(SPY2() - toFormat * YZ2()); } inline long wxStfGraph::yFormat2(int toFormat){ return (long)(SPY2() - toFormat * YZ2()); } inline long wxStfGraph::yFormatB(double toFormat) { return (long)(yzoombg.startPosY - toFormat * yzoombg.yZoom); } inline long wxStfGraph::yFormatB(long toFormat){ return (long)(yzoombg.startPosY - toFormat * yzoombg.yZoom); } inline long wxStfGraph::yFormatB(int toFormat){ return (long)(yzoombg.startPosY - toFormat * yzoombg.yZoom); } void wxStfGraph::FittorectY(YZoom& yzoom, const wxRect& rect, double min, double max, double screen_part) { yzoom.yZoom = (rect.height/fabs(max-min))*screen_part; yzoom.startPosY = (long)(((screen_part+1.0)/2.0)*rect.height + min * yzoom.yZoom); } void wxStfGraph::Fittowindow(bool refresh) { const double screen_part=0.5; //part of the window to be filled std::size_t points=Doc()->cursec().size(); if (points==0) { wxGetApp().ErrorMsg(wxT("Array of size zero in wxGraph::Fittowindow()")); return; } #if (__cplusplus < 201103) Vector_double::const_iterator max_el = std::max_element(Doc()->cursec().get().begin(), Doc()->cursec().get().end()); Vector_double::const_iterator min_el = std::min_element(Doc()->cursec().get().begin(), Doc()->cursec().get().end()); #else Vector_double::const_iterator max_el = std::max(Doc()->cursec().get().begin(), Doc()->cursec().get().end()); Vector_double::const_iterator min_el = std::min(Doc()->cursec().get().begin(), Doc()->cursec().get().end()); #endif double min = *min_el; if (min>1.0e12) min= 1.0e12; if (min<-1.0e12) min=-1.0e12; double max = *max_el; if (max>1.0e12) max= 1.0e12; if (max<-1.0e12) max=-1.0e12; wxRect WindowRect(GetRect()); switch (ParentFrame()->GetZoomQual()) { //Depending on the zoom radio buttons (Mouse field) //in the (trace navigator) control box case stf::zoomboth: if(!(Doc()->size()>1)) return; //Fit to window Ch2 FitToWindowSecCh(false); //Fit to window Ch1 XZW()=(double)WindowRect.width /points; SPXW()=0; FittorectY(Doc()->GetYZoomW(Doc()->GetCurChIndex()), WindowRect, min, max, screen_part); break; case stf::zoomch2: //ErrorMsg if no second channel available if(!(Doc()->size()>1)) return; //Fit to window Ch2 FitToWindowSecCh(false); break; default: //ErrorMsg if no second channel available // Invalidate(); //Fit to window Ch1 XZW()=(double)WindowRect.width /points; SPXW()=0; FittorectY(Doc()->GetYZoomW(Doc()->GetCurChIndex()), WindowRect, min, max, screen_part); break; } if (refresh) Refresh(); } void wxStfGraph::FitToWindowSecCh(bool refresh) { if (Doc()->size()>1) { //Get coordinates of the main window wxRect WindowRect(GetRect()); const double screen_part=0.5; //part of the window to be filled std::size_t secCh=Doc()->GetSecChIndex(); #undef min #undef max #if (__cplusplus < 201103) Vector_double::const_iterator max_el = std::max_element(Doc()->get()[secCh][Doc()->GetCurSecIndex()].get().begin(), Doc()->get()[secCh][Doc()->GetCurSecIndex()].get().end()); Vector_double::const_iterator min_el = std::min_element(Doc()->get()[secCh][Doc()->GetCurSecIndex()].get().begin(), Doc()->get()[secCh][Doc()->GetCurSecIndex()].get().end()); #else Vector_double::const_iterator max_el = std::max(Doc()->get()[secCh][Doc()->GetCurSecIndex()].get().begin(), Doc()->get()[secCh][Doc()->GetCurSecIndex()].get().end()); Vector_double::const_iterator min_el = std::min(Doc()->get()[secCh][Doc()->GetCurSecIndex()].get().begin(), Doc()->get()[secCh][Doc()->GetCurSecIndex()].get().end()); #endif double min=*min_el; double max=*max_el; FittorectY(Doc()->GetYZoomW(Doc()->GetSecChIndex()), WindowRect, min, max, screen_part); if (refresh) Refresh(); } } //End FitToWindowSecCh() void wxStfGraph::ChangeTrace(int trace) { stf::SectionAttributes sec_attr = Doc()->GetCurrentSectionAttributes(); if (!sec_attr.eventList.empty() && trace != Doc()->GetCurSecIndex()) { for (event_it it2 = sec_attr.eventList.begin(); it2 != sec_attr.eventList.end(); ++it2) { it2->GetCheckBox()->Show(false); } } Doc()->SetSection(trace); wxGetApp().OnPeakcalcexecMsg(); pFrame->SetCurTrace(trace); Refresh(); } void wxStfGraph::OnPrevious() { if (Doc()->get()[Doc()->GetCurChIndex()].size()==1) return; std::size_t curSection=Doc()->GetCurSecIndex(); if (Doc()->GetCurSecIndex() > 0) curSection--; else curSection=Doc()->get()[Doc()->GetCurChIndex()].size()-1; ChangeTrace(curSection); } void wxStfGraph::OnFirst() { if (Doc()->GetCurSecIndex()==0) return; ChangeTrace(0); } void wxStfGraph::OnLast() { if (Doc()->GetCurSecIndex()==Doc()->get()[Doc()->GetCurChIndex()].size()-1) return; std::size_t curSection=Doc()->get()[Doc()->GetCurChIndex()].size()-1; ChangeTrace(curSection); } void wxStfGraph::OnNext() { if (Doc()->get()[Doc()->GetCurChIndex()].size()==1) return; std::size_t curSection=Doc()->GetCurSecIndex(); if (curSection < Doc()->get()[Doc()->GetCurChIndex()].size()-1) curSection++; else curSection=0; ChangeTrace(curSection); } void wxStfGraph::OnUp() { switch (ParentFrame()->GetZoomQual()) { //Depending on the zoom radio buttons (Mouse field) //in the (trace navigator) control box case stf::zoomboth: //ErrorMsg if no second channel available //yZooms of Ch1 are performed keeping the base constant SPYW()=SPY() - 20; if(!(Doc()->size()>1)) break; //Ymove of Ch2 is performed SPY2W()=SPY2() - 20; break; case stf::zoomch2: if(!(Doc()->size()>1)) break; //Ymove of Ch2 is performed SPY2W()=SPY2() - 20; break; default: //Ymove of Ch1 is performed SPYW()=SPY() - 20; break; } Refresh(); } void wxStfGraph::OnDown() { switch (ParentFrame()->GetZoomQual()) { //Depending on the zoom radio buttons (Mouse field) //in the (trace navigator) control box case stf::zoomboth: //yZooms of Ch1 are performed keeping the base constant SPYW()=SPY() + 20; if(!(Doc()->size()>1)) break; //Ymove of Ch2 is performed SPY2W()=SPY2() + 20; break; case stf::zoomch2: if(!(Doc()->size()>1)) break; //Ymove of Ch2 is performed SPY2W()=SPY2() + 20; break; default: //Ymove of Ch1 is performed SPYW()=SPY() + 20; break; } Refresh(); } void wxStfGraph::ChanScroll(int direction) { /* on Control + cursor press, adjust the active channel up or down. */ // direction is either +1, or -1 int ref_chan = Doc()->GetSecChIndex(); int new_chan = Doc()->GetCurChIndex() + direction; int last_chan = Doc()->size()-1; // Exit early if there is only one channel if (Doc()->size() == 1) { return; } /*Rollover conditions ------------------- I ended up resorting to ternery operators because I need to check both that we haven't gone over the document range and that we aren't hitting the reference channel */ if (new_chan == ref_chan) { // Skip the reference channel new_chan += direction; // move one unit past the ref channel. } if (new_chan > last_chan) { // Rollover to start if channel out of range // making sure to skip the reference channel new_chan = (ref_chan == 0)? 1 : 0; } else if (new_chan < 0) { // Rollover to end if channel out of range // making sure to skip the reference channel new_chan = (ref_chan == last_chan)? last_chan-1 : last_chan; } /*Update the window ----------------- */ // Pointer to wxStfChildFrame to access Channel selection combo wxStfChildFrame* pFrame = (wxStfChildFrame*)Doc()->GetDocumentWindow(); if (!pFrame) { return; } // set the channel selection combo //pFrame->SetChannels( actDoc()->GetCurChIndex(), actDoc()->GetSecChIndex()); pFrame->SetChannels(new_chan, ref_chan); pFrame->UpdateChannels(); // update according to the combo Refresh(); } void wxStfGraph::OnRight() { SPXW()=SPX() + 20; Refresh(); } void wxStfGraph::OnLeft() { SPXW()=SPX() - 20; Refresh(); } void wxStfGraph::OnXenlhi() { ChangeXScale(2.0); } void wxStfGraph::OnXenllo() { ChangeXScale(1.1); } void wxStfGraph::OnXshrinklo() { ChangeXScale(1.0/1.1); } void wxStfGraph::OnXshrinkhi() { ChangeXScale(0.5); } void wxStfGraph::ChangeXScale(double factor) { wxRect WindowRect(GetRect()); //point in the middle: double middle=(WindowRect.width/2.0 - SPX()) / XZ(); //new setting for xZoom XZW()=XZ() * factor; //calculation of new start position SPXW()=(int)(WindowRect.width/2.0 - middle * XZ()); Refresh(); } void wxStfGraph::OnYenlhi() { ChangeYScale(2.0); } void wxStfGraph::OnYenllo() { ChangeYScale(1.1); } void wxStfGraph::OnYshrinklo() { ChangeYScale(1/1.1); } void wxStfGraph::OnYshrinkhi() { ChangeYScale(0.5); } void wxStfGraph::ChangeYScale(double factor) { switch (ParentFrame()->GetZoomQual()) { // Depending on the zoom radio buttons (Mouse field) // in the (trace navigator) control box case stf::zoomboth: //yZooms of Ch1 are performed keeping the base constant SPYW()=(int)(SPY() + Doc()->GetBase() * (YZ() * factor - YZ())); YZW()=YZ() * factor; //ErrorMsg if no second channel available if (Doc()->size()<=1) break; //yZooms of Ch2 are performed keeping the base constant SPY2W()=(int)(SPY2() + Doc()->GetBase() * (YZ2() * factor - YZ2())); YZ2W()=YZ2() * factor; break; case stf::zoomch2: if (Doc()->size()<=1) break; //yZooms of Ch2 are performed keeping the base constant SPY2W()=(int)(SPY2() + Doc()->GetBase() * (YZ2() * factor - YZ2())); YZ2W()=YZ2() * factor; break; default: //yZooms of Ch1 are performed keeping the base constant SPYW()=(int)(SPY() + Doc()->GetBase() * (YZ() * factor - YZ())); YZW()=YZ() * factor; break; } Refresh(); } void wxStfGraph::Ch2base() { if ((Doc()->size()>1)) { double base2=0.0; try { double var2=0.0; base2=stfnum::base(Doc()->GetBaselineMethod(),var2,Doc()->get()[Doc()->GetSecChIndex()][Doc()->GetCurSecIndex()].get(), Doc()->GetBaseBeg(),Doc()->GetBaseEnd()); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal ) ); return; } double base1=Doc()->GetBase(); int base1_onScreen=yFormat(base1); // Adjust startPosY2 so that base2 is the same as base1 on the screen; // i.e. yFormat2(base2) == yFormat(base1) // this is what yFormat2(toFormat) does: // return (int)(zoom.startPosY2 - toFormat * zoom.yZoom2); // Solved for startPosY2, this gets: SPY2W()=(int)(base1_onScreen+base2*YZ2()); Refresh(); } } void wxStfGraph::Ch2pos() { if ((Doc()->size()>1)) { SPY2W()=SPY(); Refresh(); } } void wxStfGraph::Ch2zoom() { if ((Doc()->size()>1)) { YZ2W()=YZ(); Refresh(); } } void wxStfGraph::Ch2basezoom() { if ((Doc()->size()>1)) { // Adjust y-scale without refreshing: YZ2W()=YZ(); // Adjust baseline: double base2=0.0; try { double var2=0.0; base2=stfnum::base(Doc()->GetBaselineMethod(),var2,Doc()->get()[Doc()->GetSecChIndex()][Doc()->GetCurSecIndex()].get(), Doc()->GetBaseBeg(),Doc()->GetBaseEnd()); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg( wxString( e.what(), wxConvLocal ) ); return; } double base1=Doc()->GetBase(); int base1_onScreen=yFormat(base1); // Adjust startPosY2 so that base2 is the same as base1 on the screen; // i.e. yFormat2(base2) == yFormat(base1) // this is what yFormat2(toFormat) does: // return (int)(zoom.startPosY2 - toFormat * zoom.yZoom2); // Solved for startPosY2, this gets: SPY2W()=(int)(base1_onScreen+base2*YZ2()); Refresh(); } } void wxStfGraph::set_isPrinted(bool value) { if (value==false) { printScale=1.0; no_gimmicks=false; } else { #if defined __WXGTK__ || defined __APPLE__ printScale=0.25; #endif // store zoom settings upon switching from normal to print view: if (isPrinted==false) { // zoomOld=zoom; } } isPrinted=value; } stimfit-0.16.0/src/stimfit/gui/printout.cpp0000775000175000017500000001714113277303516015640 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // printout.cpp // Controls printing of traces. // 2007-12-27, Christoph Schmidt-Hieber, University of Freiburg #include #ifndef WX_PRECOMP #include #endif #include #include "./app.h" #include "./view.h" #include "./parentframe.h" #include "./doc.h" #include "./printout.h" #include "./graph.h" extern wxStfParentFrame* frame; wxStfPrintout::wxStfPrintout(const wxChar *title) : wxPrintout(title) , store_noGimmicks(false) { wxStfDoc* pDoc = wxGetApp().GetActiveDoc(); if (!pDoc) { wxGetApp().ErrorMsg(wxT("Null pointer (pDoc) in wxStfPrintout::wxStfPrintout()\nAborting printing")); return; } wxStfView* pView = (wxStfView*)pDoc->GetFirstView(); if (!pView) { wxGetApp().ErrorMsg(wxT("Null pointer (pView) in wxStfPrintout::wxStfPrintout()\nAborting printing")); return; } wxStfGraph* pGraph = pView->GetGraph(); if (!pGraph) { wxGetApp().ErrorMsg(wxT("Null pointer (pGraph) in wxStfPrintout::wxStfPrintout()\nAborting printing")); return; } store_noGimmicks=wxGetApp().GetActiveView()->GetGraph()->get_noGimmicks(); } bool wxStfPrintout::OnPrintPage(int WXUNUSED(page)) { wxDC* dc=GetDC(); if (dc) { DrawPageOne(); return true; } else return false; } bool wxStfPrintout::OnBeginDocument(int startPage, int endPage) { if (!wxPrintout::OnBeginDocument(startPage, endPage)) return false; return true; } void wxStfPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) { *minPage = 1; *maxPage = 1; *selPageFrom = 1; *selPageTo = 1; } bool wxStfPrintout::HasPage(int pageNum) { return (pageNum == 1); } void wxStfPrintout::DrawPageOne() { int x,y; GetPPIPrinter(&x,&y); // Get size of Graph, in pixels: wxStfDoc* pDoc = wxGetApp().GetActiveDoc(); if (!pDoc) { wxGetApp().ErrorMsg(wxT("Null pointer (pDoc) in wxStfPrintout::DrawPageOne()\nAborting printing")); return; } wxStfView* pView = (wxStfView*)pDoc->GetFirstView(); if (!pView) { wxGetApp().ErrorMsg(wxT("Null pointer (pView) in wxStfPrintout::DrawPageOne()\nAborting printing")); return; } wxStfGraph* pGraph = pView->GetGraph(); if (!pGraph) { wxGetApp().ErrorMsg(wxT("Null pointer (pGraph) in wxStfPrintout::DrawPageOne()\nAborting printing")); return; } wxRect screenRect(pGraph->GetRect()); // Get size of page, in pixels: wxRect printRect=GetLogicalPageMarginsRect(*(frame->GetPageSetup())); // A first guess at the scale: double hScale=(double)printRect.height/(double)screenRect.height; double headerSizeY=0.0; // Space needed for the header: if (!store_noGimmicks) { headerSizeY=30.0*hScale; } else { pGraph->set_noGimmicks(true); } // Fit to width or fit to height? // If the screenRect's proportion is wider than the printRect's, // fit to width: double scale=1.0; wxRect propPrintRect(printRect); double prop=(double)screenRect.width/(double)screenRect.height; if (prop > (printRect.height-headerSizeY)/printRect.width) { scale=(double)printRect.width/(double)(screenRect.width); // keep width: propPrintRect.height=(int)((double)propPrintRect.width/prop); } else { scale=(double)(printRect.height-headerSizeY)/(double)(screenRect.height); propPrintRect.width=(int)((double)propPrintRect.height*prop); } // maximal extent of the Graph on paper: wxCoord maxX = (int)((double)(screenRect.width)*scale); wxCoord maxY = (int)((double)(screenRect.height)*scale); wxCoord xoff =(printRect.width - maxX) / 2.0; wxCoord yoff =(printRect.height - maxY) / 2.0; #ifdef __WXGTK__ xoff = -printRect.width*0.8; OffsetLogicalOrigin(xoff, 0); xoff = 0; #endif pGraph->set_isPrinted(true); pGraph->set_printScale(scale); // construct a rectangle with the same proportion as the graph on screen: pGraph->set_printRect(propPrintRect); if (!store_noGimmicks) { PrintHeader(GetDC(),hScale); } // create a font that looks similar to the screen font: wxFont font( (int)(6.0 * (double)x/72.0), wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ); GetDC()->SetFont(font); OffsetLogicalOrigin(xoff, (int)(yoff+headerSizeY)); pGraph->OnDraw(*GetDC()); pGraph->set_isPrinted(false); } void wxStfPrintout::PrintHeader(wxDC* pDC, double scale) { int ppiX,ppiY; GetPPIPrinter(&ppiX,&ppiY); double resScale = ppiX / 72.0; #ifdef _WINDOWS int fontScale=(int)(6.0 * resScale); #else int fontScale=(int)(10.0 * resScale); #endif int xstart=0; int ystart=0; // create a font that looks similar to the screen font: wxFont font( fontScale, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ); GetDC()->SetFont(font); // File name and section number: wxString description; description << Doc()->GetFilename() << wxT(", Trace ") << (int)Doc()->GetCurSecIndex()+1 << wxT(" of ") << (int)Doc()->get()[Doc()->GetCurChIndex()].size(); pDC->DrawText(description,xstart,ystart); // Results: stfnum::Table table(Doc()->CurResultsTable()); font.SetWeight(wxFONTWEIGHT_NORMAL); pDC->SetFont(font); int xpos=xstart; for (std::size_t nRow=0;nRow<1;/*table.nRows()*/++nRow) { // row label: for (std::size_t nCol=0;nColDrawText(stf::std2wx(table.GetColLabel(nCol)),xpos,(int)(14.0*resScale)+ystart); if (!table.IsEmpty(nRow,nCol)) { wxString entry; entry << table.at(nRow,nCol); pDC->DrawText(entry,xpos,(int)(24.0*resScale)+ystart); } xpos+=colSize; } } try { stf::SectionAttributes sec_attr = Doc()->GetCurrentSectionAttributes(); if (sec_attr.isFitted) { wxRect WindowRect(GetLogicalPageMarginsRect(*(frame->GetPageSetup()))); int increment=WindowRect.height/50; int yPos=(int)(WindowRect.height*0.5); int xPos=(int)(WindowRect.width*0.75); // print fit info line by line: for (std::size_t n=0;n < sec_attr.bestFit.nRows();++n) { pDC->DrawText(stf::std2wx(sec_attr.bestFit.GetRowLabel(n)),xPos,yPos); wxString value; value << sec_attr.bestFit.at(n,0); pDC->DrawText(value,(int)(xPos+40.0*resScale),yPos); yPos+=increment; } } } catch (const std::out_of_range& e) { } } stimfit-0.16.0/src/stimfit/gui/usrdlg/0000775000175000017500000000000013567226445014630 500000000000000stimfit-0.16.0/src/stimfit/gui/usrdlg/usrdlg.h0000775000175000017500000000474313277303516016225 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file usrdlg.h * \author Christoph Schmidt-Hieber * \date 2008-01-20 * \brief Declares wxStfUsrDlg. */ #ifndef _USRDLG_H #define _USRDLG_H /*! \addtogroup wxstf * @{ */ #ifdef _MSC_VER #pragma warning( disable : 4251 ) // Disable warning messages #endif #include #include #include #include "./../../stf.h" //! A user-defined dialog for entering floating-point numbers. class wxStfUsrDlg : public wxDialog { DECLARE_EVENT_TABLE() private: stf::UserInput input; Vector_double retVec; wxStdDialogButtonSizer* m_sdbSizer; std::vector m_textCtrlArray; std::vector m_staticTextArray; //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param input_ A stf::UserInput struct. * \param id Window id. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfUsrDlg( wxWindow* parent, const stf::UserInput& input_, int id = wxID_ANY, wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Get the user entries. /*! \return The user entries as a vector of doubles. */ Vector_double readInput() const {return retVec;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; /*! @} */ #endif stimfit-0.16.0/src/stimfit/gui/usrdlg/usrdlg.cpp0000775000175000017500000000471113277303516016553 00000000000000#include #ifndef WX_PRECOMP #include #endif #include "./usrdlg.h" BEGIN_EVENT_TABLE( wxStfUsrDlg, wxDialog ) END_EVENT_TABLE() wxStfUsrDlg::wxStfUsrDlg( wxWindow* parent, const stf::UserInput& input_, int id, wxPoint pos, wxSize size, int style #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) ) : wxDialog( parent, id, input_.title, pos, size, style ), #else ) : wxDialog( parent, id, wxString(input_.title.c_str(), wxConvUTF8), pos, size, style ), #endif input(input_), retVec(input_.labels.size()), m_textCtrlArray(input_.labels.size()), m_staticTextArray(input_.labels.size()) { wxFlexGridSizer* gSizer; gSizer = new wxFlexGridSizer( (int)input.labels.size(), 2, 0, 0 ); for (std::size_t nRow=0;nRowAdd( m_staticTextArray[nRow], 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString defLabel; defLabel << input.defaults[nRow]; m_textCtrlArray[nRow]= new wxTextCtrl( this, wxID_ANY, defLabel, wxDefaultPosition, wxSize(64,20), wxTE_RIGHT ); gSizer->Add( m_textCtrlArray[nRow], 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 ); } wxSizer* topSizer; topSizer=new wxBoxSizer(wxVERTICAL); topSizer->Add(gSizer,0,wxALIGN_CENTER,5); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfUsrDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxLogMessage(wxT("Check your entries")); return; } } wxDialog::EndModal(retCode); } bool wxStfUsrDlg::OnOK() { try { for (std::size_t n=0;nGetValue(); entry.ToDouble( &retVec[n] ); } } catch (const std::out_of_range&) { return false; } return true; } stimfit-0.16.0/src/stimfit/gui/table.cpp0000775000175000017500000000560713277303516015047 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // table.cpp // Table entries for spreadsheets in wxStfGrid. // 2007-12-27, Christoph Schmidt-Hieber, University of Freiburg #include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "wx/grid.h" #include "./table.h" bool wxStfTable::IsEmptyCell( int row, int col ) { try { if (row==0 && col>=1) { return table.GetColLabel(col-1) == "\0"; } else if (col==0 && row>=1) { return table.GetRowLabel(row-1) == "\0"; } else if (col!=0 && row!=0) { return table.IsEmpty(row-1,col-1); } else { return true; } } catch (const std::out_of_range&) { return true; } } wxString wxStfTable::GetValue( int row, int col ) { try { if (row==0 && col>=1) { return stf::std2wx(table.GetColLabel(col-1)); } else if (col==0 && row>=1) { return stf::std2wx(table.GetRowLabel(row-1)); } else if (col!=0 && row!=0) { if (table.IsEmpty(row-1,col-1)) return wxT("\0"); wxString strVal; strVal << table.at(row-1,col-1); return strVal; } else { return wxT("\0"); } } catch (const std::out_of_range&) { return wxT("\0"); } } void wxStfTable::SetValue( int row, int col, const wxString& value ) { try { if (row==0 && col>=1) { return table.SetColLabel(col-1, stf::wx2std(value)); } else if (col==0 && row>=1) { return table.SetRowLabel(row-1, stf::wx2std(value)); } else if (col!=0 && row!=0) { wxString strVal; strVal << value; double in=0.0; strVal.ToDouble(&in); table.at(row-1,col-1)=in; } else { return; } } catch (const std::out_of_range&) { return; } } wxString wxStfTable::GetSelection(const wxGridCellCoordsArray& selection) { wxString ret(wxT("\0")); for (std::size_t n_sel=0;n_sel Paste special..."); choose this option for best results. */ void Snapshotwmf(); //! Handles mouse events. /*! The different possibilities (e.g. left or right click) split up * within this function. * \param event The mouse event. Contains information such as whether * the left or right button was clicked. */ void OnMouseEvent(wxMouseEvent& event); //! Handles keyboard input. /*! Key modifiers (e.g. Shift or Ctrl) ar handled within this function. * \param event The keyboard event. Contains information about the key * that was pressed. */ void OnKeyDown(wxKeyEvent& event); //! Change trace /*! Takes care of refreshing everything when a new trace is shown * \param trace Index of next trace to be displayed */ void ChangeTrace(int trace); //! Show and analyse next trace. /*! Called when either the "next trace"-button is clicked or the right * arrow cursor key is pressed. Wraps around when last trace is reached. */ void OnNext(); //! Show and analyse previous trace. /*! Called when either the "previous trace"-button is clicked or the left * arrow cursor key is pressed. Wraps around when first trace is reached. */ void OnPrevious(); //! Show and analyse last trace. /*! Called when the "last trace"-button is clicked. */ void OnLast(); //! Show and analyse first trace. /*! Called when the "first trace"-button is clicked. */ void OnFirst(); //! Moves the traces up by 20 px. /*! Called when either the up arrow cursor key is pressed * or the "Move traces up"-button is clicked. */ void OnUp(); //! Moves the traces down by 20 px. /*! Called when either the down arrow cursor key is pressed * or the "Move traces down"-button is clicked. */ void OnDown(); //! Moves the traces right by 20 px. /*! Called when either the right arrow cursor key and Ctrl are pressed * at the same time or the "Move traces right"-button is clicked. */ void OnRight(); //! Moves the traces left by 20 px. /*! Called when either the left arrow cursor key and Ctrl are pressed * at the same time or the "Move traces left"-button is clicked. */ void OnLeft(); //! Enlarges the x-scale by a factor of 2. /*! This is currently never called and might be removed in the future. */ void OnXenlhi(); //! Enlarges the x-scale by a factor of 1.1. /*! Called when either the "+" key and Ctrl are pressed * at the same time or the "Enlarge x-scale"-button is clicked. */ void OnXenllo(); //! Shrinks the x-scale by a factor of 1.1. /*! Called when either the "-" key and Ctrl are pressed * at the same time or the "Shrink x-scale"-button is clicked. */ void OnXshrinklo(); //! Shrinks the x-scale by a factor of 2. /*! This is currently never called and might be removed in the future. */ void OnXshrinkhi(); //! Enlarges the y-scale by a factor of 2. /*! This is currently never called and might be removed in the future. */ void OnYenlhi(); //! Enlarges the y-scale by a factor of 1.1. /*! Called when either the "+" key is pressed * or the "Enlarge x-scale"-button is clicked. */ void OnYenllo(); //! Shrinks the y-scale by a factor of 1.1. /*! Called when either the "-" key is pressed * or the "Shrink x-scale"-button is clicked. */ void OnYshrinklo(); //! Shrinks the y-scale by a factor of 2. /*! This is currently never called and might be removed in the future. */ void OnYshrinkhi(); //! Adjust y-positioning so that the baselines of channel 1 and 2 are at the same y-position. void Ch2base(); //! Adjust y-positioning so that channel 1 and 2 are at the same absolute y-position. void Ch2pos(); //! Adjust y-scale so that channel 1 and 2 have the same y-scale. void Ch2zoom(); //! Combines Ch2zoom() and Ch2base(). /*! This is a separate function so that the graph is not * refreshed between adjusting the y-scale and the baseline. */ void Ch2basezoom(); //! advance / decrement the active channel by one void ChanScroll(int direction); #if 0 //! Swaps the active and the reference channel. void SwapChannels(); #endif //! Fits the graph to the window. /*! Fits the graph to 100% of the width and 50% of the height * of the window and centers it. * \param refresh Set to true if the graph should be refreshed after fitting it to the window. */ void Fittowindow(bool refresh); //! Destroys all event check boxes void ClearEvents(); //! Set to true if the graph is drawn on a printer. /*! \param value boolean determining whether the graph is printed. */ void set_isPrinted(bool value); //! Sets the printing scale to the specified value. /*! \param value The new printing scale. */ void set_printScale(double value) {printScale=value;} //! Sets the size of the printout to the epcified rectangle. /*! \param value The new printing rectangle. */ void set_printRect(wxRect value) {printRect=value;} //! Set to true if the results table and the cursors should be printed. /*! \param value boolean determining whether everything should be printed. */ void set_noGimmicks(bool value) {no_gimmicks=value;} //! Prints every n-th point. /*! \param value Determines that every n-th point should be printed. */ void set_downsampling(int value) { downsampling = (value < 1 ? 1 : value); } //! Indicates whether everything (cursors, results table, etc.) is printed out. /*! \return true if everything is printed out. */ bool get_noGimmicks() const {return no_gimmicks;} //! Returns the y-position of a right click when in event-detection mode. /*! \return the index of the trace that the right-click position corresponds to. */ int get_eventPos() const { return eventPos; } //! Returns the current zoom struct. /*! \return the current zoom struct. */ // Zoom get_zoom() { return Doc()->at(Doc()->GetCurChIndex()).GetZoom(); } //! Sets the current zoom struct. /*! \param zoom_ The current zoom struct. */ // void set_zoom(const Zoom& zoom_) { Doc()->at(Doc()->GetCurChIndex()).GetZoomW()=zoom_; } //! The view attached to this wxStfGraph. wxStfView *view; //! Returns x value of the left screen border /*! \return x value of the left screen border */ double get_plot_xmin() const; //! Returns x value of the right screen border /*! \return x value of the right screen border */ double get_plot_xmax() const; //! Returns y value of the bottom screen border /*! \return y value of the bottom screen border */ double get_plot_ymin() const; //! Returns y value of the top screen border /*! \return y value of the top screen border */ double get_plot_ymax() const; //! Returns y value of the bottom screen border for the reference channel /*! \return y value of the bottom screen border for the reference channel */ double get_plot_y2min() const; //! Returns y value of the top screen border for the reference channel /*! \return y value of the top screen border for the reference channel */ double get_plot_y2max() const; private: wxStfChildFrame* pFrame; bool isZoomRect; //True if zoom window is set bool no_gimmicks; //True if no extra rulers/lines and circles shall be displayed bool isPrinted; //True when the View is drawn to a printer bool isLatex; bool firstPass; bool isSyncx; //Zoom struct // Zoom zoom; //Zoom struct to retain StdOut // Zoom zoomOld; //Zoom struct for PrintOut // Zoom zoomPrint; //Variables for the scaling of the print out wxRect printRect; //Printout graphic variables static const int boebbelStd=6;//Size of circles for display output int boebbel, //Size of circles (for peak, 2080rise time, etc.) boebbelPrint; //Size of circles for scalable print out double printScale; int printSizePen1,//Size of pens for scalable print out printSizePen2, printSizePen4, downsampling, eventPos; // ll... means lower limit, ul... means upper limit double llz_x, ulz_x, llz_y, ulz_y, llz_y2,ulz_y2; //Three lines of text containing the results wxString results1, results2, results3,results4, results5, results6; //Pens are declared here instead of locally to accelerate OnDraw() //Drawing (pen) styles for the different graphical standard output wxPen standardPen, standardPen2, standardPen3, scalePen, scalePen2, peakPen, peakLimitPen, basePen, baseLimitPen, decayLimitPen, ZoomRectPen, fitPen, fitSelectedPen, selectPen, averagePen, rtPen, hdPen, rdPen, slopePen, latencyPen, alignPen, measPen, eventPen, PSlopePen; /*CSH*/ //Drawing (pen) styles for the different graphical standard output wxPen standardPrintPen, standardPrintPen2, standardPrintPen3, scalePrintPen, scalePrintPen2,measPrintPen, peakPrintPen, peakLimitPrintPen, basePrintPen, baseLimitPrintPen, decayLimitPrintPen, fitPrintPen, fitSelectedPrintPen, selectPrintPen, averagePrintPen, rtPrintPen, hdPrintPen, rdPrintPen, slopePrintPen, resultsPrintPen, latencyPrintPen, PSlopePrintPen; wxBrush baseBrush, zeroBrush; wxPoint lastLDown; YZoom yzoombg; #if (__cplusplus < 201103) boost::shared_ptr m_zoomContext; boost::shared_ptr m_eventContext; #else std::shared_ptr m_zoomContext; std::shared_ptr m_eventContext; #endif void InitPlot(); void PlotSelected(wxDC& DC); void PlotAverage(wxDC& DC); void DrawZoomRect(wxDC& DC); void PlotGimmicks(wxDC& DC); void PlotEvents(wxDC& DC); void DrawCrosshair( wxDC& DC, const wxPen& pen, const wxPen& printPen, int crosshairSize, double xch, double ych); void PlotTrace( wxDC* pDC, const Vector_double& trace, plottype pt=active, int bgno=0 ); void DoPlot( wxDC* pDC, const Vector_double& trace, int start, int end, int step, plottype pt=active, int bgno=0 ); void PrintScale(wxRect& WindowRect); void PrintTrace( wxDC* pDC, const Vector_double& trace, plottype ptype=active); void DoPrint( wxDC* pDC, const Vector_double& trace, int start, int end, plottype ptype=active); void DrawCircle(wxDC* pDC, double x, double y, const wxPen& pen, const wxPen& printPen); void DrawVLine(wxDC* pDC, double x, const wxPen& pen, const wxPen& printPen); void DrawHLine(wxDC* pDC, double y, const wxPen& pen, const wxPen& printPen); void eventArrow(wxDC* pDC, int eventIndex); void DrawFit(wxDC* pDC); void PlotFit( wxDC* pDC, const stf::SectionPointer& Sec ); void DrawIntegral(wxDC* pDC); void CreateScale(wxDC* pDC); // Function receives the x-coordinate of a point and returns // its formatted value according to the current Zoom settings long xFormat(double); long xFormat(long); long xFormat(int); long xFormat(std::size_t); // The same for the y coordinates long yFormat(double); long yFormat(long); long yFormat(int); long yFormatD(double f) { return yFormat(f); } // The same for the y coordinates of the second channel long yFormat2(double); long yFormat2(long); long yFormat2(int); long yFormatD2(double f) { return yFormat2(f); } // The same for the y coordinates of the background channel long yFormatB(double); long yFormatB(long); long yFormatB(int); long yFormatDB(double f) { return yFormatB(f); } void FittorectY(YZoom& yzoom, const wxRect& rect, double min, double max, double screen_part); void FitToWindowSecCh(bool refresh); void LButtonDown(wxMouseEvent& event); void RButtonDown(wxMouseEvent& event); void LButtonUp(wxMouseEvent& event); // shorthand: wxStfDoc* Doc() { if (view != NULL) return view->Doc(); else return NULL; } wxStfDoc* DocC() const { if (view != NULL) return view->DocC(); else return NULL; } void ChangeXScale(double factor); void ChangeYScale(double factor); wxStfParentFrame* ParentFrame(); void OnZoomHV(wxCommandEvent& event); void OnZoomH(wxCommandEvent& event); void OnZoomV(wxCommandEvent& event); #if defined __WXMAC__ && !(wxCHECK_VERSION(2, 9, 0)) void OnPaint(wxPaintEvent &event); #endif long SPX() const { return DocC()->GetXZoom().startPosX; } long& SPXW() { return DocC()->GetXZoomW().startPosX; } long SPY() const { return DocC()->GetYZoom(DocC()->GetCurChIndex()).startPosY; } long& SPYW() { return DocC()->GetYZoomW(DocC()->GetCurChIndex()).startPosY; } long SPY2() const { return DocC()->GetYZoom(DocC()->GetSecChIndex()).startPosY; } long& SPY2W() { return DocC()->GetYZoomW(DocC()->GetSecChIndex()).startPosY; } double XZ() const { return DocC()->GetXZoom().xZoom; } double& XZW() { return DocC()->GetXZoomW().xZoom; } double YZ() const { return DocC()->GetYZoom(DocC()->GetCurChIndex()).yZoom; } double& YZW() { return DocC()->GetYZoomW(DocC()->GetCurChIndex()).yZoom; } double YZ2() const { return DocC()->GetYZoom(DocC()->GetSecChIndex()).yZoom; } double& YZ2W() { return DocC()->GetYZoomW(DocC()->GetSecChIndex()).yZoom; } DECLARE_EVENT_TABLE() }; /*@}*/ #endif stimfit-0.16.0/src/stimfit/gui/copygrid.h0000775000175000017500000000650513277303516015243 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file copygrid.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfGrid. Derived from wxGrid to allow copying to clipboard. */ #ifndef _COPYGRID_H #define _COPYGRID_H /*! \addtogroup wxstf * @{ */ //! Derived from wxGrid. Allows to copy cells to the clipboard. class wxStfGrid : public wxGrid { DECLARE_CLASS(wxStfGrid) public: //! Constructor /*! \param parent Pointer to the parent window. * \param id Window id. * \param pos Initial window position. * \param size Initial window size. * \param style Grid style. * \param name Name of this grid. */ wxStfGrid( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxWANTS_CHARS, const wxString& name = wxGridNameStr ); //! Get the selection. /*! \return The selected cells as a string. */ wxString GetSelection() const {return selection;} // Get the context menu. /*! \return A pointer to the context menu. */ wxMenu* get_labelMenu() {return m_labelContext.get();} //! Updates the context menu. void ViewResults(); private: wxString selection; void Copy(wxCommandEvent& event); void OnRClick(wxGridEvent& event); void OnLabelRClick(wxGridEvent& event); void OnKeyDown(wxKeyEvent& event); void ViewCrosshair(wxCommandEvent& event); void ViewBaseline(wxCommandEvent& event); void ViewBaseSD(wxCommandEvent& event); void ViewThreshold(wxCommandEvent& event); void ViewPeakzero(wxCommandEvent& event); void ViewPeakbase(wxCommandEvent& event); void ViewPeakthreshold(wxCommandEvent& event); void ViewRTLoHi(wxCommandEvent& event); void ViewInnerRiseTime(wxCommandEvent& event); void ViewOuterRiseTime(wxCommandEvent& event); void ViewT50(wxCommandEvent& event); void ViewRD(wxCommandEvent& event); void ViewSloperise(wxCommandEvent& event); void ViewSlopedecay(wxCommandEvent& event); void ViewLatency(wxCommandEvent& event); #ifdef WITH_PSLOPE void ViewPSlope(wxCommandEvent& event); #endif void ViewCursors(wxCommandEvent& event); void SetCheckmark(const wxString& RegEntry, int id); #if (__cplusplus < 201103) boost::shared_ptr m_context; boost::shared_ptr m_labelContext; #else std::shared_ptr m_context; std::shared_ptr m_labelContext; #endif DECLARE_EVENT_TABLE() }; /*@}*/ #endif stimfit-0.16.0/src/stimfit/gui/parentframe.cpp0000775000175000017500000015061113567226230016257 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // parentframe.cpp // These are the top-level and child windows of the application. // 2007-12-27, Christoph Schmidt-Hieber, University of Freiburg #ifdef _STFDEBUG #include #endif // For compilers that support precompilation, includes "wx/wx.h". #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include #endif #if !wxUSE_DOC_VIEW_ARCHITECTURE #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h! #endif #if !wxUSE_MDI_ARCHITECTURE #error You must set wxUSE_MDI_ARCHITECTURE to 1 in setup.h! #endif #include "../../../stfconf.h" #include "./app.h" #include "./doc.h" #include "./view.h" #include "./graph.h" #include "./table.h" #include "./printout.h" #include "./dlgs/convertdlg.h" #include "./dlgs/smalldlgs.h" #include "./copygrid.h" #include "./../../libstfio/atf/atflib.h" #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) #include "./../../libstfio/biosig/biosiglib.h" #endif #include "./../../libstfio/igor/igorlib.h" #include "./childframe.h" #include "./parentframe.h" #include "./../../libstfnum/levmar/levmar.h" #include "./../res/16-em-down.xpm" #include "./../res/16-em-open.xpm" #include "./../res/accept.xpm" #include "./../res/arrow_down.xpm" #include "./../res/arrow_left.xpm" #include "./../res/arrow_out.xpm" #include "./../res/arrow_right.xpm" #include "./../res/arrow_up.xpm" #include "./../res/camera.xpm" #include "./../res/camera_ps.xpm" #include "./../res/ch1.xpm" #include "./../res/ch2.xpm" #include "./../res/cursor.xpm" #include "./../res/event.xpm" #include "./../res/fit.xpm" #include "./../res/fit_lim.xpm" #include "./../res/latency_lim.xpm" #include "./../res/resultset_first.xpm" #include "./../res/resultset_last.xpm" #include "./../res/resultset_next.xpm" #include "./../res/resultset_previous.xpm" #include "./../res/sum_new.xpm" #include "./../res/sum_new_aligned.xpm" #include "./../res/table.xpm" #include "./../res/zoom.xpm" #include "./../res/zoom_in.xpm" #include "./../res/zoom_out.xpm" #ifdef WITH_PSLOPE #include "./../res/slope.xpm" #endif #ifndef wxS_DIR_DEFAULT #define wxS_DIR_DEFAULT 0777 #endif IMPLEMENT_CLASS(wxStfParentFrame, wxStfParentType) BEGIN_EVENT_TABLE(wxStfParentFrame, wxStfParentType) EVT_MENU(wxID_HELP, wxStfParentFrame::OnHelp) EVT_MENU(ID_UPDATE, wxStfParentFrame::OnCheckUpdate) EVT_MENU(wxID_ABOUT, wxStfParentFrame::OnAbout) EVT_TOOL(ID_TOOL_SELECT,wxStfParentFrame::OnToggleSelect) EVT_TOOL(ID_TOOL_FIRST, wxStfParentFrame::OnToolFirst) EVT_TOOL(ID_TOOL_NEXT, wxStfParentFrame::OnToolNext) EVT_TOOL(ID_TOOL_PREVIOUS, wxStfParentFrame::OnToolPrevious) EVT_TOOL(ID_TOOL_LAST, wxStfParentFrame::OnToolLast) EVT_TOOL(ID_TOOL_XENL, wxStfParentFrame::OnToolXenl) EVT_TOOL(ID_TOOL_XSHRINK, wxStfParentFrame::OnToolXshrink) EVT_TOOL(ID_TOOL_YENL, wxStfParentFrame::OnToolYenl) EVT_TOOL(ID_TOOL_YSHRINK, wxStfParentFrame::OnToolYshrink) EVT_TOOL(ID_TOOL_UP, wxStfParentFrame::OnToolUp) EVT_TOOL(ID_TOOL_DOWN, wxStfParentFrame::OnToolDown) EVT_TOOL(ID_TOOL_FIT, wxStfParentFrame::OnToolFit) EVT_TOOL(ID_TOOL_LEFT, wxStfParentFrame::OnToolLeft) EVT_TOOL(ID_TOOL_RIGHT, wxStfParentFrame::OnToolRight) EVT_TOOL(ID_TOOL_SNAPSHOT_WMF, wxStfParentFrame::OnToolSnapshotwmf) EVT_TOOL(ID_TOOL_CH1, wxStfParentFrame::OnToolCh1) EVT_TOOL(ID_TOOL_CH2, wxStfParentFrame::OnToolCh2) EVT_TOOL(ID_TOOL_MEASURE, wxStfParentFrame::OnToolMeasure) EVT_TOOL(ID_TOOL_PEAK,wxStfParentFrame::OnToolPeak) EVT_TOOL(ID_TOOL_BASE,wxStfParentFrame::OnToolBase) EVT_TOOL(ID_TOOL_DECAY,wxStfParentFrame::OnToolDecay) #ifdef WITH_PSLOPE EVT_TOOL(ID_TOOL_PSLOPE,wxStfParentFrame::OnToolPSlope) #endif EVT_TOOL(ID_TOOL_LATENCY,wxStfParentFrame::OnToolLatency) EVT_TOOL(ID_TOOL_ZOOM,wxStfParentFrame::OnToolZoom) EVT_TOOL(ID_TOOL_EVENT,wxStfParentFrame::OnToolEvent) EVT_TOOL(ID_TOOL_FITDECAY, wxStfParentFrame::OnToolFitdecay) EVT_MENU(ID_CONVERT, wxStfParentFrame::OnConvert) EVT_MENU(ID_AVERAGE, wxStfParentFrame::OnAverage) EVT_MENU(ID_ALIGNEDAVERAGE, wxStfParentFrame::OnAlignedAverage) EVT_MENU( ID_VIEW_RESULTS, wxStfParentFrame::OnViewResults) EVT_MENU( ID_CH2BASE, wxStfParentFrame::OnCh2base ) EVT_MENU( ID_CH2POS, wxStfParentFrame::OnCh2pos ) EVT_MENU( ID_CH2ZOOM, wxStfParentFrame::OnCh2zoom ) EVT_MENU( ID_CH2BASEZOOM, wxStfParentFrame::OnCh2basezoom ) EVT_MENU( ID_SCALE, wxStfParentFrame::OnScale ) EVT_MENU( ID_PRINT_PRINT, wxStfParentFrame::OnPrint) EVT_MENU( ID_MPL, wxStfParentFrame::OnMpl) EVT_MENU( ID_MPL_SPECTRUM,wxStfParentFrame::OnMplSpectrum) EVT_MENU( ID_PRINT_PAGE_SETUP, wxStfParentFrame::OnPageSetup) EVT_MENU( ID_SAVEPERSPECTIVE, wxStfParentFrame::OnSaveperspective ) EVT_MENU( ID_LOADPERSPECTIVE, wxStfParentFrame::OnLoadperspective ) EVT_MENU( ID_RESTOREPERSPECTIVE, wxStfParentFrame::OnRestoreperspective ) #ifdef WITH_PYTHON EVT_MENU( ID_VIEW_SHELL, wxStfParentFrame::OnViewshell ) #endif #if 0 EVT_MENU( ID_LATENCYSTART_MAXSLOPE, wxStfParentFrame::OnLStartMaxslope ) EVT_MENU( ID_LATENCYSTART_HALFRISE, wxStfParentFrame::OnLStartHalfrise ) EVT_MENU( ID_LATENCYSTART_PEAK, wxStfParentFrame::OnLStartPeak ) EVT_MENU( ID_LATENCYSTART_MANUAL, wxStfParentFrame::OnLStartManual ) EVT_MENU( ID_LATENCYEND_FOOT, wxStfParentFrame::OnLEndFoot ) EVT_MENU( ID_LATENCYEND_MAXSLOPE, wxStfParentFrame::OnLEndMaxslope ) EVT_MENU( ID_LATENCYEND_PEAK, wxStfParentFrame::OnLEndPeak ) EVT_MENU( ID_LATENCYEND_HALFRISE, wxStfParentFrame::OnLEndHalfrise ) EVT_MENU( ID_LATENCYEND_MANUAL, wxStfParentFrame::OnLEndManual ) EVT_MENU( ID_LATENCYWINDOW, wxStfParentFrame::OnLWindow ) #endif END_EVENT_TABLE() wxStfParentFrame::wxStfParentFrame(wxDocManager *manager, wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long type): wxStfParentType(manager, frame, wxID_ANY, title, pos, size, type, _T("myFrame")), mpl_figno(0) { // ::wxInitAllImageHandlers(); m_mgr.SetManagedWindow(this); m_mgr.SetFlags( wxAUI_MGR_ALLOW_FLOATING | wxAUI_MGR_TRANSPARENT_DRAG | wxAUI_MGR_VENETIAN_BLINDS_HINT | wxAUI_MGR_ALLOW_ACTIVE_PANE ); #if wxUSE_DRAG_AND_DROP m_drop = new wxStfFileDrop; // obviously gets deleted when the frame is destructed SetDropTarget(m_drop); #endif m_printData.reset(new wxPrintData); // initial paper size // m_printData->SetQuality(wxPRINT_QUALITY_HIGH); // int ppi = m_printData->GetQuality(); m_printData->SetPaperId(wxPAPER_A4); // initial orientation m_printData->SetOrientation(wxLANDSCAPE); m_pageSetupData.reset(new wxPageSetupDialogData); // copy over initial paper size from print record m_pageSetupData->SetPrintData(*m_printData); // Set some initial page margins in mm. m_pageSetupData->SetMarginTopLeft(wxPoint(15, 15)); m_pageSetupData->SetMarginBottomRight(wxPoint(15, 15)); // create some toolbars wxStfToolBar* tb1 = CreateStdTb(); tb1->Realize(); m_scaleToolBar=CreateScaleTb(); m_scaleToolBar->Realize(); wxStfToolBar* tb4=CreateEditTb(); tb4->Realize(); m_cursorToolBar=CreateCursorTb(); m_cursorToolBar->Realize(); // add the toolbars to the manager m_mgr.AddPane( tb1, wxAuiPaneInfo().Name(wxT("tb1")).Caption(wxT("Std Toolbar")).ToolbarPane().Resizable(false). Position(0).Top().Gripper().RightDockable(false) ); #ifdef __WXMAC__ int xpos = 64, ypos = 32; #endif m_mgr.AddPane( m_cursorToolBar, wxAuiPaneInfo().Name(wxT("tb2")).Caption(wxT("Edit Toolbar")). ToolbarPane().Resizable(false). #ifndef __WXMAC__ Position(1).Top().Gripper().RightDockable(false) ); #else Dockable(false).Float().FloatingPosition(xpos, ypos) ); xpos += m_cursorToolBar->GetSize().GetWidth()+8; #endif m_mgr.AddPane( tb4, wxAuiPaneInfo().Name(wxT("tb4")).Caption(wxT("Analysis Toolbar")). ToolbarPane().Resizable(false). #ifndef __WXMAC__ Position(2).Top().Gripper().RightDockable(false) ); #else Dockable(false).Float().FloatingPosition(xpos,ypos) ); xpos += tb4->GetSize().GetWidth()+8; #endif m_mgr.AddPane( m_scaleToolBar, wxAuiPaneInfo().Name(wxT("m_scaleToolBar")).Caption(wxT("Navigation Toolbar")). ToolbarPane().Resizable(false). #ifndef __WXMAC__ Position(3).Top().Gripper().RightDockable(false) ); #else Dockable(false).Float().FloatingPosition(xpos,ypos) ); #endif SetMouseQual( stf::measure_cursor ); #ifdef WITH_PYTHON python_code2 << wxT("import sys\n") << wxT("sys.path.append('.')\n") << wxT("sys.path.append('/usr/local/lib/stimfit')\n") #ifdef IPYTHON << wxT("import embedded_ipython\n") #else << wxT("import embedded_stf\n") #endif << wxT("\n") << wxT("def makeWindow(parent, figsize=(8,6)):\n") #ifdef IPYTHON << wxT(" win = embedded_ipython.MyPanel(parent)\n") #else << wxT(" win = embedded_stf.MyPanel(parent)\n") #endif << wxT(" return win\n") << wxT("\n") #if PY_MAJOR_VERSION < 3 << wxT("import embedded_mpl\n") << wxT("def plotWindowMpl(parent, figsize=(8,6)):\n") << wxT(" win = embedded_mpl.MplPanel(parent, figsize)\n") << wxT(" win.plot_screen()\n") << wxT(" return win\n") << wxT("\n") << wxT("def spectrumWindowMpl(parent, figsize=(8,6)):\n") << wxT(" win = embedded_mpl.MplPanel(parent, figsize)\n") << wxT(" win.plot_spectrum()\n") << wxT(" return win\n") << wxT("\n") << wxT("def makeWindowMpl(parent, figsize=(8,6)):\n") << wxT(" win = embedded_mpl.MplPanel(parent, figsize)\n") << wxT(" return win\n") #endif ; /* The window remains open after the main application has been closed; deactivated for the time being. * RedirectStdio(); */ bool show = wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewShell"), 1); wxWindow* pPython = MakePythonWindow("makeWindow", "pythonShell", "Python Shell", show, #ifdef __WXMAC__ true #else false, false, GetClientSize().GetWidth(), GetClientSize().GetHeight()/5 #endif ).cppWindow; if ( pPython == 0 ) { wxGetApp().ErrorMsg(wxT("Can't create a window for the python shell\nPointer is zero")); } #ifdef _STFDEBUG #ifdef _WINDOWS wxGetApp().InfoMsg( python_code2 ); #else std::cout << "python startup script:\n" << std::string( python_code2.char_str() ); #endif // _WINDOWS #endif // _STFDEBUG #else // WITH_PYTHON m_mgr.Update(); #endif // WITH_PYTHON wxStatusBar* pStatusBar = new wxStatusBar(this, wxID_ANY, wxST_SIZEGRIP); SetStatusBar(pStatusBar); //int widths[] = { 60, 60, -1 }; //pStatusBar->SetFieldWidths(WXSIZEOF(widths), widths); //pStatusBar->SetStatusText(wxT("Test"), 0); } wxStfParentFrame::~wxStfParentFrame() { // deinitialize the frame manager #ifdef WITH_PYTHON // write visibility of the shell to config: bool shell_state = m_mgr.GetPane(wxT("pythonShell")).IsShown(); wxGetApp().wxWriteProfileInt( wxT("Settings"),wxT("ViewShell"), int(shell_state) ); #endif m_mgr.UnInit(); } wxStfToolBar* wxStfParentFrame::CreateStdTb() { wxStfToolBar* tb1=new wxStfToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE ); tb1->SetToolBitmapSize(wxSize(20,20)); tb1->AddTool( wxID_OPEN, wxT("Open"), wxArtProvider::GetBitmap( wxART_FILE_OPEN, wxART_TOOLBAR, wxSize(16,16) ), wxT("Open file"), wxITEM_NORMAL ); tb1->AddTool( wxID_SAVEAS, wxT("Save"), wxArtProvider::GetBitmap( wxART_FILE_SAVE_AS, wxART_TOOLBAR, wxSize(16,16) ), wxT("Save traces"), wxITEM_NORMAL ); tb1->AddTool( ID_PRINT_PRINT, wxT("Print"), wxArtProvider::GetBitmap( wxART_PRINT, wxART_TOOLBAR, wxSize(16,16) ), wxT("Print traces"), wxITEM_NORMAL ); return tb1; } wxStfToolBar* wxStfParentFrame::CreateScaleTb() { wxStfToolBar* scaleToolBar = new wxStfToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE ); scaleToolBar->SetToolBitmapSize(wxSize(20,20)); scaleToolBar->AddTool( ID_TOOL_FIRST, wxT("First"), wxBitmap(resultset_first), wxT("Go to first trace"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_PREVIOUS, wxT("Prev."), wxBitmap(resultset_previous), wxT("Go to previous trace (left cursor)"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_NEXT, wxT("Next"), wxBitmap(resultset_next), wxT("Go to next trace (right cursor)"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_LAST, wxT("Last"), wxBitmap(resultset_last), wxT("Go to last trace"), wxITEM_NORMAL ); scaleToolBar->AddSeparator(); scaleToolBar->AddTool( ID_TOOL_LEFT, wxT("Left"), wxBitmap(arrow_left), wxT("Move traces left (CTRL+left cursor)"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_RIGHT, wxT("Right"), wxBitmap(arrow_right), wxT("Move traces right (CTRL+right cursor)"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_FIT, wxT("Fit"), wxBitmap(arrow_out), wxT("Fit traces to window (\"F\")"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_UP, wxT("Up"), wxBitmap(arrow_up), wxT("Move traces up (up cursor)"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_DOWN, wxT("Down"), wxBitmap(arrow_down), wxT("Move traces down (down cursor)"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_XENL, wxT("Zoom X"), wxBitmap(zoom_in), wxT("Enlarge x-scale (CTRL + \"+\")"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_XSHRINK, wxT("Shrink X"), wxBitmap(zoom_out), wxT("Shrink x-scale (CTRL + \"-\")"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_YENL, wxT("Zoom Y"), wxBitmap(zoom_in), wxT("Enlarge y-scale (\"+\")"), wxITEM_NORMAL ); scaleToolBar->AddTool( ID_TOOL_YSHRINK, wxT("Shrink Y"), wxBitmap(zoom_out), wxT("Shrink y-scale (\"-\")"), wxITEM_NORMAL ); scaleToolBar->AddSeparator(); scaleToolBar->AddTool( ID_TOOL_CH1, wxT("Ch 1"), wxBitmap(ch_), wxT("Scaling applies to active (black) channel (\"1\")"), wxITEM_CHECK ); scaleToolBar->AddTool( ID_TOOL_CH2, wxT("Ch 2"), wxBitmap(ch2_), wxT("Scaling applies to reference (red) channel (\"2\")"), wxITEM_CHECK ); return scaleToolBar; } wxStfToolBar* wxStfParentFrame::CreateEditTb() { wxStfToolBar* tb4= new wxStfToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE ); tb4->SetToolBitmapSize(wxSize(20,20)); tb4->AddTool( ID_AVERAGE, wxT("Mean"), wxBitmap(sum_new), wxT("Average of selected traces"), wxITEM_NORMAL ); tb4->AddTool( ID_ALIGNEDAVERAGE, wxT("Aligned"), wxBitmap(sum_new_aligned), wxT("Aligned average of selected traces"), wxITEM_NORMAL ); tb4->AddTool( ID_TOOL_FITDECAY, wxT("Fit"), wxBitmap(fit),//chart_line), wxT("Fit function to data"), wxITEM_NORMAL ); tb4->AddTool( ID_VIEWTABLE, wxT("Table"), wxBitmap(table), wxT("View current trace as a table"), wxITEM_NORMAL ); return tb4; } wxStfToolBar* wxStfParentFrame::CreateCursorTb() { wxStfToolBar* cursorToolBar = new wxStfToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE ); cursorToolBar->SetToolBitmapSize(wxSize(20,20)); cursorToolBar->AddTool( ID_TOOL_SELECT, wxT("Select"), wxBitmap( acceptbmp ), wxT("Select or unselect this trace (\"S\" / \"R\")"), wxITEM_CHECK ); // cursorToolBar->AddTool( ID_TOOL_REMOVE, // wxT("Unselect"), // wxBitmap( bin ), // wxT("Unselect this trace (\"R\")"), // wxITEM_NORMAL ); cursorToolBar->AddSeparator(); cursorToolBar->AddTool( ID_MPL, wxT("Snapshot"), wxBitmap(camera), wxT("Create snapshot with matplotlib"), wxITEM_NORMAL ); cursorToolBar->AddTool( ID_TOOL_SNAPSHOT_WMF, wxT("WMF Snapshot"), wxBitmap(camera_ps), wxT("Copy vectorized image to clipboard"), wxITEM_NORMAL ); cursorToolBar->AddSeparator(); cursorToolBar->AddTool( ID_TOOL_MEASURE, _T("Measure"), wxBitmap(cursor), wxT("Mouse selects measurement (crosshair) cursor (\"M\")"), wxITEM_CHECK ); cursorToolBar->AddTool( ID_TOOL_PEAK, _T("Peak"), wxBitmap(___em_open), wxT("Mouse selects peak cursors (\"P\")"), wxITEM_CHECK ); cursorToolBar->AddTool( ID_TOOL_BASE, _T("Base"), wxBitmap(___em_down), wxT("Mouse selects base cursors (\"B\")"), wxITEM_CHECK ); cursorToolBar->AddTool( ID_TOOL_DECAY, _T("Fit"), wxBitmap(fit_lim),//chart_curve), wxT("Mouse selects fit cursors (\"D\")"), wxITEM_CHECK ); cursorToolBar->AddTool( ID_TOOL_LATENCY, _T("Latency"), wxBitmap(latency_lim),//chart_curve), wxT("Mouse selects latency cursors (\"L\")"), wxITEM_CHECK ); #ifdef WITH_PSLOPE cursorToolBar->AddTool( ID_TOOL_PSLOPE, _T("Slope"), wxBitmap(slope), wxT("Mouse selects slope cursors (\"O\")"), wxITEM_CHECK ); #endif cursorToolBar->AddTool( ID_TOOL_ZOOM, _T("Zoom"), wxBitmap(zoom), wxT("Draw a zoom window with left mouse button (\"Z\")"), wxITEM_CHECK ); cursorToolBar->AddTool( ID_TOOL_EVENT, _T("Events"), wxBitmap(event), wxT( "Add, erase or extract events manually with right mouse button (\"E\")" ), wxITEM_CHECK ); return cursorToolBar; } #if 0 #if defined(WITH_BIOSIG2) #define CREDIT_BIOSIG "Biosig import using libbiosig2 http://biosig.sf.net\n\n" #elif defined(WITH_BIOSIG) #define CREDIT_BIOSIG "Biosig import using libbiosig http://biosig.sf.net\n\n" #else #define CREDIT_BIOSIG "" #endif #endif void wxStfParentFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) { wxAboutDialogInfo info; info.SetName(wxT("Stimfit")); info.SetVersion(wxString(PACKAGE_VERSION, wxConvLocal)); info.SetWebSite(wxT("http://www.stimfit.org")); wxString about = wxString(wxT("Credits:\n\nOriginal idea (Stimfit for DOS):\n\ Peter Jonas, Physiology Department, University of Freiburg\n\n\ Fourier transform:\nFFTW, http://www.fftw.org\n\n\ Levenberg-Marquardt non-linear regression, version ") + wxString(wxT(LM_VERSION)) + wxT("\n\ Manolis Lourakis, http://www.ics.forth.gr/~lourakis/levmar/ \n\n")) + #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) wxString( wxT("BioSig import using libbiosig\n") ) + //+ wxString( wxT("version ") + wxT(BIOSIG_VERSION ) ) + wxString( wxT("http://biosig.sf.net\n\n") ) + #endif wxString(wxT("Documentation:\n\ Jose Guzman\n\n\ Event detection algorithms:\n\ Jonas, P., Major, G. & Sakmann B. (1993) J Physiol 472:615-63\n\ Clements, J. D. & Bekkers, J. M. (1997) Biophys J 73:220-229\n\ Pernía-Andrade, A.J., et al., (2012) Biophys J 103:1429-39.\n\n\ Thanks to Bill Anderson (www.winltp.com) for helpful suggestions")); info.SetDescription(about); info.SetCopyright(wxT("(C) 2001-2015 Christoph Schmidt-Hieber \n\ Christoph Schmidt-Hieber, University College London\n\ Published under the GNU general public license (http://www.gnu.org/licenses/gpl.html)")); wxAboutBox(info); } void wxStfParentFrame::OnHelp(wxCommandEvent& WXUNUSED(event) ) { wxLaunchDefaultBrowser( wxT("http://www.stimfit.org/doc/sphinx/index.html") ); } std::vector ParseVersionString( const wxString& VersionString ) { std::vector VersionInt(5); const char pt = '.'; // Major version: long major=0; wxString sMajor = VersionString.BeforeFirst(pt); if ( sMajor.length() == VersionString.length() ) { major = 0; } else { sMajor.ToLong( &major ); } VersionInt[0] = major; // Minor version: long minor=0; wxString sMinor1 = VersionString.AfterFirst(pt); if ( sMinor1.empty() ) { minor = 0; } else { wxString sMinor = sMinor1.BeforeFirst(pt); if ( sMinor1.length() == sMinor.length() ) { minor = 0; } else { sMinor.ToLong( &minor ); } } VersionInt[1] = minor; // Build version: long build=0; wxString sBuild = VersionString.AfterLast(pt); if ( sBuild.empty() ) { build = 0; } else { sBuild.ToLong( &build ); } VersionInt[2] = build; return VersionInt; } bool CompVersion( const std::vector& version ) { // Get current version: wxString currentString(PACKAGE_VERSION, wxConvLocal); std::vector current = ParseVersionString(currentString); if (version[0] > current[0]) { return true; } else { if (version[0] == current[0]) { if (version[1] > current[1]) { return true; } else { if (version[1] == current[1]) { if (version[2] > current[2]) { return true; } else { return false; } } else { // version[0] == current[0] && version[1] < current[1] return false; } } } else { // version[0] < current[0] return false; } } } void wxStfParentFrame::CheckUpdate( wxProgressDialog* progDlg ) const { #if defined (__MINGW32__) wxString address(wxT("/latest_mingw")); #elif defined (_WINDOWS) wxString address(wxT("/latest_windows")); #elif defined (__APPLE__) wxString address(wxT("/latest_mac")); #else wxString address(wxT("/latest_linux")); #endif wxHTTP http; http.SetHeader( wxT("Accept") , wxT("text/*") ); http.SetHeader( wxT("User-Agent"), wxT("Mozilla") ); http.SetTimeout( 1 ); // seconds // Note that Connect() wants a host address, not an URL. 80 is the server's port. wxString server( wxT("www.stimfit.org") ); if( http.Connect(server) ) { if(wxInputStream* in_stream = http.GetInputStream (address)) { wxString verS; int c_int = in_stream->GetC(); while ( c_int != wxEOF ) { if (progDlg != NULL) { progDlg->Pulse( wxT("Reading version information...") ); } verS << wxChar(c_int); c_int = in_stream->GetC(); } wxDELETE(in_stream); std::vector version = ParseVersionString( verS ); if ( CompVersion(version) ) { wxString msg; msg << wxT("A newer version of Stimfit (") << verS << wxT(") is available. ") << wxT("Would you like to download it now?"); wxMessageDialog newversion( NULL, msg, wxT("New version available"), wxYES_NO ); if ( newversion.ShowModal() == wxID_YES ) { wxLaunchDefaultBrowser( wxT("http://code.google.com/p/stimfit/downloads/list") ); } } else { if (progDlg != NULL) { wxMessageDialog newversion( NULL, wxT("You already have the newest version"), wxT("No new version available"), wxOK ); newversion.ShowModal(); } } } else { if (progDlg != NULL) { wxGetApp().ErrorMsg( wxT("Couldn't retrieve update information. Are you connected to the internet?") ); } } } else { if (progDlg != NULL) { wxGetApp().ErrorMsg( wxT("Couldn't connect to server. Are you connected to the internet?") ); } } } void wxStfParentFrame::OnCheckUpdate(wxCommandEvent& WXUNUSED(event) ) { wxProgressDialog progDlg( wxT("Checking for updates"), wxT("Connecting to server..."), 100, NULL, wxPD_SMOOTH | wxPD_AUTO_HIDE ); CheckUpdate( &progDlg ); } void wxStfParentFrame::OnConvert(wxCommandEvent& WXUNUSED(event) ) { int nfiles; // files to convert wxString src_ext; // extension of the source file wxString dest_ext; // extesion of the destiny file // "Convert files" Dialog (see wxStfConvertDlg in smalldlgs.cpp) wxStfConvertDlg myDlg(this); if(myDlg.ShowModal() == wxID_OK) { stfio::filetype ift = myDlg.GetSrcFileExt(); stfio::filetype eft = myDlg.GetDestFileExt(); src_ext = myDlg.GetSrcFilter(); // wxProgressDialog wxProgressDialog progDlg( wxT("CFS conversion utility"), wxT("Starting file conversion"), 100, NULL, wxPD_SMOOTH | wxPD_AUTO_HIDE | wxPD_APP_MODAL ); wxArrayString srcFilenames(myDlg.GetSrcFileNames()); nfiles = srcFilenames.size(); // number of files to convert wxString myDestDir = myDlg.GetDestDir(); for (std::size_t nFile=0; nFile ") << destFilename; progDlg.Update( (int)(((double)nFile/(double)srcFilenames.size())*100.0), progStr ); // Open source file and convert: Recording sourceFile; try { stf::wxProgressInfo progDlgIn("Reading file", "Opening file", 100); stfio::importFile(stf::wx2std(srcFilenames[nFile]), ift, sourceFile, wxGetApp().GetTxtImport(), progDlgIn); stf::wxProgressInfo progDlgOut("Writing file", "Opening file", 100); switch ( eft ) { #ifndef WITHOUT_ABF case stfio::atf: stfio::exportATFFile(stf::wx2std(destFilename), sourceFile); dest_ext = wxT("Axon textfile [*.atf]"); break; #endif case stfio::igor: stfio::exportIGORFile(stf::wx2std(destFilename), sourceFile, progDlgOut); dest_ext = wxT("Igor binary file [*.ibw]"); break; #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) case stfio::biosig: stfio::exportBiosigFile(stf::wx2std(destFilename), sourceFile, progDlgOut); dest_ext = wxT("Biosig/GDF [*.gdf]"); break; #endif default: wxString errorMsg(wxT("Unknown export file type\n")); wxGetApp().ErrorMsg(errorMsg); return; } } catch (const std::runtime_error& e) { wxString errorMsg(wxT("Error opening file\n")); errorMsg += wxT("Runtime Error\n"); errorMsg += wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg(errorMsg); return; } catch (const std::exception& e) { wxString errorMsg(wxT("Error opening file\n")); errorMsg += wxT("Exception\n"); errorMsg += wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg(errorMsg); return; } } // Show now a smal information dialog //std::count << srcFilter.c_str() << std::endl; wxString msg; msg = wxString::Format(wxT("%i"), nfiles); msg << src_ext; msg << wxT(" files \nwere converted to "); msg << dest_ext; wxMessageDialog Simple(this, msg); Simple.ShowModal(); } // end of wxStfConvertDlg } // Creates a graph. Called from view.cpp when a new drawing // view is created. wxStfGraph *wxStfParentFrame::CreateGraph(wxView *view, wxStfChildFrame *parent) { int width=800, height=600; parent->GetClientSize(&width, &height); // Non-retained graph wxStfGraph *graph = new wxStfGraph( view, parent, #ifndef __APPLE__ wxPoint(0, 0), #else wxDefaultPosition, #endif wxSize(width, height), wxFULL_REPAINT_ON_RESIZE | wxWANTS_CHARS ); return graph; } void wxStfParentFrame::OnPrint(wxCommandEvent& WXUNUSED(event)) { if (wxGetApp().GetActiveDoc()==NULL) return; wxPrintDialogData printDialogData(* m_printData); wxPrinter printer(& printDialogData); wxStfPreprintDlg myDlg(this); if (myDlg.ShowModal()!=wxID_OK) return; wxStfView* pView=wxGetApp().GetActiveView(); pView->GetGraph()->set_downsampling(myDlg.GetDownSampling()); pView->GetGraph()->set_noGimmicks(!myDlg.GetGimmicks()); wxStfPrintout printout(_T("Trace printout")); if (!printer.Print(this, &printout, true /*prompt*/)) { if (wxPrinter::GetLastError() == wxPRINTER_ERROR) wxMessageBox( _T("There was a problem printing.\nPerhaps your current printer is not set correctly?"), _T("Printing"), wxOK ); else wxMessageBox(_T("You canceled printing"), _T("Printing"), wxOK); } else { (*m_printData) = printer.GetPrintDialogData().GetPrintData(); } } void wxStfParentFrame::OnMpl(wxCommandEvent& WXUNUSED(event)) { if (wxGetApp().GetActiveDoc()==NULL) return; #ifdef WITH_PYTHON std::ostringstream mgr_name; mgr_name << "mpl" << GetMplFigNo(); wxWindow* pPython = MakePythonWindow("plotWindowMpl", mgr_name.str(), "Matplotlib", true, false, true, 800, 600).cppWindow; if ( pPython == 0 ) #endif wxGetApp().ErrorMsg(wxT("Can not create figure (python/matplotlib is not available)")); } void wxStfParentFrame::OnMplSpectrum(wxCommandEvent& WXUNUSED(event)) { if (wxGetApp().GetActiveDoc()==NULL) return; #ifdef WITH_PYTHON std::ostringstream mgr_name; mgr_name << "mpl" << GetMplFigNo(); wxWindow* pPython = MakePythonWindow("spectrumWindowMpl", mgr_name.str(), "Matplotlib", true, false, true, 800, 600).cppWindow; if ( pPython == 0 ) #endif wxGetApp().ErrorMsg(wxT("Can not create figure (python/matplotlib is not available)")); } void wxStfParentFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event)) { (*m_pageSetupData) = *m_printData; wxPageSetupDialog pageSetupDialog(this, m_pageSetupData.get()); pageSetupDialog.ShowModal(); (*m_printData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData(); (*m_pageSetupData) = pageSetupDialog.GetPageSetupDialogData(); } void wxStfParentFrame::OnToggleSelect(wxCommandEvent& WXUNUSED(event)) { wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pDoc!=NULL) { pDoc->ToggleSelect(); } } void wxStfParentFrame::OnToolFirst(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnFirst(); } } void wxStfParentFrame::OnToolNext(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnNext(); } } void wxStfParentFrame::OnToolPrevious(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnPrevious(); } } void wxStfParentFrame::OnToolLast(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnLast(); } } void wxStfParentFrame::OnToolXenl(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnXenllo(); } } void wxStfParentFrame::OnToolXshrink(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnXshrinklo(); } } void wxStfParentFrame::OnToolYenl(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnYenllo(); } } void wxStfParentFrame::OnToolYshrink(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnYshrinklo(); } } void wxStfParentFrame::OnToolUp(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnUp(); } } void wxStfParentFrame::OnToolDown(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnDown(); } } void wxStfParentFrame::OnToolFit(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->Fittowindow(true); } } void wxStfParentFrame::OnToolLeft(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnLeft(); } } void wxStfParentFrame::OnToolRight(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->OnRight(); } } void wxStfParentFrame::OnToolCh1(wxCommandEvent& WXUNUSED(event)) { // activate channel 1 if no channel is active: if (!m_scaleToolBar->GetToolToggled(ID_TOOL_CH1) && !m_scaleToolBar->GetToolToggled(ID_TOOL_CH2)) { m_scaleToolBar->ToggleTool(ID_TOOL_CH1,true); } m_scaleToolBar->Refresh(); } void wxStfParentFrame::OnToolCh2(wxCommandEvent& WXUNUSED(event)) { // activate channel 1 if no channel is active: if (!m_scaleToolBar->GetToolToggled(ID_TOOL_CH1) && !m_scaleToolBar->GetToolToggled(ID_TOOL_CH2)) { m_scaleToolBar->ToggleTool(ID_TOOL_CH1,true); } m_scaleToolBar->Refresh(); } void wxStfParentFrame::OnToolFitdecay(wxCommandEvent& event) { wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pDoc!=NULL) { pDoc->FitDecay(event); } } void wxStfParentFrame::SetSingleChannel(bool value) { if (!m_scaleToolBar) return; if (value) { if (!m_scaleToolBar->GetToolEnabled(ID_TOOL_CH1)) m_scaleToolBar->EnableTool(ID_TOOL_CH1,true); if (m_scaleToolBar->GetToolEnabled(ID_TOOL_CH2)) m_scaleToolBar->EnableTool(ID_TOOL_CH2,false); } else { if (!m_scaleToolBar->GetToolEnabled(ID_TOOL_CH1)) m_scaleToolBar->EnableTool(ID_TOOL_CH1,true); if (!m_scaleToolBar->GetToolEnabled(ID_TOOL_CH2)) m_scaleToolBar->EnableTool(ID_TOOL_CH2,true); } // Make sure at least one value is selected: if (!m_scaleToolBar->GetToolToggled(ID_TOOL_CH1) && (value || !m_scaleToolBar->GetToolToggled(ID_TOOL_CH2))) { m_scaleToolBar->ToggleTool(ID_TOOL_CH1, true); } m_scaleToolBar->Refresh(); } void wxStfParentFrame::OnToolSnapshotwmf(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->Snapshotwmf(); } } void wxStfParentFrame::OnToolMeasure(wxCommandEvent& WXUNUSED(event)) { SetMouseQual( stf::measure_cursor ); } void wxStfParentFrame::OnToolPeak(wxCommandEvent& WXUNUSED(event)) { SetMouseQual( stf::peak_cursor ); } void wxStfParentFrame::OnToolBase(wxCommandEvent& WXUNUSED(event)) { SetMouseQual( stf::base_cursor ); } void wxStfParentFrame::OnToolDecay(wxCommandEvent& WXUNUSED(event)) { SetMouseQual( stf::decay_cursor ); } #ifdef WITH_PSLOPE void wxStfParentFrame::OnToolPSlope(wxCommandEvent& WXUNUSED(event)) { SetMouseQual( stf::pslope_cursor ); } #endif void wxStfParentFrame::OnToolLatency(wxCommandEvent& WXUNUSED(event)) { SetMouseQual( stf::latency_cursor ); } void wxStfParentFrame::OnToolZoom(wxCommandEvent& WXUNUSED(event)) { SetMouseQual( stf::zoom_cursor ); } void wxStfParentFrame::OnToolEvent(wxCommandEvent& WXUNUSED(event)) { SetMouseQual( stf::event_cursor ); } void wxStfParentFrame::OnCh2zoom(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->Ch2zoom(); } } void wxStfParentFrame::OnCh2base(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->Ch2base(); } } void wxStfParentFrame::OnCh2pos(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->Ch2pos(); } } void wxStfParentFrame::OnCh2basezoom(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { pView->GetGraph()->Ch2basezoom(); } } void wxStfParentFrame::OnViewResults(wxCommandEvent& WXUNUSED(event)) { wxStfChildFrame* pChild=(wxStfChildFrame*)GetActiveChild(); if (pChild!=NULL) { pChild->GetCopyGrid()->ViewResults(); } } void wxStfParentFrame::OnScale(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); if (pView!=NULL) { if (GetActiveChild()->GetMenuBar() && GetActiveChild()->GetMenuBar()->GetMenu(2)->IsChecked(ID_SCALE)) { wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("ViewScaleBars"),1); wxGetApp().set_isBars(true); } else { wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("ViewScaleBars"),0); wxGetApp().set_isBars(false); } if (pView->GetGraph() != NULL) pView->GetGraph()->Refresh(); } } void wxStfParentFrame::OnAverage(wxCommandEvent& WXUNUSED(event)) { wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pDoc!=NULL) { pDoc->CreateAverage(false,false); } } void wxStfParentFrame::OnAlignedAverage(wxCommandEvent& WXUNUSED(event)) { wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pDoc!=NULL) { pDoc->CreateAverage(false,true); } } #if 0 void wxStfParentFrame::OnUserdef(wxCommandEvent& event) { wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pDoc!=NULL) { pDoc->Userdef(event.GetId()-ID_USERDEF1); } } #endif void wxStfParentFrame::OnSaveperspective(wxCommandEvent& WXUNUSED(event)) { wxStfChildFrame* pChild=(wxStfChildFrame*)GetActiveChild(); if (pChild!=NULL) { pChild->Saveperspective(); } } void wxStfParentFrame::OnLoadperspective(wxCommandEvent& WXUNUSED(event)) { wxStfChildFrame* pChild=(wxStfChildFrame*)GetActiveChild(); if (pChild!=NULL) { pChild->Loadperspective(); } } void wxStfParentFrame::OnRestoreperspective(wxCommandEvent& WXUNUSED(event)) { wxStfChildFrame* pChild=(wxStfChildFrame*)GetActiveChild(); if (pChild!=NULL) { pChild->Restoreperspective(); } } #ifdef WITH_PYTHON void wxStfParentFrame::OnViewshell(wxCommandEvent& WXUNUSED(event)) { // Save the current visibility state: bool old_state = m_mgr.GetPane(wxT("pythonShell")).IsShown(); // Toggle python shell visibility: m_mgr.GetPane(wxT("pythonShell")).Show( !old_state ); wxGetApp().wxWriteProfileInt( wxT("Settings"),wxT("ViewShell"), int(!old_state) ); m_mgr.Update(); } #endif void wxStfParentFrame::OnLStartMaxslope(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL && pDoc!=NULL) { // get previous mode: // bool prevMode=pDoc->GetLatencyStartMode()==stfio::riseMode; // toggle on if it wasn't the previous mode: // if (!prevMode) { pDoc->SetLatencyStartMode(stf::riseMode); wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("LatencyStartMode"), pDoc->GetLatencyStartMode()); if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } void wxStfParentFrame::OnLStartHalfrise(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL && pDoc!=NULL) { pDoc->SetLatencyStartMode(stf::halfMode); wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyStartMode"), pDoc->GetLatencyStartMode() ); if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } void wxStfParentFrame::OnLStartPeak(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL && pDoc!=NULL) { pDoc->SetLatencyStartMode(stf::peakMode); wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyStartMode"), pDoc->GetLatencyStartMode() ); if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } void wxStfParentFrame::OnLStartManual(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL && pDoc!=NULL) { // Always keep manual mode as a default, even if attempted to uncheck: pDoc->SetLatencyStartMode(stf::manualMode); wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyStartMode"), pDoc->GetLatencyStartMode() ); if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } void wxStfParentFrame::OnLEndFoot(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL && pDoc!=NULL) { pDoc->SetLatencyEndMode(stf::footMode); wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyEndMode"), pDoc->GetLatencyEndMode() ); if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } void wxStfParentFrame::OnLEndMaxslope(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL && pDoc!=NULL) { pDoc->SetLatencyEndMode(stf::riseMode); wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyEndMode"), pDoc->GetLatencyEndMode() ); if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } void wxStfParentFrame::OnLEndHalfrise(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL && pDoc!=NULL) { pDoc->SetLatencyEndMode(stf::halfMode); wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyEndMode"), pDoc->GetLatencyEndMode() ); if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } void wxStfParentFrame::OnLEndPeak(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL && pDoc!=NULL) { pDoc->SetLatencyEndMode(stf::peakMode); wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyEndMode"), pDoc->GetLatencyEndMode() ); if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } void wxStfParentFrame::OnLEndManual(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL && pDoc!=NULL) { pDoc->SetLatencyEndMode(stf::manualMode); wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyEndMode"), pDoc->GetLatencyEndMode() ); if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } # if 0 void wxStfParentFrame::OnLWindow(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=wxGetApp().GetActiveView(); wxStfDoc* pDoc=wxGetApp().GetActiveDoc(); if (pView!=NULL) { // Select if (GetActiveChild()->GetMenuBar() && GetActiveChild()->GetMenuBar()->GetMenu(1)->IsChecked(ID_LATENCYWINDOW)) { wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyWindowMode"), stf::windowMode ); pDoc->SetLatencyWindowMode(stf::windowMode); } else { wxGetApp().wxWriteProfileInt( wxT("Settings"), wxT("LatencyWindowMode"), stf::defaultMode ); pDoc->SetLatencyWindowMode(stf::defaultMode); } if (pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } } #endif stf::cursor_type wxStfParentFrame::GetMouseQual() const { if (m_cursorToolBar->GetToolToggled(ID_TOOL_MEASURE)) return stf::measure_cursor; if (m_cursorToolBar->GetToolToggled(ID_TOOL_PEAK)) return stf::peak_cursor; if (m_cursorToolBar->GetToolToggled(ID_TOOL_BASE)) return stf::base_cursor; if (m_cursorToolBar->GetToolToggled(ID_TOOL_DECAY)) return stf::decay_cursor; if (m_cursorToolBar->GetToolToggled(ID_TOOL_LATENCY)) return stf::latency_cursor; if (m_cursorToolBar->GetToolToggled(ID_TOOL_ZOOM)) return stf::zoom_cursor; if (m_cursorToolBar->GetToolToggled(ID_TOOL_EVENT)) return stf::event_cursor; #ifdef WITH_PSLOPE if (m_cursorToolBar->GetToolToggled(ID_TOOL_PSLOPE)) return stf::pslope_cursor; #endif return stf::undefined_cursor; } void wxStfParentFrame::SetMouseQual(stf::cursor_type value) { if (m_cursorToolBar == NULL) return; // Need to set everything to false explicitly first: m_cursorToolBar->ToggleTool(ID_TOOL_MEASURE,false); m_cursorToolBar->ToggleTool(ID_TOOL_PEAK,false); m_cursorToolBar->ToggleTool(ID_TOOL_BASE,false); m_cursorToolBar->ToggleTool(ID_TOOL_DECAY,false); m_cursorToolBar->ToggleTool(ID_TOOL_LATENCY,false); m_cursorToolBar->ToggleTool(ID_TOOL_ZOOM,false); m_cursorToolBar->ToggleTool(ID_TOOL_EVENT,false); #ifdef WITH_PSLOPE m_cursorToolBar->ToggleTool(ID_TOOL_PSLOPE,false); #endif // Then set the state of the selected button: if (value==stf::measure_cursor) m_cursorToolBar->ToggleTool(ID_TOOL_MEASURE,true); if (value==stf::peak_cursor) m_cursorToolBar->ToggleTool(ID_TOOL_PEAK,true); if (value==stf::base_cursor) m_cursorToolBar->ToggleTool(ID_TOOL_BASE,true); if (value==stf::decay_cursor) m_cursorToolBar->ToggleTool(ID_TOOL_DECAY,true); if (value==stf::latency_cursor) m_cursorToolBar->ToggleTool(ID_TOOL_LATENCY,true); #ifdef WITH_PSLOPE if (value==stf::pslope_cursor) m_cursorToolBar->ToggleTool(ID_TOOL_PSLOPE,true); #endif if (value==stf::zoom_cursor) m_cursorToolBar->ToggleTool(ID_TOOL_ZOOM,true); if (value==stf::event_cursor) m_cursorToolBar->ToggleTool(ID_TOOL_EVENT,true); m_cursorToolBar->Refresh(); } void wxStfParentFrame::SetSelectedButton(bool selected) { if (m_cursorToolBar==NULL) return; m_cursorToolBar->ToggleTool(ID_TOOL_SELECT, selected); m_cursorToolBar->Refresh(); } stf::zoom_channels wxStfParentFrame::GetZoomQual() const { if (m_scaleToolBar->GetToolToggled(ID_TOOL_CH1)) { if (m_scaleToolBar->GetToolToggled(ID_TOOL_CH2)) { return stf::zoomboth; } else { return stf::zoomch1; } } return stf::zoomch2; } void wxStfParentFrame::SetZoomQual(stf::zoom_channels value) { if (m_scaleToolBar==NULL) return; if (value==stf::zoomch1) { m_scaleToolBar->ToggleTool(ID_TOOL_CH1,true); m_scaleToolBar->ToggleTool(ID_TOOL_CH2,false); } if (value==stf::zoomch2) { m_scaleToolBar->ToggleTool(ID_TOOL_CH1,false); m_scaleToolBar->ToggleTool(ID_TOOL_CH2,true); } if (value==stf::zoomboth) { m_scaleToolBar->ToggleTool(ID_TOOL_CH1,true); m_scaleToolBar->ToggleTool(ID_TOOL_CH2,true); } m_scaleToolBar->Refresh(); } stimfit-0.16.0/src/stimfit/gui/printout.h0000775000175000017500000000512713277303516015306 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file printout.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfPrintout. Derived from wxPrintout to handle printing of traces. */ #ifndef _PRINTOUT_H #define _PRINTOUT_H /*! \addtogroup wxstf * @{ */ //! Handles printing of traces. class wxStfPrintout : public wxPrintout { public: //! Constructor /*! \param title Printout title */ wxStfPrintout(const wxChar *title = _T("Printout")); //! Called by the framework when a page should be printed. /*! \param page The page number to be printed * \return false will cancel the print job. */ bool OnPrintPage(int page); //! Checks whether a page exists. /*! \param page The page number to be checked. * \return True if \e page exists. */ bool HasPage(int page); //! Called by the framework at the start of document printing. /*! \param startPage Page from which to start printing. * \param endPage Page at which to end printing. * \return false cancels the print job. */ bool OnBeginDocument(int startPage, int endPage); //! Retrieve information about the pages that will be printed. /*! \param minPage On return, a pointer to the minimal page number allowed. * \param maxPage On return, a pointer to the maximal page number allowed. * \param selPageFrom On return, a pointer to the minimal selected page number allowed. * \param selPageTo On return, a pointer to the maximal selected page number allowed. */ void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo); //! Prints the first (and only) page. void DrawPageOne(); private: void PrintHeader(wxDC* pDC,double scale); bool store_noGimmicks; wxStfDoc* Doc() const {return wxGetApp().GetActiveDoc();} }; /*@}*/ #endif stimfit-0.16.0/src/stimfit/gui/zoom.cpp0000775000175000017500000000041513277303516014734 00000000000000#include "./zoom.h" YZoom YZoom::operator*( double factor ) { return YZoom( long(startPosY*(double)factor), yZoom*factor, isLogScaleY ); } XZoom XZoom::operator*( double factor ) { return XZoom( long(startPosX*(double)factor), xZoom*factor, isLogScaleX ); } stimfit-0.16.0/src/stimfit/gui/app.cpp0000775000175000017500000015457113567226230014544 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // app.cpp // The application, derived from wxApp // 2007-12-27, Christoph Schmidt-Hieber, University of Freiburg #include // For compilers that support precompilation, includes "wx/wx.h". #include #include #include #include #include #include #include #include #include #include #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include #endif #if !wxUSE_DOC_VIEW_ARCHITECTURE #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h! #endif #if !wxUSE_MDI_ARCHITECTURE #error You must set wxUSE_MDI_ARCHITECTURE to 1 in setup.h! #endif #include "../../../stfconf.h" #include "./app.h" #include "./doc.h" #include "./view.h" #include "./parentframe.h" #include "./childframe.h" #include "./graph.h" #include "./dlgs/cursorsdlg.h" #include "./dlgs/smalldlgs.h" #include "./../../libstfnum/funclib.h" #include "./../../libstfnum/fit.h" #if defined(__WXGTK__) || defined(__WXMAC__) #if !defined(__MINGW32__) #include "./../../libstfio/abf/axon/Common/axodefn.h" #include "./../../libstfio/abf/axon/AxAbfFio32/abffiles.h" #endif #endif extern wxStfApp& wxGetApp(); wxStfApp& wxGetApp() { return *static_cast(wxApp::GetInstance()); } wxStfParentFrame *frame = (wxStfParentFrame *) NULL; BEGIN_EVENT_TABLE( wxStfApp, wxApp ) EVT_KEY_DOWN( wxStfApp::OnKeyDown ) EVT_MENU( ID_CURSORS, wxStfApp::OnCursorSettings ) EVT_MENU( ID_NEWFROMSELECTED, wxStfApp::OnNewfromselected ) EVT_MENU( ID_NEWFROMALL, wxStfApp::OnNewfromall ) EVT_MENU( ID_APPLYTOALL, wxStfApp::OnApplytoall ) #ifdef WITH_PYTHON EVT_MENU( ID_IMPORTPYTHON, wxStfApp::OnPythonImport ) EVT_MENU_RANGE(ID_USERDEF, ID_USERDEF+32, wxStfApp::OnUserdef) #endif END_EVENT_TABLE() wxStfApp::wxStfApp(void) : directTxtImport(false), isBars(true), txtImport(), funcLib(), #ifdef WITH_PYTHON extensionLib(), #endif CursorsDialog(NULL), storedLinFunc( stfnum::initLinFunc() ), /*m_file_menu(0),*/ m_fileToLoad(wxEmptyString), mrActiveDoc(0) {} void wxStfApp::OnInitCmdLine(wxCmdLineParser& parser) { wxApp::OnInitCmdLine(parser); parser.AddOption(wxT("d"), wxT("dir"), wxT("Working directory to change to"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL ); parser.AddParam(wxT("File to open"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL ); } bool wxStfApp::OnCmdLineParsed(wxCmdLineParser& parser) { // Check if we should change the working directory: wxString new_cwd( wxT("\0") ); if ( parser.Found( wxT("dir"), &new_cwd ) ) { // Check whether the directory exists: if ( !wxDirExists( new_cwd ) ) { wxString msg; msg << wxT("New working directory ") << new_cwd << wxT(" doesn't exist."); ErrorMsg( msg ); return false; } // Change to the new wd: if ( !wxSetWorkingDirectory( new_cwd ) ) { wxString msg; msg << wxT("Couldn't change working directory to ") << new_cwd; ErrorMsg( msg ); return false; } } // Get file to load if ( parser.GetParamCount() > 0 ) { m_fileToLoad = parser.GetParam(); } return wxApp::OnCmdLineParsed(parser); } bool wxStfApp::OnInit(void) { if (!wxApp::OnInit()) { std::cerr << "Could not start application" << std::endl; return false; } #ifdef WITH_PYTHON if ( !Init_wxPython() ) { // don't start the app if we can't initialize wxPython. wxString msg; msg << wxT("Could not start wxPython"); ErrorMsg( msg ); return false; } // Load Python extensions before creation of wxMenuBar ( see later CreateUnifiedMenuBar() ) #if PY_MAJOR_VERSION < 3 extensionLib = LoadExtensions(); #ifdef _STFDEBUG std::cout << (int) GetExtensionLib().size() << " Python extension/s loaded"<< std::endl; #endif #endif #endif //WITH_PTYHON // Config: config.reset(new wxFileConfig(wxT("Stimfit"))); //// Create a document manager wxDocManager* docManager = new wxDocManager; //// Create a template relating drawing documents to their views #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) m_biosigTemplate=new wxDocTemplate( docManager, wxT("All files"), wxT("*.*"), wxT(""), wxT(""), wxT("Biosig Document"), wxT("Biosig View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); #endif #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) m_biosigTemplate=new wxDocTemplate( docManager, wxT("Biosig files"), wxT("*.dat;*.cfs;*.gdf;*.ibw;*.wcp"), wxT(""), wxT(""), wxT("Biosig Document"), wxT("Biosig View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); #endif m_cfsTemplate=new wxDocTemplate( docManager, wxT("CED filing system"), wxT("*.dat;*.cfs"), wxT(""), wxT("dat;cfs"), wxT("CFS Document"), wxT("CFS View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); m_hdf5Template=new wxDocTemplate( docManager, wxT("hdf5 file"), wxT("*.h5"), wxT(""), wxT("h5"), wxT("HDF5 Document"), wxT("HDF5 View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); m_abfTemplate=new wxDocTemplate( docManager, wxT("Axon binary file"), wxT("*.abf"), wxT(""), wxT("abf"), wxT("ABF Document"), wxT("ABF View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); #if defined(__WXGTK__) || defined(__WXMAC__) #if !defined(__MINGW32__) #if !defined(WITHOUT_ABF) ABF_Initialize(); #endif #endif #endif m_atfTemplate=new wxDocTemplate( docManager, wxT("Axon text file"), wxT("*.atf"), wxT(""), wxT("atf"), wxT("ATF Document"), wxT("ATF View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); m_axgTemplate=new wxDocTemplate( docManager, wxT("Axograph binary file"), wxT("*.axgd;*.axgx"), wxT(""), wxT("axgd;axgx"), wxT("AXG Document"), wxT("AXG View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); m_hekaTemplate=new wxDocTemplate( docManager, wxT("HEKA file"), wxT("*.dat"), wxT(""), wxT("dat"), wxT("HEKA Document"), wxT("HEKA View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); m_intanTemplate=new wxDocTemplate( docManager, wxT("Intan CLAMP file"), wxT("*.clp"), wxT(""), wxT("clp"), wxT("Intan CLAMP Document"), wxT("Intan View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); m_tdmsTemplate=new wxDocTemplate( docManager, wxT("Mantis TDMS file"), wxT("*.tdms"), wxT(""), wxT("tdms"), wxT("Mantis TDMS Document"), wxT("TDMS View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); #if 0 m_sonTemplate=new wxDocTemplate( docManager, wxT("CED Spike 2 (SON) file"), wxT("*.smr"), wxT(""), wxT(""), wxT("SON Document"), wxT("SON View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); #endif m_txtTemplate=new wxDocTemplate( docManager, wxT("General text file import"), wxT("*.*"), wxT(""), wxT(""), wxT("Text Document"), wxT("Text View"), CLASSINFO(wxStfDoc), CLASSINFO(wxStfView) ); // read last directory from config: wxString lastDir = wxGetProfileString( wxT("Settings"), wxT("Last directory"), wxT("") ); if (lastDir == wxT("") || !wxFileName::DirExists( lastDir )) { lastDir = wxFileName::GetCwd(); } docManager->SetLastDirectory( lastDir ); //// Create the main frame window frame = new wxStfParentFrame(docManager, (wxFrame *)NULL, wxT("Stimfit"), wxDefaultPosition, #ifndef __WXMAC__ wxSize(1024, 768), #else wxSize(640, 480), #endif wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE | wxMAXIMIZE); #if 0 frame->SetIcon( wxICON(sample) ); #endif // frame->SetIcon(wxIcon(wxT("doc.xbm"))); #ifndef __WXGTK__ //// Make a menubar wxMenu* m_file_menu = new wxMenu; // wxMenu *edit_menu = (wxMenu *) NULL; m_file_menu->Append(wxID_OPEN); m_file_menu->AppendSeparator(); m_file_menu->Append(ID_CONVERT, wxT("Convert file series...")); #ifdef WITH_PYTHON m_file_menu->AppendSeparator(); m_file_menu->Append( ID_IMPORTPYTHON, wxT("&Import Python module...\tCtrl+I"), wxT("Import or reload user-defined Python modules") ); #endif // WITH_PYTHON m_file_menu->AppendSeparator(); m_file_menu->Append(wxID_EXIT); // A nice touch: a history of files visited. Use this menu. GetDocManager()->FileHistoryLoad( *config ); GetDocManager()->FileHistoryUseMenu(m_file_menu); #if (wxCHECK_VERSION(2, 9, 0)) GetDocManager()->FileHistoryAddFilesToMenu(m_file_menu); #else GetDocManager()->FileHistoryAddFilesToMenu(); #endif wxMenu *help_menu = new wxMenu; help_menu->Append(wxID_HELP); help_menu->Append(ID_UPDATE, wxT("&Check for updates")); help_menu->Append(wxID_ABOUT); wxMenu *m_view_menu = new wxMenu; #ifdef WITH_PYTHON m_file_menu->AppendSeparator(); m_view_menu->Append(ID_VIEW_SHELL, wxT("&Toggle Python shell"), wxT("Shows or hides the Python shell")); #endif // WITH_PYTHON wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(m_file_menu, wxT("&File")); /* if (edit_menu) menu_bar->Append(edit_menu, wxT("&Edit")); */ menu_bar->Append(m_view_menu, wxT("&View")); menu_bar->Append(help_menu, wxT("&Help")); #ifdef __WXMAC__ // wxApp::SetExitOnFrameDelete(false); wxMenuBar::MacSetCommonMenuBar(menu_bar); #endif #else // __WXGTK__ wxMenuBar* menu_bar = CreateUnifiedMenuBar(); #endif //__WXGTK__ frame->SetMenuBar(menu_bar); frame->Centre(wxBOTH); /* pStatusBar = new wxStatusBar(frame); frame->SetStatusBar(pStatusBar); */ #if 1 //ndef __WXMAC__ frame->Show(true); #endif //ndef __WXMAC__ // check for updates in background: #ifndef __WXMAC__ frame->CheckUpdate(); #endif // load user-defined plugins: // pluginLib = stf::GetPluginLib(); //#ifdef WITH_PYTHON // extensionLib = LoadExtensions(); // std::cout << "DEBUG: wxStfApp extensionLib size is " << GetExtensionLib().size() << std::endl; //#endif // load fit function library: funcLib = stfnum::GetFuncLib(); SetTopWindow(frame); if (!m_fileToLoad.empty()) { wxDocTemplate* templ=GetDocManager()->FindTemplateForPath(m_fileToLoad); wxStfDoc* NewDoc=(wxStfDoc*)templ->CreateDocument(m_fileToLoad,wxDOC_NEW); NewDoc->SetDocumentTemplate(templ); if (!NewDoc->OnOpenDocument(m_fileToLoad)) { ErrorMsg(wxT("Couldn't open file, aborting file import")); GetDocManager()->CloseDocument(NewDoc); return false; } } return true; } int wxStfApp::OnExit() { #if wxUSE_CONFIG GetDocManager()->FileHistorySave(*config); #endif // wxUSE_CONFIG delete GetDocManager(); #ifdef WITH_PYTHON Exit_wxPython(); #endif return wxApp::OnExit(); } // "Fake" registry void wxStfApp::wxWriteProfileInt(const wxString& main, const wxString& sub, int value) const { // create a wxConfig-compatible path: wxString path=wxT("/")+main+wxT("/")+sub; if (!config->Write(path,(long)value)) { ErrorMsg(wxT("Couldn't write application settings")); return; } config->Flush(); } int wxStfApp::wxGetProfileInt(const wxString& main,const wxString& sub, int default_) const { wxString path=wxT("/")+main+wxT("/")+sub; return config->Read(path,default_); } void wxStfApp::wxWriteProfileString( const wxString& main, const wxString& sub, const wxString& value ) const { // create a wxConfig-compatible path: wxString path=wxT("/")+main+wxT("/")+sub; if (!config->Write(path,value)) { ErrorMsg(wxT("Couldn't write application settings")); return; } config->Flush(); } wxString wxStfApp::wxGetProfileString( const wxString& main, const wxString& sub, const wxString& default_) const { wxString path=wxT("/")+main+wxT("/")+sub; return config->Read(path,default_); } void wxStfApp::OnPeakcalcexecMsg(wxStfDoc* actDoc) { if (actDoc==0) { actDoc = GetActiveDoc(); if (!actDoc) return; } if (!actDoc->IsInitialized()) { ErrorMsg(wxT("Uninitialized file in wxStfApp::OnPeakcalcexecMsg()")); return; } #ifdef __WXMAC__ wxStfView* actView = (wxStfView*)actDoc->GetFirstView(); #else wxStfView* actView = GetActiveView(); #endif if (actView!=NULL) { wxStfGraph* pGraph = actView->GetGraph(); if (pGraph != NULL) pGraph->Refresh(); else return; } if (CursorsDialog != NULL && CursorsDialog->IsShown() && actView!=NULL && actDoc!=NULL && actDoc->IsInitialized()) { CursorsDialog->SetActiveDoc(actDoc); switch (CursorsDialog->CurrentCursor()) { case stf::measure_cursor: actDoc->SetMeasCursor(CursorsDialog->GetCursorM());// * GetDocument()->GetSR())); wxWriteProfileInt(wxT("Settings"), wxT("MeasureCursor"), CursorsDialog->GetCursorM() ); actDoc->SetMeasRuler( CursorsDialog->GetRuler() ); wxWriteProfileInt(wxT("Settings"), wxT("ShowRuler"), CursorsDialog->GetRuler() ); break; //Get limits for peak calculation from the dialog box: case stf::peak_cursor: actDoc->SetPeakBeg(CursorsDialog->GetCursor1P());// * GetDocument()->GetSR())); actDoc->SetPeakEnd(CursorsDialog->GetCursor2P());// * GetDocument()->GetSR())); actDoc->CheckBoundaries(); break; case stf::base_cursor: wxWriteProfileInt(wxT("Settings"), wxT("BaselineMethod"), CursorsDialog->GetBaselineMethod()); actDoc->SetBaseBeg(CursorsDialog->GetCursor1B()); actDoc->SetBaseEnd(CursorsDialog->GetCursor2B()); actDoc->SetBaselineMethod(CursorsDialog->GetBaselineMethod()); break; case stf::decay_cursor: actDoc->SetFitBeg(CursorsDialog->GetCursor1D()); actDoc->SetFitEnd(CursorsDialog->GetCursor2D()); break; case stf::latency_cursor: // Use peak cursors for latency? // actDoc->SetLatencyWindowMode(CursorsDialog->UsePeak4Latency() ); // wxWriteProfileInt(wxT("Settings"), wxT("LatencyWindowMode"), CursorsDialog->UsePeak4Latency() ); // Latency start mode actDoc->SetLatencyBeg(CursorsDialog->GetCursor1L()); // set latency mode in wxStfDoc actDoc->SetLatencyStartMode(CursorsDialog->GetLatencyStartMode() ); // write latency start mode in Stimfit Profile wxWriteProfileInt(wxT("Settings"), wxT("LatencyStartMode"), CursorsDialog->GetLatencyStartMode() ); if (CursorsDialog->GetLatencyStartMode() == stf::manualMode) wxWriteProfileInt(wxT("Settings"), wxT("LatencyStartCursor"), CursorsDialog->GetCursor1L() ); // Latency end mode actDoc->SetLatencyEnd(CursorsDialog->GetCursor2L()); actDoc->SetLatencyEndMode(CursorsDialog->GetLatencyEndMode() ); wxWriteProfileInt(wxT("Settings"), wxT("LatencyEndMode"), CursorsDialog->GetLatencyEndMode() ); if (CursorsDialog->GetLatencyEndMode() == stf::manualMode) wxWriteProfileInt(wxT("Settings"), wxT("LatencyEndCursor"), CursorsDialog->GetCursor2L() ); break; #ifdef WITH_PSLOPE case stf::pslope_cursor: // first PSlope cursor actDoc->SetPSlopeBegMode( CursorsDialog->GetPSlopeBegMode() ); wxWriteProfileInt(wxT("Settings"), wxT("PSlopeStartMode"), CursorsDialog->GetPSlopeBegMode() ); if (actDoc->GetPSlopeBegMode() == stf::psBeg_manualMode) actDoc->SetPSlopeBeg( CursorsDialog->GetCursor1PS() ); //wxWriteProfileInt(wxT("Settings"), wxT("PSlopeStartCursor"), CursorsDialog->GetCursor1PS() ); // second PSlope cursor actDoc->SetPSlopeEndMode( CursorsDialog->GetPSlopeEndMode() ); if (actDoc->GetPSlopeEndMode() == stf::psEnd_manualMode) actDoc->SetPSlopeEnd( CursorsDialog->GetCursor2PS() ); // we take data from CursorsDialog only if we need the DeltaT //else if (actDoc->GetPSlopeEndMode() == stf::psEnd_DeltaTMode){ actDoc->SetDeltaT(CursorsDialog->GetDeltaT()); break; #endif case stf::undefined_cursor: ErrorMsg(wxT("Undefined cursor in wxStfApp::OnPeakcalcexecMsg()")); return; default: break; } wxWriteProfileInt(wxT("Settings"), wxT("PeakAtEnd"), CursorsDialog->GetPeakAtEnd() ); //Update edit peak limits in the peak calculation dialog box if (CursorsDialog->GetPeakAtEnd()) { //If 'Upper limit at end of trace' is selected in the dialog box //Set upper limit to end of trace actDoc->SetPeakEnd((int)actDoc->cursec().size()-1); try { CursorsDialog->UpdateCursors(); } catch (const std::runtime_error& e) { ExceptMsg(wxString(e.what(), wxConvLocal)); return; } actDoc->SetPeakAtEnd(true); } else { actDoc->SetPeakAtEnd(false); } // Get number of peak points from the dialog box... actDoc->SetPM(CursorsDialog->GetPeakPoints()); wxWriteProfileInt(wxT("Settings"),wxT("PeakMean"),(int)actDoc->GetPM()); // Get direction from the dialog box actDoc->SetDirection(CursorsDialog->GetDirection()); wxWriteProfileInt(wxT("Settings"),wxT("Direction"), CursorsDialog->GetDirection()); // Get reference for AP kinetics from the dialog box actDoc->SetFromBase(CursorsDialog->GetFromBase()); wxWriteProfileInt(wxT("Settings"),wxT("FromBase"), CursorsDialog->GetFromBase()); // Get factor for rise time calculation actDoc->SetRTFactor(CursorsDialog->GetRTFactor()); wxWriteProfileInt(wxT("Settings"),wxT("RTFactor"), CursorsDialog->GetRTFactor()); // Get slope for threshold: actDoc->SetSlopeForThreshold( CursorsDialog->GetSlope() ); wxString wxsSlope; wxsSlope << CursorsDialog->GetSlope(); wxWriteProfileString(wxT("Settings"), wxT("Slope"), wxsSlope); wxWriteProfileInt(wxT("Settings"), wxT("StartFitAtPeak"), CursorsDialog->GetStartFitAtPeak() ); //Update start fit at peak if ( CursorsDialog->GetStartFitAtPeak() ) { actDoc->SetFitBeg( actDoc->GetMaxT() ); actDoc->SetStartFitAtPeak(true); try { CursorsDialog->UpdateCursors(); } catch (const std::runtime_error& e) { ExceptMsg(wxString( e.what(), wxConvLocal )); return; } } else { actDoc->SetStartFitAtPeak(false); } } // Calculate peak, base, Lo/Hi rise time, half duration, // ratio of rise/slope, maximum slope and geometrical slope (PSlope). try { if (actDoc != NULL) { actDoc->Measure( ); } } catch (const std::out_of_range& e) { ExceptMsg(wxString( e.what(), wxConvLocal )); } /* // Set fit start cursor to new peak if necessary. //std::cout << CursorsDialog->GetPeakAtEnd() << std::endl; //wxWriteProfileInt(wxT("Settings"), wxT("StartFitAtPeak"), CursorsDialog->GetStartFitAtPeak() ); if (actDoc != NULL && CursorsDialog != NULL && CursorsDialog->GetStartFitAtPeak()) //if ( CursorsDialog->GetStartFitAtPeak() ) { //actDoc->SetFitBeg(actDoc->GetMaxT()); actDoc->SetStartFitAtPeak( true ); //try { // CursorsDialog->UpdateCursors(); //} //catch (const std::runtime_error& e) { // ExceptMsg(wxString( e.what(), wxConvLocal )); // return; //} } else { actDoc->SetStartFitAtPeak( true ); } */ // Updates strings in the result box if (actView != NULL) { wxStfChildFrame* pChild=(wxStfChildFrame*)actView->GetFrame(); if (pChild != NULL) pChild->UpdateResults(); wxStfGraph* pGraph = actView->GetGraph(); if (pGraph != NULL) pGraph->SetFocus(); } } wxMenuBar *wxStfApp::CreateUnifiedMenuBar(wxStfDoc* doc) { //// Make a menubar wxMenu *file_menu = new wxMenu; file_menu->Append(wxID_OPEN); file_menu->Append(wxID_CLOSE); // file_menu->Append(wxID_SAVE, wxT("&Save")); file_menu->Append(wxID_SAVEAS); //#ifdef _WINDOWS file_menu->AppendSeparator(); file_menu->Append(ID_CONVERT, wxT("&Convert file series...")); //#endif file_menu->AppendSeparator(); file_menu->Append(ID_FILEINFO, wxT("File information...")); file_menu->AppendSeparator(); file_menu->Append(ID_MPL, wxT("Create &figure...")); file_menu->Append(ID_PRINT_PRINT, wxT("&Print...")); file_menu->Append(ID_PRINT_PAGE_SETUP, wxT("Print &Setup...")); #ifdef WITH_PYTHON file_menu->AppendSeparator(); file_menu->Append( ID_IMPORTPYTHON, wxT("&Import Python module...\tCtrl+I"), wxT("Import or reload user-defined Python modules") ); #endif // WITH_PYTHON file_menu->AppendSeparator(); file_menu->Append(wxID_EXIT); #if !defined __WXGTK__ && (wxCHECK_VERSION(2, 9, 0)) ((wxStfDoc*)doc)->SetFileMenu( file_menu ); #else GetDocManager()->FileHistoryLoad( *config ); #endif GetDocManager()->FileHistoryUseMenu(file_menu); #if (wxCHECK_VERSION(2, 9, 0)) GetDocManager()->FileHistoryAddFilesToMenu(file_menu); #else GetDocManager()->FileHistoryAddFilesToMenu(); #endif wxMenu* m_edit_menu=new wxMenu; m_edit_menu->Append( ID_CURSORS, wxT("&Cursor settings...\tCtrl+R"), wxT("Set cursor position, direction, etc.") ); m_edit_menu->AppendSeparator(); m_edit_menu->Append( ID_MYSELECTALL, wxT("&Select all traces\tCtrl+A"), wxT("Select all traces in this file") ); m_edit_menu->Append( ID_SELECTSOME, wxT("S&elect some traces..."), wxT("Select every n-th trace in this file") ); m_edit_menu->Append( ID_SELECT_AND_ADD, wxT("Se&lect and add traces of type ..."), wxT("Traces of a certain type are added to the select") ); m_edit_menu->Append( ID_UNSELECTALL, wxT("&Unselect all traces\tCtrl+U"), wxT("Unselect all traces in this file") ); m_edit_menu->Append( ID_UNSELECTSOME, wxT("U&nselect some traces"), wxT("Unselect some traces in this file") ); m_edit_menu->Append( ID_SELECT_AND_REMOVE, wxT("Unse&lect traces of type ..."), wxT("Traces of a certain type are removed from the selection") ); wxMenu *editSub=new wxMenu; editSub->Append( ID_NEWFROMSELECTEDTHIS, wxT("&selected traces from this file"), wxT("Create a new window showing all selected traces from this file") ); editSub->Append( ID_NEWFROMSELECTED, wxT("&selected traces from all files"), wxT("Create a new window showing all selected traces from all files") ); editSub->Append(ID_NEWFROMALL, wxT("&all traces from all files"), wxT("Create a new window showing all traces from all files") ); m_edit_menu->AppendSeparator(); m_edit_menu->AppendSubMenu(editSub,wxT("New window with...")); m_edit_menu->Append( ID_CONCATENATE_MULTICHANNEL, wxT("&Concatenate selected sweeps (multiple channels)"), wxT("Create one large sweep by merging selected sweeps in this file") ); wxMenu* m_view_menu = new wxMenu; m_view_menu->Append( ID_VIEW_RESULTS, wxT("&Results..."), wxT("Select analysis results to be shown in the results table") ); m_view_menu->Append( ID_APPLYTOALL, wxT("&Apply scaling to all windows"), wxT("Apply this trace's scaling to all other windows") ); m_view_menu->AppendCheckItem( ID_SCALE, wxT("&View scale bars"), wxT("If checked, use scale bars rather than coordinates") ); m_view_menu->AppendSeparator(); m_view_menu->Append(ID_SAVEPERSPECTIVE,wxT("&Save window positions")); m_view_menu->Append(ID_LOADPERSPECTIVE,wxT("&Load window positions")); m_view_menu->Append(ID_RESTOREPERSPECTIVE,wxT("&Restore default window positions")); #ifdef WITH_PYTHON m_view_menu->AppendSeparator(); m_view_menu->Append(ID_VIEW_SHELL, wxT("&Toggle Python shell"), wxT("Shows or hides the Python shell")); #endif // WITH_PYTHON wxMenu* ch2Sub=new wxMenu; ch2Sub->Append(ID_CH2BASE, wxT("Match &baseline")); ch2Sub->Append(ID_CH2POS, wxT("Match &abs. position")); ch2Sub->Append(ID_CH2ZOOM, wxT("Match &y-scale")); ch2Sub->Append(ID_CH2BASEZOOM, wxT("Match baseline a&nd y-scale")); m_view_menu->AppendSeparator(); m_view_menu->AppendSubMenu(ch2Sub, wxT("&Channel 2 scaling")); m_view_menu->Append(ID_SWAPCHANNELS, wxT("&Swap channels")); wxMenu *analysis_menu = new wxMenu; wxMenu *fitSub = new wxMenu; fitSub->Append( ID_FIT, wxT("&Nonlinear regression...\tCtrl+N"), wxT("Fit a function to this trace between fit cursors") ); fitSub->Append( ID_LFIT, wxT("&Linear fit..."), wxT("Fit a linear function to this trace between fit cursors") ); analysis_menu->AppendSubMenu(fitSub, wxT("&Fit")); wxMenu *transformSub = new wxMenu; transformSub->Append( ID_LOG, wxT("&Logarithmic (base e)..."), wxT("Transform selected traces logarithmically") ); analysis_menu->AppendSubMenu(transformSub, wxT("&Transform")); analysis_menu->Append( ID_MULTIPLY, wxT("&Multiply..."), wxT("Multiply selected traces") ); analysis_menu->Append( ID_INTEGRATE, wxT("&Integrate"), wxT("Integrate this trace between fit cursors") ); analysis_menu->Append( ID_DIFFERENTIATE, wxT("&Differentiate"), wxT("Differentiate selected traces") ); analysis_menu->Append( ID_SUBTRACTBASE, wxT("&Subtract baseline"), wxT("Subtract baseline from selected traces") ); analysis_menu->Append( ID_FILTER, wxT("Fi<er..."), wxT("Filter selected traces") ); analysis_menu->Append( ID_MPL_SPECTRUM, wxT("&Power spectrum..."), wxT("Compute an estimate of the power spectrum of the selected traces") ); analysis_menu->Append( ID_POVERN, wxT("P over &N correction..."), wxT("Apply P over N correction to all traces of this file") ); wxMenu* eventPlotSub = new wxMenu; eventPlotSub->Append(ID_PLOTCRITERION, wxT("&Detection criterion...")); eventPlotSub->Append(ID_PLOTCORRELATION, wxT("&Correlation coefficient...")); eventPlotSub->Append(ID_PLOTDECONVOLUTION, wxT("&Deconvolution...")); wxMenu* eventSub = new wxMenu; eventSub->AppendSubMenu(eventPlotSub,wxT("Plot")); eventSub->Append(ID_EXTRACT,wxT("&Template matching...")); eventSub->Append(ID_THRESHOLD,wxT("Threshold &crossing...")); analysis_menu->AppendSubMenu(eventSub,wxT("Event detection")); analysis_menu->Append( ID_BATCH, wxT("&Batch analysis..."), wxT("Analyze selected traces and show results in a table") ); #if 0 wxMenu* userdefSub=new wxMenu; for (std::size_t n=0;nAppend( ID_USERDEF1+(int)n, GetPluginLib()[n].menuEntry ); } analysis_menu->AppendSubMenu(userdefSub,wxT("User-defined functions")); #endif #ifdef WITH_PYTHON wxMenu *extensions_menu = new wxMenu; for (std::size_t n=0;nAppend(ID_USERDEF+(int)n, stf::std2wx(GetExtensionLib()[n].menuEntry)); } #endif wxMenu *help_menu = new wxMenu; help_menu->Append(wxID_HELP, wxT("Online &help\tF1")); help_menu->Append(wxID_ABOUT, wxT("&About")); help_menu->Append(ID_UPDATE, wxT("&Check for updates")); wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(m_edit_menu, wxT("&Edit")); menu_bar->Append(m_view_menu, wxT("&View")); menu_bar->Append(analysis_menu, wxT("&Analysis")); #ifdef WITH_PYTHON menu_bar->Append(extensions_menu, wxT("E&xtensions")); #endif menu_bar->Append(help_menu, wxT("&Help")); return menu_bar; } /* * Centralised code for creating a document frame. * Called from view.cpp when a view is created. */ wxStfChildFrame *wxStfApp::CreateChildFrame(wxDocument *doc, wxView *view) { //// Make a child frame #ifdef __WXMAC__ int xpos = (GetDocCount()-1) * 16 + 64; int ypos = (GetDocCount()-1) * 16 + 80; #endif wxStfChildFrame *subframe = new wxStfChildFrame( doc, view, GetMainFrame(), wxID_ANY, doc->GetTitle(), #ifdef __WXMAC__ wxPoint(xpos,ypos), wxSize(800,600), #else wxDefaultPosition, wxDefaultSize, #endif wxDEFAULT_FRAME_STYLE | // wxNO_FULL_REPAINT_ON_RESIZE | wxWANTS_CHARS | wxMAXIMIZE ); #ifdef __WXMSW__ subframe->SetIcon(wxString(wxT("chart"))); #endif #ifdef __X__ // subframe->SetIcon(wxIcon(wxT("doc.xbm"))); #endif #ifndef __WXGTK__ wxMenuBar* menu_bar = CreateUnifiedMenuBar((wxStfDoc*)doc); //// Associate the menu bar with the frame subframe->SetMenuBar(menu_bar); #endif // __WXGTK__ return subframe; } wxStfDoc* wxStfApp::NewChild(const Recording& NewData, const wxStfDoc* Sender, const wxString& title) { wxStfDoc* NewDoc=(wxStfDoc*)m_cfsTemplate->CreateDocument(title,wxDOC_NEW); NewDoc->SetDocumentName(title); NewDoc->SetTitle(title); NewDoc->SetDocumentTemplate(m_cfsTemplate); if (!NewDoc->OnNewDocument()) return NULL; try { NewDoc->SetData(NewData, Sender, title); } catch (const std::out_of_range& e) { wxString msg; msg << wxT("Error while creating new document:\n") << stf::std2wx(e.what()); ExceptMsg(msg); // Close file: NewDoc->OnCloseDocument(); return NULL; } catch (const std::runtime_error& e) { wxString msg; msg << wxT("Runtime error while creating new document:\n") << wxString( e.what(), wxConvLocal ); ExceptMsg( msg ); // Close file: if (!NewDoc->OnCloseDocument()) ErrorMsg(wxT("Could not close file; please close manually")); return NULL; } return NewDoc; } wxStfView* wxStfApp::GetActiveView() const { if ( GetDocManager() == 0) { ErrorMsg( wxT("Couldn't access the document manager")); return NULL; } wxStfView* pView = (wxStfView*)GetDocManager()->GetCurrentView(); if (pView == NULL) { if (mrActiveDoc != NULL) { return (wxStfView*)mrActiveDoc->GetFirstView(); } } return pView; } wxStfDoc* wxStfApp::GetActiveDoc() const { if ( GetDocManager() == 0) { ErrorMsg( wxT("Couldn't access the document manager")); return NULL; } if (GetDocManager()->GetDocuments().empty()) return NULL; wxStfDoc* pDoc = (wxStfDoc*)GetDocManager()->GetCurrentDocument(); if (pDoc == NULL) { return mrActiveDoc; } return pDoc; } void wxStfApp::OnKeyDown( wxKeyEvent& event ) { event.Skip(); wxStfDoc* actDoc = GetActiveDoc(); if (!actDoc) return; // wxStfView* actView = (wxStfView*)actDoc->GetFirstView(); wxStfView* actView = GetActiveView(); if (actView) { wxStfGraph* pGraph = actView->GetGraph(); wxStfChildFrame* pChild=(wxStfChildFrame*)actView->GetFrame(); if (pGraph && pChild && pChild->IsActive()) pGraph->OnKeyDown(event); } } void wxStfApp::OnCursorSettings( wxCommandEvent& WXUNUSED(event) ) { wxStfDoc* actDoc=GetActiveDoc(); if (CursorsDialog==NULL && actDoc!=NULL) { CursorsDialog=new wxStfCursorsDlg(frame, actDoc); CursorsDialog->Show(); CursorsDialog->SetActiveDoc(actDoc); //set CEdit controls to given values try { CursorsDialog->UpdateCursors(); } catch (const std::runtime_error& e) { ExceptMsg(wxString( e.what(), wxConvLocal )); return; } //set CButton to given direction CursorsDialog->SetDirection(actDoc->GetDirection()); CursorsDialog->SetPeakPoints((int)actDoc->GetPM()); CursorsDialog->SetFromBase(actDoc->GetFromBase()); CursorsDialog->SetSlope( actDoc->GetSlopeForThreshold() ); return; } if(CursorsDialog!=NULL && !CursorsDialog->IsShown() && actDoc!=NULL) { CursorsDialog->Show(); CursorsDialog->SetActiveDoc(actDoc); //set CEdit controls to given values try { CursorsDialog->UpdateCursors(); } catch (const std::runtime_error& e) { ExceptMsg(wxString( e.what(), wxConvLocal )); return; } //set CButton to given direction CursorsDialog->SetDirection(actDoc->GetDirection()); CursorsDialog->SetPeakPoints((int)actDoc->GetPM()); CursorsDialog->SetFromBase(actDoc->GetFromBase()); CursorsDialog->SetSlope( actDoc->GetSlopeForThreshold() ); } } void wxStfApp::OnNewfromselected( wxCommandEvent& WXUNUSED(event) ) { // number of selected traces across all open documents: std::size_t nwxT=0; // Search the document's template list for open documents: wxList docList=GetDocManager()->GetDocuments(); if (docList.IsEmpty()) { ErrorMsg(wxT("No traces were found")); return; } // Since random access is expensive, go through the list node by node: // Get first node: wxObjectList::compatibility_iterator curNode=docList.GetFirst(); std::size_t n_channels=((wxStfDoc*)curNode->GetData())->size(); while (curNode) { wxStfDoc* pDoc=(wxStfDoc*)curNode->GetData(); if (pDoc->size()!=n_channels) { ErrorMsg(wxT("Can't combine files: different numbers of channels")); return; } try { nwxT+=pDoc->GetSelectedSections().size(); } catch (const std::out_of_range& e) { ExceptMsg(wxString( e.what(), wxConvLocal )); return; } curNode=curNode->GetNext(); } if (nwxT==0) { ErrorMsg(wxT("No selected traces were found")); return; } Recording Selected(n_channels,nwxT); // Do the same iteration once again filling the channel with data: curNode=docList.GetFirst(); wxStfDoc* pDoc=NULL; nwxT=0; std::vector > channel_names(n_channels); while (curNode) { pDoc=(wxStfDoc*)curNode->GetData(); if (pDoc->GetSelectedSections().size() > 0) { for (std::size_t n_c=0;n_csize();++n_c) { channel_names[n_c].push_back(pDoc->get()[n_c].GetChannelName()); for (std::size_t n=0; nGetSelectedSections().size(); ++n) { try { Selected[n_c].InsertSection( pDoc->get()[n_c][pDoc->GetSelectedSections()[n]], n+nwxT ); } catch (const std::out_of_range& e) { ExceptMsg(wxString( e.what(), wxConvLocal )); return; } } } } nwxT+=pDoc->GetSelectedSections().size(); curNode=curNode->GetNext(); } // Set channel names: for (std::size_t n_c=0;n_c=0 && !used;--n_used) { // can't use size_t here because // n_used might be negative when checking loop condition used = ( channel_names[n_c][n_n].compare( channel_names[n_c][n_used] ) == 0 ); } if (!used) { channel_name << wxT(", ") << channel_names[n_c][n_n]; } } Selected.get()[n_c].SetChannelName(channel_name.str()); } // Copy some variables from the last document's recording // to the new recording: Selected.CopyAttributes(*pDoc); // Create a new document in a new child window, using the settings // of the last open document: NewChild(Selected,pDoc,wxT("New from selected traces")); } void wxStfApp::OnNewfromall( wxCommandEvent& WXUNUSED(event) ) { // number of traces in all open documents: std::size_t nwxT=0; // minimal number of channels: // Search the document's template list for open documents: wxList docList=GetDocManager()->GetDocuments(); if (docList.IsEmpty()) { ErrorMsg(wxT("No traces were found")); return; } // Since random access is expensive, go through the list node by node: // Get first node: wxObjectList::compatibility_iterator curNode=docList.GetFirst(); std::size_t n_channels=((wxStfDoc*)curNode->GetData())->size(); while (curNode) { wxStfDoc* pDoc=(wxStfDoc*)curNode->GetData(); if (pDoc->size()!=n_channels) { ErrorMsg(wxT("Can't combine files: different numbers of channels")); return; } try { nwxT+=pDoc->get().at(pDoc->GetCurChIndex()).size(); } catch (const std::out_of_range& e) { ExceptMsg(wxString( e.what(), wxConvLocal )); return; } curNode=curNode->GetNext(); } Recording Selected(n_channels,nwxT); //Do the same iteration once again filling the channel with data: curNode=docList.GetFirst(); nwxT=0; wxStfDoc* pDoc=NULL; std::vector > channel_names(n_channels); while (curNode) { pDoc=(wxStfDoc*)curNode->GetData(); if (pDoc->get()[pDoc->GetCurChIndex()].size() > 0) { for (std::size_t n_c=0;n_cget()[n_c].GetChannelName()); for (std::size_t n=0; nget()[n_c].size(); ++n) { try { Selected[n_c].InsertSection(pDoc->get()[n_c][n],n+nwxT); } catch (const std::out_of_range& e) { ExceptMsg(wxString( e.what(), wxConvLocal )); return; } } } } nwxT+=pDoc->get()[pDoc->GetCurChIndex()].size(); curNode=curNode->GetNext(); } // Set channel names: for (std::size_t n_c=0;n_c=0 && !used;--n_used) { // can't use size_t here because // n_used might be negative when checking loop condition used = ( channel_names[n_c][n_n].compare( channel_names[n_c][n_used] ) == 0 ); } if (!used) { channel_name << wxT(", ") << channel_names[n_c][n_n]; } } Selected.get()[n_c].SetChannelName(channel_name.str()); } // Copy some variables from the last document's recording // to the new recording: Selected.CopyAttributes(*pDoc); // Create a new document in a new child window, using the settings // of the last open document: NewChild(Selected,pDoc,wxT("New from all traces")); } void wxStfApp::OnApplytoall( wxCommandEvent& WXUNUSED(event) ) { // toggle through open documents to find out // which one is active: // Search the document's template list for open documents: wxList docList=GetDocManager()->GetDocuments(); if (docList.IsEmpty()) { ErrorMsg(wxT("No traces were found")); return; } wxStfDoc* pDoc=GetActiveDoc(); wxStfView* pView=GetActiveView(); if (pDoc==NULL || pView==NULL) { ErrorMsg(wxT("Couldn't find an active window")); return; } std::size_t llbToApply=pDoc->GetBaseBeg(); std::size_t ulbToApply=pDoc->GetBaseEnd(); std::size_t llpToApply=pDoc->GetPeakBeg(); std::size_t ulpToApply=pDoc->GetPeakEnd(); std::size_t lldToApply=pDoc->GetFitBeg(); std::size_t uldToApply=pDoc->GetFitEnd(); double latencyStartCursorToApply=pDoc->GetLatencyBeg(); double latencyEndCursorToApply=pDoc->GetLatencyEnd(); // Since random access is expensive, go through the list node by node: // Get first node: wxObjectList::compatibility_iterator curNode=docList.GetFirst(); while (curNode) { wxStfDoc* OpenDoc=(wxStfDoc*)curNode->GetData(); if (OpenDoc==NULL) return; wxStfView* curView = (wxStfView*)OpenDoc->GetFirstView(); //(GetActiveView()); if (curView!=pView && curView!=NULL) { OpenDoc->GetXZoomW() = pDoc->GetXZoom(); for ( std::size_t n_c=0; n_c < OpenDoc->size(); ++n_c ) { if ( n_c < pDoc->size() ) { OpenDoc->GetYZoomW(n_c) = pDoc->GetYZoom(n_c); } } OpenDoc->SetBaseBeg((int)llbToApply); OpenDoc->SetBaseEnd((int)ulbToApply); OpenDoc->SetPeakBeg((int)llpToApply); OpenDoc->SetPeakEnd((int)ulpToApply); OpenDoc->SetFitBeg((int)lldToApply); OpenDoc->SetFitEnd((int)uldToApply); OpenDoc->SetLatencyBeg(latencyStartCursorToApply); OpenDoc->SetLatencyEnd(latencyEndCursorToApply); wxStfChildFrame* pChild=(wxStfChildFrame*)curView->GetFrame(); pChild->UpdateResults(); if (curView->GetGraph() != NULL) curView->GetGraph()->Refresh(); } curNode=curNode->GetNext(); } } bool wxStfApp::OpenFileSeries(const wxArrayString& fNameArray) { int nFiles=(int)fNameArray.GetCount(); if (nFiles==0) return false; bool singleWindow=false; if (nFiles!=1) { // Ask whether to put files into a single window: singleWindow=(wxMessageDialog( frame, wxT("Put files into a single window?"), wxT("File series import"), wxYES_NO ).ShowModal() == wxID_YES); } wxProgressDialog progDlg( wxT("Importing file series"), wxT("Starting file import"), 100, frame, wxPD_SMOOTH | wxPD_AUTO_HIDE ); int n_opened=0; Recording seriesRec; while (n_opened!=nFiles) { wxString progStr; progStr << wxT("Reading file #") << n_opened + 1 << wxT(" of ") << nFiles; progDlg.Update( (int)((double)n_opened/(double)nFiles*100.0), progStr ); if (!singleWindow) { wxDocTemplate* templ=GetDocManager()->FindTemplateForPath(fNameArray[n_opened]); wxStfDoc* NewDoc=(wxStfDoc*)templ->CreateDocument(fNameArray[n_opened],wxDOC_NEW); NewDoc->SetDocumentTemplate(templ); if (!NewDoc->OnOpenDocument(fNameArray[n_opened++])) { ErrorMsg(wxT("Couldn't open file, aborting file import")); GetDocManager()->CloseDocument(NewDoc); return false; } } else { // Add to recording first: #ifndef TEST_MINIMAL // Find a template: wxDocTemplate* templ=GetDocManager()->FindTemplateForPath(fNameArray[n_opened]); // Use this template only for type recognition: wxString filter(templ->GetFileFilter()); stfio::filetype type = stfio::findType(stf::wx2std(templ->GetFileFilter())); #else stfio::filetype type = stfio::none; #endif #if 0 // TODO: re-implement ascii if (type==stfio::ascii) { if (!get_directTxtImport()) { wxStfTextImportDlg ImportDlg(NULL, stf::CreatePreview(fNameArray[n_opened]), 1, true); if (ImportDlg.ShowModal()!=wxID_OK) { return false; } // store settings in application: set_txtImportSettings(ImportDlg.GetTxtImport()); set_directTxtImport(ImportDlg.ApplyToAll()); } } #endif // add this file to the series recording: Recording singleRec; try { stf::wxProgressInfo progDlg("Reading file", "Opening file", 100); stfio::importFile(stf::wx2std(fNameArray[n_opened++]),type,singleRec,txtImport, progDlg); if (n_opened==1) { seriesRec.resize(singleRec.size()); // reserve memory to avoid allocations: for (std::size_t n_c=0;n_cFindTemplateForPath( filename ); if ( templ == NULL ) { ErrorMsg(wxT("Couldn't open file, aborting file import")); return false; } wxStfDoc* NewDoc = (wxStfDoc*)templ->CreateDocument( filename, wxDOC_NEW ); if ( NewDoc == NULL ) { ErrorMsg(wxT("Couldn't open file, aborting file import")); return false; } NewDoc->SetDocumentTemplate(templ); if (!NewDoc->OnOpenPyDocument(filename)) { ErrorMsg(wxT("Couldn't open file, aborting file import")); GetDocManager()->CloseDocument(NewDoc); return false; } return true; } #endif //WITH_PYTHON void wxStfApp::CleanupDocument(wxStfDoc* pDoc) { // count open docs: if (GetDocManager() && GetDocManager()->GetDocuments().GetCount()==1) { // Clean up if this was the last document: if (CursorsDialog!=NULL) { CursorsDialog->Destroy(); CursorsDialog=NULL; } } // Update active document: /* activeDoc.remove(pDoc); */ // Remove menu from file history menu list: // GetDocManager()->FileHistoryUseMenu(m_file_menu); // GetDocManager()->FileHistoryAddFilesToMenu(); } std::vector wxStfApp::GetSectionsWithFits() const { // Search the document's template list for open documents: wxList docList=GetDocManager()->GetDocuments(); if (docList.IsEmpty()) { return std::vector(0); } std::vector sectionList; // Since random access is expensive, go through the list node by node: // Get first node: wxObjectList::compatibility_iterator curNode=docList.GetFirst(); while (curNode) { wxStfDoc* pDoc=(wxStfDoc*)curNode->GetData(); try { for (std::size_t n_sec=0; n_sec < pDoc->get().at(pDoc->GetCurChIndex()).size(); ++n_sec) { stf::SectionAttributes sec_attr = pDoc->GetSectionAttributes(pDoc->GetCurChIndex(), n_sec); if (sec_attr.isFitted) { sectionList.push_back(stf::SectionPointer(&pDoc->get()[pDoc->GetCurChIndex()][n_sec], sec_attr) ); } } } catch (const std::out_of_range& e) { ExceptMsg( wxString( e.what(), wxConvLocal ) ); return std::vector(0); } curNode=curNode->GetNext(); } return sectionList; } wxString wxStfApp::GetVersionString() const { wxString verString; verString << wxT("Stimfit ") << wxString(PACKAGE_VERSION, wxConvLocal) #ifdef _STFDEBUG << wxT(", debug build, "); #else << wxT(", release build, "); #endif verString << wxT(__DATE__) << wxT(", ") << wxT(__TIME__); return verString; } StfDll wxStfParentFrame *GetMainFrame(void) { return frame; } // LocalWords: wxStfView #ifdef WITH_PYTHON void wxStfApp::OnPythonImport(wxCommandEvent& WXUNUSED(event)) { // show a file selection dialog menu. wxString pyFilter; // file filter only show *.py pyFilter = wxT("Python file (*.py)|*.py"); wxFileDialog LoadModuleDialog (frame, wxT("Import/reload Python module"), wxT(""), wxT(""), pyFilter, wxFD_OPEN | wxFD_PREVIEW ); if (LoadModuleDialog.ShowModal() == wxID_OK) { wxString modulelocation = LoadModuleDialog.GetPath(); ImportPython(modulelocation); // see in /src/app/unopt.cpp L196 } else { return; } } #endif // WITH_PYTHON stimfit-0.16.0/src/stimfit/gui/app.h0000775000175000017500000004270113567226230014200 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file app.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfApp. */ #ifndef _APP_H #define _APP_H /*! \defgroup wxstf Stimfit classes and functions derived from wxWidgets * @{ */ //! Event ids enum { ID_TOOL_FIRST, // = wxID_HIGHEST+1, resulted in wrong events being fired ID_TOOL_NEXT, ID_TOOL_PREVIOUS, ID_TOOL_LAST, ID_TOOL_XENL, ID_TOOL_XSHRINK, ID_TOOL_YENL, ID_TOOL_YSHRINK, ID_TOOL_UP, ID_TOOL_DOWN, ID_TOOL_FIT, ID_TOOL_LEFT, ID_TOOL_RIGHT, ID_TOOL_SELECT, ID_TOOL_REMOVE, ID_TOOL_MEASURE, ID_TOOL_PEAK, ID_TOOL_BASE, ID_TOOL_DECAY, ID_TOOL_LATENCY, #ifdef WITH_PSLOPE ID_TOOL_PSLOPE, #endif ID_TOOL_ZOOM, ID_TOOL_EVENT, ID_TOOL_CH1, ID_TOOL_CH2, ID_TOOL_SNAPSHOT, ID_TOOL_SNAPSHOT_WMF, ID_TOOL_FITDECAY, #ifdef WITH_PYTHON ID_IMPORTPYTHON, #endif ID_VIEW_RESULTS, ID_VIEW_MEASURE, ID_VIEW_BASELINE, ID_VIEW_BASESD, ID_VIEW_THRESHOLD, ID_VIEW_PEAKZERO, ID_VIEW_PEAKBASE, ID_VIEW_PEAKTHRESHOLD, ID_VIEW_RTLOHI, ID_VIEW_INNERRISETIME, ID_VIEW_OUTERRISETIME, ID_VIEW_T50, ID_VIEW_RD, ID_VIEW_SLOPERISE, ID_VIEW_SLOPEDECAY, ID_VIEW_LATENCY, #ifdef WITH_PSLOPE ID_VIEW_PSLOPE, #endif ID_VIEW_CURSORS, ID_VIEW_SHELL, ID_FILEINFO, ID_EXPORTIMAGE, ID_EXPORTPS, ID_EXPORTLATEX, ID_EXPORTSVG, ID_TRACES, ID_PLOTSELECTED, ID_SHOWSECOND, ID_CURSORS, ID_AVERAGE, ID_ALIGNEDAVERAGE, ID_FIT, ID_LFIT, ID_LOG, ID_VIEWTABLE, ID_BATCH, ID_INTEGRATE, ID_DIFFERENTIATE, ID_CH2BASE, ID_CH2POS, ID_CH2ZOOM, ID_CH2BASEZOOM, ID_SWAPCHANNELS, ID_SCALE, ID_ZOOMHV, ID_ZOOMH, ID_ZOOMV, ID_EVENTADD, ID_EVENTEXTRACT, ID_APPLYTOALL, ID_UPDATE, ID_CONVERT, #if 0 ID_LATENCYSTART_MAXSLOPE, ID_LATENCYSTART_HALFRISE, ID_LATENCYSTART_PEAK, ID_LATENCYSTART_MANUAL, ID_LATENCYEND_FOOT, ID_LATENCYEND_MAXSLOPE, ID_LATENCYEND_HALFRISE, ID_LATENCYEND_PEAK, ID_LATENCYEND_MANUAL, ID_LATENCYWINDOW, #endif ID_PRINT_PRINT, ID_MPL, ID_MPL_SPECTRUM, ID_PRINT_PAGE_SETUP, ID_PRINT_PREVIEW, ID_COPYINTABLE, ID_MULTIPLY, ID_SELECTSOME, ID_UNSELECTSOME, ID_MYSELECTALL, ID_UNSELECTALL, ID_SELECT_AND_ADD, ID_SELECT_AND_REMOVE, ID_NEWFROMSELECTED, ID_NEWFROMSELECTEDTHIS, ID_NEWFROMALL, ID_CONCATENATE_MULTICHANNEL, ID_SUBTRACTBASE, ID_FILTER, ID_POVERN, ID_PLOTCRITERION, ID_PLOTCORRELATION, ID_PLOTDECONVOLUTION, ID_EXTRACT, ID_THRESHOLD, ID_LOADPERSPECTIVE, ID_SAVEPERSPECTIVE, ID_RESTOREPERSPECTIVE, ID_STFCHECKBOX, ID_EVENT_ADDEVENT, ID_EVENT_EXTRACT, ID_EVENT_ERASE, ID_COMBOTRACES, ID_SPINCTRLTRACES, ID_ZERO_INDEX, ID_COMBOACTCHANNEL, ID_COMBOINACTCHANNEL, #ifdef WITH_PYTHON ID_USERDEF, // this should be the last ID event #endif }; #include #include #include #include #include #include #include "./../stf.h" #include "./../../libstfnum/stfnum.h" #ifdef WITH_PYTHON #ifdef _POSIX_C_SOURCE #define _POSIX_C_SOURCE_WAS_DEF #undef _POSIX_C_SOURCE #endif #ifdef _XOPEN_SOURCE #define _XOPEN_SOURCE_WAS_DEF #undef _XOPEN_SOURCE #endif #include #ifdef _POSIX_C_SOURCE_WAS_DEF #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE #endif #endif #ifdef _XOPEN_SOURCE_WAS_DEF #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE #endif #endif #if defined(__WXMAC__) || defined(__WXGTK__) #pragma GCC diagnostic ignored "-Wwrite-strings" #endif #ifdef WITH_PYTHON #if PY_MAJOR_VERSION >= 3 #include #include #else #include #endif #endif // revert to previous behaviour #if defined(__WXMAC__) || defined(__WXGTK__) #pragma GCC diagnostic warning "-Wwrite-strings" #endif #endif // WITH_PYTHON #if (__cplusplus < 201103) #include #endif class wxDocManager; class wxStfDoc; class wxStfView; class wxStfCursorsDlg; class wxStfParentFrame; class wxStfChildFrame; class Section; //! The application, derived from wxApp /*! This class is used to set and get application-wide properties, * implement the windowing system message or event loop, * initiate application processing via OnInit, and * allow default processing of events not handled by other objects in the application. */ class StfDll wxStfApp: public wxApp { public: //! Constructor wxStfApp(); //! Initialise the application /*! Initialises the document manager and the file-independent menu items, * loads the user-defined extension library and the least-squares function library, * parses the command line and attempts to open a file if one was given * at program startup by either double-clicking it or as a command-line * argument. * \return true upon successful initialisation, false otherwise. */ virtual bool OnInit(); //! Exit the application /*! Does nothing but calling the base class's wxApp::OnExit(). * \return The return value of wxApp::OnExit(). */ virtual int OnExit(); //! Creates a new child frame /*! This is called from view.cpp whenever a child frame is created. If you * want to pop up a new frame showing a new document, use NewChild() instead; this * function will then be called by the newly created view. * \param doc A pointer to the document that the new child frame should contain. * \param view A pointer to the view corresponding to the document. * \return A pointer to the newly created child frame. */ wxStfChildFrame *CreateChildFrame(wxDocument *doc, wxView *view); //! Retrieves the currently active document. /*! \return A pointer to the currently active document. */ wxStfDoc* GetActiveDoc() const; //! Retrieves the currently active view. /*! \return A pointer to the currently active view. */ wxStfView* GetActiveView() const; //! Displays a message box when an error has occured. /*! You can use this function from almost anywhere using * wxGetApp().ErrorMsg( wxT( "Error abc: xyz" ) ); * \param msg The message string to be shown. */ void ErrorMsg(const wxString& msg) const { wxMessageBox(msg,wxT("An error has occured"),wxOK | wxICON_EXCLAMATION,NULL); } //! Displays a message box when an exception has occured. /*! You can use this function from almost anywhere using * wxGetApp().ExceptMsg( wxT( "Exception description xyz" ) ); * \param msg The message string to be shown. */ void ExceptMsg(const wxString& msg) const { wxMessageBox(msg,wxT("An exception was caught"),wxOK | wxICON_HAND,NULL); } //! Displays a message box with information. /*! You can use this function from almost anywhere using * wxGetApp().InfoMsg( wxT( "Info xyz" ) ); * \param msg The message string to be shown. */ void InfoMsg(const wxString& msg) const { wxMessageBox(msg,wxT("Information"), wxOK | wxICON_INFORMATION, NULL); } //! Indicates whether text files should be imported directly without showing an import settings dialog. /*! \return true if text files should be imported directly, false otherwise. */ bool get_directTxtImport() const { return directTxtImport; } //! Determines whether text files should be imported directly without showing an import filter settings dialog. /*! \param directTxtImport_ Set to true if text files should be imported directly, false otherwise. */ void set_directTxtImport(bool directTxtImport_) { directTxtImport=directTxtImport_; } //! Retrieves the text import filter settings. /*! \return A struct with the current text import filter settings. */ const stfio::txtImportSettings& GetTxtImport() const { return txtImport; } //! Sets the text import filter settings. /*! \param txtImport_ A struct with the new text import filter settings. */ void set_txtImportSettings(const stfio::txtImportSettings& txtImport_) { txtImport=txtImport_; } //! Retrieves the functions that are available for least-squares minimisation. /*! \return A vector containing the available functions. */ const std::vector& GetFuncLib() const { return funcLib; } //! Retrieves a pointer to a function for least-squares minimisation. /*! \return A vector containing the available functions. */ stfnum::storedFunc* GetFuncLibPtr(std::size_t at) { return &funcLib.at(at); } //! Retrieves a pointer to a function for least-squares minimisation. /*! \return A vector containing the available functions. */ stfnum::storedFunc* GetLinFuncPtr( ) { return &storedLinFunc; } #ifdef WITH_PYTHON //! Retrieves the user-defined extension functions. /*! \return A vector containing the user-defined functions. */ const std::vector< stf::Extension >& GetExtensionLib() const { return extensionLib; } #endif //! Retrieves the cursor settings dialog. /*! \return A pointer to the cursor settings dialog. */ wxStfCursorsDlg* GetCursorsDialog() const { return CursorsDialog; } //! Retrieves all sections with fits /*! \return A vector containing pointers to all sections in which fits have been performed */ std::vector GetSectionsWithFits() const; //! Writes an integer value to the configuration. /*! \param main The main path within the configuration. * \param sub The sub-path within the configuration. * \param value The integer to write to the configuration. */ void wxWriteProfileInt(const wxString& main,const wxString& sub, int value) const; //! Retrieves an integer value from the configuration. /*! \param main The main path within the configuration. * \param sub The sub-path within the configuration. * \param default_ The default integer to return if the configuration entry can't be read. * \return The integer that is stored in /main/sub, or default_ if the entry couldn't * be read. */ int wxGetProfileInt(const wxString& main,const wxString& sub, int default_) const; //! Writes a string to the configuration. /*! \param main The main path within the configuration. * \param sub The sub-path within the configuration. * \param value The string to write to the configuration. */ void wxWriteProfileString( const wxString& main, const wxString& sub, const wxString& value ) const; //! Retrieves a string from the configuration. /*! \param main The main path within the configuration. * \param sub The sub-path within the configuration. * \param default_ The default string to return if the configuration entry can't be read. * \return The string that is stored in /main/sub, or default_ if the entry couldn't * be read. */ wxString wxGetProfileString( const wxString& main, const wxString& sub, const wxString& default_ ) const; //! Creates a new child window showing a new document. /*! \param NewData The new data to be shown in the new window. * \param Sender The document that was at the origin of this new window. * \param title A title for the new document. * \return A pointer to the newly created document. */ wxStfDoc* NewChild( const Recording& NewData, const wxStfDoc* Sender, const wxString& title = wxT("\0") ); //! Execute all pending calculations. /*! Whenever settings that have an effect on measurements, such as * cursor positions or trace selections, are modified, this function * needs to be called to update the results table. */ void OnPeakcalcexecMsg(wxStfDoc* actDoc = 0); //! Sets the currently active document. /*! \param pDoc A pointer to the currently active document. */ void SetMRActiveDoc(wxStfDoc* pDoc) {mrActiveDoc = pDoc;} //! Destroys the last cursor settings dialog when the last document is closed /*! Do not use this function directly. It only needs to be called from wxStfDoc::OnCloseDocument(). * \param pDoc Pointer to the document that is being closed. */ void CleanupDocument(wxStfDoc* pDoc); //! Closes all documents bool CloseAll() { return GetDocManager()->CloseDocuments(); } //! Opens a series of files. Optionally, files can be put into a single window. /*! \param fNameArray An array of file names to be opened. * \return true upon successful opening of all files, false otherwise. */ bool OpenFileSeries(const wxArrayString& fNameArray); //! Returns the number of currently opened documents. /*! \return The number of currently opened documents. */ int GetDocCount() { return (int)GetDocManager()->GetDocuments().GetCount(); } //! Determine whether scale bars or coordinates should be shown. /*! \param value Set to true for scale bars, false for coordinates. */ void set_isBars(bool value) { isBars=value; } //! Indicates whether scale bars or coordinates are shown. /*! \return true for scale bars, false for coordinates. */ bool get_isBars() const { return isBars; } //! Get a formatted version string. /*! \return A version string (stimfit x.y.z, release/debug build, date). */ wxString GetVersionString() const; //! Open a new window showing all selected traces from all open files /*! \param event The associated menu event */ void OnNewfromselected( wxCommandEvent& event ); //! Access the document manager /*! \return A pointer to the document manager. */ wxDocManager* GetDocManager() const { return wxDocManager::GetDocumentManager(); } virtual void OnInitCmdLine(wxCmdLineParser& parser); virtual bool OnCmdLineParsed(wxCmdLineParser& parser); #ifdef WITH_PYTHON //! Opens a file in a new window, to be called from Python. /*! \param fNameArray An array of file names to be opened. * \return true upon successful opening, false otherwise. */ bool OpenFilePy(const wxString& fNameArray); //! Opens a dialog to import a Python module /*! \param event The associated menu event */ void OnPythonImport( wxCommandEvent& event ); #endif protected: private: void OnCursorSettings( wxCommandEvent& event ); void OnNewfromall( wxCommandEvent& event ); void OnApplytoall( wxCommandEvent& event ); void OnProcessCustom( wxCommandEvent& event ); void OnKeyDown( wxKeyEvent& event ); #ifdef WITH_PYTHON void ImportPython(const wxString& modulelocation); void OnUserdef(wxCommandEvent& event); bool Init_wxPython(); bool Exit_wxPython(); std::vector LoadExtensions(); #endif // WITH_PYTHON wxMenuBar* CreateUnifiedMenuBar(wxStfDoc* doc=NULL); #ifdef _WINDOWS #pragma optimize( "", off ) #endif #ifdef _WINDOWS #pragma optimize( "", on ) #endif bool directTxtImport,isBars; stfio::txtImportSettings txtImport; // Registry: #if (__cplusplus < 201103) boost::shared_ptr config; #else std::shared_ptr config; #endif std::vector funcLib; #ifdef WITH_PYTHON std::vector< stf::Extension > extensionLib; #endif // Pointer to the cursors settings dialog box wxStfCursorsDlg* CursorsDialog; wxDocTemplate* m_cfsTemplate, *m_hdf5Template, *m_txtTemplate,*m_abfTemplate, *m_atfTemplate,*m_axgTemplate,*m_sonTemplate, *m_hekaTemplate, *m_intanTemplate, *m_tdmsTemplate, *m_biosigTemplate; stfnum::storedFunc storedLinFunc; // wxMenu* m_file_menu; wxString m_fileToLoad; /*std::list activeDoc;*/ wxStfDoc* mrActiveDoc; #ifdef WITH_PYTHON PyThreadState* m_mainTState; #endif DECLARE_EVENT_TABLE() }; #ifdef _WINDOWS //! Returns a reference to the application. extern StfDll wxStfApp& wxGetApp(); #else DECLARE_APP(wxStfApp) #endif //! Retrieve the application's top-level frame /*! \return A pointer to the top-level frame. */ extern StfDll wxStfParentFrame *GetMainFrame(); //! true if in single-window mode extern bool singleWindowMode; /*@}*/ #endif stimfit-0.16.0/src/stimfit/gui/main.cpp0000775000175000017500000000064713277303516014703 00000000000000// For compilers that support precompilation, includes "wx/wx.h". #include #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "./app.h" wxAppConsole *wxCreateApp() { wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "your program"); return new wxStfApp; } wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); IMPLEMENT_WXWIN_MAIN IMPLEMENT_WX_THEME_SUPPORT stimfit-0.16.0/src/stimfit/gui/childframe.cpp0000775000175000017500000005331713567226230016056 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // frame.cpp // These are the top-level and child windows of the application. // 2007-12-27, Christoph Schmidt-Hieber, University of Freiburg #ifdef _STFDEBUG #include #endif // For compilers that support precompilation, includes "wx/wx.h". #include #include #include #include #include #include #include #include #include #include #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include #endif #if !wxUSE_DOC_VIEW_ARCHITECTURE #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h! #endif #if !wxUSE_MDI_ARCHITECTURE #error You must set wxUSE_MDI_ARCHITECTURE to 1 in setup.h! #endif #include "./app.h" #include "./doc.h" #include "./view.h" #include "./graph.h" #include "./table.h" #include "./printout.h" #include "./dlgs/smalldlgs.h" #include "./copygrid.h" #ifdef _WINDOWS #include "./../../libstfio/atf/atflib.h" #include "./../../libstfio/igor/igorlib.h" #endif #include "./childframe.h" IMPLEMENT_CLASS(wxStfChildFrame, wxStfChildType) BEGIN_EVENT_TABLE(wxStfChildFrame, wxStfChildType) EVT_SPINCTRL( ID_SPINCTRLTRACES, wxStfChildFrame::OnSpinCtrlTraces ) EVT_COMBOBOX( ID_COMBOACTCHANNEL, wxStfChildFrame::OnComboActChannel ) EVT_COMBOBOX( ID_COMBOINACTCHANNEL, wxStfChildFrame::OnComboInactChannel ) EVT_CHECKBOX( ID_ZERO_INDEX, wxStfChildFrame::OnZeroIndex) EVT_CHECKBOX( ID_PLOTSELECTED, wxStfChildFrame::OnShowselected ) // workaround for status bar: EVT_MENU_HIGHLIGHT_ALL( wxStfChildFrame::OnMenuHighlight ) END_EVENT_TABLE() wxStfChildFrame::wxStfChildFrame(wxDocument* doc, wxView* view, wxStfParentType* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) : wxStfChildType(doc,view,parent,id,title,pos,size,style,name), m_parent(parent), m_notebook(NULL) { m_mgr.SetManagedWindow(this); m_mgr.SetFlags( wxAUI_MGR_ALLOW_FLOATING | wxAUI_MGR_TRANSPARENT_DRAG | wxAUI_MGR_VENETIAN_BLINDS_HINT | wxAUI_MGR_ALLOW_ACTIVE_PANE ); } wxStfChildFrame::~wxStfChildFrame() { // deinitialize the frame manager m_mgr.UnInit(); } wxStfGrid* wxStfChildFrame::CreateTable() { // create the notebook off-window to avoid flicker //wxSize client_size = GetClientSize(); wxStfGrid* ctrl = new wxStfGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL | wxHSCROLL ); #ifndef __APPLE__ wxFont font( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ); ctrl->SetDefaultCellFont(font); #endif ctrl->SetDefaultColSize(108); ctrl->SetColLabelSize(20); ctrl->SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE); ctrl->CreateGrid(3,10); ctrl->EnableEditing(false); return ctrl; } wxAuiNotebook* wxStfChildFrame::CreateNotebook() { // create the notebook off-window to avoid flicker wxSize client_size = GetClientSize(); m_notebook_style = wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB |/*wxAUI_NB_DEFAULT_STYLE | */ wxNO_BORDER; wxAuiNotebook* ctrl = new wxAuiNotebook( this, wxID_ANY, wxPoint(client_size.x, client_size.y), wxSize(200,200), m_notebook_style ); return ctrl; } wxPanel* wxStfChildFrame::CreateTraceCounter() { //wxSize client_size = GetClientSize(); wxPanel* ctrl = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize );// , wxSize(165,88) ); return ctrl; } wxPanel* wxStfChildFrame::CreateChannelCounter() { wxPanel* ctrl = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize ); //, wxSize(256,88) ); return ctrl; } void wxStfChildFrame::CreateMenuTraces(const std::size_t value) { sizemax = value; m_traceCounter = CreateTraceCounter(); // this is wxPanel wxBoxSizer* pTracesBoxSizer; // top-level Sizer pTracesBoxSizer = new wxBoxSizer(wxVERTICAL); wxGridSizer* TracesGridSizer; // top-level GridSizer TracesGridSizer = new wxGridSizer(3,1,0,0); // Grid for spin control wxFlexGridSizer* pSpinCtrlTraceSizer; pSpinCtrlTraceSizer = new wxFlexGridSizer(1,3,0,0); // 1 row, 3 columns for the SpinCtrl + text // 1) the wxSpinCtrl object trace_spinctrl = new wxSpinCtrl( m_traceCounter, ID_SPINCTRLTRACES, wxEmptyString, wxDefaultPosition, wxSize(64, wxDefaultCoord), wxSP_WRAP); // the "of n", where n is the number of traces // n is zero-based in zero-based check box is selected wxStaticText* pIndexText; pIndexText = new wxStaticText(m_traceCounter, wxID_ANY, wxT("Index: ")); pSize=new wxStaticText( m_traceCounter, wxID_ANY, wxEmptyString); wxString sizeStr; pSpinCtrlTraceSizer->Add( pIndexText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1) ; pSpinCtrlTraceSizer->Add( trace_spinctrl, 0, wxALIGN_LEFT, 1) ; pSpinCtrlTraceSizer->Add( pSize, 0, wxALIGN_LEFT | wxALIGN_CENTER, 1) ; // 2) Show zero-based index? Read from Stimfit registry pZeroIndex = new wxCheckBox( m_traceCounter, ID_ZERO_INDEX, wxT("Zero-based index ") ); pZeroIndex->SetValue(wxGetApp().wxGetProfileInt(wxT("Settings"), wxT("Zeroindex"), 0)); // If true set the starting value to zero if (pZeroIndex->GetValue()){ sizemax--; trace_spinctrl->SetValue(0); trace_spinctrl->SetRange(0, (int)sizemax); } else { trace_spinctrl->SetValue(1); trace_spinctrl->SetRange(1, (int)sizemax); } // value argument is the number of traces sizeStr << wxT("(") << value << wxT(")"); // gives asserts on OS X: wxString::Format(wxT("%3d"), value); pSize->SetLabel(sizeStr); // Show selected pShowSelected = new wxCheckBox( m_traceCounter, ID_PLOTSELECTED, wxT("Show selected")); pShowSelected->SetValue(false); // Add everything to top-level GridSizer TracesGridSizer->Add(pSpinCtrlTraceSizer, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 3); TracesGridSizer->Add(pZeroIndex, 0, wxALIGN_LEFT | wxALIGN_BOTTOM | wxALL, 3); TracesGridSizer->Add(pShowSelected, 0, wxALIGN_LEFT | wxALIGN_BOTTOM | wxALL, 3); pTracesBoxSizer->Add(TracesGridSizer, 0, wxALIGN_CENTER | wxALL, 1); pTracesBoxSizer->SetSizeHints(m_traceCounter); m_traceCounter->SetSizer( TracesGridSizer ); m_traceCounter->Layout(); wxSize size = m_traceCounter->GetSize(); wxStfDoc* pDoc=(wxStfDoc*)GetDocument(); m_mgr.AddPane( m_traceCounter, wxAuiPaneInfo().Caption(wxT("Trace selection")).Fixed().BestSize(size.x, size.y). Position(pDoc->size()-1).CloseButton(false).Floatable().Dock().Top().Name(wxT("SelectionT")) ); m_table=CreateTable(); m_mgr.AddPane( m_table, wxAuiPaneInfo().Caption(wxT("Results")).Position(pDoc->size()). CloseButton(false).Floatable().Dock().Top().Name(wxT("Results")) ); m_mgr.Update(); Refresh(); } // Channel Selection childframe void wxStfChildFrame::CreateComboChannels(const wxArrayString& channelStrings) { m_channelCounter = CreateChannelCounter(); wxBoxSizer* pChannelsBoxSizer; // top-level Sizer pChannelsBoxSizer = new wxBoxSizer(wxVERTICAL); // Grid for ChannelCombo wxFlexGridSizer* ChannelCombos; ChannelCombos = new wxFlexGridSizer(2,2,4,0); // Active channel Combo wxStaticText* pActIndex = new wxStaticText( m_channelCounter, wxID_ANY, wxT("Active channel: ") ); pActChannel = new wxComboBox( m_channelCounter, ID_COMBOACTCHANNEL, wxT("0"), wxDefaultPosition, wxSize(120, wxDefaultCoord), channelStrings, wxCB_DROPDOWN | wxCB_READONLY ); // Inactive channel Combo wxStaticText* pInactIndex = new wxStaticText( m_channelCounter, wxID_ANY, wxT("Reference channel: ") ); pInactIndex->SetForegroundColour( *wxRED ); pInactChannel = new wxComboBox( m_channelCounter, ID_COMBOINACTCHANNEL, wxT("1"), wxDefaultPosition, wxSize(120,wxDefaultCoord), channelStrings, wxCB_DROPDOWN | wxCB_READONLY ); ChannelCombos->Add( pActIndex, 1, wxALIGN_CENTER_VERTICAL, 1); ChannelCombos->Add( pActChannel, 1); ChannelCombos->Add( pInactIndex,1, wxALIGN_CENTER_VERTICAL, 1); ChannelCombos->Add( pInactChannel, 1); wxBoxSizer *pShowChannelSizer; pShowChannelSizer = new wxBoxSizer(wxHORIZONTAL); // Show reference channel? Read from Stimfit registry pShowSecond = new wxCheckBox( m_channelCounter, ID_PLOTSELECTED, wxT("Show reference") ); pShowSecond->SetValue(wxGetApp().wxGetProfileInt(wxT("Settings"), wxT("ShowReference"),0)); pShowSecond->SetForegroundColour( *wxRED ); pShowAll = new wxCheckBox( m_channelCounter, ID_PLOTSELECTED, wxT("Show all ") ); pShowAll->SetValue(false); pShowChannelSizer->Add( pShowAll ); pShowChannelSizer->Add( pShowSecond ); pChannelsBoxSizer->Add(ChannelCombos, 0, wxALIGN_CENTER | wxALL, 3); pChannelsBoxSizer->Add(pShowChannelSizer, 0, wxALIGN_LEFT | wxALL, 3); pChannelsBoxSizer->SetSizeHints(m_channelCounter); m_channelCounter->SetSizer( pChannelsBoxSizer ); m_channelCounter->Layout(); wxSize size = m_channelCounter->GetSize(); m_mgr.AddPane( m_channelCounter, wxAuiPaneInfo().Caption(wxT("Channel selection")).Fixed().BestSize(size.x, size.y). Position(0).CloseButton(false).Floatable().Dock().Top().Name(wxT("SelectionC")) ); m_mgr.Update(); Refresh(); } // Trace selection childframe void wxStfChildFrame::SetSelected(std::size_t value) { wxString selStr; selStr << wxT("Show ") << wxString::Format(wxT("%3d"),(int)value) << wxT(" selected"); pShowSelected->SetLabel(selStr); } void wxStfChildFrame::SetChannels( std::size_t act, std::size_t inact ) { pActChannel->SetSelection( act ); pInactChannel->SetSelection( inact ); } std::size_t wxStfChildFrame::GetCurTrace() const { // if zero-based is True if ( pZeroIndex->GetValue() ) return trace_spinctrl->GetValue(); else return trace_spinctrl->GetValue()-1; } void wxStfChildFrame::SetCurTrace(std::size_t n) { // if zero-based is True if ( pZeroIndex->GetValue() ) trace_spinctrl->SetValue((int)n); else trace_spinctrl->SetValue((int)n+1); } void wxStfChildFrame::OnSpinCtrlTraces( wxSpinEvent& event ){ event.Skip(); wxStfView* pView=(wxStfView*)GetView(); wxStfDoc* pDoc=(wxStfDoc*)GetDocument(); if (pDoc == NULL || pView == NULL) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfChildFrame::OnSpinCtrlTraces()")); return; } if (pView->GetGraph() != NULL) { pView->GetGraph()->ChangeTrace(GetCurTrace()); pView->GetGraph()->Enable(); pView->GetGraph()->SetFocus(); } } void wxStfChildFrame::OnActivate(wxActivateEvent &event) { wxStfView* pView=(wxStfView*)GetView(); if (pView) pView->Activate(true); } void wxStfChildFrame::OnComboActChannel(wxCommandEvent& WXUNUSED(event)) { if ( pActChannel->GetCurrentSelection() == pInactChannel->GetCurrentSelection()) { // correct selection: for (int n_c=0;n_c<(int)pActChannel->GetCount();++n_c) { if (n_c!=pActChannel->GetCurrentSelection()) { pInactChannel->SetSelection(n_c); break; } } } UpdateChannels(); } void wxStfChildFrame::OnComboInactChannel(wxCommandEvent& WXUNUSED(event)) { if (pInactChannel->GetCurrentSelection()==pActChannel->GetCurrentSelection()) { // correct selection: for (int n_c=0;n_c<(int)pInactChannel->GetCount();++n_c) { if (n_c!=pInactChannel->GetCurrentSelection()) { pActChannel->SetSelection(n_c); break; } } } UpdateChannels(); } void wxStfChildFrame::UpdateChannels( ) { wxStfDoc* pDoc=(wxStfDoc*)GetDocument(); if ( pDoc != NULL && pDoc->size() > 1) { try { if (pActChannel->GetCurrentSelection() >= 0 || pActChannel->GetCurrentSelection() < (int)pDoc->size()) { pDoc->SetCurChIndex( pActChannel->GetCurrentSelection() ); if (pInactChannel->GetCurrentSelection() >= 0 || pInactChannel->GetCurrentSelection() < (int)pDoc->size()) { pDoc->SetSecChIndex( pInactChannel->GetCurrentSelection() ); } else { pDoc->SetCurChIndex(0); pDoc->SetSecChIndex(1); } } else { pDoc->SetCurChIndex(0); pDoc->SetSecChIndex(1); } } catch (const std::out_of_range& e) { wxString msg(wxT("Error while changing channels\nPlease close file\n")); msg += wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg(msg); return; } // Update measurements: wxGetApp().OnPeakcalcexecMsg(); UpdateResults(); wxStfView* pView=(wxStfView*)GetView(); if ( pView == NULL ) { wxGetApp().ErrorMsg( wxT("View is zero in wxStfDoc::SwapChannels")); return; } if (pView->GetGraph() != NULL) { pView->GetGraph()->Refresh(); pView->GetGraph()->Enable(); pView->GetGraph()->SetFocus(); } } } void wxStfChildFrame::OnZeroIndex( wxCommandEvent& event) { event.Skip(); wxSpinCtrl* pTraceCtrl = (wxSpinCtrl*)FindWindow(ID_SPINCTRLTRACES); wxCheckBox* pZeroIndex = (wxCheckBox*)FindWindow(ID_ZERO_INDEX); if (pZeroIndex == NULL || pTraceCtrl == NULL){ wxGetApp().ErrorMsg(wxT("Null pointer in wxStfChildFrame::OnZeroIndex")); return; } // If Zero-index is ON (selected) if (pZeroIndex->GetValue()){ wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("Zeroindex"), 1); // write config if (pTraceCtrl->GetValue()==1){ sizemax--; pTraceCtrl->SetRange(0, sizemax); // first set new range pTraceCtrl->SetValue(pTraceCtrl->GetValue()-1); // now you can move one less } else if (pTraceCtrl->GetValue()==(int)sizemax){ sizemax--; pTraceCtrl->SetValue(pTraceCtrl->GetValue()-1); // move one less pTraceCtrl->SetRange(0, sizemax); // next set new range } else { sizemax--; pTraceCtrl->SetRange(0, sizemax); // first set new range pTraceCtrl->SetValue(pTraceCtrl->GetValue()-1); // now you can move one less } } // If Zero-index is OFF (unselected) else { wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("Zeroindex"), 0); if (pTraceCtrl->GetValue()==0){ sizemax++; pTraceCtrl->SetValue(pTraceCtrl->GetValue()+1); pTraceCtrl->SetRange(1, (int)sizemax); } else if (pTraceCtrl->GetValue()==(int)sizemax){ sizemax++; pTraceCtrl->SetRange(1, (int)sizemax); // first set new range pTraceCtrl->SetValue(pTraceCtrl->GetValue()+1); // now you can move one more } else { // now the order does not matter sizemax++; pTraceCtrl->SetRange(1, (int)sizemax); // first set new range pTraceCtrl->SetValue(pTraceCtrl->GetValue()+1); // now you can move one more } } //wxString sizeStr; //sizeStr << wxT("of ") << wxString::Format(wxT("%3d"),(int)sizemax); //pSize->SetLabel(sizeStr); } void wxStfChildFrame::OnShowselected(wxCommandEvent& WXUNUSED(event)) { wxStfView* pView=(wxStfView*)GetView(); if (pView != NULL && pView->GetGraph()!= NULL) { pView->GetGraph()->Refresh(); pView->GetGraph()->Enable(); pView->GetGraph()->SetFocus(); } } bool wxStfChildFrame::ShowSecond() { wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("ShowReference"), pShowSecond->IsChecked()); // write config return pShowSecond->IsChecked(); } void wxStfChildFrame::ActivateGraph() { wxStfView* pView=(wxStfView*)GetView(); // Set the focus somewhere else: if (m_traceCounter != NULL) m_traceCounter->SetFocus(); if (pView != NULL && pView->GetGraph()!= NULL) { pView->GetGraph()->Enable(); pView->GetGraph()->SetFocus(); } } void wxStfChildFrame::ShowTable(const stfnum::Table &table,const wxString& caption) { // Create and show notebook if necessary: if (m_notebook==NULL && !m_mgr.GetPane(m_notebook).IsOk()) { m_notebook=CreateNotebook(); m_mgr.AddPane( m_notebook, wxAuiPaneInfo().Caption(wxT("Analysis results")). Floatable().Dock().Left().Name( wxT("Notebook") ) ); } else { // Re-open notebook if it has been closed: if (!m_mgr.GetPane(m_notebook).IsShown()) { m_mgr.GetPane(m_notebook).Show(); } } wxStfGrid* pGrid = new wxStfGrid( m_notebook, wxID_ANY, wxPoint(0,20), wxDefaultSize ); wxStfTable* pTable(new wxStfTable(table)); pGrid->SetTable(pTable,true); // the grid will take care of the deletion pGrid->EnableEditing(false); pGrid->SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE); for (std::size_t n_row=0; n_row<=table.nRows()+1; ++n_row) { pGrid->SetCellAlignment((int)n_row, 0, wxALIGN_LEFT, wxALIGN_CENTRE); } m_notebook->AddPage( pGrid, caption, true ); // "commit" all changes made to wxAuiManager m_mgr.Update(); wxStfView* pView=(wxStfView*)GetView(); if (pView != NULL && pView->GetGraph()!= NULL) { pView->GetGraph()->Enable(); pView->GetGraph()->SetFocus(); } } void wxStfChildFrame::UpdateResults() { wxStfDoc* pDoc=(wxStfDoc*)GetDocument(); stfnum::Table table(pDoc->CurResultsTable()); // Delete or append columns: if (m_table->GetNumberCols()<(int)table.nCols()) { m_table->AppendCols((int)table.nCols()-(int)m_table->GetNumberCols()); } else { if (m_table->GetNumberCols()>(int)table.nCols()) { m_table->DeleteCols(0,(int)m_table->GetNumberCols()-(int)table.nCols()); } } // Delete or append row: if (m_table->GetNumberRows()<(int)table.nRows()) { m_table->AppendRows((int)table.nRows()-(int)m_table->GetNumberRows()); } else { if (m_table->GetNumberRows()>(int)table.nRows()) { m_table->DeleteRows(0,(int)m_table->GetNumberRows()-(int)table.nRows()); } } for (std::size_t nRow=0;nRowSetRowLabelValue((int)nRow, stf::std2wx(table.GetRowLabel(nRow))); for (std::size_t nCol=0;nColSetColLabelValue((int)nCol, stf::std2wx(table.GetColLabel(nCol))); if (!table.IsEmpty(nRow,nCol)) { wxString entry; entry << table.at(nRow,nCol); m_table->SetCellValue((int)nRow,(int)nCol,entry); } else { m_table->SetCellValue((int)nRow,(int)nCol,wxT("n.a.")); } } } } void wxStfChildFrame::Saveperspective() { wxString perspective = m_mgr.SavePerspective(); // Save to wxConfig: wxGetApp().wxWriteProfileString(wxT("Settings"),wxT("Windows"),perspective); #ifdef _STFDEBUG wxFile persp(wxT("perspective.txt"), wxFile::write); persp.Write(perspective); persp.Close(); #endif } void wxStfChildFrame::Loadperspective() { wxString perspective = wxGetApp().wxGetProfileString(wxT("Settings"),wxT("Windows"),wxT("")); if (perspective!=wxT("")) { m_mgr.LoadPerspective(perspective); } else { wxGetApp().ErrorMsg(wxT("Couldn't find saved windows settings")); } } void wxStfChildFrame::Restoreperspective() { m_mgr.LoadPerspective(defaultPersp); m_mgr.Update(); } void wxStfChildFrame::OnMenuHighlight(wxMenuEvent& event) { if (this->GetMenuBar()) { wxMenuItem *item = this->GetMenuBar()->FindItem(event.GetId()); if(item) { wxLogStatus(item->GetHelp()); } } event.Skip(); } #if wxUSE_DRAG_AND_DROP bool wxStfFileDrop::OnDropFiles(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxArrayString& filenames) { int nFiles=(int)filenames.GetCount(); if (nFiles>0) { return wxGetApp().OpenFileSeries(filenames); } else { return false; } } #endif stimfit-0.16.0/src/stimfit/gui/doc.cpp0000775000175000017500000036445113354367041014531 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // doc.cpp // The document class, derived from both wxDocument and recording // 2007-12-27, Christoph Schmidt-Hieber, University of Freiburg // For compilers that support precompilation, includes "wx/wx.h". #include #include #include #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include #endif #if !wxUSE_DOC_VIEW_ARCHITECTURE #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h! #endif #include "./app.h" #include "./view.h" #include "./parentframe.h" #include "./childframe.h" #include "./dlgs/smalldlgs.h" #include "./dlgs/fitseldlg.h" #include "./dlgs/eventdlg.h" #include "./dlgs/cursorsdlg.h" #include "./../../libstfnum/stfnum.h" #include "./../../libstfnum/fit.h" #include "./../../libstfnum/funclib.h" #include "./../../libstfnum/measure.h" #include "./../../libstfio/stfio.h" #ifdef WITH_PYTHON #include "./../../pystfio/pystfio.h" #endif #include "./usrdlg/usrdlg.h" #include "./doc.h" #include "./graph.h" IMPLEMENT_DYNAMIC_CLASS(wxStfDoc, wxDocument) BEGIN_EVENT_TABLE( wxStfDoc, wxDocument ) EVT_MENU( ID_SWAPCHANNELS, wxStfDoc::OnSwapChannels ) EVT_MENU( ID_FILEINFO, wxStfDoc::Fileinfo) EVT_MENU( ID_NEWFROMSELECTEDTHIS, wxStfDoc::OnNewfromselectedThisMenu ) EVT_MENU( ID_MYSELECTALL, wxStfDoc::Selectall ) EVT_MENU( ID_UNSELECTALL, wxStfDoc::Deleteselected ) EVT_MENU( ID_SELECTSOME, wxStfDoc::Selectsome ) EVT_MENU( ID_UNSELECTSOME, wxStfDoc::Unselectsome ) EVT_MENU( ID_SELECT_AND_ADD, wxStfDoc::SelectTracesOfType ) EVT_MENU( ID_SELECT_AND_REMOVE, wxStfDoc::UnselectTracesOfType ) EVT_MENU( ID_CONCATENATE_MULTICHANNEL, wxStfDoc::ConcatenateMultiChannel ) EVT_MENU( ID_BATCH, wxStfDoc::OnAnalysisBatch ) EVT_MENU( ID_INTEGRATE, wxStfDoc::OnAnalysisIntegrate ) EVT_MENU( ID_DIFFERENTIATE, wxStfDoc::OnAnalysisDifferentiate ) EVT_MENU( ID_MULTIPLY, wxStfDoc::Multiply) EVT_MENU( ID_SUBTRACTBASE, wxStfDoc::SubtractBaseMenu ) EVT_MENU( ID_FIT, wxStfDoc::FitDecay) EVT_MENU( ID_LFIT, wxStfDoc::LFit) EVT_MENU( ID_LOG, wxStfDoc::LnTransform) EVT_MENU( ID_FILTER,wxStfDoc::Filter) EVT_MENU( ID_POVERN,wxStfDoc::P_over_N) EVT_MENU( ID_PLOTCRITERION,wxStfDoc::Plotcriterion) EVT_MENU( ID_PLOTCORRELATION,wxStfDoc::Plotcorrelation) EVT_MENU( ID_PLOTDECONVOLUTION,wxStfDoc::Plotdeconvolution) EVT_MENU( ID_EXTRACT,wxStfDoc::MarkEvents ) EVT_MENU( ID_THRESHOLD,wxStfDoc::Threshold) EVT_MENU( ID_VIEWTABLE, wxStfDoc::Viewtable) EVT_MENU( ID_EVENT_EXTRACT, wxStfDoc::Extract ) EVT_MENU( ID_EVENT_ERASE, wxStfDoc::InteractiveEraseEvents ) EVT_MENU( ID_EVENT_ADDEVENT, wxStfDoc::AddEvent ) END_EVENT_TABLE() static const int baseline=100; // static const double rtfrac = 0.2; // now expressed in percentage, see RTFactor wxStfDoc::wxStfDoc() : Recording(),peakAtEnd(false), startFitAtPeak(false), initialized(false),progress(true), Average(0), latencyStartMode(stf::riseMode), latencyEndMode(stf::footMode), latencyWindowMode(stf::defaultMode), direction(stfnum::both), #ifdef WITH_PSLOPE pslopeBegMode(stf::psBeg_manualMode), pslopeEndMode(stf::psEnd_manualMode), #endif baseBeg(0), baseEnd(0), peakBeg(0), peakEnd(0), fitBeg(0), fitEnd(0), baselineMethod(stfnum::mean_sd), #ifdef WITH_PSLOPE PSlopeBeg(0), PSlopeEnd(0), DeltaT(0), viewPSlope(true), #endif measCursor(0), ShowRuler(false), latencyStartCursor(0.0), latencyEndCursor(0.0), latency(0.0), base(0.0), APBase(0.0), baseSD(0.0), threshold(0.0), slopeForThreshold(20.0), peak(0.0), APPeak(0.0), tLoReal(0), tHiReal(0), t50LeftReal(0), t50RightReal(0), maxT(0.0), thrT(-1.0), maxRiseY(0.0), maxRiseT(0.0), maxDecayY(0.0), maxDecayT(0.0), maxRise(0.0), maxDecay(0.0), t50Y(0.0), APMaxT(0.0), APMaxRiseY(0.0), APMaxRiseT(0.0), APt50LeftReal(0.0), APrtLoHi(0.0), APtLoReal(0.0), APtHiReal(0.0), APt0Real(0.0), #ifdef WITH_PSLOPE PSlope(0.0), #endif rtLoHi(0.0), InnerLoRT(NAN), InnerHiRT(NAN), OuterLoRT(NAN), OuterHiRT(NAN), halfDuration(0.0), slopeRatio(0.0), t0Real(0.0), pM(1), RTFactor(20), tLoIndex(0), tHiIndex(0), t50LeftIndex(0), t50RightIndex(0), APt50LeftIndex(0), APt50RightIndex(0), APtLoIndex(0), APtHiIndex(0), fromBase(true), viewCrosshair(true), viewBaseline(true), viewBaseSD(true), viewThreshold(false), viewPeakzero(true), viewPeakbase(true), viewPeakthreshold(false), viewRTLoHi(true), viewInnerRiseTime(false), viewOuterRiseTime(false), viewT50(true), viewRD(true), viewSloperise(true), viewSlopedecay(true), viewLatency(true), viewCursors(true), xzoom(XZoom(0, 0.1, false)), yzoom(size(), YZoom(500,0.1,false)), sec_attr(size()) { for (std::size_t nchannel=0; nchannel < sec_attr.size(); ++nchannel) { sec_attr[nchannel].resize(at(nchannel).size()); } } wxStfDoc::~wxStfDoc() {} bool wxStfDoc::OnOpenPyDocument(const wxString& filename) { progress = false; bool success = OnOpenDocument( filename ); progress = true; return success; } bool wxStfDoc::OnOpenDocument(const wxString& filename) { // Check whether the file exists: if ( !wxFileName::FileExists( filename ) ) { wxString msg; msg << wxT("Couldn't find ") << filename; wxGetApp().ErrorMsg( msg ); return false; } // Store directory: wxFileName wxfFilename( filename ); wxGetApp().wxWriteProfileString( wxT("Settings"), wxT("Last directory"), wxfFilename.GetPath() ); if (wxDocument::OnOpenDocument(filename)) { //calls base class function #ifndef TEST_MINIMAL #if 0 //(defined(WITH_BIOSIG) || defined(WITH_BIOSIG2) && !defined(__WXMAC__)) // Detect type of file according to filter: wxString filter(GetDocumentTemplate()->GetFileFilter()); #else wxString filter(wxT("*.") + wxfFilename.GetExt()); #endif stfio::filetype type = stfio::findType(stf::wx2std(filter)); #else stfio::filetype type = stfio::none; #endif #if 0 // TODO: backport ascii if (type==stf::ascii) { if (!wxGetApp().get_directTxtImport()) { wxStfTextImportDlg ImportDlg( GetDocumentWindow(), stf::CreatePreview(filename), 1, false ); if (ImportDlg.ShowModal()!=wxID_OK) { get().clear(); return false; } // store settings in application: wxGetApp().set_txtImportSettings(ImportDlg.GetTxtImport()); } } #endif if (type == stfio::tdms) { #ifdef WITH_PYTHON if (!LoadTDMS(stf::wx2std(filename), *this)) { wxString errorMsg(wxT("Error opening file\n")); #else { wxString errorMsg(wxT("Error opening file - TDMS requires python \n")); #endif wxGetApp().ExceptMsg(errorMsg); get().clear(); return false; } } else { try { if (progress) { stf::wxProgressInfo progDlg("Reading file", "Opening file", 100); stfio::importFile(stf::wx2std(filename), type, *this, wxGetApp().GetTxtImport(), progDlg); } else { stfio::StdoutProgressInfo progDlg("Reading file", "Opening file", 100, true); stfio::importFile(stf::wx2std(filename), type, *this, wxGetApp().GetTxtImport(), progDlg); } } catch (const std::runtime_error& e) { wxString errorMsg(wxT("Error opening file\n")); errorMsg += wxString( e.what(),wxConvLocal ); wxGetApp().ExceptMsg(errorMsg); get().clear(); return false; } catch (const std::exception& e) { wxString errorMsg(wxT("Error opening file\n")); errorMsg += wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg(errorMsg); get().clear(); return false; } catch (...) { wxString errorMsg(wxT("Error opening file\n")); wxGetApp().ExceptMsg(errorMsg); get().clear(); return false; } } if (get().empty()) { wxGetApp().ErrorMsg(wxT("File is probably empty\n")); get().clear(); return false; } if (get()[0].get().empty()) { wxGetApp().ErrorMsg(wxT("File is probably empty\n")); get().clear(); return false; } if (get()[0][0].get().empty()) { wxGetApp().ErrorMsg(wxT("File is probably empty\n")); get().clear(); return false; } wxStfParentFrame* pFrame = GetMainFrame(); if (pFrame == NULL) { throw std::runtime_error("pFrame is 0 in wxStfDoc::OnOpenDocument"); } pFrame->SetSingleChannel( size() <= 1 ); if (InitCursors()!=wxID_OK) { get().clear(); wxGetApp().ErrorMsg(wxT( "Couldn't initialize cursors\n" )); return false; } //Select active channel to be displayed if (get().size()>1) { try { if (ChannelSelDlg() != true) { wxGetApp().ErrorMsg(wxT( "File is probably empty\n" )); get().clear(); return false; } } catch (const std::out_of_range& e) { wxString msg(wxT( "Channel could not be selected:" )); msg += wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg(msg); get().clear(); return false; } } } else { wxGetApp().ErrorMsg(wxT( "Failure in wxDocument::OnOpenDocument\n" )); get().clear(); return false; } // Make sure curChannel and secondChannel are not out of range // so that we can use them safely without range checking: wxString msg(wxT( "Error while checking range:\nParts of the file might be empty\nClosing file now" )); if (!(get().size()>1)) { if (cursec().size()==0) { wxGetApp().ErrorMsg(msg); get().clear(); return false; } } else { if (cursec().size()==0 || secsec().size()==0) { wxGetApp().ErrorMsg(msg); get().clear(); return false; } } wxFileName fn(GetFilename()); SetTitle(fn.GetFullName()); PostInit(); return true; } void wxStfDoc::SetData( const Recording& c_Data, const wxStfDoc* Sender, const wxString& title ) { resize(c_Data.size()); std::copy(c_Data.get().begin(),c_Data.get().end(),get().begin()); CopyAttributes(c_Data); // Make sure curChannel and curSection are not out of range: std::out_of_range e("Data empty in wxStimfitDoc::SetData()"); if (get().empty()) { throw e; } wxStfParentFrame* pFrame = GetMainFrame(); if (pFrame == NULL) { throw std::runtime_error("pFrame is 0 in wxStfDoc::SetData"); } pFrame->SetSingleChannel( size() <= 1 ); // If the title is not a zero string... if (title != wxT("\0")) { // ... reset its title ... SetTitle(title); } //Read object variables and ensure correct and appropriate values: if (Sender!=NULL) { CopyCursors(*Sender); SetLatencyBeg( Sender->GetLatencyBeg() ); SetLatencyEnd( Sender->GetLatencyEnd() ); //Get value of the reset latency cursor box //0=Off, 1=Peak, 2=Rise SetLatencyStartMode( Sender->GetLatencyStartMode() ); SetLatencyEndMode( Sender->GetLatencyEndMode() ); //SetLatencyWindowMode( Sender->GetLatencyWindowMode() ); #ifdef WITH_PSLOPE SetPSlopeBegMode ( Sender->GetPSlopeBegMode() ); SetPSlopeEndMode ( Sender->GetPSlopeEndMode() ); #endif // Update menu checks: // UpdateMenuCheckmarks(); //Get value of the peak direction dialog box SetDirection( Sender->GetDirection() ); SetFromBase( Sender->GetFromBase() ); CheckBoundaries(); } else { if (InitCursors()!=wxID_OK) { get().clear(); return; } } //Number of channels to display (1 or 2 only!) if (get().size()>1) { //Select active channel to be displayed try { if (ChannelSelDlg()!=true) { get().clear(); throw std::runtime_error("Couldn't select channels"); } } catch (...) { throw; } } //Latency Cursor: OFF-Mode only if one channel is selected! if (!(get().size()>1) && GetLatencyStartMode()!=stf::manualMode && GetLatencyEndMode()!=stf::manualMode) { SetLatencyStartMode(stf::manualMode); SetLatencyEndMode(stf::manualMode); // UpdateMenuCheckmarks(); } // Make sure once again curChannel and curSection are not out of range: if (!(get().size()>1)) { if (cursec().size()==0) { throw e; } } else { if (cursec().size()==0 || secsec().size()==0) { throw e; } } PostInit(); } //Dialog box to display the specific settings of the current CFS file. int wxStfDoc::InitCursors() { //Get values from .Stimfit and ensure proper settings SetMeasCursor(wxGetApp().wxGetProfileInt(wxT("Settings"), wxT("MeasureCursor"), 1)); SetMeasRuler( wxGetApp().wxGetProfileInt(wxT("Settings"), wxT("ShowRuler"), 0) ); SetBaseBeg(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("BaseBegin"), 1)); SetBaseEnd(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("BaseEnd"), 20)); int ibase_method = wxGetApp().wxGetProfileInt(wxT("Settings"), wxT("BaselineMethod"),0); switch (ibase_method) { case 0: SetBaselineMethod(stfnum::mean_sd); break; case 1: SetBaselineMethod(stfnum::median_iqr); break; default: SetBaselineMethod(stfnum::mean_sd); } SetPeakBeg(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("PeakBegin"), (int)cursec().size()-100)); SetPeakEnd(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("PeakEnd"), (int)cursec().size()-50)); int iDirection = wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("Direction"),2); switch (iDirection) { case 0: SetDirection(stfnum::up); break; case 1: SetDirection(stfnum::down); break; case 2: SetDirection(stfnum::both); break; default: SetDirection(stfnum::undefined_direction); } SetFromBase( true ); // reset at every program start wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("FromBase"),1) ); SetPeakAtEnd( wxGetApp().wxGetProfileInt(wxT("Settings"), wxT("PeakAtEnd"), 0)); SetFitBeg(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("FitBegin"), 10)); SetFitEnd(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("FitEnd"), 100)); SetStartFitAtPeak( wxGetApp().wxGetProfileInt(wxT("Settings"), wxT("StartFitAtPeak"), 0)); SetLatencyWindowMode(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("LatencyWindowMode"),1)); SetLatencyBeg(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("LatencyStartCursor"), 0)); /*CSH*/ SetLatencyEnd(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("LatencyEndCursor"), 2)); /*CSH*/ SetLatencyStartMode( wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("LatencyStartMode"),0) ); SetLatencyEndMode( wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("LatencyEndMode"),0) ); // Set corresponding menu checkmarks: // UpdateMenuCheckmarks(); SetPM(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("PeakMean"),1)); SetRTFactor(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("RTFactor"),20)); wxString wxsSlope = wxGetApp().wxGetProfileString(wxT("Settings"),wxT("Slope"),wxT("20.0")); double fSlope = 0.0; wxsSlope.ToDouble(&fSlope); SetSlopeForThreshold( fSlope ); if (!(get().size()>1) && GetLatencyStartMode()!=stf::manualMode && GetLatencyEndMode()!=stf::manualMode) { wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("LatencyStartMode"),stf::manualMode); wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("LatencyEndMode"),stf::manualMode); SetLatencyStartMode(stf::manualMode); SetLatencyEndMode(stf::manualMode); } #ifdef WITH_PSLOPE // read PSlope Beg mode from Stimfit registry int iPSlopeMode = wxGetApp().wxGetProfileInt( wxT("Settings"), wxT("PSlopeStartMode"), stf::psBeg_manualMode ); switch (iPSlopeMode) { case 0: SetPSlopeBegMode( stf::psBeg_manualMode ); break; case 1: SetPSlopeBegMode( stf::psBeg_footMode ); break; case 2: SetPSlopeBegMode( stf::psBeg_thrMode ); break; case 3: SetPSlopeBegMode( stf::psBeg_t50Mode ); break; default: SetPSlopeBegMode( stf::psBeg_undefined ); } // read PSlope End mode from Stimfit registry iPSlopeMode = wxGetApp().wxGetProfileInt( wxT("Settings"), wxT("PSlopeEndMode"), stf::psEnd_manualMode ); switch (iPSlopeMode) { case 0: SetPSlopeEndMode( stf::psEnd_manualMode ); break; case 1: SetPSlopeEndMode( stf::psEnd_t50Mode ); break; case 2: SetPSlopeEndMode( stf::psEnd_DeltaTMode ); break; case 3: SetPSlopeEndMode( stf::psEnd_peakMode ); break; default: SetPSlopeEndMode( stf::psEnd_undefined ); } #endif CheckBoundaries(); return wxID_OK; } //End SettingsDlg() void wxStfDoc::PostInit() { wxStfChildFrame *pFrame = (wxStfChildFrame*)GetDocumentWindow(); if ( pFrame == NULL ) { wxGetApp().ErrorMsg( wxT("Zero pointer in wxStfDoc::PostInit") ); return; } // Update some vector sizes sec_attr.resize(size()); for (std::size_t nchannel=0; nchannel < sec_attr.size(); ++nchannel) { sec_attr[nchannel].resize(at(nchannel).size()); } yzoom.resize(size()); try { pFrame->CreateMenuTraces(get().at(GetCurChIndex()).size()); if ( size() > 1 ) { wxArrayString channelNames; channelNames.Alloc( size() ); for (std::size_t n_c=0; n_c < size(); ++n_c) { wxString channelStream; channelStream << n_c << wxT(" (") << stf::std2wx( at(n_c).GetChannelName() ) << wxT(")"); channelNames.Add( channelStream ); } pFrame->CreateComboChannels( channelNames ); pFrame->SetChannels( GetCurChIndex(), GetSecChIndex() ); } } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg( wxString( e.what(), wxConvLocal ) ); return; } if (GetSR()>1000) { wxString highSampling; highSampling << wxT("Sampling rate seems very high (") << GetSR() << wxT(" kHz).\n") << wxT("Divide by 1000?"); if (wxMessageDialog( GetDocumentWindow(), highSampling, wxT("Adjust sampling rate"), wxYES_NO ).ShowModal()==wxID_YES) { SetXScale(GetXScale()*1000.0); } } // Read results table settings from registry: SetViewCrosshair(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewCrosshair"),1)==1); SetViewBaseline(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewBaseline"),1)==1); SetViewBaseSD(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewBaseSD"),1)==1); SetViewThreshold(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewThreshold"),1)==1); SetViewPeakZero(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewPeakzero"),1)==1); SetViewPeakBase(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewPeakbase"),1)==1); SetViewPeakThreshold(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewPeakthreshold"),1)==1); SetViewRTLoHi(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewRTLoHi"),1)==1); SetViewInnerRiseTime(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewInnerRiseTime"),1)==1); SetViewOuterRiseTime(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewOuterRiseTime"),1)==1); SetViewT50(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewT50"),1)==1); SetViewRD(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewRD"),1)==1); SetViewSlopeRise(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewSloperise"),1)==1); SetViewSlopeDecay(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewSlopedecay"),1)==1); #ifdef WITH_PSLOPE //SetViewPSlope(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewPSlope"),1)==1); SetViewPSlope(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewPSlope"),1)==1); //SetPSlopeBegMode( wxGetApp().wxGetProfileInt( wxT("Settings"), wxT("PSlopeStartMode"), 1)==1); #endif SetViewLatency(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewLatency"),1)==1); SetViewCursors(wxGetApp().wxGetProfileInt(wxT("Settings"),wxT("ViewCursors"),1)==1); // refresh the view once we are through: initialized=true; pFrame->SetCurTrace(0); UpdateSelectedButton(); wxGetApp().OnPeakcalcexecMsg(); wxStfParentFrame* parentFrame = GetMainFrame(); if (parentFrame) { parentFrame->SetFocus(); } wxStfView* pView=(wxStfView*)GetFirstView(); if (pView != NULL) { wxStfGraph* pGraph = pView->GetGraph(); if (pGraph != NULL) { pGraph->Refresh(); pGraph->Enable(); // Set the focus: pGraph->SetFocus(); } } } //Dialog box to select channel to be displayed bool wxStfDoc::ChannelSelDlg() { // Set default channels: if ( size() < 2 ) { return false; } // SetCurChIndex(); done in Recording constructor // SetSecCh( 1 ); return true; } //End ChannelSelDlg() void wxStfDoc::CheckBoundaries() { //Security check base if (GetBaseBeg() > GetBaseEnd()) { std::size_t aux=GetBaseBeg(); SetBaseBeg((int)GetBaseEnd()); SetBaseEnd((int)aux); wxGetApp().ErrorMsg(wxT("Base cursors are reversed,\nthey will be exchanged")); } //Security check peak if (GetPeakBeg() > GetPeakEnd()) { std::size_t aux=GetPeakBeg(); SetPeakBeg((int)GetPeakEnd()); SetPeakEnd((int)aux); wxGetApp().ErrorMsg(wxT("Peak cursors are reversed,\nthey will be exchanged")); } //Security check decay if (GetFitBeg() > GetFitEnd()) { std::size_t aux=GetFitBeg(); SetFitBeg((int)GetFitEnd()); SetFitEnd((int)aux); wxGetApp().ErrorMsg(wxT("Decay cursors are reversed,\nthey will be exchanged")); } if (GetPM() > (int)cursec().size()) { SetPM((int)cursec().size()-1); } if (GetPM() == 0) { SetPM(1); } } bool wxStfDoc::OnNewDocument() { // correct caption: wxString title(GetTitle()); wxStfChildFrame* wnd=(wxStfChildFrame*)GetDocumentWindow(); wnd->SetLabel(title); // call base class member: return true; // return wxDocument::OnNewDocument(); } void wxStfDoc::Fileinfo(wxCommandEvent& WXUNUSED(event)) { //Create CFileOpenDlg object 'dlg' std::ostringstream oss1, oss2; oss1 << "Number of Channels: " << static_cast(get().size()); oss2 << "Number of Sweeps: " << static_cast(get()[GetCurChIndex()].size()); char buf[128]; struct tm t = GetDateTime(); snprintf(buf, 128, "Date:\t%04i-%02i-%02i\nTime:\t%02i:%02i:%02i\n", t.tm_year+1900, t.tm_mon+1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); std::string general = buf + oss1.str() + "\n" + oss2.str() + "\n" + "Comment:\n" + GetComment(); wxStfFileInfoDlg dlg( GetDocumentWindow(), general, GetFileDescription(), GetGlobalSectionDescription() ); dlg.ShowModal(); } bool wxStfDoc::OnCloseDocument() { if (!get().empty()) { WriteToReg(); } // Remove file menu from file menu list: #ifndef __WXGTK__ wxGetApp().GetDocManager()->GetFileHistory()->RemoveMenu( doc_file_menu ); #endif // Tell the App: wxGetApp().CleanupDocument(this); return wxDocument::OnCloseDocument(); //Note that the base class version will delete all the document's data } bool wxStfDoc::SaveAs() { // Override file save dialog to display only writeable // file types wxString filters; filters += wxT("hdf5 file (*.h5)|*.h5|"); filters += wxT("CED filing system (*.dat;*.cfs)|*.dat;*.cfs|"); filters += wxT("Axon text file (*.atf)|*.atf|"); filters += wxT("Igor binary wave (*.ibw)|*.ibw|"); filters += wxT("Mantis TDMS file (*.tdms)|*.tdms|"); filters += wxT("Text file series (*.txt)|*.txt|"); #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) filters += wxT("GDF file (*.gdf)|*.gdf"); #endif wxFileDialog SelectFileDialog( GetDocumentWindow(), wxT("Save file"), wxT(""), wxT(""), filters, wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_PREVIEW ); if(SelectFileDialog.ShowModal()==wxID_OK) { wxString filename = SelectFileDialog.GetPath(); Recording writeRec(ReorderChannels()); if (writeRec.size() == 0) return false; try { stf::wxProgressInfo progDlg("Reading file", "Opening file", 100); stfio::filetype type; switch (SelectFileDialog.GetFilterIndex()) { case 0: type=stfio::hdf5; break; case 1: type=stfio::cfs; break; case 2: type=stfio::atf; break; case 3: type=stfio::igor; break; case 4: type=stfio::tdms; break; case 5: type=stfio::ascii; break; #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) default: type=stfio::biosig; #else default: type=stfio::hdf5; #endif } return stfio::exportFile(stf::wx2std(filename), type, writeRec, progDlg); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(stf::std2wx(e.what())); return false; } } else { return false; } } Recording wxStfDoc::ReorderChannels() { // Re-order channels? std::vector< wxString > channelNames(size()); wxs_it it = channelNames.begin(); for (c_ch_it cit = get().begin(); cit != get().end() && it != channelNames.end(); cit++) { *it = stf::std2wx( cit->GetChannelName() ); it++; } std::vector channelOrder(size()); if (size()>1) { wxStfOrderChannelsDlg orderDlg(GetDocumentWindow(),channelNames); if (orderDlg.ShowModal() != wxID_OK) { return Recording(0); } channelOrder=orderDlg.GetChannelOrder(); } else { int n_c = 0; for (int_it it = channelOrder.begin(); it != channelOrder.end(); it++) { *it = n_c++; } } Recording writeRec(size()); writeRec.CopyAttributes(*this); std::size_t n_c = 0; for (c_int_it cit2 = channelOrder.begin(); cit2 != channelOrder.end(); cit2++) { writeRec.InsertChannel(get()[*cit2],n_c); // correct units: writeRec[n_c++].SetYUnits( at(*cit2).GetYUnits() ); } return writeRec; } #ifndef TEST_MINIMAL bool wxStfDoc::DoSaveDocument(const wxString& filename) { Recording writeRec(ReorderChannels()); if (writeRec.size() == 0) return false; try { stf::wxProgressInfo progDlg("Reading file", "Opening file", 100); if (stfio::exportFile(stf::wx2std(filename), stfio::hdf5, writeRec, progDlg)) return true; else return false; } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(stf::std2wx(e.what())); return false; } } #endif void wxStfDoc::WriteToReg() { //Write file length wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("FirstPoint"), 1); wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("LastPoint"), (int)cursec().size()-1); //Write cursors if (!outOfRange(GetBaseBeg())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("BaseBegin"), (int)GetBaseBeg()); if (!outOfRange(GetBaseEnd())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("BaseEnd"), (int)GetBaseEnd()); if (!outOfRange(GetPeakBeg())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("PeakBegin"), (int)GetPeakBeg()); if (!outOfRange(GetPeakEnd())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("PeakEnd"), (int)GetPeakEnd()); wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("PeakMean"),(int)GetPM()); wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("RTFactor"),(int)GetRTFactor()); wxString wxsSlope; wxsSlope << GetSlopeForThreshold(); wxGetApp().wxWriteProfileString(wxT("Settings"),wxT("Slope"),wxsSlope); //if (wxGetApp().GetCursorsDialog() != NULL) { // wxGetApp().wxWriteProfileInt( // wxT("Settings"),wxT("StartFitAtPeak"),(int)wxGetApp().GetCursorsDialog()->GetStartFitAtPeak() // ); //} if (!outOfRange(GetFitBeg())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("FitBegin"), (int)GetFitBeg()); if (!outOfRange(GetFitEnd())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("FitEnd"), (int)GetFitEnd()); wxGetApp().wxWriteProfileInt( wxT("Settings"),wxT("StartFitAtPeak"),(int)GetStartFitAtPeak() ); if (!outOfRange((size_t)GetLatencyBeg())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("LatencyStartCursor"), (int)GetLatencyBeg()); if (!outOfRange((size_t)GetLatencyEnd())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("LatencyEndCursor"), (int)GetLatencyEnd()); #ifdef WITH_PSLOPE if (!outOfRange((size_t)GetPSlopeBeg())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("PSlopeStartCursor"), GetPSlopeBeg() ); if (!outOfRange((size_t)GetPSlopeEnd())) wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("PSlopeEndCursor"), GetPSlopeEnd() ); wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("PSlopeStartMode"), (int)GetPSlopeBegMode()); wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("PSlopeEndMode"), (int)GetPSlopeEndMode()); wxGetApp().wxWriteProfileInt(wxT("Settings"), wxT("DeltaT"), GetDeltaT() ); #endif // Write Zoom wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("Zoom.xZoom"), (int)GetXZoom().xZoom*100000); wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("Zoom.yZoom"), GetYZoom(GetCurChIndex()).yZoom*100000); wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("Zoom.startPosX"), (int)GetXZoom().startPosX); wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("Zoom.startPosY"), GetYZoom(GetCurChIndex()).startPosY); if ((get().size()>1)) { wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("Zoom.yZoom2"), (int)GetYZoom(GetSecChIndex()).yZoom*100000); wxGetApp().wxWriteProfileInt(wxT("Settings"),wxT("Zoom.startPosY2"), GetYZoom(GetSecChIndex()).startPosY); } } bool wxStfDoc::SetSection(std::size_t section){ // Check range: if (!(get().size()>1)) { if (section>=get()[GetCurChIndex()].size()) { wxGetApp().ErrorMsg(wxT("subscript out of range\nwhile calling CStimfitDoc::SetSection()")); return false; } if (get()[GetCurChIndex()][section].size()==0) { wxGetApp().ErrorMsg(wxT("Section is empty")); return false; } } else { if (section>=get()[GetCurChIndex()].size() || section>=get()[GetSecChIndex()].size()) { wxGetApp().ErrorMsg(wxT("subscript out of range\nwhile calling CStimfitDoc::SetSection()")); return false; } if (get()[GetCurChIndex()][section].size()==0 || get()[GetSecChIndex()][section].size()==0) { wxGetApp().ErrorMsg(wxT("Section is empty")); return false; } } CheckBoundaries(); SetCurSecIndex(section); UpdateSelectedButton(); return true; } void wxStfDoc::OnSwapChannels(wxCommandEvent& WXUNUSED(event)) { if ( size() > 1) { // Update combo boxes: wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); if ( pFrame == NULL ) { wxGetApp().ErrorMsg( wxT("Frame is zero in wxStfDoc::SwapChannels")); return; } pFrame->SetChannels( GetSecChIndex(), GetCurChIndex() ); pFrame->UpdateChannels(); } } void wxStfDoc::ToggleSelect() { // get current selection status of this trace: bool selected = false; for (c_st_it cit = GetSelectedSections().begin(); cit != GetSelectedSections().end() && !selected; ++cit) { if (*cit == GetCurSecIndex()) { selected = true; } } if (selected) { Remove(); } else { Select(); } } void wxStfDoc::Select() { if (GetSelectedSections().size() == get()[GetCurChIndex()].size()) { wxGetApp().ErrorMsg(wxT("No more traces can be selected\nAll traces are selected")); return; } //control whether trace has already been selected: bool already=false; for (c_st_it cit = GetSelectedSections().begin(); cit != GetSelectedSections().end() && !already; ++cit) { if (*cit == GetCurSecIndex()) { already = true; } } //add trace number to selected numbers, print number of selected traces if (!already) { SelectTrace(GetCurSecIndex(), baseBeg, baseEnd); //String output in the trace navigator wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); pFrame->SetSelected(GetSelectedSections().size()); } else { wxGetApp().ErrorMsg(wxT("Trace is already selected")); return; } Focus(); } void wxStfDoc::Remove() { if (UnselectTrace(GetCurSecIndex())) { //Message update in the trace navigator wxStfChildFrame* pFrame = (wxStfChildFrame*)GetDocumentWindow(); if (pFrame) pFrame->SetSelected(GetSelectedSections().size()); } else { wxGetApp().ErrorMsg(wxT("Trace is not selected")); } Focus(); } void wxStfDoc::ConcatenateMultiChannel(wxCommandEvent &WXUNUSED(event)) { if (GetSelectedSections().empty()) { wxGetApp().ErrorMsg(wxT("Select sweeps first")); return; } stf::wxProgressInfo progDlg("Concatenating sections", "Starting...", 100); try { Recording Concatenated = stfio::concatenate(*this, GetSelectedSections(), progDlg); wxGetApp().NewChild(Concatenated,this,wxString(GetTitle()+wxT(", concatenated"))); } catch (const std::runtime_error& e) { wxGetApp().ErrorMsg(wxT("Error concatenating sections:\n") + stf::std2wx(e.what())); } } void wxStfDoc::CreateAverage( bool calcSD, bool align //align to steepest rise of other channel? ) { if(GetSelectedSections().empty()) { wxGetApp().ErrorMsg(wxT("Select traces first")); return; } wxBusyCursor wc; //array indicating how many indices to shift when aligning, //has to be filled with zeros: std::vector shift(GetSelectedSections().size(),0); int shift_size = 0; /* Aligned average */ //find alignment points in the reference (==second) channel: if (align) { // check that we have more than one channel wxStfAlignDlg AlignDlg(GetDocumentWindow(), size()>1); if (AlignDlg.ShowModal() != wxID_OK) return; //store current section and channel index: std::size_t section_old=GetCurSecIndex(); std::size_t channel_old=GetCurChIndex(); //initialize the lowest and the highest index: std::size_t min_index=0; try { if (AlignDlg.UseReference()) min_index=get()[GetSecChIndex()].at(GetSelectedSections().at(0)).size()-1; else min_index=get()[GetCurChIndex()].at(GetSelectedSections().at(0)).size()-1; } catch (const std::out_of_range& e) { wxString msg(wxT("Error while aligning\nIt is safer to re-start the program\n")); msg+=wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg(msg); return; } // swap channels temporarily: // if (AlignDlg.UseReference()) // SetCurChIndex(GetSecChIndex()); std::size_t max_index=0, n=0; int_it it = shift.begin(); //loop through all selected sections: for (c_st_it cit = GetSelectedSections().begin(); cit != GetSelectedSections().end() && it != shift.end(); cit++) { //Set the selected section as the current section temporarily: SetSection(*cit); if (peakAtEnd) { SetPeakEnd((int)get()[GetSecChIndex()][*cit].size()-1); } // Calculate all variables for the current settings // APMaxSlopeT will be calculated for the second (==reference) // channel, so channels may not be changed! try { Measure(); } catch (const std::out_of_range& e) { Average.resize(0); SetSection(section_old); SetCurChIndex(channel_old); wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); return; } std::size_t alignIndex; //check whether the current index is a max or a min, //and if so, store it: switch (AlignDlg.AlignRise()) { case 0: // align to peak time if (AlignDlg.UseReference()) alignIndex = lround(GetAPMaxT()); else alignIndex = lround(GetMaxT()); break; case 1: // align to steepest slope time if (AlignDlg.UseReference()) alignIndex = lround(GetAPMaxRiseT()); else alignIndex = lround(GetMaxRiseT()); break; case 2: // align to half amplitude time if (AlignDlg.UseReference()) alignIndex = lround(GetAPT50LeftReal()); else alignIndex = lround(GetT50LeftReal()); break; case 3: // align to onset if (AlignDlg.UseReference()) alignIndex = lround(GetAPT0Real()); else alignIndex = lround(GetT0Real()); break; default: wxGetApp().ExceptMsg(wxT("Invalid alignment method")); return; } *it = alignIndex; if (alignIndex > max_index) { max_index=alignIndex; } if (alignIndex < min_index) { min_index=alignIndex; } n++; it++; } //now that max and min indices are known, calculate the number of //points that need to be shifted: for (int_it it = shift.begin(); it != shift.end(); it++) { (*it) -= (int)min_index; } //restore section and channel settings: SetSection(section_old); SetCurChIndex(channel_old); shift_size = (max_index-min_index); } //number of points in average: size_t average_size = cursec().size(); for (c_st_it sit = GetSelectedSections().begin(); sit != GetSelectedSections().end(); sit++) { if (curch().get()[*sit].size() < average_size) { average_size = curch().get()[*sit].size(); } } average_size -= shift_size; //initialize temporary sections and channels: Average.resize(size()); std::size_t n_c = 0; for (c_ch_it cit = get().begin(); cit != get().end(); cit++) { Section TempSection(average_size), TempSig(average_size); try { MakeAverage(TempSection, TempSig, n_c, GetSelectedSections(), calcSD, shift); } catch (const std::out_of_range& e) { Average.resize(0); wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); return; } TempSection.SetXScale(get()[n_c][0].GetXScale()); // set xscale for channel n_c and the only section TempSection.SetSectionDescription(stf::wx2std(GetTitle()) +std::string(", average")); Channel TempChannel(TempSection); TempChannel.SetChannelName(cit->GetChannelName()); try { Average.InsertChannel(TempChannel,n_c); } catch (const std::out_of_range& e) { Average.resize(0); wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); return; } n_c++; } Average.CopyAttributes(*this); wxString title; title << GetFilename() << wxT(", average of ") << (int)GetSelectedSections().size() << wxT(" traces"); wxGetApp().NewChild(Average,this,title); } //End of CreateAverage(.,.,.) void wxStfDoc::FitDecay(wxCommandEvent& WXUNUSED(event)) { int fselect=-2; wxStfFitSelDlg FitSelDialog(GetDocumentWindow(), this); if (FitSelDialog.ShowModal() != wxID_OK) return; wxBeginBusyCursor(); fselect=FitSelDialog.GetFSelect(); if (outOfRange(GetFitBeg()) || outOfRange(GetFitEnd())) { wxGetApp().ErrorMsg(wxT("Subscript out of range in wxStfDoc::FitDecay()")); return; } //number of parameters to be fitted: std::size_t n_params=0; //number of points: std::size_t n_points = GetFitEnd()-GetFitBeg(); if (n_points<=1) { wxGetApp().ErrorMsg(wxT("Check fit limits")); return; } std::string fitInfo; try { n_params=(int)wxGetApp().GetFuncLib().at(fselect).pInfo.size(); } catch (const std::out_of_range& e) { wxString msg(wxT("Could not retrieve function from library:\n")); msg+=wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg(msg); return; } Vector_double params ( FitSelDialog.GetInitP() ); int warning = 0; try { std::size_t fitSize = GetFitEnd() - GetFitBeg(); Vector_double x( fitSize ); //fill array: std::copy(&cursec()[GetFitBeg()], &cursec()[GetFitBeg()+fitSize], &x[0]); if (params.size() != n_params) { throw std::runtime_error("Wrong size of params in wxStfDoc::lmFit()"); } double chisqr = stfnum::lmFit( x, GetXScale(), wxGetApp().GetFuncLib()[fselect], FitSelDialog.GetOpts(), FitSelDialog.UseScaling(), params, fitInfo, warning ); SetIsFitted( GetCurChIndex(), GetCurSecIndex(), params, wxGetApp().GetFuncLibPtr(fselect), chisqr, GetFitBeg(), GetFitEnd() ); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg( wxString(e.what(), wxConvLocal) ); return; } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg( wxString(e.what(), wxConvLocal) ); return; } // Refresh the graph to show the fit before // the dialog pops up: wxStfView* pView=(wxStfView*)GetFirstView(); if (pView!=NULL && pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); wxStfFitInfoDlg InfoDialog(GetDocumentWindow(), stf::std2wx(fitInfo)); wxEndBusyCursor(); InfoDialog.ShowModal(); wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); wxString label; label << wxT("Fit, Section #") << (int)GetCurSecIndex()+1; try { pFrame->ShowTable(sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).bestFit, label); } catch (const std::out_of_range e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } } void wxStfDoc::LFit(wxCommandEvent& WXUNUSED(event)) { wxBusyCursor wc; if (outOfRange(GetFitBeg()) || outOfRange(GetFitEnd())) { wxGetApp().ErrorMsg(wxT("Subscript out of range in wxStfDoc::FitDecay()")); return; } //number of parameters to be fitted: std::size_t n_params=0; //number of points: std::size_t n_points=GetFitEnd()-GetFitBeg(); if (n_points<=1) { wxGetApp().ErrorMsg(wxT("Check fit limits")); return; } std::string fitInfo; n_params=2; Vector_double params( n_params ); //fill array: Vector_double x(n_points); std::copy(&cursec()[GetFitBeg()], &cursec()[GetFitBeg()+n_points], &x[0]); Vector_double t(x.size()); for (std::size_t n_t=0;n_tGetGraph()!=NULL) pView->GetGraph()->Refresh(); std::ostringstream fitInfoStr; fitInfoStr << wxT("slope = ") << params[0] << wxT("\n1/slope = ") << 1.0/params[0] << wxT("\ny-intercept = ") << params[1]; fitInfo += fitInfoStr.str(); wxStfFitInfoDlg InfoDialog(GetDocumentWindow(), stf::std2wx(fitInfo)); InfoDialog.ShowModal(); wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); wxString label; label << wxT("Fit, Section #") << (int)GetCurSecIndex(); try { pFrame->ShowTable(sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).bestFit, label); } catch (const std::out_of_range e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } } void wxStfDoc::LnTransform(wxCommandEvent& WXUNUSED(event)) { Channel TempChannel(GetSelectedSections().size(), get()[GetCurChIndex()][GetSelectedSections()[0]].size()); std::size_t n = 0; for (c_st_it cit = GetSelectedSections().begin(); cit != GetSelectedSections().end(); cit++) { Section TempSection(size()); std::transform(get()[GetCurChIndex()][*cit].get().begin(), get()[GetCurChIndex()][*cit].get().end(), TempSection.get_w().begin(), #if defined(_WINDOWS) && !defined(__MINGW32__) std::logl); #else (double(*)(double))log); #endif TempSection.SetXScale(get()[GetCurChIndex()][*cit].GetXScale()); TempSection.SetSectionDescription( get()[GetCurChIndex()][*cit].GetSectionDescription()+ ", transformed (ln)"); try { TempChannel.InsertSection(TempSection,n); } catch (const std::out_of_range e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } n++; } if (TempChannel.size()>0) { Recording Transformed(TempChannel); Transformed.CopyAttributes(*this); wxString title(GetTitle()); title+=wxT(", transformed (ln)"); wxGetApp().NewChild(Transformed,this,title); } } void wxStfDoc::Viewtable(wxCommandEvent& WXUNUSED(event)) { wxBusyCursor wc; try { wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); pFrame->ShowTable( CurAsTable(), stf::std2wx( cursec().GetSectionDescription() ) ); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); return; } } void wxStfDoc::Multiply(wxCommandEvent& WXUNUSED(event)) { if (GetSelectedSections().empty()) { wxGetApp().ErrorMsg(wxT("Select traces first")); return; } //insert standard values: std::vector labels(1); Vector_double defaults(labels.size()); labels[0]="Multiply with:";defaults[0]=1; stf::UserInput init(labels,defaults,"Set factor"); wxStfUsrDlg MultDialog(GetDocumentWindow(),init); if (MultDialog.ShowModal()!=wxID_OK) return; Vector_double input(MultDialog.readInput()); if (input.size()!=1) return; double factor=input[0]; try { Recording Multiplied = stfio::multiply(*this, GetSelectedSections(), GetCurChIndex(), factor); wxGetApp().NewChild(Multiplied, this, wxString(GetTitle()+wxT(", multiplied"))); } catch (const std::exception& e) { wxGetApp().ErrorMsg(wxT("Error during multiplication:\n") + stf::std2wx(e.what())); } } bool wxStfDoc::SubtractBase( ) { if (GetSelectedSections().empty()) { wxGetApp().ErrorMsg(wxT("Select traces first")); return false; } Channel TempChannel(GetSelectedSections().size(), get()[GetCurChIndex()][GetSelectedSections()[0]].size()); std::size_t n = 0; for (c_st_it cit = GetSelectedSections().begin(); cit != GetSelectedSections().end(); cit++) { Section TempSection(stfio::vec_scal_minus(get()[GetCurChIndex()][*cit].get(), GetSelectBase()[n])); TempSection.SetXScale(get()[GetCurChIndex()][*cit].GetXScale()); TempSection.SetSectionDescription( get()[GetCurChIndex()][*cit].GetSectionDescription()+ ", baseline subtracted"); try { TempChannel.InsertSection(TempSection,n); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); return false; } n++; } if (TempChannel.size()>0) { Recording SubBase(TempChannel); SubBase.CopyAttributes(*this); wxString title(GetTitle()); title+=wxT(", baseline subtracted"); wxGetApp().NewChild(SubBase,this,title); } else { wxGetApp().ErrorMsg( wxT("Channel is empty.") ); return false; } return true; } void wxStfDoc::OnAnalysisBatch(wxCommandEvent &WXUNUSED(event)) { // event.Skip(); if (GetSelectedSections().empty()) { wxGetApp().ErrorMsg(wxT("No selected traces")); return; } std::size_t section_old=GetCurSecIndex(); // wxStfBatchDlg SaveYtDialog(GetDocumentWindow()); if (SaveYtDialog.ShowModal()!=wxID_OK) return; std::vector colTitles; //Write the header of the SaveYt file in a string if (SaveYtDialog.PrintBase()) { colTitles.push_back("Base"); } if (SaveYtDialog.PrintBaseSD()) { colTitles.push_back("Base SD"); } if (SaveYtDialog.PrintThreshold()) { colTitles.push_back("Slope threshold"); } if (SaveYtDialog.PrintSlopeThresholdTime()) { colTitles.push_back("Slope threshold time"); } if (SaveYtDialog.PrintPeakZero()) { colTitles.push_back("Peak (from 0)"); } if (SaveYtDialog.PrintPeakBase()) { colTitles.push_back("Peak (from baseline)"); } if (SaveYtDialog.PrintPeakThreshold()) { colTitles.push_back("Peak (from threshold)"); } if (SaveYtDialog.PrintPeakTime()) { colTitles.push_back("Peak time"); } if (SaveYtDialog.PrintRTLoHi()) { colTitles.push_back("RT Lo-Hi%"); } if (SaveYtDialog.PrintInnerRTLoHi()) { colTitles.push_back("inner Rise Time Lo-Hi%"); } if (SaveYtDialog.PrintOuterRTLoHi()) { colTitles.push_back("Outer Rise Time Lo-Hi%"); } if (SaveYtDialog.PrintT50()) { colTitles.push_back("duration Amp/2"); } if (SaveYtDialog.PrintT50SE()) { colTitles.push_back("start Amp/2"); colTitles.push_back("end Amp/2"); } if (SaveYtDialog.PrintSlopes()) { colTitles.push_back("Max. slope rise"); colTitles.push_back("Max. slope decay"); } if (SaveYtDialog.PrintSlopeTimes()) { colTitles.push_back("Time of max. rise"); colTitles.push_back("Time of max. decay"); } if (SaveYtDialog.PrintLatencies()) { colTitles.push_back("Latency"); } int fselect=-2; std::size_t n_params=0; wxStfFitSelDlg FitSelDialog(GetDocumentWindow(), this); if (SaveYtDialog.PrintFitResults()) { while (fselect<0) { FitSelDialog.SetNoInput(true); if (FitSelDialog.ShowModal()!=wxID_OK) { SetSection(section_old); return; } fselect=FitSelDialog.GetFSelect(); } try { n_params=(int)wxGetApp().GetFuncLib().at(fselect).pInfo.size(); } catch (const std::out_of_range& e) { wxString msg(wxT("Error while retrieving function from library:\n")); msg += stf::std2wx(e.what()); wxGetApp().ExceptMsg(msg); SetSection(section_old); return; } for (std::size_t n_pf=0;n_pf(1, thrS.str()), Vector_double (1,0.0), "Set threshold"); wxStfUsrDlg myDlg( GetDocumentWindow(), Input ); if (myDlg.ShowModal()!=wxID_OK) { return; } threshold=myDlg.readInput()[0]; } wxProgressDialog progDlg( wxT("Batch analysis in progress"), wxT("Starting batch analysis"), 100, GetDocumentWindow(), wxPD_SMOOTH | wxPD_AUTO_HIDE | wxPD_APP_MODAL ); stfnum::Table table(GetSelectedSections().size(),colTitles.size()); for (std::size_t nCol=0;nColGetStartFitAtPeak()) if ( startFitAtPeak ) SetFitBeg(GetMaxT()); Vector_double params; int fitWarning = 0; if (SaveYtDialog.PrintFitResults()) { try { n_params=(int)wxGetApp().GetFuncLib().at(fselect).pInfo.size(); } catch (const std::out_of_range& e) { wxString msg(wxT("Could not retrieve function from library:\n")); msg+=wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg(msg); return; } // in this case, initialize parameters from init function, // not from user input: Vector_double x(GetFitEnd()-GetFitBeg()); //fill array: std::copy(&cursec()[GetFitBeg()], &cursec()[GetFitEnd()], &x[0]); params.resize(n_params); wxGetApp().GetFuncLib().at(fselect).init( x, GetBase(), GetPeak(), GetRTLoHi(), GetHalfDuration(), GetXScale(), params ); std::string fitInfo; try { double chisqr = stfnum::lmFit( x, GetXScale(), wxGetApp().GetFuncLib()[fselect], FitSelDialog.GetOpts(), FitSelDialog.UseScaling(), params, fitInfo, fitWarning ); SetIsFitted( GetCurChIndex(), GetCurSecIndex(), params, wxGetApp().GetFuncLibPtr(fselect), chisqr, GetFitBeg(), GetFitEnd() ); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); SetSection(section_old); return; } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); SetSection(section_old); return; } catch (const std::exception& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); SetSection(section_old); return; } } // count number of threshold crossings if needed: std::size_t n_crossings=0; if (SaveYtDialog.PrintThr()) { n_crossings= stfnum::peakIndices( cursec().get(), threshold, 0 ).size(); } std::size_t nCol=0; //Write the variables of the current channel in a string try { table.SetRowLabel(n_s, cursec().GetSectionDescription()); if (SaveYtDialog.PrintBase()) table.at(n_s,nCol++)=GetBase(); if (SaveYtDialog.PrintBaseSD()) table.at(n_s,nCol++)=GetBaseSD(); if (SaveYtDialog.PrintThreshold()) table.at(n_s,nCol++)=GetThreshold(); if (SaveYtDialog.PrintSlopeThresholdTime()) table.at(n_s,nCol++)=GetThrT()*GetXScale(); if (SaveYtDialog.PrintPeakZero()) table.at(n_s,nCol++)=GetPeak(); if (SaveYtDialog.PrintPeakBase()) table.at(n_s,nCol++)=GetPeak()-GetBase(); if (SaveYtDialog.PrintPeakThreshold()) table.at(n_s,nCol++)=GetPeak()-GetThreshold(); if (SaveYtDialog.PrintPeakTime()) table.at(n_s,nCol++)=GetPeakTime()*GetXScale(); if (SaveYtDialog.PrintRTLoHi()) table.at(n_s,nCol++)=GetRTLoHi(); if (SaveYtDialog.PrintInnerRTLoHi()) table.at(n_s,nCol++)=GetInnerRiseTime(); if (SaveYtDialog.PrintOuterRTLoHi()) table.at(n_s,nCol++)=GetOuterRiseTime(); if (SaveYtDialog.PrintT50()) table.at(n_s,nCol++)=GetHalfDuration(); if (SaveYtDialog.PrintT50SE()) { table.at(n_s,nCol++)=GetT50LeftReal()*GetXScale(); table.at(n_s,nCol++)=GetT50RightReal()*GetXScale(); } if (SaveYtDialog.PrintSlopes()) { table.at(n_s,nCol++)=GetMaxRise(); table.at(n_s,nCol++)=GetMaxDecay(); } if (SaveYtDialog.PrintSlopeTimes()) { table.at(n_s,nCol++)=GetMaxRiseT()*GetXScale(); table.at(n_s,nCol++)=GetMaxDecayT()*GetXScale(); } if (SaveYtDialog.PrintLatencies()) { table.at(n_s,nCol++)=GetLatency()*GetXScale(); } if (SaveYtDialog.PrintFitResults()) { for (std::size_t n_pf=0;n_pfShowTable(table,wxT("Batch analysis results")); } void wxStfDoc::OnAnalysisIntegrate(wxCommandEvent &WXUNUSED(event)) { double integral_s = 0.0, integral_t = 0.0; const std::string units = at(GetCurChIndex()).GetYUnits() + " * " + GetXUnits(); try { integral_s = stfnum::integrate_simpson(cursec().get(),GetFitBeg(),GetFitEnd(),GetXScale()); integral_t = stfnum::integrate_trapezium(cursec().get(),GetFitBeg(),GetFitEnd(),GetXScale()); } catch (const std::exception& e) { wxGetApp().ErrorMsg(wxString( e.what(), wxConvLocal )); return; } stfnum::Table integralTable(6,1); try { integralTable.SetRowLabel(0, "Trapezium (linear)"); integralTable.SetRowLabel(1, "Integral (from 0)"); integralTable.SetRowLabel(2, "Integral (from base)"); integralTable.SetRowLabel(3, "Simpson (quadratic)"); integralTable.SetRowLabel(4, "Integral (from 0)"); integralTable.SetRowLabel(5, "Integral (from base)"); //integralTable.SetColLabel(0, "Results"); integralTable.SetColLabel(0, units); integralTable.SetEmpty(0,0); integralTable.at(1,0) = integral_t; integralTable.at(2,0) = integral_t - (GetFitEnd()-GetFitBeg())*GetXScale()*GetBase(); integralTable.SetEmpty(3,0); integralTable.at(4,0) = integral_s; integralTable.at(5,0) = integral_s - (GetFitEnd()-GetFitBeg())*GetXScale()*GetBase(); } catch (const std::out_of_range& e) { wxGetApp().ErrorMsg(wxString( e.what(), wxConvLocal )); return; } wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); pFrame->ShowTable(integralTable,wxT("Integral")); try { Vector_double quad_p = stfnum::quad(cursec().get(), GetFitBeg(), GetFitEnd()); SetIsIntegrated(GetCurChIndex(), GetCurSecIndex(), true,GetFitBeg(),GetFitEnd(), quad_p); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } } void wxStfDoc::OnAnalysisDifferentiate(wxCommandEvent &WXUNUSED(event)) { if (GetSelectedSections().empty()) { wxGetApp().ErrorMsg(wxT("Select traces first")); return; } Channel TempChannel(GetSelectedSections().size(), get()[GetCurChIndex()][GetSelectedSections()[0]].size()); std::size_t n = 0; for (c_st_it cit = GetSelectedSections().begin(); cit != GetSelectedSections().end(); cit++) { Section TempSection( stfnum::diff( get()[GetCurChIndex()][*cit].get(), GetXScale() ) ); TempSection.SetXScale(get()[GetCurChIndex()][*cit].GetXScale()); TempSection.SetSectionDescription( get()[GetCurChIndex()][*cit].GetSectionDescription()+ ", differentiated"); try { TempChannel.InsertSection(TempSection,n); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } n++; } if (TempChannel.size()>0) { Recording Diff(TempChannel); Diff.CopyAttributes(*this); Diff[0].SetYUnits(at(GetCurChIndex()).GetYUnits()+" / ms"); wxString title(GetTitle()); title+=wxT(", differentiated"); wxGetApp().NewChild(Diff,this,title); } } bool wxStfDoc::OnNewfromselectedThis( ) { if (GetSelectedSections().empty()) { wxGetApp().ErrorMsg(wxT("Select traces first")); return false; } Channel TempChannel(GetSelectedSections().size(), get()[GetCurChIndex()][GetSelectedSections()[0]].size()); std::size_t n = 0; for (c_st_it cit = GetSelectedSections().begin(); cit != GetSelectedSections().end(); cit++) { // Multiply the valarray in Data: Section TempSection(get()[GetCurChIndex()][*cit].get()); TempSection.SetXScale(get()[GetCurChIndex()][*cit].GetXScale()); TempSection.SetSectionDescription( get()[GetCurChIndex()][*cit].GetSectionDescription()+ ", new from selected"); try { TempChannel.InsertSection(TempSection,n); } catch (const std::out_of_range e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); return false; } n++; } if (TempChannel.size()>0) { Recording Selected(TempChannel); Selected.CopyAttributes(*this); Selected[0].SetYUnits( at(GetCurChIndex()).GetYUnits() ); Selected[0].SetChannelName( at(GetCurChIndex()).GetChannelName() ); wxString title(GetTitle()); title+=wxT(", new from selected"); wxGetApp().NewChild(Selected,this,title); } else { wxGetApp().ErrorMsg( wxT("Channel is empty.") ); return false; } return true; } void wxStfDoc::Selectsome(wxCommandEvent &WXUNUSED(event)) { if (GetSelectedSections().size()>0) { wxGetApp().ErrorMsg(wxT("Unselect all")); return; } //insert standard values: std::vector labels(2); Vector_double defaults(labels.size()); labels[0]="Select every x-th trace:";defaults[0]=1; labels[1]="Starting with the y-th:";defaults[1]=1; stf::UserInput init(labels,defaults,"Select every n-th (1-based)"); wxStfUsrDlg EveryDialog(GetDocumentWindow(),init); if (EveryDialog.ShowModal()!=wxID_OK) return; Vector_double input(EveryDialog.readInput()); if (input.size()!=2) return; int everynth=(int)input[0]; int everystart=(int)input[1]; //div_t n_selected=div((int)get()[GetCurChIndex()].size(),everynth); for (int n=0; n*everynth+everystart-1 < (int)get()[GetCurChIndex()].size(); ++n) { try { SelectTrace(n*everynth+everystart-1, baseBeg, baseEnd); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg( wxString::FromAscii(e.what()) ); } } wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); pFrame->SetSelected(GetSelectedSections().size()); Focus(); } void wxStfDoc::SelectTracesOfType(wxCommandEvent &WXUNUSED(event)) { // TODO: dialog should display possible selections //insert standard values: std::vector labels(1); Vector_double defaults(labels.size()); labels[0]="Select Trace of Type";defaults[0]=1; stf::UserInput init(labels,defaults,"Select trace of type"); wxStfUsrDlg EveryDialog(GetDocumentWindow(),init); if (EveryDialog.ShowModal()!=wxID_OK) return; Vector_double input(EveryDialog.readInput()); if (input.size()!=1) return; int selTyp=(int)input[0]; for (size_t n=0; n < (int)get()[GetCurChIndex()].size(); ++n) { if (GetSectionType(n)==selTyp) SelectTrace(n, baseBeg, baseEnd); } wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); pFrame->SetSelected(GetSelectedSections().size()); Focus(); } void wxStfDoc::UnselectTracesOfType(wxCommandEvent &WXUNUSED(event)) { // TODO: dialog should display possible selections //insert standard values: std::vector labels(1); Vector_double defaults(labels.size()); labels[0]="Unselect Traces of Type";defaults[0]=1; stf::UserInput init(labels,defaults,"Unselect trace of type"); wxStfUsrDlg EveryDialog(GetDocumentWindow(),init); if (EveryDialog.ShowModal()!=wxID_OK) return; Vector_double input(EveryDialog.readInput()); if (input.size()!=1) return; int selTyp=(int)input[0]; for (int n=0; n < (int)get()[GetCurChIndex()].size(); ++n) { if (GetSectionType(n)==selTyp) UnselectTrace(n); } wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); pFrame->SetSelected(GetSelectedSections().size()); Focus(); } void wxStfDoc::Unselectsome(wxCommandEvent &WXUNUSED(event)) { if (GetSelectedSections().size() < get()[GetCurChIndex()].size()) { wxGetApp().ErrorMsg(wxT("Select all traces first")); return; } //insert standard values: std::vector labels(2); Vector_double defaults(labels.size()); labels[0]="Unselect every x-th trace:";defaults[0]=1; labels[1]="Starting with the y-th:";defaults[1]=1; stf::UserInput init(labels,defaults,"Unselect every n-th (1-based)"); wxStfUsrDlg EveryDialog(GetDocumentWindow(),init); if (EveryDialog.ShowModal()!=wxID_OK) return; Vector_double input(EveryDialog.readInput()); if (input.size()!=2) return; int everynth=(int)input[0]; int everystart=(int)input[1]; //div_t n_unselected=div((int)get()[GetCurChIndex()].size(),everynth); for (int n=0; n*everynth+everystart-1 < (int)get()[GetCurChIndex()].size(); ++n) { UnselectTrace(n*everynth+everystart-1); } wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); pFrame->SetSelected(GetSelectedSections().size()); Focus(); } void wxStfDoc::Selectall(wxCommandEvent& event) { //Make sure all traces are unselected prior to selecting them all: if ( !GetSelectedSections().empty() ) Deleteselected(event); for (int n_s=0; n_s<(int)get()[GetCurChIndex()].size(); ++n_s) { SelectTrace(n_s, baseBeg, baseEnd); } wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); pFrame->SetSelected(GetSelectedSections().size()); Focus(); } void wxStfDoc::Deleteselected(wxCommandEvent &WXUNUSED(event)) { wxStfChildFrame* pFrame=(wxStfChildFrame*)GetDocumentWindow(); if( !GetSelectedSections().empty() ) { GetSelectedSectionsW().clear(); GetSelectBaseW().clear(); //Update selected traces string in the trace navigator pFrame->SetSelected(GetSelectedSections().size()); } else { wxGetApp().ErrorMsg(wxT("No selected trace to remove")); return; } // refresh the view once we are through: if (pFrame->ShowSelected()) { wxStfView* pView=(wxStfView*)GetFirstView(); if (pView!=NULL && pView->GetGraph()!=NULL) pView->GetGraph()->Refresh(); } Focus(); } void wxStfDoc::Focus() { UpdateSelectedButton(); // refresh the view once we are through: wxStfView* pView=(wxStfView*)GetFirstView(); if (pView != NULL && pView->GetGraph() != NULL) { pView->GetGraph()->Enable(); pView->GetGraph()->SetFocus(); } } void wxStfDoc::UpdateSelectedButton() { // control whether trace has been selected: bool selected=false; for (c_st_it cit = GetSelectedSections().begin(); cit != GetSelectedSections().end() && !selected; ++cit) { if (*cit == GetCurSecIndex()) { selected = true; } } // Set status of selection button: wxStfParentFrame* parentFrame = GetMainFrame(); if (parentFrame) { parentFrame->SetSelectedButton( selected ); } } void wxStfDoc::Filter(wxCommandEvent& WXUNUSED(event)) { #ifndef TEST_MINIMAL if (GetSelectedSections().empty()) { wxGetApp().ErrorMsg(wxT("No traces selected")); return; } //--For details on the Fast Fourier Transform see NR in C++, chapters 12 and 13 std::vector windowLabels(2); Vector_double windowDefaults(windowLabels.size()); windowLabels[0]="From point #:";windowDefaults[0]=0; windowLabels[1]="To point #:";windowDefaults[1]=(int)cursec().size()-1; stf::UserInput initWindow(windowLabels,windowDefaults,"Filter window"); wxStfUsrDlg FilterWindowDialog(GetDocumentWindow(),initWindow); if (FilterWindowDialog.ShowModal()!=wxID_OK) return; Vector_double windowInput(FilterWindowDialog.readInput()); if (windowInput.size()!=2) return; int llf=(int)windowInput[0]; int ulf=(int)windowInput[1]; wxStfFilterSelDlg FilterSelectDialog(GetDocumentWindow()); if (FilterSelectDialog.ShowModal()!=wxID_OK) return; int fselect=FilterSelectDialog.GetFilterSelect(); int size=0; bool inverse=true; switch (fselect) { case 1: size=3; break; case 2: case 3: size=1; break; } wxStfGaussianDlg FftDialog(GetDocumentWindow()); Vector_double a(size); switch (fselect) { case 1: if (FftDialog.ShowModal()!=wxID_OK) return; a[0]=(int)(FftDialog.Amp()*100000.0)/100000.0; /*amplitude from 0 to 1*/ a[1]=(int)(FftDialog.Center()*100000.0)/100000.0; /*center in kHz*/ a[2]=(int)(FftDialog.Width()*100000.0)/100000.0; /*width in kHz*/ break; case 2: case 3: { //insert standard values: std::vector labels(1); Vector_double defaults(labels.size()); labels[0]="Cutoff frequency (kHz):"; defaults[0]=10; stf::UserInput init(labels,defaults,"Set frequency"); wxStfUsrDlg FilterHighLowDialog(GetDocumentWindow(),init); if (FilterHighLowDialog.ShowModal()!=wxID_OK) return; Vector_double input(FilterHighLowDialog.readInput()); if (input.size()!=1) return; a[0]=(int)(input[0]*100000.0)/100000.0; /*midpoint of sigmoid curve in kHz*/ break; } } wxBusyCursor wc; //--I. Defining the parameters of the filter function /*sampling interval in ms*/ Channel TempChannel(GetSelectedSections().size(), get()[GetCurChIndex()][GetSelectedSections()[0]].size()); std::size_t n = 0; for (c_st_it cit = GetSelectedSections().begin(); cit != GetSelectedSections().end(); cit++) { try { switch (fselect) { case 3: { Section FftTemp(stfnum::filter(get()[GetCurChIndex()][*cit].get(), llf,ulf,a,(int)GetSR(),stfnum::fgaussColqu,false)); FftTemp.SetXScale(get()[GetCurChIndex()][*cit].GetXScale()); FftTemp.SetSectionDescription( get()[GetCurChIndex()][*cit].GetSectionDescription()+ ", filtered"); TempChannel.InsertSection(FftTemp, n); break; } case 2: { Section FftTemp(stfnum::filter(get()[GetCurChIndex()][*cit].get(), llf,ulf,a,(int)GetSR(),stfnum::fbessel4,false)); FftTemp.SetXScale(get()[GetCurChIndex()][*cit].GetXScale()); FftTemp.SetSectionDescription( get()[GetCurChIndex()][*cit].GetSectionDescription()+ ", filtered" ); TempChannel.InsertSection(FftTemp, n); break; } case 1: { Section FftTemp(stfnum::filter(get()[GetCurChIndex()][*cit].get(), llf,ulf,a,(int)GetSR(),stfnum::fgauss,inverse)); FftTemp.SetXScale(get()[GetCurChIndex()][*cit].GetXScale()); FftTemp.SetSectionDescription( get()[GetCurChIndex()][*cit].GetSectionDescription()+ std::string(", filtered") ); TempChannel.InsertSection(FftTemp, n); break; } } } catch (const std::exception& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } n++; } if (TempChannel.size()>0) { Recording Fft(TempChannel); Fft.CopyAttributes(*this); wxGetApp().NewChild(Fft, this,GetTitle()+wxT(", filtered")); } #endif } void wxStfDoc::P_over_N(wxCommandEvent& WXUNUSED(event)){ //insert standard values: std::vector labels(1); Vector_double defaults(labels.size()); labels[0]="N = (mind polarity!)";defaults[0]=-4; stf::UserInput init(labels,defaults,"P over N"); wxStfUsrDlg PonDialog(GetDocumentWindow(),init); if (PonDialog.ShowModal()!=wxID_OK) return; Vector_double input(PonDialog.readInput()); if (input.size()!=1) return; int PoN=(int)fabs(input[0]); int ponDirection=input[0]<0? -1:1; int new_sections=(int)get()[GetCurChIndex()].size()/(PoN+1); if (new_sections<1) { wxGetApp().ErrorMsg(wxT("Not enough traces for P/n correction")); return; } //File dialog box wxBusyCursor wc; Channel TempChannel(new_sections); //read and PoN for (int n_section=0; n_section < new_sections; n_section++) { //Section loop Section TempSection(get()[GetCurChIndex()][n_section].size()); TempSection.SetXScale(get()[GetCurChIndex()][n_section].GetXScale()); for (int n_point=0; n_point < (int)get()[GetCurChIndex()][n_section].size(); n_point++) TempSection[n_point]=0.0; //Addition of the PoN-values: for (int n_PoN=1; n_PoN < PoN+1; n_PoN++) for (int n_point=0; n_point < (int)get()[GetCurChIndex()][n_section].size(); n_point++) TempSection[n_point] += get()[GetCurChIndex()][n_PoN+(n_section*(PoN+1))][n_point]; //Subtraction from the original values: for (int n_point=0; n_point < (int)get()[GetCurChIndex()][n_section].size(); n_point++) TempSection[n_point] = get()[GetCurChIndex()][n_section*(PoN+1)][n_point]- TempSection[n_point]*ponDirection; std::ostringstream povernLabel; povernLabel << GetTitle() << ", #" << n_section << ", P over N"; TempSection.SetSectionDescription(povernLabel.str()); try { TempChannel.InsertSection(TempSection,n_section); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } } if (TempChannel.size()>0) { Recording DataPoN(TempChannel); DataPoN.CopyAttributes(*this); wxGetApp().NewChild(DataPoN,this,GetTitle()+wxT(", p over n subtracted")); } } void wxStfDoc::Plotextraction(stf::extraction_mode mode) { std::vector sectionList(wxGetApp().GetSectionsWithFits()); if (sectionList.empty()) { wxGetApp().ErrorMsg( wxT("You have to create a template first\nby fitting a function to an event") ); return; } wxStfEventDlg MiniDialog(GetDocumentWindow(), sectionList, false); if (MiniDialog.ShowModal()!=wxID_OK) { return; } int nTemplate=MiniDialog.GetTemplate(); try { Vector_double templateWave( sectionList.at(nTemplate).sec_attr.storeFitEnd - sectionList.at(nTemplate).sec_attr.storeFitBeg); for ( std::size_t n_p=0; n_p < templateWave.size(); n_p++ ) { templateWave[n_p] = sectionList.at(nTemplate).sec_attr.fitFunc->func( n_p*GetXScale(), sectionList.at(nTemplate).sec_attr.bestFitP); } wxBusyCursor wc; #undef min #undef max // subtract offset and normalize: double fmax = *std::max_element(templateWave.begin(), templateWave.end()); double fmin = *std::min_element(templateWave.begin(), templateWave.end()); templateWave = stfio::vec_scal_minus(templateWave, fmax); double minim=fabs(fmin); templateWave = stfio::vec_scal_div(templateWave, minim); std::string section_description, window_title; Section TempSection(cursec().get().size()); switch (mode) { case stf::criterion: { stf::wxProgressInfo progDlg("Computing detection criterion...", "Computing detection criterion...", 100); TempSection = Section(stfnum::detectionCriterion( cursec().get(), templateWave, progDlg)); section_description = "Detection criterion of "; window_title = ", detection criterion"; break; } case stf::correlation: { stf::wxProgressInfo progDlg("Computing linear correlation...", "Computing linear correlation...", 100); TempSection = Section(stfnum::linCorr(cursec().get(), templateWave, progDlg)); section_description = "Template correlation of "; window_title = ", linear correlation"; break; } case stf::deconvolution: std::string usrInStr[2] = {"Lowpass (kHz)", "Highpass (kHz)"}; double usrInDbl[2] = {0.5, 0.0001}; stf::UserInput Input( std::vector(usrInStr, usrInStr+2), Vector_double (usrInDbl, usrInDbl+2), "Filter settings" ); wxStfUsrDlg myDlg( GetDocumentWindow(), Input ); if (myDlg.ShowModal()!=wxID_OK) return; Vector_double filter = myDlg.readInput(); stf::wxProgressInfo progDlg("Computing deconvolution...", "Starting deconvolution...", 100); TempSection = Section(stfnum::deconvolve(cursec().get(), templateWave, (int)GetSR(), filter[1], filter[0], progDlg)); section_description = "Template deconvolution from "; window_title = ", deconvolution"; break; } if (TempSection.size()==0) return; TempSection.SetXScale(cursec().GetXScale()); TempSection.SetSectionDescription(section_description + cursec().GetSectionDescription()); Channel TempChannel(TempSection); Recording detCrit(TempChannel); detCrit.CopyAttributes(*this); wxGetApp().NewChild(detCrit, this, GetTitle() + stf::std2wx(window_title)); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } catch (const std::exception& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } } void wxStfDoc::Plotcriterion(wxCommandEvent& WXUNUSED(event)) { Plotextraction(stf::criterion); } void wxStfDoc::Plotcorrelation(wxCommandEvent& WXUNUSED(event)) { Plotextraction(stf::correlation); } void wxStfDoc::Plotdeconvolution(wxCommandEvent& WXUNUSED(event)) { Plotextraction(stf::deconvolution); } void wxStfDoc::MarkEvents(wxCommandEvent& WXUNUSED(event)) { std::vector sectionList(wxGetApp().GetSectionsWithFits()); if (sectionList.empty()) { wxGetApp().ErrorMsg( wxT( "You have to create a template first\nby fitting a function to an event" ) ); return; } wxStfEventDlg MiniDialog( GetDocumentWindow(), sectionList, true ); if ( MiniDialog.ShowModal()!=wxID_OK ) { return; } int nTemplate=MiniDialog.GetTemplate(); try { Vector_double templateWave( sectionList.at(nTemplate).sec_attr.storeFitEnd - sectionList.at(nTemplate).sec_attr.storeFitBeg); for ( std::size_t n_p=0; n_p < templateWave.size(); n_p++ ) { templateWave[n_p] = sectionList.at(nTemplate).sec_attr.fitFunc->func( n_p*GetXScale(), sectionList.at(nTemplate).sec_attr.bestFitP); } wxBusyCursor wc; #undef min #undef max // subtract offset and normalize: double fmax = *std::max_element(templateWave.begin(), templateWave.end()); double fmin = *std::min_element(templateWave.begin(), templateWave.end()); templateWave = stfio::vec_scal_minus(templateWave, fmax); double minim=fabs(fmin); templateWave = stfio::vec_scal_div(templateWave, minim); Vector_double detect( cursec().get().size() - templateWave.size() ); switch (MiniDialog.GetMode()) { case stf::criterion: { stf::wxProgressInfo progDlg("Computing detection criterion...", "Computing detection criterion...", 100); detect=stfnum::detectionCriterion(cursec().get(), templateWave, progDlg); break; } case stf::correlation: { stf::wxProgressInfo progDlg("Computing linear correlation...", "Computing linear correlation...", 100); detect=stfnum::linCorr(cursec().get(), templateWave, progDlg); break; } case stf::deconvolution: std::string usrInStr[2] = {"Lowpass (kHz)", "Highpass (kHz)"}; double usrInDbl[2] = {0.5, 0.0001}; stf::UserInput Input( std::vector(usrInStr, usrInStr+2), Vector_double (usrInDbl, usrInDbl+2), "Filter settings" ); wxStfUsrDlg myDlg( GetDocumentWindow(), Input ); if (myDlg.ShowModal()!=wxID_OK) return; Vector_double filter = myDlg.readInput(); stf::wxProgressInfo progDlg("Computing deconvolution...", "Starting deconvolution...", 100); detect=stfnum::deconvolve(cursec().get(), templateWave, (int)GetSR(), filter[1], filter[0], progDlg); break; } if (detect.empty()) { wxGetApp().ErrorMsg(wxT("Error: Detection criterion is empty.")); return; } std::vector startIndices( stfnum::peakIndices( detect, MiniDialog.GetThreshold(), MiniDialog.GetMinDistance() ) ); if (startIndices.empty()) { wxGetApp().ErrorMsg( wxT( "No events were found. Try to lower the threshold." ) ); return; } // erase old events: ClearEvents(GetCurChIndex(), GetCurSecIndex()); wxStfView* pView = (wxStfView*)GetFirstView(); wxStfGraph* pGraph = pView->GetGraph(); for (c_int_it cit = startIndices.begin(); cit != startIndices.end(); ++cit ) { sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).eventList.push_back( stf::Event( *cit, 0, templateWave.size(), new wxCheckBox( pGraph, -1, wxEmptyString) ) ); // Find peak in this event: double baselineMean=0; for ( int n_mean = *cit-baseline; n_mean < *cit; ++n_mean ) { if (n_mean < 0) { baselineMean += cursec().at(0); } else { baselineMean += cursec().at(n_mean); } } baselineMean /= baseline; double peakIndex=0; int eventl = templateWave.size(); if (*cit + eventl >= cursec().get().size()) { eventl = cursec().get().size()-1- (*cit); } stfnum::peak( cursec().get(), baselineMean, *cit, *cit + eventl, 1, stfnum::both, peakIndex ); if (peakIndex != peakIndex || peakIndex < 0 || peakIndex >= cursec().get().size()) { throw std::runtime_error("Error during peak detection (result is NAN)\n"); } // set peak index of this event: sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).eventList.back().SetEventPeakIndex((int)peakIndex); } if (pGraph != NULL) { pGraph->Refresh(); } } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg( wxString( e.what(), wxConvLocal )); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg( wxString( e.what(), wxConvLocal )); } catch (const std::exception& e) { wxGetApp().ExceptMsg( wxString( e.what(), wxConvLocal )); } } void wxStfDoc::Extract( wxCommandEvent& WXUNUSED(event) ) { try { stfnum::Table events(GetCurrentSectionAttributes().eventList.size(), 2); events.SetColLabel(0, "Time of event onset"); events.SetColLabel(1, "Inter-event interval"); // using the peak indices (these are the locations of the beginning of an optimal // template matching), new sections are created: // count non-discarded events: std::size_t n_real = 0; for (c_event_it cit = GetCurrentSectionAttributes().eventList.begin(); cit != GetCurrentSectionAttributes().eventList.end(); ++cit) { n_real += (int)(!cit->GetDiscard()); } Channel TempChannel2(n_real); std::vector peakIndices(n_real); n_real = 0; c_event_it lastEventIt = GetCurrentSectionAttributes().eventList.begin(); for (c_event_it it = GetCurrentSectionAttributes().eventList.begin(); it != GetCurrentSectionAttributes().eventList.end(); ++it) { if (!it->GetDiscard()) { wxString miniName; miniName << wxT( "Event #" ) << (int)n_real+1; events.SetRowLabel(n_real, stf::wx2std(miniName)); events.at(n_real,0) = (double)it->GetEventStartIndex() / GetSR(); events.at(n_real,1)= ((double)(it->GetEventStartIndex() - lastEventIt->GetEventStartIndex())) / GetSR(); // add some baseline at the beginning and end: std::size_t eventSize = it->GetEventSize() + 2*baseline; Section TempSection2( eventSize ); for ( std::size_t n_new = 0; n_new < eventSize; ++n_new ) { // make sure index is not out of range: int index = it->GetEventStartIndex() + n_new - baseline; if (index < 0) index = 0; if (index >= (int)cursec().size()) index = cursec().size()-1; TempSection2[n_new] = cursec()[index]; } std::ostringstream eventDesc; eventDesc << "Extracted event #" << (int)n_real; TempSection2.SetSectionDescription(eventDesc.str()); TempSection2.SetXScale(get()[GetCurChIndex()][GetCurSecIndex()].GetXScale()); TempChannel2.InsertSection( TempSection2, n_real ); n_real++; lastEventIt = it; } } if (TempChannel2.size()>0) { Recording Minis( TempChannel2 ); Minis.CopyAttributes( *this ); wxStfDoc* pDoc=wxGetApp().NewChild( Minis, this, GetTitle()+wxT(", extracted events") ); if (pDoc != NULL) { wxStfChildFrame* pChild=(wxStfChildFrame*)pDoc->GetDocumentWindow(); if (pChild!=NULL) { pChild->ShowTable(events,wxT("Extracted events")); } } } } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } catch (const std::exception& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } } void wxStfDoc::InteractiveEraseEvents( wxCommandEvent& WXUNUSED(event) ) { if (wxMessageDialog( GetDocumentWindow(), wxT("Do you really want to erase all events?"), wxT("Erase all events"), wxYES_NO ).ShowModal()==wxID_YES) { try { ClearEvents(GetCurChIndex(), GetCurSecIndex()); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } } } void wxStfDoc::AddEvent( wxCommandEvent& WXUNUSED(event) ) { try { // retrieve the position where to add the event: wxStfView* pView = (wxStfView*)GetFirstView(); wxStfGraph* pGraph = pView->GetGraph(); int newStartPos = pGraph->get_eventPos(); stf::Event newEvent(newStartPos, 0, GetCurrentSectionAttributes().eventList.at(0).GetEventSize(), new wxCheckBox(pGraph, -1, wxEmptyString)); // Find peak in this event: double baselineMean=0; for ( int n_mean = newStartPos - baseline; n_mean < newStartPos; ++n_mean ) { if (n_mean < 0) { baselineMean += cursec().at(0); } else { baselineMean += cursec().at(n_mean); } } baselineMean /= baseline; double peakIndex=0; stfnum::peak( cursec().get(), baselineMean, newStartPos, newStartPos + GetCurrentSectionAttributes().eventList.at(0).GetEventSize(), 1, stfnum::both, peakIndex ); // set peak index of last event: newEvent.SetEventPeakIndex( (int)peakIndex ); // find the position in the current event list where the new // event should be inserted: bool found = false; for (event_it it = sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).eventList.begin(); it != sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).eventList.end(); ++it) { if ( (int)(it->GetEventStartIndex()) > newStartPos ) { // insert new event before this event, then break: sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).eventList.insert( it, newEvent ); found = true; break; } } // if we are at the end of the list, append the event: if (!found) sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).eventList.push_back( newEvent ); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } catch (const std::exception& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); } } void wxStfDoc::Threshold(wxCommandEvent& WXUNUSED(event)) { // get threshold from user input: Vector_double threshold(0); std::ostringstream thrS; thrS << "Threshold (" << at(GetCurChIndex()).GetYUnits() << ")"; stf::UserInput Input( std::vector(1, thrS.str()), Vector_double (1,0.0), "Set threshold" ); wxStfUsrDlg myDlg( GetDocumentWindow(), Input ); if (myDlg.ShowModal()!=wxID_OK) { return; } threshold=myDlg.readInput(); std::vector startIndices( stfnum::peakIndices( cursec().get(), threshold[0], 0 ) ); if (startIndices.empty()) { wxGetApp().ErrorMsg( wxT("Couldn't find any events;\ntry again with lower threshold") ); } // clear table from previous detection wxStfView* pView=(wxStfView*)GetFirstView(); wxStfGraph* pGraph = pView->GetGraph(); sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).eventList.clear(); for (c_int_it cit = startIndices.begin(); cit != startIndices.end(); ++cit) { sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()).eventList.push_back( stf::Event(*cit, 0, baseline, new wxCheckBox(pGraph, -1, wxEmptyString))); } // show results in a table: stfnum::Table events(GetCurrentSectionAttributes().eventList.size(),2); events.SetColLabel( 0, "Time of event peak"); events.SetColLabel( 1, "Inter-event interval"); std::size_t n_event = 0; c_event_it lastEventCit = GetCurrentSectionAttributes().eventList.begin(); for (c_event_it cit2 = GetCurrentSectionAttributes().eventList.begin(); cit2 != GetCurrentSectionAttributes().eventList.end(); ++cit2) { wxString eventName; eventName << wxT("Event #") << (int)n_event+1; events.SetRowLabel(n_event, stf::wx2std(eventName)); events.at(n_event,0)= (double)cit2->GetEventStartIndex() / GetSR(); events.at(n_event,1)= ((double)(cit2->GetEventStartIndex() - lastEventCit->GetEventStartIndex()) ) / GetSR(); n_event++; lastEventCit = cit2; } wxStfChildFrame* pChild=(wxStfChildFrame*)GetDocumentWindow(); if (pChild!=NULL) { pChild->ShowTable(events,wxT("Extracted events")); } } //Function calculates the peak and respective measures: base, Lo/Hi rise time //half duration, ratio of rise/slope and maximum slope void wxStfDoc::Measure( ) { double var=0.0; if (cursec().get().size() == 0) return; try { cursec().at(0); } catch (const std::out_of_range&) { return; } long windowLength = 1; /* windowLength (defined in samples) determines the size of the window for computing slopes. if the window length larger than 1 is used, a kind of smoothing and low pass filtering is applied. If slope estimates from data with different sampling rates should be compared, the window should be choosen in such a way that the length in milliseconds is approximately the same. This reduces some variability, the slope estimates are more robust and comparible. Set window length to 0.05 ms, with a minimum of 1 sample. In this way, all data sampled with 20 kHz or lower, will use a 1 sample window, data with a larger sampling rate use a window of 0.05 ms for computing the slope. */ windowLength = lround(0.05 * GetSR()); // use window length of about 0.05 ms. if (windowLength < 1) windowLength = 1; // use a minimum window length of 1 sample //Begin peak and base calculation //------------------------------- try { base=stfnum::base(baselineMethod,var,cursec().get(),baseBeg,baseEnd); baseSD=sqrt(var); peak=stfnum::peak(cursec().get(),base, peakBeg,peakEnd,pM,direction,maxT); } catch (const std::out_of_range& e) { base=0.0; baseSD=0.0; peak=0.0; throw e; } try { threshold = stfnum::threshold( cursec().get(), peakBeg, peakEnd, slopeForThreshold/GetSR(), thrT, windowLength ); } catch (const std::out_of_range& e) { threshold = 0; throw e; } //Begin Lo to Hi% Rise Time calculation //------------------------------------- // 2009-06-05: reference is either from baseline or from threshold double reference = base; if (!fromBase && thrT >= 0) { reference = threshold; } double ampl=peak-reference; tLoReal=0.0; double factor= RTFactor*0.01; /* normalized value */ InnerLoRT=NAN; InnerHiRT=NAN; OuterLoRT=NAN; OuterHiRT=NAN; try { // 2008-04-27: changed limits to start from the beginning of the trace // 2013-06-16: changed to accept different rise-time proportions rtLoHi=stfnum::risetime2(cursec().get(),reference,ampl, (double)0/*(double)baseEnd*/, maxT, factor/*0.2*/, InnerLoRT, InnerHiRT, OuterLoRT, OuterHiRT); InnerLoRT/=GetSR(); InnerHiRT/=GetSR(); OuterLoRT/=GetSR(); OuterHiRT/=GetSR(); } catch (const std::out_of_range& e) { throw e; } try { // 2008-04-27: changed limits to start from the beginning of the trace // 2013-06-16: changed to accept different rise-time proportions rtLoHi=stfnum::risetime(cursec().get(),reference,ampl, (double)0/*(double)baseEnd*/, maxT, factor/*0.2*/, tLoIndex, tHiIndex, tLoReal); } catch (const std::out_of_range& e) { rtLoHi=0.0; throw e; } tHiReal=tLoReal+rtLoHi; rtLoHi/=GetSR(); //Begin Half Duration calculation //------------------------------- //t50LeftReal=0.0; // 2008-04-27: changed limits to start from the beginning of the trace // and to stop at the end of the trace halfDuration = stfnum::t_half(cursec().get(), reference, ampl, (double)0 /*(double)baseBeg*/, (double)cursec().size()-1 /*(double)peakEnd*/,maxT, t50LeftIndex, t50RightIndex, t50LeftReal); t50RightReal=t50LeftReal+halfDuration; halfDuration/=GetSR(); t50Y=0.5*ampl + reference; //Calculate the beginning of the event by linear extrapolation: if (latencyEndMode==stf::footMode) { t0Real=tLoReal-(tHiReal-tLoReal)/3.0; // using 20-80% rise time (f/(1-2f) = 0.2/(1-0.4) = 1/3.0) } else { t0Real=t50LeftReal; } //Begin Ratio of slopes rise/decay calculation //-------------------------------------------- double left_rise = peakBeg; maxRise=stfnum::maxRise(cursec().get(),left_rise,maxT,maxRiseT,maxRiseY,windowLength); double t_half_3=t50RightIndex+2.0*(t50RightIndex-t50LeftIndex); double right_decay=peakEnd<=t_half_3 ? peakEnd : t_half_3+1; maxDecay=stfnum::maxDecay(cursec().get(),maxT,right_decay,maxDecayT,maxDecayY,windowLength); //Slope ratio if (maxDecay !=0) slopeRatio=maxRise/maxDecay; else slopeRatio=0.0; maxRise *= GetSR(); maxDecay *= GetSR(); if (size()>1) { //Calculate the absolute peak of the (AP) Ch2 inbetween the peak boundaries //A direction dependent evaluation of the peak as in Ch1 does NOT exist!! // endResting is set to 100 points arbitrarily in the pascal version // (see measlib.pas) assuming that the resting potential is stable // during the first 100 sampling points. // const int endResting=100; const int searchRange=100; double APBase=0.0, APVar=0.0; try { // in 2012-11-02: use baseline cursors and not arbitrarily 100 points //APBase=stfnum::base(APVar,secsec().get(),0,endResting); APBase=stfnum::base(baselineMethod,APVar,secsec().get(), baseBeg, baseEnd ); // use baseline cursors //APPeak=stfnum::peak(secsec().get(),APBase,peakBeg,peakEnd,pM,stfnum::up,APMaxT); APPeak=stfnum::peak( secsec().get(),APBase ,peakBeg ,peakEnd ,pM,direction ,APMaxT ); } catch (const std::out_of_range& e) { APBase=0.0; APPeak=0.0; throw e; } //------------------------------- //Maximal slope in the rise before the peak //---------------------------- APMaxRiseT=0.0; APMaxRiseY=0.0; double left_APRise = peakBeg; //if (GetLatencyWindowMode() == stf::defaultMode ) { left_APRise= APMaxT-searchRange>2.0 ? APMaxT-searchRange : 2.0; try { stfnum::maxRise(secsec().get(),left_APRise,APMaxT,APMaxRiseT,APMaxRiseY,windowLength); } catch (const std::out_of_range&) { APMaxRiseT=0.0; APMaxRiseY=0.0; left_APRise = peakBeg; } //End determination of the region of maximal slope in the second channel //---------------------------- //------------------------------- //Half-maximal amplitude //---------------------------- //APt50LeftReal=0.0; //std::size_t APt50LeftIndex,APt50RightIndex; stfnum::t_half(secsec().get(), APBase, APPeak-APBase, left_APRise, (double)secsec().get().size(), APMaxT, APt50LeftIndex, APt50RightIndex, APt50LeftReal); //End determination of the region of maximal slope in the second channel //---------------------------- // Get onset in 2nd channel APrtLoHi=stfnum::risetime(secsec().get(), APBase, APPeak-APBase, (double)0, APMaxT, 0.2, APtLoIndex, APtHiIndex, APtLoReal); APtHiReal = APtLoReal + APrtLoHi; APt0Real = APtLoReal-(APtHiReal-APtLoReal)/3.0; // using 20-80% rise time (f/(1-2f) = 0.2/(1-0.4) = 1/3.0) } // get and set start of latency measurement: double latStart=0.0; switch (latencyStartMode) { // Interestingly, latencyCursor is an int in pascal, although // the maxTs aren't. That's why there are double type casts // here. case stf::peakMode: //Latency cursor is set to the peak latStart=APMaxT; break; case stf::riseMode: latStart=APMaxRiseT; break; case stf::halfMode: latStart=APt50LeftReal; break; case stf::manualMode: default: latStart=GetLatencyBeg(); break; } SetLatencyBeg(latStart); APt0Real = tLoReal-(tHiReal-tLoReal)/3.0; // using 20-80% rise time (f/(1-2f) = 0.2/(1-0.4) = 1/3.0) // get and set end of latency measurement: double latEnd=0.0; switch (latencyEndMode) { // Interestingly, latencyCursor is an int in pascal, although // the maxTs aren't. That's why there are double type casts // here. case stf::footMode: latEnd=tLoReal-(tHiReal-tLoReal)/3.0; // using 20-80% rise time (f/(1-2f) = 0.2/(1-0.4) = 1/3.0) break; case stf::riseMode: latEnd=maxRiseT; break; case stf::halfMode: latEnd=t50LeftReal; break; case stf::peakMode: latEnd=maxT; break; case stf::manualMode: default: latEnd=GetLatencyEnd(); break; } SetLatencyEnd(latEnd); SetLatency(GetLatencyEnd()-GetLatencyBeg()); #ifdef WITH_PSLOPE //------------------------------------- // Begin PSlope calculation (PSP Slope) //------------------------------------- // int PSlopeBegVal; switch (pslopeBegMode) { case stf::psBeg_footMode: // Left PSlope to commencement PSlopeBegVal = (int)(tLoReal-(tHiReal-tLoReal)/3.0); break; case stf::psBeg_thrMode: // Left PSlope to threshold PSlopeBegVal = (int)thrT; break; case stf::psBeg_t50Mode: // Left PSlope to the t50 PSlopeBegVal = (int)t50LeftReal; break; case stf::psBeg_manualMode: // Left PSlope cursor manual default: PSlopeBegVal = PSlopeBeg; } SetPSlopeBeg(PSlopeBegVal); int PSlopeEndVal; switch (pslopeEndMode) { case stf::psEnd_t50Mode: // Right PSlope to t50rigth PSlopeEndVal = (int)t50LeftReal; break; case stf::psEnd_peakMode: // Right PSlope to peak PSlopeEndVal = (int)maxT; break; case stf::psEnd_DeltaTMode: // Right PSlope to DeltaT time from first peak PSlopeEndVal = (int)(PSlopeBeg + DeltaT); break; case stf::psEnd_manualMode: default: PSlopeEndVal = PSlopeEnd; } SetPSlopeEnd(PSlopeEndVal); try { PSlope = (stfnum::pslope(cursec().get(), PSlopeBeg, PSlopeEnd))*GetSR(); } catch (const std::out_of_range& e) { PSlope = 0.0; throw e; } //----------------------------------- // End PSlope calculation (PSP Slope) //----------------------------------- #endif // WITH_PSLOPE //-------------------------- } //End of Measure(,,,,,) void wxStfDoc::CopyCursors(const wxStfDoc& c_Recording) { measCursor=c_Recording.measCursor; correctRangeR(measCursor); baseBeg=c_Recording.baseBeg; correctRangeR(baseBeg); baseEnd=c_Recording.baseEnd; correctRangeR(baseEnd); peakBeg=c_Recording.peakBeg; correctRangeR(peakBeg); peakEnd=c_Recording.peakEnd; correctRangeR(peakEnd); fitBeg=c_Recording.fitBeg; correctRangeR(fitBeg); fitEnd=c_Recording.fitEnd; correctRangeR(fitEnd); #ifdef WITH_PSLOPE PSlopeBeg = c_Recording.PSlopeBeg; // PSlope left cursor correctRangeR(PSlopeBeg); PSlopeEnd = c_Recording.PSlopeEnd; // PSlope right cursor correctRangeR(PSlopeEnd); DeltaT=c_Recording.DeltaT; //distance (number of points) from first cursor #endif pM=c_Recording.pM; //peakMean, number of points used for averaging } void wxStfDoc::SetLatencyStartMode(int value) { switch (value) { case 1: latencyStartMode=stf::peakMode; break; case 2: latencyStartMode=stf::riseMode; break; case 3: latencyStartMode=stf::halfMode; break; case 4: latencyStartMode=stf::footMode; break; case 0: default: latencyStartMode=stf::manualMode; } } void wxStfDoc::SetLatencyEndMode(int value) { switch (value) { case 1: latencyEndMode=stf::peakMode; break; case 2: latencyEndMode=stf::riseMode; break; case 3: latencyEndMode=stf::halfMode; break; case 4: latencyEndMode=stf::footMode; break; case 0: default: latencyEndMode=stf::manualMode; } } void wxStfDoc::SetLatencyWindowMode(int value) { if ( value == 1 ) { latencyWindowMode = stf::windowMode; } else { latencyWindowMode = stf::defaultMode; } } void wxStfDoc::correctRangeR(int& value) { if (value<0) { value=0; return; } if (value>=(int)cursec().size()) { value=(int)cursec().size()-1; return; } } void wxStfDoc::correctRangeR(std::size_t& value) { if (value>=cursec().size()) { value=cursec().size()-1; return; } } void wxStfDoc::SetMeasCursor(int value) { correctRangeR(value); measCursor=value; } double wxStfDoc::GetMeasValue() { if (measCursor>=curch().size()) { correctRangeR(measCursor); } return cursec().at(measCursor); } void wxStfDoc::SetBaseBeg(int value) { correctRangeR(value); baseBeg=value; } void wxStfDoc::SetBaseEnd(int value) { correctRangeR(value); baseEnd=value; } void wxStfDoc::SetPeakBeg(int value) { correctRangeR(value); peakBeg=value; } void wxStfDoc::SetPeakEnd(int value) { correctRangeR(value); peakEnd=value; } void wxStfDoc::SetFitBeg(int value) { correctRangeR(value); fitBeg=value; } void wxStfDoc::SetFitEnd(int value) { correctRangeR(value); fitEnd=value; } void wxStfDoc::SetLatencyBeg(double value) { if (value<0.0) { value=0.0; } if (value>=(double)cursec().size()) { value=cursec().size()-1.0; } latencyStartCursor=value; } void wxStfDoc::SetLatencyEnd(double value) { if (value<0.0) { value=0.0; } if (value>=(double)cursec().size()) { value=cursec().size()-1.0; } latencyEndCursor=value; } void wxStfDoc::SetRTFactor(int value) { if (value < 0){ value = 5; } else if (value > 50) { value = 45; } RTFactor = value; } #ifdef WITH_PSLOPE void wxStfDoc::SetPSlopeBeg(int value) { correctRangeR(value); PSlopeBeg = value; } void wxStfDoc::SetPSlopeEnd(int value) { correctRangeR(value); PSlopeEnd = value; } #endif stfnum::Table wxStfDoc::CurAsTable() const { stfnum::Table table(cursec().size(),size()); try { for (std::size_t nRow=0;nRow= 0) { table.at(0,nCol) = GetPeak()-GetThreshold(); } else { table.at(0,nCol) = 0; } if (viewCursors) { table.at(1,nCol)=GetPeakBeg()*GetXScale(); table.at(2,nCol)=GetPeakEnd()*GetXScale(); } nCol++; } // RT (Lo-Hi%) if (viewRTLoHi) {table.at(0,nCol)=GetRTLoHi(); if (viewCursors) { table.at(1,nCol)=GetTLoReal()*GetXScale(); table.at(2,nCol)=GetTHiReal()*GetXScale(); } nCol++; } if (viewInnerRiseTime) { table.at(0,nCol)=GetInnerRiseTime(); if (viewCursors) { table.at(1,nCol)=GetInnerLoRT(); table.at(2,nCol)=GetInnerHiRT(); } nCol++; } if (viewOuterRiseTime) { table.at(0,nCol)=GetOuterRiseTime(); if (viewCursors) { table.at(1,nCol)=GetOuterLoRT(); table.at(2,nCol)=GetOuterHiRT(); } nCol++; } // Half duration if (viewT50) {table.at(0,nCol)=GetHalfDuration(); if (viewCursors) { table.at(1,nCol)=GetT50LeftReal()*GetXScale(); table.at(2,nCol)=GetT50RightReal()*GetXScale(); } nCol++; } // Rise/decay if (viewRD) {table.at(0,nCol)=GetSlopeRatio(); if (viewCursors) { table.at(1,nCol)=GetMaxRiseT()*GetXScale(); table.at(2,nCol)=GetMaxDecayT()*GetXScale(); } nCol++; } // Max rise if (viewSloperise) {table.at(0,nCol)=GetMaxRise(); if (viewCursors) { table.at(1,nCol)=GetMaxRiseT()*GetXScale(); table.SetEmpty(2,nCol,true); } nCol++; } // Max decay if (viewSlopedecay) {table.at(0,nCol)=GetMaxDecay(); if (viewCursors) { table.at(1,nCol)=GetMaxDecayT()*GetXScale(); table.SetEmpty(2,nCol,true); } nCol++; } // Latency if (viewLatency) {table.at(0,nCol)=GetLatency()*GetXScale(); if (viewCursors) { table.at(1,nCol)=GetLatencyBeg()*GetXScale(); table.at(2,nCol)=GetLatencyEnd()*GetXScale(); } nCol++; } #ifdef WITH_PSLOPE // PSlope if (viewPSlope) {table.at(0,nCol)=GetPSlope(); if (viewCursors) { table.at(1,nCol)=GetPSlopeBeg()*GetXScale(); table.at(2,nCol)=GetPSlopeEnd()*GetXScale(); } nCol++; } #endif // WITH_PSLOPE return table; } void wxStfDoc::resize(std::size_t c_n_channels) { Recording::resize(c_n_channels); yzoom.resize(size()); sec_attr.resize(size()); for (std::size_t nchannel = 0; nchannel < size(); ++nchannel) { sec_attr[nchannel].resize(at(nchannel).size()); } } void wxStfDoc::InsertChannel(Channel& c_Channel, std::size_t pos) { Recording::InsertChannel(c_Channel, pos); yzoom.resize(size()); sec_attr.resize(size()); for (std::size_t nchannel = 0; nchannel < size(); ++nchannel) { sec_attr[nchannel].resize(at(nchannel).size()); } } void wxStfDoc::SetIsFitted( std::size_t nchannel, std::size_t nsection, const Vector_double& bestFitP_, stfnum::storedFunc* fitFunc_, double chisqr, std::size_t fitBeg, std::size_t fitEnd ) { if (nchannel >= sec_attr.size() || nsection >= sec_attr[nchannel].size()) { throw std::out_of_range("Index out of range in wxStfDoc::SetIsFitted"); } if ( !fitFunc_ ) { throw std::runtime_error("Function pointer is zero in wxStfDoc::SetIsFitted"); } if ( fitFunc_->pInfo.size() != bestFitP_.size() ) { throw std::runtime_error("Number of best-fit parameters doesn't match number\n \ of function parameters in wxStfDoc::SetIsFitted"); } sec_attr[nchannel][nsection].fitFunc = fitFunc_; if ( sec_attr[nchannel][nsection].bestFitP.size() != bestFitP_.size() ) sec_attr[nchannel][nsection].bestFitP.resize(bestFitP_.size()); sec_attr[nchannel][nsection].bestFitP = bestFitP_; sec_attr[nchannel][nsection].bestFit = sec_attr[nchannel][nsection].fitFunc->output(sec_attr[nchannel][nsection].bestFitP, sec_attr[nchannel][nsection].fitFunc->pInfo, chisqr ); sec_attr[nchannel][nsection].storeFitBeg = fitBeg; sec_attr[nchannel][nsection].storeFitEnd = fitEnd; sec_attr[nchannel][nsection].isFitted = true; } void wxStfDoc::DeleteFit(std::size_t nchannel, std::size_t nsection) { if (nchannel >= sec_attr.size() || nsection >= sec_attr[nchannel].size()) { throw std::out_of_range("Index out of range in wxStfDoc::DeleteFit"); } sec_attr[nchannel][nsection].fitFunc = NULL; sec_attr[nchannel][nsection].bestFitP.resize( 0 ); sec_attr[nchannel][nsection].bestFit = stfnum::Table( 0, 0 ); sec_attr[nchannel][nsection].isFitted = false; } void wxStfDoc::SetIsIntegrated(std::size_t nchannel, std::size_t nsection, bool value, std::size_t begin, std::size_t end, const Vector_double& quad_p_) { if (nchannel >= sec_attr.size() || nsection >= sec_attr[nchannel].size()) { throw std::out_of_range("Index out of range in wxStfDoc::SetIsIntegrated"); } if (value==false) { sec_attr[nchannel][nsection].isIntegrated=value; return; } if (end<=begin) { throw std::out_of_range("integration limits out of range in Section::SetIsIntegrated"); } int n_intervals=std::div((int)end-(int)begin,2).quot; if ((int)quad_p_.size() != n_intervals*3) { throw std::out_of_range("Wrong number of parameters for quadratic equations in Section::SetIsIntegrated"); } sec_attr[nchannel][nsection].quad_p = quad_p_; sec_attr[nchannel][nsection].isIntegrated=value; sec_attr[nchannel][nsection].storeIntBeg=begin; sec_attr[nchannel][nsection].storeIntEnd=end; } void wxStfDoc::ClearEvents(std::size_t nchannel, std::size_t nsection) { wxStfView* pView=(wxStfView*)GetFirstView(); if (pView!=NULL) { wxStfGraph* pGraph = pView->GetGraph(); if (pGraph != NULL) { pGraph->ClearEvents(); } } try { sec_attr.at(nchannel).at(nsection).eventList.clear(); } catch(const std::out_of_range& e) { throw e; } } const stf::SectionAttributes& wxStfDoc::GetSectionAttributes(std::size_t nchannel, std::size_t nsection) const { try { return sec_attr.at(nchannel).at(nsection); } catch(const std::out_of_range& e) { throw e; } } const stf::SectionAttributes& wxStfDoc::GetCurrentSectionAttributes() const { try { return sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()); } catch(const std::out_of_range& e) { throw e; } } stf::SectionAttributes& wxStfDoc::GetCurrentSectionAttributesW() { try { return sec_attr.at(GetCurChIndex()).at(GetCurSecIndex()); } catch(const std::out_of_range& e) { throw e; } } #if 0 void wxStfDoc::Userdef(std::size_t id) { wxBusyCursor wc; int fselect=(int)id; Recording newR; Vector_double init(0); // get user input if necessary: if (!wxGetApp().GetPluginLib().at(fselect).input.labels.empty()) { wxStfUsrDlg myDlg( GetDocumentWindow(), wxGetApp().GetPluginLib().at(fselect).input ); if (myDlg.ShowModal()!=wxID_OK) { return; } init=myDlg.readInput(); } // Apply function to current valarray std::map< wxString, double > resultsMap; try { newR=wxGetApp().GetPluginLib().at(fselect).pluginFunc( *this, init, resultsMap ); } catch (const std::out_of_range& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); return; } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); return; } catch (const std::exception& e) { wxGetApp().ExceptMsg(wxString( e.what(), wxConvLocal )); return; } if (newR.size()==0) { return; } wxString newTitle(GetTitle()); newTitle += wxT(", "); newTitle += wxGetApp().GetPluginLib().at(fselect).menuEntry; wxStfDoc* pDoc = wxGetApp().NewChild(newR,this,newTitle); ((wxStfChildFrame*)pDoc->GetDocumentWindow())->ShowTable( stfnum::Table(resultsMap), wxGetApp().GetPluginLib().at(fselect).menuEntry ); } #endif stimfit-0.16.0/src/stimfit/gui/unopt.cpp0000664000175000017500000006402013567226230015113 00000000000000#ifdef WITH_PYTHON // For compilers that support precompilation, includes "wx/wx.h". #include #ifndef WX_PRECOMP #include "wx/wx.h" #endif // WX_PRECOMP #ifdef _POSIX_C_SOURCE #define _POSIX_C_SOURCE_WAS_DEF #undef _POSIX_C_SOURCE #endif #ifdef _XOPEN_SOURCE #define _XOPEN_SOURCE_WAS_DEF #undef _XOPEN_SOURCE #endif #include #ifdef _POSIX_C_SOURCE_WAS_DEF #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE #endif #endif #ifdef _XOPEN_SOURCE_WAS_DEF #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE #endif #endif #if defined(__WXMAC__) || defined(__WXGTK__) #pragma GCC diagnostic ignored "-Wwrite-strings" #endif #if PY_MAJOR_VERSION >= 3 #include #include #define PyString_Check PyUnicode_Check #define PyString_AsString PyBytes_AsString #define PyString_FromString PyUnicode_FromString #else #include #endif // revert to previous behaviour #if defined(__WXMAC__) || defined(__WXGTK__) #pragma GCC diagnostic warning "-Wwrite-strings" #endif //#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #include #include "./app.h" #include "./doc.h" #include "./parentframe.h" int stf::Extension::n_extensions = 0; #if defined(__WXMAC__) || defined (__WXGTK__) #include wxString GetExecutablePath() { return wxStandardPaths::Get( ).GetExecutablePath(); } #endif // __WXMAC__ || __WXGTK__ #ifdef _WINDOWS #include #include wxString GetExecutablePath() { HKEY keyHandle; if( RegOpenKeyEx( HKEY_CURRENT_USER, wxT("Software\\Stimfit 0.14"), 0, KEY_QUERY_VALUE, &keyHandle) == ERROR_SUCCESS) { DWORD BufferSize = 8192; DWORD cbData = BufferSize; wxCharTypeBuffer data( BufferSize ); DWORD dwRet = RegQueryValueEx( keyHandle, TEXT("InstallLocation"), NULL, NULL, (LPBYTE) data.data(), &cbData ); while( dwRet == ERROR_MORE_DATA ) { // Get a buffer that is big enough. BufferSize += 4096; data.extend( BufferSize ); cbData = BufferSize; dwRet = RegQueryValueEx( keyHandle, TEXT("InstallLocation"), NULL, NULL, (LPBYTE) data.data(), &cbData ); } if( dwRet == ERROR_SUCCESS ) { RegCloseKey(keyHandle); return wxString( data ); } else { // wxGetApp().ErrorMsg( wxT("Couldn't read registry key for Stimfit") ); return wxT(""); } } else { // wxGetApp().ErrorMsg( wxT("Couldn't open registry key for Stimfit") ); return wxT(""); } } #endif // _WINDOWS #if PY_MAJOR_VERSION >= 3 PyObject* wxPyMake_wxObject(wxObject* source, bool setThisOwn) { bool checkEvtHandler = true; PyObject* target = NULL; bool isEvtHandler = false; bool isSizer = false; if (source) { // If it's derived from wxEvtHandler then there may // already be a pointer to a Python object that we can use // in the OOR data. if (checkEvtHandler && wxIsKindOf(source, wxEvtHandler)) { isEvtHandler = true; wxEvtHandler* eh = (wxEvtHandler*)source; wxPyClientData* data = (wxPyClientData*)eh->GetClientObject(); if (data) { target = data->GetData(); } } // Also check for wxSizer if (!target && wxIsKindOf(source, wxSizer)) { isSizer = true; wxSizer* sz = (wxSizer*)source; wxPyClientData* data = (wxPyClientData*)sz->GetClientObject(); if (data) { target = data->GetData(); } } if (! target) { // Otherwise make it the old fashioned way by making a new shadow // object and putting this pointer in it. Look up the class // heirarchy until we find a class name that is located in the // python module. const wxClassInfo* info = source->GetClassInfo(); wxString name = info->GetClassName(); wxString childname = name.Clone(); if (info) { target = wxPyConstructObject((void*)source, name.c_str(), setThisOwn); while (target == NULL) { info = info->GetBaseClass1(); name = info->GetClassName(); if (name == childname) break; childname = name.Clone(); target = wxPyConstructObject((void*)source, name.c_str(), setThisOwn); } if (target && isEvtHandler) ((wxEvtHandler*)source)->SetClientObject(new wxPyClientData(target)); if (target && isSizer) ((wxSizer*)source)->SetClientObject(new wxPyClientData(target)); } else { wxString msg(wxT("wxPython class not found for ")); msg += source->GetClassInfo()->GetClassName(); PyErr_SetString(PyExc_NameError, msg.mbc_str()); target = NULL; } } } else { // source was NULL so return None. Py_INCREF(Py_None); target = Py_None; } return target; } #endif bool wxStfApp::Init_wxPython() { // Initialize the Python interpreter if (!Py_IsInitialized()) { Py_Initialize(); } PyEval_InitThreads(); wxString cwd; #ifdef __WXMAC__ // Add the cwd to the present path: wxString app_path = wxFileName( GetExecutablePath() ).GetPath(); cwd << wxT("import os\n"); cwd << wxT("cwd=\"") << app_path << wxT("/../Frameworks\"\n"); cwd << wxT("import sys\n"); cwd << wxT("sys.path.append(cwd)\n"); cwd << wxT("cwd=\"") << app_path << wxT("/../Frameworks/stimfit\"\n"); cwd << wxT("sys.path.append(cwd)\n"); // cwd << wxT("cwd=\"") << app_path << wxT("/../Frameworks/numpy\"\n"); // cwd << wxT("sys.path.insert(0,cwd)\n"); #ifdef _STFDEBUG cwd << wxT("print(sys.path)\n"); cwd << wxT("import numpy\n"); cwd << wxT("print(numpy.version.version)\n"); #endif // _STFDEBUG #endif // __WXMAC__ #ifdef __WXGTK__ // Add the cwd to the present path: wxString app_path = wxFileName( GetExecutablePath() ).GetPath(); cwd << wxT("import os\n"); cwd << wxT("cwd=\"") << app_path << wxT("/../lib/stimfit\"\n"); cwd << wxT("import sys\n"); cwd << wxT("sys.path.append(cwd)\n"); #ifdef _STFDEBUG cwd << wxT("print(sys.path)\n"); cwd << wxT("import numpy\n"); cwd << wxT("print(numpy.version.version)\n"); #endif // _STFDEBUG #endif // __WXGTK__ #ifdef _WINDOWS // Add the cwd to the present path: wxString app_path = GetExecutablePath().BeforeFirst( wxUniChar('\0') ); cwd << wxT("cwd = \"") << app_path << wxT("\\wx-3.0-msw\"\nimport sys\nsys.path.insert(0,cwd)\n"); cwd << wxT("cwd = \"") << app_path << wxT("\\stf-site-packages\"\nsys.path.insert(0,cwd)\n"); cwd << wxT("cwd = \"") << app_path << wxT("\"\nsys.path.insert(0,cwd)\n"); #endif int cwd_result = PyRun_SimpleString(cwd.utf8_str()); if (cwd_result!=0) { PyErr_Print(); ErrorMsg( wxT("Couldn't modify Python path") ); Py_Finalize(); return false; } // Load the wxPython core API. Imports the wx._core_ module and sets a // local pointer to a function table located there. The pointer is used // internally by the rest of the API functions. #if PY_MAJOR_VERSION < 3 // Specify version of the wx module to be imported PyObject* wxversion = PyImport_ImportModule("wxversion"); if (wxversion==NULL) { PyErr_Print(); ErrorMsg( wxT("Couldn't import wxversion") ); Py_Finalize(); return false; } PyObject* wxselect = PyObject_GetAttrString(wxversion, "select"); Py_DECREF(wxversion); if (!PyCallable_Check(wxselect)) { PyErr_Print(); ErrorMsg( wxT("Couldn't select correct version of wx") ); Py_Finalize(); return false; } #if wxCHECK_VERSION(3, 1, 0) PyObject* ver_string = Py_BuildValue("ss","3.1",""); #elif wxCHECK_VERSION(3, 0, 0) PyObject* ver_string = Py_BuildValue("ss","3.0",""); #elif wxCHECK_VERSION(2, 9, 0) PyObject* ver_string = Py_BuildValue("ss","2.9",""); #else PyObject* ver_string = Py_BuildValue("ss","2.8",""); #endif PyObject* result = PyEval_CallObject(wxselect, ver_string); Py_DECREF(ver_string); if (result == NULL) { PyErr_Print(); ErrorMsg( wxT("Couldn't call wxversion.select") ); Py_Finalize(); return false; } #endif // < python 3 #if 0 // wxversion.select doesn't return an error code, but raises an exception long iresult = PyInt_AsLong(result); Py_DECREF(result); if (iresult == 0) { PyErr_Print(); ErrorMsg( wxT("Couldn't select correct version of wx") ); Py_Finalize(); return false; } #endif #if PY_MAJOR_VERSION >= 3 if (wxPyGetAPIPtr()==NULL) { #else if ( ! wxPyCoreAPI_IMPORT() ) { #endif PyErr_Print(); wxString errormsg; errormsg << wxT("Couldn't load wxPython core API.\n"); #ifdef _WINDOWS errormsg << wxT("Try the following steps:\n"); errormsg << wxT("1.\tUninstall a previous Stimfit installation\n"); errormsg << wxT("\t(Control Panel->Software)\n"); errormsg << wxT("2.\tUninstall a previous wxPython installation\n"); errormsg << wxT("\t(Control Panel->Software)\n"); errormsg << wxT("3.\tUninstall a previous Python 2.5 installation\n"); errormsg << wxT("\t(Control Panel->Software)\n"); errormsg << wxT("4.\tSet the current working directory\n"); errormsg << wxT("\tto the program directory so that all shared\n"); errormsg << wxT("\tlibraries can be found.\n"); errormsg << wxT("\tIf you used a shortcut, right-click on it,\n"); errormsg << wxT("\tchoose \"Properties\", select the \"Shortcut\"\n"); errormsg << wxT("\ttab, then set \"Run in...\" to the stimfit program\n"); errormsg << wxT("\tdirectory (typically C:\\Program Files\\Stimfit).\n"); errormsg << wxT("\tIf you started stimfit from the command line, you\n"); errormsg << wxT("\thave to set the current working directory using the\n"); errormsg << wxT("\t\"/d\" option (e.g. /d=C:\\Program Files\\Stimfit)\n"); #endif // _WINDOWS ErrorMsg( errormsg ); Py_Finalize(); #if PY_MAJOR_VERSION < 3 Py_DECREF(result); #endif return false; } // Save the current Python thread state and release the // Global Interpreter Lock. m_mainTState = wxPyBeginAllowThreads(); #ifdef IPYTHON // Set a dummy sys.argv for IPython wxPyBlock_t blocked = wxPyBeginBlockThreads(); char* argv = (char *)"\0"; PySys_SetArgv(1, &argv); wxPyEndBlockThreads(blocked); #endif return true; } void wxStfApp::ImportPython(const wxString &modulelocation) { // Get path and filename from modulelocation wxString python_path = wxFileName(modulelocation).GetPath(); wxString python_file = wxFileName(modulelocation).GetName(); // Grab the Global Interpreter Lock. wxPyBlock_t blocked = wxPyBeginBlockThreads(); wxString python_import; #ifdef IPYTHON // the ip object is created to access the interactive IPython session python_import << wxT("import IPython.ipapi\n"); python_import << wxT("ip = IPython.ipapi.get()\n"); python_import << wxT("import sys\n"); python_import << wxT("sys.path.append(\"") << python_path << wxT("\")\n"); #if (PY_VERSION_HEX < 0x03000000) python_import << wxT("if not sys.modules.has_key(\"") << python_file << wxT("\"):"); #else python_import << wxT("if '") << python_file << wxT("' not in sys.modules:"); #endif python_import << wxT("ip.ex(\"import ") << python_file << wxT("\")\n"); python_import << wxT("else:") << wxT("ip.ex(\"reload(") << python_file << wxT(")") << wxT("\")\n"); python_import << wxT("sys.path.remove(\"") << python_path << wxT("\")\n"); #else // Python code to import a module with PyCrust python_import << wxT("import sys\n"); python_import << wxT("sys.path.append(\"") << python_path << wxT("\")\n"); #if (PY_VERSION_HEX < 0x03000000) python_import << wxT("if not sys.modules.has_key(\"") << python_file << wxT("\"):"); #else python_import << wxT("if '") << python_file << wxT("' not in sys.modules:"); #endif python_import << wxT("import ") << python_file << wxT("\n"); python_import << wxT("else:") << wxT("reload(") << python_file << wxT(")") << wxT("\n"); python_import << wxT("sys.path.remove(\"") << python_path << wxT("\")\n"); python_import << wxT("del sys\n"); #endif #if ((wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) && !defined(__WXMAC__)) PyRun_SimpleString(python_import); #else PyRun_SimpleString(python_import.char_str()); #endif // Release the Global Interpreter Lock wxPyEndBlockThreads(blocked); } bool wxStfApp::Exit_wxPython() { wxPyEndAllowThreads(m_mainTState); Py_Finalize(); return true; } void wxStfParentFrame::RedirectStdio() { // This is a helpful little tidbit to help debugging and such. It // redirects Python's stdout and stderr to a window that will popup // only on demand when something is printed, like a traceback. wxString python_redirect; python_redirect = wxT("import sys, wx\n"); python_redirect << wxT("output = wx.PyOnDemandOutputWindow()\n"); python_redirect << wxT("sys.stdin = sys.stderr = output\n"); python_redirect << wxT("del sys, wx\n"); wxPyBlock_t blocked = wxPyBeginBlockThreads(); #if ((wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) && !defined(__WXMAC__)) PyRun_SimpleString(python_redirect); #else PyRun_SimpleString(python_redirect.char_str()); #endif wxPyEndBlockThreads(blocked); } new_wxwindow wxStfParentFrame::MakePythonWindow(const std::string& windowFunc, const std::string& mgr_name, const std::string& caption, bool show, bool full, bool isfloat, int width, int height, double mpl_width, double mpl_height) { // More complex embedded situations will require passing C++ objects to // Python and/or returning objects from Python to be used in C++. This // sample shows one way to do it. NOTE: The above code could just have // easily come from a file, or the whole thing could be in the Python // module that is imported and manipulated directly in this C++ code. See // the Python API for more details. wxWindow *window = NULL; PyObject *result; // As always, first grab the GIL wxPyBlock_t blocked = wxPyBeginBlockThreads(); RedirectStdio(); // Now make a dictionary to serve as the global namespace when the code is // executed. Put a reference to the builtins module in it. (Yes, the // names are supposed to be different, I don't know why...) PyObject* globals = PyDict_New(); #if PY_MAJOR_VERSION >= 3 PyObject* builtins = PyImport_ImportModule("builtins"); #else PyObject* builtins = PyImport_ImportModule("__builtin__"); #endif PyDict_SetItemString(globals, "__builtins__", builtins); Py_DECREF(builtins); // Execute the code to make the makeWindow function result = PyRun_String(python_code2.c_str(), Py_file_input, globals, globals); // Was there an exception? if (! result) { PyErr_Print(); wxGetApp().ErrorMsg(wxT("Couldn't initialize python shell")); wxPyEndBlockThreads(blocked); return NULL; } Py_DECREF(result); // Now there should be an object named 'makeWindow' in the dictionary that // we can grab a pointer to: PyObject* func = NULL; func = PyDict_GetItemString(globals, windowFunc.c_str()); if (!PyCallable_Check(func)) { PyErr_Print(); wxGetApp().ErrorMsg(wxT("Couldn't initialize window for the python shell")); wxPyEndBlockThreads(blocked); return NULL; } // Now build an argument tuple and call the Python function. Notice the // use of another wxPython API to take a wxWindows object and build a // wxPython object that wraps it. PyObject* arg = wxPyMake_wxObject(this, false); wxASSERT(arg != NULL); PyObject* py_mpl_width = PyFloat_FromDouble(mpl_width); wxASSERT(py_mpl_width != NULL); PyObject* py_mpl_height = PyFloat_FromDouble(mpl_height); wxASSERT(py_mpl_height != NULL); PyObject* figsize = PyTuple_New(2); PyTuple_SET_ITEM(figsize, 0, py_mpl_width); PyTuple_SET_ITEM(figsize, 1, py_mpl_height); PyObject* argtuple = PyTuple_New(2); PyTuple_SET_ITEM(argtuple, 0, arg); PyTuple_SET_ITEM(argtuple, 1, figsize); result = PyEval_CallObject(func, argtuple); Py_DECREF(argtuple); Py_DECREF(py_mpl_width); Py_DECREF(py_mpl_height); Py_DECREF(figsize); // Was there an exception? if (! result) { PyErr_Print(); wxGetApp().ErrorMsg(wxT("Couldn't create window for the python shell")); wxPyEndBlockThreads(blocked); return NULL; } else { // Otherwise, get the returned window out of Python-land and // into C++-ville... #if PY_MAJOR_VERSION >= 3 if (!wxPyConvertWrappedPtr(result, (void**)&window, _T("wxWindow"))) { #else if (!wxPyConvertSwigPtr(result, (void**)&window, _T("wxWindow"))) { #endif PyErr_Print(); wxGetApp().ErrorMsg(wxT("Returned object was not a wxWindow!")); wxPyEndBlockThreads(blocked); return NULL; } Py_DECREF(result); } // Release the python objects we still have Py_DECREF(globals); // Finally, after all Python stuff is done, release the GIL wxPyEndBlockThreads(blocked); if (!full) { if (isfloat) { m_mgr.AddPane( window, wxAuiPaneInfo().Name(stf::std2wx(mgr_name)). CloseButton(true). Show(show).Caption(stf::std2wx(caption)).Float(). BestSize(width, height) ); } else { m_mgr.AddPane( window, wxAuiPaneInfo().Name(stf::std2wx(mgr_name)). CloseButton(true). Show(show).Caption(stf::std2wx(caption)).Dockable(true).Bottom(). BestSize(width, height) ); } } else { m_mgr.AddPane( window, wxAuiPaneInfo().Name(stf::std2wx(mgr_name)). Floatable(false).CaptionVisible(false). BestSize(GetClientSize().GetWidth(),GetClientSize().GetHeight()).Fixed() ); } m_mgr.Update(); return new_wxwindow(window, result); } std::vector wxStfApp::LoadExtensions() { std::vector< stf::Extension > extList; // As always, first grab the GIL wxPyBlock_t blocked = wxPyBeginBlockThreads(); // import extensions.py: PyObject* pModule = PyImport_ImportModule("extensions"); if (!pModule) { PyErr_Print(); #ifdef _STFDEBUG wxGetApp().ErrorMsg(wxT("Couldn't load extensions.py")); #endif wxPyEndBlockThreads(blocked); return extList; } PyObject* pExtList = PyObject_GetAttrString(pModule, "extensionList"); if (!pExtList) { PyErr_Print(); wxGetApp().ErrorMsg(wxT("Couldn't find extensionList in extensions.py")); wxPyEndBlockThreads(blocked); Py_DECREF(pModule); return extList; } if (!PyList_Check(pExtList)) { PyErr_Print(); wxGetApp().ErrorMsg(wxT("extensionList is not a Python list in extensions.py")); wxPyEndBlockThreads(blocked); Py_DECREF(pExtList); Py_DECREF(pModule); return extList; } // retrieve values from list: for (int i=0; i= (int)GetExtensionLib().size() || id<0) { wxString msg(wxT("Couldn't find extension function")); ErrorMsg( msg ); return; } // As always, first grab the GIL wxPyBlock_t blocked = wxPyBeginBlockThreads(); // retrieve function PyObject* pPyFunc = (PyObject*)(GetExtensionLib()[id].pyFunc); // retrieve function name wxString FuncName = stf::std2wx(GetExtensionLib()[id].menuEntry); if (!pPyFunc || !PyCallable_Check(pPyFunc)) { wxString msg(FuncName << wxT(" Couldn't call extension function ")); ErrorMsg( msg ); wxPyEndBlockThreads(blocked); return; } // call function PyObject* res = PyObject_CallObject(pPyFunc, NULL); if (!res) { PyErr_Print(); wxString msg(FuncName << wxT(" call failed")); ErrorMsg( msg ); wxPyEndBlockThreads(blocked); return; } if (res==Py_False) { wxString msg(FuncName << wxT(" returned False")); ErrorMsg( msg ); } Py_XDECREF(res); // Finally, after all Python stuff is done, release the GIL wxPyEndBlockThreads(blocked); } bool wxStfDoc::LoadTDMS(const std::string& filename, Recording& ReturnData) { // Grab the Global Interpreter Lock. wxPyBlock_t blocked = wxPyBeginBlockThreads(); PyObject* stf_mod = PyImport_ImportModule("tdms"); if (!stf_mod) { PyErr_Print(); #ifdef _STFDEBUG wxGetApp().ErrorMsg(wxT("Couldn't load tdms.py")); #endif wxPyEndBlockThreads(blocked); return false; } PyObject* py_fn = PyString_FromString(filename.c_str()); PyObject* stf_tdms_f = PyObject_GetAttrString(stf_mod, "tdms_open"); PyObject* stf_tdms_res = NULL; if (PyCallable_Check(stf_tdms_f)) { PyObject* stf_tdms_args = PyTuple_Pack(1, py_fn); stf_tdms_res = PyObject_CallObject(stf_tdms_f, stf_tdms_args); PyErr_Print(); Py_DECREF(stf_mod); Py_DECREF(py_fn); Py_DECREF(stf_tdms_args); } else { Py_DECREF(stf_mod); Py_DECREF(py_fn); return false; } if (stf_tdms_res == Py_None) { wxGetApp().ErrorMsg( wxT("nptdms module unavailable. Cannot read tdms files.")); Py_DECREF(stf_tdms_res); return false; } if (!PyTuple_Check(stf_tdms_res)) { wxGetApp().ErrorMsg(wxT("Return value of tdms_open is not a tuple. Aborting now.")); Py_DECREF(stf_tdms_res); return false; } if (PyTuple_Size(stf_tdms_res) != 2) { wxGetApp().ErrorMsg( wxT("Return value of tdms_open is not a 2-tuple. Aborting now.")); Py_DECREF(stf_tdms_res); return false; } PyObject* data_list = PyTuple_GetItem(stf_tdms_res, 0); PyObject* py_dt = PyTuple_GetItem(stf_tdms_res, 1); double dt = PyFloat_AsDouble(py_dt); // Py_DECREF(py_dt); Py_ssize_t nchannels = PyList_Size(data_list); ReturnData.resize(nchannels); int nchannels_nonempty = 0; for (int nc=0; ncname); m_listCtrl->InsertItem( n_f++, funcName ); } m_listSizer->Add( m_listCtrl, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 2 ); mainGrid->Add( m_listSizer, 0, wxALIGN_CENTER_HORIZONTAL, 2 ); // vertical sizer for initial parameters (top) and options (bottom) wxBoxSizer* settingsSizer; settingsSizer=new wxBoxSizer(wxVERTICAL); wxStaticBoxSizer* paramSizer = new wxStaticBoxSizer( wxVERTICAL, this, wxT("Initial parameters") ); // grid for parameters: wxFlexGridSizer* paramGrid; paramGrid=new wxFlexGridSizer(0,4,0,4); // add parameter boxes: std::vector< wxStaticText* >::iterator it1; std::vector< wxTextCtrl* >::iterator it2 = paramEntryArray.begin(); for (it1 = paramDescArray.begin(); it1 != paramDescArray.end() && it2 != paramEntryArray.end(); it1++) { *it1 = new wxStaticText( this, wxID_ANY, wxT(" "), wxDefaultPosition, wxSize(74,20), wxTE_LEFT ); paramGrid->Add( *it1, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 ); *it2 = new wxTextCtrl( this, wxID_ANY, wxT(" "), wxDefaultPosition, wxSize(74,20), wxTE_RIGHT ); paramGrid->SetFlexibleDirection(wxHORIZONTAL); paramGrid->Add( *it2, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2 ); it2++; } //settingsSizer->Add( paramGrid, 0, wxALIGN_CENTER_HORIZONTAL, 2 ); paramSizer->Add( paramGrid, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 2 ); settingsSizer->Add( paramSizer, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2 ); // Fit options: // grid for parameters: wxFlexGridSizer* optionsGrid; optionsGrid=new wxFlexGridSizer(opts.size()+1, 2, 0, 0); wxStaticBoxSizer* fitoptSizer = new wxStaticBoxSizer( wxVERTICAL, this, wxT("Fitting options") ); InitOptions(optionsGrid); // add the options grid to the settings sizer: fitoptSizer->Add( optionsGrid, 0, wxEXPAND | wxALL, 2 ); settingsSizer->Add( fitoptSizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM, 2 ); //settingsSizer->Add( optionsGrid, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM, 2 ); // add the settings sizer to the main grid: mainGrid->Add( settingsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 2 ); // add the main grid to the dialog: topSizer->Add( mainGrid, 0, wxALIGN_CENTER_HORIZONTAL| wxALL, 5 ); // Ok / Cancel / Preview: wxButton* previewButton; previewButton = new wxButton( this, wxID_PREVIEW, wxT("Preview"), wxDefaultPosition, wxDefaultSize, 0 ); topSizer->Add( previewButton, 0, wxALIGN_CENTER | wxALL, 2 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER| wxALL, 2 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); // select first function: if (m_listCtrl->GetItemCount()>0) { m_listCtrl->SetItemState(0,wxLIST_STATE_SELECTED,wxLIST_STATE_SELECTED); } } void wxStfFitSelDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) switch (retCode) { case wxID_OK: if (!OnOK()) { wxLogMessage(wxT("Please select a valid function")); return; } break; case wxID_CANCEL: try { pDoc->DeleteFit(pDoc->GetCurChIndex(), pDoc->GetCurSecIndex()); } catch (const std::out_of_range& e) { } break; default: ; } wxDialog::EndModal(retCode); } bool wxStfFitSelDlg::OnOK() { Update_fselect(); read_init_p(); read_opts(); // wxStfDoc* pDoc=pDoc; // pDoc->cur().SetIsFitted(false); // pDoc->cur().SetFit(Vector_double(0)); return true; } void wxStfFitSelDlg::InitOptions(wxFlexGridSizer* optionsGrid) { // Number of passes-------------------------------------------------- wxStaticText* staticTextNPasses; staticTextNPasses=new wxStaticText( this, wxID_ANY, wxT("Max. number of passes:"), wxDefaultPosition, wxDefaultSize, 0 ); optionsGrid->Add( staticTextNPasses, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString strNPasses; strNPasses << opts[5]; m_textCtrlMaxpasses = new wxTextCtrl( this, wxID_ANY, strNPasses, wxDefaultPosition, wxSize(74,20), wxTE_RIGHT ); optionsGrid->Add( m_textCtrlMaxpasses, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Number of iterations---------------------------------------------- wxStaticText* staticTextNIter; staticTextNIter=new wxStaticText( this, wxID_ANY, wxT("Max. number of iterations per pass:"), wxDefaultPosition, wxDefaultSize, 0 ); optionsGrid->Add( staticTextNIter, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString strNIter; strNIter << opts[4]; m_textCtrlMaxiter=new wxTextCtrl( this, wxID_ANY, strNIter, wxDefaultPosition, wxSize(74,20), wxTE_RIGHT ); optionsGrid->Add( m_textCtrlMaxiter, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Initial scaling factor-------------------------------------------- wxStaticText* staticTextMu; staticTextMu=new wxStaticText( this, wxID_ANY, wxT("Initial scaling factor:"), wxDefaultPosition, wxDefaultSize, 0 ); optionsGrid->Add( staticTextMu, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString strMu; strMu << opts[0]; m_textCtrlMu=new wxTextCtrl( this, wxID_ANY, strMu, wxDefaultPosition, wxSize(74,20), wxTE_RIGHT ); optionsGrid->Add( m_textCtrlMu, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Gradient of squared error----------------------------------- wxStaticText* staticTextJTE; staticTextJTE=new wxStaticText( this, wxID_ANY, wxT("Stop. thresh. for gradient of squared error:"), wxDefaultPosition, wxDefaultSize, 0 ); optionsGrid->Add( staticTextJTE, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString strJTE; strJTE << opts[1]; m_textCtrlJTE=new wxTextCtrl( this, wxID_ANY, strJTE, wxDefaultPosition, wxSize(74,20), wxTE_RIGHT ); optionsGrid->Add( m_textCtrlJTE, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Parameter gradient------------------------------------------------ wxStaticText* staticTextDP; staticTextDP=new wxStaticText( this, wxID_ANY, wxT("Stop. thresh. for rel. parameter change:"), wxDefaultPosition, wxDefaultSize, 0 ); optionsGrid->Add( staticTextDP, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString strDP; strDP << opts[2]; m_textCtrlDP=new wxTextCtrl( this, wxID_ANY, strDP, wxDefaultPosition, wxSize(74,20), wxTE_RIGHT ); optionsGrid->Add( m_textCtrlDP, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Squared error----------------------------------------------------- wxStaticText* staticTextE2; staticTextE2=new wxStaticText( this, wxID_ANY, wxT("Stop. thresh. for squared error:"), wxDefaultPosition, wxDefaultSize, 0 ); optionsGrid->Add( staticTextE2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString strE2; strE2 << opts[3]; m_textCtrlE2=new wxTextCtrl( this, wxID_ANY, strE2, wxDefaultPosition, wxSize(74,20), wxTE_RIGHT ); optionsGrid->Add( m_textCtrlE2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Use scaling------------------------------------------------------- m_checkBox = new wxCheckBox(this, wxID_ANY, wxT("Scale data amplitude to 1.0"), wxDefaultPosition, wxDefaultSize, 0); m_checkBox->SetValue(false); optionsGrid->Add( m_checkBox, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); } void wxStfFitSelDlg::OnButtonClick( wxCommandEvent& event ) { event.Skip(); // Make sure we are up-to-date: Update_fselect(); // read in parameters: read_init_p(); // tell the document that a fit has been performed: if (pDoc==0) { wxGetApp().ErrorMsg(wxT("Couldn't connect to document")); return; } // calculate a graph from the current parameters: std::size_t fitSize= pDoc->GetFitEnd()-pDoc->GetFitBeg(); Vector_double fit(fitSize); for (std::size_t n_f=0;n_fGetXScale()*n_f,init_p ); } catch (const std::out_of_range& e) { wxString msg(wxT("Could not retrieve selected function from library:\n")); msg += wxString( e.what(), wxConvLocal ); wxGetApp().ExceptMsg(msg); m_fselect=-1; return; } } try { pDoc->SetIsFitted(pDoc->GetCurChIndex(), pDoc->GetCurSecIndex(), init_p, wxGetApp().GetFuncLibPtr(m_fselect), 0, pDoc->GetFitBeg(), pDoc->GetFitEnd() ); } catch (const std::out_of_range& e) { } // tell the view to draw the fit: wxStfView* pView = (wxStfView*)pDoc->GetFirstView(); if (pView != NULL) if (pView->GetGraph() != NULL) pView->GetGraph()->Refresh(); } void wxStfFitSelDlg::SetPars() { Update_fselect(); // get parameter names from selected function: try { // fill a temporary array: if (pDoc==NULL) return; std::size_t fitSize= pDoc->GetFitEnd()-pDoc->GetFitBeg(); if (fitSize<=0) { wxGetApp().ErrorMsg(wxT("Check fit cursor settings")); return; } Vector_double x(fitSize); //fill array: std::copy(&pDoc->cursec()[pDoc->GetFitBeg()], &pDoc->cursec()[pDoc->GetFitBeg()+fitSize], &x[0]); Vector_double initPars(wxGetApp().GetFuncLib().at(m_fselect).pInfo.size()); wxGetApp().GetFuncLib().at(m_fselect).init( x, pDoc->GetBase(), pDoc->GetPeak(), pDoc->GetRTLoHi(), pDoc->GetHalfDuration(), pDoc->GetXScale(), initPars); std::vector< wxStaticText* >::iterator it1; std::vector< wxTextCtrl* >::iterator it2 = paramEntryArray.begin(); std::size_t n_p = 0; for (it1 = paramDescArray.begin(); it1 != paramDescArray.end() && it2 != paramEntryArray.end(); it1++) { if (n_p < wxGetApp().GetFuncLib().at(m_fselect).pInfo.size()) { (*it1)->Show(); (*it2)->Show(); // Parameter label: (*it1)->SetLabel(stf::std2wx(wxGetApp().GetFuncLib().at(m_fselect).pInfo[n_p].desc)); // Initial parameter values: wxString strInit; strInit << initPars[n_p]; (*it2)->SetValue(strInit); (*it2)->Enable(!noInput); } else { (*it1)->Show(false); (*it2)->Show(false); } it2++; n_p++; } } catch (const std::out_of_range& e) { wxString msg(wxT("Could not retrieve selected function from library:\n")); msg += wxString( e.what(), wxConvLocal ); wxLogMessage(msg); m_fselect = -1; return; } this->Layout(); } void wxStfFitSelDlg::Update_fselect() { // Update currently selected function: if (m_listCtrl->GetSelectedItemCount()>0) { // Get first selected item: long item = -1; item=m_listCtrl->GetNextItem(item,wxLIST_NEXT_ALL,wxLIST_STATE_SELECTED); if (item==-1) return; m_fselect = item; } } void wxStfFitSelDlg::OnListItemSelected( wxListEvent& event ) { event.Skip(); SetPars(); } void wxStfFitSelDlg::read_init_p() { init_p.resize(wxGetApp().GetFuncLib().at(m_fselect).pInfo.size()); for (std::size_t n_p=0;n_pGetValue(); entryInit.ToDouble( &init_p[n_p] ); } } void wxStfFitSelDlg::read_opts() { // Read entry to string: wxString entryMu = m_textCtrlMu->GetValue(); entryMu.ToDouble( &opts[0] ); wxString entryJTE = m_textCtrlJTE->GetValue(); entryJTE.ToDouble( &opts[1] ); wxString entryDP = m_textCtrlDP->GetValue(); entryDP.ToDouble( &opts[2] ); wxString entryE2 = m_textCtrlE2->GetValue(); entryE2.ToDouble( &opts[3] ); wxString entryMaxiter = m_textCtrlMaxiter->GetValue(); entryMaxiter.ToDouble( &opts[4] ); wxString entryMaxpasses = m_textCtrlMaxpasses->GetValue(); entryMaxpasses.ToDouble( &opts[5] ); use_scaling = m_checkBox->GetValue(); } stimfit-0.16.0/src/stimfit/gui/dlgs/smalldlgs.h0000775000175000017500000006022013277303516016330 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file smalldlgs.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares several small dialogs. */ #ifndef _SMALLDLGS_H #define _SMALLDLGS_H /*! \addtogroup wxstf * @{ */ #include #include #include #include "./../../stf.h" //! Dialog showing file information. class wxStfFileInfoDlg : public wxDialog { DECLARE_EVENT_TABLE() private: wxStdDialogButtonSizer* m_sdbSizer; public: //! Constructor /*! \param parent Pointer to parent window. * \param szGeneral General information. * \param szFile File variables information. * \param szSection Section variable information. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfFileInfoDlg( wxWindow* parent, const std::string& szGeneral, const std::string& szFile, const std::string& szSection, int id = wxID_ANY, wxString title = wxT("File information"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); }; //! Dialog for selecting channels class wxStfChannelSelDlg : public wxDialog { DECLARE_EVENT_TABLE() private: int m_selChannel1, m_selChannel2; wxStdDialogButtonSizer* m_sdbSizer; wxComboBox *m_comboBoxCh1,*m_comboBoxCh2; void OnComboCh1( wxCommandEvent& event ); void OnComboCh2( wxCommandEvent& event ); //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param channelNames A vector containing the channel names. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfChannelSelDlg( wxWindow* parent, const std::vector& channelNames= std::vector(0), int id = wxID_ANY, wxString title = wxT("Select channels"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); //! Get selection for channel 1 /*! \return The index of the first (active) channel */ int GetSelCh1() const {return m_selChannel1;} //! Get selection for channel 2 /*! \return The index of the second (reference) channel */ int GetSelCh2() const {return m_selChannel2;} }; //! Dialog for selecting alignment mode class wxStfAlignDlg : public wxDialog { DECLARE_EVENT_TABLE() private: int m_alignRise; bool m_useReference, m_hasReference; wxCheckBox* m_checkBox; wxRadioBox* m_radioBox; wxStdDialogButtonSizer* m_sdbSizer; //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfAlignDlg( wxWindow* parent, bool hasReference, int id = wxID_ANY, wxString title = wxT("Alignment mode"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Indicates whether the average should be aligned to the steepest rise. /*! \return true if it should be aligned to the steepest rise, false if it should be * aligned to the peak. */ int AlignRise() const {return m_alignRise;} //! Indicates whether the reference channel should be used for alignment /*! \return true if the reference channel should be used, false if the active * channel should be used */ bool UseReference() const {return m_useReference;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; //! Dialog for selecting a filter function class wxStfFilterSelDlg : public wxDialog { DECLARE_EVENT_TABLE() private: int m_filterSelect; wxRadioBox* m_radioBox; wxStdDialogButtonSizer* m_sdbSizer; //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfFilterSelDlg( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("Filter function"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Get the selected filter function. /*! \return The index of the selected filter function. */ int GetFilterSelect() const {return m_filterSelect;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; //! Dialog for selecting a transform function class wxStfTransformDlg : public wxDialog { DECLARE_EVENT_TABLE() private: int m_fSelect; wxRadioBox* m_radioBox; wxStdDialogButtonSizer* m_sdbSizer; //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfTransformDlg( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("Choose function"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Get the selected transform function. /*! \return The index of the selected transform function. */ int GetFSelect() const {return m_fSelect;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; //! Dialog showing information about a fit. class wxStfFitInfoDlg : public wxDialog { DECLARE_EVENT_TABLE() private: wxStdDialogButtonSizer* m_sdbSizer; public: //! Constructor /*! \param parent Pointer to parent window. * \param info A string containing information about the fit. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfFitInfoDlg( wxWindow* parent, const wxString& info, int id = wxID_ANY, wxString title = wxT("Fit information"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); }; //! small struct representing a batch dialog option struct BatchOption { //! Default constructor BatchOption( ) : label( wxT("\0") ), selection(false), index(-1) {} //! Constructor //! \param lab Checkbox label //! \param sel Checkbox status //! \param id Index in dialog BatchOption(const wxString& lab, bool sel, int id) : label(lab), selection(sel), index(id) {} wxString label; //! Checkbox label bool selection; //! Checkbox status int index; //! Index within dialog }; //! Dialog for batch analysis settings. class wxStfBatchDlg : public wxDialog { DECLARE_EVENT_TABLE() private: std::vector batchOptions; wxCheckListBox* m_checkList; wxStdDialogButtonSizer* m_sdbSizer; //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); BatchOption LookUp( int index ) const; enum { id_base=0, id_basesd, id_threshold, id_slopethresholdtime, id_peakzero, id_peakbase, id_peakthreshold, id_peaktime, id_rtLoHi, id_innerLoHi, id_outerLoHi, id_t50, id_t50se, id_slopes, id_slopetimes, id_latencies, id_fit, #ifdef WITH_PSLOPE id_pslopes, #endif id_crossings }; public: //! Constructor /*! \param parent Pointer to parent window. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfBatchDlg( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("Choose values"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Indicates whether the baseline should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintBase() const {return LookUp(id_base).selection;} //! Indicates whether the standard deviation of the baseline should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintBaseSD() const {return LookUp(id_basesd).selection;} //! Indicates whether the threshold should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintThreshold() const {return LookUp(id_threshold).selection;} //! Indicates whether the time of slope threshold crossing should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintSlopeThresholdTime() const {return LookUp(id_slopethresholdtime).selection;} //! Indicates whether the peak (from 0) value should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintPeakZero() const {return LookUp(id_peakzero).selection;} //! Indicates whether the peak (from baseline) value should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintPeakBase() const {return LookUp(id_peakbase).selection;} //! Indicates whether the peak value (from threshold) should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintPeakThreshold() const {return LookUp(id_peakthreshold).selection;} //! Indicates whether the peak value (from threshold) should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintPeakTime() const {return LookUp(id_peaktime).selection;} //! Indicates whether the Lo-Hi% rise time should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintRTLoHi() const {return LookUp(id_rtLoHi).selection;} //! Indicates whether the Lo-Hi% inner rise time should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintInnerRTLoHi() const {return LookUp(id_innerLoHi).selection;} //! Indicates whether the Lo-Hi% inner rise time should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintOuterRTLoHi() const {return LookUp(id_outerLoHi).selection;} //! Indicates whether the half amplitude duration should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintT50() const {return LookUp(id_t50).selection;} //! Indicates whether the start and end time for half amplitude should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintT50SE() const {return LookUp(id_t50se).selection;} //! Indicates whether the maximal slopes should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintSlopes() const {return LookUp(id_slopes).selection;} //! Indicates whether the peak value (from threshold) should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintSlopeTimes() const {return LookUp(id_slopetimes).selection;} #ifdef WITH_PSLOPE //! Indicates whether the slopes should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintPSlopes() const {return LookUp(id_pslopes).selection;} #endif //! Indicates whether a threshold crossing should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintThr() const {return LookUp(id_crossings).selection;} //! Indicates whether the latency should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintLatencies() const {return LookUp(id_latencies).selection;} //! Indicates whether the fit results should be printed in the batch analysis table. /*! \return true if it should be printed, false otherwise. */ bool PrintFitResults() const {return LookUp(id_fit).selection;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; //! Dialog for setting printout options. class wxStfPreprintDlg : public wxDialog { DECLARE_EVENT_TABLE() private: bool m_gimmicks,m_isFile; int m_downsampling; wxStdDialogButtonSizer* m_sdbSizer; wxCheckBox* m_checkBox; wxTextCtrl* m_textCtrl; //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param isFile Set this to true if something should be printed to a file. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfPreprintDlg( wxWindow* parent, bool isFile=false, int id = wxID_ANY, wxString title = wxT("Settings"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Indicates whether gimmicks (cursors, results table etc.) sould be printed. /*! \return true if gimmicks should be printed. */ bool GetGimmicks() const {return m_gimmicks;} //! Prints every n-th point. /*! \return If the return value \e n > 1, every n-th point will be printed. */ int GetDownSampling() const {return m_downsampling;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; //! Dialog for setting the parameters of a Gaussian function. class wxStfGaussianDlg : public wxDialog { DECLARE_EVENT_TABLE() private: double m_width; double m_center; double m_amp; wxStdDialogButtonSizer* m_sdbSizer; wxSlider* m_slider; wxTextCtrl *m_textCtrlCenter, *m_textCtrlWidth; //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfGaussianDlg( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("Settings for Gaussian function"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Get the width of the Gaussian. /*! \return The width of the Gaussian. */ double Width() const {return m_width;} //! Get the center of the Gaussian. /*! \return The center of the Gaussian. */ double Center() const {return m_center;} //! Get the amplitude of the Gaussian. /*! \return The amplitude of the Gaussian. */ double Amp() const {return m_amp;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; //! Dialog for text import filter settings. class wxStfTextImportDlg : public wxDialog { DECLARE_EVENT_TABLE() private: int m_hLines; bool m_toSection; bool m_firstIsTime; bool m_isSeries; int m_ncolumns; double m_sr; wxString m_yUnits; wxString m_yUnitsCh2; wxString m_xUnits; bool m_applyToAll; void disableSenseless(); wxStdDialogButtonSizer* m_sdbSizer; wxTextCtrl *m_textCtrlHLines, *m_textCtrlYUnits, *m_textCtrlYUnitsCh2, *m_textCtrlXUnits, *m_textCtrlSR; wxComboBox *m_comboBoxNcolumns,*m_comboBoxFirsttime,*m_comboBoxSecorch; wxCheckBox *m_checkBoxApplyToAll; void OnComboNcolumns( wxCommandEvent& event ); void OnComboFirsttime( wxCommandEvent& event ); void OnComboSecorch( wxCommandEvent& event ); //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param textPreview The preview text to be shown. * \param hLines_ The number of header lines that are initially set. * \param isSeries Set this to true for file series so that they can * be batch-opened. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfTextImportDlg( wxWindow* parent, const wxString& textPreview=wxT("\0"), int hLines_=1, bool isSeries=false, int id = wxID_ANY, wxString title = wxT("Text file import settings"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Get the number of header lines. /*! \return The number of header lines. */ int GetHLines() const {return m_hLines;} //! Indicates whether columns should be put into section or into channels. /*! \return true if they should be put into sections. */ bool ToSection() const {return m_toSection;} //! Indicates whether the first column contains time values. /*! \return true is the first column contains time values. */ bool FirstIsTime() const {return m_firstIsTime;} //! Get the number of columns. /*! \return The number of columns. */ int GetNColumns() const {return m_ncolumns;} //! Get the sampling rate. /*! \return The sampling rate. */ double GetSR() const {return m_sr;} //! Get the y units of the first channel. /*! \return The y units of the first channel. */ const wxString& GetYUnits() const {return m_yUnits;} //! Get the y units of the second channel. /*! \return The y units of the second channel. */ const wxString& GetYUnitsCh2() const {return m_yUnitsCh2;} //! Get the x units. /*! \return The x units. */ const wxString& GetXUnits() const {return m_xUnits;} //! Indicates whether the settings apply to all files in a series. /*! \return true if the settings apply to all files. */ bool ApplyToAll() const {return m_applyToAll;} //! Get the text import filter settings struct. /*! \return The stf::txtImportSettings struct. */ stfio::txtImportSettings GetTxtImport() const; //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; class wxDirPickerCtrl; class wxListCtrl; //! Dialog for re-ordering channels before saving to file class wxStfOrderChannelsDlg : public wxDialog { DECLARE_EVENT_TABLE() private: wxListCtrl* m_List; std::vector channelOrder; void OnUparrow( wxCommandEvent& event ); void OnDownarrow( wxCommandEvent& event ); void SwapItems(long itemId1, long itemId2); //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param channelNames A vector containing channel names. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfOrderChannelsDlg( wxWindow* parent, const std::vector& channelNames= std::vector(0), int id = wxID_ANY, wxString title = wxT("Re-order channels"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Get the new channel order. /*! \return A vector of newly ordered channel indices. */ std::vector GetChannelOrder() const {return channelOrder;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; /* @} */ #endif stimfit-0.16.0/src/stimfit/gui/dlgs/convertdlg.h0000664000175000017500000000635613277303516016524 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file convertdlg.h * \author Christoph Schmidt-Hieber * \date 2015-05-04 * \brief Batch conversion of files */ #ifndef _CONVERTDLG_H #define _CONVERTDLG_H /*! \addtogroup wxstf * @{ */ #include #include #include #include "./../../stf.h" //! Dialog for batch conversion of files.from cfs to atf. class wxStfConvertDlg : public wxDialog { DECLARE_EVENT_TABLE() private: wxGenericDirCtrl *mySrcDirCtrl, *myDestDirCtrl; wxString srcDir,destDir; wxString srcFilter; wxCheckBox* myCheckBoxSubdirs; stfio::filetype srcFilterExt, destFilterExt; wxArrayString srcFileNames; bool ReadPath(const wxString& path); void OnComboBoxSrcExt(wxCommandEvent& event); void OnComboBoxDestExt(wxCommandEvent& event); //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfConvertDlg( wxWindow* parent, int id = wxID_ANY, wxString title = wxT("Convert file series"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Get the source directory. /*! \return The source directory. */ wxString GetSrcDir() const {return srcDir;} //! Get the destination directory. /*! \return The destination directory. */ wxString GetDestDir() const {return destDir;} //! Get the source extension filter. /*! \return The source extension filter. */ wxString GetSrcFilter() const {return srcFilter;} //! Get the source extension as stfio::filetype. /*! \return The source extension as stfio::filetype. */ stfio::filetype GetSrcFileExt() const {return srcFilterExt;} //! Get the destination extension as stfio::filetype. /*! \return The destination extension as stfio::filetype. */ stfio::filetype GetDestFileExt() const {return destFilterExt;} //! Get the list of file names. /*! \return A vector with source file names. */ wxArrayString GetSrcFileNames() const {return srcFileNames;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; /* @} */ #endif stimfit-0.16.0/src/stimfit/gui/dlgs/eventdlg.cpp0000775000175000017500000002126213354367041016513 00000000000000#include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "./../../stf.h" #include "./eventdlg.h" #include "./../app.h" enum { wxID_COMBOTEMPLATES, wxID_CRITERIA, wxDETECTIONCLEMENTS, wxDETECTIONJONAS, wxDETECTIONPERNIA }; BEGIN_EVENT_TABLE( wxStfEventDlg, wxDialog ) EVT_RADIOBUTTON( wxDETECTIONCLEMENTS, wxStfEventDlg::OnClements ) EVT_RADIOBUTTON( wxDETECTIONJONAS, wxStfEventDlg::OnJonas ) EVT_RADIOBUTTON( wxDETECTIONPERNIA, wxStfEventDlg::OnPernia ) END_EVENT_TABLE() wxStfEventDlg::wxStfEventDlg(wxWindow* parent, const std::vector& templateSections, bool isExtract_, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ), m_threshold(4.0), m_mode(stf::criterion), isExtract(isExtract_), m_minDistance(150), m_template(-1) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer* templateSizer = new wxFlexGridSizer(2,1,0,0); wxStaticText* staticTextTempl = new wxStaticText( this, wxID_ANY, wxT("Select template fit from section:"), wxDefaultPosition, wxDefaultSize, 0 ); templateSizer->Add( staticTextTempl, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxArrayString templateNames; templateNames.Alloc(templateSections.size()); int max_w = 0; for (std::size_t n_templ=0;n_templGetSectionDescription()); if (sec_desc.empty()) { sec_desc = wxT("Section "); sec_desc << n_templ; } int w, h; GetTextExtent( sec_desc, &w, &h ); if ( w > max_w ) max_w = w; templateNames.Add( sec_desc ); } } m_comboBoxTemplates = new wxComboBox( this, wxID_COMBOTEMPLATES, wxT("1"), wxDefaultPosition, wxSize( max_w + 36, 24 ), templateNames, wxCB_DROPDOWN | wxCB_READONLY ); if (templateSections.size()>0) { m_comboBoxTemplates->SetSelection(0); } templateSizer->Add( m_comboBoxTemplates, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); topSizer->Add( templateSizer, 0, wxALIGN_CENTER | wxALL, 5 ); if (isExtract) { wxFlexGridSizer* gridSizer; gridSizer=new wxFlexGridSizer(2,2,0,0); wxStaticText* staticTextThr; staticTextThr = new wxStaticText( this, wxID_CRITERIA, wxT("Threshold:"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextThr, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString def; def << m_threshold; m_textCtrlThr = new wxTextCtrl( this, wxID_ANY, def, wxDefaultPosition, wxSize(40,20), wxTE_RIGHT ); gridSizer->Add( m_textCtrlThr, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxStaticText* staticTextDist; staticTextDist = new wxStaticText( this, wxID_ANY, wxT("Min. distance between events (# points):"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextDist, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString def2; def2 << m_minDistance; m_textCtrlDist = new wxTextCtrl( this, wxID_ANY, def2, wxDefaultPosition, wxSize(40,20), wxTE_RIGHT ); gridSizer->Add( m_textCtrlDist, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); topSizer->Add( gridSizer, 0, wxALIGN_CENTER | wxALL, 5 ); //*** Radio options for event detection methods ***// m_radioBox = new wxStaticBoxSizer( wxVERTICAL, this, wxT("Detection method")); wxString m_radioBoxChoices[] = { wxT("Template scaling (Clements && Bekkers)"), wxT("Correlation coefficient (Jonas et al.)"), wxT("Deconvolution (Pernia-Andrade et al.)") }; wxRadioButton* wxRadioClements = new wxRadioButton(this, wxDETECTIONCLEMENTS, m_radioBoxChoices[0], wxDefaultPosition, wxDefaultSize, wxRB_GROUP); wxRadioButton* wxRadioJonas = new wxRadioButton(this, wxDETECTIONJONAS, m_radioBoxChoices[1], wxDefaultPosition, wxDefaultSize); wxRadioButton* wxRadioPernia = new wxRadioButton(this, wxDETECTIONPERNIA, m_radioBoxChoices[2], wxDefaultPosition, wxDefaultSize); m_radioBox->Add(wxRadioClements, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); m_radioBox->Add(wxRadioJonas, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); m_radioBox->Add(wxRadioPernia, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); //m_radioBox->SetSelection(0); topSizer->Add( m_radioBox, 0, wxALIGN_CENTER | wxALL, 5 ); } m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfEventDlg::EndModal(int retCode) { wxCommandEvent unusedEvent; // similar to overriding OnOK in MFC (I hope...) switch( retCode) { case wxID_OK: if (!OnOK()) { wxLogMessage(wxT("Select a detection method")); return; } break; case wxID_CANCEL: break; default: return; } wxDialog::EndModal(retCode); } bool wxStfEventDlg::OnOK() { // Read template: m_template = m_comboBoxTemplates->GetCurrentSelection(); if (m_template<0) { wxLogMessage(wxT("Please select a valid template")); return false; } if (isExtract) { // Read entry to string: m_textCtrlThr->GetValue().ToDouble( &m_threshold ); long tempLong; m_textCtrlDist->GetValue().ToLong( &tempLong ); m_minDistance = (int)tempLong; wxRadioButton* wxRadioClements = (wxRadioButton*)FindWindow(wxDETECTIONCLEMENTS); wxRadioButton* wxRadioJonas = (wxRadioButton*)FindWindow(wxDETECTIONJONAS); wxRadioButton* wxRadioPernia = (wxRadioButton*)FindWindow(wxDETECTIONPERNIA); if ( wxRadioClements->GetValue() ) m_mode = stf::criterion; else if ( wxRadioJonas->GetValue() ) m_mode = stf::correlation; else if ( wxRadioPernia->GetValue() ) m_mode = stf::deconvolution; else return false; /*switch (m_radioBox->GetSelection()) { case 0: m_mode = stf::criterion; break; case 1: m_mode = stf::correlation; break; case 2: m_mode = stf::deconvolution; break; }*/ if (m_mode==stf::correlation && (m_threshold<0 || m_threshold>1)) { wxLogMessage(wxT("Please select a value between 0 and 1 for the correlation coefficient")); return false; } } return true; } void wxStfEventDlg::OnClements( wxCommandEvent& event) { event.Skip(); wxRadioButton* wxRadioClements = (wxRadioButton*)FindWindow(wxDETECTIONCLEMENTS); wxStaticText* staticTextThr = (wxStaticText*)FindWindow(wxID_CRITERIA); if (wxRadioClements == NULL || staticTextThr == NULL){ wxGetApp().ErrorMsg(wxT("Null pointer in wxStfEvenDlg::OnClements()")); return; } staticTextThr->SetLabel(wxT("Threshold:")); } void wxStfEventDlg::OnJonas( wxCommandEvent& event) { event.Skip(); wxRadioButton* wxRadioJonas = (wxRadioButton*)FindWindow(wxDETECTIONJONAS); wxStaticText* staticTextThr = (wxStaticText*)FindWindow(wxID_CRITERIA); if (wxRadioJonas == NULL || staticTextThr == NULL){ wxGetApp().ErrorMsg(wxT("Null pointer in wxStfEvenDlg::OnJonas()")); return; } staticTextThr->SetLabel(wxT("Correlation:")); } void wxStfEventDlg::OnPernia( wxCommandEvent& event) { event.Skip(); wxRadioButton* wxRadioPernia = (wxRadioButton*)FindWindow(wxDETECTIONPERNIA); wxStaticText* staticTextThr = (wxStaticText*)FindWindow(wxID_CRITERIA); if (wxRadioPernia == NULL || staticTextThr == NULL){ wxGetApp().ErrorMsg(wxT("Null pointer in wxStfEvenDlg::OnPernia()")); return; } staticTextThr->SetLabel( wxT("Standard deviation:") ); } stimfit-0.16.0/src/stimfit/gui/dlgs/convertdlg.cpp0000664000175000017500000002432713567226230017054 00000000000000#include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include #include #include #include "convertdlg.h" #include "./../app.h" enum { wxCOMBOBOX_SRC, wxCOMBOBOX_DEST, wxGENERICDIRCTRL_SRC, wxGENERICDIRCTRL_DEST }; BEGIN_EVENT_TABLE( wxStfConvertDlg, wxDialog ) EVT_COMBOBOX( wxCOMBOBOX_SRC, wxStfConvertDlg::OnComboBoxSrcExt) EVT_COMBOBOX( wxCOMBOBOX_DEST, wxStfConvertDlg::OnComboBoxDestExt) END_EVENT_TABLE() // wxStfConvertDlg constructor wxStfConvertDlg::wxStfConvertDlg(wxWindow* parent, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ), srcDir(wxT("")), destDir(wxT("")), srcFilter(wxT("")), myCheckBoxSubdirs(NULL), srcFilterExt(stfio::cfs), destFilterExt(stfio::igor), srcFileNames(0) { if (srcDir == wxT("")) { srcDir = wxGetApp().wxGetProfileString( wxT("Settings"), wxT("Most recent batch source directory"), wxT("")); if (srcDir == wxT("") || !wxFileName::DirExists(srcDir)) { srcDir = wxStandardPaths::Get().GetDocumentsDir(); } } if (destDir == wxT("")) { destDir = wxGetApp().wxGetProfileString( wxT("Settings"), wxT("Most recent batch target directory"), wxT("")); if (destDir == wxT("") || !wxFileName::DirExists(destDir)) { destDir = wxStandardPaths::Get().GetDocumentsDir(); } } wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); //wxFlexGridSizer *gridSizer; //gridSizer = new wxFlexGridSizer(2,2,0,10); wxFlexGridSizer *gridSizer; gridSizer = new wxFlexGridSizer(1,2,0,0); // SOURCE dir ------------------------------------------------------ // wxFlexGridSizer to place a 1) combo + 2) directory listing wxFlexGridSizer *myLeftSizer; // this is a sizer for the left side myLeftSizer = new wxFlexGridSizer(3, 1, 0, 0); // SOURCE 1.- wxComboBox to select the source file extension wxFlexGridSizer *mySrcComboSizer; // a sizer for my Combo mySrcComboSizer = new wxFlexGridSizer(1, 2, 0, 0); wxStaticText* staticTextExt; staticTextExt = new wxStaticText( this, wxID_ANY, wxT("Origin filetype:"), wxDefaultPosition, wxDefaultSize, 0 ); wxArrayString myextensions; myextensions.Add(wxT("CFS binary [*.dat ]")); myextensions.Add(wxT("Axon binary [*.abf ]")); myextensions.Add(wxT("Axograph [*.axgd]")); myextensions.Add(wxT("Axon textfile [*.atf ]")); myextensions.Add(wxT("ASCII [*.* ]")); myextensions.Add(wxT("HDF5 [*.h5 ]")); myextensions.Add(wxT("HEKA files [*.dat ]")); myextensions.Add(wxT("Igor files [*.ibw ]")); wxComboBox* myComboBoxExt; myComboBoxExt = new wxComboBox(this, wxCOMBOBOX_SRC, myextensions[0], wxDefaultPosition, wxDefaultSize, myextensions, wxCB_READONLY); // add to mySrcComboSizer mySrcComboSizer->Add( staticTextExt, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); mySrcComboSizer->Add( myComboBoxExt, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // add to myLeftSizer myLeftSizer->Add( mySrcComboSizer, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // ---- wxComboBox to select the source file extension // SOURCE 2.- A wxGenericDirCtrl to select the source directory: //wxGenericDirCtrl *mySrcDirCtrl; mySrcDirCtrl = new wxGenericDirCtrl(this, wxGENERICDIRCTRL_SRC, srcDir, wxDefaultPosition, wxSize(300,300), wxDIRCTRL_DIR_ONLY); // add to myLeftSizer myLeftSizer->Add( mySrcDirCtrl, 0, wxEXPAND | wxALL , 2 ); // ---- A wxGenericDirCtrl to select the source directory: myCheckBoxSubdirs = new wxCheckBox( this, wxID_ANY, wxT("Include subdirectories"), wxDefaultPosition, wxDefaultSize, 0 ); myCheckBoxSubdirs->SetValue(false); myLeftSizer->Add( myCheckBoxSubdirs, 0, wxALIGN_LEFT | wxALL, 2 ); // Finally add myLeftSizer to the gridSizer gridSizer->Add( myLeftSizer, 0, wxALIGN_LEFT, 5 ); //topSizer->Add( gridSizer, 0, wxALIGN_CENTER, 5 ); // DESTINATION dir ---------------------------------------------------------- // wxFlexGridSizer to place a 1) combo + 2) directory listing wxFlexGridSizer *myRightSizer; // this is a sizer for the right side myRightSizer = new wxFlexGridSizer(2, 1, 0, 0); // DESTINATION 1.- wxComboBox to select the destiny file extension wxFlexGridSizer *myDestComboSizer; // a sizer for my Combo myDestComboSizer = new wxFlexGridSizer(1, 2, 0, 0); wxStaticText* staticTextDestExt; staticTextDestExt = new wxStaticText( this, wxID_ANY, wxT("Destination filetype:"), wxDefaultPosition, wxDefaultSize, 0 ); wxArrayString mydestextensions; //ordered by importance mydestextensions.Add(wxT("Igor binary [*.ibw ]")); mydestextensions.Add(wxT("Axon textfile [*.atf ]")); #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) mydestextensions.Add(wxT("GDF (Biosig) [*.gdf ]")); #endif wxComboBox* myComboBoxDestExt; myComboBoxDestExt = new wxComboBox(this, wxCOMBOBOX_DEST, mydestextensions[0], wxDefaultPosition, wxDefaultSize, mydestextensions, wxCB_READONLY); // add to mySrcComboSizer myDestComboSizer->Add( staticTextDestExt, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); myDestComboSizer->Add( myComboBoxDestExt, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // add to myRightSizer myRightSizer->Add( myDestComboSizer, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // ---- wxComboBox to select the source file extension // DESTINATION 2.- A wxGenericDirCtrl to select the destiny directory: myDestDirCtrl = new wxGenericDirCtrl(this, wxGENERICDIRCTRL_DEST, destDir, wxDefaultPosition, wxSize(300,300), wxDIRCTRL_DIR_ONLY); // add to myLeftSizer myRightSizer->Add( myDestDirCtrl, 0, wxEXPAND | wxALL, 2 ); // ---- A wxGenericDirCtrl to select the source directory: // Finally add myRightSizer to gridSizer and this to topSizer gridSizer->Add( myRightSizer, 0, wxALIGN_RIGHT, 5); topSizer->Add( gridSizer, 0, wxALIGN_CENTER, 5 ); // OK / Cancel buttons----------------------------------------------- wxStdDialogButtonSizer* sdbSizer = new wxStdDialogButtonSizer(); wxButton *myConvertButton; myConvertButton = new wxButton( this, wxID_OK, wxT("C&onvert")); // this for wxWidgets 2.9.1 //myConvertButton->SetBitmap(wxBitmap(wxT("icon_cross.png"), wxBITMAP_TYPE_PNG)); sdbSizer->AddButton(myConvertButton); sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); sdbSizer->Realize(); topSizer->Add( sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfConvertDlg::OnComboBoxDestExt(wxCommandEvent& event){ event.Skip(); wxComboBox* pComboBox = (wxComboBox*)FindWindow(wxCOMBOBOX_DEST); if (pComboBox == NULL) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfConvertDlg::OnComboBoxDestExt()")); return; } // update destFilterExt switch(pComboBox->GetSelection()){ case 0: destFilterExt = stfio::igor; break; case 1: destFilterExt = stfio::atf; break; #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) case 2: destFilterExt = stfio::biosig; break; #endif default: destFilterExt = stfio::igor; } } void wxStfConvertDlg::OnComboBoxSrcExt(wxCommandEvent& event){ event.Skip(); wxComboBox* pComboBox = (wxComboBox*)FindWindow(wxCOMBOBOX_SRC); if (pComboBox == NULL) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfConvertDlg::OnComboBoxSrcExt()")); return; } // update srcFilterExt and srcFilter // see index of wxArrayString myextensions to evaluate case switch(pComboBox->GetSelection()){ case 0: srcFilterExt = stfio::cfs; break; case 1: srcFilterExt = stfio::abf; break; case 2: srcFilterExt = stfio::axg; break; case 3: srcFilterExt = stfio::atf; break; case 4: break; case 5: srcFilterExt = stfio::hdf5; break; case 6: srcFilterExt = stfio::heka; break; case 7: srcFilterExt = stfio::igor; break; default: srcFilterExt = stfio::none; } srcFilter = wxT("*") + stf::std2wx(stfio::findExtension(srcFilterExt)); } void wxStfConvertDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { return; } } wxDialog::EndModal(retCode); } bool wxStfConvertDlg::OnOK() { srcDir = mySrcDirCtrl->GetPath(); destDir = myDestDirCtrl->GetPath(); if (!wxDir::Exists(srcDir)) { wxString msg; msg << srcDir << wxT(" doesn't exist"); wxLogMessage(msg); return false; } if (!wxDir::Exists(destDir)) { wxString msg; msg << destDir << wxT(" doesn't exist"); wxLogMessage(msg); return false; } if (!ReadPath(srcDir)) { wxString msg; msg << srcFilter << wxT(" not found in ") << srcDir; wxLogMessage(msg); return false; } wxGetApp().wxWriteProfileString( wxT("Settings"), wxT("Most recent batch source directory"), srcDir); wxGetApp().wxWriteProfileString( wxT("Settings"), wxT("Most recent batch target directory"), destDir); return true; } bool wxStfConvertDlg::ReadPath(const wxString& path) { // Walk through path: wxDir dir(path); if ( !dir.IsOpened() ) { return false; } if (!dir.HasFiles(srcFilter)) { return false; } int dir_flags = myCheckBoxSubdirs->IsChecked() ? wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN : wxDIR_FILES | wxDIR_HIDDEN; wxDir::GetAllFiles(path, &srcFileNames, srcFilter, dir_flags); return true; } stimfit-0.16.0/src/stimfit/gui/dlgs/fitseldlg.h0000775000175000017500000000747413277303516016337 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file fitseldlg.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfFitSelDlg. */ #ifndef _FITSELDLG_H #define _FITSELDLG_H /*! \addtogroup wxstf * @{ */ #include #include #include "./../../stf.h" //! Non-linear regression settings dialog class wxStfFitSelDlg : public wxDialog { DECLARE_EVENT_TABLE() private: int m_fselect; Vector_double init_p; Vector_double opts; bool noInput, use_scaling; void SetPars(); void SetOpts(); void InitOptions(wxFlexGridSizer* optionsGrid); void Update_fselect(); void read_init_p(); void read_opts(); static const int MAXPAR=20; void OnListItemSelected( wxListEvent& event ); void OnButtonClick( wxCommandEvent& event ); wxStdDialogButtonSizer* m_sdbSizer; wxListCtrl* m_listCtrl; wxTextCtrl *m_textCtrlMu,*m_textCtrlJTE,*m_textCtrlDP,*m_textCtrlE2, *m_textCtrlMaxiter, *m_textCtrlMaxpasses; wxCheckBox *m_checkBox; std::vector< wxStaticText* > paramDescArray; std::vector< wxTextCtrl* > paramEntryArray; wxStfDoc* pDoc; //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param doc Pointer to the document the call originated from. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfFitSelDlg( wxWindow* parent, wxStfDoc* doc, int id = wxID_ANY, wxString title = wxT("Non-linear regression"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); //! Get the selected fit function. /*! \return The index of the selected fit function. */ int GetFSelect() const {return m_fselect;} //! Get the initial parameters. /*! \return A valarray containing the initial parameter set to start the fit. */ Vector_double GetInitP() const {return init_p;} //! Get options for the algorithm. /*! \return A valarray containing the initial parameters for the algorithm. */ Vector_double GetOpts() const {return opts;} //! Scale x- and y-amplitudes to 1.0 before fit /*! \return True if scaling should be used */ bool UseScaling() const {return use_scaling;} //! Determines whether user-defined initial parameters are allowed. /*! \param noInput_ Set to true if the user may set the initial parameters, false otherwise. * Needed for batch analysis. */ void SetNoInput(bool noInput_) {noInput=noInput_;} }; /* @} */ #endif stimfit-0.16.0/src/stimfit/gui/dlgs/eventdlg.h0000775000175000017500000000720313354367041016157 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file eventdlg.h * \author Christoph Schmidt-Hieber * \date 2008-01-18 * \brief Declares wxStfEventDlg. */ #ifndef _EVENTDLG_H #define _EVENTDLG_H /*! \addtogroup wxstf * @{ */ #include class SectionPointer; //! Dialog for event-detection settings. class wxStfEventDlg : public wxDialog { DECLARE_EVENT_TABLE() private: double m_threshold; stf::extraction_mode m_mode; bool isExtract; int m_minDistance; int m_template; wxStdDialogButtonSizer* m_sdbSizer; wxTextCtrl *m_textCtrlThr, *m_textCtrlDist; wxStaticBoxSizer* m_radioBox; wxComboBox* m_comboBoxTemplates; wxStaticText* staticTextThr; wxRadioButton* wxRadioClements; wxRadioButton* wxRadioJonas; wxRadioButton* wxRadioPernia; void OnClements( wxCommandEvent & event ); void OnJonas( wxCommandEvent & event ); void OnPernia( wxCommandEvent & event ); //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param templateSections A vector of pointers to sections that contain fits * which might be used as a template. * \param isExtract true if events are to be detected for later extraction * (rather than just plotting the detection criterion or * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfEventDlg( wxWindow* parent, const std::vector& templateSections, bool isExtract, int id = wxID_ANY, wxString title = wxT("Event detection settings"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Get the event detection threshold. /*! \return The event detection threshold. */ double GetThreshold() const {return m_threshold;} //! Indicates the selected extraction algorithm /*! \return The extraction algorithm. */ stf::extraction_mode GetMode() const {return m_mode;} //! Get the minimal distance between events. /*! \return The minimal distance between events in units of sampling points. */ int GetMinDistance() const {return m_minDistance;} //! Get the selected template. /*! \return The index of the template fit to be used for event detection. */ int GetTemplate() const {return m_template;} //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); }; /* @} */ #endif stimfit-0.16.0/src/stimfit/gui/dlgs/cursorsdlg.cpp0000775000175000017500000024103013277303516017070 00000000000000#include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "./../app.h" #include "./cursorsdlg.h" #include "./../doc.h" enum { wxLOADCRS, wxSAVECRS, wxCOMBOUM, wxCOMBOU1P, wxCOMBOU2P, wxCOMBOU1B, wxCOMBOU2B, wxCOMBOU1D, wxCOMBOU2D, wxCOMBOU1L, wxCOMBOU2L, #ifdef WITH_PSLOPE wxCOMBOU1PS, wxCOMBOU2PS, #endif wxTEXTM, wxTEXT1P, wxTEXT2P, wxTEXT1B, wxTEXT2B, wxTEXT1D, wxTEXT2D, wxTEXT1L, wxTEXT2L, #ifdef WITH_PSLOPE wxTEXT1PS, wxTEXT2PS, wxTEXT_PSDELTAT, #endif wxTEXTPM, wxRADIOALL, wxRADIOMEAN, wxRADIO_BASELINE_METHOD, // 0: mean + s.d.; 1: median + iqr wxRADIO_LAT_MAXSLOPE1, wxRADIO_LAT_HALFWIDTH1, wxRADIO_LAT_PEAK1, wxRADIO_LAT_MANUAL1, wxRADIO_LAT_EVENT2, wxRADIO_LAT_MAXSLOPE2, wxRADIO_LAT_HALFWIDTH2, wxRADIO_LAT_PEAK2, wxRADIO_LAT_MANUAL2, #ifdef WITH_PSLOPE // Slope radio boxes wxRADIO_PSManBeg, wxRADIO_PSEventBeg, wxRADIO_PSThrBeg, wxRADIO_PSt50Beg, wxRADIO_PSManEnd, wxRADIO_PSt50End, wxRADIO_PSDeltaT, wxRADIO_PSPeakEnd, #endif //WITH_PSLOPE wxMEASCURSOR, wxPEAKATEND, wxPEAKMEAN, wxDIRECTION, wxSLOPE, wxSLOPEUNITS, wxREFERENCE, wxSTARTFITATPEAK, //wxID_STARTFITATPEAK, wxRT_LABEL, wxRT_SLIDER, wxIDNOTEBOOK }; BEGIN_EVENT_TABLE( wxStfCursorsDlg, wxDialog ) EVT_NOTEBOOK_PAGE_CHANGED(wxIDNOTEBOOK, wxStfCursorsDlg::OnPageChanged) EVT_COMBOBOX( wxCOMBOUM, wxStfCursorsDlg::OnComboBoxUM ) EVT_COMBOBOX( wxCOMBOU1P, wxStfCursorsDlg::OnComboBoxU1P ) EVT_COMBOBOX( wxCOMBOU2P, wxStfCursorsDlg::OnComboBoxU2P ) EVT_COMBOBOX( wxCOMBOU1B, wxStfCursorsDlg::OnComboBoxU1B ) EVT_COMBOBOX( wxCOMBOU2B, wxStfCursorsDlg::OnComboBoxU2B ) EVT_COMBOBOX( wxCOMBOU1D, wxStfCursorsDlg::OnComboBoxU1D ) EVT_COMBOBOX( wxCOMBOU2D, wxStfCursorsDlg::OnComboBoxU2D ) EVT_COMBOBOX( wxCOMBOU1L, wxStfCursorsDlg::OnComboBoxU1L ) EVT_COMBOBOX( wxCOMBOU2L, wxStfCursorsDlg::OnComboBoxU2L ) #ifdef WITH_PSLOPE EVT_COMBOBOX( wxCOMBOU1PS, wxStfCursorsDlg::OnComboBoxU1PS ) EVT_COMBOBOX( wxCOMBOU2PS, wxStfCursorsDlg::OnComboBoxU2PS ) #endif EVT_BUTTON( wxID_APPLY, wxStfCursorsDlg::OnPeakcalcexec ) EVT_BUTTON( wxID_OPEN, wxStfCursorsDlg::OnLoadCursorConf ) EVT_BUTTON( wxID_SAVE, wxStfCursorsDlg::OnSaveCursorConf ) // bindings radio buttons EVT_RADIOBUTTON( wxRADIOALL, wxStfCursorsDlg::OnRadioAll ) EVT_RADIOBUTTON( wxRADIOMEAN, wxStfCursorsDlg::OnRadioMean ) EVT_RADIOBUTTON( wxRADIO_LAT_MANUAL1, wxStfCursorsDlg::OnRadioLatManualBeg ) EVT_RADIOBUTTON( wxRADIO_LAT_MAXSLOPE1, wxStfCursorsDlg::OnRadioLatNonManualBeg ) EVT_RADIOBUTTON( wxRADIO_LAT_HALFWIDTH1, wxStfCursorsDlg::OnRadioLatNonManualBeg ) EVT_RADIOBUTTON( wxRADIO_LAT_PEAK1, wxStfCursorsDlg::OnRadioLatNonManualBeg ) EVT_RADIOBUTTON( wxRADIO_LAT_MANUAL2, wxStfCursorsDlg::OnRadioLatManualEnd ) EVT_RADIOBUTTON( wxRADIO_LAT_HALFWIDTH2, wxStfCursorsDlg::OnRadioLatNonManualEnd ) EVT_RADIOBUTTON( wxRADIO_LAT_PEAK2, wxStfCursorsDlg::OnRadioLatNonManualEnd ) EVT_RADIOBUTTON( wxRADIO_LAT_MAXSLOPE2, wxStfCursorsDlg::OnRadioLatNonManualEnd ) EVT_RADIOBUTTON( wxRADIO_LAT_EVENT2, wxStfCursorsDlg::OnRadioLatNonManualEnd ) EVT_COMMAND_SCROLL( wxRT_SLIDER, wxStfCursorsDlg::OnRTSlider ) EVT_CHECKBOX (wxPEAKATEND, wxStfCursorsDlg::OnPeakAtEnd ) EVT_CHECKBOX (wxSTARTFITATPEAK, wxStfCursorsDlg::OnStartFitAtPeak ) #ifdef WITH_PSLOPE EVT_RADIOBUTTON( wxRADIO_PSManBeg, wxStfCursorsDlg::OnRadioPSManBeg ) EVT_RADIOBUTTON( wxRADIO_PSEventBeg, wxStfCursorsDlg::OnRadioPSEventBeg ) EVT_RADIOBUTTON( wxRADIO_PSThrBeg, wxStfCursorsDlg::OnRadioPSThrBeg ) EVT_RADIOBUTTON( wxRADIO_PSt50Beg, wxStfCursorsDlg::OnRadioPSt50Beg ) EVT_RADIOBUTTON( wxRADIO_PSManEnd, wxStfCursorsDlg::OnRadioPSManEnd ) EVT_RADIOBUTTON( wxRADIO_PSt50End, wxStfCursorsDlg::OnRadioPSt50End ) EVT_RADIOBUTTON( wxRADIO_PSDeltaT, wxStfCursorsDlg::OnRadioPSDeltaT ) EVT_RADIOBUTTON( wxRADIO_PSPeakEnd, wxStfCursorsDlg::OnRadioPSPeakEnd ) #endif END_EVENT_TABLE() wxStfCursorsDlg::wxStfCursorsDlg(wxWindow* parent, wxStfDoc* initDoc, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ), cursorMIsTime(true), cursor1PIsTime(true), cursor2PIsTime(true), cursor1BIsTime(true), cursor2BIsTime(true), cursor1DIsTime(true), cursor2DIsTime(true), #ifdef WITH_PSLOPE cursor1PSIsTime(true), cursor2PSIsTime(true), #endif cursor1LIsTime(true), cursor2LIsTime(true), actDoc(initDoc) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); m_notebook = new wxNotebook( this, wxIDNOTEBOOK, wxDefaultPosition, wxDefaultSize, 0 ); m_notebook->AddPage( CreateMeasurePage(), wxT("Measure")); m_notebook->AddPage( CreatePeakPage(), wxT("Peak")); m_notebook->AddPage( CreateBasePage(), wxT("Base")); m_notebook->AddPage( CreateDecayPage(), wxT("Decay")); m_notebook->AddPage( CreateLatencyPage(), wxT("Latency")); #ifdef WITH_PSLOPE m_notebook->AddPage( CreatePSlopePage(), wxT("PSlope")); #endif topSizer->Add( m_notebook, 1, wxEXPAND | wxALL, 5 ); wxButton* bClose = new wxButton( this, wxID_CANCEL, wxT("Close") ); wxButton* bApply = new wxButton( this, wxID_APPLY, wxT("Apply") ); wxButton* bLoad = new wxButton( this, wxID_OPEN, wxT("Load") ); wxButton* bSave = new wxButton( this, wxID_SAVE, wxT("Save") ); wxBoxSizer* pSdbSizer = new wxBoxSizer(wxHORIZONTAL); pSdbSizer->Add( bClose, 0, wxALL, 1); pSdbSizer->Add( bApply, 0, wxALL, 1); pSdbSizer->Add( bLoad, 0, wxALL, 1); pSdbSizer->Add( bSave, 0, wxALL, 1); //pSdbSizer->Realize(); topSizer->Add( pSdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); if (actDoc!=NULL) { try { UpdateCursors(); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg( wxString( e.what(), wxConvLocal )); } } } bool wxStfCursorsDlg::TransferDataFromWindow() { // Apply settings before closing dialog: wxCommandEvent unusedEvent; return wxWindow::TransferDataFromWindow(); } void wxStfCursorsDlg::EndModal(int retCode) { wxCommandEvent unusedEvent; // similar to overriding OnOK in MFC (I hope...) switch (retCode) { case wxID_OK: if (!OnOK()) { wxLogMessage(wxT("Please select a valid function")); return; } OnPeakcalcexec(unusedEvent); break; case wxID_CANCEL: break; default: ; } wxDialog::EndModal(retCode); } bool wxStfCursorsDlg::IsCSRSyntax( wxFileConfig* csr_file) { wxString msg = wxT("Syntax Error: "); // Check groups wxString CSR_Group[] = { wxT("__CSR_HEADER__"), wxT("__MEASURE__"), wxT("__PEAK__"), wxT("__BASE__"), wxT("__DECAY__"), wxT("__LATENCY__") }; unsigned int nGroups = sizeof(CSR_Group)/sizeof(wxString); for (std::vector::size_type i=0; iHasGroup(CSR_Group[i])) { wxGetApp().ErrorMsg( msg + CSR_Group[i] + wxT(" not found !") ); return false; } } // check entry in every group // Other checkings... number of Groups if (nGroups != csr_file->GetNumberOfGroups()) { wxGetApp().ErrorMsg( wxT("Unexpected number of groups") ); return false; } return true; } bool wxStfCursorsDlg::OnOK() { //wxCommandEvent unusedEvent; //OnPeakcalcexec(unusedEvent); return true; } wxNotebookPage* wxStfCursorsDlg::CreateMeasurePage() { wxPanel* nbPage; nbPage=new wxPanel(m_notebook); wxBoxSizer* pageSizer; pageSizer=new wxBoxSizer(wxVERTICAL); pageSizer->Add( CreateCursorInput( nbPage, wxTEXTM, -1, wxCOMBOUM, -1, 1, 10 ), 0, wxALIGN_CENTER | wxALL, 2 ); wxCheckBox* pMeasCursor=new wxCheckBox( nbPage, wxMEASCURSOR, wxT("Show vertical ruler through cursor"), wxDefaultPosition, wxDefaultSize, 0 ); pageSizer->Add( pMeasCursor, 0, wxALIGN_CENTER | wxALL, 2); pageSizer->SetSizeHints( nbPage ); nbPage->SetSizer( pageSizer ); nbPage->Layout(); return nbPage; } wxNotebookPage* wxStfCursorsDlg::CreatePeakPage() { wxPanel* nbPage; nbPage=new wxPanel(m_notebook); wxBoxSizer* pageSizer; pageSizer=new wxBoxSizer(wxVERTICAL); pageSizer->Add( CreateCursorInput( nbPage, wxTEXT1P, wxTEXT2P, wxCOMBOU1P, wxCOMBOU2P, 1, 10 ), 0, wxALIGN_CENTER | wxALL, 2 ); wxCheckBox* pPeakAtEnd=new wxCheckBox( nbPage, wxPEAKATEND, wxT("Peak window ends at end of trace"), wxDefaultPosition, wxDefaultSize, 0 ); pPeakAtEnd->SetValue(false); pageSizer->Add( pPeakAtEnd, 0, wxALIGN_CENTER | wxALL, 2); wxFlexGridSizer* peakSettingsGrid; peakSettingsGrid=new wxFlexGridSizer(1,2,0,0); // rows, cols // START: Number of points for peak calculation: wxFlexGridSizer* CommonGrid; CommonGrid = new wxFlexGridSizer(1,2,0,0); wxFlexGridSizer* LeftGrid; LeftGrid = new wxFlexGridSizer(1,0,0); wxStaticBoxSizer* peakPointsSizer = new wxStaticBoxSizer( wxVERTICAL, nbPage, wxT("Number of points for peak") ); wxRadioButton* pAllPoints = new wxRadioButton( nbPage, wxRADIOALL, wxT("All points within peak window"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); wxRadioButton* pMeanPoints = new wxRadioButton( nbPage, wxRADIOMEAN, wxT("User-defined:"), wxDefaultPosition, wxDefaultSize ); wxFlexGridSizer* usrdefGrid; usrdefGrid = new wxFlexGridSizer(1,2,0,0); usrdefGrid->Add(pMeanPoints, 0, wxALIGN_RIGHT |wxALIGN_CENTER_VERTICAL | wxALL, 2); wxTextCtrl* textMeanPoints=new wxTextCtrl( nbPage, wxTEXTPM, wxT("1"), wxDefaultPosition, wxSize(44,20), wxTE_RIGHT ); usrdefGrid->Add(textMeanPoints, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 2); peakPointsSizer->Add( pAllPoints, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2 ); peakPointsSizer->Add( usrdefGrid, 0, wxALIGN_LEFT | wxALIGN_BOTTOM | wxALL, 2 ); peakSettingsGrid->Add( peakPointsSizer, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2 ); LeftGrid->Add(peakSettingsGrid, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2); /** Rise time slider **/ wxFlexGridSizer* RTGrid; RTGrid = new wxFlexGridSizer(1,2,0,0); wxStaticText* pRTLabel = new wxStaticText( nbPage, wxRT_LABEL, wxT("Rise time 20-80%"), wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); wxSlider *RTSlider = new wxSlider( nbPage, wxRT_SLIDER, 20, 5, 45, wxDefaultPosition, wxSize(100, wxDefaultCoord), wxSL_HORIZONTAL | wxSL_AUTOTICKS, wxDefaultValidator, wxT("")); #if (wxCHECK_VERSION(2, 9, 0)) RTSlider->SetTickFreq(5); #else RTSlider->SetTickFreq(5,1); #endif RTGrid->Add(pRTLabel, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); RTGrid->Add(RTSlider, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); LeftGrid->Add(RTGrid, 1, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL | wxALL, 2); CommonGrid->Add(LeftGrid, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2); // END: Number of points for peak calculation: // START: Peak direction wxFlexGridSizer* RigthGrid; RigthGrid = new wxFlexGridSizer(1,0,0); wxString directionChoices[] = { wxT("Up"), wxT("Down"), wxT("Both") }; int directionNChoices = sizeof( directionChoices ) / sizeof( wxString ); wxRadioBox* pDirection = new wxRadioBox( nbPage, wxDIRECTION, wxT("Peak direction"), wxDefaultPosition, wxDefaultSize, directionNChoices, directionChoices, 0, wxRA_SPECIFY_ROWS ); pDirection->SetSelection(1); //peakSettingsGrid->Add( pDirection, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2 ); RigthGrid->Add( pDirection, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2 ); CommonGrid->Add(RigthGrid, 0, wxALIGN_RIGHT | wxALIGN_TOP | wxALL, 2); pageSizer->Add(CommonGrid, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2); //pageSizer->Add(peakSettingsGrid, 0, wxALIGN_CENTER | wxALL, 2); // END: Peak direction wxFlexGridSizer* slopeSettingsGrid = new wxFlexGridSizer(1,2,0,0); // Threshold slope wxStaticBoxSizer* slopeSizer = new wxStaticBoxSizer( wxVERTICAL, nbPage, wxT("Threshold slope ") ); wxFlexGridSizer* slopeGrid = new wxFlexGridSizer(1,2,0,0); // user entry wxTextCtrl* pSlope=new wxTextCtrl( nbPage, wxSLOPE, wxT(""), wxDefaultPosition, wxSize(64,20), wxTE_RIGHT ); slopeGrid->Add( pSlope, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Units wxStaticText* pSlopeUnits=new wxStaticText( nbPage, wxSLOPEUNITS, wxT(" "), wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); slopeGrid->Add( pSlopeUnits, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); slopeSizer->Add( slopeGrid, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); slopeSettingsGrid->Add( slopeSizer, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // START: Measure peak kinetics wxString referenceChoices[] = { wxT("From baseline"), wxT("From threshold") }; int referenceNChoices = sizeof( referenceChoices ) / sizeof( wxString ); wxRadioBox* pReference = new wxRadioBox( nbPage, wxREFERENCE, wxT("Measure peak kinetics "), wxDefaultPosition, wxDefaultSize, referenceNChoices, referenceChoices, 0, wxRA_SPECIFY_ROWS ); pReference->SetSelection(0); slopeSettingsGrid->Add( pReference, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); pageSizer->Add( slopeSettingsGrid, 0, wxALIGN_CENTER | wxALL, 2 ); // END: Measure peak kinetics pageSizer->SetSizeHints(nbPage); nbPage->SetSizer( pageSizer ); nbPage->Layout(); return nbPage; } wxNotebookPage* wxStfCursorsDlg::CreateBasePage() { wxPanel* nbPage; nbPage=new wxPanel(m_notebook); wxBoxSizer* pageSizer; pageSizer=new wxBoxSizer(wxVERTICAL); pageSizer->Add( CreateCursorInput( nbPage, wxTEXT1B, wxTEXT2B, wxCOMBOU1B, wxCOMBOU2B, 1, 10 ), 0, wxALIGN_CENTER | wxALL, 2 ); // Grid wxFlexGridSizer* BaseMethodSizer = new wxFlexGridSizer(1, 0, 0); wxString BaselineMethods[] = { wxT("Mean and Standard Deviation (SD)"), wxT("Median and InterQuartil Ratio (IQR)") }; int iBaselineMethods = sizeof(BaselineMethods) / sizeof(wxString); //**** Radio options for baseline methods "mean, or median " **** wxRadioBox* pBaselineMethod = new wxRadioBox( nbPage, wxRADIO_BASELINE_METHOD, wxT("Method to compute the baseline"), wxDefaultPosition, wxDefaultSize, iBaselineMethods, BaselineMethods, 0, wxRA_SPECIFY_ROWS ); pBaselineMethod->SetSelection(0); BaseMethodSizer->Add(pBaselineMethod, 0, wxALIGN_CENTER | wxALIGN_TOP | wxALL, 2); pageSizer->Add( BaseMethodSizer, 0, wxALIGN_CENTER | wxALL, 2 ); pageSizer->SetSizeHints(nbPage); nbPage->SetSizer( pageSizer ); nbPage->Layout(); return nbPage; } wxNotebookPage* wxStfCursorsDlg::CreateDecayPage() { wxPanel* nbPage; nbPage=new wxPanel(m_notebook); wxBoxSizer* pageSizer; pageSizer=new wxBoxSizer(wxVERTICAL); pageSizer->Add( CreateCursorInput( nbPage, wxTEXT1D, wxTEXT2D, wxCOMBOU1D, wxCOMBOU2D, 1, 10 ), 0, wxALIGN_CENTER | wxALL, 2 ); wxFlexGridSizer* decaySettingsGrid = new wxFlexGridSizer(1,3,0,0); wxCheckBox* pStartFitAtPeak = new wxCheckBox( nbPage, wxSTARTFITATPEAK, wxT("Start fit at peak"), wxDefaultPosition, wxDefaultSize, 0 ); decaySettingsGrid->Add( pStartFitAtPeak, 0, wxALIGN_CENTER | wxALL, 2); pageSizer->Add( decaySettingsGrid, 0, wxALIGN_CENTER | wxALL, 2 ); pageSizer->SetSizeHints(nbPage); nbPage->SetSizer( pageSizer ); nbPage->Layout(); return nbPage; } wxNotebookPage* wxStfCursorsDlg:: CreateLatencyPage(){ wxPanel* nbPage; nbPage = new wxPanel(m_notebook); wxBoxSizer* pageSizer; pageSizer = new wxBoxSizer(wxVERTICAL); pageSizer->Add(CreateCursorInput(nbPage, wxTEXT1L, wxTEXT2L, wxCOMBOU1L, wxCOMBOU2L, 1, 10), 0, wxALIGN_CENTER | wxALL, 2); // Checkbox for using peak window for latency cursors wxStaticText *pUsePeak = new wxStaticText(nbPage, wxID_ANY, wxT("If not manual, latencies are within peak cursors"), wxDefaultPosition, wxDefaultSize, 0); pageSizer->Add(pUsePeak, 0 , wxALIGN_CENTER | wxALL, 2); // Grid wxFlexGridSizer* LatBegEndGrid; LatBegEndGrid = new wxFlexGridSizer(1,2,0,0); // rows, cols //**** Radio options "Measure from" **** wxStaticBoxSizer* LeftBoxSizer = new wxStaticBoxSizer( wxVERTICAL, nbPage, wxT("Reference channel") ); LeftBoxSizer->GetStaticBox()->SetForegroundColour(*wxRED); // Latency from: Manual wxRadioButton* wxRadio_Lat_Manual1 = new wxRadioButton( nbPage, wxRADIO_LAT_MANUAL1, wxT("Manual"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); // Latency from: Peak wxRadioButton* wxRadio_Lat_Peak1 = new wxRadioButton( nbPage, wxRADIO_LAT_PEAK1, wxT("Peak"), wxDefaultPosition, wxDefaultSize); // Latency from: Maximal slope wxRadioButton* wxRadio_Lat_MaxSlope1 = new wxRadioButton( nbPage, wxRADIO_LAT_MAXSLOPE1, wxT("Maximal slope"), wxDefaultPosition, wxDefaultSize ); // Latency from: Half-maximal amplitude wxRadioButton* wxRadio_Lat_HalfWidth1 = new wxRadioButton( nbPage, wxRADIO_LAT_HALFWIDTH1, wxT("Half-width (t50)"), wxDefaultPosition, wxDefaultSize ); // Sizer to group the radio options LeftBoxSizer->Add( wxRadio_Lat_Manual1, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); LeftBoxSizer->Add( wxRadio_Lat_Peak1, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); LeftBoxSizer->Add( wxRadio_Lat_MaxSlope1, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); LeftBoxSizer->Add( wxRadio_Lat_HalfWidth1, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); // Add to LatBegEndGrid LatBegEndGrid->Add(LeftBoxSizer, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2); //**** Radio options "Latency to" **** wxStaticBoxSizer* RightBoxSizer = new wxStaticBoxSizer( wxVERTICAL, nbPage, wxT("To active channel") ); // Latency to: Manual wxRadioButton* wxRadio_Lat_Manual2 = new wxRadioButton( nbPage, wxRADIO_LAT_MANUAL2, wxT("Manual"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); //wxRadio_Lat_Manual2->SetValue(true); // Latency to: Peak wxRadioButton* wxRadio_Lat_Peak2 = new wxRadioButton( nbPage, wxRADIO_LAT_PEAK2, wxT("Peak"), wxDefaultPosition, wxDefaultSize); // Latency to: Half-maximal amplitude wxRadioButton* wxRadio_Lat_HalfWidth2 = new wxRadioButton( nbPage, wxRADIO_LAT_HALFWIDTH2, wxT("Half-width (t50)"), wxDefaultPosition, wxDefaultSize); // Latency to: Maximal slope wxRadioButton* wxRadio_Lat_MaxSlope2 = new wxRadioButton( nbPage, wxRADIO_LAT_MAXSLOPE2, wxT("Maximal slope"), wxDefaultPosition, wxDefaultSize); // Latency to: Beginning of event wxRadioButton* wxRadio_Lat_Event2 = new wxRadioButton( nbPage, wxRADIO_LAT_EVENT2, wxT("Beginning of event"), wxDefaultPosition, wxDefaultSize ); // Sizer to group the radio options RightBoxSizer->Add( wxRadio_Lat_Manual2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); RightBoxSizer->Add( wxRadio_Lat_Peak2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); RightBoxSizer->Add( wxRadio_Lat_MaxSlope2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); RightBoxSizer->Add( wxRadio_Lat_HalfWidth2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); RightBoxSizer->Add( wxRadio_Lat_Event2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); // Add to LatBegEndGrid LatBegEndGrid->Add(RightBoxSizer, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2); pageSizer->Add(LatBegEndGrid, 0, wxALIGN_CENTER | wxALL, 2); nbPage->SetSizer(pageSizer); nbPage->Layout(); return nbPage; } #ifdef WITH_PSLOPE wxNotebookPage* wxStfCursorsDlg::CreatePSlopePage() { wxPanel* nbPage; nbPage=new wxPanel(m_notebook); // Sizer wxBoxSizer* pageSizer; pageSizer=new wxBoxSizer(wxVERTICAL); pageSizer->Add( CreateCursorInput( nbPage, wxTEXT1PS, wxTEXT2PS, wxCOMBOU1PS, wxCOMBOU2PS, 1, 10 ), 0, wxALIGN_CENTER | wxALL, 2 ); // Grid wxFlexGridSizer* PSBegEndGrid; PSBegEndGrid = new wxFlexGridSizer(1,2,0,0); // rows, cols //**** Radio options "Slope from" **** wxStaticBoxSizer* LeftBoxSizer = new wxStaticBoxSizer( wxVERTICAL, nbPage, wxT("Slope from") ); // Slope from: Manual wxRadioButton* pPSManBeg = new wxRadioButton( nbPage, wxRADIO_PSManBeg, wxT("Manual"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); //pPSManBeg->SetValue(true); // Slope from: Beginning of event wxRadioButton* pPSEventBeg = new wxRadioButton( nbPage, wxRADIO_PSEventBeg, wxT("Beginning of event"), wxDefaultPosition, wxDefaultSize ); // Slope from: Threshold slope wxFlexGridSizer* thrGrid; thrGrid = new wxFlexGridSizer(1,2,0,0); wxRadioButton* pPSThrBeg = new wxRadioButton( nbPage, wxRADIO_PSThrBeg, wxT("Threshold"), wxDefaultPosition, wxDefaultSize); thrGrid->Add(pPSThrBeg, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 2); // Slope from: t50 wxRadioButton* pPSt50Beg = new wxRadioButton( nbPage, wxRADIO_PSt50Beg, wxT("Half-width (t50)"), wxDefaultPosition, wxDefaultSize); // activate radio buttons according to the PSlope mode of the active document wxTextCtrl* pCursor1PS = (wxTextCtrl*)FindWindow(wxTEXT1PS); if ( pCursor1PS == NULL ){ wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::CreatePSlopePage()")); } switch( actDoc->GetPSlopeBegMode()){ case 1: pPSEventBeg->SetValue(true); pCursor1PS->Enable(false); break; case 2: pPSThrBeg->SetValue(true); pCursor1PS->Enable(false); break; case 3: pPSt50Beg->SetValue(true); pCursor1PS->Enable(false); break; case 0: default: pPSManBeg->SetValue(true); pCursor1PS->Enable(true); } // Sizer to group the radio options LeftBoxSizer->Add( pPSManBeg, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); LeftBoxSizer->Add( pPSEventBeg, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); LeftBoxSizer->Add( thrGrid, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); LeftBoxSizer->Add( pPSt50Beg, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); // Add to PSBegEndGrid PSBegEndGrid->Add(LeftBoxSizer, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2); //**** Radio options "Slope to" **** wxStaticBoxSizer* RightBoxSizer = new wxStaticBoxSizer( wxVERTICAL, nbPage, wxT("Slope to") ); // Slope to: Manual wxRadioButton* pPSManEnd = new wxRadioButton( nbPage, wxRADIO_PSManEnd, wxT("Manual"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); // Slope to: Half-width wxRadioButton* pPSt50End = new wxRadioButton( nbPage, wxRADIO_PSt50End, wxT("Half-width (t50)"), wxDefaultPosition, wxDefaultSize); // Slope to: DeltaT wxFlexGridSizer* DeltaTGrid; DeltaTGrid = new wxFlexGridSizer(1,2,0,0); wxRadioButton* pPSDeltaT = new wxRadioButton( nbPage, wxRADIO_PSDeltaT, wxT("Delta t"), wxDefaultPosition, wxDefaultSize); DeltaTGrid->Add(pPSDeltaT, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 2); wxTextCtrl* pTextPSDeltaT = new wxTextCtrl(nbPage, wxTEXT_PSDELTAT, wxT(""), wxDefaultPosition, wxSize(44,20), wxTE_RIGHT); pTextPSDeltaT->Enable(false); DeltaTGrid->Add(pTextPSDeltaT, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 2); // Slope to: Peak wxRadioButton* pPSPeakEnd = new wxRadioButton( nbPage, wxRADIO_PSPeakEnd, wxT("Peak"), wxDefaultPosition, wxDefaultSize); // activate radio buttons according to the PSlope mode of the active document wxTextCtrl* pCursor2PS = (wxTextCtrl*)FindWindow(wxTEXT2PS); if (pCursor2PS == NULL){ wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::CreatePSlopePage()")); } switch( actDoc->GetPSlopeEndMode()){ case 1: pPSt50End->SetValue(true); pCursor2PS->Enable(false); break; case 2: pPSDeltaT->SetValue(true); pTextPSDeltaT->Enable(true); pCursor2PS->Enable(false); break; case 3: pPSPeakEnd->SetValue(true); pCursor2PS->Enable(false); break; case 0: default: pPSManEnd->SetValue(true); pCursor2PS->Enable(true); } // Sizer to group the radio options RightBoxSizer->Add( pPSManEnd, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); RightBoxSizer->Add( pPSt50End, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); RightBoxSizer->Add( DeltaTGrid, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); RightBoxSizer->Add( pPSPeakEnd, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); // Add to PSBegEndGrid PSBegEndGrid->Add(RightBoxSizer, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 2); pageSizer->Add(PSBegEndGrid, 0, wxALIGN_CENTER | wxALL, 2); nbPage->SetSizer(pageSizer); nbPage->Layout(); return nbPage; } #endif // WITH_PSLOPE wxFlexGridSizer* wxStfCursorsDlg::CreateCursorInput( wxPanel* nbPage, wxWindowID textC1id, wxWindowID textC2id, wxWindowID comboU1id, wxWindowID comboU2id, std::size_t c1, std::size_t c2 ) { wxFlexGridSizer* cursorGrid=new wxFlexGridSizer(2,3,0,0); // Cursor 1: // Description wxStaticText *Cursor1; Cursor1 = new wxStaticText( nbPage, wxID_ANY, wxT("First cursor:"), wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); cursorGrid->Add( Cursor1, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // user entry wxString strc1,strc2; strc1 << (int)c1; wxTextCtrl* textC1 = new wxTextCtrl( nbPage, textC1id, strc1, wxDefaultPosition, wxSize(64,20), wxTE_RIGHT ); cursorGrid->Add( textC1, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // units #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) wxString szUnits[] = { actDoc->GetXUnits(), wxT("pts") }; int szUnitsSize = sizeof( szUnits ) / sizeof( wxString ); wxComboBox* comboU1 = new wxComboBox( nbPage, comboU1id, actDoc->GetXUnits(), wxDefaultPosition, #else wxString szUnits[] = { wxString(actDoc->GetXUnits().c_str(), wxConvUTF8), wxT("pts") }; int szUnitsSize = sizeof( szUnits ) / sizeof( wxString ); wxComboBox* comboU1 = new wxComboBox( nbPage, comboU1id, wxString(actDoc->GetXUnits().c_str(), wxConvUTF8), wxDefaultPosition, #endif wxSize(64,20), szUnitsSize, szUnits, wxCB_DROPDOWN | wxCB_READONLY ); cursorGrid->Add( comboU1, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Cursor 2: if (textC2id >= 0) { wxStaticText *Cursor2; // Description Cursor2 = new wxStaticText( nbPage, wxID_ANY, wxT("Second cursor:"), wxDefaultPosition, wxDefaultSize, wxTE_LEFT ); cursorGrid->Add( Cursor2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // user entry strc2 << (int)c2; wxTextCtrl* textC2 = new wxTextCtrl( nbPage, textC2id, strc2, wxDefaultPosition, wxSize(64,20), wxTE_RIGHT ); cursorGrid->Add( textC2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // units #if (wxCHECK_VERSION(2, 9, 0) || defined(MODULE_ONLY)) wxComboBox* comboU2 = new wxComboBox( nbPage, comboU2id, actDoc->GetXUnits(), wxDefaultPosition, #else wxComboBox* comboU2 = new wxComboBox( nbPage, comboU2id, wxString(actDoc->GetXUnits().c_str(), wxConvUTF8), wxDefaultPosition, #endif wxSize(64,20), szUnitsSize, szUnits, wxCB_DROPDOWN | wxCB_READONLY ); cursorGrid->Add( comboU2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); } return cursorGrid; } void wxStfCursorsDlg::OnPeakcalcexec( wxCommandEvent& event ) { event.Skip(); // Update the results table (see wxStfApp in app.cpp) wxGetApp().OnPeakcalcexecMsg(actDoc); } bool wxStfCursorsDlg::LoadCursorConf(const wxString& filepath ){ // When loading the configuration we'll write directly in the active document // loading a cursor file will also update measurements, cursors, the graph and result table. // It will write the registry as well, since it is similar to pressing "Apply". // see wxStfApp::OnPeakcalcexeMsg() for details. if (actDoc == NULL) { wxGetApp().ErrorMsg(wxT("No active document found")); return false; } wxFileConfig* csr_config = new wxFileConfig(wxT(""), wxT(""), filepath ); // minimal syntax check if ( !IsCSRSyntax( csr_config ) ) { return false; } wxString CursorValue; long start_csr, end_csr; // *** update controls in __MEASURE__ tab **** csr_config->Read( wxT("__MEASURE__/Cursor"), &start_csr ); // read from file wxTextCtrl *pMeasureCursor = (wxTextCtrl*)FindWindow(wxTEXTM); if (pMeasureCursor == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::LoadCursorConf()")); return false; } if (cursorMIsTime) { float fvalue = start_csr*actDoc->GetXScale() ; CursorValue = wxString::Format( wxT("%f"), fvalue ); } else CursorValue = wxString::Format( wxT("%i"), start_csr ); pMeasureCursor->SetValue( CursorValue ); actDoc->SetMeasCursor( GetCursorM() ); int show_ruler; csr_config->Read( wxT("__MEASURE__/ShowRuler"), &show_ruler ); // read from file SetRuler( show_ruler ); actDoc->SetMeasRuler( show_ruler ); // **** update controls in __PEAK__ tab **** csr_config->Read( wxT("__PEAK__/LeftCursor"), &start_csr ); // read from file csr_config->Read( wxT("__PEAK__/RightCursor"), &end_csr ); // read from file wxTextCtrl *pPeak1Cursor = (wxTextCtrl*)FindWindow(wxTEXT1P); wxTextCtrl *pPeak2Cursor = (wxTextCtrl*)FindWindow(wxTEXT2P); if (pPeak1Cursor == NULL || pPeak2Cursor == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::LoadCursorConf()")); return false; } if (cursor1PIsTime) { float fvalue = start_csr*actDoc->GetXScale() ; CursorValue = wxString::Format( wxT("%f"), fvalue ); } else CursorValue = wxString::Format( wxT("%i"), start_csr ); pPeak1Cursor->SetValue( CursorValue ); actDoc->SetPeakBeg( GetCursor1P() ); if (cursor2PIsTime) { float fvalue = end_csr*actDoc->GetXScale() ; CursorValue = wxString::Format( wxT("%f"), fvalue ); } else CursorValue = wxString::Format( wxT("%i"), end_csr ); pPeak2Cursor->SetValue( CursorValue ); actDoc->SetPeakEnd( GetCursor2P() ); bool is_end; csr_config->Read( wxT("__PEAK__/PeakAtEnd"), &is_end ); // read from file SetPeakAtEnd( is_end ); actDoc->SetPeakAtEnd( is_end ); int npoints; csr_config->Read( wxT("__PEAK__/NumberOfPoints"), &npoints ); // read from file SetPeakPoints( npoints); actDoc->SetPM( npoints ); int direction; csr_config->Read( wxT("__PEAK__/Direction"), &direction ); // read from file stfnum::direction mydirection; switch (direction) { case 0: mydirection = stfnum::up; break; case 1: mydirection = stfnum::down; break; case 2: mydirection = stfnum::both; break; default: mydirection = stfnum::undefined_direction; } SetDirection( mydirection ); actDoc->SetDirection ( mydirection ); bool confbase; csr_config->Read( wxT("__PEAK__/FromBase"), &confbase ); // read from file SetFromBase( confbase ); actDoc->SetFromBase( confbase ); int rt_factor; csr_config->Read( wxT("__PEAK__/RTFactor"), &rt_factor ); // read from file SetRTFactor( rt_factor ); actDoc->SetRTFactor( rt_factor ); double slope; wxString wxSlope; csr_config->Read( wxT("__PEAK__/Slope"), &wxSlope); // read from file wxSlope.ToDouble(&slope); SetSlope( slope ); actDoc->SetSlopeForThreshold( slope ); // **** update controls in __BASE__ tab **** csr_config->Read( wxT("__BASE__/LeftCursor"), &start_csr ); // read from file csr_config->Read( wxT("__BASE__/RightCursor"), &end_csr ); // read from file wxTextCtrl *pBase1Cursor = (wxTextCtrl*)FindWindow(wxTEXT1B); wxTextCtrl *pBase2Cursor = (wxTextCtrl*)FindWindow(wxTEXT2B); if (pBase1Cursor == NULL || pBase2Cursor == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::LoadCursorConf()")); return false; } if (cursor1BIsTime) { float fvalue = start_csr*actDoc->GetXScale() ; CursorValue = wxString::Format( wxT("%f"), fvalue ); } else CursorValue = wxString::Format( wxT("%i"), start_csr ); pBase1Cursor->SetValue( CursorValue ); actDoc->SetBaseBeg( GetCursor1B() ); if (cursor2BIsTime) { float fvalue = end_csr*actDoc->GetXScale() ; CursorValue = wxString::Format( wxT("%f"), fvalue ); } else CursorValue = wxString::Format( wxT("%i"), end_csr ); pBase2Cursor->SetValue( CursorValue ); actDoc->SetBaseEnd( GetCursor2B() ); int base_method; csr_config->Read( wxT("__BASE__/BaselineMethod"), &base_method ); // read from file stfnum::baseline_method mybase_method; switch( base_method ) { case 0: mybase_method = stfnum::mean_sd; break; case 1: mybase_method = stfnum::median_iqr; break; default: mybase_method = stfnum::mean_sd; } SetBaselineMethod ( mybase_method ); actDoc->SetBaselineMethod( mybase_method ); // **** update controls in __DECAY__ tab **** csr_config->Read( wxT("__DECAY__/LeftCursor"), &start_csr ); // read from file csr_config->Read( wxT("__DECAY__/RightCursor"), &end_csr ); // read from file wxTextCtrl *pFit1Cursor = (wxTextCtrl*)FindWindow(wxTEXT1D); wxTextCtrl *pFit2Cursor = (wxTextCtrl*)FindWindow(wxTEXT2D); if (pBase1Cursor == NULL || pBase2Cursor == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::LoadCursorConf()")); return false; } if (cursor1DIsTime) { float fvalue = start_csr*actDoc->GetXScale() ; CursorValue = wxString::Format( wxT("%f"), fvalue ); } else CursorValue = wxString::Format( wxT("%i"), start_csr ); pFit1Cursor->SetValue( CursorValue ); actDoc->SetFitBeg( GetCursor1D() ); if (cursor2DIsTime) { float fvalue = end_csr*actDoc->GetXScale() ; CursorValue = wxString::Format( wxT("%f"), fvalue ); } else CursorValue = wxString::Format( wxT("%i"), end_csr ); pFit2Cursor->SetValue( CursorValue ); actDoc->SetFitEnd( GetCursor2D() ); bool is_peak; csr_config->Read(wxT("__DECAY__/StartFitAtPeak"), &is_peak); SetStartFitAtPeak( is_peak); actDoc->SetStartFitAtPeak( is_peak ); // **** update controls in LATENCY tab **** csr_config->Read( wxT("__LATENCY__/LeftCursor"), &start_csr ); // read from file csr_config->Read( wxT("__LATENCY__/RightCursor"), &end_csr ); // read from file wxTextCtrl *pLatency1Cursor = (wxTextCtrl*)FindWindow(wxTEXT1L); wxTextCtrl *pLatency2Cursor = (wxTextCtrl*)FindWindow(wxTEXT2L); if (pLatency1Cursor == NULL || pLatency2Cursor == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::LoadCursorConf()")); return false; } if (cursor1LIsTime) { float fvalue = start_csr*actDoc->GetXScale() ; CursorValue = wxString::Format( wxT("%f"), fvalue ); } else CursorValue = wxString::Format( wxT("%i"), start_csr ); pLatency1Cursor->SetValue( CursorValue ); actDoc->SetLatencyBeg( GetCursor1L() ); if (cursor2LIsTime) { float fvalue = end_csr*actDoc->GetXScale() ; CursorValue = wxString::Format( wxT("%f"), fvalue ); } else CursorValue = wxString::Format( wxT("%i"), end_csr ); pLatency2Cursor->SetValue( CursorValue ); actDoc->SetLatencyEnd( GetCursor2L() ); int mode; csr_config->Read( wxT("__LATENCY__/LeftMode"), &mode ); // read from file stf::latency_mode latency_mode; switch( mode ) { case 0: latency_mode =stf::manualMode; break; case 1: latency_mode = stf::peakMode; break; case 2: latency_mode = stf::riseMode; break; case 3: latency_mode = stf::halfMode; break; case 4: latency_mode = stf::footMode; break; default: latency_mode = stf::undefinedMode; } SetLatencyStartMode( latency_mode ); actDoc->SetLatencyStartMode( latency_mode ); csr_config->Read( wxT("__LATENCY__/RightMode"), &mode ); // read from file switch( mode ) { case 0: latency_mode =stf::manualMode; break; case 1: latency_mode = stf::peakMode; break; case 2: latency_mode = stf::riseMode; break; case 3: latency_mode = stf::halfMode; break; case 4: latency_mode = stf::footMode; break; default: latency_mode = stf::undefinedMode; } SetLatencyEndMode( latency_mode ); actDoc->SetLatencyEndMode( latency_mode ); delete csr_config; // we use wxStfApp::OnPeakcalcexec() here basically to update the results table. // Because wxStfApp::OnPeakcalcexec() only updates the properties of wxStfDoc in the current tab // of the cursor dialog, we need to call the methods from actDoc() to update the cursors which // are not currently visible, but stored in the csr file. wxGetApp().OnPeakcalcexecMsg(actDoc); return true; } void wxStfCursorsDlg::OnLoadCursorConf( wxCommandEvent& event ) { event.Skip(); wxString csrFilter = wxT("Cursor conf (*.csr)|*csr"); wxFileDialog* LoadCursorDialog = new wxFileDialog(this, wxT("Load Cursor configuration"), wxT(""), wxT(""), csrFilter, wxFD_OPEN | wxFD_PREVIEW); if (LoadCursorDialog->ShowModal() == wxID_OK ){ wxString mypath = LoadCursorDialog->GetPath(); LoadCursorConf( mypath ); } } bool wxStfCursorsDlg::SaveCursorConf(const wxString& mypath ){ // Read cursor configuration from active document! if (actDoc == NULL){ throw std::runtime_error("No active document found"); return false; } wxDateTime now = wxDateTime::Now(); wxFileConfig* csr_config = new wxFileConfig(wxT(""), wxT(""), mypath ); csr_config->SetPath( wxT("__CSR_HEADER__") ); //csr_config->Write( wxT("Date"), now.Format( wxT("%Y/%M/%d"), wxDateTime::CET) ); csr_config->Write( wxT("Date"), now.Format( wxT("%A, %d %B, %Y"), wxDateTime::CET) ); csr_config->Write( wxT("Time"), now.Format( wxT("%H:%M:%S %p"), wxDateTime::CET) ); csr_config->SetPath( wxT("../__MEASURE__") ); csr_config->Write( wxT("Cursor"), (int)actDoc->GetMeasCursor() ); csr_config->Write( wxT("ShowRuler"), (int)actDoc->GetMeasRuler() ); csr_config->SetPath( wxT("../__PEAK__") ); csr_config->Write( wxT("LeftCursor"), (int)actDoc->GetPeakBeg() ); csr_config->Write( wxT("Rightcursor"), (int)actDoc->GetPeakEnd() ); csr_config->Write( wxT("PeakAtEnd"), (int)actDoc->GetPeakAtEnd() ); csr_config->Write( wxT("NumberOfPoints"), (int)actDoc->GetPM() ); csr_config->Write( wxT("Direction"), (int)actDoc->GetDirection() ); csr_config->Write( wxT("FromBase"), (int)actDoc->GetFromBase() ); csr_config->Write( wxT("RTFactor"), (int)actDoc->GetRTFactor() ); wxString mySlope; mySlope << actDoc->GetSlopeForThreshold(); csr_config->Write( wxT("Slope"), mySlope ); csr_config->SetPath( wxT("../__BASE__") ); csr_config->Write( wxT("LeftCursor"), (int)actDoc->GetBaseBeg() ); csr_config->Write( wxT("RightCursor"),(int)actDoc->GetBaseEnd() ); csr_config->Write( wxT("BaselineMethod"), (int)actDoc->GetBaselineMethod() ); csr_config->SetPath( wxT("../__DECAY__") ); csr_config->Write( wxT("LeftCursor"), (int)actDoc->GetFitBeg() ); csr_config->Write( wxT("RightCursor"),(int)actDoc->GetFitEnd() ); csr_config->Write( wxT("StartFitAtPeak"),(int)actDoc->GetStartFitAtPeak() ); csr_config->SetPath( wxT("../__LATENCY__") ); csr_config->Write( wxT("LeftCursor"), (int)actDoc->GetLatencyBeg() ); csr_config->Write( wxT("RightCursor"),(int)actDoc->GetLatencyEnd() ); csr_config->Write( wxT("LeftMode"),(int)actDoc->GetLatencyStartMode() ); csr_config->Write( wxT("RightMode"),(int)actDoc->GetLatencyEndMode() ); csr_config->Flush(); // write all changes return true; } void wxStfCursorsDlg::OnSaveCursorConf( wxCommandEvent& event ) { event.Skip(); wxString crsFilter = wxT("Cursor conf (*.csr)|*csr"); wxFileDialog* SaveCursorDialog = new wxFileDialog(this, wxT("Save Cursor configuration"), wxT(""), wxT(""), crsFilter, wxFD_SAVE | wxFD_PREVIEW); if (SaveCursorDialog->ShowModal() == wxID_OK ){ wxString mypath = SaveCursorDialog->GetPath(); SaveCursorConf( mypath ); } } int wxStfCursorsDlg::ReadCursor(wxWindowID textId, bool isTime) const { // always returns in units of sampling points, // conversion is necessary if it's in units of time: long cursor; wxString strEdit; wxTextCtrl *pText = (wxTextCtrl*)FindWindow(textId); if (pText == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::ReadCursor()")); return 0; } strEdit << pText->GetValue(); if (isTime) { double fEdit; strEdit.ToDouble( &fEdit ); cursor=stf::round(fEdit/actDoc->GetXScale()); } else { strEdit.ToLong ( &cursor ); } return (int)cursor; } void wxStfCursorsDlg::WriteCursor(wxWindowID textId, bool isTime, long value) const { wxString myvalue; wxTextCtrl *pText = (wxTextCtrl*)FindWindow(textId); if (pText == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::SetCursor()")); return; } if (isTime){ float fvalue = stf::round( value/actDoc->GetXScale() ); myvalue = wxString::Format(wxT("%f"), fvalue); } else { myvalue = wxString::Format(wxT("%i"), value); } pText->SetValue(myvalue); } #ifdef WITH_PSLOPE int wxStfCursorsDlg::ReadDeltaT(wxWindowID textID) const { // returns DeltaT entered in the textBox in units of sampling points long cursorpos=0; wxString strDeltaT; wxTextCtrl *pText = (wxTextCtrl*)FindWindow(textID); if (pText == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::ReadDeltaT()")); return 0; } strDeltaT << pText->GetValue(); double DeltaTval; strDeltaT.ToDouble(&DeltaTval); cursorpos = stf::round(DeltaTval/actDoc->GetXScale()); return (int)cursorpos; } #endif // WITH_PSLOPE int wxStfCursorsDlg::GetCursorM() const { return ReadCursor(wxTEXTM,cursorMIsTime); } int wxStfCursorsDlg::GetCursor1P() const { return ReadCursor(wxTEXT1P,cursor1PIsTime); } int wxStfCursorsDlg::GetCursor2P() const { return ReadCursor(wxTEXT2P,cursor2PIsTime); } int wxStfCursorsDlg::GetCursor1B() const { return ReadCursor(wxTEXT1B,cursor1BIsTime); } int wxStfCursorsDlg::GetCursor2B() const { return ReadCursor(wxTEXT2B,cursor2BIsTime); } int wxStfCursorsDlg::GetCursor1D() const { return ReadCursor(wxTEXT1D,cursor1DIsTime); } int wxStfCursorsDlg::GetCursor2D() const { return ReadCursor(wxTEXT2D,cursor2DIsTime); } int wxStfCursorsDlg::GetCursor1L() const { return ReadCursor(wxTEXT1L, cursor1LIsTime); } int wxStfCursorsDlg::GetCursor2L() const { return ReadCursor(wxTEXT2L, cursor2LIsTime); } #ifdef WITH_PSLOPE int wxStfCursorsDlg::GetCursor1PS() const { return ReadCursor(wxTEXT1PS, cursor1PSIsTime); } int wxStfCursorsDlg::GetCursor2PS() const { return ReadCursor(wxTEXT2PS, cursor2PSIsTime); } #endif int wxStfCursorsDlg::GetPeakPoints() const { wxRadioButton* pRadioButtonAll = (wxRadioButton*)FindWindow(wxRADIOALL); wxRadioButton* pRadioButtonMean = (wxRadioButton*)FindWindow(wxRADIOMEAN); if (pRadioButtonAll==NULL || pRadioButtonMean==NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetPeakPoints()")); return 0; } if (pRadioButtonAll->GetValue()) { return -1; } else { if (pRadioButtonMean->GetValue()) { return ReadCursor(wxTEXTPM,false); } else { wxGetApp().ErrorMsg(wxT("nothing selected in wxStfCursorsDlg::GetPeakPoints()")); return 0; } } } int wxStfCursorsDlg::GetRTFactor() const { wxSlider *pRTSlider = (wxSlider*)FindWindow(wxRT_SLIDER); if (pRTSlider == NULL ) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg:GetRTFactor()")); return -1; } return pRTSlider->GetValue(); } #ifdef WITH_PSLOPE int wxStfCursorsDlg::GetDeltaT() const { return ReadDeltaT(wxTEXT_PSDELTAT); } #endif #ifdef WITH_PSLOPE void wxStfCursorsDlg::SetDeltaT (int DeltaT) { wxRadioButton* pRadPSDeltaT = (wxRadioButton*)FindWindow(wxRADIO_PSDeltaT); wxTextCtrl* pTextPSDeltaT = (wxTextCtrl*)FindWindow(wxTEXT_PSDELTAT); if (pRadPSDeltaT == NULL || pTextPSDeltaT == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::wxSetDeltaT()")); return; } // transform sampling points into x-units double fDeltaT; fDeltaT =DeltaT*actDoc->GetXScale(); wxString strDeltaTval; strDeltaTval << fDeltaT; pTextPSDeltaT->SetValue(strDeltaTval); } #endif // WITH_PSLOPE void wxStfCursorsDlg::SetPeakPoints(int peakPoints) { wxRadioButton* pRadioButtonAll = (wxRadioButton*)FindWindow(wxRADIOALL); wxRadioButton* pRadioButtonMean = (wxRadioButton*)FindWindow(wxRADIOMEAN); wxTextCtrl* pTextPM = (wxTextCtrl*)FindWindow(wxTEXTPM); if (pRadioButtonAll==NULL || pRadioButtonMean==NULL || pTextPM==NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::SetPeakPoints()")); return; } if (peakPoints==0 || peakPoints<-1) { throw std::runtime_error("peak points out of range in wxStfCursorsDlg::SetPeakPoints()"); } else if (peakPoints == -1) { pRadioButtonAll->SetValue(true); pRadioButtonMean->SetValue(false); pTextPM->Enable(false); } else { wxString entry; entry << peakPoints; pRadioButtonAll->SetValue(false); pRadioButtonMean->SetValue(true); pTextPM->Enable(true); pTextPM->SetValue( entry ); } } stfnum::direction wxStfCursorsDlg::GetDirection() const { wxRadioBox* pDirection = (wxRadioBox*)FindWindow(wxDIRECTION); if (pDirection == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetDirection()")); return stfnum::undefined_direction; } switch (pDirection->GetSelection()) { case 0: return stfnum::up; case 1: return stfnum::down; case 2: return stfnum::both; default: return stfnum::undefined_direction; } } void wxStfCursorsDlg::SetDirection(stfnum::direction direction) { wxRadioBox* pDirection = (wxRadioBox*)FindWindow(wxDIRECTION); if (pDirection == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetDirection()")); return; } switch (direction) { case stfnum::up: pDirection->SetSelection(0); break; case stfnum::down: pDirection->SetSelection(1); break; case stfnum::both: case stfnum::undefined_direction: pDirection->SetSelection(2); break; } } bool wxStfCursorsDlg::GetFromBase() const { wxRadioBox* pReference = (wxRadioBox*)FindWindow(wxREFERENCE); if (pReference == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetFromBase()")); return true; } switch (pReference->GetSelection()) { case 0: return true; case 1: return false; default: return true; } } void wxStfCursorsDlg::SetRTFactor(int RTFactor) { wxSlider *pRTSlider = (wxSlider*)FindWindow(wxRT_SLIDER); wxStaticText *pRTLabel = (wxStaticText*)FindWindow(wxRT_LABEL); if (pRTSlider == NULL || pRTLabel == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg:SetRTFactor()")); return; } pRTSlider->SetValue(RTFactor); wxString label(wxT("Rise time ")); label << pRTSlider->GetValue() << wxT("-"); label << 100-pRTSlider->GetValue() << wxT("\%"); pRTLabel->SetLabel(label); } void wxStfCursorsDlg::SetFromBase(bool fromBase) { wxRadioBox* pReference = (wxRadioBox*)FindWindow(wxREFERENCE); if (pReference == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::SetFromBase()")); return; } if (fromBase) { pReference->SetSelection(0); } else { pReference->SetSelection(1); } } enum stfnum::baseline_method wxStfCursorsDlg::GetBaselineMethod() const { wxRadioBox* pBaselineMethod = (wxRadioBox*)FindWindow(wxRADIO_BASELINE_METHOD); if (pBaselineMethod == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetBaseSelection()")); return stfnum::mean_sd; //default value mean and standard deviation } switch( pBaselineMethod->GetSelection() ) { case 0: return stfnum::mean_sd; case 1: return stfnum::median_iqr; default: return stfnum::mean_sd; } } void wxStfCursorsDlg::SetBaselineMethod(stfnum::baseline_method base_method) { wxRadioBox* pBaselineMethod = (wxRadioBox*)FindWindow(wxRADIO_BASELINE_METHOD); if (pBaselineMethod == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::SetBaselineMethod()")); return; } switch(base_method) { case stfnum::median_iqr: pBaselineMethod->SetSelection(1); break; case stfnum::mean_sd: pBaselineMethod->SetSelection(0); break; } } bool wxStfCursorsDlg::GetPeakAtEnd() const { //Check if 'Upper limit at end of trace' is selected wxCheckBox* pPeakAtEnd = (wxCheckBox*)FindWindow(wxPEAKATEND); if (pPeakAtEnd == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetPeakAtEnd()")); return false; } return pPeakAtEnd->IsChecked(); } void wxStfCursorsDlg::OnPeakAtEnd( wxCommandEvent& event) { event.Skip(); wxCheckBox* pPeakAtEnd = (wxCheckBox*)FindWindow(wxPEAKATEND); wxTextCtrl* pCursor2P = (wxTextCtrl*)FindWindow(wxTEXT2P); if (pPeakAtEnd == NULL || pCursor2P == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnPeakAtEnd()")); return; } // second peak cursor is inactive if the peak at the end checkbox is checked pCursor2P->Enable(! pPeakAtEnd->IsChecked() ); } void wxStfCursorsDlg::SetPeakAtEnd( bool is_end ) { wxCheckBox* pPeakAtEnd = (wxCheckBox*)FindWindow(wxPEAKATEND); wxTextCtrl* pCursor2P = (wxTextCtrl*)FindWindow(wxTEXT2P); if (pPeakAtEnd == NULL || pCursor2P == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::SetPeakAtEnd()")); return; } pCursor2P->Enable( ! is_end ); pPeakAtEnd->SetValue( is_end ); } bool wxStfCursorsDlg::GetStartFitAtPeak() const { //Check if 'Start fit at peak' is selected wxCheckBox* pStartFitAtPeak = (wxCheckBox*)FindWindow(wxSTARTFITATPEAK); if (pStartFitAtPeak == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetStartFitAtPeak()")); return false; } return pStartFitAtPeak->IsChecked(); } void wxStfCursorsDlg::SetStartFitAtPeak(bool is_peak){ wxCheckBox* pStartFitAtPeak = (wxCheckBox*)FindWindow(wxSTARTFITATPEAK); wxTextCtrl* pCursor1D = (wxTextCtrl*)FindWindow(wxTEXT1D); if (pStartFitAtPeak == NULL || pCursor1D == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetStartFitAtPeak()")); return; } pCursor1D->Enable( ! is_peak ); pStartFitAtPeak->SetValue( is_peak); } void wxStfCursorsDlg::OnStartFitAtPeak( wxCommandEvent& event) { event.Skip(); wxCheckBox* pStartFitAtPeak = (wxCheckBox*)FindWindow(wxSTARTFITATPEAK); wxTextCtrl* pCursor1D = (wxTextCtrl*)FindWindow(wxTEXT1D); if (pStartFitAtPeak == NULL || pCursor1D == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnStartFitAtEnd()")); return; } // left decay cursor is inactive if the start fit at peak is checked pCursor1D->Enable(! pStartFitAtPeak->IsChecked() ); } void wxStfCursorsDlg::OnPageChanged(wxNotebookEvent& event) { event.Skip(); if (actDoc!=NULL) { try { UpdateCursors(); } catch (const std::runtime_error& e) { wxGetApp().ExceptMsg( wxString( e.what(), wxConvLocal )); } } } void wxStfCursorsDlg::OnComboBoxUM( wxCommandEvent& event ) { event.Skip(); UpdateUnits(wxCOMBOUM,cursorMIsTime,wxTEXTM); } void wxStfCursorsDlg::OnComboBoxU1P( wxCommandEvent& event ) { event.Skip(); UpdateUnits(wxCOMBOU1P,cursor1PIsTime,wxTEXT1P); } void wxStfCursorsDlg::OnComboBoxU2P( wxCommandEvent& event ) { event.Skip(); UpdateUnits(wxCOMBOU2P,cursor2PIsTime,wxTEXT2P); } void wxStfCursorsDlg::OnComboBoxU1B( wxCommandEvent& event ) { event.Skip(); UpdateUnits(wxCOMBOU1B,cursor1BIsTime,wxTEXT1B); } void wxStfCursorsDlg::OnComboBoxU2B( wxCommandEvent& event ) { event.Skip(); UpdateUnits(wxCOMBOU2B,cursor2BIsTime,wxTEXT2B); } void wxStfCursorsDlg::OnComboBoxU1D( wxCommandEvent& event ) { event.Skip(); UpdateUnits(wxCOMBOU1D,cursor1DIsTime,wxTEXT1D); } void wxStfCursorsDlg::OnComboBoxU2D( wxCommandEvent& event ) { event.Skip(); UpdateUnits(wxCOMBOU2D,cursor2DIsTime,wxTEXT2D); } void wxStfCursorsDlg::OnComboBoxU1L( wxCommandEvent& event ) { event.Skip(); wxRadioButton* wxRadio_Lat_Manual1 = (wxRadioButton*)FindWindow(wxRADIO_LAT_MANUAL1); if (wxRadio_Lat_Manual1 == NULL){ wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::OnComboBoxU1LS()")); return; } else wxRadio_Lat_Manual1->SetValue(true); UpdateUnits(wxCOMBOU1L,cursor1LIsTime,wxTEXT1L); } void wxStfCursorsDlg::OnComboBoxU2L( wxCommandEvent& event ) { event.Skip(); wxRadioButton* wxRadio_Lat_Manual2 = (wxRadioButton*)FindWindow(wxRADIO_LAT_MANUAL2); if (wxRadio_Lat_Manual2 == NULL){ wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::OnComboBoxU2LS()")); return; } else wxRadio_Lat_Manual2->SetValue(true); UpdateUnits(wxCOMBOU2L,cursor2LIsTime,wxTEXT2L); } void wxStfCursorsDlg::OnRadioLatManualBeg( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor1L = (wxTextCtrl*)FindWindow(wxTEXT1L); if (pCursor1L == NULL ) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioLatManBeg()")); return; } // if cursor wxTextCtrl is NOT enable2 if (!pCursor1L->IsEnabled()) pCursor1L->Enable(true); } void wxStfCursorsDlg::OnRadioLatManualEnd( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor2L = (wxTextCtrl*)FindWindow(wxTEXT2L); if (pCursor2L == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioLatManEnd()")); return; } // if cursor wxTextCtrl is NOT enabled if (!pCursor2L->IsEnabled()) pCursor2L->Enable(true); } void wxStfCursorsDlg::OnRadioLatNonManualBeg( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor1L = (wxTextCtrl*)FindWindow(wxTEXT1L); wxRadioButton* pLatencyManualEnd = (wxRadioButton*)FindWindow(wxRADIO_LAT_MANUAL2); if (pCursor1L == NULL || pLatencyManualEnd == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioLatt50Beg()")); return; } // disable cursor wxTextCtrl if it is enabled if (pCursor1L->IsEnabled()) pCursor1L->Enable(false); } void wxStfCursorsDlg::OnRadioLatNonManualEnd( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor2L = (wxTextCtrl*)FindWindow(wxTEXT2L); wxRadioButton* pLatencyManualBeg = (wxRadioButton*)FindWindow(wxRADIO_LAT_MANUAL1); if (pCursor2L == NULL || pLatencyManualBeg == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioNonManualEnd()")); return; } // disable cursor wxTextCtrl if it is enabled if (pCursor2L->IsEnabled()) pCursor2L->Enable(false); } #ifdef WITH_PSLOPE void wxStfCursorsDlg::OnComboBoxU1PS( wxCommandEvent& event ) { event.Skip(); // select manual option in "measurement from" box wxRadioButton* pPSManBeg = (wxRadioButton*)FindWindow(wxRADIO_PSManBeg); if (pPSManBeg == NULL) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::OnComboBoxU1PS()")); return; } else pPSManBeg->SetValue(true); UpdateUnits(wxCOMBOU1PS,cursor1PSIsTime,wxTEXT1PS); } void wxStfCursorsDlg::OnComboBoxU2PS( wxCommandEvent& event ) { event.Skip(); // select manual option in "measurement to" box wxRadioButton* pPSManEnd = (wxRadioButton*)FindWindow(wxRADIO_PSManEnd); if (pPSManEnd == NULL) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::OnComboBoxU2PS()")); return; } else pPSManEnd->SetValue(true); UpdateUnits(wxCOMBOU2PS,cursor2PSIsTime,wxTEXT2PS); } void wxStfCursorsDlg::OnRadioPSManBeg( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor1PS = (wxTextCtrl*)FindWindow(wxTEXT1PS); if (pCursor1PS == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioManBeg()")); return; } // if cursor wxTextCtrl is NOT enabled if (!pCursor1PS->IsEnabled()) pCursor1PS->Enable(true); } void wxStfCursorsDlg::OnRadioPSEventBeg( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor1PS = (wxTextCtrl*)FindWindow(wxTEXT1PS); if ( pCursor1PS == NULL ) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioPSEventBeg()")); return; } // disable cursor wxTextCtrl if it is enabled if (pCursor1PS->IsEnabled()) pCursor1PS->Enable(false); } void wxStfCursorsDlg::OnRadioPSThrBeg( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor1PS = (wxTextCtrl*)FindWindow(wxTEXT1PS); if (pCursor1PS == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioThrBeg()")); return; } // disable cursor wxTextCtrl if it is enabled if (pCursor1PS->IsEnabled()) pCursor1PS->Enable(false); } void wxStfCursorsDlg::OnRadioPSt50Beg( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor1PS = (wxTextCtrl*)FindWindow(wxTEXT1PS); if ( pCursor1PS == NULL ) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioPSt50Beg()")); return; } // disable cursor wxTextCtrl if it is enabled if (pCursor1PS->IsEnabled()) pCursor1PS->Enable(false); } void wxStfCursorsDlg::OnRadioPSManEnd( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor2PS = (wxTextCtrl*)FindWindow(wxTEXT2PS); wxTextCtrl* pTextPSDeltaT = (wxTextCtrl*)FindWindow(wxTEXT_PSDELTAT); if (pCursor2PS == NULL || pTextPSDeltaT == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioManEnd()")); return; } // if cursor wxTextCtrl is NOT enabled if (!pCursor2PS->IsEnabled()) pCursor2PS->Enable(true); if (pTextPSDeltaT->IsEnabled()) pTextPSDeltaT->Enable(false); } void wxStfCursorsDlg::OnRadioPSt50End( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor2PS = (wxTextCtrl*)FindWindow(wxTEXT2PS); wxTextCtrl* pTextPSDeltaT = (wxTextCtrl*)FindWindow(wxTEXT_PSDELTAT); if (pCursor2PS == NULL || pTextPSDeltaT == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioPSt50End()")); return; } // disable cursor wxTextCtrl if it is enabled if (pCursor2PS->IsEnabled()) pCursor2PS->Enable(false); if (pTextPSDeltaT->IsEnabled()) pTextPSDeltaT->Enable(false); SetPSlopeEndMode(stf::psEnd_t50Mode); } void wxStfCursorsDlg::OnRadioPSDeltaT( wxCommandEvent& event) { event.Skip(); wxTextCtrl* pCursor2PS = (wxTextCtrl*)FindWindow(wxTEXT2PS); wxTextCtrl* pTextPSDeltaT = (wxTextCtrl*)FindWindow(wxTEXT_PSDELTAT); if (pCursor2PS == NULL || pTextPSDeltaT == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioPSDeltaT")); return; } // disable cursor wxTextCtrl if it is enabled if (pCursor2PS->IsEnabled()) pCursor2PS->Enable(false); // enable text control if (!pTextPSDeltaT->IsEnabled()) pTextPSDeltaT->Enable(true); SetPSlopeEndMode(stf::psEnd_DeltaTMode); } void wxStfCursorsDlg::OnRadioPSPeakEnd( wxCommandEvent& event ) { event.Skip(); wxTextCtrl* pCursor2PS = (wxTextCtrl*)FindWindow(wxTEXT2PS); wxTextCtrl* pTextPSDeltaT = (wxTextCtrl*)FindWindow(wxTEXT_PSDELTAT); if (pCursor2PS == NULL || pTextPSDeltaT == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioPeakEnd()")); return; } // disable cursor wxTextCtrl if is enabled if (pCursor2PS->IsEnabled()) pCursor2PS->Enable(false); if (pTextPSDeltaT->IsEnabled()) pTextPSDeltaT->Enable(false); SetPSlopeEndMode(stf::psEnd_peakMode); } #endif // WITH_PSLOPE void wxStfCursorsDlg::OnRadioAll( wxCommandEvent& event ) { event.Skip(); wxRadioButton* pRadioAll = (wxRadioButton*)FindWindow(wxRADIOALL); wxRadioButton* pRadioMean = (wxRadioButton*)FindWindow(wxRADIOMEAN); wxTextCtrl* pTextPM = (wxTextCtrl*)FindWindow(wxTEXTPM); if (pTextPM==NULL || pRadioMean==NULL || pRadioAll==NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioAll()")); return; } pTextPM->Enable(false); pRadioMean->SetValue(false); } void wxStfCursorsDlg::OnRadioMean( wxCommandEvent& event ) { event.Skip(); wxRadioButton* pRadioAll = (wxRadioButton*)FindWindow(wxRADIOALL); wxRadioButton* pRadioMean = (wxRadioButton*)FindWindow(wxRADIOMEAN); wxTextCtrl* pTextPM = (wxTextCtrl*)FindWindow(wxTEXTPM); if (pTextPM==NULL || pRadioMean==NULL || pRadioAll==NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::OnRadioMean()")); return; } pTextPM->Enable(true); pRadioAll->SetValue(false); } void wxStfCursorsDlg::OnRTSlider( wxScrollEvent& event ) { event.Skip(); wxSlider *pRTSlider = (wxSlider*)FindWindow(wxRT_SLIDER); wxStaticText *pRTLabel = (wxStaticText*)FindWindow(wxRT_LABEL); if (pRTSlider==NULL || pRTLabel == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg:OnRTSlider()")); return; } wxString label(wxT("Rise time ")); label << pRTSlider->GetValue() << wxT("-"); label << 100-pRTSlider->GetValue() << wxT("\%"); pRTLabel->SetLabel(label); } stf::latency_mode wxStfCursorsDlg::GetLatencyStartMode() const { wxRadioButton* pManual = (wxRadioButton*)FindWindow(wxRADIO_LAT_MANUAL1); wxRadioButton* pPeak = (wxRadioButton*)FindWindow(wxRADIO_LAT_PEAK1); wxRadioButton* pMaxSlope = (wxRadioButton*)FindWindow(wxRADIO_LAT_MAXSLOPE1); wxRadioButton* pt50 = (wxRadioButton*)FindWindow(wxRADIO_LAT_HALFWIDTH1); if (pManual == NULL || pPeak == NULL || pMaxSlope == NULL || pt50 == NULL ) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::GetLatencyStartMode()")); return stf::undefinedMode; } if (pManual->GetValue() ) return stf::manualMode; else if (pPeak->GetValue()) return stf::peakMode; else if (pMaxSlope->GetValue()) return stf::riseMode; else if (pt50->GetValue()) return stf::halfMode; else return stf::undefinedMode; } stf::latency_mode wxStfCursorsDlg::GetLatencyEndMode() const { wxRadioButton* pEvent = (wxRadioButton*)FindWindow(wxRADIO_LAT_EVENT2); wxRadioButton* pManual = (wxRadioButton*)FindWindow(wxRADIO_LAT_MANUAL2); wxRadioButton* pPeak = (wxRadioButton*)FindWindow(wxRADIO_LAT_PEAK2); wxRadioButton* pMaxSlope = (wxRadioButton*)FindWindow(wxRADIO_LAT_MAXSLOPE2); wxRadioButton* pt50 = (wxRadioButton*)FindWindow(wxRADIO_LAT_HALFWIDTH2); if (pEvent == NULL || pManual == NULL || pPeak == NULL || pMaxSlope == NULL || pt50 == NULL ) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::GetLatencyEndMode()")); return stf::undefinedMode; } if (pManual->GetValue() ) { return stf::manualMode; } else { if (pEvent->GetValue()) { return stf::footMode; } else { if (pPeak->GetValue()) { return stf::peakMode; } else { if (pMaxSlope->GetValue()) { return stf::riseMode; } else { if (pt50->GetValue()) { return stf::halfMode; } else { return stf::undefinedMode; } } } } } } void wxStfCursorsDlg::SetLatencyStartMode(stf::latency_mode latencyBegMode){ wxRadioButton* pManual = (wxRadioButton*)FindWindow(wxRADIO_LAT_MANUAL1); wxRadioButton* pPeak = (wxRadioButton*)FindWindow(wxRADIO_LAT_PEAK1); wxRadioButton* pMaxSlope = (wxRadioButton*)FindWindow(wxRADIO_LAT_MAXSLOPE1); wxRadioButton* pt50 = (wxRadioButton*)FindWindow(wxRADIO_LAT_HALFWIDTH1); if (pManual == NULL || pPeak == NULL || pMaxSlope == NULL || pt50 == NULL) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::SetLatencyStartMode()")); } switch (latencyBegMode) { case stf::manualMode: pManual->SetValue(true); break; case stf::peakMode: pPeak->SetValue(true); break; case stf::riseMode: pMaxSlope->SetValue(true); break; case stf::halfMode: pt50->SetValue(true); break; default: break; } } void wxStfCursorsDlg::SetLatencyEndMode(stf::latency_mode latencyEndMode){ wxRadioButton* pManual = (wxRadioButton*)FindWindow(wxRADIO_LAT_MANUAL2); wxRadioButton* pPeak = (wxRadioButton*)FindWindow(wxRADIO_LAT_PEAK2); wxRadioButton* pMaxSlope = (wxRadioButton*)FindWindow(wxRADIO_LAT_MAXSLOPE2); wxRadioButton* pt50 = (wxRadioButton*)FindWindow(wxRADIO_LAT_HALFWIDTH2); wxRadioButton* pEvent = (wxRadioButton*)FindWindow(wxRADIO_LAT_EVENT2); if (pManual == NULL || pPeak == NULL || pMaxSlope == NULL || pt50 == NULL || pEvent == NULL) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::SetLatencyEndtMode()")); } switch (latencyEndMode) { case stf::manualMode: pManual->SetValue(true); break; case stf::peakMode: pPeak->SetValue(true); break; case stf::riseMode: pMaxSlope->SetValue(true); break; case stf::halfMode: pt50->SetValue(true); break; case stf::footMode: pEvent->SetValue(true); break; default: break; } } #ifdef WITH_PSLOPE stf::pslope_mode_beg wxStfCursorsDlg::GetPSlopeBegMode() const { wxRadioButton* pPSManBeg = (wxRadioButton*)FindWindow(wxRADIO_PSManBeg); wxRadioButton* pPSEventBeg = (wxRadioButton*)FindWindow(wxRADIO_PSEventBeg); wxRadioButton* pPSThrBeg = (wxRadioButton*)FindWindow(wxRADIO_PSThrBeg); wxRadioButton* pPSt50Beg = (wxRadioButton*)FindWindow(wxRADIO_PSt50Beg); if (pPSManBeg == NULL || pPSEventBeg == NULL || pPSThrBeg == NULL || pPSt50Beg == NULL) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::OnRadioPSBeg()")); return stf::psBeg_undefined; } if ( pPSManBeg->GetValue() ) return stf::psBeg_manualMode; else if ( pPSEventBeg->GetValue() ) return stf::psBeg_footMode; else if( pPSThrBeg->GetValue() ) return stf::psBeg_thrMode; else if ( pPSt50Beg->GetValue() ) return stf::psBeg_t50Mode; else return stf::psBeg_undefined; } stf::pslope_mode_end wxStfCursorsDlg::GetPSlopeEndMode() const { wxRadioButton* pPSManEnd = (wxRadioButton*)FindWindow(wxRADIO_PSManEnd); wxRadioButton* pPSt50End = (wxRadioButton*)FindWindow(wxRADIO_PSt50End); wxRadioButton* pPSDeltaT = (wxRadioButton*)FindWindow(wxRADIO_PSDeltaT); wxRadioButton* pPSPeakEnd = (wxRadioButton*)FindWindow(wxRADIO_PSPeakEnd); if (pPSManEnd == NULL || pPSt50End == NULL || pPSDeltaT == NULL || pPSPeakEnd == NULL) { wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::GetPSlopeEndMode()")); } if ( pPSManEnd->GetValue() ) return stf::psEnd_manualMode; else if ( pPSt50End->GetValue() ) return stf::psEnd_t50Mode; else if( pPSDeltaT->GetValue() ) return stf::psEnd_DeltaTMode; else if ( pPSPeakEnd->GetValue() ) return stf::psEnd_peakMode; else return stf::psEnd_undefined; // return dlgPSlopeModeEnd; } void wxStfCursorsDlg::SetPSlopeEndMode(stf::pslope_mode_end pslopeEndMode) { wxRadioButton* pPSManBeg = (wxRadioButton*)FindWindow(wxRADIO_PSManBeg); wxRadioButton* pPSEventBeg = (wxRadioButton*)FindWindow(wxRADIO_PSEventBeg); wxRadioButton* pPSThrBeg = (wxRadioButton*)FindWindow(wxRADIO_PSThrBeg); wxRadioButton* pPSt50Beg = (wxRadioButton*)FindWindow(wxRADIO_PSThrBeg); if (pPSManBeg == NULL || pPSEventBeg == NULL || pPSThrBeg == NULL || pPSt50Beg == NULL){ wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::SetPSlopeEndMode()")); return; } switch (pslopeEndMode) { case stf::psBeg_manualMode: pPSManBeg->Enable(true); break; case stf::psBeg_footMode: pPSEventBeg->Enable(true); break; case stf::psBeg_thrMode: pPSThrBeg->Enable(true); break; case stf::psBeg_t50Mode: pPSt50Beg->Enable(true); default: break; } } void wxStfCursorsDlg::SetPSlopeBegMode(stf::pslope_mode_beg pslopeBegMode) { wxRadioButton* pPSManBeg = (wxRadioButton*)FindWindow(wxRADIO_PSManBeg); wxRadioButton* pPSEventBeg = (wxRadioButton*)FindWindow(wxRADIO_PSEventBeg); wxRadioButton* pPSThrBeg = (wxRadioButton*)FindWindow(wxRADIO_PSThrBeg); wxRadioButton* pPSt50Beg = (wxRadioButton*)FindWindow(wxRADIO_PSThrBeg); if (pPSManBeg == NULL || pPSEventBeg == NULL || pPSThrBeg == NULL || pPSt50Beg == NULL){ wxGetApp().ErrorMsg(wxT("Null pointer in wxStfCursorsDlg::SetPSlopeBegMode()")); return; } switch (pslopeBegMode) { case stf::psBeg_manualMode: pPSManBeg->Enable(true); break; case stf::psBeg_footMode: pPSEventBeg->Enable(true); break; case stf::psBeg_thrMode: pPSThrBeg->Enable(true); break; case stf::psBeg_t50Mode: pPSt50Beg->Enable(true); default: break; } } #endif // WITH_PSLOPE void wxStfCursorsDlg::UpdateUnits(wxWindowID comboId, bool& setTime, wxWindowID textId) { // Read current entry: wxString strRead; wxTextCtrl* pText = (wxTextCtrl*)FindWindow(textId); if (pText == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::UpdateUnits()")); return; } strRead << pText->GetValue(); double fEntry=0.0; strRead.ToDouble( &fEntry ); wxComboBox* pCombo = (wxComboBox*)FindWindow(comboId); if (pCombo == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::UpdateUnits()")); return; } bool isTimeNow=(pCombo->GetCurrentSelection()==0); // switched from pts to time: if (!setTime&&isTimeNow) { // switched from pts to time: double fNewValue=fEntry*actDoc->GetXScale(); wxString strNewValue;strNewValue << fNewValue; pText->SetValue( strNewValue ); setTime=true; } if (setTime&&!isTimeNow) { // switched from time to pts: int iNewValue = stf::round(fEntry/actDoc->GetXScale()); wxString strNewValue; strNewValue << iNewValue; pText->SetValue( strNewValue ); setTime=false; } } void wxStfCursorsDlg::UpdateCursors() { stf::cursor_type select = CurrentCursor(); int iNewValue1=0, iNewValue2=0; bool cursor2isTime=true, cursor1isTime=true; wxTextCtrl* pText1=NULL, *pText2=NULL; if (actDoc == NULL) { throw std::runtime_error("No active document found"); } switch (select) { case stf::measure_cursor: // Measure iNewValue1=(int)actDoc->GetMeasCursor(); cursor1isTime=cursorMIsTime; pText1=(wxTextCtrl*)FindWindow(wxTEXTM); // update Show ruler SetRuler( actDoc->GetMeasRuler() ); break; case stf::peak_cursor: // Peak iNewValue1=(int)actDoc->GetPeakBeg(); iNewValue2=(int)actDoc->GetPeakEnd(); cursor1isTime=cursor1PIsTime; cursor2isTime=cursor2PIsTime; pText1=(wxTextCtrl*)FindWindow(wxTEXT1P); pText2=(wxTextCtrl*)FindWindow(wxTEXT2P); // Update peak at the end SetPeakAtEnd( actDoc->GetPeakAtEnd() ); // Update the mean peak points and direction: SetPeakPoints( actDoc->GetPM() ); SetDirection( actDoc->GetDirection() ); SetFromBase( actDoc->GetFromBase() ); // Update rise time factor SetRTFactor( actDoc->GetRTFactor() ); // Update threshold slope SetSlope( actDoc->GetSlopeForThreshold() ); break; case stf::base_cursor: // Base iNewValue1=(int)actDoc->GetBaseBeg(); iNewValue2=(int)actDoc->GetBaseEnd(); cursor1isTime=cursor1BIsTime; cursor2isTime=cursor2BIsTime; pText1=(wxTextCtrl*)FindWindow(wxTEXT1B); pText2=(wxTextCtrl*)FindWindow(wxTEXT2B); SetBaselineMethod( actDoc->GetBaselineMethod() ); break; case stf::decay_cursor: // Decay iNewValue1=(int)actDoc->GetFitBeg(); iNewValue2=(int)actDoc->GetFitEnd(); cursor1isTime=cursor1DIsTime; cursor2isTime=cursor2DIsTime; pText1=(wxTextCtrl*)FindWindow(wxTEXT1D); pText2=(wxTextCtrl*)FindWindow(wxTEXT2D); // Update left decay cursor to peak SetStartFitAtPeak( actDoc->GetStartFitAtPeak() ); break; case stf::latency_cursor: // Latency iNewValue1= (int)actDoc->GetLatencyBeg(); iNewValue2= (int)actDoc->GetLatencyEnd(); cursor1isTime=cursor1LIsTime; cursor2isTime=cursor2LIsTime; // if GetLatencyStartmode() is zero, textbox is enabled pText1=(wxTextCtrl*)FindWindow(wxTEXT1L); pText1->Enable(!actDoc->GetLatencyStartMode()); // if GetLatencyEndmode() is zero, textbox is enabled pText2=(wxTextCtrl*)FindWindow(wxTEXT2L); pText2->Enable(!actDoc->GetLatencyEndMode()); // use peak for latency measurements? //SetPeak4Latency ( actDoc->GetLatencyWindowMode() ); // Update RadioButton options SetLatencyStartMode( actDoc->GetLatencyStartMode() ); SetLatencyEndMode( actDoc->GetLatencyEndMode() ); break; #ifdef WITH_PSLOPE case stf::pslope_cursor: iNewValue1=(int)actDoc->GetPSlopeBeg(); iNewValue2=(int)actDoc->GetPSlopeEnd(); cursor1isTime = cursor1PSIsTime; cursor2isTime = cursor2PSIsTime; pText1=(wxTextCtrl*)FindWindow(wxTEXT1PS); pText2=(wxTextCtrl*)FindWindow(wxTEXT2PS); // Update PSlope Beg and End radio options SetPSlopeBegMode( actDoc->GetPSlopeBegMode() ); SetPSlopeEndMode( actDoc->GetPSlopeEndMode() ); SetDeltaT( actDoc->GetDeltaT() ); break; #endif default: break; } double fNewValue1=iNewValue1*actDoc->GetXScale(); double fNewValue2=iNewValue2*actDoc->GetXScale(); wxString strNewValue; if (cursor1isTime) { strNewValue << fNewValue1; } else { strNewValue << iNewValue1; } if (pText1 != NULL) { pText1->SetValue( strNewValue ); } if (select!=stf::measure_cursor && pText2 != NULL) { wxString strNewValue2; if (cursor2isTime) { strNewValue2 << fNewValue2; } else { strNewValue2 << iNewValue2; } pText2->SetValue( strNewValue2 ); } //SetSlope( actDoc->GetSlopeForThreshold() ); wxString slopeUnits; slopeUnits += stf::std2wx( actDoc->at(actDoc->GetCurChIndex()).GetYUnits() ); slopeUnits += wxT("/"); slopeUnits += stf::std2wx( actDoc->GetXUnits() ); SetSlopeUnits(slopeUnits); } stf::cursor_type wxStfCursorsDlg::CurrentCursor() const { if (m_notebook == NULL) return stf::undefined_cursor; switch (m_notebook->GetSelection()) { case 0: return stf::measure_cursor; case 1: return stf::peak_cursor; case 2: return stf::base_cursor; case 3: return stf::decay_cursor; case 4: return stf::latency_cursor; #ifdef WITH_PSLOPE case 5: return stf::pslope_cursor; #endif default: return stf::undefined_cursor; } } double wxStfCursorsDlg::GetSlope() const { double f=0.0; wxTextCtrl* pSlope =(wxTextCtrl*) FindWindow(wxSLOPE); if (pSlope == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetSlope()")); return 0; } wxString entry; entry << pSlope->GetValue(); entry.ToDouble( &f ); return f; } void wxStfCursorsDlg::SetSlope( double fSlope ) { wxTextCtrl* pSlope = (wxTextCtrl*)FindWindow(wxSLOPE); wxString wxsSlope; wxsSlope << fSlope; if ( pSlope != NULL ) pSlope->SetValue( wxsSlope ); } void wxStfCursorsDlg::SetSlopeUnits(const wxString& units) { wxStaticText* pSlopeUnits = (wxStaticText*)FindWindow(wxSLOPEUNITS); if (pSlopeUnits != NULL) { pSlopeUnits->SetLabel(units); } } bool wxStfCursorsDlg::GetRuler() const { wxCheckBox* pMeasCursor = (wxCheckBox*)FindWindow(wxMEASCURSOR); if (pMeasCursor == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::GetRuler()")); return false; } return pMeasCursor->IsChecked(); } void wxStfCursorsDlg::SetRuler(bool value) { wxCheckBox* pMeasCursor = (wxCheckBox*)FindWindow( wxMEASCURSOR ); if (pMeasCursor == NULL) { wxGetApp().ErrorMsg(wxT("null pointer in wxStfCursorsDlg::SetRuler()")); return; } pMeasCursor->SetValue(value); } stimfit-0.16.0/src/stimfit/gui/dlgs/cursorsdlg.h0000775000175000017500000003353013277303516016541 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file cursorsdlg.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfCursorsDlg. */ #ifndef _CURSORSDLG_H #define _CURSORSDLG_H /*! \addtogroup wxstf * @{ */ #include "./../../stf.h" #include #include #include #include #include class wxStfDoc; //! Cursor settings non-modal dialog class StfDll wxStfCursorsDlg : public wxDialog { DECLARE_EVENT_TABLE() private: wxNotebookPage* CreateMeasurePage(); wxNotebookPage* CreatePeakPage(); wxNotebookPage* CreateBasePage(); wxNotebookPage* CreateDecayPage(); wxNotebookPage* CreateLatencyPage(); #ifdef WITH_PSLOPE wxNotebookPage* CreatePSlopePage(); #endif wxFlexGridSizer* CreateCursorInput( wxPanel* nbPage, wxWindowID textC1, wxWindowID textC2, wxWindowID comboU1, wxWindowID comboU2, std::size_t c1, std::size_t c2 ); int ReadCursor(wxWindowID textId, bool isTime) const; void WriteCursor(wxWindowID textID, bool isTime, long cursor) const; int ReadDeltaT(wxWindowID textId) const; void UpdateUnits(wxWindowID comboId, bool& setTime, wxWindowID textID); bool cursorMIsTime, cursor1PIsTime,cursor2PIsTime, cursor1BIsTime,cursor2BIsTime, cursor1DIsTime,cursor2DIsTime, #ifdef WITH_PSLOPE cursor1PSIsTime,cursor2PSIsTime, #endif cursor1LIsTime,cursor2LIsTime; wxStfDoc* actDoc; wxNotebook* m_notebook; void OnPageChanged( wxNotebookEvent& event ); void OnComboBoxUM( wxCommandEvent& event ); void OnComboBoxU1P( wxCommandEvent& event ); void OnComboBoxU2P( wxCommandEvent& event ); void OnComboBoxU1B( wxCommandEvent& event ); void OnComboBoxU2B( wxCommandEvent& event ); void OnComboBoxU1D( wxCommandEvent& event ); void OnComboBoxU2D( wxCommandEvent& event ); void OnComboBoxU1L( wxCommandEvent& event ); void OnComboBoxU2L( wxCommandEvent& event ); #ifdef WITH_PSLOPE void OnComboBoxU1PS( wxCommandEvent& event ); void OnComboBoxU2PS( wxCommandEvent& event ); #endif void OnRadioLatManualBeg( wxCommandEvent& event ); void OnRadioLatManualEnd( wxCommandEvent& event ); void OnRadioLatNonManualBeg( wxCommandEvent& event ); void OnRadioLatNonManualEnd( wxCommandEvent& event ); #ifdef WITH_PSLOPE void OnRadioPSManBeg( wxCommandEvent& event ); void OnRadioPSEventBeg( wxCommandEvent& event ); void OnRadioPSThrBeg( wxCommandEvent& event ); void OnRadioPSt50Beg( wxCommandEvent& event ); void OnRadioPSManEnd( wxCommandEvent& event ); void OnRadioPSt50End( wxCommandEvent& event ); void OnRadioPSDeltaT( wxCommandEvent& event ); void OnRadioPSPeakEnd( wxCommandEvent& event ); #endif void OnRadioAll( wxCommandEvent& event ); void OnRadioMean( wxCommandEvent& event ); void OnPeakcalcexec( wxCommandEvent& event ); void OnLoadCursorConf( wxCommandEvent& event ); void OnSaveCursorConf( wxCommandEvent& event ); void OnBasetoslope( wxCommandEvent& event ); void OnRTSlider( wxScrollEvent& event ); void OnPeakAtEnd( wxCommandEvent& event ); void OnStartFitAtPeak( wxCommandEvent& event ); //! check the syntax of csr config files and return true if the syntax is correct. /*! \param crs_file, a crs config file */ bool IsCSRSyntax( wxFileConfig* crs_file ); //! Only called when a modal dialog is closed with the OK button. /*! \return true if all dialog entries could be read successfully */ bool OnOK(); public: //! Constructor /*! \param parent Pointer to parent window. * \param initDoc Pointer to the document the call originated from. * \param id Window id. * \param title Dialog title. * \param pos Initial position. * \param size Initial size. * \param style Dialog style. */ wxStfCursorsDlg( wxWindow* parent, wxStfDoc* initDoc, int id = wxID_ANY, wxString title = wxT("Cursor settings"), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxCAPTION ); //! Called upon ending a modal dialog. /*! \param retCode The dialog button id that ended the dialog * (e.g. wxID_OK) */ virtual void EndModal(int retCode); //! Called when data should be transferred from the non-modal dialog (e.g. when OK is pressed) /*! Note that a non-modal dialog won't be destroyed when OK is clicked, * it will only disappear from sight. This function will then apply the current * cursor settings and update the results table. * \return The return value of the base class version wxWindow::TransferDataFromWindow() */ virtual bool TransferDataFromWindow(); //! Get the measurement cursor x-position /*! \return The measurement cursor x-position in units of sampling points. */ int GetCursorM() const; //! Get the left peak cursor x-position /*! \return The left peak cursor x-position in units of sampling points. */ int GetCursor1P() const; //! Get the right peak cursor x-position /*! \return The right peak cursor x-position in units of sampling points. */ int GetCursor2P() const; //! Get the left base cursor x-position /*! \return The left base cursor x-position in units of sampling points. */ int GetCursor1B() const; //! Get the right base cursor x-position /*! \return The right base cursor x-position in units of sampling points. */ int GetCursor2B() const; //! Get the left fit cursor x-position /*! \return The left fit cursor x-position in units of sampling points. */ int GetCursor1D() const; //! Get the right fit cursor x-position /*! \return The right fit cursor x-position in units of sampling points. */ int GetCursor2D() const; //! Get the left latency cursor x-position /*! \return The left fit cursor x-position in units of sampling points. */ int GetCursor1L() const; //! Get the right latency cursor x-position /*! \return The right fit cursor x-position in units of sampling points. */ int GetCursor2L() const; #ifdef WITH_PSLOPE //! Get the left PSlope cursor x-position /*! \return The left fit cursor x-position in units of sampling points. */ int GetCursor1PS() const; //! Get the right PSlope cursor x-position /*! \return The right fit cursor x-position in units of sampling points. */ int GetCursor2PS() const; #endif //! Gets the number of points used for the binned average during peak detection. /*! \return The number of points used for the binned average during peak detection. */ int GetPeakPoints() const; //! Gets the lower factor (e.g 20) used to calculate the rise time. /*! \return The lower value of the percentage (e.g 20) to calculate the rise time. */ int GetRTFactor() const; //! Sets whether the right peak cursor should be at the end of the trace. /*! \param is_end true if the peak cursor is at the end of the trace, false otherwise. */ void SetPeakAtEnd( bool is_end); //! Sets the number of points used for the binned average during peak detection. /*! \param peakPoints The number of points used for the binned average during peak detection. */ void SetPeakPoints(int peakPoints); //! Set the lower value (e.g 20) to compute the rise-time. The high value is simply 100-lower value. /*! \param RTFactor is the lower value (e.g 20) . */ void SetRTFactor(int RTFactor); //! Gets the distance to the first PSlope cursor in number of points. /*! \return The distance to the first PSlope cursor in number of points. */ int GetDeltaT() const; //! Sets the number of points used for the distance from the first PSlope cursor. /*! \param peakPoints The number of points used for the distance from the first PSlope cursor. */ void SetDeltaT(int DeltaT); //! Sets whether the left decay cursor should be at the peak of the trace. /*! \param is_peak true if the decay cursor is at the peak of the trace, false otherwise. */ void SetStartFitAtPeak( bool is_peak); //! Gets the direction of peak calculations. /*! \return The current direction of peak calculations. */ stfnum::direction GetDirection() const; //! Gets the mode of Latency for the beginning of the latency cursor. /*! \return The current mode for the beginning latency cursor. */ stf::latency_mode GetLatencyStartMode() const; //! Gets the mode of Latency of the last latency cursor. /*! \return The current mode of the last latency cursor. */ stf::latency_mode GetLatencyEndMode() const; //! Sets the latency mode of the left latency cursor. /*! \param latencyBegMode: the new mode for the left latency cursor. */ void SetLatencyStartMode(stf::latency_mode latencyBegMode); //! Sets the latency mode of the right latency cursor. /*! \param latencyEndMode: the new mode for the right latency cursor. */ void SetLatencyEndMode(stf::latency_mode latencyEndMode); #ifdef WITH_PSLOPE //! Gets the mode of measure for the beginning of the slope cursor. /*! \return The current mode for the beginning slope cursor. */ stf::pslope_mode_beg GetPSlopeBegMode() const; //! Gets the mode of measure for the end of the slope cursor. /*! \return The current mode for the end slope cursor. */ stf::pslope_mode_end GetPSlopeEndMode() const; #endif // WITH_PSLOPE //! Indicates whether to use the baseline as a reference for AP kinetics. /*! \return true if the baseline should be used, false if the threshold should be used. */ bool GetFromBase() const; //! Sets the direction of peak calculations. /*! \param direction The new direction of peak calculations. */ void SetDirection(stfnum::direction direction); #ifdef WITH_PSLOPE //! Sets the mode of the right slope cursor. /*! \param pslopeEndMode The new mode for the slope cursor. */ void SetPSlopeEndMode(stf::pslope_mode_end pslopeEndMode); //! Sets the mode of the left slope cursor. /*! \param pslopeBegMode The new mode for the slope cursor. */ void SetPSlopeBegMode(stf::pslope_mode_beg pslopeBegMode); #endif // WITH_PSLOPE //! Sets the reference for AP kinetics measurements. /*! \param frombase true if the baseline should be used, false if the threshold should be used. */ void SetFromBase(bool frombase); //! Sets the reference for baseline measurement. /*! \param median true if the median should be used, false if the average is used. */ void SetBaselineMethod(enum stfnum::baseline_method); //! Indiates whether baseline is computed as mean or as median. /*! \param false indicates computing average (mean & s.d.), 1 indicates median & iqr. */ enum stfnum::baseline_method GetBaselineMethod() const; //! Indicates whether the right peak cursor should always be at the end of the trace. /*! \return true if the peak cursor should always be at the end of the trace. */ bool GetPeakAtEnd() const; //! Indicates whether to always start a fit at the current peak position. /*! \return true if the fit should always be started at the current peak position. */ bool GetStartFitAtPeak() const; //! Updates the cursor entries in the Cursors Settings menu. void UpdateCursors(); //! Retrieve the current cursor notebook page. /*! \return The cursor corresponding to the currently selected notebook page. */ stf::cursor_type CurrentCursor() const; //! Get the slope at which the baseline should be fixed. /*! \return The slope at which the baseline should be fixed. */ double GetSlope() const; //! Set the threshold slope. /*! \param slope The new threshold slope. */ void SetSlope( double slope ); //! Set the units of the slope. /*! \param units The units of the slope. */ void SetSlopeUnits(const wxString& units); //! Indicates whether the baseline should be fixed to a certain slope. /*! \return true if the baseline should be fixed, false otherwise. */ bool GetBaseToSlope() const; //! Indicates whether an additional vertical ruler is drawn through the measurement cursor. /*! \return true if an additional ruler should be drawn. */ bool GetRuler() const; //! Sets whether an additional vertical ruler should be drawn through the measurement cursor. /*! \param value true if an additional ruler should be drawn, false otherwise. */ void SetRuler(bool value); //! Load a cursor configuration file (*csr) in the Cursor Settings menu. /*! \param filepath The path where the csr file is located. */ bool LoadCursorConf( const wxString& filepath ); //! Save a cursor configuration file (*csr) from the Cursor Settings menu. /*! \param filepath The path where the csr file will be saved */ bool SaveCursorConf( const wxString& filepath ); //! Sets the currently active document. /*! \param actDoc_ A pointer to the currently active document. */ void SetActiveDoc(wxStfDoc* actDoc_) { actDoc = actDoc_; } }; /* @} */ #endif stimfit-0.16.0/src/stimfit/gui/dlgs/smalldlgs.cpp0000775000175000017500000011514313277303516016670 00000000000000#include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include #include "./../../res/arrow_down.xpm" #include "./../../res/arrow_up.xpm" #include "./../app.h" #include "./smalldlgs.h" BEGIN_EVENT_TABLE( wxStfFileInfoDlg, wxDialog ) END_EVENT_TABLE() wxStfFileInfoDlg::wxStfFileInfoDlg( wxWindow* parent, const std::string& szGeneral, const std::string& szFile, const std::string& szSection, int id, wxString title, wxPoint pos, wxSize size, int style ) : wxDialog( parent, id, title, pos, size, style ) { // this->SetSize(464,464); wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); wxString wxs = stf::std2wx(szGeneral); wxTextCtrl* textCtrlGeneral = new wxTextCtrl( this, wxID_ANY, wxs, wxDefaultPosition, wxSize(640,100), wxTE_MULTILINE | wxTE_DONTWRAP | wxTE_READONLY ); topSizer->Add( textCtrlGeneral, 0, wxALL, 5 ); wxBoxSizer* subSizer; subSizer = new wxBoxSizer( wxHORIZONTAL ); wxTextCtrl* textCtrlFile = new wxTextCtrl( this, wxID_ANY, stf::std2wx(szFile), wxDefaultPosition, wxSize(416,400), wxTE_MULTILINE | wxTE_DONTWRAP | wxTE_READONLY ); subSizer->Add( textCtrlFile, 0, wxALL, 5 ); wxTextCtrl* textCtrlSection = new wxTextCtrl( this, wxID_ANY, stf::std2wx(szSection), wxDefaultPosition, wxSize(214,400), wxTE_MULTILINE | wxTE_DONTWRAP | wxTE_READONLY ); subSizer->Add( textCtrlSection, 0, wxALL, 5 ); topSizer->Add( subSizer, 0, wxALIGN_CENTER, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } #define wxCOMBOCH1 1000 #define wxCOMBOCH2 1001 BEGIN_EVENT_TABLE( wxStfChannelSelDlg, wxDialog ) EVT_COMBOBOX( wxCOMBOCH1, wxStfChannelSelDlg::OnComboCh1 ) EVT_COMBOBOX( wxCOMBOCH2, wxStfChannelSelDlg::OnComboCh2 ) END_EVENT_TABLE() wxStfChannelSelDlg::wxStfChannelSelDlg( wxWindow* parent, const std::vector& channelNames, int id, wxString title, wxPoint pos, wxSize size, int style ) : wxDialog( parent, id, title, pos, size, style ), m_selChannel1(0), m_selChannel2(1) { wxArrayString strArray; strArray.Alloc(channelNames.size()); for (c_wxs_it cit = channelNames.begin(); cit != channelNames.end(); cit++) { strArray.Add( *cit ); } wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); // Add static boxes and combo boxes: wxStaticBoxSizer* ch1Sizer; ch1Sizer = new wxStaticBoxSizer( new wxStaticBox( this, -1, wxT("Select active channel:") ), wxVERTICAL ); m_comboBoxCh1 = new wxComboBox( this, wxCOMBOCH1, channelNames[0], wxDefaultPosition, wxSize(128,20), strArray, wxCB_DROPDOWN | wxCB_READONLY ); ch1Sizer->Add( m_comboBoxCh1, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); topSizer->Add( ch1Sizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxStaticBoxSizer* ch2Sizer; ch2Sizer = new wxStaticBoxSizer( new wxStaticBox( this, -1, wxT("Select second channel:") ), wxVERTICAL ); m_comboBoxCh2 = new wxComboBox( this, wxCOMBOCH2, channelNames[1], wxDefaultPosition, wxSize(128,20), strArray, wxCB_DROPDOWN | wxCB_READONLY ); ch2Sizer->Add( m_comboBoxCh2, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); topSizer->Add( ch2Sizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); m_comboBoxCh1->SetSelection(0); m_comboBoxCh2->SetSelection(1); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfChannelSelDlg::OnComboCh1( wxCommandEvent& event ) { event.Skip(); if (m_comboBoxCh1->GetCurrentSelection()==m_comboBoxCh2->GetCurrentSelection()) { // correct selection: for (int n_c=0;n_c<(int)m_comboBoxCh1->GetCount();++n_c) { if (n_c!=m_comboBoxCh1->GetCurrentSelection()) { m_comboBoxCh2->SetSelection(n_c); break; } } } } void wxStfChannelSelDlg::OnComboCh2( wxCommandEvent& event ) { event.Skip(); if (m_comboBoxCh2->GetCurrentSelection()==m_comboBoxCh1->GetCurrentSelection()) { // correct selection: for (int n_c=0;n_c<(int)m_comboBoxCh2->GetCount();++n_c) { if (n_c!=m_comboBoxCh2->GetCurrentSelection()) { m_comboBoxCh1->SetSelection(n_c); break; } } } } void wxStfChannelSelDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxGetApp().ErrorMsg(wxT("Please select a valid function")); return; } } wxDialog::EndModal(retCode); } bool wxStfChannelSelDlg::OnOK() { m_selChannel1 = m_comboBoxCh1->GetCurrentSelection(); m_selChannel2 = m_comboBoxCh2->GetCurrentSelection(); return true; } BEGIN_EVENT_TABLE( wxStfAlignDlg, wxDialog ) END_EVENT_TABLE() wxStfAlignDlg::wxStfAlignDlg(wxWindow* parent, bool hasReference, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ), m_alignRise(0), m_useReference(true), m_hasReference(hasReference) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); if (m_hasReference) { m_checkBox=new wxCheckBox( this, wxID_ANY, wxT("Use reference channel"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBox->SetValue(true); topSizer->Add( m_checkBox, 0, wxALIGN_LEFT | wxALL, 5 ); } wxString m_radioBoxChoices[] = { wxT("peak"), wxT("steepest slope during rise"), wxT("half amplitude"), wxT("onset") }; int m_radioBoxNChoices = sizeof( m_radioBoxChoices ) / sizeof( wxString ); m_radioBox = new wxRadioBox( this, wxID_ANY, wxT("Alignment point"), wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices, m_radioBoxChoices, m_radioBoxNChoices, wxRA_SPECIFY_ROWS); topSizer->Add( m_radioBox, 0, wxALL, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfAlignDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxLogMessage(wxT("Please select a valid function")); return; } } wxDialog::EndModal(retCode); } bool wxStfAlignDlg::OnOK() { m_alignRise = m_radioBox->GetSelection(); if (m_hasReference) { m_useReference = m_checkBox->IsChecked(); } else { m_useReference = false; } return true; } BEGIN_EVENT_TABLE( wxStfFilterSelDlg, wxDialog ) END_EVENT_TABLE() wxStfFilterSelDlg::wxStfFilterSelDlg(wxWindow* parent, int id, wxString title, wxPoint pos, wxSize size,int style) : wxDialog( parent, id, title, pos, size, style ), m_filterSelect(0) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); wxString m_radioBoxChoices[] = { wxT("Notch (inverted Gaussian)"), wxT("Low pass (4th-order Bessel)"), wxT("Low pass (Gaussian)") }; int m_radioBoxNChoices = sizeof( m_radioBoxChoices ) / sizeof( wxString ); m_radioBox = new wxRadioBox( this, wxID_ANY, wxT("Select filter function"), wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices, m_radioBoxChoices, 3, wxRA_SPECIFY_ROWS ); topSizer->Add( m_radioBox, 0, wxALL, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfFilterSelDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxLogMessage(wxT("Please select a valid function")); return; } } wxDialog::EndModal(retCode); } bool wxStfFilterSelDlg::OnOK() { m_filterSelect=m_radioBox->GetSelection()+1; return true; } BEGIN_EVENT_TABLE( wxStfTransformDlg, wxDialog ) END_EVENT_TABLE() wxStfTransformDlg::wxStfTransformDlg(wxWindow* parent, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ), m_fSelect(0) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); wxString m_radioBoxChoices[] = { wxT(" ln(x) ") }; int m_radioBoxNChoices = sizeof( m_radioBoxChoices ) / sizeof( wxString ); m_radioBox = new wxRadioBox( this, wxID_ANY, wxT("Select function"), wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices, m_radioBoxChoices, 0, wxRA_SPECIFY_ROWS ); topSizer->Add( m_radioBox, 0, wxALIGN_CENTER | wxALL, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfTransformDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxLogMessage(wxT("Please select a valid function")); return; } } wxDialog::EndModal(retCode); } bool wxStfTransformDlg::OnOK() { m_fSelect=m_radioBox->GetSelection()+1; return true; } BEGIN_EVENT_TABLE( wxStfFitInfoDlg, wxDialog ) END_EVENT_TABLE() wxStfFitInfoDlg::wxStfFitInfoDlg(wxWindow* parent, const wxString& info, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); wxTextCtrl* m_textCtrl; m_textCtrl=new wxTextCtrl( this, wxID_ANY, info, wxDefaultPosition, wxSize(320,120), wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP ); topSizer->Add( m_textCtrl, 0, wxALIGN_CENTER | wxALL, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } BEGIN_EVENT_TABLE( wxStfBatchDlg, wxDialog ) END_EVENT_TABLE() wxStfBatchDlg::wxStfBatchDlg(wxWindow* parent, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, wxT("Choose values"), pos, size, style ), batchOptions( 0 ) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); batchOptions.push_back( BatchOption( wxT("Base"), true, id_base ) ); batchOptions.push_back( BatchOption( wxT("Base SD"), false, id_basesd ) ); batchOptions.push_back( BatchOption( wxT("Threshold"), true, id_threshold ) ); batchOptions.push_back( BatchOption( wxT("time of slope threshold crossing"), false, id_slopethresholdtime ) ); batchOptions.push_back( BatchOption( wxT("Peak (from 0)"), true, id_peakzero ) ); batchOptions.push_back( BatchOption( wxT("Peak (from base)"), true, id_peakbase ) ); batchOptions.push_back( BatchOption( wxT("Peak (from threshold)"), true, id_peakthreshold ) ); batchOptions.push_back( BatchOption( wxT("Peak time"), true, id_peaktime ) ); batchOptions.push_back( BatchOption( wxT("Lo-Hi% risetime"), false, id_rtLoHi ) ); batchOptions.push_back( BatchOption( wxT("inner risetime"), false, id_innerLoHi ) ); batchOptions.push_back( BatchOption( wxT("outer risetime"), false, id_outerLoHi ) ); batchOptions.push_back( BatchOption( wxT("Half amplitude duration"), false, id_t50 ) ); batchOptions.push_back( BatchOption( wxT("start and end time of half amplitude"), false, id_t50se ) ); batchOptions.push_back( BatchOption( wxT("Max slopes"), false, id_slopes ) ); batchOptions.push_back( BatchOption( wxT("Max slope times"), false, id_slopetimes ) ); batchOptions.push_back( BatchOption( wxT("Latencies"), false, id_latencies ) ); batchOptions.push_back( BatchOption( wxT("Fit results"), false, id_fit ) ); #ifdef WITH_PSLOPE batchOptions.push_back( BatchOption( wxT("pSlope"), false, id_pslopes ) ); #endif batchOptions.push_back( BatchOption( wxT("Threshold crossings"), false, id_crossings ) ); std::vector::const_iterator bo_it; std::vector checkListChoices(batchOptions.size()); for (bo_it = batchOptions.begin(); bo_it != batchOptions.end(); ++bo_it) { try { checkListChoices.at(bo_it->index) = bo_it->label; } catch (const std::out_of_range& e) { wxString errorMsg( wxT("Error while populating checkbox list:\n") ); errorMsg += wxString(e.what(), wxConvLocal); wxGetApp().ExceptMsg( errorMsg ); } }; m_checkList = new wxCheckListBox( this, wxID_ANY, wxDefaultPosition, wxSize(280,350), checkListChoices.size(), &checkListChoices[0], 0 ); for (bo_it = batchOptions.begin(); bo_it != batchOptions.end(); ++bo_it) { m_checkList->Check(bo_it->index, wxGetApp().wxGetProfileInt( wxT("Batch Dialog"), bo_it->label, bo_it->selection) ); } topSizer->Add( m_checkList, 0, wxALIGN_CENTER | wxALL, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfBatchDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxLogMessage(wxT("Please select a valid function")); return; } } wxDialog::EndModal(retCode); } bool wxStfBatchDlg::OnOK() { std::vector::iterator bo_it; for (bo_it = batchOptions.begin(); bo_it != batchOptions.end(); ++bo_it) { bo_it->selection = m_checkList->IsChecked( bo_it->index ); wxGetApp().wxWriteProfileInt( wxT("Batch Dialog"), bo_it->label, bo_it->selection ); } return true; } BatchOption wxStfBatchDlg::LookUp( int index ) const { std::vector::const_iterator bo_it; for (bo_it = batchOptions.begin(); bo_it != batchOptions.end(); ++bo_it) { if ( bo_it->index == index ) { return *bo_it; } } return BatchOption( wxT(""), false, -1 ); } BEGIN_EVENT_TABLE( wxStfPreprintDlg, wxDialog ) END_EVENT_TABLE() wxStfPreprintDlg::wxStfPreprintDlg(wxWindow* parent, bool isFile_, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ), m_gimmicks(true), m_isFile(isFile_), m_downsampling(1) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); if (!m_isFile) { m_checkBox=new wxCheckBox( this, wxID_ANY, wxT("Print gimmicks (Cursors etc.)"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBox->SetValue(true); topSizer->Add( m_checkBox, 0, wxALIGN_LEFT | wxALL, 5 ); } wxFlexGridSizer* gridSizer; gridSizer=new wxFlexGridSizer(1,2,0,0); wxStaticText* staticText; staticText=new wxStaticText( this, wxID_ANY, wxT("Print every n-th point:"), wxDefaultPosition, wxSize(112,20), 0 ); gridSizer->Add( staticText, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString def; def << 1; m_textCtrl=new wxTextCtrl( this, wxID_ANY, def, wxDefaultPosition, wxSize(32,20), wxTE_RIGHT ); gridSizer->Add( m_textCtrl, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); topSizer->Add( gridSizer, 0, wxALIGN_CENTER | wxALL, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfPreprintDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxLogMessage(wxT("Please select a valid function")); return; } } wxDialog::EndModal(retCode); } bool wxStfPreprintDlg::OnOK() { if (!m_isFile) { m_gimmicks=m_checkBox->IsChecked(); } else { m_gimmicks=false; } // Read entry to string: wxString entry = m_textCtrl->GetValue(); long tempLong; entry.ToLong( &tempLong ); m_downsampling = (int) tempLong; return true; } BEGIN_EVENT_TABLE( wxStfGaussianDlg, wxDialog ) END_EVENT_TABLE() wxStfGaussianDlg::wxStfGaussianDlg(wxWindow* parent, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ), m_width(0.001), m_center(0.05), m_amp(1.0) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer *gridSizer; gridSizer=new wxFlexGridSizer(3,2,0,0); wxStaticText* staticTextAmp; staticTextAmp=new wxStaticText( this, wxID_ANY, wxT("Amplitude:"), wxDefaultPosition, wxDefaultSize, 0); gridSizer->Add( staticTextAmp, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_slider = new wxSlider( this, wxID_ANY, 100, 0, 100, wxDefaultPosition, wxSize(128,-1), wxSL_HORIZONTAL ); gridSizer->Add( m_slider, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxStaticText* staticTextCenter; staticTextCenter=new wxStaticText( this, wxID_ANY, wxT("Center (kHz):"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextCenter, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString def; def << m_center; m_textCtrlCenter=new wxTextCtrl( this, wxID_ANY, def, wxDefaultPosition, wxSize(40,20), wxTE_RIGHT ); gridSizer->Add( m_textCtrlCenter, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxStaticText* staticTextWidth; staticTextWidth=new wxStaticText( this, wxID_ANY, wxT("Width (kHz):"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextWidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString def2; def2 << m_width; m_textCtrlWidth=new wxTextCtrl( this, wxID_ANY, def2, wxDefaultPosition, wxSize(40,20), wxTE_RIGHT ); gridSizer->Add( m_textCtrlWidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); topSizer->Add( gridSizer, 0, wxALIGN_CENTER | wxALL, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfGaussianDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxLogMessage(wxT("Please select a valid function")); return; } } wxDialog::EndModal(retCode); } bool wxStfGaussianDlg::OnOK() { m_amp=m_slider->GetValue() / 100.0; // Read entry to string: wxString entryCenter = m_textCtrlCenter->GetValue(); entryCenter.ToDouble( &m_center ); wxString entryWidth = m_textCtrlWidth->GetValue(); entryWidth.ToDouble( &m_width ); return true; } #define wxCOMBONCOLUMNS 1000 #define wxCOMBOFIRSTTIME 1001 #define wxCOMBOSECORCH 1002 BEGIN_EVENT_TABLE( wxStfTextImportDlg, wxDialog ) EVT_COMBOBOX( wxCOMBONCOLUMNS, wxStfTextImportDlg::OnComboNcolumns ) EVT_COMBOBOX( wxCOMBOFIRSTTIME, wxStfTextImportDlg::OnComboFirsttime ) EVT_COMBOBOX( wxCOMBOSECORCH, wxStfTextImportDlg::OnComboSecorch ) END_EVENT_TABLE() wxStfTextImportDlg::wxStfTextImportDlg(wxWindow* parent, const wxString& textPreview, int hLines_, bool isSeries, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ), m_hLines(hLines_),m_toSection(true), m_firstIsTime(true),m_isSeries(isSeries),m_ncolumns(2), m_sr(20),m_yUnits(wxT("mV")),m_yUnitsCh2(wxT("pA")),m_xUnits(wxT("ms")) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); wxFlexGridSizer *gridSizer; gridSizer=new wxFlexGridSizer(4,4,0,10); // Header lines------------------------------------------------------ wxStaticText* staticTextHLines; staticTextHLines=new wxStaticText( this, wxID_ANY, wxT("Header lines to skip:"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextHLines, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString strHLines; strHLines << m_hLines; m_textCtrlHLines=new wxTextCtrl( this, wxID_ANY, strHLines, wxDefaultPosition, wxSize(64,20), wxTE_RIGHT ); gridSizer->Add( m_textCtrlHLines, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Number of columns------------------------------------------------- wxStaticText* staticTextNcolumns; staticTextNcolumns=new wxStaticText( this, wxID_ANY, wxT("Number of columns:"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextNcolumns, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString szNcolumns[] = { wxT("1"), wxT("2"), wxT("3") }; int szNcolumnsSize = sizeof( szNcolumns ) / sizeof( wxString ); m_comboBoxNcolumns = new wxComboBox( this, wxCOMBONCOLUMNS, wxT("1"), wxDefaultPosition, wxSize(64,20), szNcolumnsSize, szNcolumns, wxCB_DROPDOWN | wxCB_READONLY ); gridSizer->Add( m_comboBoxNcolumns, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Type of first column--------------------------------------------- wxStaticText* staticTextFirsttime; staticTextFirsttime=new wxStaticText( this, wxID_ANY, wxT("First column is time:"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextFirsttime, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString szFirsttime[] = { wxT("Yes"), wxT("No"), }; int szFirsttimeSize = sizeof( szFirsttime ) / sizeof( wxString ); m_comboBoxFirsttime = new wxComboBox( this, wxCOMBOFIRSTTIME, wxT("Yes"), wxDefaultPosition, wxSize(64,20), szFirsttimeSize, szFirsttime, wxCB_DROPDOWN | wxCB_READONLY ); gridSizer->Add( m_comboBoxFirsttime, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Read into sections or channels----------------------------------- wxStaticText* staticTextSecorch; staticTextSecorch=new wxStaticText( this, wxID_ANY, wxT("Read columns into:"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextSecorch, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString szSecorch[] = { wxT("Sections"), wxT("Channels"), }; int szSecorchSize = sizeof( szSecorch ) / sizeof( wxString ); m_comboBoxSecorch = new wxComboBox( this, wxCOMBOSECORCH, wxT("Sections"), wxDefaultPosition, wxSize(64,20), szSecorchSize, szSecorch, wxCB_DROPDOWN | wxCB_READONLY ); gridSizer->Add( m_comboBoxSecorch, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Y units----------------------------------------------------------- wxStaticText* staticTextYUnits; staticTextYUnits=new wxStaticText( this, wxID_ANY, wxT("Y units:"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextYUnits, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_textCtrlYUnits=new wxTextCtrl( this, wxID_ANY, m_yUnits, wxDefaultPosition, wxSize(64,20), wxTE_LEFT ); gridSizer->Add( m_textCtrlYUnits, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Y units of channel 2---------------------------------------------- wxStaticText* staticTextYUnitsCh2; staticTextYUnitsCh2=new wxStaticText( this, wxID_ANY, wxT("Y units, channel 2:"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextYUnitsCh2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_textCtrlYUnitsCh2=new wxTextCtrl( this, wxID_ANY, m_yUnitsCh2, wxDefaultPosition, wxSize(64,20), wxTE_LEFT ); gridSizer->Add( m_textCtrlYUnitsCh2, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // X units----------------------------------------------------------- wxStaticText* staticTextXUnits; staticTextXUnits=new wxStaticText( this, wxID_ANY, wxT("X units:"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextXUnits, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); m_textCtrlXUnits=new wxTextCtrl( this, wxID_ANY, m_xUnits, wxDefaultPosition, wxSize(64,20), wxTE_LEFT ); gridSizer->Add( m_textCtrlXUnits, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); // Sampling rate----------------------------------------------------- wxStaticText* staticTextSR; staticTextSR=new wxStaticText( this, wxID_ANY, wxT("Sampling rate (kHz):"), wxDefaultPosition, wxDefaultSize, 0 ); gridSizer->Add( staticTextSR, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); wxString strSR; strSR << m_sr; m_textCtrlSR=new wxTextCtrl( this, wxID_ANY, strSR, wxDefaultPosition, wxSize(64,20), wxTE_RIGHT ); gridSizer->Add( m_textCtrlSR, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2 ); topSizer->Add( gridSizer, 0, wxALIGN_CENTER, 5 ); // Check box for batch import---------------------------------------- if (m_isSeries) { m_checkBoxApplyToAll=new wxCheckBox( this, wxID_ANY, wxT("Apply settings to all files in series"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxApplyToAll->SetValue(false); topSizer->Add( m_checkBoxApplyToAll, 0, wxALIGN_CENTER | wxALL, 5 ); } // OK / Cancel buttons----------------------------------------------- m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); m_sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); m_sdbSizer->Realize(); topSizer->Add( m_sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); // Text preview------------------------------------------------------ wxTextCtrl* previewCtrl; previewCtrl=new wxTextCtrl( this, wxID_ANY, textPreview, wxDefaultPosition, wxSize(368,160), wxTE_MULTILINE | wxTE_DONTWRAP | wxTE_READONLY ); topSizer->Add( previewCtrl, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); disableSenseless(); this->Layout(); } void wxStfTextImportDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxLogMessage(wxT("Please select a valid function")); return; } } wxDialog::EndModal(retCode); } bool wxStfTextImportDlg::OnOK() { long tempLong; m_textCtrlHLines->GetValue().ToLong( &tempLong ); m_hLines = tempLong; m_toSection=(m_comboBoxSecorch->GetCurrentSelection()==0); m_firstIsTime=(m_comboBoxFirsttime->GetCurrentSelection()==0); m_ncolumns=m_comboBoxNcolumns->GetCurrentSelection()+1; m_yUnits = m_textCtrlYUnits->GetValue(); m_yUnitsCh2 = m_textCtrlYUnitsCh2->GetValue(); m_xUnits = m_textCtrlXUnits->GetValue(); double tempDouble; m_textCtrlSR->GetValue().ToDouble ( &tempDouble ); m_sr = tempDouble; if (m_isSeries) { m_applyToAll=m_checkBoxApplyToAll->IsChecked(); } return true; } stfio::txtImportSettings wxStfTextImportDlg::GetTxtImport() const { stfio::txtImportSettings retTxtImport; retTxtImport.firstIsTime=m_firstIsTime; retTxtImport.hLines=m_hLines; retTxtImport.ncolumns=m_ncolumns; retTxtImport.sr=m_sr; retTxtImport.toSection=m_toSection; retTxtImport.xUnits = stf::wx2std(m_xUnits); retTxtImport.yUnits = stf::wx2std(m_yUnits); retTxtImport.yUnitsCh2 = stf::wx2std(m_yUnitsCh2); return retTxtImport; } void wxStfTextImportDlg::disableSenseless() { // if there is only one column, it can't be time: if (m_comboBoxNcolumns->GetCurrentSelection()==0) { m_firstIsTime=false; m_comboBoxFirsttime->SetSelection(1); m_comboBoxFirsttime->Enable(false); } else { m_comboBoxFirsttime->Enable(); } // if the first column is time, disable manual sampling rate settings: if (m_comboBoxFirsttime->GetCurrentSelection()==0) { m_textCtrlSR->Enable(false); } else { m_textCtrlSR->Enable(); } // if there is only one data column, // it doesn't make sense to choose between channels and sections int temp_nColumns=m_comboBoxNcolumns->GetCurrentSelection()+1; int temp_nTime=(m_comboBoxFirsttime->GetCurrentSelection()==0)? 1:0; int nData=temp_nColumns-temp_nTime; if (nData<2) { m_comboBoxSecorch->Enable(false); } else { m_comboBoxSecorch->Enable(); } // Enable units of second channel only if // there is a second channel at all: if (nData>1 && m_comboBoxSecorch->GetCurrentSelection()==1) { m_textCtrlYUnitsCh2->Enable(); } else { m_textCtrlYUnitsCh2->Enable(false); } } void wxStfTextImportDlg::OnComboNcolumns( wxCommandEvent& event ) { event.Skip(); m_ncolumns=m_comboBoxNcolumns->GetCurrentSelection()+1; disableSenseless(); } void wxStfTextImportDlg::OnComboFirsttime( wxCommandEvent& event ) { event.Skip(); m_firstIsTime=(m_comboBoxFirsttime->GetCurrentSelection()==0); disableSenseless(); } void wxStfTextImportDlg::OnComboSecorch( wxCommandEvent& event ) { event.Skip(); m_toSection=(m_comboBoxSecorch->GetCurrentSelection()==0); disableSenseless(); } enum { wxID_BUP, wxID_BDOWN, wxID_LISTCH }; BEGIN_EVENT_TABLE( wxStfOrderChannelsDlg, wxDialog ) EVT_BUTTON( wxID_BUP, wxStfOrderChannelsDlg::OnUparrow ) EVT_BUTTON( wxID_BDOWN, wxStfOrderChannelsDlg::OnDownarrow ) END_EVENT_TABLE() wxStfOrderChannelsDlg::wxStfOrderChannelsDlg(wxWindow* parent, const std::vector& channelNames, int id, wxString title, wxPoint pos, wxSize size, int style) : wxDialog( parent, id, title, pos, size, style ), channelOrder(channelNames.size()) { wxBoxSizer* topSizer; topSizer = new wxBoxSizer( wxVERTICAL ); // 2-column sizer for funcs (left) and settings (right) wxFlexGridSizer* mainGrid; mainGrid=new wxFlexGridSizer(1,2,0,5); m_List = new wxListCtrl( this, wxID_LISTCH, wxDefaultPosition, wxSize(240,(int)channelNames.size()*24), wxLC_LIST | wxLC_SINGLE_SEL ); for (long n_c=0;n_c<(long)channelNames.size();++n_c) { m_List->InsertItem( n_c, channelNames[n_c] ); channelOrder[n_c]=n_c; } mainGrid->Add( m_List, 0, wxALIGN_CENTER_HORIZONTAL, 2 ); // Add up and down arrows: wxBoxSizer* arrowSizer; arrowSizer = new wxBoxSizer( wxVERTICAL ); wxBitmapButton *bUp, *bDown; bUp = new wxBitmapButton(this,wxID_BUP,arrow_up); bDown = new wxBitmapButton(this,wxID_BDOWN,arrow_down); arrowSizer->Add(bUp, 0, wxALIGN_CENTER | wxALL, 2 ); arrowSizer->Add(bDown, 0, wxALIGN_CENTER | wxALL, 2 ); mainGrid->Add( arrowSizer, 0, wxALIGN_CENTER_HORIZONTAL, 2 ); topSizer->Add( mainGrid, 0, wxALIGN_CENTER_HORIZONTAL| wxALL, 5 ); wxStdDialogButtonSizer* sdbSizer = new wxStdDialogButtonSizer(); sdbSizer->AddButton( new wxButton( this, wxID_OK ) ); sdbSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); sdbSizer->Realize(); topSizer->Add( sdbSizer, 0, wxALIGN_CENTER | wxALL, 5 ); topSizer->SetSizeHints(this); this->SetSizer( topSizer ); this->Layout(); } void wxStfOrderChannelsDlg::EndModal(int retCode) { // similar to overriding OnOK in MFC (I hope...) if (retCode==wxID_OK) { if (!OnOK()) { wxGetApp().ErrorMsg(wxT("Please select a valid function")); return; } } wxDialog::EndModal(retCode); } bool wxStfOrderChannelsDlg::OnOK() { return true; } void wxStfOrderChannelsDlg::OnUparrow( wxCommandEvent& event ) { event.Skip(); // Get currently selected item in list: if (m_List->GetSelectedItemCount()>0) { // Get first selected item: long item = -1; item=m_List->GetNextItem(item,wxLIST_NEXT_ALL,wxLIST_STATE_SELECTED); // Return if this is already the topmost item: if (item <= 0) return; // Otherwise, move this item up by swapping with the previous item: SwapItems(item-1,item); // Focus on list: m_List->SetFocus(); } } void wxStfOrderChannelsDlg::OnDownarrow( wxCommandEvent& event ) { event.Skip(); // Get currently selected item in list: if (m_List->GetSelectedItemCount()>0) { // Get first selected item: long item = -1; item=m_List->GetNextItem(item,wxLIST_NEXT_ALL,wxLIST_STATE_SELECTED); // Return if this is the last item: if (item >= m_List->GetItemCount()-1) return; // Otherwise, move this item down by swapping with the next item: SwapItems(item,item+1); // Focus on list: m_List->SetFocus(); } } void wxStfOrderChannelsDlg::SwapItems(long itemId1, long itemId2) { // Store the first item: wxString labelFirst=m_List->GetItemText(itemId1); int orderFirst=channelOrder[itemId1]; // Change first item label: m_List->SetItemText(itemId1,m_List->GetItemText(itemId2)); // Change second item label: m_List->SetItemText(itemId2,labelFirst); // Update channel order: channelOrder[itemId1]=channelOrder[itemId2]; channelOrder[itemId2]=orderFirst; } stimfit-0.16.0/src/stimfit/gui/childframe.h0000775000175000017500000001735213277303516015523 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file childframe.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfChildFrame. */ #ifndef _CHILDFRAME_H #define _CHILDFRAME_H /*! \addtogroup wxstf * @{ */ #include #include #include #include #include "./../stf.h" // Define a new frame class wxStfGraph; class wxStfTable; class wxStfGrid; //! child frame type; depends on whether aui is used for the doc/view interface #ifdef WITH_AUIDOCVIEW typedef wxAuiDocMDIChildFrame wxStfChildType; #else typedef wxDocMDIChildFrame wxStfChildType; #endif //! parent frame type; depends on whether aui is used for the doc/view interface #ifdef WITH_AUIDOCVIEW typedef wxAuiDocMDIParentFrame wxStfParentType; #else typedef wxDocMDIParentFrame wxStfParentType; #endif //! Default perspective string. /*! Can be loaded to restore the default AUI perspective. */ const wxString defaultPersp = wxT("layout2| \ name=Results;caption=Results;state=2044;dir=1;layer=0;row=0;pos=1;prop=167270; \ bestw=200;besth=184;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1| \ name=Selection;caption=Trace selection;state=2044;dir=1;layer=0;row=0;pos=0;prop=32730; \ bestw=128;besth=64;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1| \ name=Traces;caption=Traces;state=18428;dir=5;layer=0;row=0;pos=0;prop=100000; \ bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|"); #if wxUSE_DRAG_AND_DROP class wxStfFileDrop : public wxFileDropTarget { protected: virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames); }; #endif //! Provides the child frame for displaying documents on separate windows. /*! This class can only be used for MDI child frames. It is part of the document/view * framework supported by wxWidgets. */ class StfDll wxStfChildFrame : public wxStfChildType { DECLARE_CLASS( wxStfChildFrame ) public: //! Constructor /*! \param doc Pointer to the attached document. * \param view Pointer to the attached view. * \param parent Pointer to the parent frame. * \param id Window id. * \param title Window title string. * \param pos Initial window position. * \param size Initial window size. * \param style Window style. * \param name Name of this frame. */ wxStfChildFrame( wxDocument* doc, wxView* view, wxStfParentType* parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxPoint(48,48), const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxT("frame") ); //! Destructor ~wxStfChildFrame(); //! Adds a table to the results notebook /*! \param table The table to be added. * \param caption The title of the new table in the notebook. */ void ShowTable(const stfnum::Table& table,const wxString& caption); //! Retrieves the current trace from the trace selection combo box. /*! \return The 0-based index of the currently selected trace. */ std::size_t GetCurTrace() const; //! Sets the current trace from the trace selection combo box. /*! \return The 0-based index of the trace to be selected. */ void SetCurTrace(std::size_t); //! Creates the trace selection menu. /*! \param value The number of traces. */ void CreateMenuTraces(std::size_t value); //! Creates the channel selection combo boxes. /*! \param channelNames The channel names for the combo box drop-down list. */ void CreateComboChannels( const wxArrayString& channelNames ); //! Refreshes the trace selection string. /*! \param value The number of selected traces. */ void SetSelected(std::size_t value); //! Sets the channels in the combo boxes. Checks and corrects equal channels in both boxes. /*! \param act Index of the active channel. * \param inact Index of the reference channel. */ void SetChannels( std::size_t act, std::size_t inact ); //! Updates the channels according to the current combo boy selection. void UpdateChannels( ); //! Updates the results table. /*! Called from wxStfApp::OnPeakcalcexecMsg() to update the results table. * Don't call this directly; use wxStfApp::OnPeakcalcexecMsg() instead. */ void UpdateResults(); //! Retrieve the wxAuiManager. /*! \return A pointer to the wxAuiManager. */ wxAuiManager* GetMgr() {return &m_mgr;} //! Retrieve the wxStfGrid that contains the results table. /*! \return A pointer to the grid. */ wxStfGrid* GetCopyGrid() {return m_table;} //! Write the current AUI perspective to the configuration void Saveperspective(); //! Load the saved AUI perspective from the configuration void Loadperspective(); //! Restore the default AUI perspective. void Restoreperspective(); //! Indicates whether all selected traces should be plotted. /*! \return true if they should be plotted, false otherwise. */ bool ShowSelected() const {return pShowSelected->IsChecked();} //! Indicates whether the second channel should be plotted. /*! \return true if it should be plotted, false otherwise. */ bool ShowSecond();// const {return pShowSecond->IsChecked();} //! Indicates whether all channels should be plotted. /*! \return true if they should be plotted, false otherwise. */ bool ShowAll() const {return pShowAll->IsChecked();} //! Activated the current graph void ActivateGraph(); void OnActivate(wxActivateEvent &event); //! Override default GetMenuBar /*! \return the menu bar if non-NULL; otherwise, the parent's menu bar */ virtual wxMenuBar *GetMenuBar() const { if (wxStfChildType::GetMenuBar()) { return wxStfChildType::GetMenuBar(); } else { return m_parent->GetMenuBar(); } } private: wxStfParentType* m_parent; wxAuiManager m_mgr; wxAuiNotebook* m_notebook; long m_notebook_style; wxPanel *m_traceCounter; wxPanel *m_channelCounter; wxStaticText *pSize; wxComboBox *pActChannel, *pInactChannel; wxSpinCtrl *trace_spinctrl; wxStfGrid* m_table; wxCheckBox *pZeroIndex, *pShowSelected, *pShowSecond, *pShowAll; std::size_t sizemax; wxAuiNotebook* CreateNotebook(); wxPanel* CreateTraceCounter(); wxPanel* CreateChannelCounter(); wxStfGrid* CreateTable(); void OnMenuHighlight(wxMenuEvent& event); void OnShowselected(wxCommandEvent& event); void OnZeroIndex(wxCommandEvent& event); void OnSpinCtrlTraces(wxSpinEvent& event); void OnComboActChannel(wxCommandEvent& event); void OnComboInactChannel(wxCommandEvent& event); DECLARE_EVENT_TABLE() }; /*@}*/ #endif stimfit-0.16.0/src/stimfit/gui/table.h0000775000175000017500000000501213277303516014502 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file table.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfTable. Derived from wxGridTableBase. */ #ifndef _TABLE_H #define _TABLE_H #include "../stf.h" /*! \addtogroup wxstf * @{ */ //! Adapts stfnum::Table to be used by wxStfGrid class wxStfTable : public wxGridTableBase { public: //! Constructor /*! \param table_ The associated stfnum::Table */ wxStfTable(const stfnum::Table& table_) : table(table_) {} //! Get the number of rows. /*! \return The number of rows. */ virtual int GetNumberRows() {return (int)table.nRows()+1;} //! Get the number of columns. /*! \return The number of columns. */ virtual int GetNumberCols() {return (int)table.nCols()+1;} //! Check whether a cell is empty. /*! \param row The row number of the cell. * \param col The column number of the cell. * \return true if the cell is empty, false otherwise. */ virtual bool IsEmptyCell(int row,int col); //! Retrieve a cell entry. /*! \param row The row number of the cell. * \param col The column number of the cell. * \return The cell entry as a string. */ virtual wxString GetValue( int row, int col ); //! Set a cell entry. /*! \param row The row number of the cell. * \param col The column number of the cell. * \param value The new cell entry. */ virtual void SetValue( int row, int col, const wxString& value ); //! Retrieve values from selected cells. /*! \param selection The selected cells. * \return The selection as a single string. */ wxString GetSelection(const wxGridCellCoordsArray& selection); private: stfnum::Table table; }; /*@}*/ #endif stimfit-0.16.0/src/stimfit/gui/view.h0000775000175000017500000000673013277303516014375 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file view.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares wxStfView. */ #ifndef _VIEW_H #define _VIEW_H /*! \addtogroup wxstf * @{ */ #include class wxStfDoc; class wxStfGraph; //! The view class, derived from wxView. /*! It is used to model the viewing and editing component of the file-based data. * It is part of the document/view framework supported by wxWidgets. Note that * this class does almost nothing in stimfit. Its only purpose is to adhere to * the doc/view paradigm. All of the actual drawing happens in wxStfGraph. */ class wxStfView : public wxView { public: //! Constructor wxStfView(); //! Destructor ~wxStfView() {} //! Override default view creation /*! Creates a child frame and a graph, sets the window title. * \param doc Pointer to the attached document. * \param flags View creation flags. * \return true upon successful view creation, false otherwise. */ virtual bool OnCreate(wxDocument *doc, long flags); //! The drawing function (note that actual drawing happens in wxStfGraph::OnDraw()) /*! \param dc Pointer to the device context. * \sa wxStfGraph::OnDraw() */ virtual void OnDraw(wxDC *dc); //! Override default updating behaviour /*! Called when the graph should be refreshed. * \param sender Pointer to the view that requested the update. * \param hint Unused. */ virtual void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL); //! Override default file closing behaviour /*! \param deleteWindow true if the child frame should be deleted. * \return true if file closing was successful. */ virtual bool OnClose(bool deleteWindow = true); //! Retrieve the attached graph /*! \return A pointer to the attached graph. */ wxStfGraph* GetGraph() { return graph; } //! Retrieve the attached document /*! \return A pointer to the attached document. */ wxStfDoc* Doc(); //! Retrieve the attached document /*! \return A pointer to the attached document. */ wxStfDoc* DocC() const; protected: //! Called when the view is activated; dialogs and menus are then updated. /*! \param activate true if this view is being activated. * \param activeView Pointer to the view that is now active. * \param deactiveView Pointer to the view that has just been deactivated. */ virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView); private: DECLARE_DYNAMIC_CLASS(wxStfView) DECLARE_EVENT_TABLE() wxStfGraph *graph; wxStfChildFrame *childFrame; }; /*@}*/ #endif stimfit-0.16.0/src/stimfit/gui/copygrid.cpp0000775000175000017500000003332613277303516015577 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // copygrid.cpp // Derived from wxGrid to allow copying to clipboard // 2007-12-27, Christoph Schmidt-Hieber, University of Freiburg #include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "wx/grid.h" #include "wx/clipbrd.h" #include "./app.h" #include "./doc.h" #include "./parentframe.h" #include "./childframe.h" #include "./view.h" #include "./graph.h" #include "./copygrid.h" IMPLEMENT_CLASS(wxStfGrid, wxGrid) BEGIN_EVENT_TABLE(wxStfGrid, wxGrid) EVT_MENU(ID_COPYINTABLE,wxStfGrid::Copy) EVT_MENU(ID_VIEW_MEASURE,wxStfGrid::ViewCrosshair) EVT_MENU(ID_VIEW_BASELINE,wxStfGrid::ViewBaseline) EVT_MENU(ID_VIEW_BASESD,wxStfGrid::ViewBaseSD) EVT_MENU(ID_VIEW_THRESHOLD,wxStfGrid::ViewThreshold) EVT_MENU(ID_VIEW_PEAKZERO,wxStfGrid::ViewPeakzero) EVT_MENU(ID_VIEW_PEAKBASE,wxStfGrid::ViewPeakbase) EVT_MENU(ID_VIEW_PEAKTHRESHOLD,wxStfGrid::ViewPeakthreshold) EVT_MENU(ID_VIEW_RTLOHI,wxStfGrid::ViewRTLoHi) EVT_MENU(ID_VIEW_INNERRISETIME,wxStfGrid::ViewInnerRiseTime) EVT_MENU(ID_VIEW_OUTERRISETIME,wxStfGrid::ViewOuterRiseTime) EVT_MENU(ID_VIEW_T50,wxStfGrid::ViewT50) EVT_MENU(ID_VIEW_RD,wxStfGrid::ViewRD) EVT_MENU(ID_VIEW_SLOPERISE,wxStfGrid::ViewSloperise) EVT_MENU(ID_VIEW_SLOPEDECAY,wxStfGrid::ViewSlopedecay) EVT_MENU(ID_VIEW_LATENCY,wxStfGrid::ViewLatency) #ifdef WITH_PSLOPE EVT_MENU(ID_VIEW_PSLOPE,wxStfGrid::ViewPSlope) #endif EVT_MENU(ID_VIEW_CURSORS,wxStfGrid::ViewCursors) EVT_GRID_CELL_RIGHT_CLICK(wxStfGrid::OnRClick) EVT_GRID_LABEL_RIGHT_CLICK(wxStfGrid::OnLabelRClick) EVT_KEY_DOWN( wxStfGrid::OnKeyDown ) END_EVENT_TABLE() wxStfGrid::wxStfGrid( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxGrid(parent,id,pos,size,style,name), selection(wxT("")) { m_context.reset(new wxMenu()); m_context->Append(ID_COPYINTABLE, wxT("Copy selection")); m_labelContext.reset(new wxMenu()); m_labelContext->AppendCheckItem(ID_VIEW_MEASURE,wxT("Crosshair")); m_labelContext->AppendCheckItem(ID_VIEW_BASELINE,wxT("Baseline")); m_labelContext->AppendCheckItem(ID_VIEW_BASESD,wxT("Base SD")); m_labelContext->AppendCheckItem(ID_VIEW_THRESHOLD,wxT("Threshold")); m_labelContext->AppendCheckItem(ID_VIEW_PEAKZERO,wxT("Peak (from 0)")); m_labelContext->AppendCheckItem(ID_VIEW_PEAKBASE,wxT("Peak (from base)")); m_labelContext->AppendCheckItem(ID_VIEW_PEAKTHRESHOLD,wxT("Peak (from threshold)")); m_labelContext->AppendCheckItem(ID_VIEW_RTLOHI,wxT("RT (Lo-Hi%)")); m_labelContext->AppendCheckItem(ID_VIEW_INNERRISETIME,wxT("inner Rise Time (experimental)")); m_labelContext->AppendCheckItem(ID_VIEW_OUTERRISETIME,wxT("outer Rise Time (experimental)")); m_labelContext->AppendCheckItem(ID_VIEW_T50,wxT("t50")); m_labelContext->AppendCheckItem(ID_VIEW_RD,wxT("Rise/Decay")); m_labelContext->AppendCheckItem(ID_VIEW_SLOPERISE,wxT("Slope (rise)")); m_labelContext->AppendCheckItem(ID_VIEW_SLOPEDECAY,wxT("Slope (decay)")); m_labelContext->AppendCheckItem(ID_VIEW_LATENCY,wxT("Latency")); #ifdef WITH_PSLOPE m_labelContext->AppendCheckItem(ID_VIEW_PSLOPE,wxT("PSlope")); #endif m_labelContext->AppendSeparator(); m_labelContext->AppendCheckItem(ID_VIEW_CURSORS,wxT("Cursors")); } void wxStfGrid::Copy(wxCommandEvent& WXUNUSED(event)) { if (!IsSelection()) { wxGetApp().ErrorMsg( wxT("Select cells first") ); return; } // Write some text to the clipboard // These data objects are held by the clipboard, // so do not delete them in the app. selection.Clear(); bool newline=true; for (int nRow=0;nRowOpen()) { wxTheClipboard->SetData( new wxTextDataObject(selection) ); wxTheClipboard->Close(); } } void wxStfGrid::OnRClick(wxGridEvent& event) { event.Skip(); PopupMenu(m_context.get()); } void wxStfGrid::OnLabelRClick(wxGridEvent& event) { event.Skip(); // Update checkmarks: m_labelContext->Check(ID_VIEW_MEASURE,wxGetApp().GetActiveDoc()->GetViewCrosshair()); m_labelContext->Check(ID_VIEW_BASELINE,wxGetApp().GetActiveDoc()->GetViewBaseline()); m_labelContext->Check(ID_VIEW_BASESD,wxGetApp().GetActiveDoc()->GetViewBaseSD()); m_labelContext->Check(ID_VIEW_THRESHOLD,wxGetApp().GetActiveDoc()->GetViewThreshold()); m_labelContext->Check(ID_VIEW_PEAKZERO,wxGetApp().GetActiveDoc()->GetViewPeakZero()); m_labelContext->Check(ID_VIEW_PEAKBASE,wxGetApp().GetActiveDoc()->GetViewPeakBase()); m_labelContext->Check(ID_VIEW_PEAKTHRESHOLD,wxGetApp().GetActiveDoc()->GetViewPeakThreshold()); m_labelContext->Check(ID_VIEW_RTLOHI,wxGetApp().GetActiveDoc()->GetViewRTLoHi()); m_labelContext->Check(ID_VIEW_INNERRISETIME,wxGetApp().GetActiveDoc()->GetViewInnerRiseTime()); m_labelContext->Check(ID_VIEW_OUTERRISETIME,wxGetApp().GetActiveDoc()->GetViewOuterRiseTime()); m_labelContext->Check(ID_VIEW_T50,wxGetApp().GetActiveDoc()->GetViewT50()); m_labelContext->Check(ID_VIEW_RD,wxGetApp().GetActiveDoc()->GetViewRD()); m_labelContext->Check(ID_VIEW_SLOPERISE,wxGetApp().GetActiveDoc()->GetViewSlopeRise()); m_labelContext->Check(ID_VIEW_SLOPEDECAY,wxGetApp().GetActiveDoc()->GetViewSlopeDecay()); m_labelContext->Check(ID_VIEW_LATENCY,wxGetApp().GetActiveDoc()->GetViewLatency()); #ifdef WITH_PSLOPE m_labelContext->Check(ID_VIEW_PSLOPE,wxGetApp().GetActiveDoc()->GetViewPSlope()); #endif m_labelContext->Check(ID_VIEW_CURSORS,wxGetApp().GetActiveDoc()->GetViewCursors()); PopupMenu(m_labelContext.get()); } void wxStfGrid::OnKeyDown(wxKeyEvent& event) { // Handle CTRL + 'c' //event.Skip(); switch (event.GetKeyCode()) { case 67: case 99: { if (event.ControlDown()) { wxCommandEvent dEvent; Copy(dEvent); } break; } default: // pipe everything else to the graph if (wxGetApp().GetActiveView()!=NULL && wxGetApp().GetActiveView()->GetGraph()!=NULL) wxGetApp().GetActiveView()->GetGraph()->OnKeyDown(event); } } void wxStfGrid::ViewResults() { // Update checkmarks: m_labelContext->Check(ID_VIEW_MEASURE,wxGetApp().GetActiveDoc()->GetViewCrosshair()); m_labelContext->Check(ID_VIEW_BASELINE,wxGetApp().GetActiveDoc()->GetViewBaseline()); m_labelContext->Check(ID_VIEW_BASESD,wxGetApp().GetActiveDoc()->GetViewBaseSD()); m_labelContext->Check(ID_VIEW_THRESHOLD,wxGetApp().GetActiveDoc()->GetViewThreshold()); m_labelContext->Check(ID_VIEW_PEAKZERO,wxGetApp().GetActiveDoc()->GetViewPeakZero()); m_labelContext->Check(ID_VIEW_PEAKBASE,wxGetApp().GetActiveDoc()->GetViewPeakBase()); m_labelContext->Check(ID_VIEW_PEAKTHRESHOLD,wxGetApp().GetActiveDoc()->GetViewPeakThreshold()); m_labelContext->Check(ID_VIEW_RTLOHI,wxGetApp().GetActiveDoc()->GetViewRTLoHi()); m_labelContext->Check(ID_VIEW_INNERRISETIME,wxGetApp().GetActiveDoc()->GetViewInnerRiseTime()); m_labelContext->Check(ID_VIEW_OUTERRISETIME,wxGetApp().GetActiveDoc()->GetViewOuterRiseTime()); m_labelContext->Check(ID_VIEW_T50,wxGetApp().GetActiveDoc()->GetViewT50()); m_labelContext->Check(ID_VIEW_RD,wxGetApp().GetActiveDoc()->GetViewRD()); m_labelContext->Check(ID_VIEW_SLOPERISE,wxGetApp().GetActiveDoc()->GetViewSlopeRise()); m_labelContext->Check(ID_VIEW_SLOPEDECAY,wxGetApp().GetActiveDoc()->GetViewSlopeDecay()); m_labelContext->Check(ID_VIEW_LATENCY,wxGetApp().GetActiveDoc()->GetViewLatency()); #ifdef WITH_PSLOPE m_labelContext->Check(ID_VIEW_PSLOPE,wxGetApp().GetActiveDoc()->GetViewPSlope()); #endif m_labelContext->Check(ID_VIEW_CURSORS,wxGetApp().GetActiveDoc()->GetViewCursors()); PopupMenu(m_labelContext.get()); } void wxStfGrid::ViewCrosshair(wxCommandEvent& event) { event.Skip(); // Toggle on or off: wxGetApp().GetActiveDoc()->SetViewCrosshair(m_labelContext->IsChecked(ID_VIEW_MEASURE)); SetCheckmark(wxT("ViewCrosshair"),ID_VIEW_MEASURE); } void wxStfGrid::ViewBaseline(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewBaseline(m_labelContext->IsChecked(ID_VIEW_BASELINE)); SetCheckmark(wxT("ViewBaseline"),ID_VIEW_BASELINE); } void wxStfGrid::ViewBaseSD(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewBaseSD(m_labelContext->IsChecked(ID_VIEW_BASESD)); SetCheckmark(wxT("ViewBaseSD"),ID_VIEW_BASESD); } void wxStfGrid::ViewThreshold(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewThreshold(m_labelContext->IsChecked(ID_VIEW_THRESHOLD)); SetCheckmark(wxT("ViewThreshold"),ID_VIEW_THRESHOLD); } void wxStfGrid::ViewPeakzero(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewPeakZero(m_labelContext->IsChecked(ID_VIEW_PEAKZERO)); SetCheckmark(wxT("ViewPeakzero"),ID_VIEW_PEAKZERO); } void wxStfGrid::ViewPeakbase(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewPeakBase(m_labelContext->IsChecked(ID_VIEW_PEAKBASE)); SetCheckmark(wxT("ViewPeakbase"),ID_VIEW_PEAKBASE); } void wxStfGrid::ViewPeakthreshold(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewPeakThreshold(m_labelContext->IsChecked(ID_VIEW_PEAKTHRESHOLD)); SetCheckmark(wxT("ViewPeakthreshold"),ID_VIEW_PEAKTHRESHOLD); } void wxStfGrid::ViewRTLoHi(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewRTLoHi(m_labelContext->IsChecked(ID_VIEW_RTLOHI)); SetCheckmark(wxT("ViewRTLoHi"),ID_VIEW_RTLOHI); } void wxStfGrid::ViewInnerRiseTime(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewInnerRiseTime(m_labelContext->IsChecked(ID_VIEW_INNERRISETIME)); SetCheckmark(wxT("ViewInnerRiseTime"),ID_VIEW_INNERRISETIME); } void wxStfGrid::ViewOuterRiseTime(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewOuterRiseTime(m_labelContext->IsChecked(ID_VIEW_OUTERRISETIME)); SetCheckmark(wxT("ViewOuterRiseTime"),ID_VIEW_OUTERRISETIME); } void wxStfGrid::ViewT50(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewT50(m_labelContext->IsChecked(ID_VIEW_T50)); SetCheckmark(wxT("ViewT50"),ID_VIEW_T50); } void wxStfGrid::ViewRD(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewRD(m_labelContext->IsChecked(ID_VIEW_RD)); SetCheckmark(wxT("ViewRD"),ID_VIEW_RD); } void wxStfGrid::ViewSloperise(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewSlopeRise(m_labelContext->IsChecked(ID_VIEW_SLOPERISE)); SetCheckmark(wxT("ViewSloperise"),ID_VIEW_SLOPERISE); } void wxStfGrid::ViewSlopedecay(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewSlopeDecay(m_labelContext->IsChecked(ID_VIEW_SLOPEDECAY)); SetCheckmark(wxT("ViewSlopedecay"),ID_VIEW_SLOPEDECAY); } void wxStfGrid::ViewLatency(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewLatency(m_labelContext->IsChecked(ID_VIEW_LATENCY)); SetCheckmark(wxT("ViewLatency"),ID_VIEW_LATENCY); } #ifdef WITH_PSLOPE void wxStfGrid::ViewPSlope(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewPSlope(m_labelContext->IsChecked(ID_VIEW_PSLOPE)); SetCheckmark(wxT("ViewPSlope"),ID_VIEW_PSLOPE); } #endif void wxStfGrid::ViewCursors(wxCommandEvent& event) { event.Skip(); wxGetApp().GetActiveDoc()->SetViewCursors(m_labelContext->IsChecked(ID_VIEW_CURSORS)); SetCheckmark(wxT("ViewCursors"),ID_VIEW_CURSORS); } void wxStfGrid::SetCheckmark(const wxString& RegEntry, int id) { // Toggle on or off: if (m_labelContext->IsChecked(id)) { wxGetApp().wxWriteProfileInt(wxT("Settings"),RegEntry,1); } else { wxGetApp().wxWriteProfileInt(wxT("Settings"),RegEntry,0); } // Update table: wxStfChildFrame* pChild=(wxStfChildFrame*)GetMainFrame()->GetActiveChild(); pChild->UpdateResults(); } stimfit-0.16.0/src/stimfit/Makefile.am0000775000175000017500000000200513567226230014510 00000000000000pkglib_LTLIBRARIES = libstimfit.la libstimfit_la_SOURCES = ./stf.cpp \ ./gui/app.cpp ./gui/unopt.cpp ./gui/doc.cpp ./gui/copygrid.cpp ./gui/graph.cpp \ ./gui/printout.cpp ./gui/parentframe.cpp ./gui/childframe.cpp ./gui/view.cpp ./gui/table.cpp ./gui/zoom.cpp \ ./gui/dlgs/convertdlg.cpp ./gui/dlgs/cursorsdlg.cpp ./gui/dlgs/eventdlg.cpp \ ./gui/dlgs/fitseldlg.cpp ./gui/dlgs/smalldlgs.cpp \ ./gui/usrdlg/usrdlg.cpp libstimfit_la_CPPFLAGS = libstimfit_la_CXXFLAGS = $(OPT_CXXFLAGS) $(WX_CXXFLAGS) libstimfit_la_LDFLAGS = $(LIBPYTHON_LDFLAGS) $(LIBSTF_LDFLAGS) libstimfit_la_LIBADD = $(WX_LIBS) ../libstfio/libstfio.la ../libstfnum/libstfnum.la if WITH_BIOSIGLITE libstimfit_la_LIBADD += ../libbiosiglite/libbiosiglite.la endif # the application source, library search path, and link libraries if BUILD_PYTHON PYTHON_ADDINCLUDES = $(LIBNUMPY_INCLUDES) $(LIBPYTHON_INCLUDES) $(LIBWXPYTHON_INCLUDES) else PYTHON_ADDINCLUDES = endif INCLUDES = $(PYTHON_ADDINCLUDES) stimfit-0.16.0/src/stimfit/Makefile.in0000664000175000017500000013114213567226345014532 00000000000000# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2017 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @WITH_BIOSIGLITE_TRUE@am__append_1 = ../libbiosiglite/libbiosiglite.la subdir = src/stimfit ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acsite.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/stfconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = libstimfit_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ ../libstfio/libstfio.la ../libstfnum/libstfnum.la \ $(am__append_1) am_libstimfit_la_OBJECTS = libstimfit_la-stf.lo libstimfit_la-app.lo \ libstimfit_la-unopt.lo libstimfit_la-doc.lo \ libstimfit_la-copygrid.lo libstimfit_la-graph.lo \ libstimfit_la-printout.lo libstimfit_la-parentframe.lo \ libstimfit_la-childframe.lo libstimfit_la-view.lo \ libstimfit_la-table.lo libstimfit_la-zoom.lo \ libstimfit_la-convertdlg.lo libstimfit_la-cursorsdlg.lo \ libstimfit_la-eventdlg.lo libstimfit_la-fitseldlg.lo \ libstimfit_la-smalldlgs.lo libstimfit_la-usrdlg.lo libstimfit_la_OBJECTS = $(am_libstimfit_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libstimfit_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) $(libstimfit_la_LDFLAGS) \ $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(libstimfit_la_SOURCES) DIST_SOURCES = $(libstimfit_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ GT_CPPFLAGS = @GT_CPPFLAGS@ GT_CXXFLAGS = @GT_CXXFLAGS@ GT_LDFLAGS = @GT_LDFLAGS@ GT_LIBS = @GT_LIBS@ HDF5_CFLAGS = @HDF5_CFLAGS@ HDF5_LIBS = @HDF5_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBIOSIG_LDFLAGS = @LIBBIOSIG_LDFLAGS@ LIBHDF5_LDFLAGS = @LIBHDF5_LDFLAGS@ LIBLAPACK_LDFLAGS = @LIBLAPACK_LDFLAGS@ LIBNUMPY_INCLUDES = @LIBNUMPY_INCLUDES@ LIBOBJS = @LIBOBJS@ LIBPYTHON_INCLUDES = @LIBPYTHON_INCLUDES@ LIBPYTHON_LDFLAGS = @LIBPYTHON_LDFLAGS@ LIBS = @LIBS@ LIBSTF_LDFLAGS = @LIBSTF_LDFLAGS@ LIBTOOL = @LIBTOOL@ LIBWXPYTHON_INCLUDES = @LIBWXPYTHON_INCLUDES@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MACSETFILE = @MACSETFILE@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OPT_CXXFLAGS = @OPT_CXXFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSTLINK_COMMAND = @POSTLINK_COMMAND@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_DIST_PKG = @PYTHON_DIST_PKG@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_NUMPY_INCLUDE = @PYTHON_NUMPY_INCLUDE@ PYTHON_PRE_DIST_PKG = @PYTHON_PRE_DIST_PKG@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ PYTHON_WXPYTHON_INCLUDE = @PYTHON_WXPYTHON_INCLUDE@ PY_AC_VERSION = @PY_AC_VERSION@ RANLIB = @RANLIB@ REZ = @REZ@ SED = @SED@ SETFILE = @SETFILE@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STFIO_PYTHON_LIBNAME = @STFIO_PYTHON_LIBNAME@ STF_PYTHON_LIBNAME = @STF_PYTHON_LIBNAME@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@ SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ VERSION = @VERSION@ WX_CPPFLAGS = @WX_CPPFLAGS@ WX_CXXFLAGS = @WX_CXXFLAGS@ WX_LIBS = @WX_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = libstimfit.la libstimfit_la_SOURCES = ./stf.cpp \ ./gui/app.cpp ./gui/unopt.cpp ./gui/doc.cpp ./gui/copygrid.cpp ./gui/graph.cpp \ ./gui/printout.cpp ./gui/parentframe.cpp ./gui/childframe.cpp ./gui/view.cpp ./gui/table.cpp ./gui/zoom.cpp \ ./gui/dlgs/convertdlg.cpp ./gui/dlgs/cursorsdlg.cpp ./gui/dlgs/eventdlg.cpp \ ./gui/dlgs/fitseldlg.cpp ./gui/dlgs/smalldlgs.cpp \ ./gui/usrdlg/usrdlg.cpp libstimfit_la_CPPFLAGS = libstimfit_la_CXXFLAGS = $(OPT_CXXFLAGS) $(WX_CXXFLAGS) libstimfit_la_LDFLAGS = $(LIBPYTHON_LDFLAGS) $(LIBSTF_LDFLAGS) libstimfit_la_LIBADD = $(WX_LIBS) ../libstfio/libstfio.la \ ../libstfnum/libstfnum.la $(am__append_1) @BUILD_PYTHON_FALSE@PYTHON_ADDINCLUDES = # the application source, library search path, and link libraries @BUILD_PYTHON_TRUE@PYTHON_ADDINCLUDES = $(LIBNUMPY_INCLUDES) $(LIBPYTHON_INCLUDES) $(LIBWXPYTHON_INCLUDES) INCLUDES = $(PYTHON_ADDINCLUDES) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/stimfit/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/stimfit/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libstimfit.la: $(libstimfit_la_OBJECTS) $(libstimfit_la_DEPENDENCIES) $(EXTRA_libstimfit_la_DEPENDENCIES) $(AM_V_CXXLD)$(libstimfit_la_LINK) -rpath $(pkglibdir) $(libstimfit_la_OBJECTS) $(libstimfit_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-app.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-childframe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-convertdlg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-copygrid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-cursorsdlg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-doc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-eventdlg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-fitseldlg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-graph.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-parentframe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-printout.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-smalldlgs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-stf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-table.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-unopt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-usrdlg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-view.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstimfit_la-zoom.Plo@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< libstimfit_la-stf.lo: ./stf.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-stf.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-stf.Tpo -c -o libstimfit_la-stf.lo `test -f './stf.cpp' || echo '$(srcdir)/'`./stf.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-stf.Tpo $(DEPDIR)/libstimfit_la-stf.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./stf.cpp' object='libstimfit_la-stf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-stf.lo `test -f './stf.cpp' || echo '$(srcdir)/'`./stf.cpp libstimfit_la-app.lo: ./gui/app.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-app.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-app.Tpo -c -o libstimfit_la-app.lo `test -f './gui/app.cpp' || echo '$(srcdir)/'`./gui/app.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-app.Tpo $(DEPDIR)/libstimfit_la-app.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/app.cpp' object='libstimfit_la-app.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-app.lo `test -f './gui/app.cpp' || echo '$(srcdir)/'`./gui/app.cpp libstimfit_la-unopt.lo: ./gui/unopt.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-unopt.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-unopt.Tpo -c -o libstimfit_la-unopt.lo `test -f './gui/unopt.cpp' || echo '$(srcdir)/'`./gui/unopt.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-unopt.Tpo $(DEPDIR)/libstimfit_la-unopt.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/unopt.cpp' object='libstimfit_la-unopt.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-unopt.lo `test -f './gui/unopt.cpp' || echo '$(srcdir)/'`./gui/unopt.cpp libstimfit_la-doc.lo: ./gui/doc.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-doc.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-doc.Tpo -c -o libstimfit_la-doc.lo `test -f './gui/doc.cpp' || echo '$(srcdir)/'`./gui/doc.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-doc.Tpo $(DEPDIR)/libstimfit_la-doc.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/doc.cpp' object='libstimfit_la-doc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-doc.lo `test -f './gui/doc.cpp' || echo '$(srcdir)/'`./gui/doc.cpp libstimfit_la-copygrid.lo: ./gui/copygrid.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-copygrid.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-copygrid.Tpo -c -o libstimfit_la-copygrid.lo `test -f './gui/copygrid.cpp' || echo '$(srcdir)/'`./gui/copygrid.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-copygrid.Tpo $(DEPDIR)/libstimfit_la-copygrid.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/copygrid.cpp' object='libstimfit_la-copygrid.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-copygrid.lo `test -f './gui/copygrid.cpp' || echo '$(srcdir)/'`./gui/copygrid.cpp libstimfit_la-graph.lo: ./gui/graph.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-graph.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-graph.Tpo -c -o libstimfit_la-graph.lo `test -f './gui/graph.cpp' || echo '$(srcdir)/'`./gui/graph.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-graph.Tpo $(DEPDIR)/libstimfit_la-graph.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/graph.cpp' object='libstimfit_la-graph.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-graph.lo `test -f './gui/graph.cpp' || echo '$(srcdir)/'`./gui/graph.cpp libstimfit_la-printout.lo: ./gui/printout.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-printout.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-printout.Tpo -c -o libstimfit_la-printout.lo `test -f './gui/printout.cpp' || echo '$(srcdir)/'`./gui/printout.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-printout.Tpo $(DEPDIR)/libstimfit_la-printout.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/printout.cpp' object='libstimfit_la-printout.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-printout.lo `test -f './gui/printout.cpp' || echo '$(srcdir)/'`./gui/printout.cpp libstimfit_la-parentframe.lo: ./gui/parentframe.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-parentframe.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-parentframe.Tpo -c -o libstimfit_la-parentframe.lo `test -f './gui/parentframe.cpp' || echo '$(srcdir)/'`./gui/parentframe.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-parentframe.Tpo $(DEPDIR)/libstimfit_la-parentframe.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/parentframe.cpp' object='libstimfit_la-parentframe.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-parentframe.lo `test -f './gui/parentframe.cpp' || echo '$(srcdir)/'`./gui/parentframe.cpp libstimfit_la-childframe.lo: ./gui/childframe.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-childframe.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-childframe.Tpo -c -o libstimfit_la-childframe.lo `test -f './gui/childframe.cpp' || echo '$(srcdir)/'`./gui/childframe.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-childframe.Tpo $(DEPDIR)/libstimfit_la-childframe.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/childframe.cpp' object='libstimfit_la-childframe.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-childframe.lo `test -f './gui/childframe.cpp' || echo '$(srcdir)/'`./gui/childframe.cpp libstimfit_la-view.lo: ./gui/view.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-view.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-view.Tpo -c -o libstimfit_la-view.lo `test -f './gui/view.cpp' || echo '$(srcdir)/'`./gui/view.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-view.Tpo $(DEPDIR)/libstimfit_la-view.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/view.cpp' object='libstimfit_la-view.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-view.lo `test -f './gui/view.cpp' || echo '$(srcdir)/'`./gui/view.cpp libstimfit_la-table.lo: ./gui/table.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-table.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-table.Tpo -c -o libstimfit_la-table.lo `test -f './gui/table.cpp' || echo '$(srcdir)/'`./gui/table.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-table.Tpo $(DEPDIR)/libstimfit_la-table.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/table.cpp' object='libstimfit_la-table.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-table.lo `test -f './gui/table.cpp' || echo '$(srcdir)/'`./gui/table.cpp libstimfit_la-zoom.lo: ./gui/zoom.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-zoom.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-zoom.Tpo -c -o libstimfit_la-zoom.lo `test -f './gui/zoom.cpp' || echo '$(srcdir)/'`./gui/zoom.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-zoom.Tpo $(DEPDIR)/libstimfit_la-zoom.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/zoom.cpp' object='libstimfit_la-zoom.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-zoom.lo `test -f './gui/zoom.cpp' || echo '$(srcdir)/'`./gui/zoom.cpp libstimfit_la-convertdlg.lo: ./gui/dlgs/convertdlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-convertdlg.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-convertdlg.Tpo -c -o libstimfit_la-convertdlg.lo `test -f './gui/dlgs/convertdlg.cpp' || echo '$(srcdir)/'`./gui/dlgs/convertdlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-convertdlg.Tpo $(DEPDIR)/libstimfit_la-convertdlg.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/dlgs/convertdlg.cpp' object='libstimfit_la-convertdlg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-convertdlg.lo `test -f './gui/dlgs/convertdlg.cpp' || echo '$(srcdir)/'`./gui/dlgs/convertdlg.cpp libstimfit_la-cursorsdlg.lo: ./gui/dlgs/cursorsdlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-cursorsdlg.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-cursorsdlg.Tpo -c -o libstimfit_la-cursorsdlg.lo `test -f './gui/dlgs/cursorsdlg.cpp' || echo '$(srcdir)/'`./gui/dlgs/cursorsdlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-cursorsdlg.Tpo $(DEPDIR)/libstimfit_la-cursorsdlg.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/dlgs/cursorsdlg.cpp' object='libstimfit_la-cursorsdlg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-cursorsdlg.lo `test -f './gui/dlgs/cursorsdlg.cpp' || echo '$(srcdir)/'`./gui/dlgs/cursorsdlg.cpp libstimfit_la-eventdlg.lo: ./gui/dlgs/eventdlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-eventdlg.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-eventdlg.Tpo -c -o libstimfit_la-eventdlg.lo `test -f './gui/dlgs/eventdlg.cpp' || echo '$(srcdir)/'`./gui/dlgs/eventdlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-eventdlg.Tpo $(DEPDIR)/libstimfit_la-eventdlg.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/dlgs/eventdlg.cpp' object='libstimfit_la-eventdlg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-eventdlg.lo `test -f './gui/dlgs/eventdlg.cpp' || echo '$(srcdir)/'`./gui/dlgs/eventdlg.cpp libstimfit_la-fitseldlg.lo: ./gui/dlgs/fitseldlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-fitseldlg.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-fitseldlg.Tpo -c -o libstimfit_la-fitseldlg.lo `test -f './gui/dlgs/fitseldlg.cpp' || echo '$(srcdir)/'`./gui/dlgs/fitseldlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-fitseldlg.Tpo $(DEPDIR)/libstimfit_la-fitseldlg.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/dlgs/fitseldlg.cpp' object='libstimfit_la-fitseldlg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-fitseldlg.lo `test -f './gui/dlgs/fitseldlg.cpp' || echo '$(srcdir)/'`./gui/dlgs/fitseldlg.cpp libstimfit_la-smalldlgs.lo: ./gui/dlgs/smalldlgs.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-smalldlgs.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-smalldlgs.Tpo -c -o libstimfit_la-smalldlgs.lo `test -f './gui/dlgs/smalldlgs.cpp' || echo '$(srcdir)/'`./gui/dlgs/smalldlgs.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-smalldlgs.Tpo $(DEPDIR)/libstimfit_la-smalldlgs.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/dlgs/smalldlgs.cpp' object='libstimfit_la-smalldlgs.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-smalldlgs.lo `test -f './gui/dlgs/smalldlgs.cpp' || echo '$(srcdir)/'`./gui/dlgs/smalldlgs.cpp libstimfit_la-usrdlg.lo: ./gui/usrdlg/usrdlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -MT libstimfit_la-usrdlg.lo -MD -MP -MF $(DEPDIR)/libstimfit_la-usrdlg.Tpo -c -o libstimfit_la-usrdlg.lo `test -f './gui/usrdlg/usrdlg.cpp' || echo '$(srcdir)/'`./gui/usrdlg/usrdlg.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstimfit_la-usrdlg.Tpo $(DEPDIR)/libstimfit_la-usrdlg.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='./gui/usrdlg/usrdlg.cpp' object='libstimfit_la-usrdlg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstimfit_la_CPPFLAGS) $(CPPFLAGS) $(libstimfit_la_CXXFLAGS) $(CXXFLAGS) -c -o libstimfit_la-usrdlg.lo `test -f './gui/usrdlg/usrdlg.cpp' || echo '$(srcdir)/'`./gui/usrdlg/usrdlg.cpp mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-pkglibLTLIBRARIES install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-pkglibLTLIBRARIES .PRECIOUS: Makefile # 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: stimfit-0.16.0/src/stimfit/stf.h0000664000175000017500000004275713567226230013440 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file stimdefs.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Common definitions and classes. * * * Header file for common definitions and classes. */ #ifndef _STF_H_ #define _STF_H_ #ifndef _WINDOWS #if (__cplusplus < 201103) #include #else #include #include #endif #endif #if (__GNUC__ > 5) #include #endif #include #include #include #include "./gui/zoom.h" #ifdef _MSC_VER #pragma warning( disable : 4251 ) // Disable warning messages #pragma warning( disable : 4996 ) // Disable warning messages #endif //! Defines dll export or import functions for Windows #if defined(_WINDOWS) && !defined(__MINGW32__) #ifdef STFDLL #define StfDll __declspec( dllexport ) #else #define StfDll __declspec( dllimport ) #endif #else #define StfDll #endif #ifndef MODULE_ONLY #include #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include #endif #include #include #else typedef std::string wxString; typedef int wxWindow; #define wxT(x) x #define wxCHECK_VERSION(major,minor,release) 0 #endif #include "../libstfio/stfio.h" #include "../libstfnum/stfnum.h" //! The stimfit namespace. /*! All essential core functions and classes are in this namespace. * Its purpose is to reduce name mangling problems. */ namespace stf { /*! \addtogroup stfgen * @{ */ //! Progress Info interface adapter; maps to wxProgressDialog class wxProgressInfo : public stfio::ProgressInfo { public: wxProgressInfo(const std::string& title, const std::string& message, int maximum, bool verbose=true); bool Update(int value, const std::string& newmsg="", bool* skip=NULL); private: wxProgressDialog pd; }; std::string wx2std(const wxString& wxs); wxString std2wx(const std::string& sst); //! Converts a Section to a wxString. /*! \param section The Section to be written to a string. * \return A string containing the x- and y-values of the section in two columns. */ wxString sectionToString(const Section& section); //! Creates a preview of a text file. /*! \param fName Full path name of the file. * \return A string showing at most the initial 100 lines of the text file. */ wxString CreatePreview(const wxString& fName); //! Strips the directory off a full path name, returns only the filename. /*! \param fName The full path of a file. * \return The file name without the directory. */ wxString noPath(const wxString& fName); //! Get a Recording, do something with it, return the new Recording. #if (__cplusplus < 201103) typedef boost::function&)> PluginFunc; #else typedef std::function&)> PluginFunc; #endif //! Represents user input from dialogs that can be used in plugins. struct UserInput { std::vector labels; /*!< Dialog entry labels. */ Vector_double defaults; /*!< Default dialog entries. */ std::string title; /*!< Dialog title. */ //! Constructor. /*! \param labels_ A vector of dialog entry label strings. * \param defaults_ A vector of default dialog entries. * \param title_ Dialog title. */ UserInput( const std::vector& labels_=std::vector(0), const Vector_double& defaults_=Vector_double(0), std::string title_="\0" ) : labels(labels_),defaults(defaults_),title(title_) { if (defaults.size()!=labels.size()) { defaults.resize(labels.size()); std::fill(defaults.begin(), defaults.end(), 0.0); } } }; //! User-defined plugin /*! Class used for extending Stimfit's functionality: * The client supplies a new menu entry and an ExtFunc * that will be called upon selection of that entry. */ struct Plugin { //! Constructor /*! \param menuEntry_ Menu entry string for this plugin. * \param pluginFunc_ Function to be executed by this plugin. * \param input_ Dialog entries required by this plugin. */ Plugin( const wxString& menuEntry_, const PluginFunc& pluginFunc_, const UserInput& input_=UserInput() ) : menuEntry(menuEntry_),pluginFunc(pluginFunc_),input(input_) { id = n_plugins; n_plugins++; } //! Destructor ~Plugin() { } int id; /*!< The plugin id; set automatically upon construction, so don't touch. */ static int n_plugins; /*!< Static plugin counter. Initialised in plugins/plugins.cpp. */ wxString menuEntry; /*!< Menu entry string for this plugin. */ PluginFunc pluginFunc; /*!< The function to be executed by this plugin. */ UserInput input; /*!< Dialog entries */ }; //! User-defined Python extension /*! Class used for extending Stimfit's functionality: * The client supplies a new menu entry and a Python function * that will be called upon selection of that entry. */ struct Extension { //! Constructor /*! \param menuEntry_ Menu entry string for this extension. * \param pyFunc_ Python function to be called. * \param description_ Description for this function. * \param requiresFile_ Whether a file needs to be open for this function to work */ Extension(const std::string& menuEntry_, void* pyFunc_, const std::string& description_, bool requiresFile_) : menuEntry(menuEntry_), pyFunc(pyFunc_), description(description_), requiresFile(requiresFile_) { id = n_extensions; n_extensions++; } //! Destructor ~Extension() { } int id; /*!< The extension id; set automatically upon construction, so don't touch. */ static int n_extensions; /*!< Static extension counter. Initialised in extensions/extensions.cpp. */ std::string menuEntry; /*!< Menu entry string for this extension. */ void* pyFunc; /*!< Python function to be called. */ std::string description; /*!< Description for this function. */ bool requiresFile; /*!< Whether a file needs to be open for this function to work */ }; //! Resource manager for ifstream objects. struct ifstreamMan { //! Constructor /*! See fstream documentation for details */ ifstreamMan( const wxString& filename ) : myStream( filename, wxT("r") ) {} //! Destructor ~ifstreamMan() { myStream.Close(); } //! The managed stream. wxFFile myStream; }; //! Resource manager for ofstream objects. struct ofstreamMan { //! Constructor /*! See fstream documentation for details */ ofstreamMan( const wxString& filename ) : myStream( filename, wxT("w") ) {} //! Destructor ~ofstreamMan() { myStream.Close(); } //! The managed stream. wxFFile myStream; }; //! Describes the attributes of an event. class Event { public: //! Constructor explicit Event(std::size_t start, std::size_t peak, std::size_t size, wxCheckBox* cb); //! Destructor ~Event(); //! Retrieves the start index of an event. /*! \return The start index of an event within a section. */ std::size_t GetEventStartIndex() const { return eventStartIndex; } //! Retrieves the index of an event's peak. /*! \return The index of an event's peak within a section. */ std::size_t GetEventPeakIndex() const { return eventPeakIndex; } //! Retrieves the size of an event. /*! \return The size of an event in units of data points. */ std::size_t GetEventSize() const { return eventSize; } //! Indicates whether an event should be discarded. /*! \return true if it should be discarded, false otherwise. */ bool GetDiscard() const { return !checkBox->GetValue(); } //! Get the check box associated with this event /*! \return The wxCheckBox associated with this event */ wxCheckBox* GetCheckBox() {return checkBox;} //! Sets the start index of an event. /*! \param value The start index of an event within a section. */ void SetEventStartIndex( std::size_t value ) { eventStartIndex = value; } //! Sets the index of an event's peak. /*! \param value The index of an event's peak within a section. */ void SetEventPeakIndex( std::size_t value ) { eventPeakIndex = value; } //! Sets the size of an event. /*! \param value The size of an event in units of data points. */ void SetEventSize( std::size_t value ) { eventSize = value; } //! Determines whether an event should be discarded. /*! \param true if it should be discarded, false otherwise. */ /*void SetDiscard( bool value ) { discard = value; }*/ //! Sets discard to true if it was false and vice versa. /*void ToggleStatus() { discard = !discard; }*/ private: std::size_t eventStartIndex; std::size_t eventPeakIndex; std::size_t eventSize; wxCheckBox* checkBox; }; //! A marker that can be set from Python /*! A pair of x,y coordinates */ struct PyMarker { //! Constructor /*! \param xv x-coordinate. * \param yv y-coordinate. */ PyMarker( double xv, double yv ) : x(xv), y(yv) {} double x; /*!< x-coordinate in units of sampling points */ double y; /*!< y-coordinate in trace units (e.g. mV) */ }; struct StfDll SectionAttributes { SectionAttributes(); std::vector eventList; std::vector pyMarkers; bool isFitted,isIntegrated; stfnum::storedFunc *fitFunc; Vector_double bestFitP; Vector_double quad_p; std::size_t storeFitBeg; std::size_t storeFitEnd; std::size_t storeIntBeg; std::size_t storeIntEnd; stfnum::Table bestFit; }; struct SectionPointer { SectionPointer(Section* pSec=NULL, const SectionAttributes& sa=SectionAttributes()); Section* pSection; SectionAttributes sec_attr; }; //! Add decimals if you are not satisfied. const double PI=3.14159265358979323846; //! Does what it says. /*! \param toRound The double to be rounded. * \return The rounded integer. */ int round(double toRound); //! Mouse cursor types enum cursor_type { measure_cursor, /*!< Measurement cursor (crosshair). */ peak_cursor, /*!< Peak calculation limits cursor. */ base_cursor, /*!< Baseline calculation limits cursor. */ decay_cursor, /*!< Fit limits cursor. */ latency_cursor, /*!< Latency cursor. */ zoom_cursor, /*!< Zoom rectangle cursor. */ event_cursor, /*!< Event mode cursor. */ #ifdef WITH_PSLOPE pslope_cursor, /*!< PSlope mode cursor. */ #endif undefined_cursor /*!< Undefined cursor. */ }; //! Determines which channels to scale enum zoom_channels { zoomch1, /*!< Scaling applies to channel 1 only. */ zoomch2, /*!< Scaling applies to channel 2 only. */ zoomboth /*!< Scaling applies to both channels. */ }; //! Latency cursor settings enum latency_mode { manualMode = 0, /*!< Set the corresponding latency cursor manually (by clicking on the graph). */ peakMode = 1, /*!< Set the corresponding latency cursor to the peak. */ riseMode = 2, /*!< Set the corresponding latency cursor to the maximal slope of rise. */ halfMode = 3, /*!< Set the corresponding latency cursor to the half-maximal amplitude. */ footMode = 4, /*!< Set the corresponding latency cursor to the beginning of an event. */ undefinedMode /*!< undefined mode. */ }; //! Latency window settings enum latency_window_mode { defaultMode = 0, /*!< Use the current peak cursor window for the active channel. */ windowMode = 1 /*!< Use a window of 100 sampling points around the peak. */ }; #ifdef WITH_PSLOPE //! PSlope start cursor settings enum pslope_mode_beg { psBeg_manualMode =0, /*< Set the start Slope cursor manually. */ psBeg_footMode =1, /*< Set the start Slope cursor to the beginning of an event. */ psBeg_thrMode =2, /*< Set the start Slope cursor to a threshold. */ psBeg_t50Mode =3, /*< Set the start Slope cursor to the half-width of an event*/ psBeg_undefined }; //! PSlope end cursor settings enum pslope_mode_end { psEnd_manualMode =0, /*< Set the end Slope cursor manually. */ psEnd_t50Mode =1, /*< Set the Slope cursor to the half-width of an event. */ psEnd_DeltaTMode =2, /*< Set the Slope cursor to a given distance from the first cursor. */ psEnd_peakMode =3, /*< Set the Slope cursor to the peak. */ psEnd_undefined }; #endif // WITH_PSLOPE //! Deconvolution enum extraction_mode { criterion, /*!< Clements & Bekkers criterion. */ correlation, /*!< Jonas et al. correlation coefficient. */ deconvolution /*!< Pernia-Andrade et al. deconvolution. */ }; /*@}*/ } // end of namespace inline int stf::round(double toRound) { return toRound <= 0.0 ? int(toRound-0.5) : int(toRound+0.5); } typedef std::vector< wxString >::iterator wxs_it; /*!< std::string iterator */ typedef std::vector< wxString >::const_iterator c_wxs_it; /*!< constant std::string iterator */ typedef std::vector< stf::Event >::iterator event_it; /*!< stf::Event iterator */ typedef std::vector< stf::Event >::const_iterator c_event_it; /*!< constant stf::Event iterator */ typedef std::vector< stf::PyMarker >::iterator marker_it; /*!< stf::PyMarker iterator */ typedef std::vector< stf::PyMarker >::const_iterator c_marker_it; /*!< constant stf::PyMarker iterator */ // Doxygen-links to documentation of frequently used wxWidgets-classes /*! \defgroup wxwidgets wxWidgets classes * @{ */ /*! \class wxApp * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxapp.html (wxWidgets documentation) */ /*! \class wxCheckBox * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxcheckbox.html (wxWidgets documentation) */ /*! \class wxCommandEvent * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxcommandevent.html (wxWidgets documentation) */ /*! \class wxDialog * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxdialog.html (wxWidgets documentation) */ /*! \class wxDocMDIChildFrame * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxdocmdichildframe.html (wxWidgets documentation) */ /*! \class wxDocMDIParentFrame * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxdocmdiparentframe.html (wxWidgets documentation) */ /*! \class wxDocument * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxdocument.html (wxWidgets documentation) */ /*! \class wxGrid * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxgrid.html (wxWidgets documentation) */ /*! \class wxGridCellCoordsArray * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxgridcellcoordsarray.html (wxWidgets documentation) */ /*! \class wxGridTableBase * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxgridtablebase.html (wxWidgets documentation) */ /*! \class wxPoint * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxpoint.html (wxWidgets documentation) */ /*! \class wxPrintout * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxprintout.html (wxWidgets documentation) */ /*! \class wxSize * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxsize.html (wxWidgets documentation) */ /*! \class wxString * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxstring.html (wxWidgets documentation) */ /*! \class wxThread * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxthread.html (wxWidgets documentation) */ /*! \class wxView * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxview.html (wxWidgets documentation) */ /*! \class wxWindow * \brief See http://www.wxwidgets.org/manuals/stable/wx_wxwindow.html (wxWidgets documentation) */ /*@}*/ /*! \defgroup stdcpp C++ standard library classes * @{ */ /*! \namespace std * \brief The namespace of the C++ standard library (libstdc++). */ /*! \class std::map * \brief See http://www.sgi.com/tech/stl/Map.html (SGI's STL documentation) */ /*! \class std::vector * \brief See http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1valarray.html (gcc's libstdc++ documentation) */ /*! \class std::vector * \brief See http://www.sgi.com/tech/stl/Vector.html (SGI's STL documentation) */ /*@}*/ #endif stimfit-0.16.0/src/libstfio/0000775000175000017500000000000013567226445012700 500000000000000stimfit-0.16.0/src/libstfio/channel.h0000775000175000017500000001305013277303516014374 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file channel.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares the Channel class. */ #ifndef _CHANNEL_H #define _CHANNEL_H /*! \addtogroup stfgen * @{ */ #include "section.h" //! A Channel contains several data \link #Section Sections \endlink representing observations of the same physical quantity. class StfioDll Channel { public: //ctor/dtor--------------------------------------------------- //! Default constructor explicit Channel(void); //! Constructor /*! \param c_Section A single section from which to construct the channel */ explicit Channel(const Section& c_Section); //! Constructor /*! \param SectionList A vector of Sections from which to construct the channel */ explicit Channel(const std::deque
& SectionList); //! Constructor /*! Setting the number of sections at construction time will avoid unnecessary * memory re-allocations. * \param c_n_sections The number of sections. * \param section_size Initial section size. Will serve additional * re-alocations if known at construction time. */ explicit Channel(std::size_t c_n_sections, std::size_t section_size = 0); //! Destructor ~Channel(); //operators--------------------------------------------------- //! Unchecked access to a section (read and write) /*! Use at() for range-checked access. * \param at_ The section index. * \return The section at index at_. */ Section& operator[](std::size_t at_) { return SectionArray[at_]; } //! Unchecked access to a section (read-only) /*! Use at() for range-checked access. * \param at_ The section index. * \return The section at index at_. */ const Section& operator[](std::size_t at_) const { return SectionArray[at_]; } //member access: read----------------------------------------- //! Retrieves the channel name /*! \return The channel name. */ const std::string& GetChannelName() const { return name; } //! Retrieves the y units string. /*! \return The y units string. */ const std::string& GetYUnits( ) const { return yunits; } //! Retrieves the size of the section array. /*! \return The size of the section array. */ size_t size() const { return SectionArray.size(); } //! Range-checked access to a section (read-only). /*! Will throw std::out_of_range if out of range. * \param at_ The index of the section. * \return The section at index at_. */ const Section& at(std::size_t at_) const; //! Range-checked access to a section (read and write). /*! Will throw std::out_of_range if out of range. * \param at_ The index of the section. * \return The section at index at_. */ Section& at(std::size_t at_); //! Low-level access to the section array (read-only). /*! \return The vector containing the sections. */ const std::deque< Section >& get() const { return SectionArray; } //! Low-level access to the section array (read and write). /*! \return The vector containing the sections. */ std::deque< Section >& get() { return SectionArray; } //member access: write---------------------------------------- //! Sets the channel name /*! \param value The channel name. */ void SetChannelName(const std::string& value) { name = value; } //! Sets the y units string /*! \param value The new y units string. */ void SetYUnits( const std::string& value ) { yunits = value; } //misc-------------------------------------------------------- //! Inserts a section at the given position, overwriting anything that's currently stored at that position /*! Meant to be used after constructing with Channel(const unsigned int& c_n_sections}. * The section array size has to be larger than pos because it won't be resized. * Will throw std::out_of_range if out of range. * \param c_Section The section to be inserted. * \param pos The position at which to insert the section. */ void InsertSection(const Section& c_Section, std::size_t pos); //! Resize the section array. /*! \param newSize The new number of sections. */ void resize(std::size_t newSize); //! Reserve memory for a number of sections. /*! This will avoid unnecessary memory re-allocations. * \param resSize The number of sections to reserve memory for. */ void reserve(std::size_t resSize); private: //private members--------------------------------------------- std::string name, yunits; // An array of sections std::deque< Section > SectionArray; }; /*@}*/ #endif stimfit-0.16.0/src/libstfio/section.h0000775000175000017500000001215213277303516014432 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file section.h * \author Christoph Schmidt-Hieber * \date 2008-01-16 * \brief Declares the Section class. */ /*------------------------------------------------------------------------ * References: * [1] Stroustrup, B.: The C++ Programming Language. 3rd ed. 1997 * [2] Meyers, S.: Effective C++. 3rd ed. 2005 --------------------------------------------------------------------------*/ // only compile once, even if included more often: #ifndef _SECTION_H #define _SECTION_H /*! \addtogroup stfgen * @{ */ //! Represents a continuously sampled sweep of data points class StfioDll Section { public: // Construction/Destruction----------------------------------------------- //! Default constructor. explicit Section(); //! Constructor /*! \param valA A vector of values that will make up the section. * \param label An optional section label string. */ explicit Section( const Vector_double& valA, const std::string& label="\0" ); //! Yet another constructor /*! \param size Number of data points. * \param label An optional section label string. */ explicit Section( std::size_t size, const std::string& label="\0" ); //! Destructor ~Section(); // Operators-------------------------------------------------------------- //! Unchecked access. Returns a non-const reference. /*! \param at Data point index. * \return Copy of the data point with index at. */ double& operator[](std::size_t at) { return data[at]; } //! Unchecked access. Returns a copy. /*! \param at Data point index. * \return Reference to the data point with index at. */ double operator[](std::size_t at) const { return data[at]; } // Public member functions------------------------------------------------ //! Range-checked access. Returns a copy. /*! Throws std::out_of_range if out of range. * \param at_ Data point index. * \return Copy of the data point at index at_ */ double at(std::size_t at_) const; //! Range-checked access. Returns a non-const reference. /*! Throws std::out_of_range if out of range. * \param at_ Data point index. * \return Reference to the data point at index at_ */ double& at(std::size_t at_); //! Low-level access to the valarray (read-only). /*! An explicit function is used instead of implicit type conversion * to access the valarray. * \return The valarray containing the data points. */ const Vector_double& get() const { return data; } //! Low-level access to the valarray (read and write). /*! An explicit function is used instead of implicit type conversion * to access the valarray. * \return The valarray containing the data points. */ Vector_double& get_w() { return data; } //! Resize the Section to a new number of data points; deletes all previously stored data when gcc is used. /*! Note that in the gcc implementation of std::vector, resizing will * delete all the original data. This is different from std::vector::resize(). * \param new_size The new number of data points. */ void resize(std::size_t new_size) { data.resize(new_size); } //! Retrieve the number of data points. /*! \return The number of data points. */ size_t size() const { return data.size(); } //! Sets the x scaling. /*! \param value The x scaling. */ void SetXScale(double value); //! Retrieves the x scaling. /*! \return The x scaling. */ double GetXScale() const { return x_scale; } //! Retrieves a section description. /*! \return A string describing this section. */ const std::string& GetSectionDescription() const { return section_description; } //! Sets a section description. /*! \param value A string describing this section. */ void SetSectionDescription(const std::string& value) { section_description=value; } private: //Private members------------------------------------------------------- // A description that is specific to this section: std::string section_description; // The sampling interval: double x_scale; // The data: Vector_double data; }; /*@}*/ #endif stimfit-0.16.0/src/libstfio/hdf5/0000775000175000017500000000000013567226445013526 500000000000000stimfit-0.16.0/src/libstfio/hdf5/hdf5lib.h0000775000175000017500000000312313277303516015127 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file hdf5lib.h * \author Christoph Schmidt-Hieber * \date 2008-10-03 * \brief Import from and export to hdf5. */ #ifndef _HDF5LIB_H #define _HDF5LIB_H #include "../stfio.h" class Recording; namespace stfio { //! Open a HDF5 file and store its contents to a Recording object. /*! \param fName Full path to the file to be read. * \param ReturnData On entry, an empty Recording object. On exit, * the data stored in \e fName. * \param progress True if the progress dialog should be updated. */ void importHDF5File(const std::string& fName, Recording& ReturnData, ProgressInfo& progDlg); //! Export a Recording to a HDF5 file. /*! \param fName Full path to the file to be written. * \param WData The data to be exported. * \return The HDF5 file handle. */ StfioDll bool exportHDF5File(const std::string& fName, const Recording& WData, ProgressInfo& progDlg); } #endif stimfit-0.16.0/src/libstfio/hdf5/hdf5lib.cpp0000775000175000017500000005230513277303516015470 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "hdf5.h" #if H5_VERS_MINOR > 6 #include "hdf5_hl.h" #else #include "H5TA.h" #endif #include #include #include #include "./hdf5lib.h" #include "../recording.h" const static unsigned int DATELEN = 128; const static unsigned int TIMELEN = 128; const static unsigned int UNITLEN = 16; typedef struct rt { int channels; char date[DATELEN]; char time[TIMELEN]; } rt; typedef struct ct { int n_sections; } ct; typedef struct st { double dt; char xunits[UNITLEN]; char yunits[UNITLEN]; } st; bool stfio::exportHDF5File(const std::string& fName, const Recording& WData, ProgressInfo& progDlg) { hid_t file_id = H5Fcreate(fName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); const int NRECORDS = 1; const int NFIELDS = 3; /* Calculate the size and the offsets of our struct members in memory */ size_t rt_offset[NFIELDS] = { HOFFSET( rt, channels ), HOFFSET( rt, date ), HOFFSET( rt, time )}; /* Define an array of root tables */ rt p_data; p_data.channels = WData.size(); struct tm t = WData.GetDateTime(); std::size_t date_length = snprintf(p_data.date, DATELEN, "%04i-%02i-%02i", t.tm_year+1900, t.tm_mon+1, t.tm_mday); std::size_t time_length = snprintf(p_data.time, TIMELEN, "%02i:%02i:%02i", t.tm_hour, t.tm_min, t.tm_sec); // ensure that an undefine string is set to "\0", and that the terminating \0 is counted in string length p_data.date[date_length++] = 0; p_data.time[time_length++] = 0; /* Define field information */ const char *field_names[NFIELDS] = { "channels", "date", "time" }; hid_t field_type[NFIELDS]; /* Initialize the field field_type */ hid_t string_type1 = H5Tcopy( H5T_C_S1 ); hid_t string_type2 = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type1, date_length); H5Tset_size( string_type2, time_length); field_type[0] = H5T_NATIVE_INT; field_type[1] = string_type1; field_type[2] = string_type2; std::ostringstream desc; desc << "Description of " << fName; herr_t status = H5TBmake_table( desc.str().c_str(), file_id, "description", (hsize_t)NFIELDS, (hsize_t)NRECORDS, sizeof(rt), field_names, rt_offset, field_type, 10, NULL, 0, &p_data ); if (status < 0) { std::string errorMsg("Exception while writing description in stfio::exportHDF5File"); H5Fclose(file_id); H5close(); throw std::runtime_error(errorMsg); } hid_t comment_group = H5Gcreate2( file_id,"/comment", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* File comment. */ std::string description(WData.GetFileDescription()); if (description.length() <= 0) { description = "No description"; } status = H5LTmake_dataset_string(file_id, "/comment/description", description.c_str()); if (status < 0) { std::string errorMsg("Exception while writing description in stfio::exportHDF5File"); H5Fclose(file_id); H5close(); throw std::runtime_error(errorMsg); } std::string comment(WData.GetComment()); if (comment.length() <= 0) { comment = "No comment"; } status = H5LTmake_dataset_string(file_id, "/comment/comment", comment.c_str()); if (status < 0) { std::string errorMsg("Exception while writing comment in stfio::exportHDF5File"); H5Fclose(file_id); H5close(); throw std::runtime_error(errorMsg); } H5Gclose(comment_group); std::vector channel_name(WData.size()); hid_t channels_group = H5Gcreate2( file_id,"/channels", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for ( std::size_t n_c=0; n_c < WData.size(); ++n_c) { /* Channel descriptions. */ std::ostringstream ossname; ossname << WData[n_c].GetChannelName(); if ( ossname.str() == "" ) { ossname << "ch" << (n_c); } channel_name[n_c] = ossname.str(); hsize_t dimsc[1] = { 1 }; hid_t string_typec = H5Tcopy( H5T_C_S1 ); std::size_t cn_length = channel_name[n_c].length(); if (cn_length <= 0) cn_length = 1; H5Tset_size( string_typec, cn_length ); std::vector datac(channel_name[n_c].length()); std::copy(channel_name[n_c].begin(),channel_name[n_c].end(), datac.begin()); std::ostringstream desc_path; desc_path << "/channels/ch" << (n_c); status = H5LTmake_dataset(file_id, desc_path.str().c_str(), 1, dimsc, string_typec, &datac[0]); if (status < 0) { std::string errorMsg("Exception while writing channel name in stfio::exportHDF5File"); H5Fclose(file_id); H5close(); throw std::runtime_error(errorMsg); } std::ostringstream channel_path; channel_path << "/" << channel_name[n_c]; hid_t channel_group = H5Gcreate2( file_id, channel_path.str().c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (channel_group < 0) { std::ostringstream errorMsg; errorMsg << "Exception while creating channel group for " << channel_path.str().c_str(); H5Fclose(file_id); H5close(); throw std::runtime_error(errorMsg.str()); } /* Calculate the size and the offsets of our struct members in memory */ size_t ct_size = sizeof( ct ); size_t ct_offset[1] = { HOFFSET( rt, channels ) }; /* Define an array of channel tables */ ct c_data = { (int)WData[n_c].size() }; /* Define field information */ const char *cfield_names[1] = { "n_sections" }; hid_t cfield_type[1] = {H5T_NATIVE_INT}; std::ostringstream c_desc; c_desc << "Description of channel " << n_c; status = H5TBmake_table( c_desc.str().c_str(), channel_group, "description", (hsize_t)1, (hsize_t)1, ct_size, cfield_names, ct_offset, cfield_type, 10, NULL, 0, &c_data ); if (status < 0) { std::string errorMsg("Exception while writing channel description in stfio::exportHDF5File"); H5Fclose(file_id); H5close(); throw std::runtime_error(errorMsg); } int max_log10 = 0; if (WData[n_c].size() > 1) { max_log10 = int(log10((double)WData[n_c].size()-1.0)); } for (std::size_t n_s=0; n_s < WData[n_c].size(); ++n_s) { int progbar = // Channel contribution: (int)(((double)n_c/(double)WData.size())*100.0+ // Section contribution: (double)(n_s)/(double)WData[n_c].size()*(100.0/WData.size())); std::ostringstream progStr; progStr << "Writing channel #" << n_c + 1 << " of " << WData.size() << ", Section #" << n_s << " of " << WData[n_c].size(); progDlg.Update(progbar, progStr.str()); // construct a number with leading zeros: int n10 = 0; if (n_s > 0) { n10 = int(log10((double)n_s)); } std::ostringstream strZero; strZero << ""; for (int n_z=n10; n_z < max_log10; ++n_z) { strZero << "0"; } // construct a section name: std::ostringstream section_name; section_name << WData[n_c][n_s].GetSectionDescription(); if ( section_name.str() == "" ) { section_name << "sec" << n_s; } // create a child group in the channel: std::ostringstream section_path; section_path << channel_path.str() << "/" << "section_" << strZero.str() << n_s; hid_t section_group = H5Gcreate2( file_id, section_path.str().c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); // add data and description, store as 32 bit little endian independent of machine: hsize_t dims[1] = { WData[n_c][n_s].size() }; std::ostringstream data_path; data_path << section_path.str() << "/data"; Vector_float data_cp(WData[n_c][n_s].get().size()); /* 32 bit */ for (std::size_t n_cp = 0; n_cp < WData[n_c][n_s].get().size(); ++n_cp) { data_cp[n_cp] = float(WData[n_c][n_s][n_cp]); } status = H5LTmake_dataset(file_id, data_path.str().c_str(), 1, dims, H5T_IEEE_F32LE, &data_cp[0]); if (status < 0) { std::string errorMsg("Exception while writing data in stfio::exportHDF5File"); H5Fclose(file_id); H5close(); throw std::runtime_error(errorMsg); } const int NSRECORDS = 1; const int NSFIELDS = 3; /* Calculate the size and the offsets of our struct members in memory */ size_t st_size = sizeof( st ); size_t st_offset[NSFIELDS] = { HOFFSET( st, dt ), HOFFSET( st, xunits ), HOFFSET( st, yunits )}; /* Define an array of root tables */ st s_data; s_data.dt = WData.GetXScale(); if (WData.GetXUnits().length() < UNITLEN) strcpy( s_data.xunits, WData.GetXUnits().c_str() ); if (WData[n_c].GetYUnits().length() < UNITLEN) strcpy( s_data.yunits, WData[n_c].GetYUnits().c_str() ); /* Define field information */ const char *sfield_names[NSFIELDS] = { "dt", "xunits", "yunits" }; hid_t sfield_type[NSFIELDS]; /* Initialize the field field_type */ hid_t string_type4 = H5Tcopy( H5T_C_S1 ); hid_t string_type5 = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type4, 2); std::size_t yu_length = WData[n_c].GetYUnits().length(); if (yu_length <= 0) yu_length = 1; H5Tset_size( string_type5, yu_length ); sfield_type[0] = H5T_NATIVE_DOUBLE; sfield_type[1] = string_type4; sfield_type[2] = string_type5; std::ostringstream sdesc; sdesc << "Description of " << section_name.str(); status = H5TBmake_table( sdesc.str().c_str(), section_group, "description", (hsize_t)NSFIELDS, (hsize_t)NSRECORDS, st_size, sfield_names, st_offset, sfield_type, 10, NULL, 0, &s_data ); if (status < 0) { std::string errorMsg("Exception while writing section description in stfio::exportHDF5File"); H5Fclose(file_id); H5close(); throw std::runtime_error(errorMsg); } H5Gclose(section_group); } H5Gclose(channel_group); } H5Gclose(channels_group); /* Terminate access to the file. */ status = H5Fclose(file_id); if (status < 0) { std::string errorMsg("Exception while closing file in stfio::exportHDF5File"); throw std::runtime_error(errorMsg); } /* Release all hdf5 resources */ status = H5close(); if (status < 0) { std::string errorMsg("Exception while closing file in stfio::exportHDF5File"); throw std::runtime_error(errorMsg); } return (status >= 0); } void stfio::importHDF5File(const std::string& fName, Recording& ReturnData, ProgressInfo& progDlg) { /* Create a new file using default properties. */ hid_t file_id = H5Fopen(fName.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT); /* H5TBread_table const int NRECORDS = 1;*/ const int NFIELDS = 3; /* Calculate the size and the offsets of our struct members in memory */ size_t rt_offset[NFIELDS] = { HOFFSET( rt, channels ), HOFFSET( rt, date ), HOFFSET( rt, time )}; rt rt_buf[1]; size_t rt_sizes[NFIELDS] = { sizeof( rt_buf[0].channels), sizeof( rt_buf[0].date), sizeof( rt_buf[0].time)}; herr_t status=H5TBread_table( file_id, "description", sizeof(rt), rt_offset, rt_sizes, rt_buf ); if (status < 0) { std::string errorMsg("Exception while reading description in stfio::importHDF5File"); throw std::runtime_error(errorMsg); } int numberChannels =rt_buf[0].channels; if ( ReturnData.SetDate(rt_buf[0].date) || ReturnData.SetTime(rt_buf[0].time) ) { std::cout << "Warning HDF5: could not decode date/time " << rt_buf[0].date << " " << rt_buf[0].time << std::endl; } /* Create the data space for the dataset. */ hsize_t dims; H5T_class_t class_id; size_t type_size; std::string description, comment; hid_t group_id = H5Gopen2(file_id, "/comment", H5P_DEFAULT); status = H5Lexists(group_id, "/comment/description", 0); if (status==1) { status = H5LTget_dataset_info( file_id, "/comment/description", &dims, &class_id, &type_size ); if (status >= 0) { description.resize( type_size ); status = H5LTread_dataset_string (file_id, "/comment/description", &description[0]); if (status < 0) { std::string errorMsg("Exception while reading description in stfio::importHDF5File"); throw std::runtime_error(errorMsg); } } } ReturnData.SetFileDescription(description); status = H5Lexists(group_id, "/comment/comment", 0); if (status==1) { status = H5LTget_dataset_info( file_id, "/comment/comment", &dims, &class_id, &type_size ); if (status >= 0) { comment.resize( type_size ); status = H5LTread_dataset_string (file_id, "/comment/comment", &comment[0]); if (status < 0) { std::string errorMsg("Exception while reading comment in stfio::importHDF5File"); throw std::runtime_error(errorMsg); } } } ReturnData.SetComment(comment); double dt = 1.0; std::string yunits = ""; for (int n_c=0;n_c szchannel_name(ctype_size); // szchannel_name.reset( new char[ctype_size] ); status = H5LTread_dataset(file_id, desc_path.str().c_str(), string_typec, &szchannel_name[0] ); if (status < 0) { std::string errorMsg("Exception while reading channel name in stfio::importHDF5File"); throw std::runtime_error(errorMsg); } std::ostringstream channel_name; for (std::size_t c=0; c 1) { max_log10 = int(log10((double)ct_buf[0].n_sections-1.0)); } for (int n_s=0; n_s < ct_buf[0].n_sections; ++n_s) { int progbar = // Channel contribution: (int)(((double)n_c/(double)numberChannels)*100.0+ // Section contribution: (double)(n_s)/(double)ct_buf[0].n_sections*(100.0/numberChannels)); std::ostringstream progStr; progStr << "Reading channel #" << n_c + 1 << " of " << numberChannels << ", Section #" << n_s+1 << " of " << ct_buf[0].n_sections; progDlg.Update(progbar, progStr.str()); // construct a number with leading zeros: int n10 = 0; if (n_s > 0) { n10 = int(log10((double)n_s)); } std::ostringstream strZero; strZero << ""; for (int n_z=n10; n_z < max_log10; ++n_z) { strZero << "0"; } // construct a section name: std::ostringstream section_name; section_name << "sec" << n_s; // create a child group in the channel: std::ostringstream section_path; section_path << channel_path.str() << "/" << "section_" << strZero.str() << n_s; hid_t section_group = H5Gopen2(file_id, section_path.str().c_str(), H5P_DEFAULT ); std::ostringstream data_path; data_path << section_path.str() << "/data"; hsize_t sdims; H5T_class_t sclass_id; size_t stype_size; status = H5LTget_dataset_info( file_id, data_path.str().c_str(), &sdims, &sclass_id, &stype_size ); if (status < 0) { std::string errorMsg("Exception while reading data information in stfio::importHDF5File"); throw std::runtime_error(errorMsg); } Vector_float TempSection(sdims); status = H5LTread_dataset(file_id, data_path.str().c_str(), H5T_IEEE_F32LE, &TempSection[0]); if (status < 0) { std::string errorMsg("Exception while reading data in stfio::importHDF5File"); throw std::runtime_error(errorMsg); } Section TempSectionT(TempSection.size(), section_name.str()); for (std::size_t cp = 0; cp < TempSectionT.size(); ++cp) { TempSectionT[cp] = double(TempSection[cp]); } // std::copy(TempSection.begin(),TempSection.end(),&TempSectionT[0]); try { TempChannel.InsertSection(TempSectionT,n_s); } catch (...) { throw; } /* H5TBread_table const int NSRECORDS = 1; */ const int NSFIELDS = 3; /* Calculate the size and the offsets of our struct members in memory */ size_t st_offset[NSFIELDS] = { HOFFSET( st, dt ), HOFFSET( st, xunits ), HOFFSET( st, yunits )}; st st_buf[1]; size_t st_sizes[NSFIELDS] = { sizeof( st_buf[0].dt), sizeof( st_buf[0].xunits), sizeof( st_buf[0].yunits)}; status=H5TBread_table( section_group, "description", sizeof(st), st_offset, st_sizes, st_buf ); if (status < 0) { std::string errorMsg("Exception while reading data description in stfio::importHDF5File"); throw std::runtime_error(errorMsg); } dt = st_buf[0].dt; yunits = st_buf[0].yunits; H5Gclose( section_group ); } try { if ((int)ReturnData.size() #include "../stfio.h" #if defined(WITH_BIOSIGLITE) #include "../../libbiosiglite/biosig4c++/biosig2.h" #else #include #endif #if (BIOSIG_VERSION < 10902) #error libbiosig v1.9.2 or later is required #endif #define DONOTUSE_DYNAMIC_ALLOCATION_FOR_CHANSPR /* these are internal biosig functions, defined in biosig-dev.h which is not always available */ extern "C" size_t ifwrite(void* buf, size_t size, size_t nmemb, HDRTYPE* hdr); extern "C" uint32_t lcm(uint32_t A, uint32_t B); #if !defined(__MINGW32__) && !defined(_MSC_VER) #if defined (__APPLE__) #include #else #include #endif #endif #include "./biosiglib.h" stfio::filetype stfio_file_type(HDRTYPE* hdr) { switch (biosig_get_filetype(hdr)) { case ABF2: return stfio::abf; case ABF: return stfio::abf; case ATF: return stfio::atf; case CFS: return stfio::cfs; case HEKA: return stfio::heka; case HDF: return stfio::hdf5; case AXG: return stfio::axg; case IBW: return stfio::igor; case SMR: return stfio::son; default: return stfio::none; } } #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) bool stfio::check_biosig_version(int a, int b, int c) { return (BIOSIG_VERSION >= 10000*a + 100*b + c); } #endif stfio::filetype stfio::importBiosigFile(const std::string &fName, Recording &ReturnData, ProgressInfo& progDlg) { std::string errorMsg("Exception while calling std::importBSFile():\n"); std::string yunits; stfio::filetype type; // ===================================================================================================================== // // importBiosig opens file with libbiosig // - performs an automated identification of the file format // - and decides whether the data is imported through importBiosig (currently CFS, HEKA, ABF1, GDF, and others) // - or handed back to other import*File functions (currently ABF2, AXG, HDF5) // // ===================================================================================================================== #ifdef __LIBBIOSIG2_H__ HDRTYPE* hdr = sopen( fName.c_str(), "r", NULL ); if (hdr==NULL) { ReturnData.resize(0); return stfio::none; } type = stfio_file_type(hdr); if (biosig_check_error(hdr)) { ReturnData.resize(0); destructHDR(hdr); return type; } enum FileFormat biosig_filetype=biosig_get_filetype(hdr); if (biosig_filetype==ATF || biosig_filetype==ABF2 || biosig_filetype==HDF ) { // ATF, ABF2 and HDF5 support should be handled by importATF, and importABF, and importHDF5 not importBiosig ReturnData.resize(0); destructHDR(hdr); return type; } // ensure the event table is in chronological order sort_eventtable(hdr); // allocate local memory for intermediate results; const int strSize=100; char str[strSize]; /* count sections and generate list of indices indicating start and end of sweeps */ int numberOfChannels = biosig_get_number_of_channels(hdr); double fs = biosig_get_eventtable_samplerate(hdr); size_t numberOfEvents = biosig_get_number_of_events(hdr); size_t nsections = biosig_get_number_of_segments(hdr); ReturnData.InitSectionMarkerList(nsections); std::vector SegIndexList(nsections+1); SegIndexList[0] = 0; SegIndexList[nsections] = biosig_get_number_of_samples(hdr); std::string annotationTableDesc = std::string(); for (size_t k=0, n=0; k < numberOfEvents; k++) { uint32_t pos; uint16_t typ; uint32_t dur; uint16_t chn; const char *desc; /* gdftype timestamp; */ biosig_get_nth_event(hdr, k, &typ, &pos, &chn, &dur, NULL, &desc); if (typ == 0x7ffe) { SegIndexList[++n] = pos; } else if (typ < 256) { sprintf(str,"%f s:\t%s\n", pos/fs, desc); annotationTableDesc += std::string( str ); size_t currentSectionNumber = (pos < SegIndexList[n]) ? n : (n+1); ReturnData.SetSectionType(currentSectionNumber-1, typ); // TODO: Description of EvenTypes // ReturnData.SetEventDescription( currentSectionNumber-1, desc); } } /************************************************************************* rescale data to mV and pA *************************************************************************/ for (int ch=0; ch < numberOfChannels; ++ch) { CHANNEL_TYPE *hc = biosig_get_channel(hdr, ch); switch (biosig_channel_get_physdimcode(hc) & 0xffe0) { case 4256: // Volt //biosig_channel_scale_to_unit(hc, "mV"); biosig_channel_change_scale_to_physdimcode(hc, 4274); break; case 4160: // Ampere //biosig_channel_scale_to_unit(hc, "pA"); biosig_channel_change_scale_to_physdimcode(hc, 4181); break; } } /************************************************************************* read bulk data *************************************************************************/ biosig_data_type *data = biosig_get_data(hdr, 0); size_t SPR = biosig_get_number_of_samples(hdr); #ifdef _STFDEBUG std::cout << "Number of events: " << numberOfEvents << std::endl; /*int res = */ hdr2ascii(hdr, stdout, 4); #endif for (int NS=0; NS < numberOfChannels; ) { CHANNEL_TYPE *hc = biosig_get_channel(hdr, NS); Channel TempChannel(nsections); TempChannel.SetChannelName(biosig_channel_get_label(hc)); TempChannel.SetYUnits(biosig_channel_get_physdim(hc)); for (size_t ns=1; ns<=nsections; ns++) { if (SegIndexList[ns]-SegIndexList[ns-1] < 0) { ReturnData.resize(0); destructHDR(hdr); return type; } size_t SPS = SegIndexList[ns]-SegIndexList[ns-1]; // length of segment, samples per segment int progbar = int(100.0 * (1.0 * ns / nsections + NS) / numberOfChannels); std::ostringstream progStr; progStr << "Reading channel #" << NS + 1 << " of " << numberOfChannels << ", Section #" << ns << " of " << nsections; progDlg.Update(progbar, progStr.str()); Section TempSection(SPS, ""); std::copy(&(data[NS*SPR + SegIndexList[ns-1]]), &(data[NS*SPR + SegIndexList[ns]]), TempSection.get_w().begin() ); try { TempChannel.InsertSection(TempSection, ns-1); } catch (...) { ReturnData.resize(0); destructHDR(hdr); return type; } } // end for sections try { if ((int)ReturnData.size() < numberOfChannels) ReturnData.resize(numberOfChannels); ReturnData.InsertChannel(TempChannel, NS++); } catch (...) { ReturnData.resize(0); destructHDR(hdr); return type; } } // end for channels ReturnData.SetComment ( biosig_get_recording_id(hdr) ); sprintf(str,"v%i.%i.%i (compiled on %s %s)",BIOSIG_VERSION_MAJOR,BIOSIG_VERSION_MINOR,BIOSIG_PATCHLEVEL,__DATE__,__TIME__); std::string Desc = std::string("importBiosig with libbiosig ")+std::string(str) + " "; const char* tmpstr; if ((tmpstr=biosig_get_technician(hdr))) Desc += std::string ("\nTechnician:\t") + std::string (tmpstr) + " "; Desc += std::string( "\nCreated with: "); if ((tmpstr=biosig_get_manufacturer_name(hdr))) Desc += std::string( tmpstr ) + " "; if ((tmpstr=biosig_get_manufacturer_model(hdr))) Desc += std::string( tmpstr ) + " "; if ((tmpstr=biosig_get_manufacturer_version(hdr))) Desc += std::string( tmpstr ) + " "; if ((tmpstr=biosig_get_manufacturer_serial_number(hdr))) Desc += std::string( tmpstr ) + " "; Desc += std::string ("\nUser specified Annotations:\n")+annotationTableDesc; ReturnData.SetFileDescription(Desc); tmpstr = biosig_get_application_specific_information(hdr); if (tmpstr != NULL) /* MSVC2008 can not properly handle std::string( (char*)NULL ) */ ReturnData.SetGlobalSectionDescription(tmpstr); ReturnData.SetXScale(1000.0/biosig_get_samplerate(hdr)); ReturnData.SetXUnits("ms"); ReturnData.SetScaling("biosig scaling factor"); /************************************************************************* Date and time conversion *************************************************************************/ struct tm T; biosig_get_startdatetime(hdr, &T); ReturnData.SetDateTime(T); destructHDR(hdr); #endif //ifdef __LIBBIOSIG2_H__ return stfio::biosig; } // ===================================================================================================================== // // Save file with libbiosig into GDF format // // ===================================================================================================================== bool stfio::exportBiosigFile(const std::string& fName, const Recording& Data, stfio::ProgressInfo& progDlg) { /* converts the internal data structure to libbiosig's internal structure and saves the file as gdf file. The data in converted into the raw data format, and not into the common data matrix. */ #ifdef __LIBBIOSIG2_H__ size_t numberOfChannels = Data.size(); HDRTYPE* hdr = constructHDR(numberOfChannels, 0); /* Initialize all header parameters */ biosig_set_filetype(hdr, GDF); biosig_set_startdatetime(hdr, Data.GetDateTime()); const char *xunits = Data.GetXUnits().c_str(); uint16_t pdc = PhysDimCode(xunits); if ((pdc & 0xffe0) != PhysDimCode("s")) { fprintf(stderr,"Stimfit exportBiosigFile: xunits [%s] has not proper units, assume [ms]\n",Data.GetXUnits().c_str()); pdc = PhysDimCode("ms"); } double fs = 1.0/(PhysDimScale(pdc) * Data.GetXScale()); biosig_set_samplerate(hdr, fs); biosig_reset_flag(hdr, BIOSIG_FLAG_COMPRESSION | BIOSIG_FLAG_UCAL | BIOSIG_FLAG_OVERFLOWDETECTION | BIOSIG_FLAG_ROW_BASED_CHANNELS ); size_t k, m, numberOfEvents=0; size_t NRec=0; // corresponds to hdr->NRec size_t SPR=1; // corresponds to hdr->SPR size_t chSPR=0; // corresponds to hc->SPR /* Initialize all channel parameters */ #ifndef DONOTUSE_DYNAMIC_ALLOCATION_FOR_CHANSPR size_t *chanSPR = (size_t*)malloc(numberOfChannels*sizeof(size_t)); #endif for (k = 0; k < numberOfChannels; ++k) { CHANNEL_TYPE *hc = biosig_get_channel(hdr, k); biosig_channel_set_datatype_to_double(hc); biosig_channel_set_scaling(hc, 1e9, -1e9, 1e9, -1e9); biosig_channel_set_label(hc, Data[k].GetChannelName().c_str()); biosig_channel_set_physdim(hc, Data[k].GetYUnits().c_str()); biosig_channel_set_filter(hc, NAN, NAN, NAN); biosig_channel_set_timing_offset(hc, 0.0); biosig_channel_set_impedance(hc, NAN); chSPR = SPR; // each segment gets one marker, roughly numberOfEvents += Data[k].size(); size_t m,len = 0; for (len=0, m = 0; m < Data[k].size(); ++m) { unsigned div = lround(Data[k][m].GetXScale()/Data.GetXScale()); chSPR = lcm(chSPR,div); // sampling interval of m-th segment in k-th channel len += div*Data[k][m].size(); } SPR = lcm(SPR, chSPR); /* hc->SPR (i.e. chSPR) is 'abused' to store final hdr->SPR/hc->SPR, this is corrected in the loop below its a hack to avoid the need for another malloc(). */ #ifdef DONOTUSE_DYNAMIC_ALLOCATION_FOR_CHANSPR biosig_channel_set_samples_per_record(hc, chSPR); #else chanSPR[k]=chSPR; #endif if (k==0) { NRec = len; } else if ((size_t)NRec != len) { destructHDR(hdr); throw std::runtime_error("File can't be exported:\n" "No data or traces have different sizes" ); return false; } } biosig_set_number_of_samples(hdr, NRec, SPR); size_t bpb = 0; for (k = 0; k < numberOfChannels; ++k) { CHANNEL_TYPE *hc = biosig_get_channel(hdr, k); // the 'abuse' of hc->SPR described above is corrected #ifdef DONOTUSE_DYNAMIC_ALLOCATION_FOR_CHANSPR size_t spr = biosig_channel_get_samples_per_record(hc); spr = SPR / spr; biosig_channel_set_samples_per_record(hc, spr); #else size_t spr = SPR/chanSPR[k]; chanSPR[k] = spr; #endif bpb += spr * 8; /* its always double */ } /*** build Event table for storing segment information pre-allocate memory for even table ***/ numberOfEvents *= 2; // about two events per segment biosig_set_number_of_events(hdr, numberOfEvents); /* check whether all segments have same size */ { char flag = (numberOfChannels > 0); size_t m, POS, pos; for (k=0; k < numberOfChannels; ++k) { pos = Data[k].size(); if (k==0) POS = pos; else flag &= (POS == pos); } for (m=0; flag && (m < Data[(size_t)0].size()); ++m) { for (k=0; k < biosig_get_number_of_channels(hdr); ++k) { pos = Data[k][m].size() * lround(Data[k][m].GetXScale()/Data.GetXScale()); if (k==0) POS = pos; else flag &= (POS == pos); } } if (!flag) { destructHDR(hdr); throw std::runtime_error( "File can't be exported:\n" "Traces have different sizes or no channels found" ); return false; } } size_t N=0; k=0; size_t pos = 0; for (m=0; m < (Data[k].size()); ++m) { if (pos > 0) { uint16_t typ=0x7ffe; uint32_t pos32=pos; uint16_t chn=0; uint32_t dur=0; // set break marker biosig_set_nth_event(hdr, N++, &typ, &pos32, &chn, &dur, NULL, NULL); /* // set annotation const char *Desc = Data[k][m].GetSectionDescription().c_str(); if (Desc != NULL && strlen(Desc)>0) biosig_set_nth_event(hdr, N++, NULL, &pos32, &chn, &dur, NULL, Desc); // TODO */ } pos += Data[k][m].size() * lround(Data[k][m].GetXScale()/Data.GetXScale()); } biosig_set_number_of_events(hdr, N); biosig_set_eventtable_samplerate(hdr, fs); sort_eventtable(hdr); /* convert data into GDF rawdata from */ uint8_t *rawdata = (uint8_t*)malloc(bpb * NRec); size_t bi=0; for (k=0; k < numberOfChannels; ++k) { CHANNEL_TYPE *hc = biosig_get_channel(hdr, k); #ifdef DONOTUSE_DYNAMIC_ALLOCATION_FOR_CHANSPR size_t chSPR = biosig_channel_get_samples_per_record(hc); #else size_t chSPR = chanSPR[k]; #endif size_t m,n,len=0; for (m=0; m < Data[k].size(); ++m) { size_t div = lround(Data[k][m].GetXScale()/Data.GetXScale()); size_t div2 = SPR/div; // TODO: avoid using hdr->SPR // fprintf(stdout,"k,m,div,div2: %i,%i,%i,%i\n",(int)k,(int)m,(int)div,(int)div2); // for (n=0; n < Data[k][m].size(); ++n) { uint64_t val; double d = Data[k][m][n]; #if !defined(__MINGW32__) && !defined(_MSC_VER) && !defined(__APPLE__) val = htole64(*(uint64_t*)&d); #else val = *(uint64_t*)&d; #endif size_t p, spr = (len + n*div) / SPR; for (p=0; p < div2; p++) *(uint64_t*)(rawdata + bi + bpb * spr + p*8) = val; } len += div*Data[k][m].size(); } bi += chSPR*8; } #ifndef DONOTUSE_DYNAMIC_ALLOCATION_FOR_CHANSPR if (chanSPR) free(chanSPR); #endif /****************************** write to file *******************************/ std::string errorMsg("Exception while calling std::exportBiosigFile():\n"); hdr = sopen( fName.c_str(), "w", hdr ); if (serror2(hdr)) { errorMsg += biosig_get_errormsg(hdr); destructHDR(hdr); throw std::runtime_error(errorMsg.c_str()); return false; } ifwrite(rawdata, bpb, NRec, hdr); sclose(hdr); destructHDR(hdr); free(rawdata); #endif return true; } stimfit-0.16.0/src/libstfio/channel.cpp0000775000175000017500000000420713277303516014733 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "./stfio.h" #include "./channel.h" Channel::Channel(void) : name("\0"), yunits( "\0" ), SectionArray(0) {} Channel::Channel(const Section& c_Section) : name("\0"), yunits( "\0" ), SectionArray(1, c_Section) {} Channel::Channel(const std::deque
& SectionList) : name("\0"), yunits( "\0" ), SectionArray(SectionList) {} Channel::Channel(std::size_t c_n_sections, std::size_t section_size) : name("\0"), yunits( "\0" ), SectionArray(c_n_sections, Section(section_size)) {} Channel::~Channel(void) {} void Channel::InsertSection(const Section& c_Section, std::size_t pos) { try { if (SectionArray.at(pos).size() != c_Section.size()) { SectionArray.at(pos).resize(c_Section.size()); } SectionArray.at(pos) = c_Section; } catch (...) { throw; } } const Section& Channel::at(std::size_t at_) const { try { return SectionArray.at(at_); } catch (...) { // Forward all exceptions, can't deal with them here: throw; } } Section& Channel::at(std::size_t at_) { try { return SectionArray.at(at_); } catch (...) { // Forward all exceptions, can't deal with them here: throw; } } void Channel::resize(std::size_t newSize) { SectionArray.resize(newSize); } void Channel::reserve(std::size_t resSize) { /* SectionArray.reserve(resSize); */ } stimfit-0.16.0/src/libstfio/stfio.cpp0000664000175000017500000003430613567226230014446 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file stfio.cpp * \author Christoph Schmidt-Hieber * \date 2011-09-25 * \brief General functions for libstfio * * * Implements some general functions for libstfio */ // Copyright 2012 Alois Schloegl, IST Austria #include #include "stfio.h" // TODO #include "./ascii/asciilib.h" #include "./hdf5/hdf5lib.h" #include "./abf/abflib.h" #include "./atf/atflib.h" #include "./axg/axglib.h" #include "./igor/igorlib.h" #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) #include "./biosig/biosiglib.h" #endif #include "./cfs/cfslib.h" #include "./intan/intanlib.h" #ifndef TEST_MINIMAL #include "./heka/hekalib.h" #else #if (!defined(WITH_BIOSIG) && !defined(WITH_BIOSIG2)) #error -DTEST_MINIMAL requires -DWITH_BIOSIG or -DWITH_BIOSIG2 #endif #endif #if 0 #include "./son/sonlib.h" #endif #ifdef _MSC_VER StfioDll long int lround(double x) { int i = (long int) x; if (x >= 0.0) { return ((x-i) >= 0.5) ? (i + 1) : (i); } else { return (-x+i >= 0.5) ? (i - 1) : (i); } } #endif stfio::StdoutProgressInfo::StdoutProgressInfo(const std::string& title, const std::string& message, int maximum, bool verbose) : ProgressInfo(title, message, maximum, verbose), verbosity(verbose) { if (verbosity) { std::cout << title << std::endl; std::cout << message << std::endl; } } bool stfio::StdoutProgressInfo::Update(int value, const std::string& newmsg, bool* skip) { if (verbosity) { std::cout << "\r"; std::cout.width(3); std::cout << value << "% " << newmsg << std::flush; } return true; } #ifndef TEST_MINIMAL stfio::filetype stfio::findType(const std::string& ext) { if (ext=="*.dat;*.cfs") return stfio::cfs; else if (ext=="*.cfs") return stfio::cfs; else if (ext=="*.abf") return stfio::abf; else if (ext=="*.axgd") return stfio::axg; else if (ext=="*.axgx") return stfio::axg; else if (ext=="*.axgd;*.axgx") return stfio::axg; else if (ext=="*.h5") return stfio::hdf5; else if (ext=="*.atf") return stfio::atf; else if (ext=="*.dat") return stfio::heka; else if (ext=="*.smr") return stfio::son; else if (ext=="*.tdms") return stfio::tdms; else if (ext=="*.clp") return stfio::intan; #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) else if (ext=="*.dat;*.cfs;*.gdf;*.ibw;*.wcp") return stfio::biosig; else if (ext=="*.*") return stfio::biosig; #endif else return stfio::none; } #endif // TEST_MINIMAL std::string stfio::findExtension(stfio::filetype ftype) { switch (ftype) { case stfio::cfs: return ".dat"; case stfio::abf: return ".abf"; case stfio::axg: return ".axg*"; case stfio::igor: return ".ibw"; case stfio::hdf5: return ".h5"; case stfio::atf: return ".atf"; case stfio::heka: return ".dat"; case stfio::son: return ".smr"; case stfio::tdms: return ".tdms"; case stfio::intan: return ".clp"; #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) case stfio::biosig: return ".gdf"; #endif default: return ".*"; } } bool stfio::importFile( const std::string& fName, stfio::filetype type, Recording& ReturnData, const stfio::txtImportSettings& txtImport, ProgressInfo& progDlg ) { try { #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) // make use of automated file type identification #ifndef WITHOUT_ABF if (!check_biosig_version(1,6,3)) { try { // workaround for older versions of libbiosig stfio::importABFFile(fName, ReturnData, progDlg); return true; } catch (...) { #ifndef NDEBUG fprintf(stdout,"%s (line %i): importABF attempted\n",__FILE__,__LINE__); #endif }; } #endif // WITHOUT_ABF // if this point is reached, import ABF was not applied or not successful try { stfio::filetype type1 = stfio::importBiosigFile(fName, ReturnData, progDlg); switch (type1) { case stfio::biosig: return true; // succeeded case stfio::none: break; // do nothing, use input argument for deciding on type default: type = type1; // filetype is recognized and should be used below } } catch (...) { // this should never occur, importBiosigFile should always return without exception std::cout << "importBiosigFile failed with an exception - this is a bug"; } #endif switch (type) { case stfio::hdf5: { stfio::importHDF5File(fName, ReturnData, progDlg); break; } #ifndef WITHOUT_ABF case stfio::abf: { stfio::importABFFile(fName, ReturnData, progDlg); break; } case stfio::atf: { stfio::importATFFile(fName, ReturnData, progDlg); break; } #endif #ifndef WITHOUT_AXG case stfio::axg: { stfio::importAXGFile(fName, ReturnData, progDlg); break; } #endif case stfio::intan: { stfio::importIntanFile(fName, ReturnData, progDlg); break; } #ifndef TEST_MINIMAL case stfio::cfs: { { int res = stfio::importCFSFile(fName, ReturnData, progDlg); /* // disable old Heka import - its broken and will not be fixed, use biosig instead if (res==-7) { stfio::importHEKAFile(fName, ReturnData, progDlg); } */ break; } } /* // disable old Heka import - its broken and will not be fixed, use biosig instead case stfio::heka: { { try { stfio::importHEKAFile(fName, ReturnData, progDlg); } catch (const std::runtime_error& e) { stfio::importCFSFile(fName, ReturnData, progDlg); } break; } } */ #endif // TEST_MINIMAL default: throw std::runtime_error("Unknown or unsupported file type"); } #if 0 case stfio::son: { stfio::SON::importSONFile(fName,ReturnData); break; } case stfio::ascii: { stfio::importASCIIFile( fName, txtImport.hLines, txtImport.ncolumns, txtImport.firstIsTime, txtImport.toSection, ReturnData ); if (!txtImport.firstIsTime) { ReturnData.SetXScale(1.0/txtImport.sr); } if (ReturnData.size()>0) ReturnData[0].SetYUnits(txtImport.yUnits); if (ReturnData.size()>1) ReturnData[1].SetYUnits(txtImport.yUnitsCh2); ReturnData.SetXUnits(txtImport.xUnits); break; } #endif } catch (...) { throw; } return true; } bool stfio::exportFile(const std::string& fName, stfio::filetype type, const Recording& Data, ProgressInfo& progDlg) { try { switch (type) { #ifndef WITHOUT_ABF case stfio::atf: { stfio::exportATFFile(fName, Data); break; } #endif #if (defined(WITH_BIOSIG) || defined(WITH_BIOSIG2)) case stfio::biosig: { stfio::exportBiosigFile(fName, Data, progDlg); break; } #endif case stfio::cfs: { stfio::exportCFSFile(fName, Data, progDlg); break; } case stfio::hdf5: { stfio::exportHDF5File(fName, Data, progDlg); break; } case stfio::igor: { stfio::exportIGORFile(fName, Data, progDlg); break; } default: throw std::runtime_error("Trying to write an unsupported dataformat."); } } catch (...) { throw; } return true; } Vector_double stfio::vec_scal_plus(const Vector_double& vec, double scalar) { Vector_double ret_vec(vec.size(), scalar); std::transform(vec.begin(), vec.end(), ret_vec.begin(), ret_vec.begin(), std::plus()); return ret_vec; } Vector_double stfio::vec_scal_minus(const Vector_double& vec, double scalar) { Vector_double ret_vec(vec.size(), scalar); std::transform(vec.begin(), vec.end(), ret_vec.begin(), ret_vec.begin(), std::minus()); return ret_vec; } Vector_double stfio::vec_scal_mul(const Vector_double& vec, double scalar) { Vector_double ret_vec(vec.size(), scalar); std::transform(vec.begin(), vec.end(), ret_vec.begin(), ret_vec.begin(), std::multiplies()); return ret_vec; } Vector_double stfio::vec_scal_div(const Vector_double& vec, double scalar) { Vector_double ret_vec(vec.size(), scalar); std::transform(vec.begin(), vec.end(), ret_vec.begin(), ret_vec.begin(), std::divides()); return ret_vec; } Vector_double stfio::vec_vec_plus(const Vector_double& vec1, const Vector_double& vec2) { Vector_double ret_vec(vec1.size()); std::transform(vec1.begin(), vec1.end(), vec2.begin(), ret_vec.begin(), std::plus()); return ret_vec; } Vector_double stfio::vec_vec_minus(const Vector_double& vec1, const Vector_double& vec2) { Vector_double ret_vec(vec1.size()); std::transform(vec1.begin(), vec1.end(), vec2.begin(), ret_vec.begin(), std::minus()); return ret_vec; } Vector_double stfio::vec_vec_mul(const Vector_double& vec1, const Vector_double& vec2) { Vector_double ret_vec(vec1.size()); std::transform(vec1.begin(), vec1.end(), vec2.begin(), ret_vec.begin(), std::multiplies()); return ret_vec; } Vector_double stfio::vec_vec_div(const Vector_double& vec1, const Vector_double& vec2) { Vector_double ret_vec(vec1.size()); std::transform(vec1.begin(), vec1.end(), vec2.begin(), ret_vec.begin(), std::divides()); return ret_vec; } Recording stfio::concatenate(const Recording& src, const std::vector& sections, ProgressInfo& progDlg) { size_t nc, NC = src.size(); Recording Concatenated(NC, 1); for (nc = 0; nc < NC; nc++) { int new_size=0; for (c_st_it cit = sections.begin(); cit != sections.end(); cit++) { new_size += (int)src[nc][*cit].size(); } Section TempSection(new_size); std::size_t n_new=0; std::size_t n_s=0; for (c_st_it cit = sections.begin(); cit != sections.end(); cit++) { std::ostringstream progStr; progStr << "Adding section #" << (int)n_s+1 << " of " << (int)sections.size(); progDlg.Update( (int)((double)n_s/(double)sections.size()*100.0), progStr.str() ); if (cit == sections.begin()) { TempSection.SetXScale(src[nc][*cit].GetXScale()); } else if (TempSection.GetXScale() != src[nc][*cit].GetXScale()) { Concatenated.resize(0); throw std::runtime_error("can not concatanate because sampling frequency differs"); } std::size_t secSize=src[nc][*cit].size(); if (n_new+secSize>TempSection.size()) { Concatenated.resize(0); throw std::runtime_error("memory allocation error"); } std::copy(src[nc][*cit].get().begin(), src[nc][*cit].get().end(), &TempSection[n_new]); n_new += secSize; n_s++; } TempSection.SetSectionDescription(src[nc][0].GetSectionDescription() + ", concatenated"); Channel TempChannel(TempSection); TempChannel.SetChannelName(src[nc].GetChannelName()); TempChannel.SetYUnits(src[nc].GetYUnits()); Concatenated.InsertChannel(TempChannel, nc); } // Recording Concatenated(TempChannel); Concatenated.CopyAttributes(src); return Concatenated; } Recording stfio::multiply(const Recording& src, const std::vector& sections, std::size_t channel, double factor) { Channel TempChannel(sections.size(), src[channel][sections[0]].size()); std::size_t n = 0; for (c_st_it cit = sections.begin(); cit != sections.end(); cit++) { // Multiply the valarray in Data: Section TempSection(stfio::vec_scal_mul(src[channel][*cit].get(),factor)); TempSection.SetXScale(src[channel][*cit].GetXScale()); TempSection.SetSectionDescription( src[channel][*cit].GetSectionDescription()+ ", multiplied" ); try { TempChannel.InsertSection(TempSection, n); } catch (const std::out_of_range e) { throw e; } n++; } if (TempChannel.size()>0) { Recording Multiplied(TempChannel); Multiplied.CopyAttributes(src); Multiplied[0].SetYUnits( src.at( channel ).GetYUnits() ); return Multiplied; } else { throw std::runtime_error("Channel empty in stfio::multiply"); } } stimfit-0.16.0/src/libstfio/recording.cpp0000775000175000017500000003030113277303516015271 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "./stfio.h" #include "./recording.h" #include #include #include Recording::Recording(void) : ChannelArray(0) { init(); } Recording::Recording(const Channel& c_Channel) : ChannelArray(1,c_Channel) { init(); } Recording::Recording(const std::deque& ChannelList) : ChannelArray(ChannelList) { init(); } Recording::Recording(std::size_t c_n_channels, std::size_t c_n_sections, std::size_t c_n_points) : ChannelArray(c_n_channels, Channel(c_n_sections, c_n_points)) { init(); } void Recording::init() { file_description = "\0"; global_section_description = "\0"; scaling = "\0"; comment = "\0"; xunits = "ms" ; dt = 1.0; // get current time time_t timer; timer = time(0); memcpy(&datetime, localtime(&timer), sizeof(datetime)); cc = 0; sc = 1; cs = 0; selectedSections = std::vector(0); selectBase = Vector_double(0); sectionMarker = std::vector(0); } Recording::~Recording() { } const Channel& Recording::at(std::size_t n_c) const { try { return ChannelArray.at(n_c); } catch (...) { throw; } } Channel& Recording::at(std::size_t n_c) { try { return ChannelArray.at(n_c); } catch (...) { throw; } } const std::string& Recording::GetDate() { // TODO: there should be a more elegant way than using variable 'date' date.resize(128); struct tm t = GetDateTime(); snprintf((char*)date.c_str(), 128, "%04i-%02i-%02i", t.tm_year+1900, t.tm_mon+1, t.tm_mday); return date; }; const std::string& Recording::GetTime() { // TODO: there should be a more elegant way than using variable 'time0' time0.resize(128); struct tm t = GetDateTime(); snprintf((char*)time0.c_str(), 128, "%02i:%02i:%02i", t.tm_hour,t.tm_min,t.tm_sec); return time0; }; int Recording::SetDate(const std::string& value) { struct tm t = GetDateTime(); #if HAVE_STRPTIME_H strptime(value.c_str(), "%F", &t); #else if ( sscanf(value.c_str(),"%i-%i-%i", &t.tm_year, &t.tm_mon, &t.tm_mday) || sscanf(value.c_str(),"%i.%i.%i", &t.tm_mday, &t.tm_mon, &t.tm_year) || sscanf(value.c_str(),"%i/%i/%i", &t.tm_mon, &t.tm_mday, &t.tm_year) ) { t.tm_mon--; if (t.tm_year < 50) t.tm_year += 100; else if (t.tm_year < 139); else if (t.tm_year > 1900) t.tm_year -= 1900; } else { // TODO: error handling fprintf(stderr,"SetDate(%s) failed\n",value.c_str()); return(-1); } #endif SetDateTime(t); return(0); } int Recording::SetTime(const std::string& value) { struct tm t = GetDateTime(); #if HAVE_STRPTIME_H strptime(value.c_str(), "%T", &t); #else if ( sscanf(value.c_str(),"%i-%i-%i", &t.tm_hour, &t.tm_min, &t.tm_sec) || sscanf(value.c_str(),"%i.%i.%i", &t.tm_hour, &t.tm_min, &t.tm_sec) || sscanf(value.c_str(),"%i:%i:%i", &t.tm_hour, &t.tm_min, &t.tm_sec) ) { ; // everthing is fine } else { // TODO: error handling fprintf(stderr,"SetTime(%s) failed\n",value.c_str()); return(-1); } #endif SetDateTime(t); return(0); } int Recording::SetTime(int hour, int minute, int sec) { datetime.tm_hour=hour; datetime.tm_min=minute; datetime.tm_sec=sec; return(0); } int Recording::SetDate(int year, int month, int mday) { datetime.tm_year=year; datetime.tm_mon=month; datetime.tm_mday=mday; return(0); } void Recording::SetDateTime(int year, int month, int mday,int hour, int minute, int sec) { datetime.tm_year=year; datetime.tm_mon=month; datetime.tm_mday=mday; datetime.tm_hour=hour; datetime.tm_min=minute; datetime.tm_sec=sec; } void Recording::InsertChannel(Channel& c_Channel, std::size_t pos) { try { if ( ChannelArray.at(pos).size() <= c_Channel.size() ) { ChannelArray.at(pos).resize( c_Channel.size() ); } // Resize sections if necessary: std::size_t n_sec = 0; for ( sec_it sit = c_Channel.get().begin(); sit != c_Channel.get().end(); ++sit ) { if ( ChannelArray.at(pos).at(n_sec).size() <= sit->size() ) { ChannelArray.at(pos).at(n_sec).get_w().resize( sit->size() ); } n_sec++; } } catch (...) { throw; } ChannelArray.at(pos) = c_Channel; } void Recording::CopyAttributes(const Recording& c_Recording) { file_description=c_Recording.file_description; global_section_description=c_Recording.global_section_description; scaling=c_Recording.scaling; datetime=c_Recording.datetime; comment=c_Recording.comment; for ( std::size_t n_ch = 0; n_ch < c_Recording.size(); ++n_ch ) { if ( size() > n_ch ) { ChannelArray[n_ch].SetYUnits( c_Recording[n_ch].GetYUnits() ); } } dt=c_Recording.dt; } void Recording::resize(std::size_t c_n_channels) { ChannelArray.resize(c_n_channels); } size_t Recording::GetChannelSize(std::size_t n_channel) const { try { return ChannelArray.at(n_channel).size(); } catch (...) { throw; } } void Recording::SetCurChIndex(size_t value) { if (value>=get().size()) { throw std::out_of_range("channel out of range in Recording::SetCurChIndex()"); } cc=value; } void Recording::SetSecChIndex(size_t value) { if (value>=get().size() || value==cc) { throw std::out_of_range("channel out of range in Recording::SetSecChIndex()"); } sc=value; } void Recording::SetCurSecIndex( size_t value ) { if (value >= get()[cc].size()) { throw std::out_of_range("channel out of range in Recording::SetCurSecIndex()"); } cs=value; } void Recording::SelectTrace(std::size_t sectionToSelect, std::size_t base_start, std::size_t base_end) { // Check range so that sectionToSelect can be used // without checking again: if (sectionToSelect>=curch().size()) { std::out_of_range e("subscript out of range in Recording::SelectTrace\n"); throw e; } selectedSections.push_back(sectionToSelect); double sumY=0; if (curch()[sectionToSelect].size()==0) { selectBase.push_back(0); } else { int start = base_start; int end = base_end; if (start > (int)curch()[sectionToSelect].size()-1) start = curch()[sectionToSelect].size()-1; if (start < 0) start = 0; if (end > (int)curch()[sectionToSelect].size()-1) end = curch()[sectionToSelect].size()-1; if (end < 0) end = 0; #ifdef _OPENMP #pragma omp parallel for reduction(+:sumY) #endif for (int i=start; i<=end; i++) { sumY += curch()[sectionToSelect][i]; } int n=(int)(end-start+1); selectBase.push_back(sumY/n); } } bool Recording::UnselectTrace(std::size_t sectionToUnselect) { //verify whether the trace has really been selected and find the //number of the trace within the selectedTraces array: bool traceSelected=false; std::size_t traceToRemove=0; for (std::size_t n=0; n < selectedSections.size() && !traceSelected; ++n) { if (selectedSections[n] == sectionToUnselect) traceSelected=true; if (traceSelected) traceToRemove=n; } //Shift the selectedTraces array by one position, beginning //with the trace to remove: if (traceSelected) { //shift traces by one position: for (std::size_t k=traceToRemove; k < GetSelectedSections().size()-1; ++k) { selectedSections[k]=selectedSections[k+1]; selectBase[k]=selectBase[k+1]; } // resize vectors: selectedSections.resize(selectedSections.size()-1); selectBase.resize(selectBase.size()-1); return true; } else { //msgbox return false; } } void Recording::SetXScale(double value) { dt=value; for (ch_it it1 = ChannelArray.begin(); it1 != ChannelArray.end(); it1++) { for (sec_it it2 = it1->get().begin(); it2 != it1->get().end(); it2++) { it2->SetXScale(value); } } } void Recording::MakeAverage(Section& AverageReturn, Section& SigReturn, std::size_t channel, const std::vector& section_index, bool isSig, const std::vector& shift) const { if (channel >= ChannelArray.size()) { throw std::out_of_range("Channel number out of range in Recording::MakeAverage"); } unsigned int n_sections = section_index.size(); if (shift.size() != n_sections) { throw std::out_of_range("Shift out of range in Recording::MakeAverage"); } for (unsigned int l = 0; l < n_sections; ++l) { if (section_index[l] >= ChannelArray[channel].size()) { throw std::out_of_range("Section number out of range in Recording::MakeAverage"); } if (AverageReturn.size() + shift[l] > ChannelArray[channel][section_index[l]].size()) { throw std::out_of_range("Sampling point out of range in Recording::MakeAverage"); } } for (unsigned int k=0; k < AverageReturn.size(); ++k) { AverageReturn[k]=0.0; //Calculate average for (unsigned int l = 0; l < n_sections; ++l) { AverageReturn[k] += ChannelArray[channel][section_index[l]][k+shift[l]]; } AverageReturn[k] /= n_sections; // set sample interval of averaged traces AverageReturn.SetXScale(ChannelArray[channel][section_index[0]].GetXScale()); if (isSig) { SigReturn[k]=0.0; //Calculate variance for (unsigned int l=0; l < n_sections; ++l) { SigReturn[k] += pow(ChannelArray[channel][section_index[l]][k+shift[l]] - AverageReturn[k], 2); } SigReturn[k] /= (n_sections - 1); SigReturn[k]=sqrt(SigReturn[k]); } } } void Recording::AddRec(const Recording &toAdd) { // check number of channels: if (toAdd.size()!=size()) { throw std::runtime_error("Number of channels doesn't match"); } // check dt: if (toAdd.GetXScale()!=dt) { throw std::runtime_error("Sampling interval doesn't match"); } // add sections: std::deque< Channel >::iterator it; std::size_t n_c = 0; for (it = ChannelArray.begin();it != ChannelArray.end(); it++) { std::size_t old_size = it->size(); it->resize(toAdd[n_c].size()+old_size); for (std::size_t n_s=old_size;n_sInsertSection(toAdd[n_c].at(n_s-old_size),n_s); } catch (...) { throw; } } n_c++; } } std::string Recording::GetEventDescription(int type) { return listOfMarkers[type]; } void Recording::SetEventDescription(int type, const char* Description) { listOfMarkers[type] = Description; } void Recording::InitSectionMarkerList(size_t n) { sectionMarker.resize(n); return; } int Recording::GetSectionType(size_t section_number) { return sectionMarker[section_number]; } void Recording::SetSectionType(size_t section_number, int type) { sectionMarker[section_number]=type; return; } stimfit-0.16.0/src/libstfio/section.cpp0000775000175000017500000000366213277303516014773 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "./stfio.h" #include "./section.h" // Definitions------------------------------------------------------------ // Default constructor definition // For reasons why to use member initializer lists instead of assignments // within the constructor, see [1]248 and [2]28 Section::Section(void) : section_description(), x_scale(1.0), data(0) {} Section::Section( const Vector_double& valA, const std::string& label ) : section_description(label), x_scale(1.0), data(valA) {} Section::Section(std::size_t size, const std::string& label) : section_description(label), x_scale(1.0), data(size) {} Section::~Section(void) { } double Section::at(std::size_t at_) const { if (at_>=data.size()) { std::out_of_range e("subscript out of range in class Section"); throw (e); } return data[at_]; } double& Section::at(std::size_t at_) { if (at_>=data.size()) { std::out_of_range e("subscript out of range in class Section"); throw (e); } return data[at_]; } void Section::SetXScale( double value ) { if ( x_scale >= 0 ) x_scale=value; else throw std::runtime_error( "Attempt to set x-scale <= 0" ); } stimfit-0.16.0/src/libstfio/cfs/0000775000175000017500000000000013567226445013453 500000000000000stimfit-0.16.0/src/libstfio/cfs/cfslib.h0000775000175000017500000000331613277303516015005 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file cfslib.h * \author Christoph Schmidt-Hieber * \date 2008-01-23 * \brief Import from and export to the CED filing system. */ #ifndef _CFSLIB_H #define _CFSLIB_H #include "../stfio.h" class Recording; namespace stfio { //! Open a CFS file and store its contents to a Recording object. /*! \param fName Full path to the file to be read. * \param ReturnData On entry, an empty Recording object. On exit, * the data stored in \e fName. * \param progress Set to true if a progress dialog should be updated. * \return 0 upon success, a negative error code upon failure. */ int importCFSFile(const std::string& fName, Recording& ReturnData, ProgressInfo& progDlg); //! Export a Recording to a CFS file. /*! \param fName Full path to the file to be written. * \param WData The data to be exported. * \return The CFS file handle. */ StfioDll bool exportCFSFile(const std::string& fName, const Recording& WData, ProgressInfo& progDlg); } #endif stimfit-0.16.0/src/libstfio/cfs/cfs.c0000775000175000017500000060665213277303516014325 00000000000000/***************************************************************************** ** ** MSC version of CFS functions ** ** Copyright (c) Cambridge Electronic Design Limited 1988 .. 1999 ** ** Started by J.Grayer 13th Oct 1990 ** ** V 2.11 Maximum file size upped to c. 1 GByte TDB 12-Jun-91 ** ** V 2.12 Changes made so data pointers changed to _far so that the ** user may use any model and still put large data items outside ** the default data segment. ** ** V 2.13 JG 17th Jan 1992 ** Re-jigged various things so all non_ANSI functions now appear in ** msio.h/c. ** Bug corrected in which table pointer did not get reset to NULL ** when a file was opened with the pointer table not in memory. ** Change made to SetComment so it can be used with a file opened in ** edit mode. ** Re-did the flag usage. ** When file opened in edit mode and nothing changed file not updated. ** Bug in recoverTable fixed. ** ** V 2.14 JG 8th Jun 1992 ** Small change to WriteData so it doesnt truncate the file if number ** of bytes to write is given as zero. ** (12th June v.minor change: added return statemnt to TransferTable ** function.) ** ** V 2.15 JG 24th Jun 1992 ** Change to GetChanData so you can read from the current data section ** provided you have called SetDSChan. ** ** V 2.16 TDB 24th Jul 1992 ** Changes to GetChanData (above) corrected. GetDSChan and GetHeader ** adjusted to work online. Began work on tidying code ** ** V 2.17 JCN 24-Aug-92 ** Added routine ClearDS to abandon current DS by setting dataSz back ** to 0 and resetting fileSz to dataSt. On closing the file no ** InsertDs will then be called and file will not include the empty ** data set. ** Commented out the calls to InternalError in GetMemTable. ** ** V 2.18 TDB 16-Sep-92 ** Removed InternalError calls from GetMemTable, fixed bug in ** GetMemTable, brought up to v 2.18. ** ** V 2.20 KJ 6-Jun-93, Version for DOS, WINDOWS and MACINTOSH. ** ** MAE - for macintosh definitions of OpenCFSFile & CreateCFSFile ** would be good idea to use FSSpec instead of 3 separate params ** for name, vRefNum & dirID. ** Also note that changing the type TSFlags from bit fields to ** a WORD has swapped the 2 flag bytes over on the macintosh, ** but not on the PC (Horace Townsends convertor programme no ** longer works.) ** May want to use FindFolder to get the temporary folder, and ** create the temporary files in that. ** ** V 2.20 KJ 14-Jul-93, ** Tidied up errors handling calls in OpenCFSFile, CloseCFSFile ** and TransferTable routines. ** ** V 2.30 KJ 01-Sep-93, ** CommitCFSFile function added. ** This is used to write the head and data sections info ** to to the disk file and to commit all the data currently ** in buffers for the given handle. ** Assert function implemented whereever possible. ** Error mechanism altered, so that all errors are logged ** so they can be retreived by FileError. ** ** V 2.31 TDB 02/Nov/93 ** Removed requirement for oldnames in link (now ANSII names ** throughout. Fixed GP faults caused by empty file. Tested ** with Visual Basic in DLL form, created Visual Basic Interface ** file. Altered Windows file I/O to use C LLIO (non-stream) ** mechanisms, as Windows _lopen set does not include set ** file length function! CFS16.MAK now uses large model. ** ** V 2.32 TDB 25/Feb/94 ** Redid CommitCFSFile so that all errors trapped, code for ** first error is code returned, and all errors logged using ** InternalError. ** ** V 2.33 TDB 07/Dec/95 ** Fixed trivial problems causing warnings in 32-bit build, now ** commit code uses correct close function (probably irrelevant) ** and MSVC make file etc for 32-bit build generated. Ensured ** that errors in Open/Create calls are passed to InternalError. ** ** V 2.40 TDB 02/May/96 ** Added CFSFileSize function. TDataKind changed to TCFSKind to ** prevent name clash with SON library. Extended file open checks ** to detect file too short to be a CFS file - get BADVER error ** instead of read error. ** ** V 2.41 TDB 16/May/96 ** Changed pointer parameters to const forms wherever appropriate. ** ** V 2.50 TDB 08/Nov/96 ** Changed GetVarVal, SetVarVal and DSFlags so that all of these ** can be used freely on new files, with 0 specifing the new DS ** and other section parameters specifying the DS as expected. ** ** V 2.51 TDB 12/May/97 ** Changed SetDSChan and WriteData as above, both can be used on ** all data sections of a new file, with DS set to 0 or n. ** ** V 2.52 TDB 27/May/98 ** Altered StoreTable so that it will increase the size of the ** memory table if necessary - for AppendDS. Also tidied up the ** AppendDS code. ** ** v 2.60 TDB 24/Feb/99 ** Switched to using non handle-based memory allocation (basically ** malloc) for WIN32 builds, file table is extended as required ** to allow unlimited numbers of open files. Now uses WIN32 file ** I/O functions as required, plus AppendDS has been fixed - it ** was not calling FileUpdate to get the pointer table off the end ** of the file - leading to corrupted files. ** ** v 2.61 TDB 28/Apr/99 ** Adjusted handling of DS table so that 32-bit build can handle ** up to 64000 data sections. Changed LoadData & FileData. ** ** v 2.62 SMP 16/Mar/00 ** ClearDS now returns a value when it succeeds! ** Fixed AppendDS so it now no longer produces a duff DSHeader ** if called multiple times ** ** v 2.63 SMP 04/Apr/00 ** Temp file name can now be up to 300 chars long. ** ** v 2.64 SMP 01/Jun/00 ** Buffer sizes >= 64k now work without crashing or inefficency in ** the 32 bit build. ** ** v 2.65 SMP 16/Aug/00 ** AppendDS no longer looses changes to the previously appended DS ** In particular the scaling factors are maintained. ** ** v 2.66 SMP 13/Mar/01 ** ASSERT definition changed to use _DEBUG and not DEBUG ** Meaningless ASSERT removed from AppendDS ** ** v 2.67 SMP 27/Feb/02 ** CreateCFSFile was trying to flag errors by setting a handle to ** -1. This wouldn't work under Windows so errors went unreported. ** ** v 2.68 SMP 17/Jan/03 ** Added SUBSIDIARY channel kind *****************************************************************************/ #include /* C library I/O functions */ #include /* C library type checking functions */ #include /* C library data conversion + misc functions */ #include /* C library time and date functions */ #include /* C library string function definitions */ /************************************************************************* ** ** These are the machine specific definitions and includes. Some of them ** are not really machine specific, but I've put them here anyway. first ** of all are the system defines, next machine global, finally specific ** ** Remove the NDEBUG definition to cause the asserts to be used ** The LLIO (low level i/o) should be undefined to use streams library and ** defined for low level. This is to make it a bit easier to implement the ** code on different machines which may not have the low level stuff. ** LLIO is defined in cfs.h and used in cfs.h and here ** ** ** macintosh and MSC are set by the compiler, and define machine type ** _IS_MSDOS_ set in machine.h for an msdos native mode build ** _IS_WINDOWS_ set in machine.h for windows 16 or 32 bit mode ** qDebug (mac)set by MPW to enable debug fprintf ** ** NDEBUG gets rid of the asserts. ** USEHANDLES To use memory handles in place of pointers. This form is ** supported by code generated for the Mac and Windows forms. ** Actually, it is ignored. ** ** LLIO (dos) if defined, low level I/O is used, otherwise streams. ** CFSCONVERT (mac) define if we should convert format (little-big endian) ** [convert (mac) specifies direction of conversion - for CfsConvert] ** ** #undef NDEBUG No asserts if this is defined ** */ #if defined(qDebug) || defined(_STFDEBUG) #undef NDEBUG #include #define ASSERT(x) assert(x) #else #define NDEBUG 1 #define ASSERT(x) #endif #include "cfs.h" /* Exported type, constant and function definitions */ #ifdef CFSCONVERT #include "CfsConv.h" #endif /* define some constants needed in the program */ #define INITCEDFILES 16 /* Initial file array length */ #define MAXCEDFILES 2048 /* Max no. files for WINDOWS */ #define NDATATYPE 8 /* number of data types defined in CFS */ #define NDATAKIND 3 /* number of data kinds defined in CFS */ #define MAXCHANS 100 /* max number of channels of data in CFS file */ #define MAXFILVARS 100 /* max File varaibles in CFS file */ #define MAXDSVARS 100 /* max data Sections in CFS file */ #define MAXSTR 256 /* max CFS string length including NULL */ #define CEDMARKER "CEDFILE\"" /* Version 1 marker */ #define PARTMARK "CEDFILE" /* Marker for testing old files */ #define MAXLSEEK 2000000000 /* Roughly 2 GByte, the maximum file size */ #define MAXFORWRD 65535 /* maximum value for unsigned short */ #define MAXNODS 64000 /* alloc restrictions are looser for WIN32 */ #define MAXMEMALLOC 65519 /* get problems if try to allocate more */ #define WHOLEFILECHARS 1024/* to hold whole of temp file name including path */ #define MARKERCHARS 8 /* characters in file marker */ #define PARTMARKCHARS 7 /* characters to test for old version file */ #define MAXFNCHARS 1024 /* characters to test for file name */ /* define error codes */ #define NOHANDLE -1 #define BADHANDLE -2 #define NOTWRIT -3 #define NOTWORE -4 #define NOTWORR -5 #define NOTOPEN -6 #define BADVER -7 #define NOMEMR -8 #define BADCREAT -11 #define BADOPEN -12 #define READERR -13 #define WRITERR -14 #define RDDS -15 #define WRDS -16 #define DISKPOS -17 #define BADINS -18 #define BADFL -19 #define BADDESC -20 #define BADPAR -21 #define BADCHAN -22 #define XSDS -23 #define BADDS -24 #define BADKIND -25 #define BADVARN -26 /* to convert marker char to old version number */ #define BADDSZ -27 #define BADOLDVER -39 /* define file access mode */ #define rMode 0 /* READ only */ #define wMode 2 /* WRITE only */ #define rwMode 0 /* READ|WRITE used to open new file */ /* define types which give data structure of CFS file */ typedef char TBigName[WHOLEFILECHARS+2]; /* for temp file name */ typedef char TMarker[MARKERCHARS]; /* for CED file marker */ #pragma pack(1) /* 1. for file header (fixed) channel information */ typedef struct { TDesc chanName; /* users name for channel, 20 chars */ TUnits unitsY; /* name of Yunits 8 chars */ TUnits unitsX; /* name of xunits 8 chars */ TDataType dType; /* storage type 1 of 8 allowed */ TCFSKind dKind; /* equalspaced, matrix or subsidiary */ short dSpacing; /* bytes between elements */ short otherChan; /* used for matrix data */ } TFilChInfo; typedef TFilChInfo TFilChArr[MAXCHANS]; /* 2. for data section (may vary with DS) channel information */ typedef struct { CFSLONG dataOffset; CFSLONG dataPoints; float scaleY; float offsetY; float scaleX; float offsetX; } TDSChInfo; typedef TDSChInfo TDSChArr[MAXCHANS]; /* 3. for data section headers */ typedef struct { CFSLONG lastDS; /* offset in file of header of previous DS */ CFSLONG dataSt; /* data start position */ CFSLONG dataSz; /* data size in bytes */ TSFlags flags; /* flags for this section */ short dSpace[8]; /* spare space */ TDSChArr DSChArr; /* array of DS channel info */ } TDataHead; /* 4. for the file header */ typedef struct { TMarker marker; TFileName name; CFSLONG fileSz; char timeStr[8]; char dateStr[8]; short dataChans; /* number of channels of data */ short filVars; /* number of file variables */ short datVars; /* number of data section variables */ short fileHeadSz; short dataHeadSz; CFSLONG endPnt; /* offset in file of header of last DS */ WORD dataSecs; /* number of data sections */ WORD diskBlkSize; /* usually 1 or 512 */ TComment commentStr; CFSLONG tablePos; /* offset in file for start of table of DS header offsets */ short fSpace[20]; /* spare */ TFilChArr FilChArr; /* array of fixed channel info */ } TFileHead; #pragma pack() #if !defined(_IS_WINDOWS_) || defined(__MINGW32__) typedef TFileHead * TpFHead; /* pointer to start of file header */ typedef TDataHead * TpDHead; /* pointer to start of data header */ typedef TDSChInfo * TpDsInfo; typedef TFilChInfo * TpChInfo; #else typedef TFileHead FAR * TpFHead; /* pointer to start of file header */ typedef TDataHead FAR * TpDHead; /* pointer to start of data header */ typedef TDSChInfo FAR * TpDsInfo; typedef TFilChInfo FAR * TpChInfo; #endif typedef enum /* define types to describe file in program */ { reading, writing, editing, nothing } TAllowed; typedef struct { fDef p ; /* file handle */ fDef d ; /* file handle */ } TDOSHdl; typedef struct { TpVDesc nameP; /* pointers to start of variable descriptions */ TpSStr dataP; /* pointers to corresponding data storage */ } TPointers; typedef struct /* for storing and sending back current error information */ { short eFound; short eHandleNo; short eProcNo; short eErrNo; } TError; typedef struct /* For program to keep track of storage locations */ { TAllowed allowed; /* current state of this set of TFileInfo */ // THandle fHeadH; /* handle to area for file head */ // THandle dHeadH; /* handle to area for data section */ // THandle eHeadH; /* handle to area for insert data section */ // THandle tableH; /* handle to area for offsets of ds headers */ TpFHead fileHeadP; /* to storage allocated for general header */ TpDHead dataHeadP; /* to storage allocated for data section header */ TpDHead extHeadP; /* to storage allocated for Insert data section */ TPointers FVPoint; /* to descriptions and values of file variables */ TPointers DSPoint; /* to descrip and values of data section variables */ TpLong tableP; /* array of offsets in the file of the DS headers */ TDOSHdl DOSHdl; TBigName tempFName; WORD thisSection; short DSAltered; } TFileInfo; /*********************** CFS FILE STRUCTURE ***************************** ** ** The file header consist of a struct of type TFileHead less the final ** array which is replaced by fixed info array for each channel + file and ** DS vraiable descriptions + byte array containing values of the file data ** variables. ** The file also contains the channel data and the data sections. How these ** are arranged in the file is not defined. Each data section (DS) consists ** of a struct of type TDataHead less the final array which is replaced by ** DS info array for each cahnnel + byte array containing values of the DS ** data variables for that DS. ** The position and size of the actual channel data is in the DS header. ** At the end of the file is a table of pointers to the start of each DS. ** *****************************************************************************/ /**************************************************************************** ** ** Global Variables Declaration and Initialisation ** NB declare near so they go in the default data segment. ** ** 1. Declare pointer to FileInfo and initialise to null, set global ** array length info to zero. ** *****************************************************************************/ int g_maxCfsFiles = 0; /* The length of the array of file info */ TFileInfo* g_fileInfo = NULL; /**************************************************************************** ** ** 2. Declare an error structure and initialise all fields to zero. ** *****************************************************************************/ #if !defined(_IS_WINDOWS_) || defined(__MINGW32__) TError errorInfo = {0,0,0,0}; #else TError _near errorInfo = {0,0,0,0}; #endif char gWorkStr[MAXFNCHARS]; /* Global var on DS to avoid DLL SS != DS problems */ /* Local function definitions */ static void CleanUpCfs(void); static short FindUnusedHandle(void); static short SetSizes(TpCVDesc theArray,TpShort offsetArray,short numVars); static void TransferIn(TpCStr olds,TpStr pNew,BYTE max); static void TransferOut(TpCStr olds,TpStr pNew,BYTE max); static void SetVarDescs(short numOfVars,TPointers varPoint, TpCVDesc useArray,TpShort Offsets,short vSpace); static CFSLONG BlockRound(short handle,CFSLONG raw); static void InternalError(short handle,short proc,short err); static short GetHeader(short handle,WORD getSection); static short FileData(short handle, TpVoid startP, CFSLONG st, CFSLONG sz); static short LoadData(short handle, TpVoid startP, CFSLONG st, CFSLONG sz); static CFSLONG GetTable(short handle, WORD position); static void StoreTable(short handle,WORD position,CFSLONG DSPointer); static short RecoverTable(short handle,TpLong relSize,TpLong tPos, TpUShort dSecs,TpLong fSize); static short TransferTable(WORD sects, fDef rdHdl, fDef wrHdl); static short GetMemTable(short handle); static TpStr AllocateSpace(TpUShort sizeP, WORD steps); static void ExtractBytes(TpStr destP,WORD dataOffset, TpStr srcP,WORD points,WORD spacing,WORD ptSz); static short FileUpdate(short handle,TpFHead fileHP); /* Function definitions for IO functions . */ static short TempName(short handle,TpCStr name,TpStr str2, unsigned str2len); static short CCreat(TpCStr name, short mode, fDef* pFile); static short CUnlink(TpCStr path); static short COpen(TpCStr name, short mode, fDef* pFile); static short CCloseAndUnlink(fDef handle, TpCStr path); static CFSLONG CGetFileLen(fDef handle); static short CClose(fDef handle); static CFSLONG CLSeek(fDef handle, CFSLONG offset, short mode); static WORD CReadHandle(fDef handle,TpStr buffer, WORD bytes); static WORD CWriteHandle(fDef handle,TpStr buffer, WORD bytes); static void CMovel(TpVoid dest,const TpVoid src, int count); static short CSetFileLen(fDef handle, CFSLONG size); static TpVoid CMemAllcn(int size); static void CFreeAllcn(TpVoid p); static void CStrTime(char *timeStr); static void CStrDate(char *dateStr); /************************************************************************** ** ** Function definitions for IO functions . ** Set of C functions which call the MS ones in io.h ** THESE FUNCTIONS ARE FOR BINARY FILES. ** Changes made and memory allocation functions added to force FAR pointers ** ***************************************************************************/ /************************* CCreat ******************************** ** ** CCreat. This is very like the Pascal equiv in MSDOSLIB CREAT but only ** modes allowed are 0 Read/Write, 1 Read only ** ** Either creates a new file or opens and truncates an existing one. ** The mode is applied to newly opened files only. It sets the allowed ** file access after the file has been closed. ** ** On the Mac we have to explicitly create a new file before opening it ** If the file exists, we must truncate it. Then set the file type and ** creator. ** ** Return is handle value or -ve error code. ** ***************************************************************************/ short CCreat(TpCStr name, short mode, fDef* pFile) { short sErr = 0; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) DWORD dwMode; #else short pmode; char fname[MAXFNCHARS]; /* To get near variable holding string */ #endif fDef file; /* The various types of file handle */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) if (mode) /* Sort out the file access value */ dwMode = GENERIC_READ; else dwMode = GENERIC_READ | GENERIC_WRITE; file = CreateFileA(name, dwMode, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (file == INVALID_HANDLE_VALUE) sErr = BADCREAT; #else if (mode) pmode = S_IREAD; else pmode = S_IREAD|S_IWRITE; char* omode; if (mode) /* Sort out the file access value */ omode = "r"; else omode = "w+"; if (strlen(name) < MAXFNCHARS) F_strcpy(fname, name); /* Get filename in near var */ file = fopen(fname,omode); if (file == 0) sErr = -1; #endif if (sErr == 0) *pFile = file; return sErr; } /* end of CCreat */ /******************* 2. CUnlink for deleteing files. *********************** ** ** Delete file specified by path. Return 0 if ok, -ve error code ** ****************************************************************************/ short CUnlink(TpCStr path) { #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) int a; a = _unlink(path); /* C function in io.h */ if (a < 0) return (short)(0 - _doserrno); else return 0; #else return remove(path); /* C function in io.h */ #endif } /************* 3. CClose for closing files given DOS handle **************** ** ** Close the file associated with handle. ** Return 0 if ok or -ve error code. ** ****************************************************************************/ short CClose(fDef handle) { int res = 0; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) if (!CloseHandle(handle)) res = BADHANDLE; #else res = fclose(handle); #endif return (short)res; } /* end of CClose */ /************* CCloseAndUnlink closes then deletes the file **************** ** ** Closes the file associated with handle, and then deletes it ** Return 0 if ok or -ve error code. ** ****************************************************************************/ short CCloseAndUnlink(fDef handle, TpCStr path) { short err = 0; err = CClose(handle); #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) err = CUnlink(path); #else err += CUnlink(path); #endif return err; } /************* 4. CLSeek for moving file pointer *************************** ** ** Move the file pointer (ie. next position for read/write) by offset bytes ** in file with DOShandle handle from a start position depending on mode. ** Returns new file position or -ve error code ** *****************************************************************************/ CFSLONG CLSeek(fDef handle, /* DOS handle of file */ CFSLONG offset, /* amount to move in bytes */ short mode) /* 0 Move from file start 1 Move from current file position 2 Move from file end */ { #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) /* Windows seek */ CFSLONG res = 0; DWORD dwMode; switch (mode) { case 0 : dwMode = FILE_BEGIN; /* start of file */ break; case 1 : dwMode = FILE_CURRENT; /* current posn of file pointer */ break; case 2 : dwMode = FILE_END; /* end of file */ break; } res = SetFilePointer(handle, offset, NULL, dwMode); if (res == 0xFFFFFFFF) return DISKPOS; else return res; #else CFSLONG res; short origin = 0; switch (mode) { case 0 : origin = SEEK_SET; /* start of file */ break; case 1 : origin = SEEK_CUR; /* current position of file pointer */ break; case 2 : origin = SEEK_END; /* end of file */ break; } res = fseek (handle, offset, origin); /* stdio read */ if (res==0) { return ftell(handle); } else { return -1; } #endif } /* end of CLSeek */ /******************** 5. Transfer from file to buffer ********************** ** ** Transfer from current file position of file, specified by its DOS file ** handle, to the buffer the specified number of bytes.(counted from file) ** Return the number of bytes transferred to the buffer or zero if error. ** NB C Function _dos_read can have been successful and NOT give numread=bytes ** It can have read numread bytes then found EOF or the file can be text ** in which case CRLF is counted as 2 bytes in the file but only ** 1 byte (LF) in numread. ** *****************************************************************************/ WORD CReadHandle(fDef handle, TpStr buffer, WORD bytes) { #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) DWORD dwRead; if (ReadFile(handle, buffer, bytes, &dwRead, NULL)) return bytes; else return 0; #else if (fread(buffer,1,bytes,handle) != bytes) return 0; else return bytes; #endif }; /******************** 6. Transfer from buffer to file ********************** ** ** Transfer to current file position of file, specified by its DOS file ** handle, from the buffer the specified number of bytes. ** Return the number of bytes transferred from the buffer or zero if error. ** NB C Function _dos_write can have been successful and NOT give numwrt=bytes ** It can have written numwrt bytes then run out of disk space. ** If the file is of type text LF in the buffer is replaced by 2 bytes ** CRLF but numwrt is unchanged since it refers to the buffer bytes. ** *****************************************************************************/ WORD CWriteHandle(fDef handle, TpStr buffer, WORD bytes) { #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) DWORD dwWrit; if (WriteFile(handle, buffer, bytes, &dwWrit, NULL)) return bytes; else return 0; #else if (fwrite(buffer, 1, bytes, handle) != bytes) return 0; else return bytes; #endif } /* end of CWriteHandle */ /******************** 7. Memory transfer *********************************** ** ** Transfer count bytes from src to dest addresses. ** memcpy is used so any overlap of regions is not checked. ** *****************************************************************************/ void CMovel(TpVoid dest, const TpVoid src, int count) { TpVoid ret; /* for return pointer of memcpy */ ret = F_memcpy(dest,src,(size_t)count); /* C function from string.h */ return; }; /* end of CMovel */ /****** 8. Change file size. NB operates on file handle NOT file name *****/ short CSetFileLen(fDef handle, CFSLONG size) /* ** For a file specified by its DOS handle, extend or truncate file to length, ** in bytes, specified by size. File must be open for writing. ** Return 0 if successful, -DOS error code if not. */ { #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) if (SetFilePointer(handle, size, NULL, FILE_BEGIN) != 0xFFFFFFFF) if (SetEndOfFile(handle)) return 0; else return BADHANDLE; else return DISKPOS; #else return -1; #endif } /* end of CSetFileLen */ /****** 8a. Retrieve file size. NB operates on file handle NOT file name *****/ CFSLONG CGetFileLen(fDef pFile) /* ** For a file specified by its DOS handle, find the file size in bytes. ** Returns file size if successful, -DOS error code if not. */ { CFSLONG lSize; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) lSize = GetFileSize(pFile, NULL); if (lSize != -1) return lSize; else return BADHANDLE; #else fpos_t cur; if (fgetpos(pFile,&cur)!=0) return -1; if (fseek (pFile, 0, SEEK_END)!=0) return -1; lSize=ftell (pFile); if (fsetpos(pFile,&cur)!=0) return -1; return lSize; #endif } /* end of CGetFileLen */ /************** 9.Open an exisiting file of specified name ***************** ** ** Open file specified by its path. ** For mode = 0 Read only (default) ** = 1 Write only ** = 2 Read/Write. ** Return DOS file handle if ok DOS error code (-ve) if not. ** ** for the mac, we need vRefNum, which we hope to get from stdFile SFGetFile ** also we want to make sure we have a pascal string ** *****************************************************************************/ short COpen(TpCStr name, short mode, fDef* pFile) { short sRes = 0; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) fDef file; DWORD dwMode; switch (mode) /* use C library constants to set mode */ { case 1 : dwMode = GENERIC_WRITE; break; case 2 : dwMode = GENERIC_READ | GENERIC_WRITE; break; default: dwMode = GENERIC_READ; break; } file = CreateFileA(name, dwMode, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (file == INVALID_HANDLE_VALUE) sRes = BADOPEN; if (sRes == 0) *pFile = file; #else char fname[MAXFNCHARS]; /* To get near variable holding string */ char* omode; switch (mode) /* use C library constants to set mode */ { case 1 : omode = "w"; break; case 2 : omode = "r+"; break; default: omode = "r"; break; } if (strlen(name) < MAXFNCHARS) F_strcpy(fname, name); /* Get filename in near var */ *pFile = fopen(fname,omode); if (*pFile == 0) sRes = -1; #endif return sRes; } /************** 10. Allocate memory on the far heap ************************ ** ** Allocate size bytes of memory outside the default data segment and ** return a far pointer to it. ** *****************************************************************************/ TpVoid CMemAllcn(int size) { TpVoid p; p = F_malloc(size); /* Use a simple, non-handle based, allocation */ // if ((*dummy = (THandle) M_AllocMem(size)) != NULL) // p = M_MoveLockMem(*dummy); // else // p = NULL; return p; } /*************** 11.Free memory allocated by above function **************** ** ** Free memory allocated on far heap by _fmalloc. ** No return. ** *****************************************************************************/ void CFreeAllcn(TpVoid p) { F_free(p); /* Simple memory free mechanism */ // if (M_UnlockMem(*dummy)) // M_FreeMem(*dummy); } /*************** 12. Get the time as string in required format ************* ** ** Gets time formatted as hh:mm:ss. ** timeStr must be at least 9 bytes ** *****************************************************************************/ void CStrTime(char *timeStr) { #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) _strtime(timeStr); /* timsStr must be at least 9 bytes */ #else time_t now; struct tm *today; now = time(NULL); today = localtime(&now); strftime(timeStr, 9, "%H:%M:%S", today); #endif } /* end of CStrTime */ /************ 13. Get the date as string in the required format *********** ** ** gets the date formatted as dd/mm/yy. ** dateStr must be at least 9 bytes ** *****************************************************************************/ void CStrDate(char *dateStr) { #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) char sdata[9]; _strdate(dateStr); /* dateStr must be at least 9 bytes */ F_strncpy(sdata,dateStr,8); /* store time without NULL */ sdata[0] = dateStr[3]; sdata[1] = dateStr[4]; sdata[3] = dateStr[0]; sdata[4] = dateStr[1]; F_strncpy(dateStr,sdata,8); /* store time without NULL */ #else time_t now; struct tm *today; now = time(NULL); today = localtime(&now); strftime(dateStr, 9, "%d/%m/%y", today); #endif } /* end of CStrDate */ /*********************** CreateCFSFile ******************************** ** ** Function to create CFS file open it for writing and allocate storage ** space for header and data section structures ready to fill and write to ** the file when ready. ** ** On the Mac we have to explicitly create a new file before opening it ** If the file exists, we must truncate it. Then set the file type and ** creator. ** Returns file handle or -ve error code. ** *****************************************************************************/ CFSAPI(short) CreateCFSFile(TpCStr fname, /* name of file */ TpCStr comment, /* general comment */ WORD blockSize, /* 1 or 512 */ short channels, /* number of data channels */ TpCVDesc fileArray,/* file variable descriptions */ TpCVDesc DSArray, /* DS variable descriptions */ short fileVars, /* no. of file varables */ short DSVars) /* no. of DS variables */ { short proc = 18; /* function number for error record */ short retval; /* return value */ short sErr; /* for checking return codes */ short handle; /* CFS file handle */ WORD bytSz; /* used to calcualte space needed when allocating */ short search; /* loop varable */ short pathend = 0; /* end of path part of fname */ short filVarSpace; /* space needed for file and DS variable data */ short DSVarSpace; TpShort filOffsets; /* temp store offsets */ TpShort DSOffsets; /* temp store offsets */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif /* pointer for current files info in global array */ TpFHead pFileH; /* used to shorten pointers */ TpDHead pDataH; TpChInfo pFilChInfo; TpDsInfo pDSChInfo; /* 1. Get program file handle */ handle = FindUnusedHandle(); /* 0,1,2 or error */ if (handle < 0) { retval = NOHANDLE; /* error code for no spare handles */ InternalError(handle,proc,retval); return retval; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* 2. Open file for writing */ sErr = CCreat(fname, rwMode, &pfileInfo->DOSHdl.d);/* Open data file */ if (sErr != 0) { pfileInfo->DOSHdl.d = (fDef)-1; retval = sErr; /* error code for unopenable file */ InternalError(handle,proc,retval); return retval; } TempName(handle, fname, pfileInfo->tempFName, WHOLEFILECHARS+2); /* get temp file name */ sErr = CCreat(pfileInfo->tempFName, rwMode, &pfileInfo->DOSHdl.p); if (sErr != 0) { pfileInfo->DOSHdl.p = (fDef)-1; retval = sErr; goto Close_1; /* close CFS file before return */ } /* open temp file */ /* 3. Get space for file,DS and spare headers */ /* ** error code for problem with file or Ds variable sizing. ** allocate some space for the offset arrays used by SetSizes, there is ** allways 2 bytes of space allocated to avoid problem when either of ** these two equals 0 */ DSOffsets = (TpShort)CMemAllcn((2*DSVars+2)); filOffsets = (TpShort)CMemAllcn((2*fileVars+2)); if ((DSOffsets == NULL) || (filOffsets == NULL)) { retval = NOMEMR; goto Close0; } /* ** setsizes computes the total space needed to store the variables described ** and sets up an offset array which says whereabouts each variables would ** start if you stored all the variables in a byte list */ DSVarSpace = SetSizes(DSArray, DSOffsets, DSVars); filVarSpace = SetSizes(fileArray, filOffsets, fileVars); if ((filVarSpace < 0) || (DSVarSpace < 0)) { retval = BADDESC; goto Close0; } /* File header size consists of */ bytSz = (WORD)(sizeof(TFileHead) - sizeof(TFilChArr) + /* File header without array */ channels*sizeof(TFilChInfo) + /* Info for each channel */ ((fileVars+DSVars+2) * sizeof(TVarDesc)) + /* desc for each var */ filVarSpace); /* space computed for actual file variables */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) if (bytSz > (WORD)MAXMEMALLOC) { retval = NOMEMR; /* error code for not enough space */ goto Close0; /* dont attempt to allocate over max */ } #endif pfileInfo->fileHeadP = (TpFHead)CMemAllcn(bytSz); /* allocate space for file header */ pFileH = pfileInfo->fileHeadP; if (pFileH == NULL) { retval = NOMEMR; /* error code for not enough space */ goto Close0; /* clear up files before return */ } pFileH->fileHeadSz = (short)bytSz;/* save space in bytes for file head */ pFileH->diskBlkSize = blockSize; /* store blocksize specified */ /* ** Now do the Data Section header size */ bytSz = (WORD)(sizeof(TDataHead) - sizeof(TDSChArr) + /* Data header without array */ (channels * sizeof(TDSChInfo))+ /* Info for each channel */ DSVarSpace); /* DS varable data space */ /* round to nearest block */ bytSz = (WORD)(((bytSz+(WORD)(blockSize-1)) / blockSize)*blockSize); #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) if (bytSz>(WORD)MAXMEMALLOC) { retval = NOMEMR; goto Close1; } #endif pfileInfo->dataHeadP= (TpDHead)CMemAllcn(bytSz); /* allocate space for DS header */ pDataH = pfileInfo->dataHeadP; if (pDataH == NULL) { retval = NOMEMR; goto Close1; /* release file and allocated file header */ } pFileH->dataHeadSz = (short)bytSz; /* store DS header size in bytes */ pfileInfo->extHeadP = (TpDHead)CMemAllcn(bytSz); /* space for insert block (another DS header) */ if (pfileInfo->extHeadP == NULL) { retval = NOMEMR; goto Close2; /* release file,fileheader,data header */ } /* 4. Store variables in header checking range */ retval = BADPAR; /* error code for out of range */ if ( (channels < 0) || (fileVars < 0) || (DSVars < 0) || (channels >= MAXCHANS) || (fileVars >= MAXFILVARS) || (DSVars >= MAXDSVARS) ) { retval = NOMEMR; goto Close3; /* Release file file header data header insert block */ } pFileH->filVars = fileVars; /* store specified number of file vars */ pFileH->datVars = DSVars; /* store number of data section vars */ pFileH->dataChans= channels; /* store specified number of data channels */ /* 5. Set pointers to within spaces allocated to start of various items */ /* The fixed channel information following the general occupies fileChArr[channels] and the space straight after this is for the descrition of the file variables. */ pfileInfo->FVPoint.nameP = (TpVDesc)(pFileH->FilChArr+channels); /* The fixed file variable descriptions occupy nameP[filvars+1] and the data section variables start after them. */ pfileInfo->DSPoint.nameP = pfileInfo->FVPoint.nameP+fileVars+1; /* The data section variable descriptions occupy nameP[DSVars+1] then come the actual file variables */ pfileInfo->FVPoint.dataP = (TpSStr)(pfileInfo->DSPoint.nameP + DSVars+1); /* The actual data section variables are part of the data header (not fileheader) and come straight after the data section channel info */ pfileInfo->DSPoint.dataP = (TpSStr)(pDataH->DSChArr + channels); /* 6. Store default values in data structure structs */ /* Fixed channel information in File Header */ for (search = 0;search < channels;search++) { pFilChInfo = pFileH->FilChArr+search; /* pointer to relevant chan info */ /* Put null strings in Chan name and units */ TransferIn("", pFilChInfo->chanName, 0); TransferIn("", pFilChInfo->unitsY, 0); TransferIn("", pFilChInfo->unitsX, 0); pFilChInfo->dType = INT2; /* default type is integer */ pFilChInfo->dKind = EQUALSPACED; pFilChInfo->dSpacing = 2; /* integers stored in sequence */ pFilChInfo->otherChan= 0; } /*************************************************************************** ** Fixed file variables in the File header ** Copy the variable descriptions to the space allocated (which is in the ** form of variable description structs) storing the offsets in the data ** array for each variable value in the vsize field ****************************************************************************/ SetVarDescs(fileVars,pfileInfo->FVPoint,fileArray,filOffsets,filVarSpace); /* Data section variables descriptions */ SetVarDescs(DSVars,pfileInfo->DSPoint,DSArray,DSOffsets,DSVarSpace); /* Now fill in as much as poss of header block */ pDataH->lastDS = 0; /* no data section there yet */ /* lastDS of zero means the fileheader is the 'previous' DS */ pDataH->dataSt = BlockRound(handle,(CFSLONG)pFileH->fileHeadSz);/*round up */ pFileH->fileSz = pDataH->dataSt; /* reset so they are consistent */ pDataH->dataSz = 0; /* fill in later */ pDataH->flags = noFlags; /* start with no flags */ for (search = 0;search < 8;search++) pDataH->dSpace[search] = 0; /* zero spare space */ /* Initialise channel information */ for (search = 0; search < channels; search++) { pDSChInfo = pDataH->DSChArr + search; pDSChInfo->dataOffset = 0; /* no data there yet */ pDSChInfo->dataPoints = 0; pDSChInfo->scaleY = (float)1.0; pDSChInfo->offsetY = (float)0.0; pDSChInfo->scaleX = (float)1.0; pDSChInfo->offsetX = (float)0.0; } TransferIn(comment,pFileH->commentStr,COMMENTCHARS); /* users comment in LSTRING form */ F_strncpy(pFileH->marker,CEDMARKER,MARKERCHARS); /* marker with no NULL */ CStrTime(gWorkStr); /* time + NULL */ F_strncpy(pFileH->timeStr,gWorkStr,8); /* store time without NULL */ CStrDate(gWorkStr); /* date + NULL */ F_strncpy(pFileH->dateStr,gWorkStr,8); /* store date without NULL */ pFileH->dataSecs = 0; /* No DS yet */ pfileInfo->tableP = NULL; /* table giving file offsets for each DS header is not in memory */ pFileH->tablePos= 0; /* position in file where DS offsets table starts */ pFileH->endPnt = 0;/* this will hold the offset of the final DS header */ pfileInfo->allowed = writing; /* file now opened */ pfileInfo->thisSection= 0xFFFF; /* not used in writing mode */ for (search = 0;search < 20; search++) pFileH->fSpace[search] = 0; /* zero spare space */ pfileInfo->DSAltered = 0; /* initialise to 0 so that GetHeader does not write the DS header to file.(InsertDS is only valid way to do this for a new file. */ errorInfo.eFound = 0; /* no filing errors yet */ #if defined(_IS_MSDOS_) || defined(_IS_WINDOWS_) /* In file header store the file name without a path or leading spaces in LSTRING format */ search = 0; /* find 1st non space TpStr */ while (isspace(fname[search])) search++; pathend = (short)(search-1); /* If there is no path in fname it ends before the start */ /* look for last occurrence of '\\' or ':' */ while (search<(short)F_strlen(fname)) { if ((fname[search] == '\\') || (fname[search] == ':')) pathend = search; search = (short)(search + 1); } TransferIn(&fname[pathend+1],pFileH->name,FNAMECHARS); #endif /* return space allocated for temp arrays of affsets */ CFreeAllcn(filOffsets); CFreeAllcn(DSOffsets); return handle; /* all ok so return the file handle */ /* ** Here for the general error handling. Tidy up and return error code, ** also calling Internal Error so that any errors are remembered. */ Close3: CFreeAllcn(pfileInfo->extHeadP); /* free mem for data insert */ pfileInfo->extHeadP = NULL; Close2: CFreeAllcn(pfileInfo->dataHeadP); /* and for data header */ Close1: CFreeAllcn(pfileInfo->fileHeadP); /* and for file header */ Close0: CCloseAndUnlink(pfileInfo->DOSHdl.p, pfileInfo->tempFName); /* delete temp file */ CFreeAllcn(filOffsets); /* release space for offset arrays */ CFreeAllcn(DSOffsets); Close_1: if (strlen(fname) < MAXFNCHARS) F_strcpy(gWorkStr,fname); /* Get file name into global var */ CCloseAndUnlink(pfileInfo->DOSHdl.d, gWorkStr); /* delete empty CFS file */ InternalError(handle,proc,retval); return retval; /* retval is error code */ } /* end of CreatCFSFile */ /************************ SetFileChan ******************************** ** ** Set the channel information that stays same throughout file and goes ** in the file header. ** *****************************************************************************/ CFSAPI(void) SetFileChan(short handle, /* program file handle */ short channel, /* channel numb in CFS storage */ TpCStr channelName, /* users identifier for channel */ TpCStr yUnits, /* users name for units */ TpCStr xUnits,/* only for equal spaces often s */ TDataType dataType, /* one of 8 types */ TCFSKind dataKind, /* one of 2 kinds */ short spacing, /* bytes between equal spaced elements */ short other) /* next channel for matrix data */ { short proc = 1; /* function number for error record */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif /* to point to set of file info with given handle */ TpChInfo pFilChInfo; /* to point to this channels info structure */ short ecode; /* for return of FileUpdate */ ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(channel >= 0); ASSERT(channel < g_fileInfo[handle].fileHeadP->dataChans); ASSERT(dataType >= 0); ASSERT(dataType < NDATATYPE); ASSERT(dataKind >= 0); ASSERT(spacing >= 0); ASSERT((g_fileInfo[handle].allowed == writing) || (g_fileInfo[handle].allowed == editing)); /* 1. Check valid handle given and that its file is open for write/edit */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if ((pfileInfo->allowed == writing) || (pfileInfo->allowed == editing)) { /* 2. Check channel number in range */ if ((channel < 0) || (channel >= pfileInfo->fileHeadP->dataChans)) { InternalError(handle,proc,BADCHAN); return; } /* Additional checks on parameters dataType and dataKind */ if ((dataType < 0) || (dataType >= NDATATYPE)) { InternalError(handle,proc,BADPAR); return; } if ((dataKind < 0) || (dataKind >= NDATAKIND)) { InternalError(handle,proc,BADKIND); return; } if ((spacing < 0) || ((dataKind == MATRIX) && (other < 0))) { InternalError(handle,proc,BADPAR); return; } /* If this is the first edit made to a file get it ready for the change */ if ((pfileInfo->allowed == editing) && (pfileInfo->fileHeadP->tablePos != 0)) { ecode = FileUpdate(handle,pfileInfo->fileHeadP); if (ecode != 0) { InternalError(handle,proc,ecode); return; } } /* channels info parameters look reasonable so fill them in */ pFilChInfo = pfileInfo->fileHeadP->FilChArr + channel; /* pick out chan */ TransferIn(channelName,pFilChInfo->chanName,DESCCHARS); TransferIn(yUnits,pFilChInfo->unitsY,UNITCHARS); TransferIn(xUnits,pFilChInfo->unitsX,UNITCHARS); pFilChInfo->dType = dataType; pFilChInfo->dKind = dataKind; pFilChInfo->dSpacing = spacing; pFilChInfo->otherChan = other; } else InternalError(handle,proc,NOTWORE); /* failed allowed test */ return; } /* end of SetFileChan */ /************************** SetDSChan ******************************** ** ** Sort out the data section channel info ie the bit that can change ** with data section. ** *****************************************************************************/ CFSAPI(void) SetDSChan(short handle, /* program file handle */ short channel, /* CFS channel number */ WORD dataSection, /* reference when editing */ CFSLONG startOffset, /* byte offset to 1st element */ CFSLONG points, /* number of channel elements */ float yScale, /* data scale */ float yOffset, float xScale, float xOffset) { short proc = 2; /* number for this function */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpDsInfo pDSChInfo; short ecode; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT((g_fileInfo[handle].allowed == writing) || (g_fileInfo[handle].allowed == editing)); ASSERT(channel >= 0); ASSERT(channel < g_fileInfo[handle].fileHeadP->dataChans); /* 1. Is Handle ok */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return; } /* 1a. Is file open for writing/editing */ pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if ((pfileInfo->allowed == writing) || (pfileInfo->allowed == editing)) { /* 2. Check channel number */ if ((channel < 0) || (channel >= pfileInfo->fileHeadP->dataChans)) { InternalError(handle,proc,BADCHAN); return; } /* 3. Check data section number if editing and read in its header from the CFS file */ if (pfileInfo->allowed == editing) { if ((dataSection<1)||(dataSection>pfileInfo->fileHeadP->dataSecs)) { InternalError(handle,proc,BADDS); return; } ecode = GetHeader(handle,dataSection); if (ecode != 0) { InternalError(handle,proc,ecode); return; } } else { if (/*(dataSection<0)||*/(dataSection>pfileInfo->fileHeadP->dataSecs)) { InternalError(handle,proc,BADDS); return; } if (dataSection > 0) { CMovel(pfileInfo->extHeadP, pfileInfo->dataHeadP, /* Save current DS header */ pfileInfo->fileHeadP->dataHeadSz); ecode = GetHeader(handle, dataSection); /* Read in wanted */ if (ecode != 0) { InternalError(handle,proc,ecode); goto Restore; } } } /* If this is the first edit made to a file get it ready for the change */ if ((pfileInfo->allowed == editing) && (pfileInfo->fileHeadP->tablePos != 0)) { ecode = FileUpdate(handle,pfileInfo->fileHeadP); if (ecode != 0) { InternalError(handle,proc,ecode); return; } } /* Store information from function parameters in program */ pDSChInfo = pfileInfo->dataHeadP->DSChArr + channel; pDSChInfo->dataOffset = startOffset; pDSChInfo->dataPoints = points; pDSChInfo->scaleY = yScale; pDSChInfo->offsetY = yOffset; pDSChInfo->scaleX = xScale; pDSChInfo->offsetX = xOffset; if (pfileInfo->allowed == editing) pfileInfo->DSAltered = 1; /* (TRUE) */ else { if (dataSection > 0) /* If we are at previous data section */ { CFSLONG tableValue; /* Write the data back to disk */ tableValue = GetTable(handle, dataSection); if (FileData(handle, pfileInfo->dataHeadP, tableValue, (WORD)pfileInfo->fileHeadP->dataHeadSz) == 0) { InternalError(handle, proc, WRITERR); goto Restore; } } } Restore: if ((pfileInfo->allowed == writing) && (dataSection > 0)) { /* Then copy the old data back into position */ CMovel(pfileInfo->dataHeadP,pfileInfo->extHeadP, pfileInfo->fileHeadP->dataHeadSz); } } else InternalError(handle,proc,NOTWORE); /* failed writing/editing */ return; } /* end of setDSChans */ /************************** Write Data ******************************** ** ** Write actual data into current data block. ** *****************************************************************************/ CFSAPI(short) WriteData(short handle, /* program file handle */ WORD dataSection, /* data section for data */ CFSLONG startOffset, /* offset in DS for write */ WORD bytes, /* number of bytes to write */ TpVoid dataADS) /* ptr to start of data to write */ { short proc = 19; /* number for this function */ short ecode = 0; CFSLONG endOffset; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpDHead dataHP; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); ASSERT(g_fileInfo[handle].allowed != reading); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return BADHANDLE; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* action depends on whether file was opened by CREAT (writing) or OPEN (editing) */ if ((pfileInfo->allowed == writing) && (dataSection == 0)) { /* adjust pointers for data size */ dataHP = pfileInfo->dataHeadP; endOffset = dataHP->dataSt + startOffset + bytes; if (pfileInfo->fileHeadP->fileSz < endOffset) { pfileInfo->fileHeadP->fileSz = endOffset; dataHP->dataSz = endOffset - dataHP->dataSt; } ecode = FileData(handle,dataADS,dataHP->dataSt + startOffset,bytes); if (ecode == 0) { InternalError(handle,proc,WRITERR); ecode = WRITERR; } else ecode = 0; /* Set to no error result otherwise */ } else { if ((pfileInfo->allowed != editing) && /* must be OK to write */ (pfileInfo->allowed != writing)) { InternalError(handle, proc, NOTWORE); return NOTWORE; } if ((dataSection < 1) || (dataSection > pfileInfo->fileHeadP->dataSecs)) { InternalError(handle,proc,BADDS); /* check data section number */ return BADDS; } /* If writing, preserve the current data section header */ if (pfileInfo->allowed == writing) { CMovel(pfileInfo->extHeadP, pfileInfo->dataHeadP, pfileInfo->fileHeadP->dataHeadSz); } ecode = GetHeader(handle, dataSection); if (ecode != 0) /* can be READERR or WRITERR */ { InternalError(handle,proc,ecode); /* check data section number */ goto Restore; } if ((startOffset + bytes) > pfileInfo->dataHeadP->dataSz) { InternalError(handle,proc,BADDSZ); /* check data section number */ ecode = BADDSZ; goto Restore; } /* If this is the first edit made to a file get it ready for the change */ if ((pfileInfo->fileHeadP->tablePos != 0) && (pfileInfo->allowed == editing)) { ecode = FileUpdate(handle, pfileInfo->fileHeadP); if (ecode != 0) { InternalError(handle,proc,ecode); goto Restore; } } ecode = FileData(handle, dataADS, pfileInfo->dataHeadP->dataSt + startOffset,bytes); if (ecode == 0) { InternalError(handle,proc,WRITERR); ecode = WRITERR; goto Restore; } else ecode = 0; /* No errors, so clear function return */ Restore: /* Copy the old data back into position if required */ if (pfileInfo->allowed == writing) { CMovel(pfileInfo->dataHeadP, pfileInfo->extHeadP, pfileInfo->fileHeadP->dataHeadSz); } } return ecode; } /* end of WriteData */ /************************** Set Write Data ****************************** ** ** For file opened with CREAT only. Set it up ready for fast sequential write. ** Attempt to by pass piecewise disk allocation and speed up write to disc. ** NB BUFFERS = prameter in CONFIG.SYS needs to be at least 20. ** Any error is put into global error struct. ** *****************************************************************************/ CFSAPI(void) SetWriteData(short handle, /* program file handle */ CFSLONG startOffset, /* byte offset within DS for writing */ CFSLONG bytes) /* number of bytes to write */ { short proc = 3; /* function number */ char oneByte; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpDHead dataHP; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed == writing); /* 1. Check handle */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed != writing) /* check created file */ { InternalError(handle,proc,NOTWRIT); return; } dataHP = pfileInfo->dataHeadP; if ((bytes >= 0) && (startOffset >= 0)) /* If parameters are ok */ /* 2. move to end of data and write 1 byte to allocate file space */ { if (FileData(handle,dataHP,dataHP->dataSt+startOffset + bytes,1) == 0) { /* attempt write to wouldbe end of file */ InternalError(handle,proc,WRITERR); return; } } else { /* either bytes or startOffset duff */ InternalError(handle,proc,BADPAR); return; } /* 3. move to start of data area and read 1 byte to position of head */ if (LoadData(handle, &oneByte, dataHP->dataSt+startOffset-1, 1) == 0) { InternalError(handle,proc,READERR); return; } return; } /* end of SetWritedata */ /**************************** CFSFileSize ********************************* ** ** Return the file size, in bytes. The name is to avoid C library clashes. ** *****************************************************************************/ CFSAPI(CFSLONG) CFSFileSize(short handle) { short proc = 24; /* function number */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle, proc, BADHANDLE); /* check handle */ return BADHANDLE; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed == nothing) /* and also check for file not open */ { InternalError(handle, proc, NOTOPEN); return NOTOPEN; } fileHP = pfileInfo->fileHeadP; /* Get pointer to file header */ return fileHP->fileSz; /* return the file size from the header */ } /**************************** Insert DS ****************************** ** ** Close the current data block and insert it at datasection th data ** block in the file. For dataSection 0 put it at the end. ** Return zero or error code. ** *****************************************************************************/ CFSAPI(short) InsertDS(short handle, /* program file handle */ WORD dataSection, /* section number */ TSFlags flagSet) /* flags for this DS */ { short proc = 17; /* function number */ WORD index,relevantSize; CFSLONG gtPlace,gtPlace1; CFSLONG tableValue; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; TpDHead dataHP; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed == writing); ASSERT(dataSection < MAXNODS); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); /* check handle */ return BADHANDLE; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* 1. check file open for writing and dataSection valid */ if (pfileInfo->allowed != writing) { InternalError(handle,proc,NOTWRIT); return NOTWRIT; } fileHP = pfileInfo->fileHeadP; if (fileHP->dataSecs >= MAXNODS) { InternalError(handle,proc,XSDS); return XSDS; } if (dataSection == 0) dataSection = (WORD)(fileHP->dataSecs + 1); if ((dataSection < 1) || (dataSection > (fileHP->dataSecs + 1))) { InternalError(handle,proc,BADDS); return BADDS; } /* 2. change the pointer table to accommodate new data section */ for (index = fileHP->dataSecs;index >= dataSection;index--) { /* move entries past current DS up one */ tableValue = GetTable(handle,index); StoreTable(handle,(WORD)(index+1),tableValue); } dataHP = pfileInfo->dataHeadP; /* 3. change pointers for current section */ /* for first DS lastDS=0 ie previous thing is the header */ if (dataSection == 1) dataHP->lastDS = 0; else dataHP->lastDS = GetTable(handle,(WORD)(dataSection-1)); /* previous section */ dataHP->dataSz = fileHP->fileSz - dataHP->dataSt; /* set size of data which should be on end of file */ gtPlace = dataHP->dataSt + BlockRound(handle, dataHP->dataSz); /* offset corresponding to this DS */ StoreTable(handle, dataSection, gtPlace); /* store offset for this DS header */ /* 4. write the data header to the file */ dataHP->flags = flagSet; /* set flags for this DS */ if (FileData(handle,dataHP,gtPlace,(WORD)fileHP->dataHeadSz) == 0) { InternalError(handle,proc,WRITERR); return WRITERR; } /* 5. alter lastDS pointer in subsequent header */ relevantSize = sizeof(TDataHead) - sizeof(TDSChArr); if (dataSection < (fileHP->dataSecs + 1)) { /* not the last one */ gtPlace1 = GetTable(handle,(WORD)(dataSection + 1)); /* offset for next DS */ if (LoadData(handle,pfileInfo->extHeadP,gtPlace1,relevantSize) == 0) { InternalError(handle,proc,READERR); return READERR; /* read header to change */ } pfileInfo->extHeadP->lastDS = gtPlace; /* make the change */ if (FileData(handle,pfileInfo->extHeadP,gtPlace1,relevantSize) == 0) { InternalError(handle,proc,WRITERR); return WRITERR; } } else fileHP->endPnt = gtPlace; /* action for end DS */ /* 6. update fileHeader and dataheader variable */ fileHP->dataSecs = (WORD)(fileHP->dataSecs + 1); fileHP->fileSz = gtPlace + fileHP->dataHeadSz; dataHP->dataSt = fileHP->fileSz; dataHP->dataSz = 0; return 0; /* all ok */ } /* end of InsertDS */ /**************************** AppendDS ****************************** ** ** Add an empty data section onto the end of the file, so that we can ** write to it. Intended for use with offline files. ** ** Return zero or error code. ** *****************************************************************************/ CFSAPI(short) AppendDS(short handle, /* program file handle */ CFSLONG lSize, /* size of the new section */ TSFlags flagSet) /* flags for this DS */ { short proc = 25; /* function number */ WORD headSize, thisDS; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; TpDHead dataHP; CFSLONG lPrev, lThis; CFSLONG tableValue; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT((g_fileInfo[handle].allowed == editing) || (g_fileInfo[handle].allowed == writing)); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); /* check handle */ return BADHANDLE; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed == writing) /* If writing just use InsertDS */ return InsertDS(handle, 0, flagSet); /* as this does it */ /* 1. check file open for writing and work out this DS number */ if (pfileInfo->allowed != editing) { InternalError(handle, proc, NOTWORE); return NOTWORE; } if (pfileInfo->DSAltered == 1) /* do we need to write this DS out first? */ { tableValue = GetTable(handle,pfileInfo->thisSection); pfileInfo->DSAltered = 0; if (FileData(handle,pfileInfo->dataHeadP,tableValue,(WORD) pfileInfo->fileHeadP->dataHeadSz) == 0) { InternalError(handle,proc,WRITERR); return WRITERR; } } pfileInfo->thisSection = 0xFFFF; /* If this is the first edit made to a file get it ready for the change */ /* This code strips the lookup table from the file size, which will help out! */ if (pfileInfo->fileHeadP->tablePos != 0) { short ecode; ecode = FileUpdate(handle, pfileInfo->fileHeadP); if (ecode != 0) { InternalError(handle, proc, ecode); return ecode; } } fileHP = pfileInfo->fileHeadP; /* Pointer to the file info */ dataHP = pfileInfo->dataHeadP; /* and the data header buffer */ if (fileHP->dataSecs >= MAXNODS) { InternalError(handle,proc,XSDS); return XSDS; } headSize = fileHP->dataHeadSz; /* Size of DS header in total */ thisDS = fileHP->dataSecs + 1; /* The number for the new data section */ lThis = fileHP->fileSz + BlockRound(handle, lSize); /* New DS head pos */ /* 2. Read in the previous DS header so we can meddle */ lPrev = GetTable(handle, (WORD)(thisDS - 1));/* offset for prev DS */ if (LoadData(handle, dataHP, lPrev, headSize) == 0) { InternalError(handle,proc,READERR); return READERR; /* read header to change */ } /* 3. Start creating the new data section. The new section goes at the end */ dataHP->dataSt = lPrev + headSize; /* Start posn for the data */ dataHP->dataSz = lSize; /* Size of the data */ dataHP->lastDS = lPrev; dataHP->flags = flagSet; /* set flags for this DS */ pfileInfo->thisSection = thisDS; /* now talking about a different DS */ StoreTable(handle, thisDS, lThis); /* Get the DS start into table */ /* 4. write the data header to the file */ if (FileData(handle, dataHP, lThis, headSize) == 0) { InternalError(handle,proc,WRITERR); return WRITERR; } /* 5. update fileHeader and dataheader variable */ fileHP->dataSecs = thisDS; fileHP->endPnt = lThis; /* pointer to the last DS header */ fileHP->fileSz = lThis + headSize; /* Updated file size */ return 0; /* all ok */ } /* end of AppendDS */ /**************************** Get DS Size ******************************** ** ** Returns size (in bytes) of specified data section for old file or current ** data section for new file. (file specified by its program file handle ). ** The size returned is the disk space for the channel data and doesn't ** include the DS header. ** Return is the size or -ve error code. ** *****************************************************************************/ CFSAPI(CFSLONG) GetDSSize(short handle, /* program file handle */ WORD dataSection) { short proc = 22; short ecode; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif /* check handle */ ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return BADHANDLE; } /* check file status */ pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed != nothing) { /* get header if old file */ if (pfileInfo->allowed != writing) { if ((dataSection < 1) || (dataSection > pfileInfo->fileHeadP->dataSecs)) { InternalError(handle,proc,BADDS); return BADDS; } ecode = GetHeader(handle,dataSection); if (ecode < 0) { InternalError(handle,proc,ecode); return ecode; } } return pfileInfo->dataHeadP->dataSz; /* return stored size */ } else { InternalError(handle,proc, NOTWORR); return NOTWORR; } } /* end of GetDSSize */ /************************** Clear DS ******************************** ** ** Clear out data already written in current DS. See WriteData. ** *****************************************************************************/ CFSAPI(short) ClearDS(short handle) { short proc = 20; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpDHead dataHP = NULL; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed == writing); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return BADHANDLE; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* action depends on if file was opened by CREAT(writing) or OPEN (editing) */ if (pfileInfo->allowed == writing) /* adjust pointers for data size 0 */ { pfileInfo->fileHeadP->fileSz = dataHP->dataSt; pfileInfo->dataHeadP->dataSz = 0; } else { InternalError(handle,proc,NOTWRIT); return NOTWRIT; /* cannot do it unless CREAT (writing) */ } return 0; } /***************************** Remove DS ********************************* ** ** Remove a data section from the CFS file. Doesn't actually shorten the ** file but rearranges pointers so blocks dont appear any more. ** *****************************************************************************/ CFSAPI(void) RemoveDS(short handle, /* program file handle */ WORD dataSection) /* DS to remove */ { short proc = 4; /* number for this function */ CFSLONG storeLastDS; WORD relSize,index,ecode; CFSLONG tableValue; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(dataSection > 0); ASSERT(dataSection <= g_fileInfo[handle].fileHeadP->dataSecs); ASSERT((g_fileInfo[handle].allowed == writing) || (g_fileInfo[handle].allowed == editing)); /* 1. Check handle and data section parameters are valid */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ relSize = sizeof(TDataHead) - sizeof(TDSChArr); /* size of data header without channel infoe array */ if ((pfileInfo->allowed != writing) && (pfileInfo->allowed != editing)) { InternalError(handle,proc,NOTWORE); return; } if ((dataSection < 1) || (dataSection > pfileInfo->fileHeadP->dataSecs)) { InternalError(handle,proc,BADDS); return; } /* If this is the first edit made to a file get it ready for the change */ if ((pfileInfo->allowed == editing) && (pfileInfo->fileHeadP->tablePos != 0)) { ecode = FileUpdate(handle,pfileInfo->fileHeadP); if (ecode != 0) { InternalError(handle,proc,ecode); return; } } tableValue = GetTable(handle,dataSection); if (LoadData(handle,pfileInfo->extHeadP,tableValue,relSize) == 0) { InternalError(handle,proc,READERR); return; } storeLastDS = pfileInfo->extHeadP->lastDS; /* save the pointer to previous DS */ /* 3. If current DS needs Filing do so */ if (pfileInfo->DSAltered == 1) { tableValue = GetTable(handle,pfileInfo->thisSection); pfileInfo->DSAltered = 0; if (FileData(handle,pfileInfo->dataHeadP,tableValue,(WORD) pfileInfo->fileHeadP->dataHeadSz) == 0) { InternalError(handle,proc,WRITERR); return; } } pfileInfo->thisSection = 0xFFFF; /* 4. Remove section from pointer table */ for (index = dataSection;index < pfileInfo->fileHeadP->dataSecs;index++) { tableValue = GetTable(handle,(WORD)(index + 1)); /* shift all offsets one place */ StoreTable(handle,index,tableValue); /* back in array */ } /* 5. set lastDS for DS which now has removed ones index (or endPnt) if last */ if (dataSection < pfileInfo->fileHeadP->dataSecs) /* DS is not last one */ { tableValue = GetTable(handle,dataSection); /* offset for new DS with this number */ if (LoadData(handle,pfileInfo->extHeadP,tableValue,relSize) == 0) { InternalError(handle,proc,READERR); return; } pfileInfo->extHeadP->lastDS = storeLastDS; /* set new previous section */ if (FileData(handle,pfileInfo->extHeadP,tableValue,relSize) == 0) { InternalError(handle,proc,WRITERR); return; } /* write it back to file again */ } else pfileInfo->fileHeadP->endPnt = storeLastDS; /* if DS is last one */ /* 6. There is now 1 DS less in file */ pfileInfo->fileHeadP->dataSecs--; return; } /* end of Remove DS */ /***************************** Set Comment ******************************* ** ** Can use this function if file opened with CreateCFSFile or OpenCFSFile in ** edit mode. Overwrite the comment stored in the file header. ** *****************************************************************************/ CFSAPI(void) SetComment(short handle, /* program file handle */ TpCStr comment) /* comment to store */ { short proc = 15; /* function number */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; short ecode; /* for return from FileUpdate */ ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT((g_fileInfo[handle].allowed == writing) || (g_fileInfo[handle].allowed == editing)); /* check handle and file status */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ fileHP = pfileInfo->fileHeadP; if ((pfileInfo->allowed != writing) && (pfileInfo->allowed != editing)) { InternalError(handle,proc,NOTWRIT); return; } /* If this is the first edit made to a file get it ready for the change */ if ((pfileInfo->allowed == editing) && (pfileInfo->fileHeadP->tablePos != 0)) { ecode = FileUpdate(handle,pfileInfo->fileHeadP); if (ecode != 0) { InternalError(handle,proc,ecode); return; } } /* if all ok transfer comment to its place in the file header */ TransferIn(comment,fileHP->commentStr,COMMENTCHARS); } /* end of setComment */ /*************************** Set Var Val ******************************* ** ** Transfer the variable value to the byte list ready for transfer to file. ** ** If file opened by CreateCFSFile (allowed=writing) and the DS variable ** value applies to the current data section it will keep the value set ** for subsequent data sections unless changed. ** ** File opened by OpenCFSFile (allowed=editing) the new DS variable value ** applies to the data section specified only. ** *****************************************************************************/ CFSAPI(void) SetVarVal(short handle, /* program file handle */ short varNo, /* variable number (file or DS) */ short varKind, /* FILEVAR or DSVAR */ WORD dataSection, /* 0 or DS number */ TpVoid varADS) /* location of data to write to file */ { short proc = 5; /* function number */ short maxVarNo, ecode; int size = 0; int varOff; int stType; /* 1 for string transfers 0 for others */ TpSStr dest = NULL; BYTE maxLen = 0; BYTE charCount; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif CFSLONG* pLong = (CFSLONG*)varADS; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); ASSERT(g_fileInfo[handle].allowed != reading); /* NB ALL variable descriptions should be entered before the FIRST value is transferred */ /* Check handle parameter */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* Check file status */ if ((pfileInfo->allowed != writing) && (pfileInfo->allowed != editing)) { InternalError(handle, proc, NOTWORE); return; } stType = 0; /* Assume not a string */ /* Check variable kind and number */ switch (varKind) { case FILEVAR: { maxVarNo = pfileInfo->fileHeadP->filVars; if ((varNo >= 0) && (varNo < maxVarNo)) { /* retrieve place at which to store variable */ varOff = pfileInfo->FVPoint.nameP[varNo].vSize; dest = pfileInfo->FVPoint.dataP + varOff; /* get variable size from its offset and the next one */ size = (short)(pfileInfo->FVPoint. nameP[varNo+1].vSize-varOff); /* watch out for lstr type */ if (pfileInfo->FVPoint.nameP[varNo].vType == LSTR) { /* size allocated is for max number of chars + 2bytes */ maxLen = (BYTE)(size-2); /* maximum characters in transfer */ stType = 1; /* flag string transfer */ } else maxLen = 255; } break; } case DSVAR: { maxVarNo = pfileInfo->fileHeadP->datVars; /* same comments as above */ if ((varNo >= 0) && (varNo < maxVarNo)) { varOff = pfileInfo->DSPoint.nameP[varNo].vSize; dest = pfileInfo->DSPoint.dataP + varOff; size = (short)(pfileInfo->DSPoint.nameP[varNo+1]. vSize-varOff); if (pfileInfo->DSPoint.nameP[varNo].vType == LSTR) { maxLen = (BYTE)(size - 2); stType = 1; } else maxLen = 255; } break; } default: { InternalError(handle,proc,BADKIND); return; } } if ((varNo < 0) || (varNo >= maxVarNo)) { /* can now check variable number is in range */ InternalError(handle,proc,BADVARN); return; } /* Now split depending upon the variable type */ if (varKind == FILEVAR) { /* If this is the first edit made to a file get it ready for the change */ if ((pfileInfo->allowed == editing) && (pfileInfo->fileHeadP->tablePos != 0)) { ecode = FileUpdate(handle,pfileInfo->fileHeadP); if (ecode != 0) { InternalError(handle,proc,ecode); return; } } if (stType == 0) /* not a string to transfer */ CMovel(dest, varADS, (short)size); else { /* varADS is address of C string to transfer dest is address of LSTRING for storage */ charCount = (BYTE)F_strlen((TpStr)varADS); /* how many cahracters in string */ if (charCount > maxLen) charCount = maxLen; TransferIn((TpStr)varADS,(TpStr)dest,charCount); } } else { /* check datasection is in files range */ if ((pfileInfo->allowed == writing) && (dataSection == 0)) dataSection = (WORD)(pfileInfo->fileHeadP->dataSecs + 1); if ((dataSection < 1) || /* Now check for a legal DS */ ((dataSection > pfileInfo->fileHeadP->dataSecs) && (pfileInfo->allowed != writing)) || ((dataSection > pfileInfo->fileHeadP->dataSecs + 1) && (pfileInfo->allowed == writing))) { InternalError(handle,proc,BADDS); return; } /* If writing and looking back in file, preserve the data header */ if ((pfileInfo->allowed == writing) && (dataSection <= pfileInfo->fileHeadP->dataSecs)) { CMovel(pfileInfo->extHeadP, pfileInfo->dataHeadP, pfileInfo->fileHeadP->dataHeadSz); } /* If editing or reading need to load data header of DS specified */ if (dataSection <= pfileInfo->fileHeadP->dataSecs) { ecode = GetHeader(handle,dataSection); /* load data header */ if (ecode < 0) /* error code can be read/write error */ { InternalError(handle,proc,ecode); goto Restore; } } /* If this is the first edit made to a file get it ready for the change */ if ((pfileInfo->allowed == editing) && (pfileInfo->fileHeadP->tablePos != 0)) { ecode = FileUpdate(handle, pfileInfo->fileHeadP); if (ecode != 0) { InternalError(handle,proc,ecode); goto Restore; } } if (stType == 0) /* not a string to transfer */ CMovel(dest, varADS, (short)size); else { /* varADS is address of C string to transfer dest is address of LSTRING for storage */ charCount = (BYTE)F_strlen((TpStr)varADS); /* how many cahracters in string */ if (charCount > maxLen) charCount = maxLen; TransferIn((TpStr)varADS,(TpStr)dest,charCount); } /* If editing update DS header flag so it gets written to file later */ if (pfileInfo->allowed == editing) pfileInfo->DSAltered = 1; Restore: /* Restore header for DS being written if required */ if ((pfileInfo->allowed == writing) && (dataSection <= pfileInfo->fileHeadP->dataSecs)) { CFSLONG tableValue; // First write the data back to disk tableValue = GetTable(handle, dataSection); if (FileData(handle, pfileInfo->dataHeadP, tableValue, (WORD)pfileInfo->fileHeadP->dataHeadSz) == 0) InternalError(handle, proc, WRITERR); /* Then copy the old data back into position */ CMovel(pfileInfo->dataHeadP,pfileInfo->extHeadP, pfileInfo->fileHeadP->dataHeadSz); } } return; } /* end of SetVarVal */ /************************** Close CFS File ******************************* ** ** Close the CFS file specified by its program handle. ** It can have been opened by CreateCFSFile or OpenCFSFile. ** Return 0 if ok or error code if not. ** *****************************************************************************/ CFSAPI(short) CloseCFSFile(short handle) { short proc = 21; short flag = 0, exchange = 0, retval = 0; CFSLONG tabSize, tableValue; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; TpDHead dataHP; int index; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); /* 1. Check handle */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return BADHANDLE; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed == nothing) { InternalError(handle,proc,BADHANDLE); return BADHANDLE; } fileHP = pfileInfo->fileHeadP; dataHP = pfileInfo->dataHeadP; retval = 0; /* return value for ok. Will overwrite if error */ /* 2. File the last DS if necessary */ if ((pfileInfo->allowed == writing) && (fileHP->fileSz > dataHP->dataSt)) { if (InsertDS(handle,(WORD)(fileHP->dataSecs+1),dataHP->flags) != 0) retval = BADINS; } if (pfileInfo->allowed != reading) { /* 3. Transfer the pointer table first make sure that any altered DS header is filed. */ /* Check that the file actually needs updating */ if ((pfileInfo->allowed == editing) && (fileHP->tablePos != 0)) { /* no change has been made. DO NOT write to file. Tidy up. */ CFreeAllcn(pfileInfo->extHeadP); /* if file opened for table pointers close and delete it */ if (pfileInfo->tableP == NULL) { /* delete CFS file */ retval = CCloseAndUnlink(pfileInfo->DOSHdl.p, pfileInfo->tempFName); if (retval < 0) retval = WRDS; } } else { if (pfileInfo->DSAltered == 1) { tableValue = GetTable(handle,pfileInfo->thisSection); if (FileData(handle,dataHP,tableValue,fileHP->dataHeadSz) == 0) retval = WRITERR; } /* it is to go on end of CFS file */ if (CLSeek(pfileInfo->DOSHdl.d, fileHP->fileSz, 0) < 0) retval = DISKPOS; tabSize = fileHP->dataSecs * 4; /* size of table */ if (pfileInfo->tableP == NULL) /* table not in memory */ { /* copy from start of temp file */ if (CLSeek(pfileInfo->DOSHdl.p,(CFSLONG)0,0) < 0) retval = DISKPOS; exchange = TransferTable(fileHP->dataSecs, pfileInfo->DOSHdl.p, pfileInfo->DOSHdl.d); if (exchange < 0) retval = exchange; /* want to return error if not ok */ flag = CCloseAndUnlink(pfileInfo->DOSHdl.p, pfileInfo->tempFName);/* delete pointer file */ if ((flag < 0) && (exchange >= 0)) retval = WRDS; /* delete pointer table file */ } else /* table is in memory so write it to file */ if (CWriteHandle(pfileInfo->DOSHdl.d,(TpStr)pfileInfo->tableP, (WORD)tabSize) < (WORD)tabSize) retval = WRDS; /* 4. Store file header */ if (exchange < 0) fileHP->tablePos = 0; /* if transfer failed, enabling to rebuild table on the next run */ else fileHP->tablePos = fileHP->fileSz; /* table position at end of rest of file */ fileHP->fileSz = fileHP->fileSz + tabSize; /* add table to file size */ if (FileData(handle, fileHP, (CFSLONG)0, fileHP->fileHeadSz) == 0) retval = WRITERR; CFreeAllcn(pfileInfo->extHeadP); /* release space for insert header applies to writing and editing files */ /* set the file length */ if (CSetFileLen(pfileInfo->DOSHdl.d, pfileInfo->fileHeadP->fileSz) != 0) retval = BADFL; } } CClose(pfileInfo->DOSHdl.d); /* Close the CFS file */ CFreeAllcn(pfileInfo->fileHeadP); /* free space allocated for header */ CFreeAllcn(pfileInfo->dataHeadP); /* free space allocated for data */ /* flag handle as not used */ pfileInfo->allowed = nothing; /* no need to initialise other file prams */ /* as they will be initialised on opening/creating next CFS file */ /* if the table is in memory free its allocated space */ if (pfileInfo->tableP != NULL) CFreeAllcn(pfileInfo->tableP); for (index = 0; index < g_maxCfsFiles; index++) /* Finally, check tables */ if (g_fileInfo[index].allowed != nothing) /* Any files still open? */ break; /* If so, we exit the loop early */ if (index >= g_maxCfsFiles) /* If no files open, will clean up memory */ CleanUpCfs(); return retval; /* return 0 or errorcode */ } /* end of CloseCFSFile */ /************************** Open CFS File ******************************* ** ** Open en exisiting CFS file for reading or editing. ** Return the program handle if ok (even if cant fulfil table in memory ** request) or -ve error code. ** If only problem is inability to allocate memory for the table, this error ** is returned via the error record and things are set to proceed with the ** table on disc. ** *****************************************************************************/ CFSAPI(short) OpenCFSFile(TpCStr fname, /* C string containing file name */ short enableWrite, /* 1 for editing 0 for readonly */ short memoryTable) /* 1 for table in memory 0 for on disk */ { short proc; /* function number */ short loop,retval; WORD relevantSize; CFSLONG tblSz; short exchange, handle; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; TpDHead dataHP,extHP; proc = 13; /* initialise here to get rid of compiler warning */ extHP = NULL; /* do with goto */ /* 1. get a program file handle */ handle = FindUnusedHandle(); if (handle < 0) { InternalError(handle,proc,NOHANDLE); return NOHANDLE; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* 2. open the file with required status */ /* use loop as temp variable */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) loop = 0; if (COpen(fname,(short)((enableWrite == 0) ? rMode : wMode), &pfileInfo->DOSHdl.d) != 0) loop = -1; #else loop = 0; if (COpen(fname,(short)((enableWrite == 0) ? 0 : 2), &pfileInfo->DOSHdl.d) != 0) loop = -1; #endif if (loop < 0) { InternalError(handle,proc,BADOPEN); return BADOPEN; } /* file is now open and DOS handle stored */ /* 2a. Check the file size against minimum */ /* Calculate space needed for minimal file file header */ relevantSize = sizeof(TFileHead) - sizeof(TFilChArr); if (CGetFileLen(pfileInfo->DOSHdl.d) < (CFSLONG)relevantSize) { retval = BADVER; goto Close0; /* need to close file before exit */ } /* file is now open and DOS handle stored */ /* 3. get memory needed initially for file header and data header */ /* Calculate space needed for just a minimalist file header */ relevantSize = sizeof(TFileHead) - sizeof(TFilChArr); pfileInfo->fileHeadP = (TpFHead)CMemAllcn(relevantSize); fileHP = pfileInfo->fileHeadP; if (fileHP == NULL) /* allocation failed */ { retval = NOMEMR; goto Close0; /* need to close file before exit */ } /* read the file header into the space allocated */ if (LoadData(handle,fileHP,(CFSLONG)0,relevantSize) == 0) { retval = READERR; /* load failed */ goto Close1; /* free space allated and close file */ } /* check the file marker . first whole of current version marker .*/ if (F_strncmp(fileHP->marker,CEDMARKER,MARKERCHARS) != 0) { retval = BADVER; /* now 2nd check to sort out old version file from foreigner */ if (F_strncmp(fileHP->marker,PARTMARK,PARTMARKCHARS) == 0) { /* fish out which old version from ASCII of last TpStr */ retval = fileHP->marker[PARTMARKCHARS]; retval = (short)(-(retval+BADOLDVER)); /* convert to error code .Yuck! */ } goto Close1; /* tidy up and return error code */ } relevantSize = fileHP->fileHeadSz; /* size of full header including chan stuff */ CFreeAllcn(pfileInfo->fileHeadP); /* release smaller space */ fileHP = (TpFHead)CMemAllcn(relevantSize); /* get enough for all */ if (fileHP == NULL) { retval = NOMEMR; goto Close0; /* close file only before exit */ } pfileInfo->fileHeadP = fileHP; /* store pointer to space allocated */ /* 4. read whole of file header including fixed channel info */ if (LoadData(handle,fileHP,(CFSLONG)0,relevantSize) == 0) { retval = READERR; goto Close1; } /* allocate space for data header */ pfileInfo->dataHeadP = (TpDHead)CMemAllcn(fileHP->dataHeadSz); dataHP = pfileInfo->dataHeadP; if (dataHP == NULL) { retval = NOMEMR; /* failure at DS header allocation */ goto Close1; } if (enableWrite != 0) { /* if user wants to edit file get extra DS header for insert */ pfileInfo->extHeadP = (TpDHead)CMemAllcn(fileHP->dataHeadSz); extHP = pfileInfo->extHeadP; if (extHP == NULL) { retval = NOMEMR; goto Close2; /* free DS header, file header and close file */ } } else pfileInfo->extHeadP = NULL; /* set explicitly to NULL if not allocated */ /* 5. set pointers within allocated space */ /* file variable descriptions come after fixed channel data */ pfileInfo->FVPoint.nameP = (TpVDesc)(fileHP->FilChArr+fileHP->dataChans); /* DS variable descriptions come after the file variables */ pfileInfo->DSPoint.nameP = pfileInfo->FVPoint.nameP + fileHP->filVars + 1; /* file variable values follow the DS variable descriptions */ pfileInfo->FVPoint.dataP = (TpSStr)(pfileInfo->DSPoint.nameP + fileHP->datVars + 1); /* DS variable values follow the DS channel information */ pfileInfo->DSPoint.dataP = (TpSStr)(dataHP->DSChArr+fileHP->dataChans); /* 6. get pointer table in memory or in separate file */ tblSz = 4 * fileHP->dataSecs; /* first locate table in CFS file */ if (fileHP->tablePos == 0) /* is pointer table lost */ { if (enableWrite == 0) { /* need to change file access to read/write */ if (CClose(pfileInfo->DOSHdl.d) != 0) { retval = WRITERR; /* nearset error poss. */ goto Close2; } #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) loop = 0; if (COpen(fname, wMode, &pfileInfo->DOSHdl.d) != 0) loop = -1; #else loop = 0; if (COpen(fname, 2, &pfileInfo->DOSHdl.d) != 0) loop = -1; #endif if (loop < 0) { retval = BADOPEN; goto Close2; } } loop = RecoverTable(handle,&tblSz,&fileHP->tablePos,&fileHP->dataSecs, &fileHP->fileSz); /* if loop is zero the table will be recovered ie.added to the CFS file and the file header variable updated */ if (loop < 0) { retval = loop; /* return error code of recovertable */ goto Close2; /* deallocate file and DS header(s) and close file */ } else /* success in recovering table. write updated header to file */ { if (FileData(handle,fileHP,(CFSLONG)0,fileHP->fileHeadSz) == 0) { retval = WRITERR; goto Close2; } } if (enableWrite == 0) /* need to change file access back to read */ { if (CClose(pfileInfo->DOSHdl.d) != 0) { retval = WRITERR; /* nearset error poss. */ goto Close2; } #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) loop = 0; if (COpen(fname, rMode, &pfileInfo->DOSHdl.d) != 0) loop = -1; #else loop = 0; if (COpen(fname, 0, &pfileInfo->DOSHdl.d) != 0) loop = -1; #endif if (loop < 0) { retval = BADOPEN; goto Close2; } } } /* position CFS file pointer at start of table */ if (CLSeek(pfileInfo->DOSHdl.d,fileHP->tablePos,0) < 0) { retval = DISKPOS; /* couldnt find table data */ goto Close2; } /* if requested and if possible get pointer table in memory */ if (memoryTable != 0) /* request for table to be in memory */ memoryTable = GetMemTable(handle); /* try to get space */ if (memoryTable != 0) /* space in memory allcated for table */ { if (!LoadData(handle, pfileInfo->tableP, fileHP->tablePos, tblSz)) { retval = READERR; /* couldnt read table */ goto Close2; } } else /* table to be accessed from file */ { pfileInfo->tableP = NULL; /* flag pointer table not in memory */ if (enableWrite != 0) { /* editing required so make temp file for table */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) /* make and save name for temp file */ TempName(handle,fname,pfileInfo->tempFName, WHOLEFILECHARS+2); if (CCreat(pfileInfo->tempFName, rwMode, &pfileInfo->DOSHdl.p) != 0) pfileInfo->DOSHdl.p = (fDef)-1; #endif if (&(pfileInfo->DOSHdl.p) < 0) /* create failed */ { retval = BADCREAT; goto Close2; } if (CLSeek(pfileInfo->DOSHdl.p,(CFSLONG)0,0) != 0) { retval = BADCREAT; goto Close3; /* add close and delete of temp file to tiy up */ } exchange = TransferTable(fileHP->dataSecs,pfileInfo->DOSHdl.d, pfileInfo->DOSHdl.p); /* transfer table from CFS to temp file */ if (exchange < 0) { retval = exchange; /* retrun error code of TransferTable */ goto Close3; } } else pfileInfo->DOSHdl.p = pfileInfo->DOSHdl.d; /* for reading only access the table from the CFS file itself */ } /* all is well now set files status */ if (enableWrite != 0) pfileInfo->allowed = editing; else pfileInfo->allowed = reading; pfileInfo->thisSection = 0xFFFF; pfileInfo->DSAltered = 0; return handle; /* return the program file handle */ /* 7. Tidy up in case of failure */ Close3:if (pfileInfo->tableP == NULL) /* is there likely to be a temp table file */ { if (&(pfileInfo->DOSHdl.p) != &(pfileInfo->DOSHdl.d)) /* make sure it isnt the CFS file */ { loop = CCloseAndUnlink(pfileInfo->DOSHdl.p, pfileInfo->tempFName); /* delete file */ } } Close2:if (pfileInfo->tableP != NULL) { CFreeAllcn(pfileInfo->tableP); pfileInfo->tableP = NULL; } if (pfileInfo->extHeadP != NULL) { CFreeAllcn(pfileInfo->extHeadP); pfileInfo->extHeadP = NULL; } CFreeAllcn(pfileInfo->dataHeadP); Close1:CFreeAllcn(pfileInfo->fileHeadP); Close0:loop = CClose(pfileInfo->DOSHdl.d); InternalError(handle,proc,retval); /* InternalError gets the details */ return retval; /* return error code */ } /* end of OpenCFSFile */ /************************** Get Gen Info ******************************* ** ** For CFS file specified by it program file handle, return in the time,date ** and comment arrays the time and date of creation of the CFS file and ** its general comment. ** time and date should point to C strings at least 8 chars long. (This will ** give time/date chars with no NULL.) ** comment should point to a C string at least COMMENTCHARS+1 (73) chars long. ** Error return is via error reord. ** *****************************************************************************/ CFSAPI(void) GetGenInfo(short handle, /* progran file handle */ TpStr time, /* to read back time */ TpStr date, /* to read back date */ TpStr comment) /* to read back general comment */ { short Proc = 6; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) /* function number */ TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); /* check handle specified */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,Proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed == nothing) InternalError(handle,Proc,NOTOPEN); else { fileHP = pfileInfo->fileHeadP; /* for the time and date copy the 8 chars only no NULL */ F_strncpy(time,fileHP->timeStr,8); time[8] = '\0'; F_strncpy(date,fileHP->dateStr,8); date[8] = '\0'; TransferOut(fileHP->commentStr,comment,COMMENTCHARS); } return; } /* end of GetGenInfo */ /*************************** Get File Info ******************************* ** ** For user to get some values from the file header of the file specified ** by its program file handle. ** The values are returned via pointers which on entry should point to ** variables of the correct type. ** Error return is via error record. ** *****************************************************************************/ CFSAPI(void) GetFileInfo(short handle, /* program file handle */ TpShort channels, /* to return number of channels */ TpShort fileVars, /* to return number of file variables */ TpShort DSVars, /* to return number of DS variables */ TpUShort dataSections) /* to retrun no. of DS's */ { short Proc = 7; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) /* function number */ TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,Proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; if (pfileInfo->allowed != nothing) /* if file is open */ { fileHP = pfileInfo->fileHeadP; /* set the thing that each parameter points to to the value in the file */ *channels = fileHP->dataChans; *fileVars = fileHP->filVars; *DSVars = fileHP->datVars; *dataSections= fileHP->dataSecs; } else InternalError(handle,Proc,NOTOPEN); /* file flagged as not open */ return; } /* end of GeTFileInfo */ /************************** Get Var Desc ******************************* ** ** To get from the file, specified by its program handle, information about ** a particular variable description, specified by its varKind (FILEVAR or ** DSVAR) and its number (alloted when first stored ). ** The size and type are returned by variable pointers. ** The units and description are returned by string pointers. ** The pointer for units should point to a string of at least UNITCHARS+1 (9) ** chars and that for the description to a string of at least DESCCHARS+1 (21) ** chars. ** Any error is returned via the error record. ** *****************************************************************************/ CFSAPI(void) GetVarDesc(short handle, /* program file handle */ short varNo, /* file or DS variable number */ short varKind, /* FILEVAR or DSVAR */ TpShort varSize,/* to return variable size in bytes */ TpDType varType, /* to return variable type */ TpStr units, /* to return units as C string */ TpStr description) /* to return variable description as C string */ { short Proc = 8; /* function number */ short size; short maxVarNo; short nextOffset; TVarDesc interDesc; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; /* check program handle */ ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,Proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed != nothing) { fileHP = pfileInfo->fileHeadP; switch (varKind) { case FILEVAR:maxVarNo = (short)(fileHP->filVars-1); break; case DSVAR :maxVarNo = (short)(fileHP->datVars-1); break; default :InternalError(handle,Proc,BADKIND); return; } if ((varNo < 0) || (varNo > maxVarNo)) { InternalError(handle,Proc,BADVARN); return; } if (varKind == FILEVAR) { interDesc = pfileInfo->FVPoint.nameP[varNo]; /* inside program vsize filed stores variable offset in byte list (not the size) */ nextOffset = pfileInfo->FVPoint.nameP[varNo+1].vSize; } else { interDesc = pfileInfo->DSPoint.nameP[varNo]; nextOffset = pfileInfo->DSPoint.nameP[varNo+1].vSize; } *varType = interDesc.vType; /* to return variable type */ /* now sort out the size from the stored offsets */ size = (short)(nextOffset - interDesc.vSize); /* if the variable is an lstring deduct 1 so that what is returned is the length of the C string needed to store it, ie. number of characters + 1 for the NULL */ if (interDesc.vType == LSTR) size = (short)(size-1); *varSize = size; /* return size in bytes */ /* Transfer the units and description from their stored LSTRING format to the C string provided */ TransferOut(interDesc.varUnits,units,UNITCHARS); TransferOut(interDesc.varDesc,description,DESCCHARS); } else InternalError(handle,Proc,NOTOPEN); return; } /* end of GetVarDesc */ /*************************** Get Var Val ******************************** ** ** To get from the file, specified by its program file handle, the actual ** value of a variable specified by its varKind (FILEVAR or DSVAR) and ** number (allocated when stored). ** For DSVAR in the case of files opened by CreatsCFSFile the value for the ** current DS is returned regardless of the parameter dataSection, ** in the case of files opened by OpenCFSFile the value for the ** dataSection specified is returned. ** The value is returned by copying it to the address, varADS, provided. ** The user must ensure that varADS is pointing to a large enough piece ** of free memory to which to copy the variable. ** String variables are returned as NULL terminated C strings (although stored as LSTRING). ** Any error is returned via the error record. ** *****************************************************************************/ CFSAPI(void) GetVarVal(short handle, /* program file handle */ short varNo, /* number of variable required */ short varKind, /* FILEVAR orDSVAR */ WORD dataSection, /* may need to specify DS */ TpVoid varADS) /* for return of variable */ { short Proc = 9; /* function number */ short maxVarNo,size,ecode; TpStr sourceP; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpVDesc pInterDesc,pnext; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); if ((handle < 0) || (handle >= g_maxCfsFiles)) /* check handle */ { InternalError(handle,Proc,BADHANDLE); return; } if ((varKind != FILEVAR) && (varKind != DSVAR)) /* check kind too */ { InternalError(handle,Proc,BADKIND); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* 1. Check file is open */ if (pfileInfo->allowed != nothing) { // // We split into file/DS sections here as the DS var code is getting a bit // complex if (varKind == FILEVAR) { maxVarNo = (short)(pfileInfo->fileHeadP->filVars-1); if ((varNo < 0) || (varNo > maxVarNo)) { InternalError(handle,Proc,BADVARN); return; } pInterDesc = pfileInfo->FVPoint.nameP + varNo;/* vars descript */ size = pInterDesc->vSize; /* actually OFFSET for now */ /* set pointer to next var description */ pnext = pfileInfo->FVPoint.nameP + varNo + 1; /* point to variable in its data (char) array, using its offset, size */ sourceP = (TpStr)pfileInfo->FVPoint.dataP + size; size = (short)(pnext->vSize - size); /* set size from offsets */ /* 4. move the variable to the location specified */ if (pInterDesc->vType == LSTR) { size = (short)(size-2); TransferOut(sourceP,(TpStr)varADS,(BYTE)size); } else CMovel(varADS,sourceP,size); } else // Here we do mostly the same for DS vars. Sorry for the { // duplication of code, but it keeps things much easier to do. maxVarNo = (short)(pfileInfo->fileHeadP->datVars-1); if ((varNo < 0) || (varNo > maxVarNo)) { InternalError(handle,Proc,BADVARN); return; } // If DS 0 on a new file, set to be next DS. if ((pfileInfo->allowed == writing) && (dataSection == 0)) dataSection = (WORD)(pfileInfo->fileHeadP->dataSecs + 1); // Now to check the data section number if ((dataSection < 1) || ((dataSection > pfileInfo->fileHeadP->dataSecs) && (pfileInfo->allowed != writing)) || ((dataSection > pfileInfo->fileHeadP->dataSecs + 1) && (pfileInfo->allowed == writing))) { InternalError(handle, Proc, BADDS); return; } /* 2. Look to see if a different data header is needed. If it is and we are */ /* writing, we will need to save the current header. */ if (dataSection <= pfileInfo->fileHeadP->dataSecs) { if (pfileInfo->allowed == writing) // Save the current header ? CMovel(pfileInfo->extHeadP, pfileInfo->dataHeadP, pfileInfo->fileHeadP->dataHeadSz); ecode = GetHeader(handle, dataSection); /* read new header */ if (ecode != 0) /* could have failed on read or write */ { InternalError(handle,Proc,ecode); goto Restore; } } /* now sort out where the variable is in its array and how many bytes */ pInterDesc = pfileInfo->DSPoint.nameP + varNo; size = pInterDesc->vSize; /* This is offset for now */ pnext = pfileInfo->DSPoint.nameP + varNo + 1; sourceP = (TpStr)pfileInfo->DSPoint.dataP + size; size = (short)(pnext->vSize - size); /* set size from offsets */ /* if variable is lstr things are different */ if (pInterDesc->vType == LSTR) { size = (short)(size-2); TransferOut(sourceP,(TpStr)varADS,(BYTE)size); } else CMovel(varADS,sourceP,size); Restore: /* Restore header for DS being written if required */ if ((pfileInfo->allowed == writing) && (dataSection <= pfileInfo->fileHeadP->dataSecs)) { CMovel(pfileInfo->dataHeadP,pfileInfo->extHeadP, pfileInfo->fileHeadP->dataHeadSz); } } } else InternalError(handle,Proc,NOTOPEN); return; } /* end of GetVarVal */ /************************** Get File Chan ******************************* ** ** To get from file, specified by its program file handle, the fixed ** information on a channel, specified by its number. (ie the order in which ** it appears in the CFS file.) ** The character arrays channelName,yUnits and xUnits must be of sufficient ** size, (DESCCHARS+1 (21), and UNITCHARS+1 (9) characters), for the return ** of the C string. ** The other information is returned via pointers which should on entry ** point to variables of the correct type. ** Any error is returned via the error record. ** *****************************************************************************/ CFSAPI(void) GetFileChan(short handle, /* program file handle */ short channel,/* chan for which info is required */ TpStr channelName, /* to return channel name */ TpStr yUnits, /* to return channel y units */ TpStr xUnits, /* EqualSpaced ot subsidiary to return x units */ TpDType dataTypeP, /* to return 1 of 8 types for channel */ TpDKind dataKindP,/* return equalspaced, matrix or subsidiary */ TpShort spacing, /* to return bytes between successive values for channel */ TpShort other) /* for matrix data rets next chan */ { short Proc = 10; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) /* function number */ TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpChInfo pChInfo; /* check handle */ ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); ASSERT(channel >= 0); ASSERT(channel < g_fileInfo[handle].fileHeadP->dataChans); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,Proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed != nothing) { /* check channel parameter */ if ((channel < 0) || (channel >= pfileInfo->fileHeadP->dataChans)) { InternalError(handle,Proc,BADCHAN); return; } pChInfo = pfileInfo->fileHeadP->FilChArr + channel; /* transfer character arrays for return */ TransferOut(pChInfo->chanName,channelName,DESCCHARS); TransferOut(pChInfo->unitsY,yUnits,UNITCHARS); TransferOut(pChInfo->unitsX,xUnits,UNITCHARS); /* set values to which return pointers point to values from file */ *dataTypeP = pChInfo->dType; *dataKindP = pChInfo->dKind; *spacing = pChInfo->dSpacing; *other = pChInfo->otherChan; } else InternalError(handle,Proc,NOTOPEN); return; } /* end of GetFileChan */ /**************************** Get DS Chan ******************************** ** ** To get from file, specified by its program file handle, the values of the ** data section channel information. User specifies which channel. Data ** section can include the one being written if file opened with ** CreateCFSFile. The values are returned via pointers. ** Any error is returned via the error record. ** *****************************************************************************/ CFSAPI(void) GetDSChan(short handle, /* program file handle */ short channel, /* channel for which info required */ WORD dataSection, /* dataSection required */ TpLong startOffset, /* to return channel start */ TpLong points, /* to return data points for channel */ TpFloat yScale, /* to return yscale for channel */ TpFloat yOffset, /* to return y offset for channel */ TpFloat xScale, /* to return x scale for channel */ TpFloat xOffset) /* to return x offset for channel */ { short Proc = 11; /* function number */ short ecode; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpDsInfo pChInfo; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); ASSERT(channel >= 0); ASSERT(channel < g_fileInfo[handle].fileHeadP->dataChans); /* 1. Check handle */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,Proc,BADHANDLE); return; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* check file status */ if (pfileInfo->allowed != nothing) { /* 2. Check channel specified against range in file */ if ((channel < 0) || (channel >= pfileInfo->fileHeadP->dataChans)) { InternalError(handle,Proc,BADCHAN); return; } /* 3. Check the data section number. We can access the current section if writing */ if ((pfileInfo->allowed == writing) && (dataSection == 0)) dataSection = (WORD)(pfileInfo->fileHeadP->dataSecs + 1); if ((dataSection < 1) || ((dataSection > pfileInfo->fileHeadP->dataSecs) && (pfileInfo->allowed != writing)) || ((dataSection > pfileInfo->fileHeadP->dataSecs + 1) && (pfileInfo->allowed == writing))) { InternalError(handle,Proc,BADDS); return; } /* 4. If writing and looking back in file, preserve the data header */ if ((pfileInfo->allowed == writing) && (dataSection <= pfileInfo->fileHeadP->dataSecs)) { CMovel(pfileInfo->extHeadP,pfileInfo->dataHeadP, pfileInfo->fileHeadP->dataHeadSz); } /* 5. If editing or reading need to load data header of DS specified */ if (dataSection <= pfileInfo->fileHeadP->dataSecs) { ecode = GetHeader(handle,dataSection); /* load data header */ if (ecode < 0) /* error code can be read/write error */ { InternalError(handle,Proc,ecode); goto Restore; } } /* extract information required from DS header */ pChInfo = pfileInfo->dataHeadP->DSChArr + channel; *startOffset = pChInfo->dataOffset; *points = pChInfo->dataPoints; *yScale = pChInfo->scaleY; *yOffset = pChInfo->offsetY; *xScale = pChInfo->scaleX; *xOffset = pChInfo->offsetX; Restore: /* Restore header for DS being written if required */ if ((pfileInfo->allowed == writing) && (dataSection <= pfileInfo->fileHeadP->dataSecs)) { CMovel(pfileInfo->dataHeadP,pfileInfo->extHeadP, pfileInfo->fileHeadP->dataHeadSz); } } else InternalError(handle,Proc,NOTOPEN); return; } /* end of GetDSChan */ /************************** Get Chan Data ******************************* ** ** Return data for a single channel from the CFS file. ** ** User specifies file by its program file handle, ** channel for which data required, ** dataSection for which data required, ** data point in the DS and channel from which to start ** transfer. (first point is 0) ** number of data points to transfer. 0 means transfer from ** point specified to end of DS, (or end of buffer). ** ** The data are returned by transfer to a buffer starting at dataADS. This ** should point to an area large enough for the transfer. ** areaSize should be set to the size of this destination buffer (in bytes). ** The transfer will not exceed this area even if the points requested would ** take it beyond it. ** Return is 0 if parameters passed specify 0 points or if there is any error, ** (this may have occurred part way through transferring). ** If the whole operation was successful return is the number of data points ** actually transferred, (this may not be the number requested in numPoints). ** Any error is returned via the error record. ** *****************************************************************************/ CFSAPI(WORD) GetChanData(short handle, /* program file handle */ short channel, /* channel required */ WORD dataSection, /* DS required */ CFSLONG firstElement, /* data point in channel at which to start */ WORD numberElements, /* points wanted */ TpVoid dataADS, /* address to transfer to */ CFSLONG areaSize) /* bytes allocated for transfer */ { short SizeOfData[NDATATYPE]; /* sizes in bytes of data types */ short ecode; short Proc = 14; /* function number */ WORD elementSize,dataOffset,numSecs; WORD retval; WORD bufferSize,spacing,pointsPerBuffer,buffersNeeded, bufferLoop,residueElements; CFSLONG filePos,totalPoints,numElements,longSpace; TpStr dBufferP; // THandle dummy; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); ASSERT(channel >= 0); ASSERT(channel < g_fileInfo[handle].fileHeadP->dataChans); SizeOfData[INT1] = 1; /* set sizes in bytes of each data type */ SizeOfData[WRD1] = 1; SizeOfData[INT2] = 2; SizeOfData[WRD2] = 2; SizeOfData[INT4] = 4; SizeOfData[RL4] = 4; SizeOfData[RL8] = 8; SizeOfData[LSTR] = 1; retval = 0; /* initialise return value. no points transferred */ dBufferP = NULL; /* ** 1. Check file handle and status */ if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,Proc,BADHANDLE); return retval; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed != nothing) /* Are we allowed to do this ? */ { /* ** 2. check channel number */ if ((channel < 0) || (channel >= pfileInfo->fileHeadP->dataChans)) { InternalError(handle,Proc,BADCHAN); return retval; } /* ** 3. for file just created copy the header for current section to spare place */ if ((pfileInfo->allowed == writing) && (dataSection<=pfileInfo->fileHeadP->dataSecs)) { CMovel(pfileInfo->extHeadP, pfileInfo->dataHeadP, pfileInfo->fileHeadP->dataHeadSz); } /* ** 4. check data section and read in its header */ numSecs = pfileInfo->fileHeadP->dataSecs; /* shorthand for number of DS */ if ((pfileInfo->allowed == writing) && (dataSection == 0)) dataSection = (WORD)(numSecs+1); /* Convert 0 to currently writing */ if ((dataSection < 1) || ((pfileInfo->allowed != writing) && (dataSection>numSecs)) || ((pfileInfo->allowed == writing) && (dataSection>(numSecs+1)))) { InternalError(handle,Proc,BADDS); return retval; } if (dataSection <= numSecs) /* if not the current DS */ { ecode = GetHeader(handle,dataSection); /* get right DS */ if (ecode < 0) /* header not read */ { InternalError(handle,Proc,ecode); return retval; } } /* ** 5. Check space and number of points */ elementSize = SizeOfData[(int)pfileInfo->fileHeadP->FilChArr[channel].dType]; totalPoints = pfileInfo->dataHeadP->DSChArr[channel].dataPoints; if (numberElements == 0) numElements = totalPoints; else numElements = numberElements; /* ** check there are enough points in data section to satisfy request */ if ((numElements + firstElement) >totalPoints) numElements = totalPoints - firstElement; /* check that request does not exceed buffer */ if ((numElements * elementSize) > areaSize) numElements = areaSize/elementSize; /* limit to unsigned short range */ if (numElements > MAXFORWRD) numElements = MAXFORWRD; /* ** 6. extract channels */ if (numElements == 0) goto Restore; spacing = pfileInfo->fileHeadP->FilChArr[channel].dSpacing; /* get as much as poss */ if ((numElements*spacing) > MAXMEMALLOC) bufferSize = (WORD)(MAXMEMALLOC - (MAXMEMALLOC % spacing)); else bufferSize = (WORD)numElements * spacing; /* allocated space must have integral set of channels */ dBufferP = AllocateSpace(&bufferSize, spacing); if (bufferSize == 0) { InternalError(handle,Proc,NOMEMR); goto Restore; } pointsPerBuffer = (WORD)(bufferSize/spacing); buffersNeeded = (WORD)(((numElements-1)/pointsPerBuffer)+1); /* includes last part buffer */ longSpace = spacing; /* keep it like the Pascal version */ filePos = pfileInfo->dataHeadP->dataSt + pfileInfo->dataHeadP->DSChArr[channel]. dataOffset + (longSpace*firstElement); dataOffset = 0; /* deal with complete buffers other than the last one */ if (buffersNeeded > 1) { for (bufferLoop = 0;bufferLoop <= (buffersNeeded-2);bufferLoop++) { if (LoadData(handle,dBufferP,filePos,bufferSize) == 0) { InternalError(handle,Proc,READERR); goto Restore; /* tidy up before exit */ } ExtractBytes((TpStr)dataADS,dataOffset, dBufferP, pointsPerBuffer,spacing,elementSize); dataOffset = (WORD)(dataOffset + pointsPerBuffer*elementSize); filePos = filePos + bufferSize; } } /* ** now whole buffers are done deal with remainder (last Buffer ) */ residueElements = (WORD)(((numElements - 1) % pointsPerBuffer) +1); if (LoadData(handle,dBufferP,filePos,(WORD)((( residueElements-1)*spacing)+elementSize)) == 0) { InternalError(handle,Proc,READERR); goto Restore; } ExtractBytes((TpStr)dataADS,dataOffset, dBufferP, residueElements,spacing,elementSize); retval = (WORD)numElements; /* to return number of points successfully transferred */ /* ** 7. tidy up. if writing copy header back */ Restore: if ((pfileInfo->allowed == writing) && (dataSection <= numSecs)) { CMovel(pfileInfo->dataHeadP, pfileInfo->extHeadP, pfileInfo->fileHeadP->dataHeadSz); } if (dBufferP != NULL) /* free memory allocated for transfer */ CFreeAllcn(dBufferP); } else InternalError(handle,Proc,NOTOPEN); return retval; } /* end of GetChanData */ /***************************** Read Data ********************************* ** ** To read data from a data section. ** CFS File is specified by its program file handle. ** DS is specified by its number. (even if opened by CreateCFSFile). 1 is ** first DS. ** startOffset is byte offset within the DS at which to start. ** bytes specifies how much to read. (error if this is off end of DS ) ** dataADS points to the start of the region into which to read the data. ** The user must allocate at least bytes bytes for this. ** Return is 0 if ok -ve error code if not. ** *****************************************************************************/ CFSAPI(short) ReadData(short handle, /* program file handle */ WORD dataSection, /* data section required */ CFSLONG startOffset, /* offset into DS from which to start reading */ WORD bytes, /* number of bytes to read */ TpVoid dataADS) /* start address to which to read */ { short proc = 23; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpDHead phead; WORD numSecs; short ecode,retval; /* check handle */ ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return BADHANDLE; } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed == nothing) /* check status */ { InternalError(handle,proc,NOTOPEN); return NOTOPEN; } /* 1. for file opened by CreateCFSFile copy current DS header to spare */ numSecs = pfileInfo->fileHeadP->dataSecs; if ((pfileInfo->allowed == writing) && (dataSection <= numSecs)) { CMovel((TpVoid)pfileInfo->extHeadP, (TpVoid)pfileInfo->dataHeadP,pfileInfo->fileHeadP->dataHeadSz); } /* 2. read in header of required DS */ if ((dataSection < 1) || ((pfileInfo->allowed != writing) && (dataSection > numSecs)) || ((pfileInfo->allowed == writing) && (dataSection > (numSecs + 1)))) { InternalError(handle,proc,BADDS); return BADDS; } if (dataSection <= numSecs) /* read in if not current header */ { ecode = GetHeader(handle,dataSection); if (ecode < 0) { InternalError(handle,proc,ecode); return ecode; } } /* right header is now there */ phead = pfileInfo->dataHeadP; /* shorten its pointer */ /* check the read spec against what is in the DS */ retval = BADDSZ; /* in case check fails */ if ((startOffset < 0) || ((startOffset + bytes) > phead->dataSz)) goto Restore; /* clear up before exit */ /* 3. extract data */ retval = READERR; /* in case it fails */ if (LoadData(handle,dataADS,phead->dataSt+startOffset,bytes) == 0) goto Restore; retval = 0; /* transfer requested successfully completed */ /* 4. if CreateCFSFile used make sure current DS header back in place */ Restore: if ((pfileInfo->allowed == writing) && (dataSection <= numSecs)) CMovel((TpVoid)pfileInfo->dataHeadP, (TpVoid)pfileInfo->extHeadP,pfileInfo->fileHeadP->dataHeadSz); return retval; /* 0 or error code */ } /* end of ReadData */ /************************** DS Flag Value ******************************* ** ** Returns initial value of a DS flag, for index supplied from 1 to 16. ** *****************************************************************************/ CFSAPI(WORD) DSFlagValue(int nflag) { const WORD flagVal[16] = {FLAG0,FLAG1,FLAG2,FLAG3,FLAG4,FLAG5,FLAG6, FLAG7,FLAG8,FLAG9,FLAG10,FLAG11,FLAG12, FLAG13,FLAG14,FLAG15}; /* holds DS flags intial values */ if ((nflag <= 15) && (nflag >=0)) return flagVal[nflag]; else return (WORD) 0; } /**************************** DS Flags *********************************** ** ** Either gets or sets (specified by setIt) the flags for a specified data ** section within a CFS file, specified by its program file handle, which ** has been opened with OpenCFSFile. ** ** The flags may only be set if writing was enabled when the file was opened. ** On entry pflagSet should point to a variable in the users program of the ** type TSFlags. If the flags are being set this varaible should have the ** required settingd. ** ** Any error is returned via the error record. ** *****************************************************************************/ CFSAPI(void) DSFlags(short handle, /* program file handle */ WORD dataSection, /* DS for which flags set/get */ short setIt, /* 1 means set 0 means get flags */ TpFlags pflagSet) /* pointer to users flagset variable */ { short proc = 12; /* function number */ short ecode; TFileInfo *pfileInfo; ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed != nothing); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return; } /* Check file status. ie OpenCFSFile used */ pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed != nothing) { /* if setting check status is OK */ if ((setIt == 1) && (pfileInfo->allowed == reading)) { InternalError(handle,proc,NOTWORE); return; } /* check datasection is in files range */ if ((pfileInfo->allowed == writing) && (dataSection == 0)) dataSection = (WORD)(pfileInfo->fileHeadP->dataSecs + 1); if ((dataSection < 1) || /* Now check for a legal DS */ ((dataSection > pfileInfo->fileHeadP->dataSecs) && (pfileInfo->allowed != writing)) || ((dataSection > pfileInfo->fileHeadP->dataSecs + 1) && (pfileInfo->allowed == writing))) { InternalError(handle,proc,BADDS); return; } /* If writing and looking back in file, preserve the data header */ if ((pfileInfo->allowed == writing) && (dataSection <= pfileInfo->fileHeadP->dataSecs)) { CMovel(pfileInfo->extHeadP, pfileInfo->dataHeadP, pfileInfo->fileHeadP->dataHeadSz); } /* If editing or reading need to load data header of DS specified */ if (dataSection <= pfileInfo->fileHeadP->dataSecs) { ecode = GetHeader(handle,dataSection); /* load data header */ if (ecode < 0) /* error code can be read/write error */ { InternalError(handle,proc,ecode); goto Restore; } } /* Get or set flags for data section */ if (setIt == 1) { /* If this is the first edit made to a file get it ready for the change */ if ((pfileInfo->allowed == editing) && (pfileInfo->fileHeadP->tablePos != 0)) { ecode = FileUpdate(handle, pfileInfo->fileHeadP); if (ecode != 0) { InternalError(handle, proc, ecode); goto Restore; } } pfileInfo->dataHeadP->flags = *pflagSet; if (pfileInfo->allowed == editing) /* What to do now ? */ pfileInfo->DSAltered = 1; /* flag header has been altered */ } else *pflagSet = pfileInfo->dataHeadP->flags;/* return value in file */ Restore: /* Restore header for DS being written if required */ if ((pfileInfo->allowed == writing) && (dataSection <= pfileInfo->fileHeadP->dataSecs)) { if (setIt == 1) // Did we modify the data ? { // If so, we need to write it back CFSLONG tableValue; tableValue = GetTable(handle, dataSection); if (FileData(handle, pfileInfo->dataHeadP, tableValue, (WORD)pfileInfo->fileHeadP->dataHeadSz) == 0) InternalError(handle, proc, WRITERR); } /* Then copy the old data back into position */ CMovel(pfileInfo->dataHeadP,pfileInfo->extHeadP, pfileInfo->fileHeadP->dataHeadSz); } } else InternalError(handle,proc,NOTWORR); return; } /* end of DSFlags */ /***************************** File Error ******************************* ** ** Error function to collect information on error which is not instantly ** fatal. ** Return of error details is via pointers which on entry should point to ** variables of the right type. ** The values returned via these pointers refer to the first error encountered ** since the function was last called. (If no error was encountered since ** the last time the function was callled the values returned to will refer ** to the previous error ). ** Return value is 1 if an error was encountered since the last time the ** function was called, 0 if not. ** Side effect. ** eFound field of global errorInfo is reinitialised to 0. ** *****************************************************************************/ CFSAPI(short) FileError(TpShort handleNo, /* to return handle number */ TpShort procNo, /* to return procedure number */ TpShort errNo) /* to return error code */ { short retval; /* return current state of error found flag */ retval = errorInfo.eFound; *handleNo = errorInfo.eHandleNo; *procNo = errorInfo.eProcNo; *errNo = errorInfo.eErrNo; errorInfo.eFound = 0; /* reset for next error */ return retval; } /* end of FileError */ /************************** CommitCFSFile ********************************* ** ** CommitCFSFile:- Commits a file to disk, ie ensures that file secure ** on disk. The precise actions will vary with the OS, needless to say, ** but the DOS mechanism is to update the file header on disk, followed ** by duplicating the file handle and closing it, which updates the ** directory information. ** ** fh The handle for the file ** ** returns zero or -ve error code ** *****************************************************************************/ CFSAPI(short) CommitCFSFile(short handle) { short proc = 16; /* function number */ short err = 0; short retCode = 0; short restore = 0; int hand = 0; CFSLONG gtPlace = 0; CFSLONG endPtr = 0; CFSLONG oldDataSz = 0; CFSLONG oldFileSz = 0; CFSLONG oldLastDS = 0; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif ASSERT(handle >= 0); ASSERT(handle < g_maxCfsFiles); ASSERT(g_fileInfo[handle].allowed == writing); if ((handle < 0) || (handle >= g_maxCfsFiles)) { InternalError(handle,proc,BADHANDLE); return BADHANDLE; /* handle out of range */ } pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->allowed != writing) { InternalError(handle,proc,NOTWRIT); return NOTWRIT; /* not for writing */ } if (pfileInfo->fileHeadP->fileSz > pfileInfo->dataHeadP->dataSt) { /* Is there a growing DS ? */ oldDataSz = pfileInfo->dataHeadP->dataSz; oldLastDS = pfileInfo->dataHeadP->lastDS; /* points to header */ oldFileSz = pfileInfo->fileHeadP->fileSz; endPtr = pfileInfo->fileHeadP->endPnt; if (pfileInfo->fileHeadP->dataSecs == 0) pfileInfo->dataHeadP->lastDS = 0; else { pfileInfo->dataHeadP->lastDS = GetTable(handle, pfileInfo->fileHeadP->dataSecs); pfileInfo->dataHeadP->dataSz = pfileInfo->fileHeadP->fileSz - pfileInfo->dataHeadP->dataSt; gtPlace = pfileInfo->dataHeadP->dataSt + BlockRound(handle, pfileInfo->dataHeadP->dataSz); /* pointer to this DS */ if (!FileData(handle,pfileInfo->dataHeadP,gtPlace, (WORD)pfileInfo->fileHeadP->dataHeadSz)) retCode = WRDS; /* error writing DS header */ pfileInfo->fileHeadP->endPnt = gtPlace; pfileInfo->fileHeadP->fileSz = gtPlace + pfileInfo->fileHeadP->dataHeadSz; pfileInfo->fileHeadP->dataSecs++; /* inc data sections */ restore = 1; } } pfileInfo->fileHeadP->tablePos = 0; /* flag no table on disk... */ if (!FileData(handle,pfileInfo->fileHeadP,(CFSLONG)0, (WORD)pfileInfo->fileHeadP->fileHeadSz)) if (retCode == 0) retCode = WRITERR; /* error writing file header */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) /* shut the file for Windows */ if (!FlushFileBuffers(pfileInfo->DOSHdl.d)) retCode = BADHANDLE; #endif if (restore) { pfileInfo->fileHeadP->endPnt = endPtr; pfileInfo->fileHeadP->fileSz = oldFileSz; pfileInfo->dataHeadP->dataSz = oldDataSz; /* size of data */ pfileInfo->dataHeadP->lastDS = oldLastDS; pfileInfo->fileHeadP->dataSecs--; /* dec data sections */ } if (retCode != 0) InternalError(handle,proc,retCode); return retCode; } /****************************************************************************/ /***************** *************************/ /***************** Local function definitions *************************/ /***************** *************************/ /****************************************************************************/ /************************** Find Unused Handle ***************************** ** ** Looks through global array of file information to find first member ** which is not in use. Its index is the local file handle. -1 means none ** available. ** *****************************************************************************/ short FindUnusedHandle(void) { short search; if (g_maxCfsFiles <= 0) /* Do the initial allocation? */ { ASSERT(g_fileInfo == NULL); g_fileInfo = (TFileInfo*)CMemAllcn(INITCEDFILES * sizeof(TFileInfo)); if (g_fileInfo == NULL) return NOMEMR; /* Memory allocation error */ g_maxCfsFiles = INITCEDFILES; /* Number of files we have space for */ for (search = 0; search < g_maxCfsFiles; search++) g_fileInfo[search].allowed = nothing; /* Initialise file info */ } search = g_maxCfsFiles - 1; /* Start index for the search */ while ((search >= 0) && (g_fileInfo[search].allowed != nothing)) search--; if ((search < 0) && (g_maxCfsFiles < MAXCEDFILES)) /* If table is full */ { /* but could be enlarged */ TFileInfo* pNew; int num; num = g_maxCfsFiles * 2; /* Normally, just double the size */ if (num > MAXCEDFILES) num = MAXCEDFILES; /* but limit at the limit */ pNew = (TFileInfo*)CMemAllcn(num * sizeof(TFileInfo));/* Get memory */ if (pNew != NULL) /* and if it suceeded */ { for (search = 0; search < num; search++) /* Initialise memory */ pNew[search].allowed = nothing; /* and copy the data */ memcpy(pNew, g_fileInfo, sizeof(TFileInfo) * g_maxCfsFiles); CFreeAllcn(g_fileInfo); /* Discard old memory area */ g_fileInfo = pNew; /* and save new pointer and count */ g_maxCfsFiles = num; search = num - 1; /* and finally, return the last index */ } } return search; } /* end of FindUnusedHandle */ /***************************** Clean Up Cfs ***************************** ** ** Tries to clean up the CFS library memory prior to the library exiting ** from memory or shutting down. Called as part of Windows DLL cleanup. ** *****************************************************************************/ void CleanUpCfs(void) { int i; for (i = 0; i < g_maxCfsFiles; i++) if (g_fileInfo[i].allowed != nothing)/* Attempt a reliable clean up */ CloseCFSFile((short)i); if (g_fileInfo != NULL) CFreeAllcn(g_fileInfo); /* and final memory release and tidy up */ g_fileInfo = NULL; g_maxCfsFiles = 0; } /************************** Temp Name ************************************* ** ** Make a temporary file name encoding the file handle ** ****************************************************************************/ short TempName(short handle, TpCStr name, TpStr str2, unsigned str2len) { #if defined(_IS_WINDOWS_) short pathstart; short pathend = 0; short search = 0; char fname[WHOLEFILECHARS]; /* To get near variable holding string */ if (strlen(name) < WHOLEFILECHARS) F_strcpy(fname, name); /* Get filename in near var */ pathstart = 0; while (isspace(fname[pathstart])) pathstart++; /* first proper TpStr */ pathend = (short)(pathstart - 1); search = pathstart; /* start at proper start of file name */ while (search <= (short)F_strlen(fname)) { /* scan fname for end of path */ if ((fname[search] == '\\') || (fname[search] == ':')) pathend = search; search++; } /* use path if any to start temporary file name */ if (pathend >= pathstart) { F_strncpy(str2,fname+pathstart,pathend+1-pathstart); /* copy path */ str2[pathend+1-pathstart] = '\0'; /* add null */ } else { if (str2len > 0) F_strcpy(str2,""); /* or initialise to null string */ } F_strcat(str2,"CFS(TMP)."); /* ad standard part of temp file name */ _itoa(handle,gWorkStr,10); /* encode handle into string */ F_strcat(str2,gWorkStr); /* add handle to make complete name */ return 0; #else if (str2len > 12) F_strcpy(str2,"CFSTMPXXXXXX"); return (short)mkstemp(str2); #endif } /************************** Set Sizes ************************************* ** ** Look at array of variable descriptions and using the types add up how ** much space will be needed for all the actual variables in the array ** Return computed space (bytes) or -1 for error. ** *****************************************************************************/ short SetSizes(TpCVDesc theArray, TpShort offsetArray, short numVars) { short SizeOfData[NDATATYPE]; short search,size,runningTotal,errFlag; TpShort pOffsets; TpVDesc pVarDesc; /* set sizes for data types */ SizeOfData[INT1] = 1; SizeOfData[WRD1] = 1; SizeOfData[INT2] = 2; SizeOfData[WRD2] = 2; SizeOfData[INT4] = 4; SizeOfData[RL4] = 4; SizeOfData[RL8] = 8; SizeOfData[LSTR] = 0; errFlag = 0; /* No error */ runningTotal = 0; /* initialise */ for (search = 0;search < numVars;search++) { pOffsets = offsetArray + search; pVarDesc = (TpVDesc)theArray + search; /* Ok to remove const here */ /* check type is in range */ if ((pVarDesc->vType < 0) || (pVarDesc->vType >= NDATATYPE)) return -1; size = SizeOfData[(int)pVarDesc->vType]; if (pVarDesc->vType == LSTR) size = (short)(pVarDesc->vSize + 1); /* allow for NULL */ if ((size < 0) || (size >= MAXSTR)) errFlag = 1; *pOffsets = runningTotal; /* save start offset for each variable */ runningTotal = (short)(runningTotal+size); } if (errFlag) return -1; else return runningTotal; } /* end of setSizes */ /******************** Character handling functions ************************ ** ** TransferIn takes C string format (users storage) ** transfers to CFS storage format (program storage far heap) ** TransferOUT takes CFS storage format (program storage far heap) ** transfers to C string format (users storage). ** NB The length parameter is VITAL for checking strings do not overflow ** their char arrays. ** In both cases the length refers to the number of characters transferred ** neither the length byte nor the NULL are counted in this. ** ****************************************************************************/ /************************** Transfer In *********************************** ** ** Transfer as much as possible, but not more than max characters, of the ** NULL terminated C string old, to the character array new which imitates ** an LSTRING (NULL terminated) ** NB Since the allocated length of new cannot be checked the function relies ** on the parameter max to prevent overflow of new which should be ** declared as char[2+max]. ** new should finish up with new[0] containing the chracter count (0 to 255) ** then new[1] to new[new[0]] containig the characters and new[new[0]+1] ** containing the NULL ** *****************************************************************************/ void TransferIn(TpCStr olds, TpStr pNew, BYTE max) { BYTE lengths; short loop; lengths = (BYTE)F_strlen(olds); /* how many characters to transfer */ if (lengths > max) lengths = max; /* check against specified max */ pNew[0] = lengths; /* assigning an unsigned char to char preserves bit pattern */ /* now copy characters on at a time */ for (loop = 0;loop < (short)lengths;loop++) pNew[loop+1] = olds[loop]; pNew[lengths+1] = '\0'; /* put NULL on end */ } /* end of TransferIn */ /************************* Transfer Out *********************************** ** ** Transfer as much as possible but not more than max characters of the ** Pascal like LSTRING + NULL to an ordinary NULL terminated C string. ** NB new must have been declared at least char[max+1]. ** *****************************************************************************/ void TransferOut(TpCStr olds, TpStr pNew, BYTE max) { BYTE lengths; short loop; lengths = olds[0];/* get the number of chars in the Pascal type LSTRING */ if (lengths > max) lengths = max; /* dont transfer more than max chars */ for (loop = 0;loop < (short)lengths;loop++) pNew[loop] = olds[loop+1]; /* transfer 1 char at a time */ pNew[lengths] = '\0'; /* terminate with NULL */ } /* end of transferOut */ /************************* Set Var Descs ********************************** ** ** NB the useArray will contain its string data as C strings. When strings ** get put into the data structure array in this function they are ** converted to the LSTRING+NULL format required. ** This function sets the data structure variable descriptions and the ** pointers to the corresponding allocated storage positions. ** *****************************************************************************/ void SetVarDescs(short numOfVars, /* number of variable descriptions */ TPointers varPoint, /* pointers to starts of descriptions to be done and data storage places */ TpCVDesc useArray, /* array of values to go in */ TpShort offsets, /* array of computed (setSizes) offsets for data storage */ short vSpace) /* size of data variable area */ { short setloop; TpVDesc p; /* for storage in program use varaible description structs */ for (setloop = 0;setloop < numOfVars;setloop++) { p = varPoint.nameP + setloop; /* point to variable description to set */ p->vSize = offsets[setloop]; /* vsize to hold offset in data array for variable */ p->vType = useArray[setloop].vType; /* copy type from description provided */ p->zeroByte = 0; /* zero extra byte added for MS Pascal compatibility */ TransferIn(useArray[setloop].varUnits,p->varUnits,UNITCHARS); /* units string */ TransferIn(useArray[setloop].varDesc,p->varDesc,DESCCHARS); /* name string */ } /* after the ordinary variable descriptions comes the system one which stores the size of the data space neede for all the variables */ varPoint.nameP[numOfVars].vSize = vSpace; /* now initialise all the variable space to zero */ for (setloop = 0;setloop < vSpace;setloop++) varPoint.dataP[setloop] = 0; } /* end of SetVarDescs */ /************************* Block Round ********************************** ** ** Round up raw (which represents a storage space) to a whole number of blocks ** The block size is to be found in the file info for the program file handle ** specified and is usually 1 or 512. ** *****************************************************************************/ CFSLONG BlockRound(short handle,CFSLONG raw) { CFSLONG retval; short dbs; dbs = g_fileInfo[handle].fileHeadP->diskBlkSize; /* fish out the block size */ if (dbs == 1) retval = raw; else retval = ((raw + dbs - 1) / dbs) * dbs; return retval; } /* end of BlockRound */ /************************* Internal Error ********************************* ** ** Set the global errorInfo values for user to look at, UNLESS it has already ** been used. ** *****************************************************************************/ void InternalError(short handle,short proc,short err) { if (errorInfo.eFound == 0) /* no previous error */ { errorInfo.eFound = 1; errorInfo.eHandleNo = handle; errorInfo.eProcNo = proc; errorInfo.eErrNo = err; } } /* end of Internalerror */ /**************************** File Data *********************************** ** ** Write data to the CFS file corresponding to the program handle. ** Return 1 if ok 0 if not. ** *****************************************************************************/ short FileData(short handle, /* file handle */ TpVoid startP, /* start address from which to transfer */ CFSLONG st, /* file position to which to start writing */ CFSLONG sz) /* number of bytes to transfer */ { WORD res; TpStr pDat = (TpStr)startP; if ((st < 0) || (st >= MAXLSEEK)) return 0; if (CLSeek(g_fileInfo[handle].DOSHdl.d, st, 0) < 0) /* set file pointer */ return 0; if (sz == 0) /* dont try to write 0 bytes it will truncate file */ return 1; while (sz > 0) /* Loop to read the data */ { WORD wr; if (sz > 64000) /* How much to read this time round */ wr = 64000; else wr = (WORD)sz; res = CWriteHandle(g_fileInfo[handle].DOSHdl.d, pDat, wr); /* do write */ if (res == wr) /* keep going if all OK */ { sz -= wr; /* bytes left to do */ pDat += wr; /* pointer to write data */ } else return 0; /* Return failed if not written OK */ } return 1; } /* end of FileData */ /**************************** Load Data *********************************** ** ** Read data from the CFS file corresponding to the program handle. ** Return 1 if ok 0 if not. ** *****************************************************************************/ short LoadData(short handle, /* file handle */ TpVoid startP, /* address in memory to transfer to */ CFSLONG st, /* file position from which to start reading */ CFSLONG sz) /* number of bytes to transfer */ { WORD res; TpStr pDat = (TpStr)startP; if ((st < 0) || (st >= MAXLSEEK)) return 0; if (CLSeek(g_fileInfo[handle].DOSHdl.d,st,0) < 0 ) /* set file pointer */ return 0; while (sz > 0) /* Loop to read the data */ { WORD wr; if (sz > 64000) /* How much to read this time round */ wr = 64000; else wr = (WORD)sz; res = CReadHandle(g_fileInfo[handle].DOSHdl.d, pDat, wr);/* do read */ if (res == wr) /* keep going if all OK */ { sz -= wr; /* bytes left to do */ pDat += wr; /* pointer to read data */ } else return 0; /* Return failed if not read OK */ } return 1; } /* end of LoadData */ /*************************** Get Table *********************************** ** ** Return offset in CFS file for the section,position . ** if the table has been read in then the pointer tableP in g_fileInfo will ** point to it and the entry at (position-1) will correspond to ** the offset for the data section,postiton. ** If the table is not there the offset needs to be read from the ** temporary file. ** *****************************************************************************/ CFSLONG GetTable(short handle, WORD position) { CFSLONG DSPointer; /* return for offset value */ CFSLONG filePosn; /* position in temporary file for offset value */ #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* if table has been read in retrieve offset from it */ if (pfileInfo->tableP != NULL) DSPointer = pfileInfo->tableP[position-1]; else { /* get it from the temporary file */ filePosn = (position-1)*4; /* offset for each DS is CFSLONG ie 4 bytes */ if (pfileInfo->allowed == reading) filePosn=filePosn + pfileInfo->fileHeadP->fileSz - 4*pfileInfo->fileHeadP->dataSecs; CLSeek(pfileInfo->DOSHdl.p, filePosn, 0); /* move to place for read */ CReadHandle(pfileInfo->DOSHdl.p, (TpStr)&DSPointer, 4); /* 4 bytes */ } return DSPointer; } /* end of GetTable */ /*************************** Get Header *********************************** ** ** Reads header of DS requested from CFS file. If current header ** has been altered it is written to the CFS file before being replaced ** by the new one. ** Return value is 0 if all ok and errorcode READERR if failed on reading ** new section or WRITERR if failed when writing current header ** *****************************************************************************/ short GetHeader(short handle, WORD getSection) { CFSLONG tableValue; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif pfileInfo = &g_fileInfo[handle]; /* point to this files information */ if (pfileInfo->thisSection != getSection) /* only get it if different */ { if ((pfileInfo->DSAltered != 0) && /* write changed header to file */ (pfileInfo->allowed != writing)) /* But not if writing */ /* ** can only have DSAltered=1 if GetHeader has already been called and set ** thisSection */ { tableValue = GetTable(handle, pfileInfo->thisSection); if (FileData(handle, pfileInfo->dataHeadP, tableValue, (WORD)pfileInfo->fileHeadP->dataHeadSz) != 0) pfileInfo->DSAltered = 0;/* If saved can clear altered flag */ else return WRITERR; /* error if couldnt save current header */ } tableValue = GetTable(handle, getSection); if (LoadData(handle,pfileInfo->dataHeadP, tableValue, (WORD)pfileInfo->fileHeadP->dataHeadSz) == 0) return READERR; if (pfileInfo->allowed != writing) /* Keep track of actions */ pfileInfo->thisSection = getSection; else pfileInfo->thisSection = 0xFFFF; } return 0; } /* end of getHeader */ /*************************** Store Table *********************************** ** ** Put a CFSLONG offset value into the pointer table or file correspopnding to ** the entry for data section position. ** *****************************************************************************/ void StoreTable(short handle, WORD position, CFSLONG DSPointer) { CFSLONG filePosn; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif pfileInfo = &g_fileInfo[handle]; /* point to this files information */ /* ** look to see if pointer table has been read into memory */ if (pfileInfo->tableP != NULL) { if (position > pfileInfo->fileHeadP->dataSecs) { TpLong pNew; TpVoid pOld = pfileInfo->tableP; /* Previous data pointer */ pNew = (TpLong)CMemAllcn(position*4); if (pNew != NULL) { CMovel(pNew, pfileInfo->tableP, position*4); pfileInfo->tableP = pNew; CFreeAllcn(pOld); } else { /* if (pfileInfo->tableP == NULL) return NOMEMR; BUGBUG what the hell do I do here */ } } pfileInfo->tableP[position-1] = DSPointer; } else { /* table is in temporary file */ filePosn = (CFSLONG)(position-1)*4; /* each entry occupies 4 bytes */ CLSeek(pfileInfo->DOSHdl.p,filePosn,0); CWriteHandle(pfileInfo->DOSHdl.p,(TpStr)&DSPointer,4); } } /* end of storeTable */ /*************************** Recover Table ******************************** ** ** Re-build table holding file offsets of data section headers in the event ** of table size and number of data sections not tallying. ** Uses the information in the file header and individual data section ** headers. ** *****************************************************************************/ short RecoverTable(short handle, /* program file handle */ TpLong relSize, /* location of table size variable */ TpLong tPos, /* location of table position variable this is for return only */ TpUShort dSecs, /* location of number of DS's variable */ TpLong fSize) /* location of file size variable */ { WORD foundSecs,expSecs; CFSLONG secPos,tablePos,maxSecPos,fileSz,tableSz,maxSecs; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif TpFHead fileHP; short retval; THandle pHandle = 0; pfileInfo = &g_fileInfo[handle]; /* point to this files information */ fileHP = pfileInfo->fileHeadP; /* extract values from function parameter pointers */ tableSz = *relSize; /* expected size of table */ fileSz = *fSize; /* expected file size */ expSecs = *dSecs; /* expected number of data sections */ secPos = fileHP->endPnt; /* start place of highest numbered DS */ foundSecs = 0; /* initialise */ maxSecPos = secPos; /* initialise for finding last section in file */ #if 0 if (tableSz > MAXMEMALLOC) return NOMEMR; /* largest memory allocation */ #endif pfileInfo->tableP = (TpLong)CMemAllcn(tableSz); /* allocate space for table */ if (pfileInfo->tableP == NULL) return NOMEMR; maxSecs = tableSz/4; /* memory has been allocated for this number of longs */ if (maxSecs > MAXNODS) maxSecs = MAXNODS; /* dont exceed max */ retval = READERR; while (secPos > 0) /* work back through the data sections */ { foundSecs = (WORD)(foundSecs + 1); /* count how many sections found */ if (foundSecs > (WORD)maxSecs) /* fail if too many */ { retval = XSDS; goto Restore; } pfileInfo->tableP[expSecs-foundSecs] = secPos; /* store the one found starting at end of table */ /* read the DS header into the file info */ if (LoadData(handle,pfileInfo->dataHeadP,secPos, (WORD)fileHP->dataHeadSz) == 0) goto Restore; secPos = pfileInfo->dataHeadP->lastDS; /* extract from header just read in the file position of the previous data section */ if (secPos > maxSecPos) maxSecPos = secPos; /* keep a trace of largest offset found. */ } /* secPos = 0 means that 'previous DS' is in fact the fileheader */ tableSz = 4*foundSecs; /* new value for table size */ tablePos = maxSecPos + fileHP->dataHeadSz; /* end of data header area */ fileSz = tablePos + tableSz; /* new file size */ /* move file pointer to table start position */ if (CLSeek(pfileInfo->DOSHdl.d,tablePos,0) < 0) goto Restore; retval = WRITERR; /* write table to file */ if (CWriteHandle(pfileInfo->DOSHdl.d,(TpStr)&pfileInfo->tableP[expSecs- foundSecs],(WORD)tableSz)< (WORD)tableSz) goto Restore; expSecs = foundSecs; retval = 0; /* all ok */ /* prepare for new value returns via pointer function arguments */ *relSize = tableSz; *tPos = tablePos; *dSecs = expSecs; *fSize = fileSz; Restore:CFreeAllcn(pfileInfo->tableP); pfileInfo->tableP = NULL; return retval; /* error code or 0 */ } /* end of recovertable */ /*************************** Transfer Table ******************************** ** ** Transfer table from current position of file rdHdl to current position ** of file wrHdl in 512 (or 4) byte blocks. ** Return zero or error code ** *****************************************************************************/ short TransferTable(WORD sects, fDef rdHdl, fDef wrHdl) { short retval; TpShort transArr; /* array 512 bytes long */ WORD index,ntran,transSize, lastSize; // THandle pHandle = NULL; CFSLONG lTranBuf; /* last ditch transfer buffer */ retval = 0; /* return value if all ok */ if (sects == 0) return retval; /* Cover our backs */ transSize = 512; /* what we want to transfer */ transArr = (TpShort)CMemAllcn(transSize); if (transArr == NULL) /* have another go with little 4 byte blocks */ { transSize = 4; transArr = (TpShort)&lTranBuf; /* Pointer to stack variable */ } ntran = (WORD)(sects/(transSize/4)); /* number of whole blocks to transfer */ for (index = 1; index <= ntran; index++) { if (CReadHandle(rdHdl,(TpStr)transArr,transSize) < transSize) { retval = READERR; /* retrun error code */ goto Close1; } if (CWriteHandle(wrHdl,(TpStr)transArr,transSize) < transSize) { retval = WRITERR; goto Close1; } } if (ntran * (transSize/4) < sects) /* part of block still to transfer */ { lastSize = (WORD)((sects * 4) - (ntran * transSize)); if (CReadHandle(rdHdl,(TpStr)transArr, lastSize) < lastSize) { retval = READERR; goto Close1; } if (CWriteHandle(wrHdl,(TpStr)transArr, lastSize) < lastSize) retval = WRITERR; } Close1:if (transSize > 4) /* Don't free if using local variable */ CFreeAllcn(transArr); return retval; } /* end of TransferTable */ /*************************** GetMem Table ********************************* ** ** Try to alloacte space for pointer table. ** handle is program file handle, proc is function number from which called. ** Return 1 if alloaction ok 0 if not. ** *****************************************************************************/ short GetMemTable(short handle) { CFSLONG tableSz; #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) TFileInfo _near *pfileInfo; #else TFileInfo *pfileInfo; #endif pfileInfo = &g_fileInfo[handle]; /* point to this files information */ tableSz = 4*(CFSLONG)pfileInfo->fileHeadP->dataSecs; /* 4 bytes per data section */ #if 0 if (tableSz > MAXMEMALLOC) return 0; /* failed */ #endif pfileInfo->tableP = (TpLong)CMemAllcn(tableSz); if (pfileInfo->tableP == NULL) return 0; /* failed */ return 1; /* success */ } /* end of GetMemTable */ /*************************** Allocate Space ******************************** ** ** Function for alloacting space which must be an integral number of steps. ** On entry sizeP points to the variable holding the size of the space ** (in bytes) requested. ** steps is the size in bytes of which the allocated space must be ** an integral multiple. ** On exit the variable pointed to by sizeP is the size of the space ** actually allocated. ** The return value is a pointer to the allocated space, NULL if allocation ** failed. ** *****************************************************************************/ TpStr AllocateSpace(TpUShort sizeP, WORD steps) { WORD buffSize; TpStr buffP; buffSize = *sizeP; /* required buffer size */ buffP = NULL; buffSize = (WORD)((buffSize/steps)*steps); /* truncate to integral number of steps */ while ((buffP == NULL) && (buffSize > 0)) { buffP = (TpStr)CMemAllcn(buffSize); /* do allocation */ if (buffP == NULL) /* want to have another go if failed */ { /* ** try half the size or if this isnt integral number of steps subtract steps */ if (((buffSize/2) % steps) == 0) buffSize = (WORD)(buffSize/2); else buffSize = (WORD)(buffSize - steps); } } /* prepare to return the final size allocated */ *sizeP = buffSize; return buffP; } /* end of AllocateSpace */ /*************************** Extract Bytes ******************************** ** ** Function to extract single channel array from array of interleaved data. ** On entry destP points to the start of array to which to write the ** single channel data. ** dataOffset is the offset in that array at which to start writing. ** srcP points to the start of the interleaved data. ** points is the number of data points to transfer. ** spacing is the number of bytes between data points of ** the channel required in the source array. ** ptSz is the number of bytes per point. ** *****************************************************************************/ void ExtractBytes(TpStr destP,WORD dataOffset,TpStr srcP, WORD points,WORD spacing,WORD ptSz) { WORD index; destP = destP + dataOffset; for (index = 0;index < points;index++) { CMovel(destP,srcP,ptSz); /* Transfer 1 point */ srcP = srcP + spacing; /* move to next point in source */ destP = destP + ptSz; /* move to place for next point */ } } /* end of ExtractBytes */ /*************************** File Update ******************************** ** ** Called when access to file is editing, the file has not yet been changed ** (tablePos != 0) but a real change is about to be made. ** It effectively removes the pointer table from the file and updates the ** file header accordingly. Returns 0 or error code. ** *****************************************************************************/ short FileUpdate(short handle, /* program file handle */ TpFHead fileHP) /* address in memory of file header */ { /* ** 1. Flag that table pointers removed from file */ fileHP->tablePos = 0; /* ** 2. Effect removal of memory table by not including it in file length */ fileHP->fileSz = fileHP->fileSz - 4 * fileHP->dataSecs; /* 4 bytes per DS */ /* ** 3. Write this information to the file as new file header. */ if (FileData(handle, fileHP, 0L, fileHP->fileHeadSz) == 0) return WRITERR; else return 0; } /* end of FileUpdate */ /******************************** E N D **********************************/ stimfit-0.16.0/src/libstfio/cfs/cfs.h0000775000175000017500000002400113277303516014310 00000000000000/***************************************************************************** ** ** cfs.h ** 78 cols --->* ** Header file for MSC version of CFS functions. ** Definitions of the structures and routines for the CFS filing * ** system. This is the include file for standard use, all access * ** is by means of functions - no access to the internal CFS data. The file * ** machine.h provides some common definitions across separate platforms, * ** note that the MS variants are designed to accomodate medium model - far * ** pointers are explicitly used where necessary. ** ** CFSAPI Don't declare this to give a pascal type on the Mac, there is a MPW ** compiler bug that corrupts floats passed to pascal functions!!!!!! ** */ #ifndef __CFS__ #define __CFS__ #include "machine.h" #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) #include #define qDebug 0 /* only used to debug Mac stuff */ #define CFSAPI(type) type WINAPI #undef LLIO #undef USEHANDLES #ifdef _MSC_VER #pragma warning( disable : 4251 ) // Disable warning messages #pragma warning( disable : 4996 ) // Disable warning messages #endif #else #define qDebug 0 /* only used to debug Mac stuff */ #if !defined(__APPLE__) && !defined(__MINGW32) #include #endif #include /* MSC I/O function definitions */ #include #include #define CFSAPI(type) type #endif #define FILEVAR 0 /* Constants to indicate whether variable is */ #define DSVAR 1 /* file or data section variable. */ #define INT1 0 /* DATA VARIABLE STORAGE TYPES */ #define WRD1 1 #define INT2 2 #define WRD2 3 #define INT4 4 #define RL4 5 #define RL8 6 #define LSTR 7 #define SUBSIDIARY 2 /* Chan Data Storage types */ #define MATRIX 1 #define EQUALSPACED 0 /* Chan Data Storage types */ #define noFlags 0 /* Declare a default flag */ /* Definitions of bits for DS flags */ #define FLAG7 1 #define FLAG6 2 #define FLAG5 4 #define FLAG4 8 #define FLAG3 16 #define FLAG2 32 #define FLAG1 64 #define FLAG0 128 #define FLAG15 256 #define FLAG14 512 #define FLAG13 1024 #define FLAG12 2048 #define FLAG11 4096 #define FLAG10 8192 #define FLAG9 16384 #define FLAG8 32768 /* define numbers of characters in various string types */ #define DESCCHARS 20 #define FNAMECHARS 12 #define COMMENTCHARS 72 #define UNITCHARS 8 /*character arrays used in data structure */ typedef char TDataType; typedef char TCFSKind; typedef char TDesc[DESCCHARS+2]; /* Names in descriptions, 20 chars */ typedef char TFileName[FNAMECHARS+2]; /* File names, 12 chars */ typedef char TComment[COMMENTCHARS+2]; /* Comment, 72 chars max */ typedef char TUnits[UNITCHARS+2]; /* For units, 8 chars */ /* other types for users benefit */ typedef WORD TSFlags; /* for data and data section variables */ typedef struct { TDesc varDesc; /* users description of variable */ TDataType vType; /* one of 8 types allowed */ char zeroByte; /* for MS Pascal compatibility */ TUnits varUnits; /* users name for units */ short vSize; /* for type lstr gives no. of chars +1 for length byte */ } TVarDesc; #if !defined(_IS_WINDOWS_) || defined(__MINGW32__) typedef char * TpStr; typedef const char * TpCStr; typedef short * TpShort; typedef float * TpFloat; typedef CFSLONG * TpLong; typedef void * TpVoid; typedef TSFlags * TpFlags; typedef TDataType * TpDType; typedef TCFSKind * TpDKind; typedef TVarDesc * TpVDesc; typedef const TVarDesc * TpCVDesc; typedef THandle * TpHandle; typedef signed char * TpSStr; typedef WORD * TpUShort; #else typedef char FAR * TpStr; typedef const char FAR * TpCStr; typedef short FAR * TpShort; typedef float FAR * TpFloat; typedef CFSLONG FAR * TpLong; typedef void FAR * TpVoid; typedef TSFlags FAR * TpFlags; typedef TDataType FAR * TpDType; typedef TCFSKind FAR * TpDKind; typedef TVarDesc FAR * TpVDesc; typedef const TVarDesc FAR * TpCVDesc; typedef THandle FAR * TpHandle; typedef signed char FAR * TpSStr; typedef WORD FAR * TpUShort; #endif #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) typedef HANDLE fDef; /* WIN32 file handle */ #else #ifdef LLIO typedef short fDef; /* file handle */ #else typedef FILE* fDef; /* stream identifier */ #endif #endif #ifdef __cplusplus extern "C" { #endif /* ** Now definitions of the functions defined in the code */ CFSAPI(short) CreateCFSFile(TpCStr fname, TpCStr comment, WORD blocksize, short channels, TpCVDesc fileArray, TpCVDesc DSArray, short fileVars, short DSVars); CFSAPI(void) SetFileChan(short handle, short channel, TpCStr channelName, TpCStr yUnits, TpCStr xUnits, TDataType dataType, TCFSKind dataKind, short spacing, short other); CFSAPI(void) SetDSChan(short handle, short channel, WORD dataSection, CFSLONG startOffset, CFSLONG points, float yScale, float yOffset, float xScale, float xOffset); CFSAPI(short) WriteData(short handle, WORD dataSection, CFSLONG startOffset, WORD bytes, TpVoid dataADS); CFSAPI(short) ClearDS(short handle); CFSAPI(void) SetWriteData(short handle, CFSLONG startOffset, CFSLONG bytes); CFSAPI(CFSLONG) CFSFileSize(short handle); CFSAPI(short) InsertDS(short handle, WORD dataSection, TSFlags flagSet); CFSAPI(short) AppendDS(short handle, CFSLONG lSize, TSFlags flagSet); CFSAPI(void) RemoveDS(short handle, WORD dataSection); CFSAPI(void) SetComment(short handle, TpCStr comment); CFSAPI(void) SetVarVal(short handle, short varNo, short varKind, WORD dataSection, TpVoid varADS); CFSAPI(short) CloseCFSFile(short handle); CFSAPI(short) OpenCFSFile(TpCStr fname, short enableWrite, short memoryTable); CFSAPI(void) GetGenInfo(short handle, TpStr time, TpStr date, TpStr comment); CFSAPI(void) GetFileInfo(short handle, TpShort channels, TpShort fileVars, TpShort DSVars, TpUShort dataSections); CFSAPI(void) GetVarDesc(short handle, short varNo, short varKind, TpShort varSize, TpDType varType, TpStr units, TpStr description); CFSAPI(void) GetVarVal(short handle, short varNo, short varKind, WORD dataSection, TpVoid varADS); CFSAPI(void) GetFileChan(short handle, short channel, TpStr channelName, TpStr yUnits, TpStr xUnits, TpDType dataType, TpDKind dataKind, TpShort spacing, TpShort other); CFSAPI(void) GetDSChan(short handle, short channel, WORD dataSection, TpLong startOffset, TpLong points, TpFloat yScale, TpFloat yOffset, TpFloat xScale, TpFloat xOffset); CFSAPI(WORD) GetChanData(short handle, short channel, WORD dataSection, CFSLONG firstElement, WORD numberElements, TpVoid dataADS, CFSLONG areaSize); CFSAPI(CFSLONG) GetDSSize(short handle, WORD dataSection); CFSAPI(short) ReadData(short handle, WORD dataSection, CFSLONG startOffest, WORD bytes, TpVoid dataADS); CFSAPI(WORD) DSFlagValue(int nflag); CFSAPI(void) DSFlags(short handle, WORD dataSection, short setIt, TpFlags pflagSet); CFSAPI(short) FileError(TpShort handleNo, TpShort procNo, TpShort errNo); CFSAPI(short) CommitCFSFile(short handle); #ifdef __cplusplus } #endif #endif /* __CFS__ */ stimfit-0.16.0/src/libstfio/cfs/cfslib.cpp0000775000175000017500000005675313277303516015355 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include #include "./cfslib.h" #include "./cfs.h" #include "../recording.h" namespace stfio { int CFSError(std::string& errorMsg); std::string CFSReadVar(short fHandle,short varNo,short varKind); // Resource management of CFS files // Management of read-only files: class CFS_IFile { public: explicit CFS_IFile(const std::string& filename); ~CFS_IFile(); short myHandle; }; // Management of write-only files: class CFS_OFile { public: explicit CFS_OFile( const std::string& filename, const std::string& comment, std::size_t nChannels=1 ); ~CFS_OFile(); short myHandle; }; const int CFSMAXBYTES=64000; // adopted from FPCfs.ips by U Froebe } stfio::CFS_IFile::CFS_IFile(const std::string& filename) { myHandle = OpenCFSFile(filename.c_str(),0,1); } stfio::CFS_IFile::~CFS_IFile() { if (myHandle>0) { CloseCFSFile(myHandle); } } // Management of write-only files: stfio::CFS_OFile::CFS_OFile(const std::string& filename,const std::string& comment,std::size_t nChannels) { TVarDesc *c_DSArray, *c_fileArray; c_DSArray=NULL; c_fileArray=NULL; myHandle=CreateCFSFile(filename.c_str(), comment.c_str(), 512, (short)nChannels, c_fileArray, c_DSArray, 0/*number of file vars*/, 0/*number of section vars*/); } stfio::CFS_OFile::~CFS_OFile() { CloseCFSFile(myHandle); } int stfio::CFSError(std::string& errorMsg) { short pHandle; short pFunc; short pErr; if (!FileError(&pHandle,&pFunc,&pErr)) return 0; errorMsg = "Error in stfio::"; switch (pFunc) { case (1): errorMsg += "SetFileChan()"; break; case (2): errorMsg += "SetDSChan()"; break; case (3): errorMsg += "SetWriteData()"; break; case (4): errorMsg += "RemoveDS()"; break; case (5): errorMsg += "SetVarVal()"; break; case (6): errorMsg += "GetGenInfo()"; break; case (7): errorMsg += "GetFileInfo()"; break; case (8): errorMsg += "GetVarDesc()"; break; case (9): errorMsg += "GetVarVal()"; break; case (10): errorMsg += "GetFileChan()"; break; case (11): errorMsg += "GetDSChan()"; break; case (12): errorMsg += "DSFlags()"; break; case (13): errorMsg += "OpenCFSFile()"; break; case (14): errorMsg += "GetChanData()"; break; case (15): errorMsg += "SetComment()"; break; case (16): errorMsg += "CommitCFSFile()"; break; case (17): errorMsg += "InsertDS()"; break; case (18): errorMsg += "CreateCFSFile()"; break; case (19): errorMsg += "WriteData()"; break; case (20): errorMsg += "ClearDS()"; break; case (21): errorMsg += "CloseCFSFile()"; break; case (22): errorMsg += "GetDSSize()"; break; case (23): errorMsg += "ReadData()"; break; case (24): errorMsg += "CFSFileSize()"; break; case (25): errorMsg += "AppendDS()"; break; default : errorMsg += ", unknown function"; break; } errorMsg += ":\n"; switch (pErr) { case (-1): errorMsg += "No spare file handles."; break; case (-2): errorMsg += "File handle out of range 0-2."; break; case (-3): errorMsg += " File not open for writing."; break; case (-4): errorMsg += "File not open for editing/writing."; break; case (-5): errorMsg += "File not open for editing/reading."; break; case (-6): errorMsg += "File not open."; break; case (-7): errorMsg += "The specified file is not a CFS file."; break; case (-8): errorMsg += "Unable to allocate the memory needed for the filing system data."; break; case (-11): errorMsg += "Creation of file on disk failed (writing only)."; break; case (-12): errorMsg += "Opening of file on disk failed (reading only)."; break; case (-13): errorMsg += "Error reading from data file."; break; case (-14): errorMsg += "Error writing to data file."; break; case (-15): errorMsg += "Error reading from data section pointer file."; break; case (-16): errorMsg += "Error writing to data section pointer file."; break; case (-17): errorMsg += "Error seeking disk position."; break; case (-18): errorMsg += "Error inserting final data section of the file."; break; case (-19): errorMsg += "Error setting the file length."; break; case (-20): errorMsg += "Invalid variable description."; break; case (-21): errorMsg += "Parameter out of range 0-99."; break; case (-22): errorMsg += "Channel number out of range"; break; case (-24): errorMsg += "Invalid data section number (not in the range 1 to total number of sections)."; break; case (-25): errorMsg += "Invalid variable kind (not 0 for file variable or 1 for DS variable)."; break; case (-26): errorMsg += "Invalid variable number."; break; case (-27): errorMsg += "Data size specified is out of the correct range."; break; case (-30): case (-31): case (-32): case (-33): case (-34): case (-35): case (-36): case (-37): case (-38): case (-39): errorMsg += "Wrong CFS version number in file"; break; default : errorMsg += "An unknown error occurred"; break; } return pErr; } std::string stfio::CFSReadVar(short fHandle,short varNo,short varKind) { std::string errorMsg; std::ostringstream outputstream; TUnits units; std::vector description(DESCCHARS); short varSize=0; TDataType varType; //Get description of a particular file variable //- see manual of CFS file system GetVarDesc(fHandle,varNo,varKind,&varSize,&varType,units,&description[0]); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); //I haven't found a way to directly pass a std::string to GetVarDesc; //passing &s_description[0] won't work correctly. // Added 11/27/06, CSH: Should be possible with vector std::string s_description(description.begin(), description.end()); if (s_description.substr(0,5) != "Spare") { switch (varType) { //Begin switch 'varType' case INT1: case INT2: case INT4: { short shortBuffer=0; //Read the value of the file variable //- see manual of CFS file system GetVarVal(fHandle,varNo,varKind, 1,&shortBuffer); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); outputstream << s_description << " " << shortBuffer << " " << units; break; } case WRD1: case WRD2: { unsigned short ushortBuffer=0; GetVarVal(fHandle,varNo,varKind, 1,&ushortBuffer); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); outputstream << s_description << " " << ushortBuffer << " " << units; break; } case RL4: case RL8: { float floatBuffer=0; GetVarVal(fHandle,varNo,varKind, 1,&floatBuffer); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); outputstream << s_description << " " << floatBuffer << " " << units; break; } case LSTR: { std::vector vc(varSize+2); GetVarVal(fHandle,varNo,varKind, 1, &vc[0]); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); std::string s; s.resize(vc.size()); int ns = 0; for (std::vector::iterator it=vc.begin(); it != vc.end(); ++it) { if ((int)*it == 13) s[ns] = '\n'; else if ((int)*it < 0) s[ns] = '?'; else s[ns] = *it; ns++; } if (s_description.substr(0,11) == "ScriptBlock") { outputstream << s; } else { outputstream << s_description << " " << s; } break; } default: break; } //End switch 'varType' if (s_description.substr(0,11) != "ScriptBlock" ) { outputstream << "\n"; } } return outputstream.str(); } bool stfio::exportCFSFile(const std::string& fName, const Recording& WData, stfio::ProgressInfo& progDlg) { std::string errorMsg; if (fName.length()>1024) { throw std::runtime_error( "Sorry for the inconvenience, but the CFS\n" "library is a bit picky with filenames.\n" "Please restrict yourself to less than\n" "1024 characters.\n" ); } CFS_OFile CFSFile(fName, WData.GetComment(), WData.size()); if (CFSFile.myHandle<0) { std::string errorMsg; CFSError(errorMsg); throw std::runtime_error(errorMsg); } for (std::size_t n_c=0;n_c points(dataSections); TDataType dataType; TCFSKind dataKind; short spacing, other; float xScale=1.0; std::size_t empty_channels=0; for (short n_channel=0; n_channel < channelsAvail; ++n_channel) { //Get constant information for a particular data channel - //see manual of CFS file system. std::vector vchannel_name(22),vyUnits(10),vxUnits(10); CFSLONG startOffset; GetFileChan(CFSFile.myHandle, n_channel, &vchannel_name[0], &vyUnits[0], &vxUnits[0], &dataType, &dataKind, &spacing, &other); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); std::string channel_name(&vchannel_name[0]), xUnits(&vxUnits[0]), yUnits(&vyUnits[0]); //Memory allocation for the current channel float yScale, yOffset, xOffset; //Begin loop: read scaling and offsets //Write the formatted string from 'n_channel' and 'channel_name' to 'buffer' std::ostringstream outputstream; outputstream << "Channel " << n_channel << " (" << channel_name.c_str() << ")\n"; scaling += outputstream.str(); //Get the channel information for a data section or a file //- see manual of CFS file system GetDSChan(CFSFile.myHandle, n_channel /*first channel*/, 1 /*first section*/, &startOffset, &points[0], &yScale, &yOffset,&xScale,&xOffset); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); //Write the formatted string from 'yScale' to 'buffer' outputstream.clear(); outputstream << "Yscale=" << yScale << "\n"; scaling += outputstream.str(); //Write the formatted string from 'xScale' to 'buffer' outputstream.clear(); outputstream << "Xscale=" << xScale << "\n"; scaling += outputstream.str(); //Write the formatted string from 'yOffset' to 'buffer' outputstream.clear(); outputstream << "YOffset=" << yOffset << "\n"; scaling += outputstream.str(); //Write the formatted string from 'xOffset' to 'buffer' outputstream.clear(); outputstream << "XOffset=" << xOffset << "\n"; scaling += outputstream.str(); Channel TempChannel(dataSections); TempChannel.SetChannelName(channel_name); TempChannel.SetYUnits(yUnits); std::size_t empty_sections=0; for (int n_section=0; n_section < dataSections; ++n_section) { int progbar = // Channel contribution: (int)(((double)n_channel/(double)channelsAvail)*100.0+ // Section contribution: (double)n_section/(double)dataSections*(100.0/channelsAvail)); std::ostringstream progStr; progStr << "Reading channel #" << n_channel + 1 << " of " << channelsAvail << ", Section #" << n_section+1 << " of " << dataSections; progDlg.Update(progbar, progStr.str()); //Begin loop: n_sections //Get the channel information for a data section or a file //- see manual of CFS file system CFSLONG startOffset; float yScale, yOffset, xOffset; GetDSChan(CFSFile.myHandle,(short)n_channel,(WORD)n_section+1,&startOffset, &points[n_section],&yScale,&yOffset,&xScale,&xOffset); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); std::ostringstream label; label << fName << ", Section # " << n_section+1; Section TempSection( (int)(points[n_section]), label.str() ); //----------------------------------------------------- //The following part was modified to read data sections //larger than 64 KB as e.g. produced by Igor. //Adopted from FPCfs.ipf by U Froebe //Sections with a size larger than 64 KB have been made //possible by dividing CFS-sections into 'blocks' //----------------------------------------------------- int nBlocks, //number of blocks nBlockBytes; //number of bytes per block //Calculation of the number of blocks depending on the data format: //RL4 - 4 byte floating point numbers (2 byte int numbers otherwise) if (dataType == RL4) nBlocks=(int)(((points[n_section]*4-1)/CFSMAXBYTES) + 1); else nBlocks=(int)(((points[n_section]*2-1)/CFSMAXBYTES) + 1); for (int b=0; b < nBlocks; ++b) { //Begin loop: storage of blocks if (dataType == RL4) { //4 byte data //Read data of the current channel and data section //- see manual of CFS file system //Temporary arrays to store blocks: if (b == nBlocks - 1) nBlockBytes=points[n_section]*4 - b*CFSMAXBYTES; else nBlockBytes=CFSMAXBYTES; Vector_float fTempSection_small(nBlockBytes); GetChanData(CFSFile.myHandle, (short)n_channel, (WORD)n_section+1, b*CFSMAXBYTES/4, (WORD)nBlockBytes/4, &fTempSection_small[0], 4*(points[n_section]+1)); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); for (int n=0; n TempSection_small(nBlockBytes); GetChanData(CFSFile.myHandle, (short)n_channel, (WORD)n_section+1, b*CFSMAXBYTES/2, (WORD)nBlockBytes/2, &TempSection_small[0], 2*(points[n_section]+1)); if (CFSError(errorMsg)) throw std::runtime_error(errorMsg); for (int n=0; n #if ( __WORDSIZE == 64 ) || defined (__APPLE__) #define CFSLONG int #else #define CFSLONG long #endif #include /* Needed for various types */ #include /* ditto */ #include /* for LDBL_DIG */ #if defined(WIN32) || defined (_MSC_VER) /* if its windows define our windows symbol */ #define _IS_WINDOWS_ /* WIN32 is defined for 32-bit at moment */ #undef _IS_MSDOS_ /* and we arent doing msdos after all */ #endif #ifdef _INC_WINDOWS /* the alternative windows symbolic defn */ #ifndef _IS_WINDOWS_ /* as above but _INC_WINDOWS is for 16 bit */ #define _IS_WINDOWS_ #endif #undef _IS_MSDOS_ /* and we arent doing msdos after all */ #endif #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #if defined(_IS_WINDOWS_) && !defined(__MINGW32__) /* Now set up for windows use */ #include #define F_memcpy memcpy /* Define model-independent routines */ #define F_memmove memmove #define F_strlen strlen #define F_strcat strcat #define F_strcpy strcpy #define F_strcmp strcmp #define F_strncat strncat #define F_strncpy strncpy #define F_strncmp strncmp #define F_strchr strchr #define _fstrrchr strrchr #define _near /* stop compiler errors for 32 bit compile*/ #define DllExport __declspec(dllexport) #define DllImport __declspec(dllimport) typedef CFSLONG Coord; /* this is LONG in the MacApp definitions */ typedef double fdouble; #define FDBL_DIG DBL_DIG #define FDBL_MAX DBL_MAX typedef HGLOBAL THandle; #define F_malloc malloc #define F_free free #define M_AllocMem(x) GlobalAlloc(GMEM_MOVEABLE,x) #define M_AllocClear(x) GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT,x) #define M_FreeMem(x) GlobalFree(x) #define M_LockMem(x) GlobalLock(x) #define M_MoveLockMem(x) GlobalLock(x) #define M_UnlockMem(x) (GlobalUnlock(x)==0) #define M_NewMemSize(x,y) (x = GlobalReAlloc(x,y,GMEM_MOVEABLE)) #define M_GetMemSize(x) GlobalSize(x) #else #define F_memcpy memcpy #define F_memmove memmove #define F_strlen strlen #define F_strcat strcat #define F_strcpy strcpy #define F_strcmp strcmp #define F_strncat strncat #define F_strncpy strncpy #define F_strncmp strncmp #define F_strchr strchr #define FAR #define PASCAL #define _far #define _near #define DllExport #define DllImport #define FDBL_DIG LDBL_DIG #define FDBL_MAX LDBL_MAX typedef char * LPSTR; typedef const char * LPCSTR; typedef unsigned short WORD; // typedef unsigned CFSLONG DWORD; typedef unsigned char BYTE; typedef long double fdouble; typedef CFSLONG Coord; /* Borrowed from MacApp */ typedef WORD THandle; #define F_malloc malloc #define F_free free #define M_AllocMem(x) NewHandle(x) #define M_AllocClear(x) NewHandleClear(x) #define M_FreeMem(x) DisposHandle(x) #define M_LockMem(x) (HLock(x),*x) #define M_MoveLockMem(x) (HLockHi(x),*x) #define M_UnlockMem(x) (HUnlock(x),TRUE) #define M_NewMemSize(x,y) (SetHandleSize(x,y),MemError() == 0) #define M_GetMemSize(x) GetHandleSize(x) #endif /*UNIX*/ #endif /* not defined __MACHINE__ */ stimfit-0.16.0/src/libstfio/igor/0000775000175000017500000000000013567226445013640 500000000000000stimfit-0.16.0/src/libstfio/igor/IgorBin.h0000775000175000017500000002220713277303516015261 00000000000000// IgorBin.h -- structures and #defines for dealing with Igor binary data. #ifdef __cplusplus extern "C" { #endif // All structures written to disk are 2-byte-aligned. #if GENERATINGPOWERPC #pragma options align=mac68k #endif #define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1]) #if 1 // def WIN32 #pragma pack(2) #endif #if ( __WORDSIZE == 64 ) || defined (__APPLE__) #define IGORLONG int #else #define IGORLONG long #endif typedef void** Handle; // From IgorMath.h #define NT_CMPLX 1 // Complex numbers. #define NT_FP32 2 // 32 bit fp numbers. #define NT_FP64 4 // 64 bit fp numbers. #define NT_I8 8 // 8 bit signed integer. Requires Igor Pro 2.0 or later. #define NT_I16 0x10 // 16 bit integer numbers. Requires Igor Pro 2.0 or later. #define NT_I32 0x20 // 32 bit integer numbers. Requires Igor Pro 2.0 or later. #define NT_UNSIGNED 0x40 // Makes above signed integers unsigned. Requires Igor Pro 3.0 or later. // From wave.h #define MAXDIMS 4 // From binary.h typedef struct BinHeader1 { short version; // Version number for backwards compatibility. IGORLONG wfmSize; // The size of the WaveHeader2 data structure plus the wave data plus 16 bytes of padding. short checksum; // Checksum over this header and the wave header. } BinHeader1; typedef struct BinHeader2 { short version; // Version number for backwards compatibility. IGORLONG wfmSize; // The size of the WaveHeader2 data structure plus the wave data plus 16 bytes of padding. IGORLONG noteSize; // The size of the note text. IGORLONG pictSize; // Reserved. Write zero. Ignore on read. short checksum; // Checksum over this header and the wave header. } BinHeader2; typedef struct BinHeader3 { short version; // Version number for backwards compatibility. IGORLONG wfmSize; // The size of the WaveHeader2 data structure plus the wave data plus 16 bytes of padding. IGORLONG noteSize; // The size of the note text. IGORLONG formulaSize; // The size of the dependency formula, if any. IGORLONG pictSize; // Reserved. Write zero. Ignore on read. short checksum; // Checksum over this header and the wave header. } BinHeader3; typedef struct BinHeader5 { short version; // Version number for backwards compatibility. short checksum; // Checksum over this header and the wave header. IGORLONG wfmSize; // The size of the WaveHeader5 data structure plus the wave data. IGORLONG formulaSize; // The size of the dependency formula, if any. IGORLONG noteSize; // The size of the note text. IGORLONG dataEUnitsSize; // The size of optional extended data units. IGORLONG dimEUnitsSize[MAXDIMS]; // The size of optional extended dimension units. IGORLONG dimLabelsSize[MAXDIMS]; // The size of optional dimension labels. IGORLONG sIndicesSize; // The size of string indicies if this is a text wave. IGORLONG optionsSize1; // Reserved. Write zero. Ignore on read. IGORLONG optionsSize2; // Reserved. Write zero. Ignore on read. } BinHeader5; // From wave.h #define MAX_WAVE_NAME2 18 // Maximum length of wave name in version 1 and 2 files. Does not include the trailing null. #define MAX_WAVE_NAME5 31 // Maximum length of wave name in version 5 files. Does not include the trailing null. #define MAX_UNIT_CHARS 3 // Header to an array of waveform data. struct WaveHeader2 { short type; // See types (e.g. NT_FP64) above. Zero for text waves. struct WaveHeader2 **next; // Used in memory only. Write zero. Ignore on read. char bname[MAX_WAVE_NAME2+2]; // Name of wave plus trailing null. short whVersion; // Write 0. Ignore on read. short srcFldr; // Used in memory only. Write zero. Ignore on read. Handle fileName; // Used in memory only. Write zero. Ignore on read. char dataUnits[MAX_UNIT_CHARS+1]; // Natural data units go here - null if none. char xUnits[MAX_UNIT_CHARS+1]; // Natural x-axis units go here - null if none. IGORLONG npnts; // Number of data points in wave. short aModified; // Used in memory only. Write zero. Ignore on read. double hsA,hsB; // X value for point p = hsA*p + hsB short wModified; // Used in memory only. Write zero. Ignore on read. short swModified; // Used in memory only. Write zero. Ignore on read. short fsValid; // True if full scale values have meaning. double topFullScale,botFullScale; // The min full scale value for wave. char useBits; // Used in memory only. Write zero. Ignore on read. char kindBits; // Reserved. Write zero. Ignore on read. void **formula; // Used in memory only. Write zero. Ignore on read. IGORLONG depID; // Used in memory only. Write zero. Ignore on read. unsigned IGORLONG creationDate; // DateTime of creation. Not used in version 1 files. char wUnused[2]; // Reserved. Write zero. Ignore on read. unsigned IGORLONG modDate; // DateTime of last modification. Handle waveNoteH; // Used in memory only. Write zero. Ignore on read. float wData[4]; // The start of the array of waveform data. }; typedef struct WaveHeader2 WaveHeader2; typedef WaveHeader2 *WavePtr2; typedef WavePtr2 *waveHandle2; struct WaveHeader5 { #if defined(_WINDOWS) && !defined(__MINGW32__) struct WaveHeader5 **next; // link to next wave in linked list. #else int next; #endif unsigned IGORLONG creationDate; // DateTime of creation. unsigned IGORLONG modDate; // DateTime of last modification. IGORLONG npnts; // Total number of points (multiply dimensions up to first zero). short type; // See types (e.g. NT_FP64) above. Zero for text waves. short dLock; // Reserved. Write zero. Ignore on read. char whpad1[6]; // Reserved. Write zero. Ignore on read. short whVersion; // Write 1. Ignore on read. char bname[MAX_WAVE_NAME5+1]; // Name of wave plus trailing null. IGORLONG whpad2; // Reserved. Write zero. Ignore on read. #if defined(_WINDOWS) && !defined(__MINGW32__) struct DataFolder **dFolder; // Used in memory only. Write zero. Ignore on read. #else int dFolder; // Used in memory only. Write zero. Ignore on read. #endif // Dimensioning info. [0] == rows, [1] == cols etc IGORLONG nDim[MAXDIMS]; // Number of of items in a dimension -- 0 means no data. double sfA[MAXDIMS]; // Index value for element e of dimension d = sfA[d]*e + sfB[d]. double sfB[MAXDIMS]; // SI units char dataUnits[MAX_UNIT_CHARS+1]; // Natural data units go here - null if none. char dimUnits[MAXDIMS][MAX_UNIT_CHARS+1]; // Natural dimension units go here - null if none. short fsValid; // TRUE if full scale values have meaning. short whpad3; // Reserved. Write zero. Ignore on read. double topFullScale,botFullScale; // The max and max full scale value for wave. #if defined(_WINDOWS) && !defined(__MINGW32__) Handle dataEUnits; // Used in memory only. Write zero. Ignore on read. Handle dimEUnits[MAXDIMS]; // Used in memory only. Write zero. Ignore on read. Handle dimLabels[MAXDIMS]; // Used in memory only. Write zero. Ignore on read. Handle waveNoteH; // Used in memory only. Write zero. Ignore on read. #else int dataEUnits; // Used in memory only. Write zero. Ignore on read. int dimEUnits[MAXDIMS]; // Used in memory only. Write zero. Ignore on read. int dimLabels[MAXDIMS]; // Used in memory only. Write zero. Ignore on read. int waveNoteH; // Used in memory only. Write zero. Ignore on read. #endif IGORLONG whUnused[16]; // Reserved. Write zero. Ignore on read. // The following stuff is considered private to Igor. short aModified; // Used in memory only. Write zero. Ignore on read. short wModified; // Used in memory only. Write zero. Ignore on read. short swModified; // Used in memory only. Write zero. Ignore on read. char useBits; // Used in memory only. Write zero. Ignore on read. char kindBits; // Reserved. Write zero. Ignore on read. #if defined(_WINDOWS) && !defined(__MINGW32__) void **formula; // Used in memory only. Write zero. Ignore on read. #else int formula; #endif IGORLONG depID; // Used in memory only. Write zero. Ignore on read. short whpad4; // Reserved. Write zero. Ignore on read. short srcFldr; // Used in memory only. Write zero. Ignore on read. #if defined(_WINDOWS) && !defined(__MINGW32__) Handle fileName; // Used in memory only. Write zero. Ignore on read. IGORLONG **sIndices; // Used in memory only. Write zero. Ignore on read. #else int fileName; // Used in memory only. Write zero. Ignore on read. int sIndices; // Used in memory only. Write zero. Ignore on read. #endif float wData[1]; // The start of the array of data. Must be 64 bit aligned. }; typedef struct WaveHeader5 WaveHeader5; typedef WaveHeader5 *WavePtr5; typedef WavePtr5 *WaveHandle5; #if GENERATINGPOWERPC #pragma options align=reset #endif #if 1 //def WIN32 #pragma pack() #endif // All structures written to disk are 2-byte-aligned. #ifdef __cplusplus } #endif stimfit-0.16.0/src/libstfio/igor/WriteWave.c0000775000175000017500000001552313277303516015643 00000000000000// This file contains an example of writing a wave file. #include #include #include #include #include #include "IgorBin.h" #include "CrossPlatformFileIO.h" /* Checksum(data,oldcksum,numbytes) Returns shortwise simpleminded checksum over the data. ASSUMES data starts on an even boundary. */ static int Checksum(short *data, int oldcksum, int numbytes) { numbytes >>= 1; // 2 bytes to a short -- ignore trailing odd byte. while(numbytes-- > 0) oldcksum += *data++; return oldcksum&0xffff; } /* NumBytesPerPoint(int type) Given a numeric wave type, returns the number of data bytes per point. */ static int NumBytesPerPoint(int type) { int numBytesPerPoint; // Consider the number type, not including the complex bit or the unsigned bit. switch(type & ~(NT_CMPLX | NT_UNSIGNED)) { case NT_I8: numBytesPerPoint = 1; // char break; case NT_I16: numBytesPerPoint = 2; // short break; case NT_I32: numBytesPerPoint = 4; // IGORLONG break; case NT_FP32: numBytesPerPoint = 4; // float break; case NT_FP64: numBytesPerPoint = 8; // double break; default: return 0; break; } if (type & NT_CMPLX) numBytesPerPoint *= 2; // Complex wave - twice as many points. return numBytesPerPoint; } /* WriteVersion2NumericWave(fr, whp, data, waveNote, noteSize) Writes an Igor version 2 binary wave with the properties specified in whp, the data specified by data, and the wave note specified by waveNote and noteSize. Returns 0 or an error code. */ static int WriteVersion2NumericWave(CP_FILE_REF fr, WaveHeader2* whp, const void* data, const char* waveNote, long noteSize) { unsigned long numBytesToWrite; unsigned long numBytesWritten; unsigned long waveDataSize; int numBytesPerPoint; short cksum; BinHeader2 bh; char padding[16]; int err; numBytesPerPoint = NumBytesPerPoint(whp->type); if (numBytesPerPoint <= 0) { printf("Invalid wave type (0x%x).\n", whp->type); return -1; } waveDataSize = whp->npnts * numBytesPerPoint; // Prepare the BinHeader structure. memset(&bh,0,sizeof(struct BinHeader2)); bh.version = 2; bh.wfmSize = offsetof(WaveHeader2, wData) + waveDataSize + 16; // Includes 16 bytes padding. bh.noteSize = noteSize; /* The checksum is over the BinHeader2 structure and the WaveHeader2 structure. The wData field of the WaveHeader2 structure is assumed to contain the same data as the first 16 bytes of the actual wave data. This is necessary to get the correct checksum. */ cksum = Checksum((short *)&bh, 0, sizeof(struct BinHeader2)); cksum = Checksum((short *)whp, cksum, sizeof(struct WaveHeader2)); bh.checksum = -cksum; do { // Write the BinHeader. numBytesToWrite = sizeof(struct BinHeader2); err = CPWriteFile(fr, numBytesToWrite, &bh, &numBytesWritten); if (err) break; // Write the WaveHeader, up to but not including the wData field. numBytesToWrite = offsetof(WaveHeader2, wData); err = CPWriteFile(fr, numBytesToWrite, whp, &numBytesWritten); if (err) break; // Write the wave data. numBytesToWrite = waveDataSize; err = CPWriteFile(fr, numBytesToWrite, data, &numBytesWritten); if (err) break; // Write the 16 byte padding. memset(padding, 0, 16); // Write padding at the end of the wave data. numBytesToWrite = 16; err = CPWriteFile(fr, numBytesToWrite, padding, &numBytesWritten); if (err) break; // Now write optional data, in the correct order. // Write the wave note. numBytesToWrite = noteSize; if (numBytesToWrite > 0) { err = CPWriteFile(fr, numBytesToWrite, waveNote, &numBytesWritten); if (err) break; } } while(0); return err; } /* WriteVersion5NumericWave(fr, whp, data, waveNote, noteSize) Writes an Igor version 5 binary wave with the properties specified in whp, the data specified by data, and the wave note specified by waveNote and noteSize. Returns 0 or an error code. */ int WriteVersion5NumericWave(CP_FILE_REF fr, WaveHeader5* whp, const void* data, const char* waveNote, long noteSize) { unsigned long numBytesToWrite; unsigned long numBytesWritten; unsigned IGORLONG waveDataSize; int numBytesPerPoint; short cksum; BinHeader5 bh; int err; #ifdef _STFDEBUG printf("sizeof(short): %lu\n", sizeof(short)); printf("sizeof(int): %lu\n", sizeof(int)); printf("sizeof(long): %lu\n", sizeof(long)); printf("sizeof(IGORLONG): %lu\n", sizeof(IGORLONG)); printf("sizeof(unsigned long): %lu\n", sizeof(unsigned long)); printf("sizeof(unsigned IGORLONG): %lu\n", sizeof(unsigned IGORLONG)); printf("sizeof(float): %lu\n", sizeof(float)); printf("sizeof(double): %lu\n", sizeof(double)); printf("sizeof(void): %lu\n", sizeof(void)); printf("sizeof(void*): %lu\n", sizeof(void*)); printf("sizeof(void**): %lu\n", sizeof(void**)); #endif numBytesPerPoint = NumBytesPerPoint(whp->type); if (numBytesPerPoint <= 0) { printf("Invalid wave type (0x%x).\n", whp->type); return -1; } waveDataSize = whp->npnts * numBytesPerPoint; // Prepare the BinHeader structure. memset(&bh,0,sizeof(struct BinHeader5)); bh.version = 5; bh.wfmSize = offsetof(WaveHeader5, wData) + waveDataSize; bh.noteSize = noteSize; #ifdef _STFDEBUG printf("waveDataSize: %d\n", waveDataSize); printf("wfmSize: %d\n", bh.wfmSize); printf("noteSize: %d\n", bh.noteSize); #endif /* The checksum is over the BinHeader5 structure and the WaveHeader5 structure, excluding the wData field. */ cksum = Checksum((short *)&bh, 0, sizeof(BinHeader5)); #ifdef _STFDEBUG printf("%d\n", cksum); #endif cksum = Checksum((short *)whp, cksum, offsetof(WaveHeader5, wData)); bh.checksum = -cksum; #ifdef _STFDEBUG printf("%d\n", cksum); printf("%d\n", bh.checksum); #endif do { // Write the BinHeader. numBytesToWrite = sizeof(struct BinHeader5); err = CPWriteFile(fr, numBytesToWrite, &bh, &numBytesWritten); if (err) break; // Write the WaveHeader, up to but not including the wData field. numBytesToWrite = offsetof(WaveHeader5, wData); err = CPWriteFile(fr, numBytesToWrite, whp, &numBytesWritten); if (err) break; // Write the wave data. numBytesToWrite = waveDataSize; err = CPWriteFile(fr, numBytesToWrite, data, &numBytesWritten); if (err) break; // Now write optional data, in the correct order. // Write the wave note. numBytesToWrite = noteSize; if (numBytesToWrite > 0) { err = CPWriteFile(fr, numBytesToWrite, waveNote, &numBytesWritten); if (err) break; } } while(0); return err; } stimfit-0.16.0/src/libstfio/igor/igorlib.h0000775000175000017500000000240613277303516015356 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file igorlib.h * \author Christoph Schmidt-Hieber * \date 2008-01-23 * \brief Export Igor binary waves. */ #ifndef _IGORLIB_H #define _IGORLIB_H #include "./../stfio.h" class Recording; namespace stfio { //! Export a Recording to an Igor binary wave. /*! \param fName Full path to the file to be written. * \param WData The data to be exported. * \return At present, always returns 0. */ StfioDll bool exportIGORFile(const std::string& fName, const Recording& WData, ProgressInfo& progDlg); } #endif stimfit-0.16.0/src/libstfio/igor/CrossPlatformFileIO.c0000775000175000017500000002605613277303516017557 00000000000000// This file contains utilities for cross-platform file I/O. #include #include #include #include #include #if defined(WIN32) && !defined(__MINGW32__) #include #else #include "../abf/axon/Common/unix.h" #endif // The Windows headers create the WIN32 symbol if we are compiling for Windows. // Here, we create an analogous MACINTOSH symbol if we are compiling for Macintosh. #if (defined(GENERATINGPOWERPC) || defined(GENERATING68K)) #define MACINTOSH 1 #endif #include "CrossPlatformFileIO.h" /* CPCreateFile(fullFilePath, overwrite, macCreator, macFileType) Creates a file with the location and name specified by fullFilePath. fullFilePath must be a native path. If overwrite is true and a file by that name already exists, it first deletes the conflicting file. If overwrite is false and a file by that name exists, it returns an error. macFileType is ignored on Windows. On Macintosh, it is used to set the new file's type. For example, use 'TEXT' for a text file. macCreator is ignored on Windows. On Macintosh, it is used to set the new file's creator code. For example, use 'IGR0' (last character is zero) for an file. Returns 0 if OK or an error code. */ int CPCreateFile(const char* fullFilePath, int overwrite) { int err; err = 0; #if defined(_WINDOWS) && !defined(__MINGW32__) if (overwrite) // Delete file if it exists and if overwrite is specified. CPDeleteFile(fullFilePath); // Ignore error. #endif #ifdef MACINTOSH if (err = create(fullFilePath, 0, macCreator, macFileType)) return err; return 0; #endif { HANDLE fileH; long accessMode, shareMode; #if defined(_WINDOWS) && !defined(__MINGW32__) accessMode = GENERIC_READ | GENERIC_WRITE; shareMode = 0; fileH = CreateFileA(fullFilePath, accessMode, shareMode, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); #else fileH = fopen(fullFilePath, "w+b"); #endif if (fileH == INVALID_HANDLE_VALUE) #if defined(_WINDOWS) && !defined(__MINGW32__) err = GetLastError(); #else err = 1; #endif else #if defined(_WINDOWS) && !defined(__MINGW32__) CloseHandle(fileH); #else fclose(fileH); #endif return err; } } /* CPDeleteFile(fullFilePath) Deletes the file specified by fullFilePath. fullFilePath must be a native path. Returns 0 if OK or an error code. Added for Igor Pro 3.13 but works with any version. However, some error codes returned require Igor Pro 3.13 or later, so you will get bogus error messages if you return these error codes to earlier versions of Igor. */ #if defined(_WINDOWS) && !defined(__MINGW32__) int CPDeleteFile(const char* fullFilePath) { #ifdef MACINTOSH int err; if (err = fsdelete(fullFilePath, 0)) return err; return 0; #endif { int err; err = 0; if (DeleteFileA(fullFilePath) == 0) err = GetLastError(); return err; } } #endif /* CPOpenFile(fullFilePath, readOrWrite, fileRefPtr) If readOrWrite is zero, opens an existing file for reading and returns a file reference via fileRefPtr. If readOrWrite is non-zero, opens an existing file for writing or creates a new file if none exists and returns a file reference via fileRefPtr. fullFilePath must be a native path. Returns 0 if OK or an error code. */ int CPOpenFile(const char* fullFilePath, int readOrWrite, CP_FILE_REF* fileRefPtr) { *fileRefPtr = fopen(fullFilePath, readOrWrite ? "wb" : "rb"); if (*fileRefPtr == NULL) return CP_FILE_OPEN_ERROR; return 0; } /* CPCloseFile(fileRef) Closes the referenced file. Returns 0 if OK or an error code. Added for Igor Pro 3.13 but works with any version. However, some error codes returned require Igor Pro 3.13 or later, so you will get bogus error messages if you return these error codes to earlier versions of Igor. */ int CPCloseFile(CP_FILE_REF fileRef) { if (fclose(fileRef)) return CP_FILE_CLOSE_ERROR; return 0; } /* CPReadFile(fileRef, count, buffer, numBytesReadPtr) Reads count bytes from the referenced file into the buffer. If numBytesReadPtr is not NULL, stores the number of bytes read in *numBytesReadPtr. Returns 0 if OK or an error code. If bytes remain to be read in the file and you ask to read more bytes than remain, the remaining bytes are returned and the function result is zero. If no bytes remain to be read in the file and you ask to read bytes, no bytes are returned and the function result is CP_FILE_EOF_ERROR. CPReadFile is appropriate when you are reading data of variable size, in which case you do not want to consider it an error if the end of file is reached before reading all of the bytes that you requested. If you are reading a record of fixed size, use use CPReadFile2 instead of CPReadFile. Added for Igor Pro 3.13 but works with any version. However, some error codes returned require Igor Pro 3.13 or later, so you will get bogus error messages if you return these error codes to earlier versions of Igor. */ int CPReadFile(CP_FILE_REF fileRef, unsigned long count, void* buffer, unsigned long* numBytesReadPtr) { unsigned long numBytesRead; if (count == 0) { if (numBytesReadPtr != NULL) *numBytesReadPtr = 0; return 0; } clearerr(fileRef); numBytesRead = (DWORD)fread(buffer, 1, count, fileRef); if (numBytesReadPtr != NULL) *numBytesReadPtr = numBytesRead; if (ferror(fileRef)) return CP_FILE_READ_ERROR; if (numBytesRead==0 && CPAtEndOfFile(fileRef)) return CP_FILE_EOF_ERROR; // We were at the end of file when asked to read some bytes. return 0; } /* CPReadFile2(fileRef, count, buffer, numBytesReadPtr) Reads count bytes from the referenced file into the buffer. If numBytesReadPtr is not NULL, stores the number of bytes read in *numBytesReadPtr. Returns 0 if OK or an error code. If bytes remain to be read in the file and you ask to read more bytes than remain, the remaining bytes are returned and the function result is CP_FILE_EOF_ERROR. CPReadFile2 is appropriate when you are reading a record of fixed size, in which case you want to consider it an error if the end of file is reached before reading all of the bytes in the record. If you are reading a record of variable size then you should use CPReadFile instead of CPReadFile2. Added for Igor Pro 3.13 but works with any version. However, some error codes returned require Igor Pro 3.13 or later, so you will get bogus error messages if you return these error codes to earlier versions of Igor. */ int CPReadFile2(CP_FILE_REF fileRef, unsigned long count, void* buffer, unsigned long* numBytesReadPtr) { unsigned long numBytesRead; if (count == 0) { if (numBytesReadPtr != NULL) *numBytesReadPtr = 0; return 0; } clearerr(fileRef); numBytesRead = (DWORD)fread(buffer, 1, count, fileRef); if (numBytesReadPtr != NULL) *numBytesReadPtr = numBytesRead; if (ferror(fileRef)) return CP_FILE_READ_ERROR; if (numBytesRead < count) { // We did not read all of the bytes requested. if (CPAtEndOfFile(fileRef)) return CP_FILE_EOF_ERROR; // We hit the end of file. return CP_FILE_READ_ERROR; // Some other occurred but ferror did not reflect it. } return 0; } /* CPWriteFile(fileRef, count, buffer, numBytesWrittenPtr) Writes count bytes from the buffer to the referenced file. If numBytesWrittenPtr is not NULL, stores the number of bytes written in *numBytesWrittenPtr. Returns 0 if OK or an error code. Added for Igor Pro 3.13 but works with any version. However, some error codes returned require Igor Pro 3.13 or later, so you will get bogus error messages if you return these error codes to earlier versions of Igor. */ int CPWriteFile(CP_FILE_REF fileRef, unsigned long count, const void* buffer, unsigned long* numBytesWrittenPtr) { unsigned long numBytesWritten; if (count == 0) { if (numBytesWrittenPtr != NULL) *numBytesWrittenPtr = 0; return 0; } numBytesWritten = (DWORD)fwrite(buffer, 1, count, fileRef); if (numBytesWrittenPtr != NULL) *numBytesWrittenPtr = numBytesWritten; if (numBytesWritten != count) return CP_FILE_WRITE_ERROR; return 0; } /* CPGetFilePosition(fileRef, filePosPtr) Returns via filePosPtr the current file position of the referenced file. Returns 0 if OK or an error code. Added for Igor Pro 3.13 but works with any version. However, some error codes returned require Igor Pro 3.13 or later, so you will get bogus error messages if you return these error codes to earlier versions of Igor. */ int CPGetFilePosition(CP_FILE_REF fileRef, unsigned long* filePosPtr) { long pos; pos = ftell(fileRef); if (pos == -1L) return CP_FILE_POS_ERROR; *filePosPtr = pos; return 0; } /* CPSetFilePosition(fileRef, filePos, mode) Sets the current file position in the referenced file. If mode is -1, then filePos is relative to the start of the file. If mode is 0, then filePos is relative to the current file position. If mode is 1, then filePos is relative to the end of the file. Returns 0 if OK or an error code. Added for Igor Pro 3.13 but works with any version. However, some error codes returned require Igor Pro 3.13 or later, so you will get bogus error messages if you return these error codes to earlier versions of Igor. */ int CPSetFilePosition(CP_FILE_REF fileRef, long filePos, int mode) { int seekMode; switch(mode) { case -1: seekMode = SEEK_SET; break; case 0: seekMode = SEEK_CUR; break; case 1: seekMode = SEEK_END; break; default: return CP_FILE_POS_ERROR; } if (fseek(fileRef, filePos, seekMode) != 0) return CP_FILE_POS_ERROR; return 0; } /* CPAtEndOfFile(fileRef) Returns 1 if the current file position is at the end of file, 0 if not. Added for Igor Pro 3.13 but works with any version. However, some error codes returned require Igor Pro 3.13 or later, so you will get bogus error messages if you return these error codes to earlier versions of Igor. */ int CPAtEndOfFile(CP_FILE_REF fileRef) { if (feof(fileRef)) // Hit end of file? return 1; return 0; } /* CPNumberOfBytesInFile(fileRef, numBytesPtr) Returns via numBytesPtr the total number of bytes in the referenced file. Returns 0 if OK or an error code. Added for Igor Pro 3.13 but works with any version. However, some error codes returned require Igor Pro 3.13 or later, so you will get bogus error messages if you return these error codes to earlier versions of Igor. */ int CPNumberOfBytesInFile(CP_FILE_REF fileRef, unsigned long* numBytesPtr) { long originalPos; originalPos = ftell(fileRef); if (fseek(fileRef, 0, SEEK_END) != 0) return CP_FILE_POS_ERROR; *numBytesPtr = ftell(fileRef); if (*numBytesPtr == -1L) return CP_FILE_POS_ERROR; if (fseek(fileRef, originalPos, SEEK_SET) != 0) return CP_FILE_POS_ERROR; return 0; } stimfit-0.16.0/src/libstfio/igor/CrossPlatformFileIO.h0000775000175000017500000000222013277303516017547 00000000000000#define CP_FILE_OPEN_ERROR 10000 #define CP_FILE_CLOSE_ERROR 10001 #define CP_FILE_EOF_ERROR 10002 #define CP_FILE_READ_ERROR 10003 #define CP_FILE_WRITE_ERROR 10004 #define CP_FILE_POS_ERROR 10005 #define CP_FILE_REF FILE* #if ( __WORDSIZE == 64 ) || defined (__APPLE__) #define IGORLONG int #else #define IGORLONG long #endif int CPCreateFile(const char* fullFilePath, int overwrite); int CPDeleteFile(const char* fullFilePath); int CPOpenFile(const char* fullFilePath, int readOrWrite, CP_FILE_REF* fileRefPtr); int CPCloseFile(CP_FILE_REF fileRef); int CPReadFile(CP_FILE_REF fileRef, unsigned long count, void* buffer, unsigned long* numBytesReadPtr); int CPReadFile2(CP_FILE_REF fileRef, unsigned long count, void* buffer, unsigned long* numBytesReadPtr); int CPWriteFile(CP_FILE_REF fileRef, unsigned long count, const void* buffer, unsigned long* numBytesWrittenPtr); int CPGetFilePosition(CP_FILE_REF fileRef, unsigned long* filePosPtr); int CPSetFilePosition(CP_FILE_REF fileRef, long filePos, int mode); int CPAtEndOfFile(CP_FILE_REF fileRef); int CPNumberOfBytesInFile(CP_FILE_REF fileRef, unsigned long* numBytesPtr); stimfit-0.16.0/src/libstfio/igor/igorlib.cpp0000775000175000017500000001570013277303516015712 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Export Igor binary waves from stimfit // last revision: 2007-05-07 // CSH, University of Freiburg // Most of this was shamelessly copied from Wavemetrics' sample code. // Blame them for bugs. /* The code in this file writes a sample Igor Pro packed experiment file. See Igor Pro Tech Note PTN#003 for details. */ #include #include #include #include // For offsetof macro. #include #if !defined(_WINDOWS) || defined(__MINGW32__) #include "../abf/axon/Common/unix.h" #endif #include "./igorlib.h" #include "../recording.h" // Headers taken from Wavemetrics' demo files: #ifdef __cplusplus extern "C" { #endif #include "../igor/IgorBin.h" #include "../igor/CrossPlatformFileIO.h" int WriteVersion5NumericWave(CP_FILE_REF fr, WaveHeader5* whp, const void* data, const char* waveNote, long noteSize); #ifdef __cplusplus } #endif namespace stfio { std::string IGORError(const std::string& msg, int nError); // Check compatibility before exporting: bool CheckComp(const Recording& ReturnData); } std::string stfio::IGORError(const std::string& msg, int error) { std::ostringstream ret; ret << "Error # " << error << " while writing Igor packed experiment:\n" << msg; return ret.str(); } bool stfio::CheckComp(const Recording& Data) { std::size_t oldSize=0; if (!Data.get().empty() && !Data[0].get().empty()) { oldSize=Data[0][0].size(); } else { return false; } for (std::size_t n_c=0;n_c channel_name(Data.size()); bool ident=false; for (std::size_t n_c=0;n_c) Channel TempChannel(Data[n_c]); for (std::size_t n_s=0;n_s cpData.size() || Data[n_c][n_s].size() > TempChannel[n_s].size()) { throw std::out_of_range("Out of range exception in WriteVersion5NumericWave"); } std::copy( TempChannel[n_s].get_w().begin(), TempChannel[n_s].get_w().begin()+Data[n_c][n_s].size(), &cpData[n_s*wh.nDim[0]] ); } err=WriteVersion5NumericWave( fr, &wh, &cpData[0], waveNote.c_str(), (long)waveNote.length() ); if (err) { throw std::runtime_error( std::string(IGORError("Error in WriteVersion5NumericWave()\n", err).c_str()) ); } CPCloseFile(fr); } return true; } stimfit-0.16.0/src/libstfio/axg/0000775000175000017500000000000013567226445013457 500000000000000stimfit-0.16.0/src/libstfio/axg/fileUtils.cpp0000775000175000017500000000312713277303516016042 00000000000000#include "fileUtils.h" #if defined(_WINDOWS) && !defined(__MINGW32__) #include #include typedef std::wstring wxString; #endif // Mac-specific file access functions // On other platforms, replace the following with equivalent functions /* GetApplicationDirectory returns the volume reference number and directory ID for the demo application's directory. */ filehandle OpenFile( const char *fileName ) { #if defined(_WINDOWS) && !defined(__MINGW32__) std::wstringstream fileNameS; fileNameS << fileName; HANDLE file = CreateFile(fileNameS.str().c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); return file; #else return fopen( fileName, "r" ); #endif } void CloseFile( filehandle dataRefNum ) { #if defined(_WINDOWS) && !defined(__MINGW32__) CloseHandle(dataRefNum); return; #else fclose( dataRefNum ); return; #endif } int SetFilePosition( filehandle dataRefNum, int posn ) { #if defined(_WINDOWS) && !defined(__MINGW32__) if (SetFilePointer(dataRefNum, posn, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) return 1; else return 0; #else return fseek( dataRefNum, posn, SEEK_SET ); #endif } int ReadFromFile( filehandle dataRefNum, AXGLONG *count, void *dataToRead ) { #if defined(_WINDOWS) && !defined(__MINGW32__) DWORD dwRead; short res = ReadFile(dataRefNum, dataToRead, *count, &dwRead, NULL); if (res) return 0; else return 1; #else if ( (AXGLONG)fread( dataToRead, 1, *count, dataRefNum ) == *count ) return 0; else return 1; #endif } stimfit-0.16.0/src/libstfio/axg/axglib.h0000775000175000017500000000410613277303516015013 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file axglib.h * \author Christoph Schmidt-Hieber * \date 2008-01-23 * \brief Import Axograph X binary files. */ #ifndef _AXGLIB_H #define _AXGLIB_H #include "../stfio.h" class Recording; namespace stfio { //! Open an AXG file and store its contents to a Recording object. /*! \param fName The full path to the file to be opened. * \param ReturnData On entry, an empty Recording object. On exit, * the data stored in \e fName. * \param progress True if the progress dialog should be updated. */ void importAXGFile(const std::string& fName, Recording& ReturnData, ProgressInfo& progDlg); } #endif stimfit-0.16.0/src/libstfio/axg/AxoGraph_ReadWrite.h0000664000175000017500000003575513277303516017237 00000000000000#ifndef AXOGRAPH_READEWRITE_H #define AXOGRAPH_READEWRITE_H /* ---------------------------------------------------------------------------------- AxoGraph_ReadWrite : functions for reading and writing AxoGraph data files. See also : the example programs which uses these functions, Demo_AxoGraph_ReadWrite and Simple_AxoGraph_ReadWrite This source code and the AxoGraph data file format are in the public domain. To run on little endian hardware (Intel, etc.) __LITTLE_ENDIAN__ must be defined This is done automatically under OS X / XCode 2008-12-14: Some modifications to avoid unfreed mallocs using std::vector C. Schmidt-Hieber ---------------------------------------------------------------------------------- The three AxoGraph file formats are descibed here for completeness, but this information is not needed in order to use the supplied AxoGraph file functions to read and write binary data. For information about reading and writing graph display information, see the end of the section on the AxoGraph X file format. AxoGraph Data File Format ========================= Header ------ Byte Type Contents 0 char[4] AxoGraph file header identifier = 'AxGr' - same as document type ID 4 short AxoGraph graph file format ID = 1 6 short Number of columns to follow Each column ----------- Byte Type Contents 0 long Number of points in the column ( columnPoints ) 4 char[80] Column title (Pascal 'String' format) - S.I. units should be in brackets e.g. 'Current (pA)' 84 float 1st Data point 88 float 2nd Data point .. .. .... .. .. etc. ---------------------------------------------------------------------------------- AxoGraph Digitized Data File Format =================================== Header ------ Byte Type Contents 0 char[4] AxoGraph file header identifier = 'AxGr' - same as document type ID 4 short AxoGraph file format ID = 2 6 short Number of columns to follow Each column ---------------------- Byte Type Contents 0 long Number of points in the column ( columnPoints ) 4 long Data type 8 char[80] Column title (Pascal 'String' format) - S.I. units should be in brackets e.g. 'Current (pA)' 84 float Scaling Factor 88 short 1st Data point 90 short 2nd Data point .. ... .... .. ... etc. ---------------------------------------------------------------------------------- AxoGraph X Data File Format =================================== Header ------ Byte Type Contents 0 char[4] AxoGraph file header identifier = 'AxGx' - same as filename extension 4 long AxoGraph X file format ID = a number between 3 (earliest version) and 6 (latest version) 8 long Number of columns to follow Each column ---------------------- Byte Type Contents 0 long Number of points in the column ( columnPoints ) 4 long Column type 8 long Length of column title in bytes (Unicode - 2 bytes per character) 12 char* Column title (Unicode 2 byte per char) - S.I. units should be in brackets e.g. 'Current (pA)' ?? ?? Byte offset depends on length of column title string. .. ... Numeric type and layout depend on the column type .. ... .... .. ... etc. Six column types are supported... 4: short 5: long 6: float 7: double 9: 'series' 10: 'scaled short' In the first four column types, data is stored as a simple array of the corresponding type. The 'scaled short' column type stores data as a 'double' scaling factor and offset, and a 'short' array. The 'series' column type stores data as a 'double' first value and a 'double' increment. Prior to AxoGraph X, all graph display information was stored in the 'resource fork' of the file, and the resource fork format was not documented. In contrast, AxoGraph X has a 'flat' format with all display information stored immediately following the data columns. It is safe to simply leave out this information. AxoGraph X will use default parameters when the file is read in. For greater control of graph appearance when creating a file it may be necessary to add display format information. When reading in a file, it may be necessary to access the 'Notes' string. The following is a preliminary description of the file format used to store important elements of graph display information. Reading 'notes' and graph format info is not supported in the AxoGraph_ReadWrite example functions. The Comment and Notes strings are stored immediately after the last data column. Both are stored in Unicode string format.. Unicode string format ---------------------- long Length of string in bytes char* Notes string (Unicode 2 byte per char) For Latin1 strings, every second byte is an ASCII character code Each trace consists of a pair of columns. The trace header specifies the X and Y column numbers, and other trace-specific information. 'bool' header fields are stored as long int: false = 0, true = 1 The number of traces is stored immediately after the comment and notes strings. long Number of trace headers to follow Header for each trace ---------------------- long header version number (currently = 2) long X column number long Y column number long Error bar column number or -1 if no error bars long Negative error bar column number or -1 if no negative error bars long Group number that this column belongs to bool Trace shown? False if trace is hidden double Minimum X data point in this trace double Maximum X data point in this trace (if both are zero, they will be recalculated) double Minimum positive X data point in this trace (used in log-axis format) bool True if X axis data is regularly spaced bool True if X axis data is monotonic (each point > previous point) double Interval between points for regular X axis data double Minimum Y data point in this trace double Maximum Y data point in this trace (if both are zero, they will be recalculated) double Minimum positive Y data point in this trace (used in log-axis format) long Trace color with RGB values serialized into a long int bool True if a line plot joining the data points is displayed double Thickness of the line plot (can be less than 1.0 for fine lines) long Pen style (zero for solid line, non zero for dashed lines) bool True if symbols are displayed long Symbol type long Symbol size (radius in pixels) bool True if some symbols are to be skipped bool True if symbols are to be skipped by distance instead of number of points long Minimum separation of symbols in pixels is previous parameter is true bool True for a histogram plot long Type of histogram (zero for standard solid fill) long Separation between adjacent histogram bars expressed as a percentage of bar width bool True if error bars are displayed bool True if a positive error bar is displayed bool True if a negative error bar is displayed long Error bar width in pixels ---------------------------------------------------------------------------------- */ // uncomment the following line to run on little endian hardware ( byte swaps data before reading or writing ) #ifdef __APPLE__ #include #elif defined(__MINGW32__) #define __LITTLE_ENDIAN__ #elif !defined(_MSC_VER) #include #else #define __LITTLE_ENDIAN__ #endif #ifdef __LITTLE_ENDIAN #define __LITTLE_ENDIAN__ #endif #include "longdef.h" #include "fileUtils.h" #include "./../stfio.h" // errors numbers const short kAG_MemoryErr = -21; const short kAG_FormatErr = -23; const short kAG_VersionErr = -24; // file format id's const short kAxoGraph_Graph_Format = 1; const short kAxoGraph_Digitized_Format = 2; const short kAxoGraph_X_Format = 6; const short kAxoGraph_X_Digitized_Format = 6; const axgchar kAxoGraph4DocType[4] = { 'A', 'x', 'G', 'r' }; const axgchar kAxoGraphXDocType[4] = { 'a', 'x', 'g', 'x' }; // column header for AxoGraph graph files struct ColumnHeader { AXGLONG points; axgchar title[80]; }; // x-axis column header for AxoGraph digitized files struct DigitizedFirstColumnHeader { AXGLONG points; axgchar title[80]; float firstPoint; float sampleInterval; }; // y-axis column header for AxoGraph digitized files struct DigitizedColumnHeader { AXGLONG points; axgchar title[80]; float scalingFactor; }; // column header for AxoGraph X files struct AxoGraphXColumnHeader { AXGLONG points; AXGLONG dataType; AXGLONG titleLength; }; struct AxoGraphXTraceHeader { long nHeaderVersion; // header version number (currently = 2) long nColumnX; // X column number long nColumnY; // Y column number long nError; // Error bar column number or -1 if no error bars long nErrorBarColumn; // Negative error bar column number or -1 if no negative error bars long nGroup; // Group number that this column belongs to bool isShown; // Trace shown? False if trace is hidden double dMinX; // Minimum X data point in this trace double dMaxX; // Maximum X data point in this trace (if both are zero, they will be recalculated) double dMinPosX; // Minimum positive X data point in this trace (used in log-axis format) bool bXEqSpaced; // True if X axis data is regularly spaced bool bXMonotonic; // True if X axis data is monotonic (each point > previous point) double dXInterval; // Interval between points for regular X axis data double dMinY; // Minimum Y data point in this trace double dMaxY; // Maximum Y data point in this trace (if both are zero, they will be recalculated) double dMinPosY; // Minimum positive Y data point in this trace (used in log-axis format) long nRGB; // Trace color with RGB values serialized into a long int bool bLinejoin; // True if a line plot joining the data points is displayed double dLineThickness; // Thickness of the line plot (can be less than 1.0 for fine lines) long nLineStyle; // Pen style (zero for solid line, non zero for dashed lines) bool bSymbol; // True if symbols are displayed long nSymbolType; // Symbol type long nSymbolSize; // Symbol size (radius in pixels) bool bSymbolSkip; // True if some symbols are to be skipped bool bSymbolSkipDist; // True if symbols are to be skipped by distance instead of number of points long nSympolDist; // Minimum separation of symbols in pixes is previous parameter is true bool bHisto; // True for a histogram plot long nHistoType; // Type of histogram (zero for standard solid fill) long nHistoDist; // Separation between adjacent histogram bars expressed as a percentage of bar width bool bError; // True if error bars are displayed bool bErrorPos; // True if a positive error bar is displayed bool bErrorNeg; // True if a negative error bar is displayed long nErrorWidth; // Error bar width in pixels }; //============= ColumnData structure ====================== // This enum is copied from AxoGraph X source code // The only types used for data file columns are... // ShortArrayType = 4 IntArrayType = 5 // FloatArrayType = 6 DoubleArrayType = 7 // SeriesArrayType = 9 ScaledShortArrayType = 10 enum ColumnType { IntType, DoubleType, BoolType, StringType, ShortArrayType, IntArrayType, FloatArrayType, DoubleArrayType, BoolArrayType, SeriesArrayType, ScaledShortArrayType, StringArrayType, ReferenceType }; struct SeriesArray { double firstValue; double increment; }; struct ScaledShortArray { double scale; double offset; std::vector shortArray; }; struct ColumnData { ColumnType type; AXGLONG points; AXGLONG titleLength; std::string title; std::vector shortArray; std::vector intArray; Vector_float floatArray; Vector_double doubleArray; SeriesArray seriesArray; ScaledShortArray scaledShortArray; }; // ----------- AxoGraph Read and Write functions ------------- int AG_GetFileFormat( filehandle refNum, int *fileFormat ); // Check that the file referenced by refNum is an AxoGraph data file // and read in the file format. Legal values are 1, 2, or 3, // corresponding to AxoGraph Graph, Digitized, or AxoGraph X formats. // Called once per file. Returns 0 if all goes well. // If an error occurs, returns the result from the file access functions, // or kAG_FormatErr if file is not in AxoGraph format, // or kAG_VersionErr if the file is of a more recent version than supported by this code. int AG_GetNumberOfColumns( filehandle refNum, const int fileFormat, AXGLONG *numberOfColumns ); // Read in the number of columns to follow in this file. // Called once per file. Returns 0 if all goes well. // If an error occurs, returns the result from the file access functions, int AG_ReadColumn( filehandle refNum, const int fileFormat, const int columnNumber, ColumnData *columnData ); // Read in a column from any AxoGraph data file. // Called once for each column in the file. // Returns data in a pointer in structure that contains the number of points, // the column title, and the column data. // This function allocates new pointers of the appropriate size, reads the data into // them and returns it in columnData. std::string AG_ReadComment( filehandle refNum ); // Read in comment from an AxoGraph X data file. std::string AG_ReadNotes( filehandle refNum ); // Read in notes from an AxoGraph X data file. std::string AG_ReadTraceHeaders( filehandle refNum ); // Read in trace headers from an AxoGraph X data file. std::string AG_ParseDate( const std::string& notes ); std::string AG_ParseTime( const std::string& notes ); int AG_ReadFloatColumn( filehandle refNum, const int fileFormat, const int columnNumber, ColumnData *columnData ); // Read in a column from any AxoGraph data file. // Convert the column data to a float array, regardless of the input column format // Called once for each column in the file. // Returns data in a pointer in structure that contains the number of points, // the column title, and the column data. // This function allocates new pointers of the appropriate size, reads the data into // them and returns it in columnData. #endif stimfit-0.16.0/src/libstfio/axg/fileUtils.h0000775000175000017500000000125213277303516015504 00000000000000#ifndef FILEUTILS_H #define FILEUTILS_H #define kAG_Creator 'AxG2' #define kAG_DocType 'AxGr' #define kAGX_Creator 'AxGX' #define kAGX_DocType 'axgx' #include "longdef.h" #if 0 typedef const int filehandle; #else #if !defined(_WINDOWS) || defined(__MINGW32__) #include typedef FILE* filehandle; #else #include "Windows.h" typedef HANDLE filehandle; #endif #endif #include "stringUtils.h" filehandle OpenFile( const char *fileName ); void CloseFile( filehandle dataRefNum ); int SetFilePosition( filehandle dataRefNum, int posn ); int ReadFromFile( filehandle dataRefNum, AXGLONG *count, void *dataToRead ); #endif stimfit-0.16.0/src/libstfio/axg/axglib.cpp0000775000175000017500000001730513277303516015353 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include #include #include #include #include "../axg/fileUtils.h" #include "../axg/AxoGraph_ReadWrite.h" #include "../axg/longdef.h" #include "./axglib.h" #include "../recording.h" void stfio::importAXGFile(const std::string &fName, Recording &ReturnData, ProgressInfo& progDlg) { std::string errorMsg("Exception while calling AXG_importAXGFile():\n"); std::string yunits; // ===================================================================================================================== // // Open an AxoGraph file and read in the data // // ===================================================================================================================== progDlg.Update(0, "Opening AXG file..."); filehandle dataRefNum = OpenFile( fName.c_str() ); if ( dataRefNum == 0 ) { errorMsg += "\n\nError: Could not find file."; ReturnData.resize(0); throw std::runtime_error(std::string(errorMsg.c_str())); } // check the AxoGraph header, and get the number of columns to be read int fileFormat = 0; int result = AG_GetFileFormat( dataRefNum, &fileFormat ); if ( result ) { errorMsg += "\nError from AG_GetFileFormat - "; if ( result == kAG_FormatErr ) errorMsg += "file is not in AxoGraph format"; else if ( result == kAG_VersionErr ) errorMsg += "file is of a more recent version than supported by this code"; else errorMsg += "error"; ReturnData.resize(0); CloseFile( dataRefNum ); throw std::runtime_error(errorMsg); } AXGLONG numberOfColumns = 0; result = AG_GetNumberOfColumns( dataRefNum, fileFormat, &numberOfColumns ); if ( result ) { errorMsg += "Error from AG_GetNumberOfColumns"; ReturnData.resize(0); CloseFile( dataRefNum ); throw std::runtime_error(errorMsg); } // Sanity check if ( numberOfColumns <= 0 ) // negative columns { errorMsg += "File format error: number of columns is negative in AxoGraph data file"; ReturnData.resize(0); CloseFile( dataRefNum ); throw std::runtime_error(errorMsg); } // AG_ReadFloatColumn reads column data into a float column structure. int numberOfChannels = 0; std::vector< Section > section_list; std::vector< std::string > channel_names; std::vector< std::string > channel_units; double xscale = 1.0; for ( int columnNumber=0; columnNumber #if defined (_WIN64) #define AXGLONG int #elif ( __WORDSIZE == 64 ) || defined (__APPLE__) #define AXGLONG int #else #define AXGLONG long #endif #endif stimfit-0.16.0/src/libstfio/axg/stringUtils.cpp0000775000175000017500000000227313277303516016432 00000000000000 #include "stringUtils.h" // In place string converstion functions void PascalToCString( axgchar *string ) { // First byte of pascal string contains string length short stringLength = string[0]; // Shift string left for ( short i = 0; i < stringLength; i++ ) string[i] = string[i+1]; // Append null byte string[stringLength] = 0; } void CToPascalString( axgchar *string ) { // Find first null byte (determine string length) short i = 0; while ( string[i++] ); short stringLength = i - 1; // Shift string right for ( short j = stringLength-1; j >= 0; j-- ) string[j+1] = string[j]; // Insert length byte string[0] = stringLength; } void UnicodeToCString( axgchar *string, const int stringBytes ) { // Construct C string from every second byte int stringLength = stringBytes / 2; for ( int i = 0; i < stringLength; i++ ) string[i] = string[i*2+1]; // Append null byte string[stringLength] = 0; } void CStringToUnicode( axgchar *string, const int stringBytes ) { // Expand C string to every second byte // Set first byte to null int stringLength = stringBytes / 2; for ( int i = stringLength-1; i >= 0; i-- ) { string[i*2+1] = string[i]; string[i*2] = 0; } } stimfit-0.16.0/src/libstfio/axg/AxoGraph_ReadWrite.cpp0000775000175000017500000004774213277303516017574 00000000000000/* ---------------------------------------------------------------------------------- AxoGraph_ReadWrite : functions for reading and writing AxoGraph data files. See also : AxoGraph_ReadWrite.h This source code and the AxoGraph data file format are in the public domain. ---------------------------------------------------------------------------------- */ #include #include #include #include "stringUtils.h" #include "byteswap.h" #include "AxoGraph_ReadWrite.h" int AG_GetFileFormat( filehandle refNum, int *fileFormat ) { *fileFormat = 0; // Read the file header int posn = 0; int result = SetFilePosition( refNum, posn ); // Position the mark at start if ( result ) return result; // Read the 4-byte prefix present in all AxoGraph file formats unsigned char AxoGraphFileID[4]; AXGLONG bytes = 4; // 4 byte identifier result = ReadFromFile( refNum, &bytes, AxoGraphFileID ); if ( result ) return result; // Check the prefix if ( memcmp( AxoGraphFileID, kAxoGraph4DocType, 4 ) == 0 ) { // Got an AxoGraph version 4 format file. Read the file type. short version; bytes = sizeof( short ); result = ReadFromFile( refNum, &bytes, &version ); if ( result ) return result; #ifdef __LITTLE_ENDIAN__ ByteSwapShort( &version ); #endif if ( version != kAxoGraph_Graph_Format && version != kAxoGraph_Digitized_Format ) return kAG_VersionErr; // Return the file format *fileFormat = version; } else if ( memcmp( AxoGraphFileID, kAxoGraphXDocType, 4 ) == 0 ) { // Got an AxoGraph X format file. Check the file version. AXGLONG version = 0; bytes = sizeof( AXGLONG ); result = ReadFromFile( refNum, &bytes, &version ); if ( result ) return result; #ifdef __LITTLE_ENDIAN__ ByteSwapLong( &version ); #endif if ( version < 3 || version > kAxoGraph_X_Format ) { return kAG_VersionErr; } // update to latest version number version = kAxoGraph_X_Format; // Return the file format *fileFormat = version; } else { result = kAG_FormatErr; } // pass back the result ( = 0 if all went well) return result; } int AG_GetNumberOfColumns( filehandle refNum, const int fileFormat, AXGLONG *numberOfColumns ) { *numberOfColumns = 0; if ( fileFormat == kAxoGraph_Digitized_Format || fileFormat == kAxoGraph_Graph_Format ) { // Read the number of columns (short integer in AxoGraph 4 files) short nColumns; AXGLONG bytes = 2; int result = ReadFromFile( refNum, &bytes, &nColumns); if ( result ) return result; #ifdef __LITTLE_ENDIAN__ ByteSwapShort( &nColumns ); #endif *numberOfColumns = nColumns; return result; } else if ( fileFormat == kAxoGraph_X_Format ) { // Read the number of columns (long integer in AxoGraph X files) AXGLONG nColumns; AXGLONG bytes = 4; int result = ReadFromFile( refNum, &bytes, &nColumns); if ( result ) return result; #ifdef __LITTLE_ENDIAN__ ByteSwapLong( &nColumns ); #endif *numberOfColumns = nColumns; return result; } else { return -1; } } int AG_ReadColumn( filehandle refNum, const int fileFormat, const int columnNumber, ColumnData *columnData ) { // Initialize in case of error during read columnData->points = 0; columnData->title = ""; switch ( fileFormat ) { case kAxoGraph_Graph_Format: { // Read the standard column header ColumnHeader columnHeader; AXGLONG bytes = sizeof( ColumnHeader ); int result = ReadFromFile( refNum, &bytes, &columnHeader ); if ( result ) return result; #ifdef __LITTLE_ENDIAN__ ByteSwapLong( &columnHeader.points ); #endif // Retrieve the title and number of points in the column columnData->type = FloatArrayType; columnData->points = columnHeader.points; columnData->title.resize( 80 ); PascalToCString( columnHeader.title ); columnData->title = std::string( (char*)columnHeader.title ); // create a new pointer to receive the data AXGLONG columnBytes = columnHeader.points * sizeof( float ); columnData->floatArray.resize( columnHeader.points ); if ( columnData->floatArray.empty() ) return kAG_MemoryErr; // Read in the column's data result = ReadFromFile( refNum, &columnBytes, &(columnData->floatArray[0]) ); #ifdef __LITTLE_ENDIAN__ ByteSwapFloatArray( &(columnData->floatArray[0]), columnHeader.points ); #endif break; } case kAxoGraph_Digitized_Format: { if ( columnNumber == 0 ) { // Read the column header DigitizedFirstColumnHeader columnHeader; AXGLONG bytes = sizeof( DigitizedFirstColumnHeader ); int result = ReadFromFile( refNum, &bytes, &columnHeader ); if ( result ) return result; #ifdef __LITTLE_ENDIAN__ ByteSwapLong( &columnHeader.points ); ByteSwapFloat( &columnHeader.firstPoint ); ByteSwapFloat( &columnHeader.sampleInterval ); #endif // Retrieve the title, number of points in the column, and sample interval columnData->type = SeriesArrayType; columnData->points = columnHeader.points; columnData->title.resize( 80 ); PascalToCString( columnHeader.title ); columnData->title = std::string( (char*)columnHeader.title ); columnData->seriesArray.firstValue = columnHeader.firstPoint; columnData->seriesArray.increment = columnHeader.sampleInterval; } else { // Read the column header DigitizedColumnHeader columnHeader; AXGLONG bytes = sizeof( DigitizedColumnHeader ); int result = ReadFromFile( refNum, &bytes, &columnHeader ); if ( result ) return result; #ifdef __LITTLE_ENDIAN__ ByteSwapLong( &columnHeader.points ); ByteSwapFloat( &columnHeader.scalingFactor ); #endif // Retrieve the title and number of points in the column columnData->type = ScaledShortArrayType; columnData->points = columnHeader.points; columnData->title.resize( 80 ); PascalToCString( columnHeader.title ); columnData->title = std::string( (char*)columnHeader.title ); columnData->scaledShortArray.scale = columnHeader.scalingFactor; columnData->scaledShortArray.offset = 0; // create a new pointer to receive the data AXGLONG columnBytes = columnHeader.points * sizeof( short ); columnData->scaledShortArray.shortArray.resize( columnHeader.points ); if ( columnData->scaledShortArray.shortArray.empty() ) return kAG_MemoryErr; // Read in the column's data result = ReadFromFile( refNum, &columnBytes, &(columnData->scaledShortArray.shortArray[0]) ); #ifdef __LITTLE_ENDIAN__ ByteSwapShortArray( &(columnData->scaledShortArray.shortArray[0]), columnHeader.points ); #endif } break; } case kAxoGraph_X_Format: { // Read the column header AxoGraphXColumnHeader columnHeader; AXGLONG bytes = sizeof( AxoGraphXColumnHeader ); int result = ReadFromFile( refNum, &bytes, &columnHeader ); if ( result ) return result; #ifdef __LITTLE_ENDIAN__ ByteSwapLong( &columnHeader.points ); ByteSwapLong( &columnHeader.dataType ); ByteSwapLong( &columnHeader.titleLength ); #endif // Retrieve the column type and number of points in the column columnData->type = (ColumnType)columnHeader.dataType; columnData->points = columnHeader.points; // sanity check on column type if ( columnData->type < 0 || columnData->type > 14 ) return -1; // Read the column title columnData->titleLength = columnHeader.titleLength; // columnData->title.resize( columnHeader.titleLength ); std::vector< unsigned char > charBuffer( columnHeader.titleLength, '\0' ); result = ReadFromFile( refNum, &columnHeader.titleLength, &charBuffer[0] ); if ( result ) return result; // Copy characters one by one into title (tedious but safe) for (std::size_t nc=1; nctitle += char(charBuffer[nc]); } // UnicodeToCString( columnData->title, columnData->titleLength ); switch ( columnHeader.dataType ) { case ShortArrayType: { // create a new pointer to receive the data AXGLONG columnBytes = columnHeader.points * sizeof( short ); columnData->shortArray.resize( columnHeader.points ); if ( columnData->shortArray.empty() ) return kAG_MemoryErr; // Read in the column's data result = ReadFromFile( refNum, &columnBytes, &(columnData->shortArray[0]) ); #ifdef __LITTLE_ENDIAN__ ByteSwapShortArray( &(columnData->shortArray[0]), columnHeader.points ); #endif break; } case IntArrayType: { // create a new pointer to receive the data AXGLONG columnBytes = columnHeader.points * sizeof( int ); columnData->intArray.resize( columnHeader.points ); if ( columnData->intArray.empty() ) return kAG_MemoryErr; // Read in the column's data result = ReadFromFile( refNum, &columnBytes, &(columnData->intArray[0]) ); #ifdef __LITTLE_ENDIAN__ ByteSwapLongArray( (AXGLONG *)&(columnData->intArray[0]), columnHeader.points ); #endif break; } case FloatArrayType: { // create a new pointer to receive the data AXGLONG columnBytes = columnHeader.points * sizeof( float ); columnData->floatArray.resize( columnHeader.points ); if ( columnData->floatArray.empty() ) return kAG_MemoryErr; // Read in the column's data result = ReadFromFile( refNum, &columnBytes, &(columnData->floatArray[0]) ); #ifdef __LITTLE_ENDIAN__ ByteSwapFloatArray( &(columnData->floatArray[0]), columnHeader.points ); #endif break; } case DoubleArrayType: { // create a new pointer to receive the data AXGLONG columnBytes = columnHeader.points * sizeof( double ); columnData->doubleArray.resize( columnHeader.points ); if ( columnData->doubleArray.empty() ) return kAG_MemoryErr; // Read in the column's data result = ReadFromFile( refNum, &columnBytes, &(columnData->doubleArray[0]) ); #ifdef __LITTLE_ENDIAN__ ByteSwapDoubleArray( &(columnData->doubleArray[0]), columnHeader.points ); #endif break; } case SeriesArrayType: { SeriesArray seriesParameters; AXGLONG bytes = sizeof( SeriesArray ); result = ReadFromFile( refNum, &bytes, &seriesParameters ); #ifdef __LITTLE_ENDIAN__ ByteSwapDouble( &seriesParameters.firstValue ); ByteSwapDouble( &seriesParameters.increment ); #endif columnData->seriesArray.firstValue = seriesParameters.firstValue; columnData->seriesArray.increment = seriesParameters.increment; break; } case ScaledShortArrayType: { double scale, offset; AXGLONG bytes = sizeof( double ); result = ReadFromFile( refNum, &bytes, &scale ); result = ReadFromFile( refNum, &bytes, &offset ); #ifdef __LITTLE_ENDIAN__ ByteSwapDouble( &scale ); ByteSwapDouble( &offset ); #endif columnData->scaledShortArray.scale = scale; columnData->scaledShortArray.offset = offset; // create a new pointer to receive the data AXGLONG columnBytes = columnHeader.points * sizeof( short ); columnData->scaledShortArray.shortArray.resize( columnHeader.points ); if ( columnData->scaledShortArray.shortArray.empty() ) return kAG_MemoryErr; // Read in the column's data result = ReadFromFile( refNum, &columnBytes, &(columnData->scaledShortArray.shortArray[0]) ); #ifdef __LITTLE_ENDIAN__ ByteSwapShortArray( &(columnData->scaledShortArray.shortArray[0]), columnHeader.points ); #endif break; } } } break; default: { return -1; } } return 0; } std::string AG_ReadComment( filehandle refNum ) { // File comment std::ostringstream comment; comment << "\0"; AXGLONG comment_size = 0; AXGLONG bytes = sizeof(AXGLONG); int result = ReadFromFile( refNum, &bytes, &comment_size ); if ( result ) return comment.str(); #ifdef __LITTLE_ENDIAN__ ByteSwapLong( &comment_size ); #endif if (comment_size > 0) { std::vector< unsigned char > charBuffer( comment_size, '\0' ); result = ReadFromFile( refNum, &comment_size, &charBuffer[0] ); if ( result ) return comment.str(); // Copy characters one by one into title (tedious but safe) for (std::size_t nc=1; nc 0) { std::vector< unsigned char > charBuffer( notes_size, '\0' ); result = ReadFromFile( refNum, ¬es_size, &charBuffer[0] ); if ( result ) return notes.str(); // Copy characters one by one into title (tedious but safe) for (std::size_t nc=1; nctype ) { case ShortArrayType: { // Convert in the column data columnData->floatArray.resize( columnData->shortArray.size() ); std::copy( columnData->shortArray.begin(), columnData->shortArray.end(), columnData->floatArray.begin() ); columnData->shortArray.resize(0); columnData->type = FloatArrayType; return result; } case IntArrayType: { // Convert in the column data columnData->floatArray.resize( columnData->intArray.size() ); std::copy( columnData->intArray.begin(), columnData->intArray.end(), columnData->floatArray.begin() ); columnData->intArray.resize(0); columnData->type = FloatArrayType; return result; } case FloatArrayType: { // Don't need to convert return result; } case DoubleArrayType: { // Convert in the column data columnData->floatArray.resize( columnData->doubleArray.size() ); std::copy( columnData->doubleArray.begin(), columnData->doubleArray.end(), columnData->floatArray.begin() ); columnData->doubleArray.resize(0); columnData->type = FloatArrayType; return result; } case SeriesArrayType: { // create a new pointer to receive the converted data double firstValue = columnData->seriesArray.firstValue; double increment = columnData->seriesArray.increment; columnData->floatArray.resize( columnData->points ); // Convert in the column data for ( AXGLONG i = 0; i < columnData->points; i++ ) { columnData->floatArray[i] = (float)(firstValue + i * increment); } columnData->type = FloatArrayType; return result; } case ScaledShortArrayType: { // create a new pointer to receive the converted data double scale = columnData->scaledShortArray.scale; double offset = columnData->scaledShortArray.offset; columnData->floatArray.resize( columnData->points ); // Convert in the column data for ( AXGLONG i = 0; i < columnData->points; i++ ) { columnData->floatArray[i] = (float)(columnData->scaledShortArray.shortArray[i] * scale + offset); } // free old short array columnData->scaledShortArray.shortArray.resize(0); // pass in new float array columnData->type = FloatArrayType; return result; } default: { return result; } } } stimfit-0.16.0/src/libstfio/axg/byteswap.cpp0000775000175000017500000000402213277303516015733 00000000000000// ****************************************************************************************** // Graph Document Routines // Copyright 1996 Dr. John Clements. All rights reserved. // ****************************************************************************************** #include "byteswap.h" void ByteSwapShort( short *shortNumber ) { unsigned short *uShortNumber = ( unsigned short * )shortNumber; *uShortNumber = ( ( *uShortNumber >> 8 ) | ( *uShortNumber << 8 ) ); } void ByteSwapLong( AXGLONG *longNumber ) { unsigned int *uLongNumber = ( unsigned int * )longNumber; *uLongNumber = ( ( ( *uLongNumber & 0x000000FF )<<24 ) + ( ( *uLongNumber & 0x0000FF00 )<<8 ) + ( ( *uLongNumber & 0x00FF0000 )>>8 ) + ( ( *uLongNumber & 0xFF000000 )>>24 ) ); } void ByteSwapFloat( float *floatNumber ) { unsigned int *uLongNumber = ( unsigned int * )floatNumber; *uLongNumber = ( ( ( *uLongNumber & 0x000000FF )<<24 ) + ( ( *uLongNumber & 0x0000FF00 )<<8 ) + ( ( *uLongNumber & 0x00FF0000 )>>8 ) + ( ( *uLongNumber & 0xFF000000 )>>24 ) ); } void ByteSwapDouble( double *doubleNumber ) { // cast the double to an array of two unsigned ints unsigned int *uLongArray = ( unsigned int * )doubleNumber; // swap the bytes in each long ByteSwapLong( ( AXGLONG * )&uLongArray[0] ); ByteSwapLong( ( AXGLONG * )&uLongArray[1] ); // swap the two longs unsigned int saveLong0 = uLongArray[0]; uLongArray[0] = uLongArray[1]; uLongArray[1] = saveLong0; } void ByteSwapShortArray( short *shortArray, int arraySize ) { for ( int i = 0; i < arraySize; i++ ) { ByteSwapShort( shortArray++ ); } } void ByteSwapLongArray( AXGLONG *longArray, int arraySize ) { for ( int i = 0; i < arraySize; i++ ) { ByteSwapLong( longArray++ ); } } void ByteSwapFloatArray( float *floatArray, int arraySize ) { for ( int i = 0; i < arraySize; i++ ) { ByteSwapFloat( floatArray++ ); } } void ByteSwapDoubleArray( double *doubleArray, int arraySize ) { for ( int i = 0; i < arraySize; i++ ) { ByteSwapDouble( doubleArray++ ); } } stimfit-0.16.0/src/libstfio/axg/stringUtils.h0000775000175000017500000000050013277303516016066 00000000000000 #ifndef STRINGUTILS_H #define STRINGUTILS_H #include "longdef.h" typedef unsigned char axgchar; void PascalToCString( axgchar *string ); void CToPascalString( axgchar *string ); void UnicodeToCString( axgchar *string, const int stringBytes ); void CStringToUnicode( axgchar *string, const int stringBytes ); #endif stimfit-0.16.0/src/libstfio/stfio.h0000664000175000017500000002124113567226230014105 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /*! \file stfio.h * \author Christoph Schmidt-Hieber * \date 2011-09-25 * \brief header file for libstfio * * * Header file for libstfio */ #ifndef _STFIO_H_ #define _STFIO_H_ #include #if (__cplusplus < 201103) # include #else # include # include #endif #include #include #include #include #include #ifdef _MSC_VER #pragma warning( disable : 4251 ) // Disable warning messages #pragma warning( disable : 4996 ) // Disable warning messages #endif //! Defines dll export or import functions for Windows #if defined(_WINDOWS) && !defined(__MINGW32__) #ifdef STFIODLL #define StfioDll __declspec( dllexport ) #else #define StfioDll __declspec( dllimport ) #endif #else #define StfioDll #endif typedef std::vector Vector_double; typedef std::vector Vector_float; #ifdef _MSC_VER #ifndef NAN static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff}; #define NAN (*(const float *) __nan) #endif #ifndef INFINITY #define INFINITY (DBL_MAX+DBL_MAX) #endif StfioDll long int lround(double x); #define snprintf _snprintf #endif #include "./recording.h" #include "./channel.h" #include "./section.h" /* class Recording; */ /* class Channel; */ /* class Section; */ //! The stfio namespace. /*! All essential core functions and classes are in this namespace. * Its purpose is to reduce name mangling problems. */ namespace stfio { /*! \addtogroup stfio * @{ */ StfioDll Vector_double vec_scal_plus(const Vector_double& vec, double scalar); StfioDll Vector_double vec_scal_minus(const Vector_double& vec, double scalar); StfioDll Vector_double vec_scal_mul(const Vector_double& vec, double scalar); StfioDll Vector_double vec_scal_div(const Vector_double& vec, double scalar); StfioDll Vector_double vec_vec_plus(const Vector_double& vec1, const Vector_double& vec2); StfioDll Vector_double vec_vec_minus(const Vector_double& vec1, const Vector_double& vec2); StfioDll Vector_double vec_vec_mul(const Vector_double& vec1, const Vector_double& vec2); StfioDll Vector_double vec_vec_div(const Vector_double& vec1, const Vector_double& vec2); //! ProgressInfo class /*! Abstract class to be used as an interface for the file io read/write functions * Can be a GUI Dialog or stdout messages */ class StfioDll ProgressInfo { public: //! Constructor /*! \param title Dialog title * \param message Message displayed * \param maximum Maximum value for the progress meter * \param verbose Whether or not to emit a lot of noise */ ProgressInfo(const std::string& title, const std::string& message, int maximum, bool verbose) {}; //! Updates the progress info /*! \param value New value of the progress meter * \param newmsg New message for the info text * \param skip This is set to true if the user has chosen to skip the operation * \return True unless the operation was cancelled. */ virtual bool Update(int value, const std::string& newmsg="", bool* skip=NULL) = 0; }; //! StdoutProgressInfo class /*! Example of a ProgressInfo that prints to stdout */ class StfioDll StdoutProgressInfo : public stfio::ProgressInfo { public: StdoutProgressInfo(const std::string& title, const std::string& message, int maximum, bool verbose); bool Update(int value, const std::string& newmsg="", bool* skip=NULL); private: bool verbosity; }; //! Text file import filter settings struct txtImportSettings { txtImportSettings() : hLines(1),toSection(true),firstIsTime(true),ncolumns(2), sr(20),yUnits("mV"),yUnitsCh2("pA"),xUnits("ms") {} int hLines; /*!< Number of header lines. */ bool toSection; /*!< Import columns into separate sections rather than separate channels. */ bool firstIsTime; /*!< First column contains time. */ int ncolumns; /*!< Number of columns. */ double sr; /*!< Sampling rate. */ std::string yUnits; /*!< y units string. */ std::string yUnitsCh2; /*!< y units string of second channel. */ std::string xUnits; /*!< x units string. */ }; //! File types enum filetype { atf, /*!< Axon text file. */ abf, /*!< Axon binary file. */ axg, /*!< Axograph binary file. */ ascii, /*!< Generic text file. */ cfs, /*!< CED filing system. */ igor, /*!< Igor binary wave. */ son, /*!< CED Son files. */ hdf5, /*!< hdf5 files. */ heka, /*!< heka files. */ biosig, /*!< biosig files. */ tdms, /*!< TDMS files. */ intan, /*!< Intan CLAMP files. */ none /*!< Undefined file type. */ }; #ifndef TEST_MINIMAL //! Attempts to determine the filetype from the filter extension. /*! \param ext The filter extension to be tested (in the form wxT("*.ext")). * \return The corresponding file type. */ StfioDll stfio::filetype findType(const std::string& ext); #endif // TEST_MINIMAL //! Returns file extension for a file type /*! \param ftype File type * \return File extension for given file type (in the form ".ext") */ StfioDll std::string findExtension(stfio::filetype ftype); //! Generic file import. /*! \param fName The full path name of the file. * \param type The file type. * \param ReturnData Will contain the file data on return. * \param txtImport The text import filter settings. * \param ProgressInfo Progress indicator * \return true if the file has successfully been read, false otherwise. */ StfioDll bool importFile( const std::string& fName, stfio::filetype type, Recording& ReturnData, const stfio::txtImportSettings& txtImport, stfio::ProgressInfo& progDlg ); //! Generic file export. /*! \param fName The full path name of the file. * \param type The file type. * \param Data Data to be written * \param ProgressInfo Progress indicator * \return true if the file has successfully been written, false otherwise. */ StfioDll bool exportFile(const std::string& fName, stfio::filetype type, const Recording& Data, ProgressInfo& progDlg); //! Produce new recording with concatenated sections /*! \param src Source recording * \param sections Indices of selected sections * \param ProgressInfo Progress indicator * \return New recording with concatenated selected sections */ StfioDll Recording concatenate(const Recording& src, const std::vector& sections, ProgressInfo& progDlg); //! Produce new recording with multiplied sections /*! \param src Source recording * \param sections Indices of selected sections * \param channel Channel index * \param factor Multiplication factor * \return New recording with multiplied selected sections */ StfioDll Recording multiply(const Recording& src, const std::vector& sections, std::size_t channel, double factor); /*@}*/ } // end of namespace typedef std::vector< std::string >::iterator sst_it; /*!< std::string iterator */ typedef std::vector< std::string >::const_iterator c_sst_it; /*!< constant std::string iterator */ typedef std::vector< std::size_t >::const_iterator c_st_it; /*!< constant size_t iterator */ typedef std::vector< int >::iterator int_it; /*!< int iterator */ typedef std::vector< int >::const_iterator c_int_it; /*!< constant int iterator */ typedef std::deque< Channel >::iterator ch_it; /*!< Channel iterator */ typedef std::deque< Channel >::const_iterator c_ch_it; /*!< constant Channel iterator */ typedef std::deque< Section >::iterator sec_it; /*!< Section iterator */ typedef std::deque< Section >::const_iterator c_sec_it; /*!< constant Section iterator */ #endif stimfit-0.16.0/src/libstfio/abf/0000775000175000017500000000000013567226445013430 500000000000000stimfit-0.16.0/src/libstfio/abf/abflib.cpp0000775000175000017500000004711213277303516015274 00000000000000// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include #include #include #if !defined(_MSC_VER) || defined(__STF__) #include "./axon/Common/axodefn.h" #include "./axon/AxAbfFio32/abffiles.h" #include "./axon2/ProtocolReaderABF2.hpp" #endif #include "./abflib.h" #include "../recording.h" namespace stfio { std::string ABF1Error(const std::string& fName, int nError); } std::string stfio::ABF1Error(const std::string& fName, int nError) { UINT uMaxLen=320; std::vector errorMsg(uMaxLen); // local copy: std::string wxCp = fName; ABF_BuildErrorText(nError, wxCp.c_str(),&errorMsg[0], uMaxLen ); return std::string( &errorMsg[0] ); } void stfio::importABFFile(const std::string &fName, Recording &ReturnData, ProgressInfo& progDlg) { ABF2_FileInfo fileInfo; // Open file: #if !defined(_MSC_VER) FILE* fh = fopen( fName.c_str(), "r" ); if (!fh) { std::string errorMsg("Exception while calling importABFFile():\nCouldn't open file"); fclose(fh); throw std::runtime_error(errorMsg); } // attempt to read first chunk of data: int res = fseek( fh, 0, SEEK_SET); if (res != 0) { std::string errorMsg("Exception while calling importABFFile():\nCouldn't open file"); fclose(fh); throw std::runtime_error(errorMsg); } res = fread( &fileInfo, sizeof( fileInfo ), 1, fh ); if (res != 1) { std::string errorMsg("Exception while calling importABFFile():\nCouldn't open file"); fclose(fh); throw std::runtime_error(errorMsg); } fclose(fh); #else std::wstringstream fNameS; fNameS << fName.c_str(); HANDLE hFile = CreateFile(fNameS.str().c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { std::string errorMsg("Exception while calling importABFFile():\nCouldn't open file"); CloseHandle(hFile); throw std::runtime_error(errorMsg); } // Read one character less than the buffer size to save room for // the terminating NULL character. DWORD dwBytesRead = 0; if( FALSE == ReadFile(hFile, &fileInfo, sizeof( fileInfo ), &dwBytesRead, NULL) ) { std::string errorMsg("Exception while calling importABFFile():\nCouldn't open file"); CloseHandle(hFile); throw std::runtime_error(errorMsg); } if (dwBytesRead <= 0) { std::string errorMsg("Exception while calling importABFFile():\nCouldn't open file"); CloseHandle(hFile); throw std::runtime_error(errorMsg); } CloseHandle(hFile); #endif if (CABF2ProtocolReader::CanOpen( (void*)&fileInfo, sizeof(fileInfo) )) { importABF2File( std::string(fName.c_str()), ReturnData, progDlg ); } else { importABF1File( std::string(fName.c_str()), ReturnData, progDlg ); } } void stfio::importABF2File(const std::string &fName, Recording &ReturnData, ProgressInfo& progDlg) { CABF2ProtocolReader abf2; std::wstring wfName; wfName.resize(fName.size()); std::copy(fName.begin(), fName.end(), wfName.begin()); // for(std::string::size_type i=0; ifFileVersionNumber << std::endl << "Header version " << pFH->fHeaderVersionNumber << std::endl << "Data format " << pFH->nDataFormat << std::endl << "Number of channels " << pFH->nADCNumChannels << std::endl << "Number of sweeps " << pFH->lActualEpisodes << std::endl << "Sampling points per sweep " << pFH->lNumSamplesPerEpisode << std::endl << "File type " << pFH->nOperationMode << std::endl; #endif int numberChannels = pFH->nADCNumChannels; ABFLONG numberSections = pFH->lActualEpisodes; ABFLONG finalSections = numberSections; int hFile = abf2.GetFileNumber(); bool gapfree = (pFH->nOperationMode == ABF2_GAPFREEFILE); if (gapfree) { UINT uMaxSamples = pFH->lNumSamplesPerEpisode / numberChannels; DWORD dwMaxEpi; if (!ABF2_SetChunkSize(hFile,abf2.GetFileHeaderW(),&uMaxSamples,&dwMaxEpi,&nError)) { std::ostringstream errorMsg; errorMsg << "Exception while calling ABF2_SetChunkSize() " << "\n" << ABF1Error(fName, nError); ABF_Close(hFile,&nError); throw std::runtime_error(errorMsg.str()); } finalSections = 1; } for (int nChannel=0; nChannel < numberChannels; ++nChannel) { int progbar = (int)(((double)nChannel/(double)numberChannels)*100.0); progDlg.Update(progbar, "Memory allocation"); ABFLONG grandsize = pFH->lNumSamplesPerEpisode / numberChannels; std::ostringstream label; label << fName << ", gapfree section"; if (gapfree) { grandsize = pFH->lActualAcqLength / numberChannels; Vector_double test_size(0); ABFLONG maxsize = test_size.max_size() #if defined(_MSC_VER) // doesn't seem to return the correct size on Windows. ; #else ; #endif if (grandsize <= 0 || grandsize >= maxsize) { progDlg.Update(progbar, "Gapfree file is too large for a single section." \ "It will be segmented.\nFile opening may be very slow."); gapfree=false; grandsize = pFH->lNumSamplesPerEpisode / numberChannels; finalSections=numberSections; } } Channel TempChannel(finalSections, grandsize); Section TempSectionGrand(grandsize, label.str()); for (int nEpisode=1; nEpisode<=numberSections;++nEpisode) { int progbar = // Channel contribution: (int)(((double)nChannel/(double)numberChannels)*100.0+ // Section contribution: (double)(nEpisode-1)/(double)numberSections*(100.0/numberChannels)); std::ostringstream progStr; progStr << "Reading channel #" << nChannel + 1 << " of " << numberChannels << ", Section #" << nEpisode << " of " << numberSections; progDlg.Update(progbar, progStr.str()); UINT uNumSamples = 0; if (gapfree) { if (nEpisode == numberSections) { uNumSamples = grandsize - (nEpisode-1) * pFH->lNumSamplesPerEpisode / numberChannels; #ifdef _STFDEBUG std::cout << "Last section size " << uNumSamples << std::endl; #endif } else { uNumSamples = pFH->lNumSamplesPerEpisode / numberChannels; } } else { if (!ABF2_GetNumSamples(hFile, pFH, nEpisode, &uNumSamples, &nError)) { std::ostringstream errorMsg; errorMsg << "Exception while calling ABF2_GetNumSamples() " << "for episode # " << nEpisode << "\n" << ABF1Error(fName, nError); ReturnData.resize(0); ABF_Close(hFile,&nError); throw std::runtime_error(errorMsg.str()); } } // Use a vector here because memory allocation can // be controlled more easily: // request memory: if (uNumSamples > 0) { Vector_float TempSection(uNumSamples, 0.0); unsigned int uNumSamplesW; if (!ABF2_ReadChannel(hFile, pFH, pFH->nADCSamplingSeq[nChannel],nEpisode,TempSection, &uNumSamplesW,&nError)) { std::string errorMsg("Exception while calling ABF2_ReadChannel():\n"); errorMsg += ABF1Error(fName, nError); ReturnData.resize(0); ABF_Close(hFile,&nError); throw std::runtime_error(errorMsg); } if (uNumSamples!=uNumSamplesW && !gapfree) { ABF_Close(hFile,&nError); throw std::runtime_error("Exception while calling ABF2_ReadChannel()"); } if (!gapfree) { std::ostringstream label; label << fName << ", Section # " << nEpisode; Section TempSectionT(TempSection.size(),label.str()); std::copy(TempSection.begin(),TempSection.end(),&TempSectionT[0]); try { TempChannel.InsertSection(TempSectionT,nEpisode-1); } catch (...) { ABF_Close(hFile,&nError); throw; } } else { if ((nEpisode-1) * pFH->lNumSamplesPerEpisode / numberChannels + TempSection.size() <= TempSectionGrand.size()) { std::copy(TempSection.begin(),TempSection.end(), &TempSectionGrand[(nEpisode-1) * pFH->lNumSamplesPerEpisode / numberChannels]); } #ifdef _STFDEBUG else { std::cout << "Overflow while copying gapfree sections" << std::endl; } #endif } } else { TempChannel.resize(TempChannel.size()-1); } } if (gapfree) { try { TempChannel.InsertSection(TempSectionGrand,0); } catch (...) { ABF_Close(hFile,&nError); throw; } } try { if ((int)ReturnData.size()sADCChannelName[pFH->nADCSamplingSeq[nChannel]] ); if (channel_name.find(" ")sADCUnits[pFH->nADCSamplingSeq[nChannel]] ); if (channel_units.find(" ") < channel_units.size()) { channel_units.erase(channel_units.begin() + channel_units.find(" "),channel_units.end()); } ReturnData[nChannel].SetYUnits(channel_units); } if (!ABF_Close(hFile,&nError)) { std::string errorMsg("Exception in importABFFile():\n"); errorMsg += ABF1Error(fName,nError); ReturnData.resize(0); throw std::runtime_error(errorMsg); } ReturnData.SetXScale((double)(pFH->fADCSequenceInterval/1000.0)); std::string comment("Created with "); comment += std::string( pFH->sCreatorInfo ); ReturnData.SetComment(comment); ldiv_t year=ldiv(pFH->uFileStartDate,(ABFLONG)10000); ldiv_t month=ldiv(year.rem,(ABFLONG)100); ldiv_t hours=ldiv(pFH->uFileStartTimeMS/1000,(ABFLONG)3600); ldiv_t minutes=ldiv(hours.rem,(ABFLONG)60); // Recording::SetDateTime expects the year to be passed as the number of years since 1900, and the month // as 0 = Jan ... 11 = Dec ReturnData.SetDateTime(year.quot-1900, month.quot-1, month.rem, hours.quot, minutes.quot, minutes.rem); abf2.Close(); } void stfio::importABF1File(const std::string &fName, Recording &ReturnData, ProgressInfo& progDlg) { int hFile = 0; ABFFileHeader FH; UINT uMaxSamples = 0; DWORD dwMaxEpi = 0; int nError = 0; std::wstring wfName; for(std::string::size_type i=0; idwMaxEpi) { ABF_Close(hFile,&nError); throw std::runtime_error("Error while calling stfio::importABFFile():\n" "lActualEpisodes>dwMaxEpi"); } for (int nChannel=0;nChannel #else #include #endif //=============================================================================================== class CABF2ProtocolReader { private: ABF2_FileInfo m_FileInfo; CSimpleStringCache m_Strings; // The string writing object. CFileDescriptor* m_pFI; int nFile; #if (__cplusplus < 201103) boost::shared_ptr m_pFH; #else std::shared_ptr m_pFH; #endif BOOL ReadFileInfo(); BOOL ReadProtocolInfo(); BOOL ReadADCInfo(); BOOL ReadDACInfo(); BOOL ReadEpochs(); BOOL ReadStats(); BOOL ReadUserList(); BOOL ReadMathInfo(); BOOL GetString( UINT uIndex, LPSTR pszText, UINT uBufSize ); public: CABF2ProtocolReader( ); virtual ~CABF2ProtocolReader(); virtual BOOL Open( LPCTSTR fName ); virtual BOOL Close( ); static BOOL CanOpen( const void *pFirstBlock, UINT uBytes ); virtual BOOL Read( int* pnError); virtual const ABF2_FileInfo *GetFileInfo() const { return &m_FileInfo; } virtual const ABF2FileHeader* GetFileHeader() const { return m_pFH.get(); } virtual ABF2FileHeader* GetFileHeaderW() { return m_pFH.get(); } virtual int GetFileNumber() const { return nFile; } // virtual BOOL ValidateCRC(); }; #endif // INC_ABF2PROTOCOLREADER_H stimfit-0.16.0/src/libstfio/abf/axon2/SimpleStringCache.hpp0000664000175000017500000000254413277303516020452 00000000000000//*********************************************************************************************** // // Copyright (c) 1999 - 2002 Axon Instruments, Inc. // All rights reserved. // //*********************************************************************************************** // MODULE: SimpleStringCache.HPP // PURPOSE: // AUTHOR: BHI Nov 1999 // PRC May 2002 // Simple String Cache class, based on StringCache.hpp / cpp // #ifndef INC_SIMPLESTRINGCACHE_HPP #define INC_SIMPLESTRINGCACHE_HPP #pragma once #include #pragma pack(push, 1) #pragma pack(pop) class CSimpleStringCache { private: // Attributes // Typedefs to simplify code. std::vector m_Cache; UINT m_uMaxSize; private: // Unimplemented copy functions. CSimpleStringCache(const CSimpleStringCache &); const CSimpleStringCache &operator=(const CSimpleStringCache &); public: // Public interface CSimpleStringCache(); ~CSimpleStringCache(); void Clear(); UINT Add(LPCSTR psz); LPCSTR Get(UINT uIndex) const; BOOL Write(HANDLE hFile, UINT &uOffset) const; BOOL Read(HANDLE hFile, UINT uOffset); UINT GetNumStrings() const; UINT GetMaxSize() const { return m_uMaxSize; }; UINT GetTotalSize() const; }; #endif // INC_SIMPLESTRINGCACHE_HPP stimfit-0.16.0/src/libstfio/abf/axon2/abf2headr.cpp0000664000175000017500000003206013277303516016713 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-2000 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // This is ABF2HEADR.CPP; the routines that cope with reading the data file // parameters block for all AXON pCLAMP binary file formats. // // An ANSI C compiler should be used for compilation. // Compile with the large memory model option. // (e.g. CL -c -AL ABFHEADR.C) #include "../axon/Common/wincpp.hpp" #include "abf2headr.h" #include "../axon/AxAbfFio32/abfheadr.h" #include "../axon/AxAbfFio32/abfutil.h" //=============================================================================================== // FUNCTION: ABFH_Initialize // PURPOSE: Initialize an ABFFileHeader structure to a consistent set of parameters // void WINAPI ABF2H_Initialize( ABF2FileHeader *pFH ) { int i; // Zero fill all to start with. memset(pFH, '\0', sizeof(*pFH)); // Blank fill all strings. ABF_BLANK_FILL(pFH->sADCChannelName); ABF_BLANK_FILL(pFH->sADCUnits); ABF_BLANK_FILL(pFH->sDACChannelName); ABF_BLANK_FILL(pFH->sDACChannelUnits); ABF_BLANK_FILL(pFH->sDACFilePath[0]); ABF_BLANK_FILL(pFH->sDACFilePath[1]); ABF_SET_STRING(pFH->sArithmeticOperator, "+"); ABF_BLANK_FILL(pFH->sArithmeticUnits); pFH->fFileVersionNumber = ABF2_CURRENTVERSION; pFH->fHeaderVersionNumber = ABF2_CURRENTVERSION; pFH->nOperationMode = ABF2_GAPFREEFILE; pFH->nADCNumChannels = 1; pFH->fADCSequenceInterval = 100.0F; pFH->lNumSamplesPerEpisode = 512; pFH->lEpisodesPerRun = 1; pFH->lDataSectionPtr = sizeof(ABFFileHeader) / ABF2_BLOCKSIZE; pFH->nDataDisplayMode = ABF2_DRAW_LINES; pFH->nFileType = ABF2_ABFFILE; pFH->nAutoTriggerStrategy = 1; // Allow auto triggering. pFH->nChannelStatsStrategy = 0; // Don't calculate channel statistics. pFH->fStatisticsPeriod = 1.0F; pFH->lStatisticsMeasurements = ABF2_STATISTICS_ABOVETHRESHOLD | ABF2_STATISTICS_MEANOPENTIME; pFH->lSamplesPerTrace = 16384; pFH->lPreTriggerSamples = 16; // default to 16 pFH->fADCRange = 10.24F; pFH->fDACRange = 10.24F; pFH->lADCResolution = 32768L; pFH->lDACResolution = 32768L; pFH->nExperimentType = ABF2_SIMPLEACQUISITION; ABF_BLANK_FILL(pFH->sCreatorInfo); ABF_BLANK_FILL(pFH->sModifierInfo); ABF_BLANK_FILL(pFH->sFileComment); // ADC channel data for (i=0; isADCChannelName[i], szName, ABF2_ADCNAMELEN); strncpy(pFH->sADCUnits[i], "pA ", ABF2_ADCUNITLEN); pFH->nADCPtoLChannelMap[i] = short(i); pFH->nADCSamplingSeq[i] = ABF2_UNUSED_CHANNEL; pFH->fADCProgrammableGain[i] = 1.0F; pFH->fADCDisplayAmplification[i] = 1.0F; pFH->fInstrumentScaleFactor[i] = 0.1F; pFH->fSignalGain[i] = 1.0F; pFH->fSignalLowpassFilter[i] = ABF2_FILTERDISABLED; // FIX FIX FIX PRC DEBUG Telegraph changes - check ! pFH->fTelegraphAdditGain[i] = 1.0F; pFH->fTelegraphFilter[i] = 100000.0F; } pFH->nADCSamplingSeq[0] = 0; // DAC channel data for (i=0; isDACChannelName[i], szName, ABF2_DACNAMELEN); strncpy(pFH->sDACChannelUnits[i], "mV ", ABF2_ADCUNITLEN); pFH->fDACScaleFactor[i] = 20.0F; } // DAC file settings for (i=0; ifDACFileScale[i] = 1.0F; } pFH->nPNPolarity = ABF2_PN_SAME_POLARITY; pFH->nPNNumPulses = 2; pFH->fPNInterpulse = 0; // Initialize as non-zero to avoid glitch in first holding pFH->fPNSettlingTime = 10; for (i=0; ifPostTrainPeriod[i] = 10; // Initialize statistics variables. pFH->nStatsSearchRegionFlags = ABF2_PEAK_SEARCH_REGION0; pFH->nStatsBaseline = ABF2_PEAK_BASELINE_SPECIFIED; pFH->nStatsSmoothing = 1; pFH->nStatsActiveChannels = 0; for( int nStatsRegionID = 0; nStatsRegionID < ABF2_STATS_REGIONS; nStatsRegionID++ ) { pFH->nStatsSearchMode[ nStatsRegionID ] = ABF2_PEAK_SEARCH_SPECIFIED; pFH->lStatsMeasurements[ nStatsRegionID ] = ABF2_PEAK_MEASURE_PEAK | ABF2_PEAK_MEASURE_PEAKTIME; pFH->nRiseBottomPercentile[ nStatsRegionID ] = 10; pFH->nRiseTopPercentile[ nStatsRegionID ] = 90; pFH->nDecayBottomPercentile[ nStatsRegionID ] = 10; pFH->nDecayTopPercentile[ nStatsRegionID ] = 90; } for ( UINT uChannel = 0; uChannel < ABF2_ADCCOUNT; uChannel++ ) pFH->nStatsChannelPolarity[uChannel] = ABF2_PEAK_ABSOLUTE; pFH->fArithmeticUpperLimit = 100.0F; pFH->fArithmeticLowerLimit = -100.0F; pFH->fArithmeticK1 = 1.0F; pFH->fArithmeticK3 = 1.0F; pFH->nLevelHysteresis = 64; // Two LSBits of level hysteresis. pFH->lTimeHysteresis = 1; // Two sequences of time hysteresis. pFH->fAverageWeighting = 0.1F; // Add 10% of trace to 90% of average. pFH->nTrialTriggerSource = ABF2_TRIALTRIGGER_NONE; pFH->nExternalTagType = ABF2_EXTERNALTAG; pFH->nAutoAnalyseEnable = ABF2_AUTOANALYSE_DEFAULT; for( i=0; isULParamValueList[i] ); // DAC Calibration Factors. for( i=0; ifDACCalibrationFactor[i] = 1.0F; pFH->fDACCalibrationOffset[i] = 0.0F; } // Digital train params. pFH->nDigitalTrainActiveLogic = 1; for( i = 0; i < ABF2_EPOCHCOUNT; i ++ ) { pFH->nDigitalTrainValue[ i ] = 0; } // Initialize LTP type. pFH->nLTPType = ABF2_LTP_TYPE_NONE; for( i=0; inLTPUsageOfDAC[ i ] = ABF2_LTP_DAC_USAGE_NONE; pFH->nLTPPresynapticPulses[ i ] = 0; } // Alternating Outputs pFH->nAlternateDACOutputState = 0; pFH->nAlternateDigitalOutputState = 0; for( int nEpoch = 0; nEpoch < ABF2_EPOCHCOUNT; nEpoch ++ ) { pFH->nAlternateDigitalValue[ nEpoch ] = 0; pFH->nAlternateDigitalTrainValue[ nEpoch ] = 0; } //Post-processing values. for( i=0; ifPostProcessLowpassFilter[i] = ABF2_FILTERDISABLED; pFH->nPostProcessLowpassFilterType[i] = ABF2_POSTPROCESS_FILTER_NONE; } } //=============================================================================================== // FUNCTION: ABFH_GetChannelOffset // PURPOSE: Get the offset in the sampling sequence for the given physical channel. // BOOL WINAPI ABF2H_GetChannelOffset( const ABF2FileHeader *pFH, int nChannel, UINT *puChannelOffset ) { // ABFH_ASSERT(pFH); // WPTRASSERT(puChannelOffset); int nOffset; // check the ADC channel number, -1 refers to the math channel if (nChannel < 0) { if (!pFH->nArithmeticEnable) { if (puChannelOffset) *puChannelOffset = 0; // return the offset to this channel return FALSE; // channel not found in sampling sequence } nChannel = pFH->nArithmeticADCNumA; } for (nOffset = 0; nOffset < pFH->nADCNumChannels; nOffset++) { if (pFH->nADCSamplingSeq[nOffset] == nChannel) { if (puChannelOffset) *puChannelOffset = UINT(nOffset); // return the offset to this channel return TRUE; } } if (puChannelOffset) *puChannelOffset = 0; // return the offset to this channel return FALSE; } //============================================================================================== // FUNCTION: GetADCtoUUFactors // PURPOSE: Calculates the scaling factors used to convert ADC values to UserUnits. // PARAMETERS: // nChannel - The physical channel number to get the factors for. // pfADCToUUFactor - Pointers to return locations for scale and offset. // pfADCToUUShift UserUnits = ADCValue * fADCToUUFactor + fADCToUUShift; // void WINAPI ABF2H_GetADCtoUUFactors( const ABF2FileHeader *pFH, int nChannel, float *pfADCToUUFactor, float *pfADCToUUShift ) { ASSERT(nChannel < ABF2_ADCCOUNT); float fTotalScaleFactor = pFH->fInstrumentScaleFactor[nChannel] * pFH->fADCProgrammableGain[nChannel]; if (pFH->nSignalType != 0) fTotalScaleFactor *= pFH->fSignalGain[nChannel]; // Adjust for the telegraphed gain. if( pFH->nTelegraphEnable[nChannel] ) fTotalScaleFactor *= pFH->fTelegraphAdditGain[nChannel]; ASSERT(fTotalScaleFactor != 0.0F); if (fTotalScaleFactor==0.0F) fTotalScaleFactor = 1.0F; // InputRange and InputOffset is the range and offset of the signal in // user units when it hits the Analog-to-Digital converter float fInputRange = pFH->fADCRange / fTotalScaleFactor; float fInputOffset= -pFH->fInstrumentOffset[nChannel]; if (pFH->nSignalType != 0) fInputOffset += pFH->fSignalOffset[nChannel]; *pfADCToUUFactor = fInputRange / pFH->lADCResolution; *pfADCToUUShift = -fInputOffset; } #define AVERYBIGNUMBER 3.402823466E+38 //=============================================================================================== // FUNCTION: ABFH_GetMathValue // PURPOSE: Evaluate the Math expression for the given UU values. // RETURNS: TRUE if the expression could be evaluated OK. // FALSE if a divide by zero occurred. // BOOL WINAPI ABF2H_GetMathValue(const ABF2FileHeader *pFH, float fA, float fB, float *pfRval) { // ABFH_ASSERT(pFH); // WPTRASSERT(pfRval); double dResult = 0.0; // default return response double dLeftVal, dRightVal; BOOL bRval = TRUE; if (pFH->nArithmeticExpression == ABF2_SIMPLE_EXPRESSION) { dLeftVal = pFH->fArithmeticK1 * fA + pFH->fArithmeticK2; dRightVal = pFH->fArithmeticK3 * fB + pFH->fArithmeticK4; } else { double dRatio; if (fB + pFH->fArithmeticK6 != 0.0F) dRatio = (fA + pFH->fArithmeticK5) / (fB + pFH->fArithmeticK6); else if (fA + pFH->fArithmeticK5 > 0.0F) { dRatio = AVERYBIGNUMBER; bRval = FALSE; } else { dRatio = -AVERYBIGNUMBER; bRval = FALSE; } dLeftVal = pFH->fArithmeticK1 * dRatio + pFH->fArithmeticK2; dRightVal = pFH->fArithmeticK3 * dRatio + pFH->fArithmeticK4; } switch (pFH->sArithmeticOperator[0]) { case '+': dResult = dLeftVal + dRightVal; break; case '-': dResult = dLeftVal - dRightVal; break; case '*': dResult = dLeftVal * dRightVal; break; case '/': if (dRightVal != 0.0) dResult = dLeftVal / dRightVal; else if (dLeftVal > 0) { dResult = pFH->fArithmeticUpperLimit; bRval = FALSE; } else { dResult = pFH->fArithmeticLowerLimit; bRval = FALSE; } break; default: //ERRORMSG1("Unexpected operator '%c'.", pFH->sArithmeticOperator[0]); break; } if (dResult < pFH->fArithmeticLowerLimit) dResult = pFH->fArithmeticLowerLimit; else if (dResult > pFH->fArithmeticUpperLimit) dResult = pFH->fArithmeticUpperLimit; if (pfRval) *pfRval = (float)dResult; return bRval; } //=============================================================================================== // FUNCTION: GetSampleInterval // PURPOSE: Gets the sample interval expressed as a double. // This prevents round off errors in modifiable ABF files, // where sample intervals are not constrained to be in multiples of 0.5 us. // static double GetSampleInterval( const ABF2FileHeader *pFH, const UINT uInterval ) { // ABFH_ASSERT( pFH ); ASSERT( uInterval == 1 || uInterval == 2 ); float fInterval = 0; if( uInterval == 1 ) fInterval = pFH->fLegacyADCSequenceInterval; else if( uInterval == 2 ) fInterval = pFH->fLegacyADCSecondSequenceInterval; else ; //ERRORMSG( "ABFH_GetSampleInterval called with invalid parameters !\n" ); // Modifiable ABF allows sample intervals which are not multiples of 0.5 us // Attempt to reconstruct the original sample interval to 0.1 us resolution // This has no adverse effect for acquisition files and prevents rounding errors in modifable ABF files. double dInterval = int((fInterval * pFH->nADCNumChannels) * 10 + 0.5); dInterval /= 10 * pFH->nADCNumChannels; return dInterval; } //=============================================================================================== // FUNCTION: ABFH_GetFirstSampleInterval // PURPOSE: Gets the first sample interval expressed as a double. double WINAPI ABF2H_GetFirstSampleInterval( const ABF2FileHeader *pFH ) { return GetSampleInterval( pFH, 1 ); } stimfit-0.16.0/src/libstfio/abf/axon2/SimpleStringCache.cpp0000664000175000017500000001766413277303516020456 00000000000000//*********************************************************************************************** // // Copyright (c) 1999 - 2002 Axon Instruments, Inc. // All rights reserved. // //*********************************************************************************************** // MODULE: SimpleStringCache.CPP // PURPOSE: Cache of strings stored in a vector. // AUTHOR: BHI Nov 1999 // PRC May 2002 // #include "../axon/Common/wincpp.hpp" #include "SimpleStringCache.hpp" #include "../axon/Common/ArrayPtr.hpp" #include "../axon/Common/FileIO.hpp" #if defined(_WINDOWS) && !defined(__MINGW32__) #pragma warning(disable : 4201) #include #endif #include "../axon/Common/FileIO.hpp" #include #define MAKEFOURCC(ch0, ch1, ch2, ch3) \ ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) const DWORD c_dwSIGNATURE = MAKEFOURCC('S','S','C','H'); // Simple String Cache Header const DWORD c_dwCURRENT_VERSION = MAKEFOURCC(1,0,0,0); // 1.0.0.0 #if !defined(_WINDOWS) || defined(__MINGW32__) || defined(__STF__) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif struct SimpleStringCacheHeader { DWORD dwSignature; DWORD dwVersion; UINT uNumStrings; UINT uMaxSize; ABFLONG lTotalBytes; UINT uUnused[6]; SimpleStringCacheHeader() { memset(this, 0, sizeof(*this)); dwSignature = c_dwSIGNATURE; dwVersion = c_dwCURRENT_VERSION; } }; #if 0 //#define SHOW_STRUCT_SIZES #ifdef SHOW_STRUCT_SIZES AXODBG_SHOW_SIZE(SimpleStringCacheHeader); #else ASSERT( sizeof(SimpleStringCacheHeader) == 44 ); #endif #endif //############################################################################################### //############################################################################################### //############################################################################################### //############################################################################################### //=============================================================================================== // FUNCTION: Constructor // PURPOSE: Object initialization. // CSimpleStringCache::CSimpleStringCache() { MEMBERASSERT(); m_uMaxSize = 0; } //=============================================================================================== // FUNCTION: Destructor // PURPOSE: Object cleanup. // CSimpleStringCache::~CSimpleStringCache() { MEMBERASSERT(); Clear(); } //=============================================================================================== // FUNCTION: Clear // PURPOSE: Clear the cache. // void CSimpleStringCache::Clear() { MEMBERASSERT(); // Delete the strings. for( UINT i=0; i( m_Cache[i] ); delete pszItem; pszItem = NULL; } // Now clear the vector m_Cache.clear(); } //=============================================================================================== // FUNCTION: Add // PURPOSE: Add a new string into the cache. // UINT CSimpleStringCache::Add(LPCSTR psz) { MEMBERASSERT(); std::size_t uLen = strlen(psz); LPSTR pszText = new char[uLen+1]; strcpy( pszText, psz ); m_Cache.push_back( pszText ); m_uMaxSize = max( m_uMaxSize, uLen ); return GetNumStrings(); } //=============================================================================================== // FUNCTION: Get // PURPOSE: Get the string pointer that corresponds to the index. // LPCSTR CSimpleStringCache::Get(UINT uIndex) const { MEMBERASSERT(); if( uIndex < m_Cache.size() ) { LPCSTR pszText = m_Cache[uIndex]; return pszText; } #ifndef __APPLE__ std::cerr << "Bad index passed to CSimpleStringCache (" << uIndex << ")"; #endif return NULL; } //=============================================================================================== // FUNCTION: GetTotalSize // PURPOSE: Returns to total size (in bytes) required to write out all the strings (including the header). // UINT CSimpleStringCache::GetTotalSize() const { MEMBERASSERT(); UINT uSize = sizeof(SimpleStringCacheHeader); for( std::size_t i=0; i pszBuffer( Header.lTotalBytes ); if( !File.Read( pszBuffer, Header.lTotalBytes ) ) return false; // Copy each string into the cache. LPCSTR pszText = pszBuffer; for (UINT i=0; i0 = The specific sweep number. // // Constants for nInterEpisodeLevel & nDigitalInterEpisode // #define ABF2_INTEREPI_USEHOLDING 0 #define ABF2_INTEREPI_USELASTEPOCH 1 // // Constants for nArithmeticExpression // #define ABF2_SIMPLE_EXPRESSION 0 #define ABF2_RATIO_EXPRESSION 1 // // Constants for nLowpassFilterType & nHighpassFilterType // #define ABF2_FILTER_NONE 0 #define ABF2_FILTER_EXTERNAL 1 #define ABF2_FILTER_SIMPLE_RC 2 #define ABF2_FILTER_BESSEL 3 #define ABF2_FILTER_BUTTERWORTH 4 // // Constants for post nPostprocessLowpassFilterType // #define ABF2_POSTPROCESS_FILTER_NONE 0 #define ABF2_POSTPROCESS_FILTER_ADAPTIVE 1 #define ABF2_POSTPROCESS_FILTER_BESSEL 2 #define ABF2_POSTPROCESS_FILTER_BOXCAR 3 #define ABF2_POSTPROCESS_FILTER_BUTTERWORTH 4 #define ABF2_POSTPROCESS_FILTER_CHEBYSHEV 5 #define ABF2_POSTPROCESS_FILTER_GAUSSIAN 6 #define ABF2_POSTPROCESS_FILTER_RC 7 #define ABF2_POSTPROCESS_FILTER_RC8 8 #define ABF2_POSTPROCESS_FILTER_NOTCH 9 // // The output sampling sequence identifier for a separate digital out channel. // #define ABF2_DIGITAL_OUT_CHANNEL -1 #define ABF2_PADDING_OUT_CHANNEL -2 // // Constants for nAutoAnalyseEnable // #define ABF2_AUTOANALYSE_DISABLED 0 #define ABF2_AUTOANALYSE_DEFAULT 1 #define ABF2_AUTOANALYSE_RUNMACRO 2 // // Constants for nAutopeakSearchMode // #define ABF2_PEAK_SEARCH_SPECIFIED -2 #define ABF2_PEAK_SEARCH_ALL -1 // nAutopeakSearchMode 0..9 = epoch in waveform 0's epoch table // nAutopeakSearchMode 10..19 = epoch in waveform 1's epoch table // // Constants for nAutopeakBaseline // #define ABF2_PEAK_BASELINE_SPECIFIED -3 #define ABF2_PEAK_BASELINE_NONE -2 #define ABF2_PEAK_BASELINE_FIRSTHOLDING -1 #define ABF2_PEAK_BASELINE_LASTHOLDING -4 // Bit flag settings for nStatsSearchRegionFlags // #define ABF2_PEAK_SEARCH_REGION0 0x01 #define ABF2_PEAK_SEARCH_REGION1 0x02 #define ABF2_PEAK_SEARCH_REGION2 0x04 #define ABF2_PEAK_SEARCH_REGION3 0x08 #define ABF2_PEAK_SEARCH_REGION4 0x10 #define ABF2_PEAK_SEARCH_REGION5 0x20 #define ABF2_PEAK_SEARCH_REGION6 0x40 #define ABF2_PEAK_SEARCH_REGION7 0x80 #define ABF2_PEAK_SEARCH_REGIONALL 0xFF // All of the above OR'd together. // // Constants for nStatsActiveChannels // #define ABF2_PEAK_SEARCH_CHANNEL0 0x0001 #define ABF2_PEAK_SEARCH_CHANNEL1 0x0002 #define ABF2_PEAK_SEARCH_CHANNEL2 0x0004 #define ABF2_PEAK_SEARCH_CHANNEL3 0x0008 #define ABF2_PEAK_SEARCH_CHANNEL4 0x0010 #define ABF2_PEAK_SEARCH_CHANNEL5 0x0020 #define ABF2_PEAK_SEARCH_CHANNEL6 0x0040 #define ABF2_PEAK_SEARCH_CHANNEL7 0x0080 #define ABF2_PEAK_SEARCH_CHANNEL8 0x0100 #define ABF2_PEAK_SEARCH_CHANNEL9 0x0200 #define ABF2_PEAK_SEARCH_CHANNEL10 0x0400 #define ABF2_PEAK_SEARCH_CHANNEL11 0x0800 #define ABF2_PEAK_SEARCH_CHANNEL12 0x1000 #define ABF2_PEAK_SEARCH_CHANNEL13 0x2000 #define ABF2_PEAK_SEARCH_CHANNEL14 0x4000 #define ABF2_PEAK_SEARCH_CHANNEL15 0x8000 #define ABF2_PEAK_SEARCH_CHANNELSALL 0xFFFF // All of the above OR'd together. // // Constants for nLeakSubtractType // #define ABF2_LEAKSUBTRACT_NONE 0 #define ABF2_LEAKSUBTRACT_PN 1 #define ABF2_LEAKSUBTRACT_RESISTIVE 2 // // Constants for nPNPolarity // #define ABF2_PN_OPPOSITE_POLARITY -1 #define ABF2_PN_SAME_POLARITY 1 // // Constants for nPNPosition // #define ABF2_PN_BEFORE_EPISODE 0 #define ABF2_PN_AFTER_EPISODE 1 // // Constants for nAutosampleEnable // #define ABF2_AUTOSAMPLEDISABLED 0 #define ABF2_AUTOSAMPLEAUTOMATIC 1 #define ABF2_AUTOSAMPLEMANUAL 2 // // Constants for nAutosampleInstrument // #define ABF2_INST_UNKNOWN 0 // Unknown instrument (manual or user defined telegraph table). #define ABF2_INST_AXOPATCH1 1 // Axopatch-1 with CV-4-1/100 #define ABF2_INST_AXOPATCH1_1 2 // Axopatch-1 with CV-4-0.1/100 #define ABF2_INST_AXOPATCH1B 3 // Axopatch-1B(inv.) CV-4-1/100 #define ABF2_INST_AXOPATCH1B_1 4 // Axopatch-1B(inv) CV-4-0.1/100 #define ABF2_INST_AXOPATCH201 5 // Axopatch 200 with CV 201 #define ABF2_INST_AXOPATCH202 6 // Axopatch 200 with CV 202 #define ABF2_INST_GENECLAMP 7 // GeneClamp #define ABF2_INST_DAGAN3900 8 // Dagan 3900 #define ABF2_INST_DAGAN3900A 9 // Dagan 3900A #define ABF2_INST_DAGANCA1_1 10 // Dagan CA-1 Im=0.1 #define ABF2_INST_DAGANCA1 11 // Dagan CA-1 Im=1.0 #define ABF2_INST_DAGANCA10 12 // Dagan CA-1 Im=10 #define ABF2_INST_WARNER_OC725 13 // Warner OC-725 #define ABF2_INST_WARNER_OC725C 14 // Warner OC-725 #define ABF2_INST_AXOPATCH200B 15 // Axopatch 200B #define ABF2_INST_DAGANPCONE0_1 16 // Dagan PC-ONE Im=0.1 #define ABF2_INST_DAGANPCONE1 17 // Dagan PC-ONE Im=1.0 #define ABF2_INST_DAGANPCONE10 18 // Dagan PC-ONE Im=10 #define ABF2_INST_DAGANPCONE100 19 // Dagan PC-ONE Im=100 #define ABF2_INST_WARNER_BC525C 20 // Warner BC-525C #define ABF2_INST_WARNER_PC505 21 // Warner PC-505 #define ABF2_INST_WARNER_PC501 22 // Warner PC-501 #define ABF2_INST_DAGANCA1_05 23 // Dagan CA-1 Im=0.05 #define ABF2_INST_MULTICLAMP700 24 // MultiClamp 700 #define ABF2_INST_TURBO_TEC 25 // Turbo Tec #define ABF2_INST_OPUSXPRESS6000 26 // OpusXpress 6000A #define ABF2_INST_AXOCLAMP900 27 // Axoclamp 900 // // Constants for nTagType in the ABFTag structure. // #define ABF2_TIMETAG 0 #define ABF2_COMMENTTAG 1 #define ABF2_EXTERNALTAG 2 #define ABF2_VOICETAG 3 #define ABF2_NEWFILETAG 4 #define ABF2_ANNOTATIONTAG 5 // Same as a comment tag except that nAnnotationIndex holds // the index of the annotation that holds extra information. // Comment inserted for externally acquired tags (expanded with spaces to ABF2_TAGCOMMENTLEN). #define ABF2_EXTERNALTAGCOMMENT "" #define ABF2_VOICETAGCOMMENT "" // // Constants for nManualInfoStrategy // #define ABF2_ENV_DONOTWRITE 0 #define ABF2_ENV_WRITEEACHTRIAL 1 #define ABF2_ENV_PROMPTEACHTRIAL 2 // // Constants for nAutopeakPolarity // #define ABF2_PEAK_NEGATIVE -1 #define ABF2_PEAK_ABSOLUTE 0 #define ABF2_PEAK_POSITIVE 1 // // LTP Types - Reflects whether the header is used for LTP as baseline or induction. // #define ABF2_LTP_TYPE_NONE 0 #define ABF2_LTP_TYPE_BASELINE 1 #define ABF2_LTP_TYPE_INDUCTION 2 // // LTP Usage of DAC - Reflects whether the analog output will be used presynaptically or postsynaptically. // #define ABF2_LTP_DAC_USAGE_NONE 0 #define ABF2_LTP_DAC_USAGE_PRESYNAPTIC 1 #define ABF2_LTP_DAC_USAGE_POSTSYNAPTIC 2 // Values for the wScopeMode field in ABFScopeConfig. #define ABF2_EPISODICMODE 0 #define ABF2_CONTINUOUSMODE 1 //#define ABF2_XYMODE 2 // // Constants for nExperimentType // #define ABF2_VOLTAGECLAMP 0 #define ABF2_CURRENTCLAMP 1 #define ABF2_SIMPLEACQUISITION 2 // // Miscellaneous constants // #define ABF2_FILTERDISABLED 100000.0F // Large frequency to disable lowpass filters #define ABF2_UNUSED_CHANNEL -1 // Unused ADC and DAC channels. #define ABF2_ANY_CHANNEL (UINT)-1 // Any ADC or DAC channel. // // Constant definitions for nDataFormat // #define ABF2_INTEGERDATA 0 #define ABF2_FLOATDATA 1 // // Constant definitions for nOperationMode // #define ABF2_VARLENEVENTS 1 #define ABF2_FIXLENEVENTS 2 // (ABF2_FIXLENEVENTS == ABF2_LOSSFREEOSC) #define ABF2_LOSSFREEOSC 2 #define ABF2_GAPFREEFILE 3 #define ABF2_HIGHSPEEDOSC 4 #define ABF2_WAVEFORMFILE 5 // // Constants for nEpochType // #define ABF2_EPOCHDISABLED 0 // disabled epoch #define ABF2_EPOCHSTEPPED 1 // stepped waveform #define ABF2_EPOCHRAMPED 2 // ramp waveform #define ABF2_EPOCH_TYPE_RECTANGLE 3 // rectangular pulse train #define ABF2_EPOCH_TYPE_TRIANGLE 4 // triangular waveform #define ABF2_EPOCH_TYPE_COSINE 5 // cosinusoidal waveform #define ABF2_EPOCH_TYPE_UNUSED 6 // was ABF2_EPOCH_TYPE_RESISTANCE #define ABF2_EPOCH_TYPE_BIPHASIC 7 // biphasic pulse train #define ABF2_EPOCHSLOPE 8 // IonWorks style ramp waveform // // Constants for epoch resistance // #define ABF2_MIN_EPOCH_RESISTANCE_DURATION 8 // // Constants for nWaveformSource // #define ABF2_WAVEFORMDISABLED 0 // disabled waveform #define ABF2_EPOCHTABLEWAVEFORM 1 #define ABF2_DACFILEWAVEFORM 2 // // Constant definitions for nFileType // #define ABF2_ABFFILE 1 #define ABF2_FETCHEX 2 #define ABF2_CLAMPEX 3 // // maximum values for various parameters (used by ABFH1_CheckUserList). // #define ABF2_CTPULSECOUNT_MAX 10000 #define ABF2_CTBASELINEDURATION_MAX 1000000.0F #define ABF2_CTSTEPDURATION_MAX 1000000.0F #define ABF2_CTPOSTTRAINDURATION_MAX 1000000.0F #define ABF2_SWEEPSTARTTOSTARTTIME_MAX 1000000.0F #define ABF2_PNPULSECOUNT_MAX 8 #define ABF2_DIGITALVALUE_MAX 0xFF #define ABF2_EPOCHDIGITALVALUE_MAX 0xFF // // Constants for nTriggerSource // #define ABF2_TRIGGERLINEINPUT -5 // Start on line trigger (DD1320 only) #define ABF2_TRIGGERTAGINPUT -4 #define ABF2_TRIGGERFIRSTCHANNEL -3 #define ABF2_TRIGGEREXTERNAL -2 #define ABF2_TRIGGERSPACEBAR -1 // >=0 = ADC channel to trigger off. // // Constants for nTrialTriggerSource // #define ABF2_TRIALTRIGGER_SWSTARTONLY -6 // Start on software message, end when protocol ends. #define ABF2_TRIALTRIGGER_SWSTARTSTOP -5 // Start and end on software messages. #define ABF2_TRIALTRIGGER_LINEINPUT -4 // Start on line trigger (DD1320 only) #define ABF2_TRIALTRIGGER_SPACEBAR -3 // Start on spacebar press. #define ABF2_TRIALTRIGGER_EXTERNAL -2 // Start on external trigger high #define ABF2_TRIALTRIGGER_NONE -1 // Start immediately (default). // >=0 = ADC channel to trigger off. // Not implemented as yet... // // Constants for lStatisticsMeasurements // #define ABF2_STATISTICS_ABOVETHRESHOLD 0x00000001 #define ABF2_STATISTICS_EVENTFREQUENCY 0x00000002 #define ABF2_STATISTICS_MEANOPENTIME 0x00000004 #define ABF2_STATISTICS_MEANCLOSEDTIME 0x00000008 #define ABF2_STATISTICS_ALL 0x0000000F // All the above OR'd together. // // Constants for nStatisticsSaveStrategy // #define ABF2_STATISTICS_NOAUTOSAVE 0 #define ABF2_STATISTICS_AUTOSAVE 1 #define ABF2_STATISTICS_AUTOSAVE_AUTOCLEAR 2 // // Constants for nStatisticsDisplayStrategy // #define ABF2_STATISTICS_DISPLAY 0 #define ABF2_STATISTICS_NODISPLAY 1 // // Constants for nStatisticsClearStrategy // determines whether to clear statistics after saving. // #define ABF2_STATISTICS_NOCLEAR 0 #define ABF2_STATISTICS_CLEAR 1 #define ABF2_STATS_REGIONS 8 // The number of independent statistics regions. #define ABF2_BASELINE_REGIONS 1 // The number of independent baseline regions. #define ABF2_STATS_NUM_MEASUREMENTS 18 // The total number of supported statistcs measurements. // // Constants for lAutopeakMeasurements // #define ABF2_PEAK_MEASURE_PEAK 0x00000001 #define ABF2_PEAK_MEASURE_PEAKTIME 0x00000002 #define ABF2_PEAK_MEASURE_ANTIPEAK 0x00000004 #define ABF2_PEAK_MEASURE_ANTIPEAKTIME 0x00000008 #define ABF2_PEAK_MEASURE_MEAN 0x00000010 #define ABF2_PEAK_MEASURE_STDDEV 0x00000020 #define ABF2_PEAK_MEASURE_INTEGRAL 0x00000040 #define ABF2_PEAK_MEASURE_MAXRISESLOPE 0x00000080 #define ABF2_PEAK_MEASURE_MAXRISESLOPETIME 0x00000100 #define ABF2_PEAK_MEASURE_MAXDECAYSLOPE 0x00000200 #define ABF2_PEAK_MEASURE_MAXDECAYSLOPETIME 0x00000400 #define ABF2_PEAK_MEASURE_RISETIME 0x00000800 #define ABF2_PEAK_MEASURE_DECAYTIME 0x00001000 #define ABF2_PEAK_MEASURE_HALFWIDTH 0x00002000 #define ABF2_PEAK_MEASURE_BASELINE 0x00004000 #define ABF2_PEAK_MEASURE_RISESLOPE 0x00008000 #define ABF2_PEAK_MEASURE_DECAYSLOPE 0x00010000 #define ABF2_PEAK_MEASURE_REGIONSLOPE 0x00020000 #define ABF2_PEAK_MEASURE_DURATION 0x00040000 #define ABF2_PEAK_NORMAL_PEAK 0x00100000 #define ABF2_PEAK_NORMAL_ANTIPEAK 0x00400000 #define ABF2_PEAK_NORMAL_MEAN 0x01000000 #define ABF2_PEAK_NORMAL_STDDEV 0x02000000 #define ABF2_PEAK_NORMAL_INTEGRAL 0x04000000 #define ABF2_PEAK_NORMALISABLE 0x00000075 #define ABF2_PEAK_NORMALISED 0x07500000 #define ABF2_PEAK_MEASURE_ALL 0x0752FFFF // All of the above OR'd together. // // Constant definitions for nParamToVary // #define ABF2_CONDITNUMPULSES 0 #define ABF2_CONDITBASELINEDURATION 1 #define ABF2_CONDITBASELINELEVEL 2 #define ABF2_CONDITSTEPDURATION 3 #define ABF2_CONDITSTEPLEVEL 4 #define ABF2_CONDITPOSTTRAINDURATION 5 #define ABF2_CONDITPOSTTRAINLEVEL 6 #define ABF2_EPISODESTARTTOSTART 7 #define ABF2_INACTIVEHOLDING 8 #define ABF2_DIGITALHOLDING 9 #define ABF2_PNNUMPULSES 10 #define ABF2_PARALLELVALUE 11 #define ABF2_EPOCHINITLEVEL (ABF2_PARALLELVALUE + ABF2_EPOCHCOUNT) #define ABF2_EPOCHINITDURATION (ABF2_EPOCHINITLEVEL + ABF2_EPOCHCOUNT) #define ABF2_EPOCHTRAINPERIOD (ABF2_EPOCHINITDURATION + ABF2_EPOCHCOUNT) #define ABF2_EPOCHTRAINPULSEWIDTH (ABF2_EPOCHTRAINPERIOD + ABF2_EPOCHCOUNT) // Next value is (ABF2_EPOCHINITDURATION + ABF2_EPOCHCOUNT) // Values for the nEraseStrategy field in ABFScopeConfig. #define ABF2_ERASE_EACHSWEEP 0 #define ABF2_ERASE_EACHRUN 1 #define ABF2_ERASE_EACHTRIAL 2 #define ABF2_ERASE_DONTERASE 3 // Indexes into the rgbColor field of ABFScopeConfig. #define ABF2_BACKGROUNDCOLOR 0 #define ABF2_GRIDCOLOR 1 #define ABF2_THRESHOLDCOLOR 2 #define ABF2_EVENTMARKERCOLOR 3 #define ABF2_SEPARATORCOLOR 4 #define ABF2_AVERAGECOLOR 5 #define ABF2_OLDDATACOLOR 6 #define ABF2_TEXTCOLOR 7 #define ABF2_AXISCOLOR 8 #define ABF2_ACTIVEAXISCOLOR 9 #define ABF2_LASTCOLOR ABF2_ACTIVEAXISCOLOR #define ABF2_SCOPECOLORS (ABF2_LASTCOLOR+1) // Extended colors for rgbColorEx field in ABFScopeConfig #define ABF2_STATISTICS_REGION0 0 #define ABF2_STATISTICS_REGION1 1 #define ABF2_STATISTICS_REGION2 2 #define ABF2_STATISTICS_REGION3 3 #define ABF2_STATISTICS_REGION4 4 #define ABF2_STATISTICS_REGION5 5 #define ABF2_STATISTICS_REGION6 6 #define ABF2_STATISTICS_REGION7 7 #define ABF2_BASELINE_REGION 8 #define ABF2_STOREDSWEEPCOLOR 9 #define ABF2_LASTCOLOR_EX ABF2_STOREDSWEEPCOLOR #define ABF2_SCOPECOLORS_EX (ABF2_LASTCOLOR+1) // // Constants for nCompressionType in the ABFVoiceTagInfo structure. // #define ABF2_COMPRESSION_NONE 0 #define ABF2_COMPRESSION_PKWARE 1 #define ABF2_CURRENTVERSION ABF2_V203 // Current file format version number // // Header Version Numbers // #define ABF2_V200 2.00F // Alpha versions of pCLAMP 10 and DataXpress 2 #define ABF2_V201 2.01F // DataXpress 2.0.0.16 and later // pCLAMP 10.0.0.6 and later #define ABF2_V202 2.02F // Barracuda 1.0 and later #define ABF2_V203 2.03F // pCLAMP 10.4.0.7 and later // Retired constants. #undef ABF2_AUTOANALYSE_RUNMACRO #undef ABF2_MACRONAMELEN // // pack structure on byte boundaries // #ifndef RC_INVOKED #pragma pack(push, 1) #endif // // Definition of the ABF header structure. // struct ABF2FileHeader { public: // GROUP #1 - File ID and size information float fFileVersionNumber; short nOperationMode; ABFLONG lActualAcqLength; short nNumPointsIgnored; ABFLONG lActualEpisodes; UINT uFileStartDate; // YYYYMMDD UINT uFileStartTimeMS; ABFLONG lStopwatchTime; float fHeaderVersionNumber; short nFileType; // GROUP #2 - File Structure ABFLONG lDataSectionPtr; ABFLONG lTagSectionPtr; ABFLONG lNumTagEntries; ABFLONG lScopeConfigPtr; ABFLONG lNumScopes; ABFLONG lDeltaArrayPtr; ABFLONG lNumDeltas; ABFLONG lVoiceTagPtr; ABFLONG lVoiceTagEntries; ABFLONG lSynchArrayPtr; ABFLONG lSynchArraySize; short nDataFormat; short nSimultaneousScan; ABFLONG lStatisticsConfigPtr; ABFLONG lAnnotationSectionPtr; ABFLONG lNumAnnotations; ABFLONG lDACFilePtr[ABF2_DACCOUNT]; ABFLONG lDACFileNumEpisodes[ABF2_DACCOUNT]; // GROUP #3 - Trial hierarchy information short nADCNumChannels; float fADCSequenceInterval; UINT uFileCompressionRatio; bool bEnableFileCompression; float fSynchTimeUnit; float fSecondsPerRun; ABFLONG lNumSamplesPerEpisode; ABFLONG lPreTriggerSamples; ABFLONG lEpisodesPerRun; ABFLONG lRunsPerTrial; ABFLONG lNumberOfTrials; short nAveragingMode; short nUndoRunCount; short nFirstEpisodeInRun; float fTriggerThreshold; short nTriggerSource; short nTriggerAction; short nTriggerPolarity; float fScopeOutputInterval; float fEpisodeStartToStart; float fRunStartToStart; float fTrialStartToStart; ABFLONG lAverageCount; short nAutoTriggerStrategy; float fFirstRunDelayS; // GROUP #4 - Display Parameters short nDataDisplayMode; short nChannelStatsStrategy; ABFLONG lSamplesPerTrace; ABFLONG lStartDisplayNum; ABFLONG lFinishDisplayNum; short nShowPNRawData; float fStatisticsPeriod; ABFLONG lStatisticsMeasurements; short nStatisticsSaveStrategy; // GROUP #5 - Hardware information float fADCRange; float fDACRange; ABFLONG lADCResolution; ABFLONG lDACResolution; short nDigitizerADCs; short nDigitizerDACs; short nDigitizerTotalDigitalOuts; short nDigitizerSynchDigitalOuts; short nDigitizerType; // GROUP #6 Environmental Information short nExperimentType; short nManualInfoStrategy; float fCellID1; float fCellID2; float fCellID3; char sProtocolPath[ABF2_PATHLEN]; char sCreatorInfo[ABF2_CREATORINFOLEN]; char sModifierInfo[ABF2_CREATORINFOLEN]; short nCommentsEnable; char sFileComment[ABF2_FILECOMMENTLEN]; short nTelegraphEnable[ABF2_ADCCOUNT]; short nTelegraphInstrument[ABF2_ADCCOUNT]; float fTelegraphAdditGain[ABF2_ADCCOUNT]; float fTelegraphFilter[ABF2_ADCCOUNT]; float fTelegraphMembraneCap[ABF2_ADCCOUNT]; float fTelegraphAccessResistance[ABF2_ADCCOUNT]; short nTelegraphMode[ABF2_ADCCOUNT]; short nTelegraphDACScaleFactorEnable[ABF2_DACCOUNT]; short nAutoAnalyseEnable; GUID FileGUID; float fInstrumentHoldingLevel[ABF2_DACCOUNT]; unsigned ABFLONG ulFileCRC; short nCRCEnable; // GROUP #7 - Multi-channel information short nSignalType; // why is this only single channel ? short nADCPtoLChannelMap[ABF2_ADCCOUNT]; short nADCSamplingSeq[ABF2_ADCCOUNT]; float fADCProgrammableGain[ABF2_ADCCOUNT]; float fADCDisplayAmplification[ABF2_ADCCOUNT]; float fADCDisplayOffset[ABF2_ADCCOUNT]; float fInstrumentScaleFactor[ABF2_ADCCOUNT]; float fInstrumentOffset[ABF2_ADCCOUNT]; float fSignalGain[ABF2_ADCCOUNT]; float fSignalOffset[ABF2_ADCCOUNT]; float fSignalLowpassFilter[ABF2_ADCCOUNT]; float fSignalHighpassFilter[ABF2_ADCCOUNT]; char nLowpassFilterType[ABF2_ADCCOUNT]; char nHighpassFilterType[ABF2_ADCCOUNT]; bool bHumFilterEnable[ABF2_ADCCOUNT]; char sADCChannelName[ABF2_ADCCOUNT][ABF2_ADCNAMELEN]; char sADCUnits[ABF2_ADCCOUNT][ABF2_ADCUNITLEN]; float fDACScaleFactor[ABF2_DACCOUNT]; float fDACHoldingLevel[ABF2_DACCOUNT]; float fDACCalibrationFactor[ABF2_DACCOUNT]; float fDACCalibrationOffset[ABF2_DACCOUNT]; char sDACChannelName[ABF2_DACCOUNT][ABF2_DACNAMELEN]; char sDACChannelUnits[ABF2_DACCOUNT][ABF2_DACUNITLEN]; // GROUP #9 - Epoch Waveform and Pulses short nDigitalEnable; short nActiveDACChannel; // should retire ! short nDigitalDACChannel; short nDigitalHolding; short nDigitalInterEpisode; short nDigitalTrainActiveLogic; short nDigitalValue[ABF2_EPOCHCOUNT]; short nDigitalTrainValue[ABF2_EPOCHCOUNT]; bool bEpochCompression[ABF2_EPOCHCOUNT]; short nWaveformEnable[ABF2_DACCOUNT]; short nWaveformSource[ABF2_DACCOUNT]; short nInterEpisodeLevel[ABF2_DACCOUNT]; short nEpochType[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; float fEpochInitLevel[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; float fEpochFinalLevel[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; // Only used for ABF_EPOCHSLOPE. float fEpochLevelInc[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; ABFLONG lEpochInitDuration[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; ABFLONG lEpochDurationInc[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; short nEpochTableRepetitions[ABF2_DACCOUNT]; float fEpochTableStartToStartInterval[ABF2_DACCOUNT]; // GROUP #10 - DAC Output File float fDACFileScale[ABF2_DACCOUNT]; float fDACFileOffset[ABF2_DACCOUNT]; ABFLONG lDACFileEpisodeNum[ABF2_DACCOUNT]; short nDACFileADCNum[ABF2_DACCOUNT]; char sDACFilePath[ABF2_DACCOUNT][ABF2_PATHLEN]; // GROUP #11a - Presweep (conditioning) pulse train short nConditEnable[ABF2_DACCOUNT]; ABFLONG lConditNumPulses[ABF2_DACCOUNT]; float fBaselineDuration[ABF2_DACCOUNT]; float fBaselineLevel[ABF2_DACCOUNT]; float fStepDuration[ABF2_DACCOUNT]; float fStepLevel[ABF2_DACCOUNT]; float fPostTrainPeriod[ABF2_DACCOUNT]; float fPostTrainLevel[ABF2_DACCOUNT]; float fCTStartLevel[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; float fCTEndLevel[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; float fCTIntervalDuration[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; float fCTStartToStartInterval[ABF2_DACCOUNT]; // GROUP #11b - Membrane Test Between Sweeps short nMembTestEnable[ABF2_DACCOUNT]; float fMembTestPreSettlingTimeMS[ABF2_DACCOUNT]; float fMembTestPostSettlingTimeMS[ABF2_DACCOUNT]; // GROUP #11c - PreSignal test pulse short nPreSignalEnable[ABF2_DACCOUNT]; float fPreSignalPreStepDuration[ABF2_DACCOUNT]; float fPreSignalPreStepLevel[ABF2_DACCOUNT]; float fPreSignalStepDuration[ABF2_DACCOUNT]; float fPreSignalStepLevel[ABF2_DACCOUNT]; float fPreSignalPostStepDuration[ABF2_DACCOUNT]; float fPreSignalPostStepLevel[ABF2_DACCOUNT]; // GROUP #12 - Variable parameter user list short nULEnable[ABF2_USERLISTCOUNT]; short nULParamToVary[ABF2_USERLISTCOUNT]; short nULRepeat[ABF2_USERLISTCOUNT]; char sULParamValueList[ABF2_USERLISTCOUNT][ABF2_USERLISTLEN]; // GROUP #13 - Statistics measurements short nStatsEnable; unsigned short nStatsActiveChannels; // Active stats channel bit flag unsigned short nStatsSearchRegionFlags; // Active stats region bit flag short nStatsSmoothing; short nStatsSmoothingEnable; short nStatsBaseline; short nStatsBaselineDAC; // If mode is epoch, then this holds the DAC ABFLONG lStatsBaselineStart; ABFLONG lStatsBaselineEnd; ABFLONG lStatsMeasurements[ABF2_STATS_REGIONS]; // Measurement bit flag for each region ABFLONG lStatsStart[ABF2_STATS_REGIONS]; ABFLONG lStatsEnd[ABF2_STATS_REGIONS]; short nRiseBottomPercentile[ABF2_STATS_REGIONS]; short nRiseTopPercentile[ABF2_STATS_REGIONS]; short nDecayBottomPercentile[ABF2_STATS_REGIONS]; short nDecayTopPercentile[ABF2_STATS_REGIONS]; short nStatsChannelPolarity[ABF2_ADCCOUNT]; short nStatsSearchMode[ABF2_STATS_REGIONS]; // Stats mode per region: mode is cursor region, epoch etc short nStatsSearchDAC[ABF2_STATS_REGIONS]; // If mode is epoch, then this holds the DAC // GROUP #14 - Channel Arithmetic short nArithmeticEnable; short nArithmeticExpression; float fArithmeticUpperLimit; float fArithmeticLowerLimit; short nArithmeticADCNumA; short nArithmeticADCNumB; float fArithmeticK1; float fArithmeticK2; float fArithmeticK3; float fArithmeticK4; float fArithmeticK5; float fArithmeticK6; char sArithmeticOperator[ABF2_ARITHMETICOPLEN]; char sArithmeticUnits[ABF2_ARITHMETICUNITSLEN]; // GROUP #15 - Leak subtraction short nPNPosition; short nPNNumPulses; short nPNPolarity; float fPNSettlingTime; float fPNInterpulse; short nLeakSubtractType[ABF2_DACCOUNT]; float fPNHoldingLevel[ABF2_DACCOUNT]; short nLeakSubtractADCIndex[ABF2_DACCOUNT]; // GROUP #16 - Miscellaneous variables short nLevelHysteresis; ABFLONG lTimeHysteresis; short nAllowExternalTags; short nAverageAlgorithm; float fAverageWeighting; short nUndoPromptStrategy; short nTrialTriggerSource; short nStatisticsDisplayStrategy; short nExternalTagType; ABFLONG lHeaderSize; short nStatisticsClearStrategy; short nEnableFirstLastHolding; // First & Last Holding are now optional. // GROUP #17 - Trains parameters ABFLONG lEpochPulsePeriod[ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; ABFLONG lEpochPulseWidth [ABF2_DACCOUNT][ABF2_EPOCHCOUNT]; // GROUP #18 - Application version data short nCreatorMajorVersion; short nCreatorMinorVersion; short nCreatorBugfixVersion; short nCreatorBuildVersion; short nModifierMajorVersion; short nModifierMinorVersion; short nModifierBugfixVersion; short nModifierBuildVersion; // GROUP #19 - LTP protocol short nLTPType; short nLTPUsageOfDAC[ABF2_DACCOUNT]; short nLTPPresynapticPulses[ABF2_DACCOUNT]; // GROUP #20 - Digidata 132x Trigger out flag short nScopeTriggerOut; // GROUP #22 - Alternating episodic mode short nAlternateDACOutputState; short nAlternateDigitalOutputState; short nAlternateDigitalValue[ABF2_EPOCHCOUNT]; short nAlternateDigitalTrainValue[ABF2_EPOCHCOUNT]; // GROUP #23 - Post-processing actions float fPostProcessLowpassFilter[ABF2_ADCCOUNT]; char nPostProcessLowpassFilterType[ABF2_ADCCOUNT]; // GROUP #24 - Legacy gear shift info float fLegacyADCSequenceInterval; float fLegacyADCSecondSequenceInterval; ABFLONG lLegacyClockChange; ABFLONG lLegacyNumSamplesPerEpisode; ABF2FileHeader(); }; inline ABF2FileHeader::ABF2FileHeader() { // Set everything to 0. memset( this, 0, sizeof(ABF2FileHeader) ); // Set critical parameters so we can determine the version. fFileVersionNumber = ABF2_CURRENTVERSION; fHeaderVersionNumber = ABF2_CURRENTVERSION; lHeaderSize = sizeof(ABF2FileHeader); } // // Scope descriptor format. // #define ABF2_FACESIZE 32 struct ABFLogFont { short nHeight; // Height of the font in pixels. // short lWidth; // use 0 // short lEscapement; // use 0 // short lOrientation; // use 0 short nWeight; // MSWindows font weight value. // char bItalic; // use 0 // char bUnderline; // use 0 // char bStrikeOut; // use 0 // char cCharSet; // use ANSI_CHARSET (0) // char cOutPrecision; // use OUT_TT_PRECIS // char cClipPrecision; // use CLIP_DEFAULT_PRECIS // char cQuality; // use PROOF_QUALITY char cPitchAndFamily; // MSWindows pitch and family mask. char Unused[3]; // Unused space to maintain 4-byte packing. char szFaceName[ABF2_FACESIZE];// Face name of the font. }; // Size = 40 struct ABFSignal { char szName[ABF2_ADCNAMELEN+2]; // ABF name length + '\0' + 1 for alignment. short nMxOffset; // Offset of the signal in the sampling sequence. DWORD rgbColor; // Pen color used to draw trace. char nPenWidth; // Pen width in pixels. char bDrawPoints; // TRUE = Draw disconnected points char bHidden; // TRUE = Hide the trace. char bFloatData; // TRUE = Floating point pseudo channel float fVertProportion; // Relative proportion of client area to use float fDisplayGain; // Display gain of trace in UserUnits float fDisplayOffset; // Display offset of trace in UserUnits // float fUUTop; // Top of window in UserUnits // float fUUBottom; // Bottom of window in UserUnits }; // Size = 34 struct ABFScopeConfig { // Section 1 scope configurations DWORD dwFlags; // Flags that are meaningful to the scope. DWORD rgbColor[ABF2_SCOPECOLORS]; // Colors for the components of the scope. float fDisplayStart; // Start of the display area in ms. float fDisplayEnd; // End of the display area in ms. WORD wScopeMode; // Mode that the scope is in. char bMaximized; // TRUE = Scope parent is maximized. char bMinimized; // TRUE = Scope parent is minimized. short xLeft; // Coordinate of the left edge. short yTop; // Coordinate of the top edge. short xRight; // Coordinate of the right edge. short yBottom; // Coordinate of the bottom edge. ABFLogFont LogFont; // Description of current font. ABFSignal TraceList[ABF2_ADCCOUNT]; // List of traces in current use. short nYAxisWidth; // Width of the YAxis region. short nTraceCount; // Number of traces described in TraceList. short nEraseStrategy; // Erase strategy. short nDockState; // Docked position. // Size 656 // * Do not insert any new members above this point! * // Section 2 scope configurations for file version 1.68. short nSizeofOldStructure; // Unused byte to determine the offset of the version 2 data. DWORD rgbColorEx[ ABF2_SCOPECOLORS_EX ]; // New color settings for stored sweep and cursors. short nAutoZeroState; // Status of the autozero selection. DWORD dwCursorsVisibleState; // Flag for visible status of cursors. DWORD dwCursorsLockedState; // Flag for enabled status of cursors. char sUnasigned[61]; // Size 113 ABFScopeConfig(); }; // Size = 769 inline ABFScopeConfig::ABFScopeConfig() { // Set everything to 0. memset( this, 0, sizeof(ABFScopeConfig) ); // Set critical parameters so we can determine the version. nSizeofOldStructure = 656; } // // Definition of the ABF Tag structure // struct ABFTag { ABFLONG lTagTime; // Time at which the tag was entered in fSynchTimeUnit units. char sComment[ABF2_TAGCOMMENTLEN]; // Optional tag comment. short nTagType; // Type of tag ABF2_TIMETAG, ABF2_COMMENTTAG, ABF2_EXTERNALTAG, ABF2_VOICETAG, ABF2_NEWFILETAG or ABF2_ANNOTATIONTAG union { short nVoiceTagNumber; // If nTagType=ABF2_VOICETAG, this is the number of this voice tag. short nAnnotationIndex; // If nTagType=ABF2_ANNOTATIONTAG, this is the index of the corresponding annotation. }; }; // Size = 64 // // Definition of the ABFVoiceTagInfo structure. // struct ABFVoiceTagInfo { ABFLONG lTagNumber; // The tag number that corresponds to this VoiceTag ABFLONG lFileOffset; // Offset to this tag within the VoiceTag block ABFLONG lUncompressedSize; // Size of the voice tag expanded. ABFLONG lCompressedSize; // Compressed size of the tag. short nCompressionType; // Compression method used. short nSampleSize; // Size of the samples acquired. ABFLONG lSamplesPerSecond; // Rate at which the sound was acquired. DWORD dwCRC; // CRC used to check data integrity. WORD wChannels; // Number of channels in the tag (usually 1). WORD wUnused; // Unused space. }; // Size 32 // // Definition of the ABF Delta structure. // struct ABFDelta { ABFLONG lDeltaTime; // Time at which the parameter was changed in fSynchTimeUnit units. ABFLONG lParameterID; // Identifier for the parameter changed union { ABFLONG lNewParamValue; // Depending on the value of lParameterID float fNewParamValue; // this entry may be either a float or a long. }; }; // Size = 12 // // Definition of the ABF synch array structure // struct ABF2Synch { ABFLONG lStart; // Start of the episode/event in fSynchTimeUnit units. ABFLONG lLength; // Length of the episode/event in multiplexed samples. }; // Size = 8 #ifndef RC_INVOKED #pragma pack(pop) // return to default packing #endif // ============================================================================================ // Function prototypes for functions in ABFHEADR.C // ============================================================================================ void WINAPI ABF2H_Initialize( ABF2FileHeader *pFH ); #if 0 void WINAPI ABF2H_InitializeScopeConfig(const ABF2FileHeader *pFH, ABFScopeConfig *pCfg); BOOL WINAPI ABF2H_CheckScopeConfig(const ABF2FileHeader *pFH, ABFScopeConfig *pCfg); void WINAPI ABF2H_GetADCDisplayRange( const ABF2FileHeader *pFH, int nChannel, float *pfUUTop, float *pfUUBottom); #endif void WINAPI ABF2H_GetADCtoUUFactors( const ABF2FileHeader *pFH, int nChannel, float *pfADCToUUFactor, float *pfADCToUUShift ); #if 0 void WINAPI ABF2H_ClipADCUUValue(const ABF2FileHeader *pFH, int nChannel, float *pfUUValue); void WINAPI ABF2H_GetDACtoUUFactors( const ABF2FileHeader *pFH, int nChannel, float *pfDACToUUFactor, float *pfDACToUUShift ); void WINAPI ABF2H_ClipDACUUValue(const ABF2FileHeader *pFH, int nChannel, float *pfUUValue); #endif BOOL WINAPI ABF2H_GetMathValue(const ABF2FileHeader *pFH, float fA, float fB, float *pfRval); #if 0 int WINAPI ABF2H_GetMathChannelName(LPSTR psz, UINT uLen); BOOL WINAPI ABF2H_ParamReader( HANDLE hFile, ABF2FileHeader *pFH, int *pnError ); BOOL WINAPI ABF2H_ParamWriter( HANDLE hFile, ABF2FileHeader *pFH, int *pnError ); BOOL WINAPI ABF2H_GetErrorText( int nError, char *pszBuffer, UINT nBufferSize ); BOOL WINAPI ABF2H_GetCreatorInfo(const ABF2FileHeader *pFH, char *pszName, UINT uNameSize, char *pszVersion, UINT uVersionSize); BOOL WINAPI ABF2H_GetModifierInfo(const ABF2FileHeader *pFH, char *pszName, UINT uNameSize, char *pszVersion, UINT uVersionSize); // ABF 1 conversion functions - use with care. struct ABF2FileHeader1; BOOL WINAPI ABF2H_ConvertFromABF1( const ABF2FileHeader1 *pIn, ABF2FileHeader *pOut, int *pnError ); BOOL WINAPI ABF2H_ConvertABF2ToABF1Header( const ABF2FileHeader *pNewFH, ABF2FileHeader1 *pOldFH, int *pnError ); // ABFHWAVE.CPP // Constants for ABF2H_GetEpochLimits #define ABF2H_FIRSTHOLDING -1 #define ABF2H_LASTHOLDING ABF2_EPOCHCOUNT // Return the bounds of a given epoch in a given episode. Values returned are ZERO relative. BOOL WINAPI ABF2H_GetEpochLimits(const ABF2FileHeader *pFH, int nADCChannel, UINT uDACChannel, DWORD dwEpisode, int nEpoch, UINT *puEpochStart, UINT *puEpochEnd, int *pnError); #endif // Get the offset in the sampling sequence for the given physical channel. BOOL WINAPI ABF2H_GetChannelOffset( const ABF2FileHeader *pFH, int nChannel, UINT *puChannelOffset ); // Gets the first sample interval, expressed as a double. double WINAPI ABF2H_GetFirstSampleInterval( const ABF2FileHeader *pFH ); #if 0 // This function forms the de-multiplexed DAC output waveform for the // particular channel in the pfBuffer, in DAC UserUnits. BOOL WINAPI ABF2H_GetWaveform( const ABF2FileHeader *pFH, UINT uDACChannel, DWORD dwEpisode, float *pfBuffer, int *pnError); // This function forms the de-multiplexed Digital output waveform for the // particular channel in the pdwBuffer, as a bit mask. Digital OUT 0 is in bit 0. BOOL WINAPI ABF2H_GetDigitalWaveform( const ABF2FileHeader *pFH, int nChannel, DWORD dwEpisode, DWORD *pdwBuffer, int *pnError); // Calculates the timebase array for the file. void WINAPI ABF2H_GetTimebase(const ABF2FileHeader *pFH, double dTimeOffset, double *pdBuffer, UINT uBufferSize); // Constant for ABF2H_GetHoldingDuration #define ABF2H_HOLDINGFRACTION 64 // Get the duration of the first holding period. UINT WINAPI ABF2H_GetHoldingDuration(const ABF2FileHeader *pFH); // Checks whether the waveform varies from episode to episode. BOOL WINAPI ABF2H_IsConstantWaveform(const ABF2FileHeader *pFH, UINT uDACChannel); // Get the full sweep length given the length available to epochs or vice-versa. int WINAPI ABF2H_SweepLenFromUserLen(int nUserLength, int nNumChannels); int WINAPI ABF2H_UserLenFromSweepLen(int nSweepLength, int nNumChannels); // Converts a display range to the equivalent gain and offset factors. void WINAPI ABF2H_GainOffsetToDisplayRange( const ABF2FileHeader *pFH, int nChannel, float fDisplayGain, float fDisplayOffset, float *pfUUTop, float *pfUUBottom); // Converts a display range to the equivalent gain and offset factors. void WINAPI ABF2H_DisplayRangeToGainOffset( const ABF2FileHeader *pFH, int nChannel, float fUUTop, float fUUBottom, float *pfDisplayGain, float *pfDisplayOffset); // Converts a time value to a synch time count or vice-versa. void WINAPI ABF2H_SynchCountToMS(const ABF2FileHeader *pFH, UINT uCount, double *pdTimeMS); UINT WINAPI ABF2H_MSToSynchCount(const ABF2FileHeader *pFH, double dTimeMS); // Gets the duration of the Waveform Episode (in us), allowing for split clock etc. void WINAPI ABF2H_GetEpisodeDuration(const ABF2FileHeader *pFH, double *pdEpisodeDuration); // Returns TRUE is P/N is enabled on any output channel. BOOL WINAPI ABF2H_IsPNEnabled(const ABF2FileHeader *pFH, UINT uDAC=ABF2_ANY_CHANNEL); // Gets the duration of a P/N sequence (in us), including settling times. void WINAPI ABF2H_GetPNDuration(const ABF2FileHeader *pFH, double *pdPNDuration); // Gets the duration of a pre-sweep train in us. void WINAPI ABF2H_GetTrainDuration (const ABF2FileHeader *pFH, UINT uDAC, double *pdTrainDuration); // Gets the duration of a post-train portion of the pre-sweep train in us. void WINAPI ABF2H_GetPostTrainDuration (const ABF2FileHeader *pFH, UINT uDAC, UINT uEpisode, double *pdDuration); // Gets the level of a post-train portion of the pre-sweep train. void WINAPI ABF2H_GetPostTrainLevel (const ABF2FileHeader *pFH, UINT uDAC, UINT uEpisode, double *pdLevel); // Gets the duration of a whole meta-episode (in us). void WINAPI ABF2H_GetMetaEpisodeDuration(const ABF2FileHeader *pFH, double *pdMetaEpisodeDuration); // Gets the start to start period for the episode in us. void WINAPI ABF2H_GetEpisodeStartToStart(const ABF2FileHeader *pFH, double *pdEpisodeStartToStart); // Checks that the user list contains valid entries for the protocol. BOOL WINAPI ABF2H_CheckUserList(const ABF2FileHeader *pFH, UINT uListNum, int *pnError); // Counts the number of changing sweeps. UINT WINAPI ABF2H_GetNumberOfChangingSweeps( const ABF2FileHeader *pFH ); // // Checks whether the digital output varies from episode to episode. BOOL WINAPI ABF2H_IsConstantDigitalOutput(const ABF2FileHeader *pFH, UINT uDACChannel); int WINAPI ABF2H_GetEpochDuration(const ABF2FileHeader *pFH, UINT uDACChannel, UINT uEpisode, int nEpoch); float WINAPI ABF2H_GetEpochLevel(const ABF2FileHeader *pFH, UINT uDACChannel, UINT uEpisode, int nEpoch); BOOL WINAPI ABF2H_GetEpochLevelRange(const ABF2FileHeader *pFH, UINT uDACChannel, int nEpoch, float *pfMin, float *pfMax); UINT WINAPI ABF2H_GetMaxPNSubsweeps(const ABF2FileHeader *pFH, UINT uDACChannel); #endif // // Error return values that may be returned by the ABF2H_xxx functions. // #define ABF2H_FIRSTERRORNUMBER 2001 #define ABF2H_EHEADERREAD 2001 #define ABF2H_EHEADERWRITE 2002 #define ABF2H_EINVALIDFILE 2003 #define ABF2H_EUNKNOWNFILETYPE 2004 #define ABF2H_CHANNELNOTSAMPLED 2005 #define ABF2H_EPOCHNOTPRESENT 2006 #define ABF2H_ENOWAVEFORM 2007 #define ABF2H_EDACFILEWAVEFORM 2008 #define ABF2H_ENOMEMORY 2009 #define ABF2H_BADSAMPLEINTERVAL 2010 #define ABF2H_BADSECONDSAMPLEINTERVAL 2011 #define ABF2H_BADSAMPLEINTERVALS 2012 #define ABF2H_ENOCONDITTRAINS 2013 #define ABF2H_EMETADURATION 2014 #define ABF2H_ECONDITNUMPULSES 2015 #define ABF2H_ECONDITBASEDUR 2016 #define ABF2H_ECONDITBASELEVEL 2017 #define ABF2H_ECONDITPOSTTRAINDUR 2018 #define ABF2H_ECONDITPOSTTRAINLEVEL 2019 #define ABF2H_ESTART2START 2020 #define ABF2H_EINACTIVEHOLDING 2021 #define ABF2H_EINVALIDCHARS 2022 #define ABF2H_ENODIG 2023 #define ABF2H_EDIGHOLDLEVEL 2024 #define ABF2H_ENOPNPULSES 2025 #define ABF2H_EPNNUMPULSES 2026 #define ABF2H_ENOEPOCH 2027 #define ABF2H_EEPOCHLEN 2028 #define ABF2H_EEPOCHINITLEVEL 2029 #define ABF2H_EDIGLEVEL 2030 #define ABF2H_ECONDITSTEPDUR 2031 #define ABF2H_ECONDITSTEPLEVEL 2032 #define ABF2H_EINVALIDBINARYCHARS 2033 #define ABF2H_EBADWAVEFORM 2034 #ifdef __cplusplus } #endif #endif /* INC_ABFHEADR2_H */ stimfit-0.16.0/src/libstfio/abf/axon2/ProtocolStructs.h0000664000175000017500000002767313277303516017751 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-2005 Molecular Devices. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // // MODULE: ProtocolStructs.HPP // ABF structs: used to describe the actual file contents. // // Added 64bit support according to Jakub Nowacki's implementation in libaxon: // http://libaxon.sourceforge.net #ifndef INC_PROTOCOLSTRUCTS_HPP #define INC_PROTOCOLSTRUCTS_HPP #include "../axon/Common/axodebug.h" #include "../axon/AxAbfFio32/AxAbffio32.h" #include #pragma once #pragma pack(push, 1) // GUID is normally defined in the Windows Platform SDK #ifndef GUID_DEFINED #define GUID_DEFINED typedef struct _GUID { akxjsbasd unsigned ABFLONG Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #endif /* GUID_DEFINED */ // All these structs are persisted to file -> their sizes must NOT be changed without careful // attention to versioning issues in order to maintain compatibility. struct ABF_Section { UINT uBlockIndex; // ABF block number of the first entry UINT uBytes; // size in bytes of of each entry long long llNumEntries; // number of entries in this section ABF_Section(); ABFLONG GetNumEntries(); void Set( const UINT p_uBlockIndex, const UINT p_uBytes, const long long p_llNumEntries ); }; #define MEMSET_CTOR inline ABF_Section::ABF_Section() { MEMSET_CTOR; } inline void ABF_Section::Set( const UINT p_uBlockIndex, const UINT p_uBytes, const long long p_llNumEntries ) { uBytes = 0; llNumEntries = 0; uBlockIndex = p_uBlockIndex; if( uBlockIndex ) { uBytes = p_uBytes; llNumEntries = p_llNumEntries; } } inline ABFLONG ABF_Section::GetNumEntries() { // If this assert goes off, then files longer than 2 gigasamples need to be handled. if( llNumEntries > LONG_MAX ) { std::cerr << "File contains" << (int)(llNumEntries / 1000000L) << "megasamples which exceeds current limit (" << (int)(LONG_MAX / 1000000L) << ")."; } return ABFLONG(llNumEntries); } #define ABF2_FILESIGNATURE 0x32464241 // PC="ABF2", MAC="2FBA" struct ABF2_FileInfo { UINT uFileSignature; UINT uFileVersionNumber; // After this point there is no need to be the same as the ABF 1 equivalent. UINT uFileInfoSize; UINT uActualEpisodes; UINT uFileStartDate; UINT uFileStartTimeMS; UINT uStopwatchTime; short nFileType; short nDataFormat; short nSimultaneousScan; short nCRCEnable; UINT uFileCRC; GUID FileGUID; UINT uCreatorVersion; UINT uCreatorNameIndex; UINT uModifierVersion; UINT uModifierNameIndex; UINT uProtocolPathIndex; // New sections in ABF 2 - protocol stuff ... ABF_Section ProtocolSection; // the protocol ABF_Section ADCSection; // one for each ADC channel ABF_Section DACSection; // one for each DAC channel ABF_Section EpochSection; // one for each epoch ABF_Section ADCPerDACSection; // one for each ADC for each DAC ABF_Section EpochPerDACSection; // one for each epoch for each DAC ABF_Section UserListSection; // one for each user list ABF_Section StatsRegionSection; // one for each stats region ABF_Section MathSection; ABF_Section StringsSection; // ABF 1 sections ... ABF_Section DataSection; // Data ABF_Section TagSection; // Tags ABF_Section ScopeSection; // Scope config ABF_Section DeltaSection; // Deltas ABF_Section VoiceTagSection; // Voice Tags ABF_Section SynchArraySection; // Synch Array ABF_Section AnnotationSection; // Annotations ABF_Section StatsSection; // Stats config char sUnused[148]; // size = 512 bytes ABF2_FileInfo() { MEMSET_CTOR; ASSERT( sizeof( ABF2_FileInfo ) == 512 ); uFileSignature = ABF2_FILESIGNATURE; uFileInfoSize = sizeof( ABF2_FileInfo); } }; struct ABF_ProtocolInfo { short nOperationMode; float fADCSequenceInterval; bool bEnableFileCompression; char sUnused1[3]; UINT uFileCompressionRatio; float fSynchTimeUnit; float fSecondsPerRun; ABFLONG lNumSamplesPerEpisode; ABFLONG lPreTriggerSamples; ABFLONG lEpisodesPerRun; ABFLONG lRunsPerTrial; ABFLONG lNumberOfTrials; short nAveragingMode; short nUndoRunCount; short nFirstEpisodeInRun; float fTriggerThreshold; short nTriggerSource; short nTriggerAction; short nTriggerPolarity; float fScopeOutputInterval; float fEpisodeStartToStart; float fRunStartToStart; ABFLONG lAverageCount; float fTrialStartToStart; short nAutoTriggerStrategy; float fFirstRunDelayS; short nChannelStatsStrategy; ABFLONG lSamplesPerTrace; ABFLONG lStartDisplayNum; ABFLONG lFinishDisplayNum; short nShowPNRawData; float fStatisticsPeriod; ABFLONG lStatisticsMeasurements; short nStatisticsSaveStrategy; float fADCRange; float fDACRange; ABFLONG lADCResolution; ABFLONG lDACResolution; short nExperimentType; short nManualInfoStrategy; short nCommentsEnable; ABFLONG lFileCommentIndex; short nAutoAnalyseEnable; short nSignalType; short nDigitalEnable; short nActiveDACChannel; short nDigitalHolding; short nDigitalInterEpisode; short nDigitalDACChannel; short nDigitalTrainActiveLogic; short nStatsEnable; short nStatisticsClearStrategy; short nLevelHysteresis; ABFLONG lTimeHysteresis; short nAllowExternalTags; short nAverageAlgorithm; float fAverageWeighting; short nUndoPromptStrategy; short nTrialTriggerSource; short nStatisticsDisplayStrategy; short nExternalTagType; short nScopeTriggerOut; short nLTPType; short nAlternateDACOutputState; short nAlternateDigitalOutputState; float fCellID[3]; short nDigitizerADCs; short nDigitizerDACs; short nDigitizerTotalDigitalOuts; short nDigitizerSynchDigitalOuts; short nDigitizerType; char sUnused[304]; // size = 512 bytes ABF_ProtocolInfo() { MEMSET_CTOR; ASSERT( sizeof( ABF_ProtocolInfo ) == 512 ); } }; struct ABF_MathInfo { short nMathEnable; short nMathExpression; UINT uMathOperatorIndex; UINT uMathUnitsIndex; float fMathUpperLimit; float fMathLowerLimit; short nMathADCNum[2]; char sUnused[16]; float fMathK[6]; char sUnused2[64]; // size = 128 bytes ABF_MathInfo() { MEMSET_CTOR; ASSERT( sizeof( ABF_MathInfo ) == 128 ); } }; struct ABF_ADCInfo { // The ADC this struct is describing. short nADCNum; short nTelegraphEnable; short nTelegraphInstrument; float fTelegraphAdditGain; float fTelegraphFilter; float fTelegraphMembraneCap; short nTelegraphMode; float fTelegraphAccessResistance; short nADCPtoLChannelMap; short nADCSamplingSeq; float fADCProgrammableGain; float fADCDisplayAmplification; float fADCDisplayOffset; float fInstrumentScaleFactor; float fInstrumentOffset; float fSignalGain; float fSignalOffset; float fSignalLowpassFilter; float fSignalHighpassFilter; char nLowpassFilterType; char nHighpassFilterType; float fPostProcessLowpassFilter; char nPostProcessLowpassFilterType; bool bEnabledDuringPN; short nStatsChannelPolarity; ABFLONG lADCChannelNameIndex; ABFLONG lADCUnitsIndex; char sUnused[46]; // size = 128 bytes ABF_ADCInfo() { MEMSET_CTOR; ASSERT( sizeof( ABF_ADCInfo ) == 128 ); } }; struct ABF_DACInfo { // The DAC this struct is describing. short nDACNum; short nTelegraphDACScaleFactorEnable; float fInstrumentHoldingLevel; float fDACScaleFactor; float fDACHoldingLevel; float fDACCalibrationFactor; float fDACCalibrationOffset; ABFLONG lDACChannelNameIndex; ABFLONG lDACChannelUnitsIndex; ABFLONG lDACFilePtr; ABFLONG lDACFileNumEpisodes; short nWaveformEnable; short nWaveformSource; short nInterEpisodeLevel; float fDACFileScale; float fDACFileOffset; ABFLONG lDACFileEpisodeNum; short nDACFileADCNum; short nConditEnable; ABFLONG lConditNumPulses; float fBaselineDuration; float fBaselineLevel; float fStepDuration; float fStepLevel; float fPostTrainPeriod; float fPostTrainLevel; short nMembTestEnable; short nLeakSubtractType; short nPNPolarity; float fPNHoldingLevel; short nPNNumADCChannels; short nPNPosition; short nPNNumPulses; float fPNSettlingTime; float fPNInterpulse; short nLTPUsageOfDAC; short nLTPPresynapticPulses; ABFLONG lDACFilePathIndex; float fMembTestPreSettlingTimeMS; float fMembTestPostSettlingTimeMS; short nLeakSubtractADCIndex; char sUnused[124]; // size = 256 bytes ABF_DACInfo() { MEMSET_CTOR; ASSERT( sizeof( ABF_DACInfo ) == 256 ); } }; struct ABF_EpochInfoPerDAC { // The Epoch / DAC this struct is describing. short nEpochNum; short nDACNum; // One full set of epochs (ABF_EPOCHCOUNT) for each DAC channel ... short nEpochType; float fEpochInitLevel; float fEpochLevelInc; ABFLONG lEpochInitDuration; ABFLONG lEpochDurationInc; ABFLONG lEpochPulsePeriod; ABFLONG lEpochPulseWidth; char sUnused[18]; // size = 48 bytes ABF_EpochInfoPerDAC() { MEMSET_CTOR; ASSERT( sizeof( ABF_EpochInfoPerDAC ) == 48 ); } }; struct ABF_EpochInfo { // The Epoch this struct is describing. short nEpochNum; // Describes one epoch short nDigitalValue; short nDigitalTrainValue; short nAlternateDigitalValue; short nAlternateDigitalTrainValue; bool bEpochCompression; // Compress the data from this epoch using uFileCompressionRatio char sUnused[21]; // size = 32 bytes ABF_EpochInfo() { MEMSET_CTOR; ASSERT( sizeof( ABF_EpochInfo ) == 32 ); } }; struct ABF_StatsRegionInfo { // The stats region this struct is describing. short nRegionNum; short nADCNum; short nStatsActiveChannels; short nStatsSearchRegionFlags; short nStatsSelectedRegion; short nStatsSmoothing; short nStatsSmoothingEnable; short nStatsBaseline; ABFLONG lStatsBaselineStart; ABFLONG lStatsBaselineEnd; // Describes one stats region ABFLONG lStatsMeasurements; ABFLONG lStatsStart; ABFLONG lStatsEnd; short nRiseBottomPercentile; short nRiseTopPercentile; short nDecayBottomPercentile; short nDecayTopPercentile; short nStatsSearchMode; short nStatsSearchDAC; short nStatsBaselineDAC; char sUnused[78]; // size = 128 bytes ABF_StatsRegionInfo() { MEMSET_CTOR; ASSERT( sizeof( ABF_StatsRegionInfo ) == 128 ); } }; struct ABF_UserListInfo { // The user list this struct is describing. short nListNum; // Describes one user list short nULEnable; short nULParamToVary; short nULRepeat; ABFLONG lULParamValueListIndex; char sUnused[52]; // size = 64 bytes ABF_UserListInfo() { MEMSET_CTOR; ASSERT( sizeof( ABF_UserListInfo ) == 64 ); } }; #pragma pack(pop) // return to default packing #endif // INC_PROTOCOLSTRUCTS_HPP stimfit-0.16.0/src/libstfio/abf/axon2/ProtocolReaderABF2.cpp0000664000175000017500000010543013277303516020416 00000000000000//*********************************************************************************************** // // Copyright (c) 2005 Molecular Devices. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // // MODULE: ProtocolReader.CPP // PURPOSE: ReadsABF 2 protocols from an ABF file. // #include "../axon/Common/wincpp.hpp" #include "../axon/Common/axodefn.h" #include "ProtocolReaderABF2.hpp" #include "../axon/AxAbfFio32/abfutil.h" #include "../axon/AxAbfFio32/abffiles.h" #include #if !defined(_WINDOWS) || defined(__MINGW32__) || defined(__STF__) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif extern BOOL GetNewFileDescriptor(CFileDescriptor **ppFI, int *pnFile, int *pnError); extern BOOL GetFileDescriptor(CFileDescriptor **ppFI, int nFile, int *pnError); extern void ReleaseFileDescriptor(int nFile); static BOOL ErrorReturn(int *pnError, int nErrorNum) { if (pnError) *pnError = nErrorNum; return FALSE; } //=============================================================================================== //=============================================================================================== // FUNCTION: FlattenGearShift // PURPOSE: Converts a header with gear shift enabled to the equivalent with the gear shift flattened. // static BOOL FlattenGearShift(ABF2FileHeader *pFH) { ASSERT( pFH ); if( pFH->nOperationMode != ABF_WAVEFORMFILE ) return FALSE; if( pFH->uFileCompressionRatio == 1 ) return FALSE; return TRUE; } #if 0 //=============================================================================================== // FUNCTION: RemoveExtraChannels // PURPOSE: Removes "extra" channels when P/N is enabled and files are opened as protocols. // NOTES: This function allows Clampex 10 data files (with P/N enabled) to be opened as a protocol. // These files have an extra channel that stores the raw data (in addition to the corrected data). // Therefore there is some tweaking and scaling of header parameters. // static BOOL RemoveExtraChannels( ABF2FileHeader *pFH, UINT uFlags ) { WPTRASSERT( pFH ); // Must be episodic stimulation mode. if( pFH->nOperationMode != ABF_WAVEFORMFILE ) return FALSE; // P/N must be enabled. if( !ABF2H_IsPNEnabled( pFH ) ) return FALSE; // This fix only applies to files with one ADC channel and one P/N channel. if( pFH->nADCNumChannels != 2 ) return FALSE; // Must be a data file (i.e. not a protocol). if( pFH->lActualAcqLength == 0 ) return FALSE; bool bFudge = false; if( uFlags & ABF_PARAMFILE ) bFudge = true; else { ABFLONG lActualSamplesPerEpisode = pFH->lActualAcqLength / pFH->lActualEpisodes; if( lActualSamplesPerEpisode != pFH->lNumSamplesPerEpisode ) bFudge = true; } if( !bFudge ) return FALSE; int nIndex = ABF_UNUSED_CHANNEL; for( UINT i=0; inADCSamplingSeq[i] == ABF_UNUSED_CHANNEL ) { nIndex = i - 1; // i.e. the previous channel is the last valid channel. break; } } if( nIndex == ABF_UNUSED_CHANNEL ) return FALSE; // There are extra channels to be stripped. short nOldChans = pFH->nADCNumChannels; short nNewChans = nOldChans - 1; pFH->nADCNumChannels = nNewChans; pFH->lNumSamplesPerEpisode = MulDiv( pFH->lNumSamplesPerEpisode, nNewChans, nOldChans ); // Adjust the statistics search regions. pFH->lStatsBaselineStart = MulDiv( pFH->lStatsBaselineStart, nNewChans, nOldChans ); pFH->lStatsBaselineEnd = MulDiv( pFH->lStatsBaselineEnd, nNewChans, nOldChans ); for( UINT i=0; ilStatsStart[i] = MulDiv( pFH->lStatsStart[i], nNewChans, nOldChans ); pFH->lStatsEnd[i] = MulDiv( pFH->lStatsEnd[i], nNewChans, nOldChans ); } return TRUE; } #endif //=============================================================================================== // CABF2ProtocolReader implementation // // NOTE: Any changes made here will require complementary changes to ProtocolWriter.cpp //=============================================================================================== // Constructor. // CABF2ProtocolReader::CABF2ProtocolReader( ) : m_pFI( NULL ) { m_pFH.reset( new ABF2FileHeader ); ABF2H_Initialize( m_pFH.get() ); MEMBERASSERT(); } //=============================================================================================== // Destructor. // CABF2ProtocolReader::~CABF2ProtocolReader() { if (m_pFI != NULL ) { Close(); } MEMBERASSERT(); } //=============================================================================================== // FUNCTION: Read // PURPOSE: Reads the complete protocol from the data file. // BOOL CABF2ProtocolReader::Read( int* pnError ) { MEMBERASSERT(); if (m_pFI == NULL) return FALSE; BOOL bOK = TRUE; bOK &= m_pFI->Seek( 0L, FILE_BEGIN); if( !bOK ) return FALSE; bOK &= m_pFI->Read( &m_FileInfo, sizeof( m_FileInfo ) ); if( m_FileInfo.StringsSection.uBlockIndex ) { // Read the protocol strings into the cache. UINT uSeekPos = m_FileInfo.StringsSection.uBlockIndex * ABF_BLOCKSIZE; if( !m_Strings.Read( m_pFI->GetFileHandle(), uSeekPos ) ) return FALSE; //SetLastError( ABF_ENOSTRINGS ); } bOK &= ReadFileInfo(); bOK &= ReadProtocolInfo(); bOK &= ReadADCInfo(); bOK &= ReadDACInfo(); bOK &= ReadEpochs(); bOK &= ReadStats(); bOK &= ReadUserList(); bOK &= ReadMathInfo(); // modified from ABF_ReadOpen int nError = 0; // Check that the data file actually contains data. if ((m_pFH->lActualAcqLength <= 0) || (m_pFH->nADCNumChannels <= 0)) { nError = ABF_EBADPARAMETERS; Close(); nFile = (int)ABF_INVALID_HANDLE; ERRORRETURN(pnError, nError); } // Set header variable for the number of episodes in the file. if( m_pFH->nOperationMode == ABF2_GAPFREEFILE ) { double fdiv = (double)m_pFH->lActualAcqLength / m_pFH->lNumSamplesPerEpisode; DWORD dwMaxEpi = ceil(fdiv); #ifdef _STFDEBUG std::cout << "Total number of samples " << m_pFH->lActualAcqLength << std::endl; #endif m_pFH->lActualEpisodes = dwMaxEpi; } m_pFI->SetAcquiredEpisodes(m_pFH->lActualEpisodes); m_pFI->SetAcquiredSamples(m_pFH->lActualAcqLength); // CSH RemoveExtraChannels( m_pFH, fFlags ); FlattenGearShift( m_pFH.get() ); return bOK; } //=============================================================================================== // FUNCTION: GetString // PURPOSE: Read a single ProtocolString into the buffer. // BOOL CABF2ProtocolReader::GetString( UINT uIndex, LPSTR pszText, UINT uBufSize ) { MEMBERASSERT(); // LPSZASSERT( pszText ); WARRAYASSERT( pszText, uBufSize ); ABFU_SetABFString( pszText, "", uBufSize ); // Just return an empty string if the index is invalid. if( uIndex == 0 ) return TRUE; // or if we do not have the requested string available. if( uIndex > m_Strings.GetNumStrings() ) return TRUE; LPCSTR pszString = m_Strings.Get( uIndex - 1 ); if( pszString ) { UINT uLen = strlen( pszString ); if( uLen > uBufSize ) return FALSE; ABFU_SetABFString( pszText, pszString, uLen ); return TRUE; } return FALSE; } #define MAJOR( n ) HIBYTE( HIWORD( (n) ) ) #define MINOR( n ) LOBYTE( HIWORD( (n) ) ) #define BUGFIX( n ) HIBYTE( LOWORD( (n) ) ) #define BUILD( n ) LOBYTE( LOWORD( (n) ) ) //=============================================================================================== // FUNCTION: ReadFileInfo // PURPOSE: Reads the file info from the data file. // BOOL CABF2ProtocolReader::ReadFileInfo() { MEMBERASSERT(); BOOL bOK = TRUE; short nMajor = MAJOR( m_FileInfo.uFileVersionNumber ); short nMinor = MINOR( m_FileInfo.uFileVersionNumber ); m_pFH->fFileVersionNumber = nMajor + nMinor/100.0F; m_pFH->fHeaderVersionNumber = ABF_CURRENTVERSION; m_pFH->nFileType = m_FileInfo.nFileType; m_pFH->nDataFormat = m_FileInfo.nDataFormat; m_pFH->nSimultaneousScan = m_FileInfo.nSimultaneousScan; m_pFH->FileGUID = m_FileInfo.FileGUID; m_pFH->ulFileCRC = m_FileInfo.uFileCRC; m_pFH->nCRCEnable = m_FileInfo.nCRCEnable; m_pFH->nCreatorMajorVersion = MAJOR ( m_FileInfo.uCreatorVersion ); m_pFH->nCreatorMinorVersion = MINOR ( m_FileInfo.uCreatorVersion ); m_pFH->nCreatorBugfixVersion = BUGFIX( m_FileInfo.uCreatorVersion ); m_pFH->nCreatorBuildVersion = BUILD ( m_FileInfo.uCreatorVersion ); bOK &= GetString( m_FileInfo.uCreatorNameIndex, m_pFH->sCreatorInfo, ELEMENTS_IN( m_pFH->sCreatorInfo ) ); m_pFH->nModifierMajorVersion = MAJOR ( m_FileInfo.uModifierVersion ); m_pFH->nModifierMinorVersion = MINOR ( m_FileInfo.uModifierVersion ); m_pFH->nModifierBugfixVersion = BUGFIX( m_FileInfo.uModifierVersion ); m_pFH->nModifierBuildVersion = BUILD ( m_FileInfo.uModifierVersion ); bOK &= GetString( m_FileInfo.uModifierNameIndex, m_pFH->sModifierInfo, ELEMENTS_IN( m_pFH->sModifierInfo ) ); m_pFH->nNumPointsIgnored = 0; m_pFH->uFileStartDate = m_FileInfo.uFileStartDate; m_pFH->uFileStartTimeMS = m_FileInfo.uFileStartTimeMS; m_pFH->lStopwatchTime = m_FileInfo.uStopwatchTime; m_pFH->lActualEpisodes = m_FileInfo.uActualEpisodes; m_pFH->lActualAcqLength = m_FileInfo.DataSection.GetNumEntries(); m_pFH->lDataSectionPtr = m_FileInfo.DataSection.uBlockIndex; m_pFH->lScopeConfigPtr = m_FileInfo.ScopeSection.uBlockIndex; m_pFH->lNumScopes = m_FileInfo.ScopeSection.GetNumEntries(); m_pFH->lStatisticsConfigPtr = m_FileInfo.StatsSection.uBlockIndex; m_pFH->lTagSectionPtr = m_FileInfo.TagSection.uBlockIndex; m_pFH->lNumTagEntries = m_FileInfo.TagSection.GetNumEntries(); m_pFH->lDeltaArrayPtr = m_FileInfo.DeltaSection.uBlockIndex; m_pFH->lNumDeltas = m_FileInfo.DeltaSection.GetNumEntries(); m_pFH->lVoiceTagPtr = m_FileInfo.VoiceTagSection.uBlockIndex; m_pFH->lVoiceTagEntries = m_FileInfo.VoiceTagSection.GetNumEntries(); m_pFH->lSynchArrayPtr = m_FileInfo.SynchArraySection.uBlockIndex; m_pFH->lSynchArraySize = m_FileInfo.SynchArraySection.GetNumEntries(); m_pFH->lAnnotationSectionPtr = m_FileInfo.AnnotationSection.uBlockIndex; m_pFH->lNumAnnotations = m_FileInfo.AnnotationSection.GetNumEntries(); bOK &= GetString( m_FileInfo.uProtocolPathIndex, m_pFH->sProtocolPath, ELEMENTS_IN( m_pFH->sProtocolPath ) ); return bOK; } //=============================================================================================== // FUNCTION: ReadProtocolInfo // PURPOSE: Reads the protocol info from the data file. // BOOL CABF2ProtocolReader::ReadProtocolInfo() { MEMBERASSERT(); BOOL bOK = TRUE; ABF_ProtocolInfo Protocol; bOK &= m_pFI->Seek( LONGLONG(m_FileInfo.ProtocolSection.uBlockIndex) * ABF_BLOCKSIZE, FILE_BEGIN ); if( !bOK ) return FALSE; bOK &= m_pFI->Read( &Protocol, sizeof( Protocol ) ); ASSERT( bOK ); m_pFH->nADCNumChannels = short( m_FileInfo.ADCSection.llNumEntries ); m_pFH->nOperationMode = Protocol.nOperationMode; m_pFH->fADCSequenceInterval = Protocol.fADCSequenceInterval; m_pFH->uFileCompressionRatio = max( Protocol.uFileCompressionRatio, 1 ); m_pFH->bEnableFileCompression = Protocol.bEnableFileCompression; m_pFH->fSynchTimeUnit = Protocol.fSynchTimeUnit; m_pFH->fSecondsPerRun = Protocol.fSecondsPerRun; m_pFH->lNumSamplesPerEpisode = Protocol.lNumSamplesPerEpisode; m_pFH->lPreTriggerSamples = Protocol.lPreTriggerSamples; m_pFH->lEpisodesPerRun = Protocol.lEpisodesPerRun; m_pFH->lRunsPerTrial = Protocol.lRunsPerTrial; m_pFH->lNumberOfTrials = Protocol.lNumberOfTrials; m_pFH->nAveragingMode = Protocol.nAveragingMode; m_pFH->nUndoRunCount = Protocol.nUndoRunCount; m_pFH->nFirstEpisodeInRun = Protocol.nFirstEpisodeInRun; m_pFH->fTriggerThreshold = Protocol.fTriggerThreshold; m_pFH->nTriggerSource = Protocol.nTriggerSource; m_pFH->nTriggerAction = Protocol.nTriggerAction; m_pFH->nTriggerPolarity = Protocol.nTriggerPolarity; m_pFH->fScopeOutputInterval = Protocol.fScopeOutputInterval; m_pFH->fEpisodeStartToStart = Protocol.fEpisodeStartToStart; m_pFH->fRunStartToStart = Protocol.fRunStartToStart; m_pFH->lAverageCount = Protocol.lAverageCount; m_pFH->fTrialStartToStart = Protocol.fTrialStartToStart; m_pFH->nAutoTriggerStrategy = Protocol.nAutoTriggerStrategy; m_pFH->fFirstRunDelayS = Protocol.fFirstRunDelayS; m_pFH->nChannelStatsStrategy = Protocol.nChannelStatsStrategy; m_pFH->lSamplesPerTrace = Protocol.lSamplesPerTrace; m_pFH->lStartDisplayNum = Protocol.lStartDisplayNum; m_pFH->lFinishDisplayNum = Protocol.lFinishDisplayNum; m_pFH->nShowPNRawData = Protocol.nShowPNRawData; m_pFH->fStatisticsPeriod = Protocol.fStatisticsPeriod; m_pFH->lStatisticsMeasurements = Protocol.lStatisticsMeasurements; m_pFH->nStatisticsSaveStrategy = Protocol.nStatisticsSaveStrategy; m_pFH->fADCRange = Protocol.fADCRange; m_pFH->fDACRange = Protocol.fDACRange; m_pFH->lADCResolution = Protocol.lADCResolution; m_pFH->lDACResolution = Protocol.lDACResolution; m_pFH->nDigitizerADCs = Protocol.nDigitizerADCs; m_pFH->nDigitizerDACs = Protocol.nDigitizerDACs; m_pFH->nDigitizerTotalDigitalOuts = Protocol.nDigitizerTotalDigitalOuts; m_pFH->nDigitizerSynchDigitalOuts = Protocol.nDigitizerSynchDigitalOuts; m_pFH->nDigitizerType = Protocol.nDigitizerType; m_pFH->nExperimentType = Protocol.nExperimentType; m_pFH->nManualInfoStrategy = Protocol.nManualInfoStrategy; m_pFH->fCellID1 = Protocol.fCellID[0]; m_pFH->fCellID2 = Protocol.fCellID[1]; m_pFH->fCellID3 = Protocol.fCellID[2]; m_pFH->nCommentsEnable = Protocol.nCommentsEnable; m_pFH->nAutoAnalyseEnable = Protocol.nAutoAnalyseEnable; m_pFH->nSignalType = Protocol.nSignalType; m_pFH->nDigitalEnable = Protocol.nDigitalEnable; m_pFH->nActiveDACChannel = Protocol.nActiveDACChannel; m_pFH->nDigitalHolding = Protocol.nDigitalHolding; m_pFH->nDigitalInterEpisode = Protocol.nDigitalInterEpisode; m_pFH->nDigitalDACChannel = Protocol.nDigitalDACChannel; m_pFH->nDigitalTrainActiveLogic = Protocol.nDigitalTrainActiveLogic; m_pFH->nStatsEnable = Protocol.nStatsEnable; m_pFH->nLevelHysteresis = Protocol.nLevelHysteresis; m_pFH->lTimeHysteresis = Protocol.lTimeHysteresis; m_pFH->nAllowExternalTags = Protocol.nAllowExternalTags; m_pFH->nAverageAlgorithm = Protocol.nAverageAlgorithm; m_pFH->fAverageWeighting = Protocol.fAverageWeighting; m_pFH->nUndoPromptStrategy = Protocol.nUndoPromptStrategy; m_pFH->nTrialTriggerSource = Protocol.nTrialTriggerSource; m_pFH->nStatisticsDisplayStrategy = Protocol.nStatisticsDisplayStrategy; m_pFH->nExternalTagType = Protocol.nExternalTagType; m_pFH->nStatisticsClearStrategy = Protocol.nStatisticsClearStrategy; m_pFH->nLTPType = Protocol.nLTPType; m_pFH->nScopeTriggerOut = Protocol.nScopeTriggerOut; m_pFH->nAlternateDACOutputState = Protocol.nAlternateDACOutputState; m_pFH->nAlternateDigitalOutputState = Protocol.nAlternateDigitalOutputState; bOK &= GetString( Protocol.lFileCommentIndex, m_pFH->sFileComment, ELEMENTS_IN( m_pFH->sFileComment ) ); return bOK; } //=============================================================================================== // FUNCTION: ReadADCInfo // PURPOSE: Reads the ADC info from the data file. // BOOL CABF2ProtocolReader::ReadADCInfo() { MEMBERASSERT(); short ch = 0; BOOL bOK = TRUE; ABF_ADCInfo ADCInfo; ASSERT( m_FileInfo.ADCSection.llNumEntries ); ASSERT( m_FileInfo.ADCSection.uBytes == sizeof( ADCInfo ) ); bOK &= m_pFI->Seek( LONGLONG(m_FileInfo.ADCSection.uBlockIndex) * ABF_BLOCKSIZE, FILE_BEGIN ); if( !bOK ) return FALSE; for( int a=0; aRead( &ADCInfo, sizeof( ADCInfo ) ); // Read the channel. ch = ADCInfo.nADCNum; if( ADCInfo.nADCNum >= 0 ) { // Setup the sampling sequence array, using the channel sequence index. m_pFH->nADCSamplingSeq[a] = ADCInfo.nADCNum; // Everything else use the channel index. m_pFH->nTelegraphEnable[ch] = ADCInfo.nTelegraphEnable; m_pFH->nTelegraphInstrument[ch] = ADCInfo.nTelegraphInstrument; m_pFH->fTelegraphAdditGain[ch] = ADCInfo.fTelegraphAdditGain; m_pFH->fTelegraphFilter[ch] = ADCInfo.fTelegraphFilter; m_pFH->fTelegraphMembraneCap[ch] = ADCInfo.fTelegraphMembraneCap; m_pFH->nTelegraphMode[ch] = ADCInfo.nTelegraphMode; m_pFH->fTelegraphAccessResistance[ch] = ADCInfo.fTelegraphAccessResistance; m_pFH->nADCPtoLChannelMap[ch] = ADCInfo.nADCPtoLChannelMap; m_pFH->fADCProgrammableGain[ch] = ADCInfo.fADCProgrammableGain; m_pFH->fADCDisplayAmplification[ch] = ADCInfo.fADCDisplayAmplification; m_pFH->fADCDisplayOffset[ch] = ADCInfo.fADCDisplayOffset; m_pFH->fInstrumentScaleFactor[ch] = ADCInfo.fInstrumentScaleFactor; m_pFH->fInstrumentOffset[ch] = ADCInfo.fInstrumentOffset; m_pFH->fSignalGain[ch] = ADCInfo.fSignalGain; m_pFH->fSignalOffset[ch] = ADCInfo.fSignalOffset; m_pFH->fSignalLowpassFilter[ch] = ADCInfo.fSignalLowpassFilter; m_pFH->fSignalHighpassFilter[ch] = ADCInfo.fSignalHighpassFilter; m_pFH->nLowpassFilterType[ch] = ADCInfo.nLowpassFilterType; m_pFH->nHighpassFilterType[ch] = ADCInfo.nHighpassFilterType; m_pFH->fPostProcessLowpassFilter[ch] = ADCInfo.fPostProcessLowpassFilter; m_pFH->nPostProcessLowpassFilterType[ch] = ADCInfo.nPostProcessLowpassFilterType; m_pFH->nStatsChannelPolarity[ch] = ADCInfo.nStatsChannelPolarity; // Set the DAC index if an old P/N file is read. // CSH if( ADCInfo.bEnabledDuringPN ) // CSH m_pFH->nLeakSubtractADCIndex[0] = ch; bOK &= GetString( ADCInfo.lADCChannelNameIndex, m_pFH->sADCChannelName[ADCInfo.nADCNum], ABF_ADCNAMELEN ); bOK &= GetString( ADCInfo.lADCUnitsIndex, m_pFH->sADCUnits[ADCInfo.nADCNum], ABF_ADCUNITLEN ); } } return bOK; } //=============================================================================================== // FUNCTION: ReadDACInfo // PURPOSE: Reads the DAC info from the data file. // BOOL CABF2ProtocolReader::ReadDACInfo() { MEMBERASSERT(); BOOL bOK = TRUE; ABF_DACInfo DACInfo; ASSERT( m_FileInfo.DACSection.llNumEntries <= ABF2_DACCOUNT ); ASSERT( m_FileInfo.DACSection.uBytes == sizeof( DACInfo ) ); bOK &= m_pFI->Seek( LONGLONG(m_FileInfo.DACSection.uBlockIndex) * ABF_BLOCKSIZE, FILE_BEGIN ); if( !bOK ) return FALSE; for( UINT d=0; dRead( &DACInfo, sizeof( DACInfo ) ); //DACInfo.nDACNum = d; m_pFH->nTelegraphDACScaleFactorEnable[d] = DACInfo.nTelegraphDACScaleFactorEnable; m_pFH->fInstrumentHoldingLevel[d] = DACInfo.fInstrumentHoldingLevel; m_pFH->fDACScaleFactor[d] = DACInfo.fDACScaleFactor; m_pFH->fDACHoldingLevel[d] = DACInfo.fDACHoldingLevel; m_pFH->fDACCalibrationFactor[d] = DACInfo.fDACCalibrationFactor; m_pFH->fDACCalibrationOffset[d] = DACInfo.fDACCalibrationOffset; m_pFH->lDACFilePtr[d] = DACInfo.lDACFilePtr; m_pFH->lDACFileNumEpisodes[d] = DACInfo.lDACFileNumEpisodes; m_pFH->nWaveformEnable[d] = DACInfo.nWaveformEnable; m_pFH->nWaveformSource[d] = DACInfo.nWaveformSource; m_pFH->nInterEpisodeLevel[d] = DACInfo.nInterEpisodeLevel; m_pFH->fDACFileScale[d] = DACInfo.fDACFileScale; m_pFH->fDACFileOffset[d] = DACInfo.fDACFileOffset; m_pFH->lDACFileEpisodeNum[d] = DACInfo.lDACFileEpisodeNum; m_pFH->nDACFileADCNum[d] = DACInfo.nDACFileADCNum; m_pFH->nConditEnable[d] = DACInfo.nConditEnable; m_pFH->lConditNumPulses[d] = DACInfo.lConditNumPulses; m_pFH->fBaselineDuration[d] = DACInfo.fBaselineDuration; m_pFH->fBaselineLevel[d] = DACInfo.fBaselineLevel; m_pFH->fStepDuration[d] = DACInfo.fStepDuration; m_pFH->fStepLevel[d] = DACInfo.fStepLevel; m_pFH->fPostTrainPeriod[d] = DACInfo.fPostTrainPeriod; m_pFH->fPostTrainLevel[d] = DACInfo.fPostTrainLevel; m_pFH->nMembTestEnable[d] = DACInfo.nMembTestEnable; m_pFH->fMembTestPreSettlingTimeMS[d] = DACInfo.fMembTestPreSettlingTimeMS; m_pFH->fMembTestPostSettlingTimeMS[d] = DACInfo.fMembTestPostSettlingTimeMS; m_pFH->nLeakSubtractType[d] = DACInfo.nLeakSubtractType; m_pFH->nPNPosition = DACInfo.nPNPosition; m_pFH->nPNNumPulses = DACInfo.nPNNumPulses; m_pFH->fPNSettlingTime = DACInfo.fPNSettlingTime; m_pFH->fPNInterpulse = DACInfo.fPNInterpulse; m_pFH->nPNPolarity = DACInfo.nPNPolarity; m_pFH->fPNHoldingLevel[d] = DACInfo.fPNHoldingLevel; // CSH m_pFH->nLeakSubtractADCIndex[d] = DACInfo.nLeakSubtractADCIndex; m_pFH->nLTPUsageOfDAC[d] = DACInfo.nLTPUsageOfDAC; m_pFH->nLTPPresynapticPulses[d] = DACInfo.nLTPPresynapticPulses; bOK &= GetString( DACInfo.lDACChannelNameIndex, m_pFH->sDACChannelName[d], ABF_DACNAMELEN ); bOK &= GetString( DACInfo.lDACChannelUnitsIndex, m_pFH->sDACChannelUnits[d], ABF_DACUNITLEN ); bOK &= GetString( DACInfo.lDACFilePathIndex, m_pFH->sDACFilePath[d], ABF_PATHLEN ); } return bOK; } //=============================================================================================== // FUNCTION: ReadEpochs // PURPOSE: Reads the epochs from the data file. // BOOL CABF2ProtocolReader::ReadEpochs() { MEMBERASSERT(); BOOL bOK = TRUE; // Analog Epochs ... one set for each DAC in use. if( m_FileInfo.EpochPerDACSection.uBlockIndex ) { ABF_EpochInfoPerDAC Epoch; ASSERT( m_FileInfo.EpochPerDACSection.uBytes == sizeof( Epoch ) ); ASSERT( m_FileInfo.EpochPerDACSection.llNumEntries ); bOK &= m_pFI->Seek( LONGLONG(m_FileInfo.EpochPerDACSection.uBlockIndex) * ABF_BLOCKSIZE, FILE_BEGIN ); if( !bOK ) return FALSE; for( long i=0; iRead( &Epoch, sizeof( Epoch ) ); ASSERT( Epoch.nEpochType != ABF_EPOCHDISABLED ); short e = Epoch.nEpochNum; short d = Epoch.nDACNum; m_pFH->nEpochType[d][e] = Epoch.nEpochType; m_pFH->fEpochInitLevel[d][e] = Epoch.fEpochInitLevel; m_pFH->fEpochLevelInc[d][e] = Epoch.fEpochLevelInc; m_pFH->lEpochInitDuration[d][e] = Epoch.lEpochInitDuration; m_pFH->lEpochDurationInc[d][e] = Epoch.lEpochDurationInc; m_pFH->lEpochPulsePeriod[d][e] = Epoch.lEpochPulsePeriod; m_pFH->lEpochPulseWidth[d][e] = Epoch.lEpochPulseWidth; } } // Digital Epochs ... one set only. if( m_FileInfo.EpochSection.uBlockIndex ) { ABF_EpochInfo Epoch; ASSERT( m_FileInfo.EpochSection.uBytes == sizeof( Epoch ) ); ASSERT( m_FileInfo.EpochSection.llNumEntries ); bOK &= m_pFI->Seek( LONGLONG(m_FileInfo.EpochSection.uBlockIndex) * ABF_BLOCKSIZE, FILE_BEGIN ); if( !bOK ) return FALSE; for( long i=0; iRead( &Epoch, sizeof( Epoch ) ); short e = Epoch.nEpochNum; m_pFH->nDigitalValue[e] = Epoch.nDigitalValue; m_pFH->nDigitalTrainValue[e] = Epoch.nDigitalTrainValue; m_pFH->nAlternateDigitalValue[e] = Epoch.nAlternateDigitalValue; m_pFH->nAlternateDigitalTrainValue[e] = Epoch.nAlternateDigitalTrainValue; m_pFH->bEpochCompression[e] = Epoch.bEpochCompression; } } return bOK; } //=============================================================================================== // FUNCTION: ReadStats // PURPOSE: Reads the Stats regions from the data file. // BOOL CABF2ProtocolReader::ReadStats() { MEMBERASSERT(); BOOL bOK = TRUE; if( m_FileInfo.StatsRegionSection.uBlockIndex ) { bOK &= m_pFI->Seek( LONGLONG(m_FileInfo.StatsRegionSection.uBlockIndex) * ABF_BLOCKSIZE, FILE_BEGIN ); if( !bOK ) return FALSE; for( long i=0; iRead( &Stats, sizeof( Stats ) ); short r = Stats.nRegionNum; UINT uBitMask = 0x01 << r; m_pFH->nStatsSearchRegionFlags |= uBitMask; m_pFH->lStatsMeasurements[r] = Stats.lStatsMeasurements; m_pFH->lStatsStart[r] = Stats.lStatsStart; m_pFH->lStatsEnd[r] = Stats.lStatsEnd; m_pFH->nRiseTopPercentile[r] = Stats.nRiseTopPercentile; m_pFH->nRiseBottomPercentile[r] = Stats.nRiseBottomPercentile; m_pFH->nDecayBottomPercentile[r] = Stats.nDecayBottomPercentile; m_pFH->nDecayTopPercentile[r] = Stats.nDecayTopPercentile; m_pFH->nStatsSearchMode[r] = Stats.nStatsSearchMode; m_pFH->nStatsSearchDAC[r] = Stats.nStatsSearchDAC; m_pFH->nStatsActiveChannels = Stats.nStatsActiveChannels; m_pFH->nStatsSearchRegionFlags = Stats.nStatsSearchRegionFlags; m_pFH->nStatsSmoothing = Stats.nStatsSmoothing; m_pFH->nStatsSmoothingEnable = Stats.nStatsSmoothingEnable; m_pFH->nStatsBaseline = Stats.nStatsBaseline; m_pFH->nStatsBaselineDAC = Stats.nStatsBaselineDAC; m_pFH->lStatsBaselineStart = Stats.lStatsBaselineStart; m_pFH->lStatsBaselineEnd = Stats.lStatsBaselineEnd; // Some early ABF 2 protocols did not use the "DAC" field, so coerce these. if( Stats.nStatsSearchMode >= ABF_EPOCHCOUNT ) { m_pFH->nStatsSearchMode[r] = Stats.nStatsSearchMode % ABF_EPOCHCOUNT; m_pFH->nStatsSearchDAC[r] = Stats.nStatsSearchMode / ABF_EPOCHCOUNT; } if( Stats.nStatsBaseline >= ABF_EPOCHCOUNT ) { m_pFH->nStatsBaseline = Stats.nStatsBaseline % ABF_EPOCHCOUNT; m_pFH->nStatsBaselineDAC = Stats.nStatsBaseline / ABF_EPOCHCOUNT; } } } return bOK; } //=============================================================================================== // FUNCTION: ReadUserList // PURPOSE: Reads the user list from the data file. // BOOL CABF2ProtocolReader::ReadUserList() { MEMBERASSERT(); BOOL bOK = TRUE; if( m_FileInfo.UserListSection.uBlockIndex ) { ABF_UserListInfo UserList; ASSERT( m_FileInfo.UserListSection.uBytes == sizeof( UserList ) ); ASSERT( m_FileInfo.UserListSection.llNumEntries ); bOK &= m_pFI->Seek( LONGLONG(m_FileInfo.UserListSection.uBlockIndex) * ABF_BLOCKSIZE, FILE_BEGIN ); if( !bOK ) return FALSE; for( long i=0; iRead( &UserList, sizeof( UserList ) ); short u = UserList.nListNum; m_pFH->nULEnable[u] = 1; m_pFH->nULParamToVary[u] = UserList.nULParamToVary; m_pFH->nULRepeat[u] = UserList.nULRepeat; bOK &= GetString( UserList.lULParamValueListIndex, m_pFH->sULParamValueList[u], ABF_USERLISTLEN ); } } return bOK; } //=============================================================================================== // FUNCTION: ReadMathInfo // PURPOSE: Read the math channel info to the data file. // NOTES: We currently only support one math channel, but the file can support any number. // BOOL CABF2ProtocolReader::ReadMathInfo() { MEMBERASSERT(); BOOL bOK = TRUE; if( m_FileInfo.MathSection.uBlockIndex ) { ABF_MathInfo Math; ASSERT( m_FileInfo.MathSection.uBytes == sizeof( ABF_MathInfo ) ); ASSERT( m_FileInfo.MathSection.llNumEntries ); bOK &= m_pFI->Seek( LONGLONG(m_FileInfo.MathSection.uBlockIndex) * ABF_BLOCKSIZE, FILE_BEGIN ); if( !bOK ) return FALSE; bOK &= m_pFI->Read( &Math, sizeof( Math ) ); m_pFH->nArithmeticEnable = Math.nMathEnable; m_pFH->nArithmeticExpression = Math.nMathExpression; m_pFH->fArithmeticUpperLimit = Math.fMathUpperLimit; m_pFH->fArithmeticLowerLimit = Math.fMathLowerLimit; m_pFH->nArithmeticADCNumA = Math.nMathADCNum[0]; m_pFH->nArithmeticADCNumB = Math.nMathADCNum[1]; m_pFH->fArithmeticK1 = Math.fMathK[0]; m_pFH->fArithmeticK2 = Math.fMathK[1]; m_pFH->fArithmeticK3 = Math.fMathK[2]; m_pFH->fArithmeticK4 = Math.fMathK[3]; m_pFH->fArithmeticK5 = Math.fMathK[4]; m_pFH->fArithmeticK6 = Math.fMathK[5]; GetString( Math.uMathOperatorIndex, m_pFH->sArithmeticOperator, sizeof( m_pFH->sArithmeticOperator ) ); GetString( Math.uMathUnitsIndex, m_pFH->sArithmeticUnits, sizeof( m_pFH->sArithmeticUnits ) ); } return bOK; } #if 0 //=============================================================================================== // FUNCTION: ValidateCRC // PURPOSE: Validates the CRC in the FileInfo matches the CRC of the file. // BOOL CABF2ProtocolReader::ValidateCRC() { MEMBERASSERT(); if( m_pFH->nCRCEnable != ABF_CRC_ENABLED ) return TRUE; // CRC checking required. Read( 0 ); #if _DEBUG // Get the total length of the file. #ifdef _DEBUG LONGLONG llFileLength = m_pFI->GetFileSize(); UINT uHeaderSize = sizeof( m_FileInfo ); ASSERT( llFileLength > uHeaderSize ); #endif // _DEBUG #endif // Keep expected CRC value from header and Zero the lFileCRC. UINT uExpectedCRC = m_FileInfo.uFileCRC; m_FileInfo.uFileCRC = 0; UINT uFileCRC = CalculateCRC( &m_FileInfo, sizeof( m_FileInfo ) ); // Restore the original CRC. m_FileInfo.uFileCRC = uExpectedCRC; // Compare expected CRC with file CRC. if ( uFileCRC != uExpectedCRC ) { TRACE2( "File CRC Validation Failed: Expected %X, Calculated %X\n", uExpectedCRC, uFileCRC ); return FALSE; } TRACE1( "File CRC Validation OK: %X\n", uFileCRC); return TRUE; } #endif BOOL CABF2ProtocolReader::Open( LPCTSTR fName ) { int nError = 0; // Get a new file descriptor if available. if (!GetNewFileDescriptor(&m_pFI, &nFile, &nError)) return FALSE; // Now open the file for reading. if (!m_pFI->Open(fName, TRUE)) { return FALSE; } return TRUE; } BOOL CABF2ProtocolReader::Close( ) { int nError = 0; CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, &nError)) { return FALSE; } ReleaseFileDescriptor( nFile ); return TRUE; } //=============================================================================================== // FUNCTION: CanOpen // PURPOSE: Returns TRUE if this reader can open the file // BOOL CABF2ProtocolReader::CanOpen( const void *pFirstBlock, UINT uBytes ) { ASSERT( pFirstBlock ); ASSERT( uBytes >= sizeof( ABF2_FileInfo ) ); ABF2_FileInfo *pInfo = (ABF2_FileInfo *)pFirstBlock; // Check if it has the correct signature. if( pInfo->uFileSignature != ABF2_FILESIGNATURE ) return FALSE; // Check the major file version BYTE byMajorVersion = HIBYTE( HIWORD( pInfo->uFileVersionNumber ) ); if( byMajorVersion == 2 ) return TRUE; return FALSE; } stimfit-0.16.0/src/libstfio/abf/axon/0000775000175000017500000000000013567226445014375 500000000000000stimfit-0.16.0/src/libstfio/abf/axon/AxAtfFio32/0000775000175000017500000000000013567226445016203 500000000000000stimfit-0.16.0/src/libstfio/abf/axon/AxAtfFio32/axatffio32.cpp0000775000175000017500000015332013277303516020575 00000000000000//*********************************************************************************************** // // Written 1990 - 1997 by AXON Instruments Inc. // // This file is not protected by copyright. You are free to use, modify // and copy the code in this file. // //*********************************************************************************************** // // MODULE: AXATFFIO32.CPP // PURPOSE: Contains routines for reading and writing text files in the ATF format. // // An ANSI C compiler should be used for compilation. // Compile with the large memory model option. // (e.g. CL -c -AL AXATFFIO32.CPP) // // NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE // For consistency and code reuse, the DLL version of this module uses // AxonValidation.lib to perform float/double formatting. // NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE=NOTE #include "axatffio32.h" #include "atfutil.h" #include "atfintl.h" #include "../Common/axodebug.h" #define ATF_FILE_ID "ATF" #define PAF_FILE_ID "PAF" #define FILE_ID_LEN 3 #define PREVIOUS_PAF_VERSION 5.0F #define ATF_AVCOLUMNSIZE 50 // average number of chars per column #define ATF_MINBUFSIZE 1024 // minimum size for the pszIOBuffer #define ATF_DBL_SIG_DIGITS 12 #define ATF_FLT_SIG_DIGITS 6 // #define ATF_DBL_STR_LEN ATF_DBL_SIG_DIGITS + 7 // 1 for sign, 1 for decimal, // #define ATF_FLT_STR_LEN ATF_FLT_SIG_DIGITS + 7 // 2 for '+E' of exponential notation, 3 for exponent #define ATF_DBL_STR_LEN VAL_EXTERNBUFSIZE // for use with axovdate #define ATF_FLT_STR_LEN VAL_EXTERNBUFSIZE // // Set the maximum number of files that can be open simultaneously. // This can be overridden from the compiler command line. // #define ATF_MAXFILES 64 static PATF_FILEINFO g_FileDescriptor[ATF_MAXFILES]; // // If the file is opened in BINARY mode, CR/LF pairs are NOT translated to LFs // on reading, and LFs are NOT translated to CR/LF on writing. // static const char s_szEndOfLine[] = "\r\n"; static const char s_szWhitespace[] = "\t\r\n ,"; static const char s_szWhiteNoSpace[] = "\t\r\n,"; static const char s_szDelimiter[] = "\t,"; static const char s_szLineTerm[] = "\r\n"; // HINSTANCE g_hInstance = NULL; #define ENDOFFILE 0x1A // End-of-file character static BOOL ReadDataRecord(ATF_FILEINFO *pATF, int *pnError); //=============================================================================================== // FUNCTION: ATF_Initialize() // PARAMETERS: // hInstance - Instance handle from which resources will be taken. // RETURNS: // BOOL - TRUE = Initialization was successful. // // PURPOSE: This function should be called before any of the other API functions. // NOTES: This function is not exported as it is called from the DLL startup code. If the // API is bound into an executable rather than a DLL it will need to be called // explicitly. // BOOL WINAPI ATF_Initialize(HINSTANCE hDLL) { // Protect against multiple calls. if (g_hInstance != NULL) return TRUE; // Save the DLL instance handle. g_hInstance = hDLL; for (int i=0; iszSeparator[0] = s_szDelimiter[0]; *ppATF = g_FileDescriptor[nFile] = pATF; *pnFile = nFile; return TRUE; } //----------------------------------------------------------------------------------------------- // FUNCTION: GetFileDescriptor // PURPOSE: Retreive an existing file descriptor. // static BOOL GetFileDescriptor(ATF_FILEINFO **ppATF, int nFile, int *pnError) { WPTRASSERT(ppATF); // Check that index is within range. if ((nFile < 0) || (nFile >= ATF_MAXFILES)) ERRORRETURN(pnError, ATF_ERROR_BADFILENUM); // Get a pointer to the descriptor. ATF_FILEINFO *pATF = g_FileDescriptor[nFile]; if (pATF == NULL) ERRORRETURN(pnError, ATF_ERROR_BADSTATE); // Return the descriptor. *ppATF = pATF; return TRUE; } //=============================================================================================== // FUNCTION: AllocIOBuffer // PURPOSE: Allocate an IOBuffer for this file. // static BOOL AllocIOBuffer(ATF_FILEINFO *pATF) { WPTRASSERT(pATF); pATF->nIOBufferSize = pATF->nColumns * ATF_AVCOLUMNSIZE; if (pATF->nIOBufferSize < ATF_MINBUFSIZE) pATF->nIOBufferSize = ATF_MINBUFSIZE; pATF->pszIOBuffer = (char *)calloc(pATF->nIOBufferSize, sizeof(char)); if (pATF->pszIOBuffer == NULL) { pATF->nIOBufferSize = 0; return FALSE; } return TRUE; } //=============================================================================================== // FUNCTION: FreeIOBuffer // PURPOSE: Free the IO buffer used by this file. // static void FreeIOBuffer(ATF_FILEINFO *pATF) { WPTRASSERT(pATF); if (pATF->pszIOBuffer != NULL) free(pATF->pszIOBuffer); pATF->pszIOBuffer = NULL; pATF->nIOBufferSize = 0; } //============================================================================================== // FUNCTION: strncpyz // PURPOSE: Does a strncpy but guarantees that a terminating zero is placed on the // destination string. // RETURNS: The destination buffer. // static LPSTR strncpyz(LPSTR pszDest, LPCSTR pszSrce, UINT uBufSize) { ARRAYASSERT(pszDest, uBufSize); #if 0 LPSZASSERT(pszSrce); #endif strncpy(pszDest, pszSrce, uBufSize-1); pszDest[uBufSize-1] = '\0'; return pszDest; } //=============================================================================================== // FUNCTION: GetNumber // PURPOSE: Parse the next double out of the buffer, skipping delimeters etc. // static char *GetNumber(char *psBuf, double *pdNum) { #if 0 LPSZASSERT(psBuf); #endif // Skip space characters to get the start of the number char *ps = psBuf; while (*ps==' ') ++ps; // Save a pointer to the start of the number. char *psStart = ps; // search for the end of this token while (*ps && !strchr(s_szWhitespace, *ps)) ++ps; // skip trailing spaces. while (*ps==' ') ++ps; // Null terminate the string (knocking out the next delimiter) and step past the null if not end of line. if (*ps && !strchr(s_szLineTerm, *ps)) *ps++ = '\0'; else *ps = '\0'; if (pdNum) { WPTRASSERT(pdNum); *pdNum = atof(psStart); } return ps; } //=============================================================================================== // FUNCTION: GetVersion // PURPOSE: Parse the version number out of the data stream and check it against acceptable // values. // static BOOL GetVersion(char *psBuf, double *pdATFVersion, int *pnError) { #if 0 LPSZASSERT(psBuf); #endif WPTRASSERT(pdATFVersion); double dNum = 0; if (strlen(psBuf) < 5) ERRORRETURN(pnError, ATF_ERROR_INVALIDFILE); // Skip leading whitespace. char *psz = psBuf+FILE_ID_LEN; while (*psz && strchr(s_szWhitespace, *psz)) psz++; GetNumber(psz, &dNum); if (strncmp(psBuf, ATF_FILE_ID, FILE_ID_LEN) == 0) { if ((dNum > ATF_CURRENTVERSION) || (dNum==0.0)) ERRORRETURN(pnError, ATF_ERROR_BADVERSION); // File is an ATF file *pdATFVersion = dNum; } else if (strncmp(psBuf, PAF_FILE_ID, FILE_ID_LEN) == 0) { if (dNum != PREVIOUS_PAF_VERSION) ERRORRETURN(pnError, ATF_ERROR_BADVERSION); // Previous PAF V5.0 files are supported as ATF V0.0 *pdATFVersion = 0.0; } else ERRORRETURN(pnError, ATF_ERROR_INVALIDFILE); return TRUE; } //=============================================================================================== // FUNCTION: CleanupMem // PURPOSE: Frees strings that have been strdup'ed into the array. // static void CleanupMem(char **ppsz, int nItems) { if (!ppsz) return; while (nItems--) { if (*ppsz) free(*ppsz); ppsz++; } } //============================================================================================== // FUNCTION: StripSpaces // PURPOSE: Strips space characters out of the start and end of the passed string. // NOTES: This routine is DESTRUCTIVE in that it replaces any trailing spaces with '\0's. // It contains its own static definition of whitespace, not that it does not // include ','. // RETURNS: Pointer to the first non-white-space character. // static LPSTR StripSpaces(LPSTR pszSource) { // Garbage in == garbage out. if (!pszSource) return pszSource; // Characters that are regarded as white space. static const char szWhiteSpace[] = " \t\r\n"; #if 0 LPSZASSERT(pszSource); #endif // Strip leading white space. char *pszFirstChar = pszSource + strspn(pszSource, szWhiteSpace); // If nothing left, return. if (*pszFirstChar=='\0') { pszSource[0] = '\0'; return pszSource; } // Strip trailing white space. char *pszLastChar = pszFirstChar + strlen(pszFirstChar) - 1; while (pszLastChar > pszFirstChar) { if (strchr(szWhiteSpace, *pszLastChar) == NULL) break; *pszLastChar-- = '\0'; } // Move the sub-string to the start of the source string. if (pszFirstChar > pszSource) memmove(pszSource, pszFirstChar, strlen(pszFirstChar)+1); return pszSource; } //=============================================================================================== // FUNCTION: FixColumnTitles // PURPOSE: This function reads PAF V5.0 (ATF 0.0) headings. // static BOOL FixColumnTitles(int nColumns, ATF_FILEINFO *pATF) { WPTRASSERT(pATF); char *ps = pATF->pszIOBuffer; char *psEnd = pATF->pszIOBuffer + pATF->nIOBufferSize; for (int i=0; i= psEnd) // return an error if past end of buffer. return FALSE; } // Save the start of the title. char *psStart = ps; // Search for the end of the title. while ((*ps!='"') && (*ps!='\t')) { ++ps; if (ps >= psEnd) // return an error if past end of buffer. return FALSE; } *ps++ = '\0'; #if !defined(_WINDOWS) || defined(__MINGW32__) pATF->apszFileColTitles[i] = strdup(StripSpaces(psStart)); #else pATF->apszFileColTitles[i] = _strdup(StripSpaces(psStart)); #endif if (pATF->apszFileColTitles[i] == NULL) return FALSE; } return TRUE; } //=============================================================================================== // FUNCTION: FixColumnUnits // PURPOSE: This function reads PAF V5.0 (ATF 0.0) headings. // static BOOL FixColumnUnits(int nColumns, ATF_FILEINFO *pATF) { WPTRASSERT(pATF); char *ps = pATF->pszIOBuffer; char *psEnd = pATF->pszIOBuffer + pATF->nIOBufferSize; for (int i=0; i= psEnd) // return an error if past end of buffer. return FALSE; } // Save the start of the units char *psStart = ps; // Search for the end of the units. while ((*ps!='"') && (*ps!='\t')) { ++ps; if (ps >= psEnd) // return an error if past end of buffer. return FALSE; } *ps++ = '\0'; #if !defined(_WINDOWS) || defined(__MINGW32__) pATF->apszFileColUnits[i] = strdup(StripSpaces(psStart)); #else pATF->apszFileColUnits[i] = _strdup(StripSpaces(psStart)); #endif if (pATF->apszFileColUnits[i] == NULL) return FALSE; } return TRUE; } //=============================================================================================== // FUNCTION: FixColumnHeadings // PURPOSE: Store away the column headings and the column units strings for ATF files. // static BOOL FixColumnHeadings(int nColumns, ATF_FILEINFO *pATF) { WPTRASSERT(pATF); char *ps = pATF->pszIOBuffer; char *psEnd = pATF->pszIOBuffer + pATF->nIOBufferSize; for (int i=0; i= psEnd) // return an error if past end of buffer. return FALSE; } if (*ps=='"') { bDoubleQuote = TRUE; ++ps; } // Save the start of the title char *psStart = ps; for (; *ps && !strchr(s_szWhiteNoSpace, *ps); ++ps) { if (ps >= psEnd) // return an error if past end of buffer. return FALSE; if (bDoubleQuote && (*ps=='"')) break; if (*ps == '(') { if (*(ps-1) == ' ') *(ps-1) = '\0'; bUnits = TRUE; break; } } *ps++ = '\0'; #if !defined(_WINDOWS) || defined(__MINGW32__) pATF->apszFileColTitles[i] = strdup(StripSpaces(psStart)); #else pATF->apszFileColTitles[i] = _strdup(StripSpaces(psStart)); #endif if (pATF->apszFileColTitles[i] == NULL) return FALSE; if (bUnits) { psStart = ps; while (!strchr(s_szDelimiter, *ps) && (*ps!=')')) { if (bDoubleQuote && (*ps=='"')) { bDoubleQuote = FALSE; break; } ++ps; if (ps >= psEnd) // return an error if past end of buffer. return FALSE; } *ps++ = '\0'; #if !defined(_WINDOWS) || defined(__MINGW32__) pATF->apszFileColUnits[i] = strdup(StripSpaces(psStart)); #else pATF->apszFileColUnits[i] = _strdup(StripSpaces(psStart)); #endif if (pATF->apszFileColUnits[i] == NULL) return FALSE; if (bDoubleQuote) { while (*ps && (*ps!='"')) ps++; *ps++ = '\0'; } } } return TRUE; } //=============================================================================================== // FUNCTION: ReadLine // PURPOSE: This function masks gets and processes error conditions // static BOOL ReadLine(ATF_FILEINFO *pATF, int nEOFError, int *pnError) { WPTRASSERT(pATF); char *pszIOBuffer = pATF->pszIOBuffer; int nReturn = getsBuf(pATF, pszIOBuffer, pATF->nIOBufferSize); if (nReturn == GETS_EOF) ERRORRETURN(pnError, nEOFError); if (nReturn == GETS_ERROR) ERRORRETURN(pnError, ATF_ERROR_IOERROR); if (nReturn == GETS_NOEOL) ERRORRETURN(pnError, ATF_ERROR_LINETOOLONG); if (pszIOBuffer[0] == ENDOFFILE) pszIOBuffer[0] = '\0'; return TRUE; } //=============================================================================================== // FUNCTION: ReadHeaderInfo // PURPOSE: Reads the header information out of the file and stores it away in the file // descriptor. // static BOOL ReadHeaderInfo(ATF_FILEINFO *pATF, int *pnColumns, int *pnError) { WPTRASSERT(pnColumns); char szReadBuf[128]; double dATFVersion, dNum; int nHeaders, nColumns, i; long lCurrentPos; // Check if the version number is suported if (getsBuf(pATF, szReadBuf, sizeof(szReadBuf))) ERRORRETURN(pnError, ATF_ERROR_INVALIDFILE); if (!GetVersion(szReadBuf, &dATFVersion, pnError)) return FALSE; // Read in the number of header records and the number of columns of data // in the file if (getsBuf(pATF, szReadBuf, sizeof(szReadBuf))) ERRORRETURN(pnError, ATF_ERROR_BADHEADER); if (dATFVersion == 0.0) { // Read number of headers and columns as in previous (PAF 5.0) version GetNumber(szReadBuf, &dNum); nHeaders = (int)dNum; if (getsBuf(pATF, szReadBuf, sizeof(szReadBuf))) ERRORRETURN(pnError, ATF_ERROR_BADHEADER); GetNumber(szReadBuf, &dNum); nColumns = (int)dNum; } else { // Parse out first number (Headers) char *ps = GetNumber(szReadBuf, &dNum); nHeaders = (int)dNum; // Parse out second number (Columns) GetNumber(ps, &dNum); nColumns = (int)dNum; } if (nHeaders < 0) nHeaders = 0; if (nColumns < 0) nColumns = 0; // Return the number of columns to the user if a pointer was passed in if (pnColumns) *pnColumns = nColumns; if (nColumns > ATF_MAXCOLUMNS) ERRORRETURN(pnError, ATF_ERROR_TOOMANYCOLS); // Save the various pieces of information about this file // pATF->hFile = hFile; // now set in _CreateFileBuf pATF->nHeaders = nHeaders; pATF->nColumns = nColumns; pATF->eState = eOPENED; pATF->bWriting = FALSE; pATF->dFileVersion = dATFVersion; if (!AllocIOBuffer(pATF)) ERRORRETURN(pnError, ATF_ERROR_NOMEMORY); // Now save the current position and skip the header records and get the // column title and unit strings lCurrentPos = SetFilePointerBuf(pATF, 0, NULL, FILE_CURRENT); for (i=0; iapszFileColTitles = (char **)calloc(nColumns, sizeof(char *)); if (pATF->apszFileColTitles == NULL) ERRORRETURN(pnError, ATF_ERROR_NOMEMORY); pATF->apszFileColUnits = (char **)calloc(nColumns, sizeof(char *)); if (pATF->apszFileColUnits == NULL) { free(pATF->apszFileColTitles); pATF->apszFileColTitles = NULL; ERRORRETURN(pnError, ATF_ERROR_NOMEMORY); } if (!ReadLine(pATF, ATF_ERROR_BADHEADER, pnError)) return FALSE; if (dATFVersion == 0.0) { if (!FixColumnTitles(nColumns, pATF)) { CleanupMem(pATF->apszFileColTitles, nColumns); ERRORRETURN(pnError, ATF_ERROR_BADHEADER); } if (!ReadLine(pATF, ATF_ERROR_BADHEADER, pnError)) { CleanupMem(pATF->apszFileColTitles, nColumns); return FALSE; } if (!FixColumnUnits(nColumns, pATF)) { CleanupMem(pATF->apszFileColTitles, nColumns); CleanupMem(pATF->apszFileColUnits, nColumns); ERRORRETURN(pnError, ATF_ERROR_BADHEADER); } } else if (!FixColumnHeadings(nColumns, pATF)) { CleanupMem(pATF->apszFileColTitles, nColumns); CleanupMem(pATF->apszFileColUnits, nColumns); ERRORRETURN(pnError, ATF_ERROR_BADHEADER); } // Return to the saved position SetFilePointerBuf(pATF, lCurrentPos, NULL, FILE_BEGIN); return TRUE; } //=============================================================================================== // FUNCTION: WriteHeaderInfo // PURPOSE: Write the first compulsory header lines out to the file. // static BOOL WriteHeaderInfo(ATF_FILEINFO *pATF, int nColumns, int *pnError) { // Writing a new file; Setup any necessary info pATF->dFileVersion = ATF_CURRENTVERSION; pATF->eState = eOPENED; pATF->bWriting = TRUE; pATF->bDataOnLine = FALSE; pATF->nHeaders = 0; pATF->nColumns = nColumns; // Allocate / re-allocate the IOBuffer. if (!AllocIOBuffer(pATF)) ERRORRETURN(pnError, ATF_ERROR_NOMEMORY); // Allocate space to hold column titles and units. pATF->apszFileColTitles = (char **)calloc(nColumns, sizeof(char *)); if (pATF->apszFileColTitles == NULL) ERRORRETURN(pnError, ATF_ERROR_NOMEMORY); pATF->apszFileColUnits = (char **)calloc(nColumns, sizeof(char *)); if (pATF->apszFileColUnits == NULL) { free(pATF->apszFileColTitles); pATF->apszFileColTitles = NULL; ERRORRETURN(pnError, ATF_ERROR_NOMEMORY); } if (pATF->uFlags & ATF_DONTWRITEHEADER) { pATF->lFilePos = 0; return TRUE; } // Write the special marker string and the file version number char *pszIOBuffer = pATF->pszIOBuffer; sprintf(pszIOBuffer, "%s%s%.1f%s", ATF_FILE_ID, pATF->szSeparator, ATF_CURRENTVERSION, s_szEndOfLine); if (!putsBuf(pATF, pszIOBuffer)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); // Save the current position so that we may update the number of header records pATF->lFilePos = SetFilePointerBuf(pATF, 0, NULL, FILE_CURRENT); // Write the number of headers and columns that will be written, leaving // enough trailing spaces for 4 digits of headers (more than enough) sprintf(pszIOBuffer, "0%s%d %s", pATF->szSeparator, nColumns, s_szEndOfLine); if (!putsBuf(pATF, pszIOBuffer)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); return TRUE; } //=============================================================================================== // FUNCTION: _FormatNumber // PURPOSE: Formats the digits of dNum into pszString, suppressing trailing zeros. // In the event that "0." is produced as output from gcvt, truncate to "0" // // RETURNS: TRUE if success; FALSE if failure // #ifdef _WINDOWS // #include "..\AxonValidation\AxonValidation.h" // for VAL_* functions (standard Axon float/double->string formatting) #endif static BOOL _FormatNumber(double dNum, int nDigits, char *pszString, UINT uSize) { ARRAYASSERT(pszString, uSize); #if !defined(_WINDOWS) || defined(__MINGW32__) sprintf(pszString, "%.*g", nDigits, dNum); // char* res = gcvt(dNum, nDigits, pszString); #else _gcvt(dNum, nDigits, pszString); #endif int l = (int)strlen(pszString); if ((l > 0) && (pszString[l-1]=='.')) pszString[l-1] = '\0'; return TRUE; /* #else return VAL_ConvertDblToStr(dNum, pszString, uSize, VAL_FMT_SIG_DIGITS, 0, nDigits, NULL); #endif */ } //=============================================================================================== // FUNCTION: ATF_OpenFile // PURPOSE: Opens an ATF file for either reading or writing. // BOOL WINAPI ATF_OpenFile(LPCSTR szFileName, UINT uFlags, int *pnColumns, int *pnFile, int *pnError) { #if 0 LPSZASSERT(szFileName); #endif WPTRASSERT(pnColumns); WPTRASSERT(pnFile); // keep state of DONTWRITEHEADER flag BOOL bDontWriteHeader = uFlags & ATF_DONTWRITEHEADER; int nColumns, nFile; HANDLE hFile = INVALID_HANDLE_VALUE; ATF_FILEINFO *pATF = NULL; if (!GetNewFileDescriptor(&pATF, &nFile, pnError)) return FALSE; // copy name: #if !defined(_WINDOWS) || defined(__MINGW32__) pATF->pszFileName = strdup(szFileName); #else pATF->pszFileName = _strdup(szFileName); #endif if (pATF->pszFileName == NULL) goto OpenError; if (uFlags & ATF_READONLY) { hFile = CreateFileBuf(pATF, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { if (pnError) *pnError = ATF_ERROR_NOFILE; goto OpenError; } pATF->uFlags = uFlags; // Read the header information into the global variables if (!ReadHeaderInfo(pATF, pnColumns, pnError)) goto OpenError; } else { nColumns = *pnColumns; if (nColumns > ATF_MAXCOLUMNS) { if (pnError) *pnError = ATF_ERROR_TOOMANYCOLS; goto OpenError; } // Try to open any existing file with same name #if defined(_WINDOWS) && !defined(__MINGW32__) hFile = CreateFileBuf(pATF, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { if ((uFlags & ATF_OVERWRTIFEXIST)==0) { if (pnError) *pnError = ATF_ERROR_FILEEXISTS; goto OpenError; } if ((uFlags & ATF_APPENDIFEXIST)!=0) { // If we are appending to the file, read the header // to confirm that it is a valid ATF file that we are // appending to. if (!ReadHeaderInfo(pATF, NULL, pnError)) goto OpenError; } CloseHandleBuf(pATF); } else #endif uFlags = ATF_WRITEONLY; pATF->uFlags = uFlags; // Now, open the file for output hFile = CreateFileBuf(pATF, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, uFlags & ATF_APPENDIFEXIST ? OPEN_EXISTING : CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { if (pnError) *pnError = ATF_ERROR_NOFILE; goto OpenError; } if ((uFlags & ATF_APPENDIFEXIST)!=0) { // pATF->hFile = hFile; pATF->bDataOnLine = FALSE; pATF->eState = eDATAAPPENDED; pATF->bWriting = TRUE; } else { // Set the DONTWRITEHEADER flag if needed pATF->uFlags |= bDontWriteHeader; // Write the header information and set up global variables if (!WriteHeaderInfo(pATF, nColumns, pnError)) { CloseHandleBuf(pATF); goto OpenError; } } } *pnFile = nFile; return TRUE; OpenError: if (hFile != INVALID_HANDLE_VALUE) CloseHandleBuf(pATF); if (pATF->pszFileName != NULL) free(pATF->pszFileName); free(pATF); g_FileDescriptor[nFile] = NULL; return FALSE; } //=============================================================================================== // FUNCTION: HasUnits // PURPOSE: Checks for the presence of a units string. // static BOOL HasUnits(LPCSTR pszUnits) { return (pszUnits && (pszUnits[0]!=0)); } //=============================================================================================== // FUNCTION: UpdateHeaders // PURPOSE: Update the headers in the ATF file. // static BOOL UpdateHeaders(ATF_FILEINFO *pATF, int *pnError) { WPTRASSERT(pATF); if (pATF->uFlags & ATF_DONTWRITEHEADER) return TRUE; char *pszIOBuffer = pATF->pszIOBuffer; // if there are unterminated header lines then terminate the last one if (pATF->bDataOnLine) { if (!putsBuf(pATF, s_szEndOfLine)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); pATF->nHeaders++; pATF->bDataOnLine = FALSE; } // Save the current position of the file long lCurrentPos = SetFilePointerBuf(pATF, 0, NULL, FILE_CURRENT); // Move to the location of the record containing the number of header records SetFilePointerBuf(pATF, pATF->lFilePos, NULL, FILE_BEGIN); // Create the string for the number of header records { sprintf(pszIOBuffer, "%d%s%d", pATF->nHeaders, pATF->szSeparator, pATF->nColumns); if (!putsBuf(pATF, pszIOBuffer)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); } // Restore the position of the file SetFilePointerBuf(pATF, lCurrentPos, NULL, FILE_BEGIN); // Output the column titles and units record for (int i=0; inColumns; i++) { // Start with separator if not the first column if (i > 0) strcpy(pszIOBuffer, pATF->szSeparator); else pszIOBuffer[0] = '\0'; // Add next title string strcat(pszIOBuffer, "\""); if (pATF->apszFileColTitles[i] != NULL) { strcat(pszIOBuffer, pATF->apszFileColTitles[i]); if (HasUnits(pATF->apszFileColUnits[i])) strcat(pszIOBuffer, " "); } if (HasUnits(pATF->apszFileColUnits[i])) { strcat(pszIOBuffer, "("); strcat(pszIOBuffer, pATF->apszFileColUnits[i]); strcat(pszIOBuffer, ")"); } strcat(pszIOBuffer, "\""); if (!putsBuf(pATF, pszIOBuffer)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); } if (!putsBuf(pATF, s_szEndOfLine)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); pATF->bDataOnLine = FALSE; pszIOBuffer[0] = '\0'; return TRUE; } //=============================================================================================== // FUNCTION: ATF_CloseFile // PURPOSE: Close an ATF file that was opened with ATF_OpenFile. // BOOL WINAPI ATF_CloseFile(int nFile) { ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, NULL)) return FALSE; // Check that we have written out the headers at least. if ((pATF->eState < eDATAWRITTEN) && pATF->bWriting) UpdateHeaders(pATF, NULL); // Close the file and update the state variable CloseHandleBuf(pATF); CleanupMem(pATF->apszFileColTitles, pATF->nColumns); free(pATF->apszFileColTitles); CleanupMem(pATF->apszFileColUnits, pATF->nColumns); free(pATF->apszFileColUnits); FreeIOBuffer(pATF); if (pATF->pszFileName != NULL) free(pATF->pszFileName); free(pATF); g_FileDescriptor[nFile] = NULL; return TRUE; } //=============================================================================================== // FUNCTION: ATF_SetSeperator // PURPOSE: Sets the data item separator to be used when writing out an ATF file. // BOOL WINAPI ATF_SetSeperator(int nFile, BOOL bUseCommas, int *pnError) { ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; pATF->szSeparator[0] = s_szDelimiter[bUseCommas ? 1 : 0]; return TRUE; } //=============================================================================================== // FUNCTION: ATF_IsAppending // PURPOSE: Returns TRUE if the file has been opened for appending. // BOOL WINAPI ATF_IsAppending(int nFile) { ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, NULL)) return FALSE; return (pATF->eState == eDATAAPPENDED); } //=============================================================================================== // FUNCTION: ATF_RewindFile // PURPOSE: Rewind the data section of the ATF file back to the beginning. // BOOL WINAPI ATF_RewindFile(int nFile, int *pnError) { ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; if (pATF->bWriting) ERRORRETURN(pnError, ATF_ERROR_BADSTATE); if (pATF->eState != eDATAREAD) ERRORRETURN(pnError, ATF_ERROR_BADSTATE); SetFilePointerBuf(pATF, pATF->lDataPtr, NULL, FILE_BEGIN); return TRUE; } //=============================================================================================== // FUNCTION: ATF_CountDataLines // PURPOSE: Counts lines of data in an ATF file, stopping at the first empty line, or EOF. // BOOL WINAPI ATF_CountDataLines(int nFile, long *plNumLines, int *pnError) { WPTRASSERT(plNumLines); long lDataLines = 0L; ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; while (ReadDataRecord(pATF, pnError)) { if (strchr(s_szLineTerm, pATF->pszIOBuffer[0])) break; ++lDataLines; } ATF_RewindFile(nFile, NULL); *plNumLines = lDataLines; return TRUE; } //=============================================================================================== // FUNCTION: ATF_GetNumHeaders // PURPOSE: Gets the number of optional data records in the ATF file. // BOOL WINAPI ATF_GetNumHeaders(int nFile, int *pnHeaders, int *pnError) { WPTRASSERT(pnHeaders); ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; *pnHeaders = pATF->nHeaders; return TRUE; } //=============================================================================================== // FUNCTION: ATF_WriteHeaderRecord // PURPOSE: Writes an optional header r3cord to the ATF file. // BOOL WINAPI ATF_WriteHeaderRecord(int nFile, LPCSTR pszText, int *pnError) { #if 0 LPSZASSERT(pszText); #endif ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; if (pATF->uFlags & ATF_DONTWRITEHEADER) return TRUE; char *pszIOBuffer = pATF->pszIOBuffer; // Check that we are in the correct state for this file if (pATF->eState > eHEADERED) ERRORRETURN(pnError, ATF_ERROR_BADSTATE); // Update the state if necessary pATF->eState = eHEADERED; // Write out the header record if (pATF->bDataOnLine) strcpy(pszIOBuffer, pATF->szSeparator); else pszIOBuffer[0] = '\0'; strcat(pszIOBuffer, "\""); strcat(pszIOBuffer, pszText); strcat(pszIOBuffer, "\""); if (!putsBuf(pATF, pszIOBuffer)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); pATF->bDataOnLine = TRUE; return TRUE; } //=============================================================================================== // FUNCTION: ATF_SetColumnTitle // PURPOSE: Sets the next column title. Columns are labeled sequentially. // BOOL WINAPI ATF_SetColumnTitle(int nFile, LPCSTR pszText, int *pnError) { #if 0 LPSZASSERT(pszText); #endif int i; ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; // Check that we are in the correct state for this file if (pATF->eState > eHEADERED) ERRORRETURN(pnError, ATF_ERROR_BADSTATE); for (i=0; inColumns; i++) if (pATF->apszFileColTitles[i] == NULL) break; if (i==pATF->nColumns) ERRORRETURN(pnError, ATF_ERROR_TOOMANYCOLS); // Copy the new column title into the string buffer and save a pointer to it. #if !defined(_WINDOWS) || defined(__MINGW32__) LPSTR psz = strdup(pszText); #else LPSTR psz = _strdup(pszText); #endif if (psz == NULL) ERRORRETURN(pnError, ATF_ERROR_NOMEMORY); pATF->apszFileColTitles[i] = psz; return TRUE; } //=============================================================================================== // FUNCTION: ATF_SetColumnUnits // PURPOSE: Sets the next column units label. Columns are labeled sequentially. // BOOL WINAPI ATF_SetColumnUnits(int nFile, LPCSTR pszText, int *pnError) { #if 0 LPSZASSERT(pszText); #endif int i; ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; // Check that we are in the correct state for this file if (pATF->eState > eHEADERED) ERRORRETURN(pnError, ATF_ERROR_BADSTATE); for (i=0; inColumns; i++) if (pATF->apszFileColUnits[i] == NULL) break; if (i==pATF->nColumns) ERRORRETURN(pnError, ATF_ERROR_TOOMANYCOLS); // Copy the new column Unit into the string buffer and save a pointer to it. #if !defined(_WINDOWS) || defined(__MINGW32__) LPSTR psz = strdup(pszText); #else LPSTR psz = _strdup(pszText); #endif if (psz == NULL) ERRORRETURN(pnError, ATF_ERROR_NOMEMORY); pATF->apszFileColUnits[i] = psz; return TRUE; } //=============================================================================================== // FUNCTION: ATF_WriteEndOfLine // PURPOSE: Terminates the current data line when writing to an ATF file. // BOOL WINAPI ATF_WriteEndOfLine(int nFile, int *pnError) { ATF_FILEINFO * pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; // Write out the EndOfLine character to the file if (!putsBuf(pATF, s_szEndOfLine)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); // Reset data-on-line flag pATF->bDataOnLine = FALSE; // If a header is being written, increment the count of header records if (pATF->eState == eHEADERED) pATF->nHeaders++; return TRUE; } //=============================================================================================== // FUNCTION: ATF_WriteDataRecord // PURPOSE: Writes a data record out to the ATF file. // BOOL WINAPI ATF_WriteDataRecord(int nFile, LPCSTR pszText, int *pnError) { #if 0 LPSZASSERT(pszText); #endif ATF_FILEINFO * pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; // Check that we are in the correct state for this file if (pATF->eState < eDATAWRITTEN) { if (!UpdateHeaders(pATF, pnError)) return FALSE; pATF->eState = eDATAWRITTEN; } else if (pATF->bDataOnLine) if (!putsBuf(pATF, pATF->szSeparator)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); // Write out the text string to the file if (!putsBuf(pATF, pszText)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); // Set data-on-line flag pATF->bDataOnLine = TRUE; return TRUE; } //=============================================================================================== // FUNCTION: ATF_WriteDataComment // PURPOSE: Writes a comment record out to the ATF file. // BOOL WINAPI ATF_WriteDataComment(int nFile, LPCSTR pszText, int *pnError) { #if 0 LPSZASSERT(pszText); #endif char buf[128]; #if defined(_WINDOWS) && !defined(__MINGW32__) _snprintf(buf, sizeof(buf), "\"%s\"", pszText); #else snprintf(buf, sizeof(buf), "\"%s\"", pszText); #endif return ATF_WriteDataRecord(nFile, buf, pnError); } //=============================================================================================== // FUNCTION: ATF_WriteDataRecordArray // PURPOSE: Writes an array of data values out to a line of the ATF file. // BOOL WINAPI ATF_WriteDataRecordArray(int nFile, int nCount, double *pdVals, int *pnError) { ARRAYASSERT(pdVals, nCount); char psTemp[ATF_DBL_STR_LEN]; ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; if (nCount > pATF->nColumns) ERRORRETURN(pnError, ATF_ERROR_TOOMANYCOLS); char *pszIOBuffer = pATF->pszIOBuffer; // Check that we are in the correct state for this file if (pATF->eState < eDATAWRITTEN) { if (!UpdateHeaders(pATF, pnError)) return FALSE; pATF->eState = eDATAWRITTEN; } // Create the output string for this record char *ps = pszIOBuffer; *ps = '\0'; if (nCount > 0) { if (pATF->bDataOnLine) strcpy(ps++, pATF->szSeparator); if (!_FormatNumber(*pdVals++, ATF_DBL_SIG_DIGITS, psTemp, ATF_DBL_STR_LEN)) ERRORRETURN(pnError, ATF_ERROR_BADFLTCNV); strcpy(ps, psTemp); ps += strlen(psTemp); } for (int i=1; iszSeparator); ps += strlen(pATF->szSeparator); if (!_FormatNumber(*pdVals++, ATF_DBL_SIG_DIGITS, psTemp, ATF_DBL_STR_LEN)) ERRORRETURN(pnError, ATF_ERROR_BADFLTCNV); strcpy(ps, psTemp); ps += strlen(psTemp); } // Write out the text string to the file if (!putsBuf(pATF, pszIOBuffer)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); // Set data-on-line flag pATF->bDataOnLine = TRUE; return TRUE; } //=============================================================================================== // FUNCTION: ATF_WriteDataRecordArrayFloat // PURPOSE: Writes an array of float data values out to a line of the ATF file. // BOOL WINAPI ATF_WriteDataRecordArrayFloat(int nFile, int nCount, float *pfVals, int *pnError) { ARRAYASSERT(pfVals, nCount); char psTemp[ATF_FLT_STR_LEN]; ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; if (nCount > pATF->nColumns) ERRORRETURN(pnError, ATF_ERROR_TOOMANYCOLS); char *pszIOBuffer = pATF->pszIOBuffer; // Check that we are in the correct state for this file if (pATF->eState < eDATAWRITTEN) { if (!UpdateHeaders(pATF, pnError)) return FALSE; pATF->eState = eDATAWRITTEN; } // Create the output string for this record char *ps = pszIOBuffer; *ps = '\0'; if (nCount > 0) { if (pATF->bDataOnLine) strcpy(ps++, pATF->szSeparator); if (!_FormatNumber((double)*pfVals++, ATF_FLT_SIG_DIGITS, psTemp, ATF_FLT_STR_LEN)) ERRORRETURN(pnError, ATF_ERROR_BADFLTCNV); strcpy(ps, psTemp); ps += strlen(psTemp); } for (int i=1; iszSeparator); ps += strlen(pATF->szSeparator); if (!_FormatNumber((double)*pfVals++, ATF_FLT_SIG_DIGITS, psTemp, ATF_FLT_STR_LEN)) ERRORRETURN(pnError, ATF_ERROR_BADFLTCNV); strcpy(ps, psTemp); ps += strlen(psTemp); } // Write out the text string to the file if (!putsBuf(pATF, pszIOBuffer)) ERRORRETURN(pnError, ATF_ERROR_IOERROR); // Set data-on-line flag pATF->bDataOnLine = TRUE; return TRUE; } //=============================================================================================== // FUNCTION: ATF_WriteDataRecord1 // PURPOSE: Writes a single double data item out to the ATF file. // BOOL WINAPI ATF_WriteDataRecord1(int nFile, double dNum1, int *pnError) { char psTemp[ATF_DBL_STR_LEN]; if (!_FormatNumber(dNum1, ATF_DBL_SIG_DIGITS, psTemp, ATF_DBL_STR_LEN)) ERRORRETURN(pnError, ATF_ERROR_BADFLTCNV); return ATF_WriteDataRecord(nFile, psTemp, pnError); } //=============================================================================================== // FUNCTION: ATF_WriteDataRecord1Float // PURPOSE: Writes a single float data item out to the ATF file. // BOOL WINAPI ATF_WriteDataRecord1Float(int nFile, float fNum1, int *pnError) { char psTemp[ATF_FLT_STR_LEN]; if (!_FormatNumber((double)fNum1, ATF_FLT_SIG_DIGITS, psTemp, ATF_FLT_STR_LEN)) ERRORRETURN(pnError, ATF_ERROR_BADFLTCNV); return ATF_WriteDataRecord(nFile, psTemp, pnError); } //=============================================================================================== // FUNCTION: GetComment // PURPOSE: Strips a comment string out of the data stream, removing separators and // double quotes. // static char *GetComment(char *pszStr) { // Strip off any leading or trailing space characters pszStr = StripSpaces(pszStr); // If nothing left, return. if (*pszStr=='\0') return pszStr; // Strip leading and trailing quotes from the string if (*pszStr == '"') { pszStr++; char *ps = pszStr; while (*ps && (*ps!='"')) ps++; if (*ps != '\0') *ps = '\0'; } return pszStr; } //=============================================================================================== // FUNCTION: ReadHeaderLine // PURPOSE: Reads an optional header line from the file. // static BOOL ReadHeaderLine(ATF_FILEINFO *pATF, int *pnError) { WPTRASSERT(pATF); // Check that we are in the correct state for this file if (pATF->eState > eHEADERED) ERRORRETURN(pnError, ATF_ERROR_BADSTATE); pATF->eState = eHEADERED; // Check if there are any more header records left to be read if (pATF->nHeaders < 1) ERRORRETURN(pnError, ATF_ERROR_NOMORE); // Read a header record and copy it into the return buffer if (!ReadLine(pATF, ATF_ERROR_BADHEADER, pnError)) return FALSE; // remove any trailing white space at the end of the line. StripSpaces(pATF->pszIOBuffer); pATF->nHeaders--; return TRUE; } //=============================================================================================== // FUNCTION: ATF_ReadHeaderLine // PURPOSE: Exported version of ReadHeaderLine. // BOOL WINAPI ATF_ReadHeaderLine(int nFile, char *psBuf, int nMaxLen, int *pnError) { ARRAYASSERT(psBuf, nMaxLen); ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; // Load the next line, checking state etc if (!ReadHeaderLine(pATF, pnError)) return FALSE; strncpyz(psBuf, pATF->pszIOBuffer, nMaxLen); return TRUE; } //=============================================================================================== // FUNCTION: ATF_ReadHeaderNoQuotes // PURPOSE: Reads a header record, stripping of any double quotes if present. // BOOL WINAPI ATF_ReadHeaderNoQuotes(int nFile, char *psBuf, int nMaxLen, int *pnError) { ARRAYASSERT(psBuf, nMaxLen); ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; // Load the next line, checking state etc if (!ReadHeaderLine(pATF, pnError)) return FALSE; // Strip off any leading and trailing quotes from the string char *psComment = GetComment(pATF->pszIOBuffer); strncpyz(psBuf, psComment, nMaxLen); return TRUE; } //=============================================================================================== // FUNCTION: ATF_GetColumnTitle // PURPOSE: Returns the title of a particular column in the ATF file. // BOOL WINAPI ATF_GetColumnTitle(int nFile, int nColumn, char *pszText, int nMaxTxt, int *pnError) { ARRAYASSERT(pszText, nMaxTxt); ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; // Check that the column number is within range. if ((nColumn < 0) || (nColumn >= pATF->nColumns)) ERRORRETURN(pnError, ATF_ERROR_BADCOLNUM); if (pATF->apszFileColTitles[nColumn] != NULL) strncpyz(pszText, pATF->apszFileColTitles[nColumn], nMaxTxt); else pszText[0] = '\0'; return TRUE; } //=============================================================================================== // FUNCTION: ATF_GetColumnUnits // PURPOSE: Returns the units of a particular column in the ATF file. // BOOL WINAPI ATF_GetColumnUnits(int nFile, int nColumn, char *pszText, int nMaxTxt, int *pnError) { ARRAYASSERT(pszText, nMaxTxt); ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; // Check that the column number is within range. if ((nColumn < 0) || (nColumn >= pATF->nColumns)) ERRORRETURN(pnError, ATF_ERROR_BADCOLNUM); if (pATF->apszFileColUnits[nColumn] != NULL) strncpyz(pszText, pATF->apszFileColUnits[nColumn], nMaxTxt); else pszText[0] = '\0'; return TRUE; } //=============================================================================================== // FUNCTION: ReadDataRecord // PURPOSE: Internal workhorse function for parsing lines out of the data stream. // static BOOL ReadDataRecord(ATF_FILEINFO *pATF, int *pnError) { WPTRASSERT(pATF); // Check that we are in the correct state for this file if (pATF->eState < eDATAREAD) { // Read any header records that were not processed while (pATF->nHeaders-- > 0) if (!ReadLine(pATF, ATF_ERROR_BADHEADER, pnError)) return FALSE; // Skip the column titles and units if (!ReadLine(pATF, ATF_ERROR_BADHEADER, pnError)) return FALSE; if (pATF->dFileVersion == 0.0) if (!ReadLine(pATF, ATF_ERROR_BADHEADER, pnError)) return FALSE; pATF->lDataPtr = SetFilePointerBuf(pATF, 0, NULL, FILE_CURRENT); pATF->eState = eDATAREAD; } // Update the file state and check for end-of-file // JT - we may need this: // if (feof(pATF->hFile)) // ERRORRETURN(pnError, ATF_ERROR_NOMORE); // Read the next record from the data file and return it // JT - we may need to reconsider what error we use here: // return ReadLine(pATF, ATF_ERROR_IOERROR, pnError); return ReadLine(pATF, ATF_ERROR_NOMORE, pnError); } //=============================================================================================== // FUNCTION: ATF_ReadDataRecord // PURPOSE: Returns the next complete line from the ATF file. // BOOL WINAPI ATF_ReadDataRecord(int nFile, char *pszText, int nMaxLen, int *pnError) { ARRAYASSERT(pszText, nMaxLen); ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; if (!ReadDataRecord(pATF, pnError)) return FALSE; strncpyz(pszText, pATF->pszIOBuffer, nMaxLen); return TRUE; } //=============================================================================================== // FUNCTION: ATF_ReadDataRecordArray // PURPOSE: Reads an array of data values from the ATF file. // BOOL WINAPI ATF_ReadDataRecordArray(int nFile, int nCount, double *pdVals, char *pszComment, int nMaxLen, int *pnError) { ARRAYASSERT(pdVals, nCount); ARRAYASSERT(pszComment, nMaxLen); ATF_FILEINFO *pATF = NULL; if (!GetFileDescriptor(&pATF, nFile, pnError)) return FALSE; // Perform the necessary checks and read the data record if (!ReadDataRecord(pATF, pnError)) return FALSE; // Read out the requested numbers char *ps = pATF->pszIOBuffer; for (int i=0; ipszIOBuffer; for (int i=0; ihFile, &CreationTime, NULL, NULL)) { FILETIME LocalTime = { 0 }; VERIFY(FileTimeToLocalFileTime(&CreationTime, &LocalTime)); VERIFY(FileTimeToSystemTime(&LocalTime, &Time)); } int nYear = int(Time.wYear); if (plDate) *plDate = long(nYear*10000 + Time.wMonth*100 + Time.wDay); if (plTime) *plTime = long(((Time.wHour*60) + Time.wMinute)*60 + Time.wSecond); #endif return TRUE; } stimfit-0.16.0/src/libstfio/abf/axon/AxAtfFio32/atfutil.h0000775000175000017500000000204613277303516017742 00000000000000/****************************************************************************\ * * * Written 1990 - 1995 by AXON Instruments Inc. * * * * This file is not protected by copyright. You are free to use, modify * * and copy the code in this file. * * * \****************************************************************************/ // // HEADER: ATFUTIL.H Prototypes for functions in ATFUTIL.CPP // AUTHOR: BHI Feb 1995 #ifndef __ATFUTIL_H__ #define __ATFUTIL_H__ #if !defined(_WINDOWS) || defined(__MINGW32__) int LoadString( HINSTANCE hInstance, int nErrorNum, char *sTxtBuf, UINT uMaxLen); #endif extern HINSTANCE g_hInstance; #if defined(_WINDOWS) && !defined(__MINGW32__) #include "./../Common/resource.h" #endif #endif stimfit-0.16.0/src/libstfio/abf/axon/AxAtfFio32/atfintl.h0000775000175000017500000000667513277303516017747 00000000000000//*********************************************************************************************** // // Written 1990 - 1996 by AXON Instruments Inc. // // This file is not protected by copyright. You are free to use, modify // and copy the code in this file. // //*********************************************************************************************** // // HEADER: ATFINTL.H // PURPOSE: Internal header file for the ATF file I/O routines. // enum eFILE_STATE { eCLOSED, eOPENED, eHEADERED, eDATAREAD, eDATAWRITTEN, eDATAAPPENDED, }; struct ATF_FILEINFO { HANDLE hFile; eFILE_STATE eState; BOOL bWriting; UINT uFlags; int nHeaders; long lFilePos; int nColumns; double dFileVersion; long lTitlesPtr; long lDataPtr; BOOL bDataOnLine; char szSeparator[2]; char ** apszFileColTitles; char ** apszFileColUnits; char * pszIOBuffer; char * pszFileName; int nIOBufferSize; // buffering: long lBufSize; char * pszBuf; // = lBufSize means no info is buffered long lPos; // current position in buffer - 0 means no info is buffered BOOL bRead; // TRUE = reading; FALSE = writing long lBufReadLimit; // actual amount read in when a full buffer is not available char cLineTerm; // The character that will terminate each line. }; typedef ATF_FILEINFO *PATF_FILEINFO; //----------------------------------------------------------------------------------------------- // Macros and functions to deal with returning error return codes through a pointer if given. #define ERRORRETURN(p, e) return ErrorReturn(p, e); inline BOOL ErrorReturn(int *pnError, int nErrorNum) { if (pnError) *pnError = nErrorNum; return FALSE; } //----------------------------------------------------------------------------------------------- #define MAX_READ_SIZE 512 #define GETS_OK 0 // Success! #define GETS_EOF 1 // End of file reached. #define GETS_ERROR 2 // I/O error #define GETS_NOEOL 3 // No end of line found. //----------------------------------------------------------------------------------------------- // declaration of low-level file I/O functions. HANDLE CreateFileBuf(ATF_FILEINFO *pATF, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ); BOOL CloseHandleBuf(ATF_FILEINFO *pATF); BOOL WriteFileBuf(ATF_FILEINFO *pATF, LPCVOID pvBuffer, DWORD dwBytes, DWORD *pdwWritten, LPOVERLAPPED lpOverlapped); BOOL ReadFileBuf(ATF_FILEINFO *pATF, LPVOID pvBuffer, DWORD dwBytes, DWORD *pdwRead, LPOVERLAPPED lpOverlapped); DWORD SetFilePointerBuf(ATF_FILEINFO *pATF, long lToMove, PLONG plDistHigh, DWORD dwMoveMethod); int getsBuf(ATF_FILEINFO *pATF, LPSTR pszString, DWORD dwToRead); int putsBuf(ATF_FILEINFO *pATF, LPCSTR pszString); stimfit-0.16.0/src/libstfio/abf/axon/AxAtfFio32/fileio2.cpp0000775000175000017500000006163613277303516020170 00000000000000//*********************************************************************************************** // // Written 1990 - 1996 by AXON Instruments Inc. // // This file is not protected by copyright. You are free to use, modify // and copy the code in this file. // //*********************************************************************************************** // // MODULE: FILEIO.CPP // PURPOSE: Low level routines for buffered file I/O. // // An ANSI C compiler should be used for compilation. // (e.g. CL -c AXATFFIO32.CPP) // #include "../Common/wincpp.hpp" #include "atfintl.h" #include "axatffio32.h" #include #if !defined(_WINDOWS) || defined(__MINGW32__) || defined(__STF__) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif #if defined(_MSC_VER) //=============================================================================================== // FUNCTION: _GetRootDir // PURPOSE: Extracts the root directory of a full or partial path. // FIXFIX: Fix this to cope with UNC names when GetDiskFreeSpace does. // static BOOL _GetRootDir(LPCSTR pszFileName, LPSTR pszRoot, UINT uRootLen) { // Build the path to the drive's root directory. char szRootDir[_MAX_DRIVE+2]; char szFullPath[_MAX_PATH], *pszTitle; GetFullPathNameA(pszFileName, sizeof(szFullPath), szFullPath, &pszTitle); if (!isalpha(szFullPath[0])) return FALSE; sprintf(szRootDir, "%c:\\", szFullPath[0]); strncpy(pszRoot, szRootDir, uRootLen-1); pszRoot[uRootLen-1] = '\0'; return TRUE; } #endif //=============================================================================================== // FUNCTION: _AllocReadWriteBuffer // PURPOSE: Allocate read/write buffers for this file // static BOOL AllocReadWriteBuffer(ATF_FILEINFO *pATF, DWORD dwDesiredAccess) { WPTRASSERT(pATF); // init all settings: pATF->lBufSize = 0L; pATF->lPos = 0L; pATF->lBufReadLimit = 0L; pATF->pszBuf = NULL; pATF->bRead = TRUE; // if querying only: if (dwDesiredAccess == 0) return TRUE; #if defined(_MSC_VER) char szRootDir[_MAX_DRIVE+2]; if (_GetRootDir(pATF->pszFileName, szRootDir, sizeof(szRootDir))) { DWORD dwSectorsPerCluster = 0; DWORD dwBytesPerSector = 0; DWORD dwNumberOfFreeClusters = 0; DWORD dwTotalNumberOfClusters = 0; GetDiskFreeSpaceA(szRootDir, &dwSectorsPerCluster, &dwBytesPerSector, &dwNumberOfFreeClusters, &dwTotalNumberOfClusters); pATF->lBufSize = min((dwSectorsPerCluster * dwBytesPerSector), (long)ATF_MAX_BUFFER_SIZE); ASSERT(pATF->lBufSize > 0); } else pATF->lBufSize = ATF_MAX_BUFFER_SIZE; #else pATF->lBufSize = ATF_MAX_BUFFER_SIZE; #endif // Allocate one more than the size for zero termination. pATF->pszBuf = (char *)calloc(pATF->lBufSize+1, sizeof(char)); if (pATF->pszBuf == NULL) { pATF->lBufSize = 0L; return FALSE; } pATF->lPos = pATF->lBufSize; // empty read buffer pATF->lBufReadLimit = pATF->lBufSize; return TRUE; } //=============================================================================================== // FUNCTION: _FreeReadWriteBuffer // PURPOSE: Free the read/write buffers used by this file; flushes write buffer to disk if necessary // static BOOL FreeReadWriteBuffer(ATF_FILEINFO *pATF) { WPTRASSERT(pATF); DWORD dwBytesWritten = 0; if (!pATF->bRead && pATF->lPos != 0L) #if defined(_MSC_VER) WriteFile(pATF->hFile, pATF->pszBuf, pATF->lPos, &dwBytesWritten, NULL); #else c_WriteFile((FILE*)pATF->hFile, pATF->pszBuf, pATF->lPos, &dwBytesWritten, NULL); #endif if (pATF->pszBuf) free(pATF->pszBuf); pATF->pszBuf = NULL; pATF->lBufSize = 0L; pATF->lPos = 0L; pATF->lBufReadLimit = 0L; pATF->bRead = TRUE; return TRUE; } //=============================================================================================== // FUNCTION: _CreateFileBuf // PURPOSE: Buffered version of CreateFile - creates appropriate buffers // PARAMETERS: // pATF Pointer to ATF_FILEINFO structure containing ATF state information (just filename at this point!) // ... CreateFile parms which we ignore (missing lpFileName - derived from pATF), except // for dwDesiredAccess. If GENERIC_READ or GENERIC_WRITE, we allocate a buffer // RETURNS: Handle of file; INVALID_HANDLE_VALUE if failure; HANDLE CreateFileBuf(ATF_FILEINFO *pATF, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ) { #if defined(_MSC_VER) pATF->hFile = CreateFileA(pATF->pszFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); #else pATF->hFile = c_CreateFile(pATF->pszFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); #endif if (pATF->hFile != INVALID_HANDLE_VALUE) { // allocate buffer, initialize flags: if (!AllocReadWriteBuffer(pATF, dwDesiredAccess)) { #if defined(_MSC_VER) CloseHandle(pATF->hFile); #else c_CloseHandle((FILE*)pATF->hFile); #endif pATF->hFile = INVALID_HANDLE_VALUE; } } return pATF->hFile; } //=============================================================================================== // FUNCTION: _CloseHandleBuf // PURPOSE: Buffered version of CloseHandle - flushes and cleans up buffers // PARAMETERS: // pATF Pointer to ATF_FILEINFO structure containing ATF state information (just filename at this point!) // RETURNS: TRUE on success; FALSE on failure BOOL CloseHandleBuf(ATF_FILEINFO *pATF) { BOOL bReturn = FreeReadWriteBuffer(pATF); #if defined(_MSC_VER) return CloseHandle(pATF->hFile) && bReturn; #else return c_CloseHandle((FILE*)pATF->hFile) && bReturn; #endif } //=============================================================================================== // FUNCTION: WriteFileBuf // PURPOSE: Buffered version of WriteFile // PARAMETERS: // pATF Pointer to ATF_FILEINFO structure containing ATF state information // pvBuffer Buffer containing data to be written // dwBytes Number of bytes to write // pdwWritten Pointer to DWORD used to catch the number of bytes written to the file // lpOverlapped Pointer to overlapped structure used to communicate requests of overlapped i/o (may be NULL) // RETURNS: // TRUE on success // FALSE on failure BOOL WriteFileBuf(ATF_FILEINFO *pATF, LPCVOID pvBuffer, DWORD dwBytes, DWORD *pdwWritten, LPOVERLAPPED lpOverlapped) { WPTRASSERT(pATF); long lBufSize = pATF->lBufSize; char *pszWriteBuf = pATF->pszBuf; // perform write if buffer size is 0: if (lBufSize == 0L) #if defined(_MSC_VER) return WriteFile(pATF->hFile, pvBuffer, dwBytes, pdwWritten, lpOverlapped); #else return c_WriteFile((FILE*)pATF->hFile, pvBuffer, dwBytes, pdwWritten, lpOverlapped); #endif // switch to write mode: if (pATF->bRead) { pATF->bRead = FALSE; pATF->lPos = 0; } // determine free size left in buffer: long lFreeSize = lBufSize - pATF->lPos; ASSERT(lFreeSize > 0L); // move up to a single buffer long lMoveSize = min((DWORD)lFreeSize, dwBytes); memcpy(pszWriteBuf + pATF->lPos, pvBuffer, lMoveSize); pATF->lPos += lMoveSize; // case 1: doesn't fill buffer if (pATF->lPos < lBufSize) { if (pdwWritten) *pdwWritten = dwBytes; return TRUE; } // write initial buffer - results handled in case 2 and 3: DWORD dwBytesWritten = 0; #if defined(_MSC_VER) BOOL bReturn = WriteFile(pATF->hFile, pszWriteBuf, lBufSize, &dwBytesWritten, lpOverlapped); #else BOOL bReturn = c_WriteFile((FILE*)pATF->hFile, pszWriteBuf, lBufSize, &dwBytesWritten, lpOverlapped); #endif // case 2: fills buffer, less than one buffer overflow (write one, move the rest) if (dwBytes - (DWORD)lMoveSize < (DWORD)lBufSize) { if (dwBytes - lMoveSize > 0L) memcpy(pszWriteBuf, ((BYTE *)pvBuffer + lMoveSize), dwBytes-lMoveSize); pATF->lPos = dwBytes - lMoveSize; if (pdwWritten) *pdwWritten = dwBytes; return bReturn; } // case 3: multiple buffer's worth (write mem buffer, write the remainder, reset internals) if (bReturn) { #if defined(_MSC_VER) bReturn = WriteFile(pATF->hFile, ((BYTE *)pvBuffer + lMoveSize), dwBytes - lMoveSize, &dwBytesWritten, lpOverlapped); #else bReturn = c_WriteFile((FILE*)pATF->hFile, ((BYTE *)pvBuffer + lMoveSize), dwBytes - lMoveSize, &dwBytesWritten, lpOverlapped); #endif if (pdwWritten) *pdwWritten = dwBytes; } else if (pdwWritten) *pdwWritten = dwBytesWritten; pATF->lPos = 0L; return bReturn; } //=============================================================================================== // FUNCTION: ReadFileBuf // PURPOSE: Buffered version of ReadFile // PARAMETERS: // pATF Pointer to ATF_FILEINFO structure containing ATF state information // pvBuffer Buffer to contain dwBytes read from file // dwBytes Number of bytes to read // pdwRead Pointer to DWORD used to catch the number of bytes written to the file // lpOverlapped Pointer to overlapped structure used to communicate requests of overlapped i/o (may be NULL) // RETURNS: // TRUE on success (*pdwRead == 0 -> EOF) // FALSE on failure (error condition) BOOL ReadFileBuf(ATF_FILEINFO *pATF, LPVOID pvBuffer, DWORD dwBytes, DWORD *pdwRead, LPOVERLAPPED lpOverlapped) { WPTRASSERT(pATF); // perform read if buffer size is 0: if (pATF->lBufSize == 0L) #if defined(_MSC_VER) return ReadFile(pATF->hFile, pvBuffer, dwBytes, pdwRead, lpOverlapped); #else return c_ReadFile((FILE*)pATF->hFile, pvBuffer, dwBytes, pdwRead, lpOverlapped); #endif // switch to read mode: if (!pATF->bRead) { DWORD dwBytesWritten; // commit current cache: if (pATF->lPos > 0L) #if defined(_MSC_VER) if (!WriteFile(pATF->hFile, pATF->pszBuf, pATF->lPos, &dwBytesWritten, NULL)) #else if (!c_WriteFile((FILE*)pATF->hFile, pATF->pszBuf, pATF->lPos, &dwBytesWritten, NULL)) #endif return FALSE; pATF->bRead = TRUE; pATF->lPos = pATF->lBufSize; pATF->lBufReadLimit = pATF->lBufSize; } DWORD dwBytesRead; BOOL bReturn; long lBufSize = pATF->lBufSize; char *pszReadBuf = pATF->pszBuf; // determine amount left in buffer: long lBytesInBuf = pATF->lBufReadLimit - pATF->lPos; ASSERT(lBytesInBuf >= 0L); // move up to a single buffer long lMoveSize = min((DWORD)lBytesInBuf, dwBytes); if (lMoveSize > 0L) { memcpy(pvBuffer, pszReadBuf + pATF->lPos, lMoveSize); pATF->lPos += lMoveSize; } // case 1: request doesn't run past the end of the buffer if (pATF->lPos < pATF->lBufReadLimit) { if (pdwRead) *pdwRead = dwBytes; return TRUE; } // case 2: request runs past end of buffer, and wants more than (or =) another buffer's worth: // (perform a full read; leaves buffer empty) if (dwBytes - (DWORD)lMoveSize >= (DWORD)pATF->lBufReadLimit) { #if defined(_MSC_VER) bReturn = ReadFile(pATF->hFile, ((BYTE *)pvBuffer + lMoveSize), dwBytes - lMoveSize, &dwBytesRead, lpOverlapped); #else bReturn = c_ReadFile((FILE*)pATF->hFile, ((BYTE *)pvBuffer + lMoveSize), dwBytes - lMoveSize, &dwBytesRead, lpOverlapped); #endif if (pdwRead) *pdwRead = lMoveSize + dwBytesRead; pATF->lPos = lBufSize; pATF->lBufReadLimit = lBufSize; return bReturn; } // case 3: request runs past end of buffer, and wants less than another buffer's worth: // (read in another buffer, copy wanted portion, advance lPos) #if defined(_MSC_VER) bReturn = ReadFile(pATF->hFile, pszReadBuf, lBufSize, &dwBytesRead, lpOverlapped); #else bReturn = c_ReadFile((FILE*)pATF->hFile, pszReadBuf, lBufSize, &dwBytesRead, lpOverlapped); #endif if (bReturn) { pATF->lBufReadLimit = dwBytesRead; int nMoveAmount = min((int)(dwBytes - lMoveSize), pATF->lBufReadLimit); memcpy((BYTE *)pvBuffer + lMoveSize, pszReadBuf, nMoveAmount); if (pdwRead) *pdwRead = lMoveSize + nMoveAmount; pATF->lPos = nMoveAmount; } else { if (pdwRead) *pdwRead = lMoveSize; pATF->lPos = lBufSize; } return bReturn; } //=============================================================================================== // FUNCTION: _SetFilePointerBuf // PURPOSE: Buffered version of SetFilePointer // PARAMETERS: // pATF Pointer to ATF_FILEINFO structure containing ATF state information // lToMove Amount to move from position specified in dwMoveMethod; negative means move backwards // plDistHigh High order word of 64-bit distance to move. Should be NULL // dwMoveMethod Method to move: FILE_BEGIN - move lToMove bytes from beginning of file // FILE_CURRENT - move lToMove bytes from current position // FILE_END - move lToMove bytes from end of file // RETURNS: Offset of new position from beginning of file (0xFFFFFFFF if failure) DWORD SetFilePointerBuf(ATF_FILEINFO *pATF, long lToMove, PLONG plDistHigh, DWORD dwMoveMethod) { WPTRASSERT(pATF); DWORD dwBytesWritten; // move real file position to lPos: if (pATF->bRead) { #if defined(_MSC_VER) if (SetFilePointer(pATF->hFile, pATF->lPos - pATF->lBufReadLimit, NULL, FILE_CURRENT) == 0xFFFFFFFF) #else if (c_SetFilePointer((FILE*)pATF->hFile, pATF->lPos - pATF->lBufReadLimit, NULL, FILE_CURRENT) == 0xFFFFFFFF) #endif return 0xFFFFFFFF; } // flush write buffer if non-empty - this positions the file pointer appropriately. else { if (pATF->lPos != 0L) { #if defined(_MSC_VER) if (!WriteFile(pATF->hFile, pATF->pszBuf, pATF->lPos, &dwBytesWritten, NULL)) #else if (!c_WriteFile((FILE*)pATF->hFile, pATF->pszBuf, pATF->lPos, &dwBytesWritten, NULL)) #endif return 0xFFFFFFFF; } } pATF->bRead = TRUE; pATF->lPos = pATF->lBufSize; pATF->lBufReadLimit = pATF->lBufSize; #if defined(_MSC_VER) return SetFilePointer(pATF->hFile, lToMove, plDistHigh, dwMoveMethod); #else return c_SetFilePointer((FILE*)pATF->hFile, lToMove, plDistHigh, dwMoveMethod); #endif } //=============================================================================================== // FUNCTION: SetLineTerminator // PURPOSE: Sets the line terminator to use on this file. // NOTES: This call assumes that if the file only contains \r characters as // line terminators, that there will be at least one '\r' in the first read of the file. // This should be reasonably safe as the first line of an ATF file should be "ATF\t1.0 \r". // inline char GetLineTerminator(LPSTR psz) { return strchr(psz, '\n') ? '\n' : '\r'; } //=============================================================================================== // FUNCTION: getsUnBuf // PURPOSE: Unbuffered version of gets // RETURNS: ZERO on success // GETS_EOF on EOF // GETS_ERROR on error // static int getsUnBuf(ATF_FILEINFO *pATF, LPSTR pszString, DWORD dwBufSize) { WPTRASSERT(pATF); ASSERT(dwBufSize > 1L); // Must be at least one character and a '\0'; DWORD dwToRead = dwBufSize; // Zero terminate the buffer at the last element and reduce the length count // to be sure that we are returning a zero term8inated string. dwToRead--; pszString[dwToRead] = '\0'; LPSTR pszThisRead = pszString; while (dwToRead > 0L) { // Do the read. DWORD dwBytesToRead = min(MAX_READ_SIZE, dwToRead); DWORD dwBytesRead = 0L; if (!ReadFileBuf(pATF, pszThisRead, dwBytesToRead, &dwBytesRead, NULL)) return GETS_ERROR; if (dwBytesRead == 0L) return GETS_EOF; // Zero terminate the read block after the last byte read. // No bounds problem because we predecremented the string size // up front to allow for a trailing '\0'. pszThisRead[dwBytesRead] = '\0'; // If the line terminator has not been set, set it now. if (pATF->cLineTerm == '\0') pATF->cLineTerm = GetLineTerminator(pszString); // look for a line terminator. LPSTR pszTerm = strchr(pszThisRead, pATF->cLineTerm); if (pszTerm) { // Zero out the terminator and step on past it. *pszTerm++ = '\0'; // Set the count of bytes to back up in the file. int nCount = (pszThisRead + dwBytesRead) - pszTerm; // adjust file position if we find a line terminator before the end of the buffer we have just read; if (nCount < 0) SetFilePointerBuf(pATF, nCount, NULL, FILE_CURRENT); break; } dwToRead -= dwBytesRead; pszThisRead += dwBytesRead; } // Take out the last character if it is '\r'. // (present if \r\n pairs terminate lines) int l = strlen(pszThisRead); if (l && (pszThisRead[l-1]=='\r')) { --l; pszThisRead[l] = '\0'; } return (DWORD(l) < dwBufSize-1) ? 0 : GETS_NOEOL; } //=============================================================================================== // FUNCTION: getsBuf // PURPOSE: Buffered version of gets -- line terminated are removed from the returned string. // RETURNS: ZERO on success // GETS_EOF on EOF // GETS_ERROR on error int getsBuf(ATF_FILEINFO *pATF, LPSTR pszString, DWORD dwBufSize) { WPTRASSERT(pATF); // ******************************************************************************* // check for unbuffered status: if (pATF->lBufSize == 0) return getsUnBuf(pATF, pszString, dwBufSize); DWORD dwToRead = dwBufSize; // ******************************************************************************* // switch to read mode, if necessary: if (!pATF->bRead) { DWORD dwBytesWritten; // commit current cache: if (pATF->lPos > 0) #if defined(_MSC_VER) if (!WriteFile(pATF->hFile, pATF->pszBuf, pATF->lPos, &dwBytesWritten, NULL)) #else if (!c_WriteFile((FILE*)pATF->hFile, pATF->pszBuf, pATF->lPos, &dwBytesWritten, NULL)) #endif return GETS_ERROR; pATF->bRead = TRUE; pATF->lPos = pATF->lBufSize; pATF->lBufReadLimit = pATF->lBufSize; } // ******************************************************************************* // process: dwToRead--; // for terminating 0 pszString[dwToRead] = '\0'; LPSTR pszReturnBuf = pszString; LPSTR pszReadBuf = pATF->pszBuf; while (dwToRead > 0L) { // determine amount left in buffer: long lBytesInBuf = pATF->lBufReadLimit - pATF->lPos; ASSERT(lBytesInBuf >= 0L); // move up to a single buffer long lMoveSize = min(lBytesInBuf, (long)dwToRead); if (lMoveSize > 0) { // look for a line terminator LPSTR pszStart = pszReadBuf + pATF->lPos; LPSTR pszTerm = strchr(pszStart, pATF->cLineTerm); // If found and inside the read range terminate the string and the read. if (pszTerm && (pszTerm < pszStart+lMoveSize)) { *pszTerm = '\0'; lMoveSize = pszTerm - pszStart + 1; // When the counter gets decremented below, the loop will terminate. dwToRead = lMoveSize; } // Copy the data into the return buffer. strncpy(pszReturnBuf, pszStart, lMoveSize); pszReturnBuf[lMoveSize] = '\0'; // Advance the buffer position pATF->lPos += lMoveSize; dwToRead -= lMoveSize; pszReturnBuf += lMoveSize; } else { // read another buffer if done with the current one: if (dwToRead > 0) // ie - we arrived here because lBytesInBuf == 0 { DWORD dwBytesRead; #if defined(_MSC_VER) if (!ReadFile(pATF->hFile, pszReadBuf, pATF->lBufSize, &dwBytesRead, NULL)) #else if (!c_ReadFile((FILE*)pATF->hFile, pszReadBuf, pATF->lBufSize, &dwBytesRead, NULL)) #endif return GETS_ERROR; if (dwBytesRead == 0) return GETS_EOF; if (dwBytesRead != (DWORD)pATF->lBufSize) pATF->lBufReadLimit = dwBytesRead; else pATF->lBufReadLimit = pATF->lBufSize; pATF->lPos = 0; // Zero terminate the read block after the last byte read. // No bounds problem because we allocated the I/O buffer to be one byte // more than pATF->lBufSize. pszReadBuf[dwBytesRead] = '\0'; // If the line terminator has not been set, set it now. if (pATF->cLineTerm == '\0') pATF->cLineTerm = GetLineTerminator(pszReadBuf); } } } // Take out the last character if it is '\r'. // (present if \r\n pairs terminate lines) int l = strlen(pszString); if (l && (pszString[l-1]=='\r')) { l--; pszString[l] = '\0'; } return (DWORD(l) < dwBufSize-1) ? 0 : GETS_NOEOL; } //=============================================================================================== // FUNCTION: putsBuf // PURPOSE: Buffered version of puts. // RETURNS: ZERO on success // GETS_EOF on EOF // GETS_ERROR on error int putsBuf(ATF_FILEINFO *pATF, LPCSTR pszString) { WPTRASSERT(pATF); DWORD dwBytes = strlen(pszString); DWORD dwBytesWritten; // perform write if buffer size is 0: if (pATF->lBufSize == 0L) #if defined(_MSC_VER) return WriteFile(pATF->hFile, pszString, dwBytes, &dwBytesWritten, NULL); #else return c_WriteFile((FILE*)pATF->hFile, pszString, dwBytes, &dwBytesWritten, NULL); #endif // switch to write mode: if (pATF->bRead) { pATF->bRead = FALSE; pATF->lPos = 0; } long lBufSize = pATF->lBufSize; char *pszWriteBuf = pATF->pszBuf; // determine free size left in buffer: long lFreeSize = lBufSize - pATF->lPos; ASSERT(lFreeSize > 0L); // move up to a single buffer long lMoveSize = min((DWORD)lFreeSize, dwBytes); memcpy(pszWriteBuf + pATF->lPos, pszString, lMoveSize); pATF->lPos += lMoveSize; // case 1: doesn't fill buffer if (pATF->lPos < lBufSize) return TRUE; // write initial buffer - results handled in case 2 and 3: #if defined(_MSC_VER) BOOL bReturn = WriteFile(pATF->hFile, pszWriteBuf, lBufSize, &dwBytesWritten, NULL); #else BOOL bReturn = c_WriteFile((FILE*)pATF->hFile, pszWriteBuf, lBufSize, &dwBytesWritten, NULL); #endif // case 2: fills buffer, less than one buffer overflow (write one, move the rest) if (dwBytes - (DWORD)lMoveSize < (DWORD)lBufSize) { pATF->lPos = dwBytes - lMoveSize; if (pATF->lPos > 0L) memcpy(pszWriteBuf, pszString + lMoveSize, pATF->lPos); return bReturn; } // case 3: multiple buffer's worth (write mem buffer, write the remainder, reset internals) if (bReturn) #if defined(_MSC_VER) bReturn = WriteFile(pATF->hFile, pszString + lMoveSize, dwBytes - lMoveSize, &dwBytesWritten, NULL); #else bReturn = c_WriteFile((FILE*)pATF->hFile, pszString + lMoveSize, dwBytes - lMoveSize, &dwBytesWritten, NULL); #endif pATF->lPos = 0L; return bReturn; } stimfit-0.16.0/src/libstfio/abf/axon/AxAtfFio32/axatffio32.h0000775000175000017500000001122113277303516020233 00000000000000/****************************************************************************\ * * * Written 1990 - 1996 by AXON Instruments Inc. * * * * This file is not protected by copyright. You are free to use, modify * * and copy the code in this file. * * * \****************************************************************************/ #ifndef INC_AXATFFIO32_H #define INC_AXATFFIO32_H #include "../Common/wincpp.hpp" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define VAL_EXTERNBUFSIZE 31 /* anybody calling methods using conversion */ // This is AXATFFIO32.H; a companion file to AXATFFIO32.CPP #define ATF_CURRENTVERSION 1.0 // Length required for I/O buffers #define ATF_MAXCOLUMNS 8000 // maximum size of read & write buffers (each can be this size) #define ATF_MAX_BUFFER_SIZE 65536 // Flags that may be combined and passed in the wFlags to ATF_OpenFile call #define ATF_WRITEONLY 0 #define ATF_READONLY 1 #define ATF_OVERWRTIFEXIST 2 #define ATF_APPENDIFEXIST 4 #define ATF_DONTWRITEHEADER 8 // Value returned as the file handle if the file could not be opened. #define ATF_INVALID_HANDLE -1 // Definitions for error results returned by AXATFFIO32 module #define ATF_SUCCESS 0 #define ATF_ERROR_NOFILE 1001 #define ATF_ERROR_TOOMANYFILES 1002 #define ATF_ERROR_FILEEXISTS 1003 #define ATF_ERROR_BADVERSION 1004 #define ATF_ERROR_BADFILENUM 1005 #define ATF_ERROR_BADSTATE 1006 #define ATF_ERROR_IOERROR 1007 #define ATF_ERROR_NOMORE 1008 #define ATF_ERROR_BADHEADER 1009 #define ATF_ERROR_NOMEMORY 1012 #define ATF_ERROR_TOOMANYCOLS 1013 #define ATF_ERROR_INVALIDFILE 1014 #define ATF_ERROR_BADCOLNUM 1015 #define ATF_ERROR_LINETOOLONG 1016 #define ATF_ERROR_BADFLTCNV 1017 #define ATF_ERROR_NOMESSAGESTR 2000 // These functions are not exported from the DLL version as they are called implicitly on load/unload. BOOL WINAPI ATF_Initialize(HINSTANCE hDLL); void WINAPI ATF_Cleanup(void); //---------------------- Exported Function Definitions ------------------------- BOOL WINAPI ATF_OpenFile(LPCSTR szFileName, UINT uFlags, int *pnColumns, int *pnFile, int *pnError); BOOL WINAPI ATF_CloseFile(int nFile); BOOL WINAPI ATF_SetSeperator(int nFile, BOOL bUseCommas, int *pnError); BOOL WINAPI ATF_IsAppending(int nFile); BOOL WINAPI ATF_RewindFile(int nFile, int *pnError); BOOL WINAPI ATF_CountDataLines(int nFile, long *plNumLines, int *pnError); BOOL WINAPI ATF_GetNumHeaders(int nFile, int *pnHeaders, int *pnError); BOOL WINAPI ATF_WriteHeaderRecord(int nFile, LPCSTR pszText, int *pnError); BOOL WINAPI ATF_SetColumnTitle(int nFile, LPCSTR pszText, int *pnError); BOOL WINAPI ATF_SetColumnUnits(int nFile, LPCSTR pszText, int *pnError); BOOL WINAPI ATF_WriteEndOfLine(int nFile, int *pnError); BOOL WINAPI ATF_WriteDataRecord(int nFile, LPCSTR pszText, int *pnError); BOOL WINAPI ATF_WriteDataComment(int nFile, LPCSTR pszText, int *pnError); BOOL WINAPI ATF_WriteDataRecordArray(int nFile, int nCount, double *pdVals, int *pnError); BOOL WINAPI ATF_WriteDataRecordArrayFloat(int nFile, int nCount, float *pfVals, int *pnError); BOOL WINAPI ATF_WriteDataRecord1(int nFile, double dNum1, int *pnError); BOOL WINAPI ATF_WriteDataRecord1Float(int nFile, float fNum1, int *pnError); BOOL WINAPI ATF_ReadHeaderLine(int nFile, char *psBuf, int nMaxLen, int *pnError); BOOL WINAPI ATF_ReadHeaderNoQuotes(int nFile, char *psBuf, int nMaxLen, int *pnError); BOOL WINAPI ATF_GetColumnTitle(int nFile, int nColumn, char *pszText, int nMaxTxt, int *pnError); BOOL WINAPI ATF_GetColumnUnits(int nFile, int nColumn, char *pszText, int nMaxTxt, int *pnError); BOOL WINAPI ATF_ReadDataRecord(int nFile, char *pszText, int nMaxLen, int *pnError); BOOL WINAPI ATF_ReadDataRecordArray(int nFile, int nCount, double *pdVals, char *pszComment, int nMaxLen, int *pnError); BOOL WINAPI ATF_ReadDataColumn(int nFile, int nColumn, double *pdVal, int *pnError); int WINAPI ATF_BuildErrorText(int nErrorNum, LPCSTR szFileName, char *sTxtBuf, int nMaxLen); BOOL WINAPI ATF_GetFileDateTime(int nFile, long *plDate, long *plTime, int *pnError); #ifdef __cplusplus } #endif #endif /* INC_AXATFFIO32_H */ stimfit-0.16.0/src/libstfio/abf/axon/Common/0000775000175000017500000000000013567226445015625 500000000000000stimfit-0.16.0/src/libstfio/abf/axon/Common/axodebug.h0000775000175000017500000003230113277303516017507 00000000000000//****************************************************************************** // // Copyright (c) 1993-1997 Axon Instruments. // All rights reserved. // //****************************************************************************** // HEADER: AXODEBUG.H // PURPOSE: Contains utility macros and defines for Axon development debugging. // AUTHOR: BHI Oct 1993 // // Debugging functions in WINDOWS.H // BOLL WINAPI IsWindow(HWND hWnd); // BOOL WINAPI IsGDIObject(HGDIOBJ hobj); // BOOL WINAPI IsBadReadPtr(const void *lp, UINT cb); // BOOL WINAPI IsBadWritePtr(void *lp, UINT cb); // BOOL WINAPI IsBadHugeReadPtr(const void _huge* lp, DWORD cb); // BOOL WINAPI IsBadHugeWritePtr(void _huge* lp, DWORD cb); // BOOL WINAPI IsBadCodePtr(FARPROC lpfn); // BOOL WINAPI IsBadStringPtr(const void *lpsz, UINT cchMax); // void WINAPI FatalExit(int nCode); // (nCode = -1 -> stack overflow) // void WINAPI FatalAppExit(UINT, LPCSTR); // void WINAPI DebugBreak(void); // void WINAPI OutputDebugString(LPCSTR); #ifndef __AXODEBUG_H__ #define __AXODEBUG_H__ #include #if defined(__WIN32__) && !defined(__MINGW32__) #include #endif #ifdef __cplusplus extern "C" { #endif // Setup the debug reporting callback. void AXODBG_Initialize(void); // Protected call to DebugBreak() that only breaks if a debugger is running. BOOL AXODBG_DebugBreak(void); // Prints a printf formatted string to the debug context. #ifdef __MINGW32__ int AXODBG_printf(char *lpsz, ... ); #else int cdecl AXODBG_printf(char *lpsz, ... ); #endif // Set a prefix string used for all subsequent calls to AXODBG_printf() void AXODBG_SetTracePrefix(char const * szNewTracePrefix); // You can set the prefix to anything, but usually you will want to set it to include the EXE and/or DLL name. // This function sets the prefix to "{App=foo} {Mod=bar} " // Call this function once from within your DllMain(), WinMain() or CWinApp::InitInstance() void AXODBG_SetTracePrefixFromModuleHandle(HMODULE mod_handle); // Prints a textual description of a WIN32 system error to the debug context. int AXODBG_ShowSystemError(DWORD dwSystemError); UINT AXODBG_GetSystemErrorText(DWORD dwSystemError, LPSTR pszBuf, UINT uMaxLen); // Returns TRUE if the given pointer is aligned on a multiple of the passed data size. BOOL AXODBG_IsAligned( void *pv, UINT uDataSize ); // Returns TRUE if the given pointer is not on the stack (rough check). // Typically this function should be used in the constructor of large objects to check // that they are not being allocated on the stack. // e.g. // CSomeObject::CSomeObject() // { // MEMBERASSERT(); // ASSERT_NOTONSTACK(this); // } BOOL AXODBG_NotOnStack( void *pv ); // Assertion processing. void AXODBG_assert(LPCSTR psExp, LPCSTR psFile, int nLine); void AXODBG_ErrorMsg(LPCSTR psFile, int nLine, LPCSTR pszFormat, ...); void AXODBG_SystemErrorMsg(DWORD dwSystemError, LPCSTR psFile, int nLine); // Define our own ASSERT macro that is only compiled into a _DEBUG build. // This gives us more control over where the error output gets displayed // than the default runtime version. #if !defined(ASSERT) #ifdef _STFDEBUG /* #define ASSERT(exp) (void)( (exp) || (AXODBG_assert(#exp, __FILE__, __LINE__), 0) )*/ #define ASSERT(exp) assert(exp) #else // #define ASSERT(exp) ((void)0) #define ASSERT(exp) assert(exp) #endif #endif // ASSERT // // The ERRORMSG macros are like a combination of an ASSERT and a TRACE macro. // They are typically useful for marking a code path that should never get executed // (e.g. default clause of switch statement) with a debug time message and the // option to break to the debugger. // #if !defined(ERRORMSG) #ifdef _STFDEBUG #define ERRORMSG(msg) AXODBG_ErrorMsg(__FILE__, __LINE__, msg) #define ERRORMSG1(msg,a) AXODBG_ErrorMsg(__FILE__, __LINE__, msg, a) #define ERRORMSG2(msg,a,b) AXODBG_ErrorMsg(__FILE__, __LINE__, msg, a, b) #define ERRORMSG3(msg,a,b,c) AXODBG_ErrorMsg(__FILE__, __LINE__, msg, a, b, c) #define ERRORMSG4(msg,a,b,c,d) AXODBG_ErrorMsg(__FILE__, __LINE__, msg, a, b, c, d) #define ERRORMSG5(msg,a,b,c,d,e) AXODBG_ErrorMsg(__FILE__, __LINE__, msg, a, b, c, d, e) #else #define ERRORMSG(msg) ((void)0) #define ERRORMSG1(msg,a) ((void)0) #define ERRORMSG2(msg,a,b) ((void)0) #define ERRORMSG3(msg,a,b,c) ((void)0) #define ERRORMSG4(msg,a,b,c,d) ((void)0) #define ERRORMSG5(msg,a,b,c,d,e) ((void)0) #endif #endif // ASSERT #if defined(_WINDOWS) && !defined(__MINGW32__) #define HWNDASSERT(hWnd) ASSERT(IsWindow(hWnd)) #define IsBadPtr(p) IsBadWritePtr((void *)(p), sizeof(*(p))) #define IsBadArray(p,n) IsBadWritePtr((void *)(p), sizeof(*(p))*(n)) #define RPTRASSERT(p) ASSERT(!IsBadReadPtr((const void *)(p), sizeof(*(p)))) #define FNPTRASSERT(p) ASSERT(!IsBadCodePtr((FARPROC)(p))) #define LPSZASSERT(p) ASSERT(!IsBadStringPtr(p, (UINT)(-1))) #else #define IsBadPtr(p) (p==NULL) #define IsBadArray(p,n) IsBadPtr(p) #define RPTRASSERT(p) ASSERT(!IsBadPtr(p)) #define FNPTRASSERT(p) ASSERT(!IsBadPtr(p)) #define LPSZASSERT(p) ASSERT(!IsBadPtr(p)) #endif #define WPTRASSERT(p) ASSERT(!IsBadPtr(p)) #define MEMBERASSERT() WPTRASSERT(this) #define ARRAYASSERT(p,n) ASSERT(!IsBadArray(p, n)) //================================================================================================================== // MACRO: // RARRAYASSERT(p,n) // WARRAYASSERT(p,n) // PURPOSE: // Validate an array by checking the caller has read access to the array. // PARAMETERS: // p The array // n The number of elements in the array (NOT the size in bytes) // USAGE: // int array[10]; // RARRAYASSERT(array, 10); #if defined(_WINDOWS) && !defined(__MINGW32__) #define RARRAYASSERT(p,n) ASSERT( ((p) != NULL) && !IsBadReadPtr( (const void *)(p), sizeof(*(p))*(n) ) ) #define WARRAYASSERT(p,n) ASSERT( ((p) != NULL) && !IsBadWritePtr( (void *)(p), sizeof(*(p))*(n) ) ) #else #define RARRAYASSERT(p,n) ASSERT(!IsBadPtr(p)) #define WARRAYASSERT(p,n) ASSERT(!IsBadPtr(p)) #endif //================================================================================================================== // VERIFY is an ASSERT macro that always evaluates the given expression, but // only actually ASSERT's in a DEBUG build. #if !defined(VERIFY) #ifdef _STFDEBUG #define VERIFY(exp) ASSERT(exp) #else #define VERIFY(exp) (exp) #endif #endif //================================================================================================================== // The DEBUG_ONLY macro only expands out the expression in a DEBUG build. #if !defined(DEBUG_ONLY) #ifdef _STFDEBUG #define DEBUG_ONLY(exp) (exp) #else #define DEBUG_ONLY(exp) ((void)0) #endif #endif //================================================================================================================== // Trace functions that are only expanded for debug builds and when the AXODBG_TRACE flag is set. #if !defined(TRACE) #if (defined(_STFDEBUG) || defined(AXODBG_TRACE)) #define TRACE(s) AXODBG_printf(s) #define DLLTRACE(s) AXODBG_printf(s) #define TRACE1(s, a) AXODBG_printf(s, a) #define TRACE2(s, a, b) AXODBG_printf(s, a, b) #define TRACE3(s, a, b, c) AXODBG_printf(s, a, b, c) #define TRACE4(s, a, b, c, d) AXODBG_printf(s, a, b, c, d) #define TRACE5(s, a, b, c, d, e) AXODBG_printf(s, a, b, c, d, e) #else #define TRACE(s) ((void)0) #define DLLTRACE(s) ((void)0) #define TRACE1(s, a) ((void)0) #define TRACE2(s, a, b) ((void)0) #define TRACE3(s, a, b, c) ((void)0) #define TRACE4(s, a, b, c, d) ((void)0) #define TRACE5(s, a, b, c, d, e) ((void)0) #endif #endif #define TRACE_INT(e) TRACE1(#e "=%d\n", e) #define TRACE_FLOAT(e) TRACE1(#e "=%g\n", e) #define TRACE_STRING(e) TRACE1(#e "=%s\n", e) //================================================================================================================== // SHOW_SYSTEM_ERROR will only dump a text description of a system error in a DEBUG build. // #ifdef _STFDEBUG #define SHOW_SYSTEM_ERROR(dwError) AXODBG_ShowSystemError(dwError) #else #define SHOW_SYSTEM_ERROR(dwError) ((void)0) #endif //================================================================================================================== // VERIFY_SYSTEM_CALL will only dump a text description of a system error in a DEBUG build. // #ifdef _STFDEBUG #define VERIFY_SYSTEM_CALL(exp) (exp || (AXODBG_SystemErrorMsg(0, __FILE__, __LINE__), 0)) #else #define VERIFY_SYSTEM_CALL(exp) (exp) #endif //================================================================================================================== // ASSERT_ISALIGNED will throw an assertion error if the pointer is not aligned on a boundary of its data type. // #ifdef _STFDEBUG #define ASSERT_ISALIGNED(p) ASSERT(AXODBG_IsAligned(p, sizeof(*p))) #define ASSERT_NOTONSTACK(p) ASSERT(AXODBG_NotOnStack(p)) #else #define ASSERT_ISALIGNED(p) ((void)0) #define ASSERT_NOTONSTACK(p) ((void)0) #endif //================================================================================================================== // The following macros set and clear, respectively, given bits // of the C runtime library debug flag, as specified by a bitmask. // // Valid flags include: (default value) // _CRTDBG_ALLOC_MEM_DF (on) // ON: Enable debug heap allocations and use of memory block type identifiers, such as _CLIENT_BLOCK. // OFF: Add new allocations to heap's linked list, but set block type to _IGNORE_BLOCK. // _CRTDBG_CHECK_ALWAYS_DF (off) // ON: Call _CrtCheckMemory at every allocation and deallocation request. // OFF: _CrtCheckMemory must be called explicitly. // _CRTDBG_CHECK_CRT_DF (off) // ON: Include _CRT_BLOCK types in leak detection and memory state difference operations. // OFF: Memory used internally by the run-time library is ignored by these operations. // _CRTDBG_DELAY_FREE_MEM_DF (off) // ON: Keep freed memory blocks in the heap's linked list, assign them the _FREE_BLOCK type, and fill them with the byte value 0xDD. // OFF: Do not keep freed blocks in the heap's linked list. // _CRTDBG_LEAK_CHECK_DF (off) // ON: Perform automatic leak checking at program exit via a call to _CrtDumpMemoryLeaks and generate an error report if the application failed to free all the memory it allocated. // OFF: Do not automatically perform leak checking at program exit. // #ifdef _STFDEBUG #define SET_CRT_DEBUG_FIELD(a) \ _CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)) #define CLEAR_CRT_DEBUG_FIELD(a) \ _CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)) #else #define SET_CRT_DEBUG_FIELD(a) ((void)0) #define CLEAR_CRT_DEBUG_FIELD(a) ((void)0) #endif //================================================================================================================== // HEAPASSERT checks the integrity of the heap managed by the run-time library. // #ifdef _STFDEBUG #define HEAPASSERT() ASSERT(_CrtCheckMemory()) #else #define HEAPASSERT() ((void)0) #endif //================================================================================================================== // Flags supported by AXODBG_SetDebugFlag. #define AXODBG_REPORT_FLAG 0x80000000 // If this flag is set the current flags are returned. #define AXODBG_BREAK_ON_ASSERT 0x00000001 // If set, assertion failures will immediately break to the debugger. // Function to set/get debugging flags modeled after _CrtSetDbgFlag(). DWORD AXODBG_SetDebugFlag(DWORD dwFlags); #ifdef _STFDEBUG #define AXODBG_SET_DEBUG_FIELD(a) \ AXODBG_SetDebugFlag((a) | AXODBG_SetDebugFlag(AXODBG_REPORT_FLAG)) #define AXODBG_CLEAR_DEBUG_FIELD(a) \ AXODBG_SetDebugFlag(~(a) & AXODBG_SetDebugFlag(AXODBG_REPORT_FLAG)) #else #define AXODBG_SET_DEBUG_FIELD(a) ((void)0) #define AXODBG_CLEAR_DEBUG_FIELD(a) ((void)0) #endif //================================================================================================================== // Debug time only call to AXODBG_DebugBreak() #ifdef _STFDEBUG #define AXODBG_DEBUGBREAK() AXODBG_DebugBreak() #else #define AXODBG_DEBUGBREAK() ((BOOL)FALSE) #endif #ifdef __cplusplus } #endif #ifdef __cplusplus //================================================================================================================== // Compile time assert for static expressions // (e.g. STATIC_ASSERT(sizeof(MyStruct)==256); ) // #define STATIC_ASSERT(expr) C_ASSERT(expr) #endif #endif /* __AXODEBUG_H__ */ stimfit-0.16.0/src/libstfio/abf/axon/Common/FileReadCache.hpp0000775000175000017500000000467713567226230020666 00000000000000//*********************************************************************************************** // // Copyright (c) 1996-1997 Axon Instruments. // All rights reserved. // //*********************************************************************************************** // HEADER: FileReadCache.HPP // PURPOSE: Contains class definition for CFileReadCache for creating and maintaining a BufferedArray array. // AUTHOR: BHI Dec 1996 // #ifndef INC_FILEREADCACHE_HPP #define INC_FILEREADCACHE_HPP #include "./../Common/FileIO.hpp" #if (__cplusplus < 201402L) # include #else # include #endif //----------------------------------------------------------------------------------------------- // CFileReadCache class definition class CFileReadCache { private: UINT m_uItemSize; // Size of all data items (structures) CFileIO m_File; // DOS file handle to the read-only data. UINT m_uItemCount; // Number of items available in the file LONGLONG m_llFileOffset; // Start offset in the file. UINT m_uCacheSize; UINT m_uCacheStart; UINT m_uCacheCount; #if (__cplusplus < 201402L) boost::shared_array m_pItemCache; #else std::shared_ptr m_pItemCache; #endif private: // Unimplemented default member functions. // Declare but don't define copy constructors to prevent use of defaults. CFileReadCache(const CFileReadCache &CS); const CFileReadCache &operator=(const CFileReadCache &CS); private: BOOL LoadCache(UINT uEntry); public: // Public member functions CFileReadCache(); ~CFileReadCache(); // Call this function to initialize the DTB and the temp file. BOOL Initialize(UINT uItemSize, UINT uCacheSize, FILEHANDLE hFile, LONGLONG llOffset, UINT uItems ); // Get one or more items from the array. BOOL Get( UINT uFirstEntry, void *pItem, UINT uEntries ); // Get a pointer to one entry in the cache. void *Get( UINT uEntry ); // Get the count of items in the file. UINT GetCount() const; }; //=============================================================================================== // PROCEDURE: GetCount // PURPOSE: Returns the current count of ITEMs, both cached and written to file. // inline UINT CFileReadCache::GetCount() const { // MEMBERASSERT(); return m_uItemCount; } #endif // INC_FILEREADCACHE_HPP stimfit-0.16.0/src/libstfio/abf/axon/Common/resource.h0000775000175000017500000000145113277303516017542 00000000000000//{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by axabffio32.rc // #define IDS_EPITAGHEADINGS 1 #define IDS_CONTTAGHEADINGS 2 #define IDS_NONE 3 #define IDS_ENOMESSAGESTR 4 #define IDS_MATHCHANNEL 5 #define IDS_CANNOTLOAD 6 #define IDD_VOICETAGCLEANUP 119 #define IDC_PROGRESS 1001 #define IDC_TAGNUMBER 2053 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 105 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1002 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif stimfit-0.16.0/src/libstfio/abf/axon/Common/wincpp.hpp0000775000175000017500000000130613277303516017552 00000000000000//********************************************************************************************** // // Copyright (c) 1993 Axon Instruments. // All rights reserved. // //********************************************************************************************** // HEADER: WINCPP.HPP // PURPOSE: Contains common includes. Used for generation of precompiled headers. // AUTHOR: BHI Nov 1993 // #include "../Common/axodefn.h" #include "../Common/axodebug.h" /* #include "../Common/colors.h" */ #include "../Common/adcdac.h" #include #include #include #include #include /* #include */ #include stimfit-0.16.0/src/libstfio/abf/axon/Common/unix.h0000775000175000017500000001553213277303516016703 00000000000000// Windows macros to compile on Unix machines. // Taken from MSDOS.H and from various wine headers. // Only the absolute minimum has been integrated. // 2007, CSH, University of Freiburg // Error return from SetFilePointer() #ifndef INVALID_SEEK_VALUE #define INVALID_SEEK_VALUE (0xFFFFFFFF) #endif #define FILE_NULL NULL #define IDS_ENOMESSAGESTR 4 #ifdef __cplusplus extern "C" { #endif #if defined(_MSC_VER) #include #include typedef HANDLE FILEHANDLE; #include "resource.h" #define __LITTLE_ENDIAN__ #else #ifdef __APPLE__ #include #elif defined(__MINGW32__) #define __LITTLE_ENDIAN__ #else #include #endif #ifndef INVALID_HANDLE_VALUE #define INVALID_HANDLE_VALUE ((HANDLE)0xFFFFFFFF) #endif #include "../AxAbfFio32/AxAbffio32.h" #include typedef FILE* FILEHANDLE; // // Commonly used typedefs & constants from windows.h. // typedef unsigned char BYTE; typedef unsigned short WORD; typedef unsigned ABFLONG DWORD; typedef unsigned ABFLONG *LPDWORD; typedef unsigned int UINT; typedef int INT; typedef int BOOL; typedef long *PLONG; typedef unsigned char *LPBYTE; typedef void *LPVOID; typedef const void *LPCVOID; // // Basics // #ifndef VOID #define VOID void typedef char CHAR; typedef short SHORT; typedef long LONG; #endif // // UNICODE (Wide Character) types // #ifndef _MAC typedef wchar_t WCHAR; // wc, 16-bit UNICODE character #else // some Macintosh compilers don't define wchar_t in a convenient location, or define it as a char typedef unsigned short WCHAR; // wc, 16-bit UNICODE character #endif typedef WCHAR *PWCHAR; typedef WCHAR *LPWCH, *PWCH; typedef const WCHAR *LPCWCH, *PCWCH; typedef WCHAR *NWPSTR; typedef WCHAR *LPWSTR, *PWSTR; typedef const WCHAR *LPCWSTR, *PCWSTR; // // ANSI (Multi-byte Character) types // typedef CHAR *PCHAR; typedef CHAR *LPCH, *PCH; typedef const CHAR *LPCCH, *PCCH; typedef CHAR *NPSTR; typedef CHAR *LPSTR, *PSTR; typedef const CHAR *LPCSTR, *PCSTR; // // Neutral ANSI/UNICODE types and macros // #if defined(__MINGW32__) #include #include #include #else #if defined(UNICODE) // r_winnt #ifndef _TCHAR_DEFINED typedef WCHAR TCHAR, *PTCHAR; typedef WCHAR TBYTE , *PTBYTE ; #define _TCHAR_DEFINED #endif /* !_TCHAR_DEFINED */ typedef LPWSTR LPTCH, PTCH; typedef LPWSTR PTSTR, LPTSTR; typedef LPCWSTR LPCTSTR; typedef LPWSTR LP; #define __TEXT(quote) L##quote // r_winnt #else /* UNICODE */ // r_winnt #ifndef _TCHAR_DEFINED typedef char TCHAR, *PTCHAR; typedef unsigned char TBYTE , *PTBYTE ; #define _TCHAR_DEFINED #endif /* !_TCHAR_DEFINED */ typedef LPSTR LPTCH, PTCH; typedef LPSTR PTSTR, LPTSTR; typedef LPCSTR LPCTSTR; #define __TEXT(quote) quote // r_winnt #endif /* UNICODE */ // r_winnt // Handle declarations. typedef void *HANDLE; typedef HANDLE HINSTANCE; typedef HINSTANCE HMODULE; typedef void *LPOVERLAPPED; typedef void *LPSECURITY_ATTRIBUTES; typedef long long LONGLONG; #if defined(_WIN64) typedef unsigned __int64 UINT_PTR; #else typedef unsigned int UINT_PTR; #endif #endif // #define DWORD_PTR UINT_PTR #define FILE_BEGIN 0 #define FILE_CURRENT 1 #define FILE_END 2 #define FILE_ATTRIBUTE_NORMAL 0x00000080 #define GENERIC_READ 0x80000000 #define GENERIC_WRITE 0x40000000 #define CREATE_NEW 1 #define CREATE_ALWAYS 2 #define OPEN_EXISTING 3 #define FILE_SHARE_READ 0x00000001L #define NO_ERROR 0 #define ERROR_HANDLE_EOF 38 #define TRUE 1 #define FALSE 0 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF)) #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF)) #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) #ifndef _MAX_PATH #define _MAX_DRIVE 3 #define _MAX_FNAME 256 #define _MAX_DIR _MAX_FNAME #define _MAX_EXT _MAX_FNAME #define _MAX_PATH 260 #endif #define ERROR_TOO_MANY_OPEN_FILES 4 // #define __stdcall __attribute__((__stdcall__)) #if !defined(__MINGW32__) #define __stdcall #endif // gcc uses cdecl as a standard: #define cdecl #define WINAPI __stdcall #ifndef GUID_DEFINED typedef struct _GUID { // TODO: for WIN64 this need to be redefined unsigned int Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[ 8 ]; } GUID; #define GUID_DEFINED #endif void _splitpath(const char* inpath, char * drv, char * dir, char* fname, char * ext ); int _strnicmp( LPCSTR str1, LPCSTR str2, size_t n ); void _makepath( char * path, const char * drive, const char *directory, const char * filename, const char * extension ); #if !defined(__MINGW32__) /* 64 bit number of 100 nanoseconds intervals since January 1, 1601 */ typedef struct _FILETIME { #ifdef __BIG_ENDIAN__ DWORD dwHighDateTime; DWORD dwLowDateTime; #else DWORD dwLowDateTime; DWORD dwHighDateTime; #endif } FILETIME, *PFILETIME, *LPFILETIME; typedef struct _SYSTEMTIME{ WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds; } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME; #endif // __MINGW32__ #endif // _MSC_VER extern HINSTANCE g_hInstance; // // Function wrappers // int WINAPI AXODBG_printf(char *lpsz, ... ); BOOL WINAPI c_WriteFile( FILEHANDLE hFile, LPCVOID buffer, DWORD bytesToWrite, LPDWORD bytesWritten, LPOVERLAPPED overlapped ); FILEHANDLE WINAPI c_CreateFile( LPCSTR filename, DWORD access, DWORD sharing, LPSECURITY_ATTRIBUTES sa, DWORD creation, DWORD attributes_, HANDLE templ); DWORD WINAPI c_SetFilePointer( FILEHANDLE hFile, LONG distance, LONG *highword, DWORD method ); BOOL WINAPI c_ReadFile( FILEHANDLE hFile, LPVOID buffer, DWORD bytesToRead, LPDWORD bytesRead, LPOVERLAPPED overlapped ); DWORD WINAPI c_GetFileSize( FILEHANDLE hFile, LPDWORD filesizehigh ); BOOL WINAPI c_CloseHandle( FILEHANDLE handle ); INT WINAPI c_LoadString( HINSTANCE instance, UINT resource_id, LPSTR buffer, INT buflen ); #ifdef __cplusplus } #endif stimfit-0.16.0/src/libstfio/abf/axon/Common/colors.h0000775000175000017500000000354713277303516017224 00000000000000//**************************************************************************************** // // Copyright (c) 1993-1997 Axon Instruments. // All rights reserved. // //**************************************************************************************** // HEADER: COLORS.H // PURPOSE: Contains RGB definitions for VGA solid colors. #ifndef __COLORS_H__ #define __COLORS_H__ #ifndef RGB #define RGB(r,g,b) ((DWORD)(((BYTE)(r)|((WORD)(g)<<8))|(((DWORD)(BYTE)(b))<<16))) #endif // // MS name #ifndef RGB_BLACK #define RGB_WHITE RGB(255,255,255) // White #define RGB_VLTGRAY RGB(224,224,224) #define RGB_LTGRAY RGB(192,192,192) // Silver #define RGB_DKGRAY RGB(128,128,128) // Gray #define RGB_VDKGRAY RGB(96,96,96) #define RGB_BLACK RGB(0,0,0) // Black #define RGB_VLTYELLOW RGB(255,255,192) // #define RGB_LTYELLOW RGB(255,255,128) // #define RGB_YELLOW RGB(255,255,0) // Yellow #define RGB_ORANGE RGB(255,128,0) // ???? #define RGB_DKYELLOW RGB(128,128,0) // Olive? #define RGB_BLUE RGB(0,0,255) // Blue #define RGB_LTBLUE RGB(0,255,255) // Cyan #define RGB_DKBLUE RGB(0,0,128) // Navy #define RGB_BLUEGRAY RGB(0,128,128) // Teal #define RGB_AQUAMARINE RGB(64,128,128) // #define RGB_PURPLE RGB(64,0,128) // #define RGB_DKRED RGB(128,0,0) // Maroon #define RGB_MAUVE RGB(128,0,128) // Purple #define RGB_RED RGB(255,0,0) // Red #define RGB_PINK RGB(255,0,128) // ???? #define RGB_LTPINK RGB(255,0,255) // Magenta or Fuschia #define RGB_GREEN RGB(0,255,0) // Lime #define RGB_DKGREEN RGB(0,128,0) // MS-Green #endif // RGB_BLACK #endif /* __COLORS_H__ */ stimfit-0.16.0/src/libstfio/abf/axon/Common/FileReadCache.cpp0000775000175000017500000001145313277303516020650 00000000000000//*********************************************************************************************** // // Copyright (c) 1996-1997 Axon Instruments. // All rights reserved. // //*********************************************************************************************** // MODULE: FileReadCache.cpp // PURPOSE: Contains class implementation for CFileReadCache. // AUTHOR: BHI Apr 1998 // #include "wincpp.hpp" #include "FileReadCache.hpp" #if !defined(_WINDOWS) || defined(__MINGW32__) || defined(__STF__) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif //=============================================================================================== // PROCEDURE: CFileReadCache // PURPOSE: Constructor. // CFileReadCache::CFileReadCache() { //MEMBERASSERT(); // Initialize the internal variables. m_uItemSize = 0; // Size of all data items (structures) m_uItemCount = 0; // Number of items available m_llFileOffset = 0; // Start offset in the file. m_uCacheSize = 0; m_uCacheStart = 0; m_uCacheCount = 0; m_pItemCache.reset((BYTE*)0); } //=============================================================================================== // PROCEDURE: ~CFileReadCache // PURPOSE: Destructor. Closes the temporary file and deletes it. // CFileReadCache::~CFileReadCache() { //MEMBERASSERT(); m_File.Release(); // delete[] m_pItemCache; // m_pItemCache = NULL; } //=============================================================================================== // PROCEDURE: Initialize // PURPOSE: Gets a unique filename and opens it as a temporary file. // BOOL CFileReadCache::Initialize(UINT uItemSize, UINT uCacheSize, FILEHANDLE hFile, LONGLONG llOffset, UINT uItems ) { //MEMBERASSERT(); //ASSERT(uItems > 0); m_uItemSize = uItemSize; m_uCacheSize = min(uCacheSize, uItems); m_uItemCount = uItems; m_llFileOffset = llOffset; m_File.SetFileHandle(hFile); m_uCacheSize = uCacheSize; m_uCacheStart = 0; m_uCacheCount = 0; m_pItemCache.reset(new BYTE[uItemSize * uCacheSize]); return (m_pItemCache.get() != NULL); } //=============================================================================================== // PROCEDURE: Get // PURPOSE: Retrieves one or more ITEMs from the virtualized array. // BOOL CFileReadCache::Get( UINT uFirstEntry, void *pvItems, UINT uEntries ) { //MEMBERASSERT(); //ASSERT(m_File.IsOpen()); //ASSERT(uFirstEntry+uEntries <= GetCount()); //ASSERT(uEntries > 0); BYTE *pItems = (BYTE *)pvItems; //ARRAYASSERT(pItems, uEntries * m_uItemSize); while (uEntries) { // Make sure that the first item is in the cache. if (!LoadCache(uFirstEntry)) return FALSE; // Calculate which portion of the cache we want. UINT uStart = uFirstEntry - m_uCacheStart; UINT uCopy = m_uCacheStart + m_uCacheCount - uFirstEntry; if (uCopy > uEntries) uCopy = uEntries; // Copy the data out. UINT uBytes = uCopy * m_uItemSize; memcpy(pItems, m_pItemCache.get() + uStart * m_uItemSize, uBytes); // Update the pointers. pItems += uBytes; uEntries -= uCopy; uFirstEntry += uCopy; } return TRUE; } //=============================================================================================== // PROCEDURE: Get // PURPOSE: Get a pointer to one entry in the cache. // void *CFileReadCache::Get( UINT uEntry ) { //MEMBERASSERT(); //ASSERT(m_File.IsOpen()); //ASSERT(uEntry < GetCount()); // Make sure that the item is in the cache. if (!LoadCache(uEntry)) return NULL; // return a pointer to the item. return m_pItemCache.get() + (uEntry - m_uCacheStart) * m_uItemSize; } //=============================================================================================== // PROCEDURE: LoadCache // PURPOSE: If an entry is not in the cache, the cache is reloaded from disk. // BOOL CFileReadCache::LoadCache(UINT uEntry) { //MEMBERASSERT(); //ASSERT(m_File.IsOpen()); if ((uEntry >= m_uCacheStart) && (uEntry < m_uCacheStart+m_uCacheCount)) return TRUE; // Set the cache at the start of the cache size block that includes the requested item m_uCacheStart = uEntry - (uEntry % m_uCacheSize); m_uCacheCount = min(m_uItemCount-m_uCacheStart, m_uCacheSize); // seek to the start point. if (!m_File.Seek(m_uCacheStart * m_uItemSize + m_llFileOffset, FILE_BEGIN)) return FALSE; // Read the items from the file. return m_File.Read(m_pItemCache.get(), m_uCacheCount * m_uItemSize); } stimfit-0.16.0/src/libstfio/abf/axon/Common/adcdac.h0000775000175000017500000000345513277303516017120 00000000000000/************************************************************************************************ ** ** Copyright (c) 1994-1997 Axon Instruments. ** All rights reserved. ** ************************************************************************************************* ** HEADER: ADCDAC.H ** PURPOSE: Contains #defines for working with ADC and DAC values. ** AUTHOR: BHI Jul 1994 */ #ifndef INC_ADCDAC_H #define INC_ADCDAC_H // // ADC values are 16 bit integers collected from Analog-to-Digital converters // #define ADC_MAX 32767 #define ADC_MIN -32768 typedef short ADC_VALUE; // // DAC values are 16 bit integers for output by Digital-to-Analog converters // #define DAC_MAX 32767 #define DAC_MIN -32768 typedef short DAC_VALUE; // // Define a linked list structure for holding acquisition buffers. // struct DATABUFFER { UINT uNumSamples; // Number of samples in this buffer. UINT uFlags; // Flags discribing the data buffer. ADC_VALUE *pnData; // The buffer containing the data. BYTE *psDataFlags; // Flags split out from the data buffer. DATABUFFER *pNextBuffer; // Next buffer in the list. DATABUFFER *pPrevBuffer; // Previous buffer in the list. }; typedef DATABUFFER *PDATABUFFER; // // Define a linked list structure for holding floating point acquisition buffers. // struct FLOATBUFFER { UINT uNumSamples; // Number of samples in this buffer. UINT uFlags; // Flags discribing the data buffer. float *pfData; // The buffer containing the data. FLOATBUFFER *pNextBuffer; // Next buffer in the list. FLOATBUFFER *pPrevBuffer; // Previous buffer in the list. }; typedef FLOATBUFFER *PFLOATBUFFER; #endif // INC_ADCDAC_H stimfit-0.16.0/src/libstfio/abf/axon/Common/FileIO.cpp0000775000175000017500000004310013277303516017352 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-1997 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // // MODULE: FileIO.CPP // PURPOSE: Contains the member functions for the CFileIO class. // NOTES: // // Overlapped file I/O is not available in WIN95 -- PSS ID Number: Q125717 // Windows 95 does not support overlapped operations on files, disk, pipes, or // mail slots, but does support overlapped operations on serial and parallel // communication ports. Non-overlapped file write operations are similar to // overlapped file writes, because Windows 95 uses a lazy-write disk cache. // Overlapped I/O can be implemented in a Win32-based application by creating // multiple threads to handle I/O. // // Asynchronous I/O on files, disk, pipes and mail slots is not implemented in // Windows 95. If a Win32-based application running on Windows 95 attempts to // perform asynchronous file I/O (such as ReadFile() with any value other than // NULL in the lpOverlapped field) on any of these objects, the ReadFile() or // WriteFile fails and GetLastError() returns ERROR_INVALID_PARAMETER (87). // #include "wincpp.hpp" #include "FileIO.hpp" //=============================================================================================== // FUNCTION: Constructor // PURPOSE: Initialize the object // CFileIO::CFileIO() { //MEMBERASSERT(); m_hFileHandle = NULL; m_szFileName[0] = '\0'; m_dwLastError = 0; } //=============================================================================================== // FUNCTION: Copy Constructor // PURPOSE: Creates a CFileIO object from a Win32 HANDLE. // CFileIO::CFileIO(FILEHANDLE hFile) { //MEMBERASSERT(); m_hFileHandle = hFile; m_szFileName[0] = '\0'; m_dwLastError = 0; } #if !defined(_MSC_VER) CFileIO::CFileIO(HANDLE hFile) { //MEMBERASSERT(); m_hFileHandle = (FILEHANDLE)hFile; m_szFileName[0] = '\0'; m_dwLastError = 0; } #endif //=============================================================================================== // FUNCTION: Destructor // PURPOSE: Cleanup the object when it is deleted. // CFileIO::~CFileIO() { //MEMBERASSERT(); Close(); } //=============================================================================================== // FUNCTION: Create // PURPOSE: Opens a file and stores the filename if successful. // BOOL CFileIO::Create(LPCTSTR szFileName, BOOL bReadOnly, DWORD dwAttributes) { //MEMBERASSERT(); //LPSZASSERT(szFileName); ASSERT(m_hFileHandle == FILE_NULL); DWORD dwFlags = GENERIC_READ; DWORD dwCreation = OPEN_EXISTING; if (!bReadOnly) { dwFlags |= GENERIC_WRITE; dwCreation = CREATE_ALWAYS; } return CreateEx(szFileName, dwFlags, FILE_SHARE_READ, dwCreation, dwAttributes); } //=============================================================================================== // FUNCTION: CreateEx // PURPOSE: Opens a file and stores the filename if successful. // BOOL CFileIO::CreateEx(LPCTSTR szFileName, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes) { //MEMBERASSERT(); //LPSZASSERT(szFileName); ASSERT(m_hFileHandle == FILE_NULL); #if defined(_MSC_VER) m_hFileHandle = ::CreateFile(szFileName, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); #else int fnsize = 0; std::string fName; while (szFileName[fnsize++] != '\0') { fName += char(szFileName[fnsize-1]); } fName += '\0'; m_hFileHandle = ::c_CreateFile(fName.c_str(), dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); #endif if (m_hFileHandle == FILE_NULL) return SetLastError(); #if defined(_MSC_VER) // TRACE1("Create(%s)\n", szFileName); wcsncpy(m_szFileName, szFileName, _MAX_PATH-1); m_szFileName[_MAX_PATH-1] = '\0'; #endif return TRUE; } //=============================================================================================== // FUNCTION: SetFileHandle // PURPOSE: Initializes the object from a Win32 HANDLE. // void CFileIO::SetFileHandle(FILEHANDLE hFile) { //MEMBERASSERT(); ASSERT(m_hFileHandle == FILE_NULL); m_hFileHandle = hFile; m_szFileName[0] = '\0'; m_dwLastError = 0; } /* //=============================================================================================== // FUNCTION: Write // PURPOSE: Write a buffer of data to the file. // BOOL CFileIO::Write(const void *pvBuffer, DWORD dwSizeInBytes, DWORD *pdwBytesWritten) { //MEMBERASSERT(); // ASSERT(m_hFileHandle != INVALID_HANDLE_VALUE); DWORD dwBytesWritten = 0; BOOL bRval = ::WriteFile(m_hFileHandle, pvBuffer, dwSizeInBytes, &dwBytesWritten, NULL); if (pdwBytesWritten) *pdwBytesWritten = dwBytesWritten; if (!bRval) SetLastError(); return bRval; } //=============================================================================================== // FUNCTION: Flush // PURPOSE: Flush the current file to disk. // BOOL CFileIO::Flush() { //MEMBERASSERT(); // ASSERT(m_hFileHandle != INVALID_HANDLE_VALUE); return ::FlushFileBuffers(m_hFileHandle) ? TRUE : SetLastError(); } */ //=============================================================================================== // PROCEDURE: Read // PURPOSE: Reads a block and returnd FALSE on ERROR. // BOOL CFileIO::Read(LPVOID lpBuf, DWORD dwBytesToRead, DWORD *pdwBytesRead) { //MEMBERASSERT(); ASSERT(m_hFileHandle != FILE_NULL); DWORD dwBytesRead = 0; #if defined(_MSC_VER) BOOL bRval = ::ReadFile(m_hFileHandle, lpBuf, dwBytesToRead, &dwBytesRead, NULL); #else BOOL bRval = ::c_ReadFile(m_hFileHandle, lpBuf, dwBytesToRead, &dwBytesRead, NULL); #endif if (pdwBytesRead) *pdwBytesRead = dwBytesRead; if (!bRval) return SetLastError(); if (dwBytesRead!=dwBytesToRead) return SetLastError(ERROR_HANDLE_EOF); return TRUE; } //=============================================================================================== // FUNCTION: Close // PURPOSE: Closes a previously opened file. // BOOL CFileIO::Close() { //MEMBERASSERT(); if (m_hFileHandle != NULL) { #if defined(_MSC_VER) if (!::CloseHandle(m_hFileHandle)) #else if (!c_CloseHandle(m_hFileHandle)) #endif return SetLastError(); // TRACE1("Close(%s)\n", m_szFileName); m_hFileHandle = NULL; } m_szFileName[0] = '\0'; return TRUE; } //=============================================================================================== // FUNCTION: Release // PURPOSE: Releases the file handle held in the object. // FILEHANDLE CFileIO::Release() { //MEMBERASSERT(); FILEHANDLE hRval = m_hFileHandle; m_hFileHandle = NULL; m_szFileName[0] = '\0'; return hRval; } //=============================================================================================== // FUNCTION: SeekFailure // PURPOSE: Returns TRUE if an open file handle is held. // BOOL CFileIO::SeekFailure(DWORD dwOffset) { //MEMBERASSERT(); if (dwOffset == 0xFFFFFFFF) { DWORD dwError = GetLastError(); if (dwError != NO_ERROR ) { SetLastError(dwError); return TRUE; } } return FALSE; } //=============================================================================================== // FUNCTION: Seek // PURPOSE: Change the current position of the file pointer. // NOTES: Valid flags are FILE_CURRENT, FILE_BEGIN, & FILE_END. // BOOL CFileIO::Seek(LONGLONG lOffset, UINT uFlag, LONGLONG *plNewOffset) { #if !defined(_MSC_VER) /*MEMBERASSERT();*/ short origin = 0; switch (uFlag) { case FILE_BEGIN : origin = SEEK_SET; /* start of file */ break; case FILE_CURRENT : origin = SEEK_CUR; /* current position of file pointer */ break; case FILE_END : origin = SEEK_END; /* end of file */ break; } return (!fseek (m_hFileHandle, (long)lOffset, origin)); /* stdio read */ #else MEMBERASSERT(); LARGE_INTEGER Offset; Offset.QuadPart = lOffset; Offset.LowPart = ::SetFilePointer(m_hFileHandle, Offset.LowPart, &Offset.HighPart, uFlag); if (SeekFailure(Offset.LowPart)) return FALSE; if (plNewOffset) *plNewOffset = Offset.QuadPart; return TRUE; #endif } /* //=============================================================================================== // FUNCTION: GetCurrentPosition // PURPOSE: Get the current position of the file pointer. // BOOL CFileIO::GetCurrentPosition(LONGLONG *plCurrentPosition) { //MEMBERASSERT(); return Seek(0, FILE_CURRENT, plCurrentPosition); } */ //=============================================================================================== // FUNCTION: GetFileSize // PURPOSE: Returns the size of a file in bytes. // LONGLONG CFileIO::GetFileSize() { /*MEMBERASSERT();*/ ASSERT(m_hFileHandle != FILE_NULL); #if !defined(_MSC_VER) return c_GetFileSize(m_hFileHandle,NULL); #else return ::GetFileSize(m_hFileHandle,NULL); #endif } /* //=============================================================================================== // FUNCTION: GetFileTime // PURPOSE: Gets time values for the file. // BOOL CFileIO::GetFileTime( LPFILETIME pCreationTime, LPFILETIME pLastAccessTime, LPFILETIME pLastWriteTime) { //MEMBERASSERT(); //ASSERT(m_hFileHandle != INVALID_HANDLE_VALUE); return ::GetFileTime(m_hFileHandle, pCreationTime, pLastAccessTime, pLastWriteTime); } //=============================================================================================== // FUNCTION: SetFileTime // PURPOSE: Sets time values for the file. // BOOL CFileIO::SetFileTime( LPFILETIME pCreationTime, LPFILETIME pLastAccessTime, LPFILETIME pLastWriteTime) { //MEMBERASSERT(); //ASSERT(m_hFileHandle != INVALID_HANDLE_VALUE); return ::SetFileTime(m_hFileHandle, pCreationTime, pLastAccessTime, pLastWriteTime); } //=============================================================================================== // FUNCTION: GetFileInformation // PURPOSE: . // BOOL CFileIO::GetFileInformation(LPBY_HANDLE_FILE_INFORMATION pFileInformation) { //MEMBERASSERT(); return ::GetFileInformationByHandle(m_hFileHandle, pFileInformation) ? TRUE : SetLastError(); } //=============================================================================================== // FUNCTION: Duplicate // PURPOSE: Makes a copy of the handle into another CFileIO object. // BOOL CFileIO::Duplicate(CFileIO *pNewFile, BOOL bInheritable) { //MEMBERASSERT(); HANDLE hNewHandle = NULL; HANDLE *pNewHandle = NULL; if (pNewFile) { // WPTRASSERT(pNewFile); pNewHandle = &hNewHandle; } if (!DuplicateHandle(GetCurrentProcess(), // source process m_hFileHandle, // handle to duplicate GetCurrentProcess(), // destination process pNewHandle, // new handle 0, // new access flags - ignored since DUPLICATE_SAME_ACCESS bInheritable, // it's inheritable DUPLICATE_SAME_ACCESS)) return SetLastError(); if (pNewFile) pNewFile->SetFileHandle(hNewHandle); return TRUE; } //=============================================================================================== // FUNCTION: SetInheritable // PURPOSE: Sets the "inheritability" of the file handle. // BOOL CFileIO::SetInheritable(BOOL bInheritable) { //MEMBERASSERT(); return Duplicate(NULL, bInheritable); } */ //=============================================================================================== // FUNCTION: SetLastError // PURPOSE: Sets the last error value and always returns FALSE for convenience. // BOOL CFileIO::SetLastError() { /*MEMBERASSERT();*/ return SetLastError(GetLastError()); } //=============================================================================================== // FUNCTION: SetLastError // PURPOSE: Sets the last error value and always returns FALSE for convenience. // BOOL CFileIO::SetLastError(DWORD dwError) { /*MEMBERASSERT();*/ m_dwLastError = dwError; // TRACE1("CFileIO::SetLastError(%u)\n", dwError); // SHOW_SYSTEM_ERROR(dwError); return FALSE; // convenience. } //=============================================================================================== // FUNCTION: GetLastError // PURPOSE: Gets the last error condition provoked by this object. // DWORD CFileIO::GetLastError() const { /*MEMBERASSERT();*/ return m_dwLastError; } //############################################################################################### //############################################################################################### //### //### CFileIO_NoClose is a non-polymorphic derivation of CFileIO that does not close the //### file on destruction. Typically used with the copy constructor to wrap a HANDLE. //### //############################################################################################### //############################################################################################### //=============================================================================================== // FUNCTION: Constructor // PURPOSE: Object initialization. // CFileIO_NoClose::CFileIO_NoClose(HANDLE hFile) : CFileIO(hFile) { } //=============================================================================================== // FUNCTION: Destructor // PURPOSE: Object cleanup. // CFileIO_NoClose::~CFileIO_NoClose() { Release(); } #if 0 //############################################################################################### //############################################################################################### //### //### CFileIO_Pipe is a thin wrapper around a Win32 pipe. //### //############################################################################################### //############################################################################################### CFileIO_Pipe::CFileIO_Pipe() { } CFileIO_Pipe::~CFileIO_Pipe() { } BOOL CFileIO_Pipe::Create(BOOL bInheritable) { // set up the security attributes for the anonymous pipe SECURITY_ATTRIBUTES saPipe = { 0 }; saPipe.nLength = sizeof(SECURITY_ATTRIBUTES); saPipe.lpSecurityDescriptor = NULL; saPipe.bInheritHandle = bInheritable; // handles to the anonymous pipe HANDLE hReadPipe=NULL, hWritePipe=NULL; // create the anonymous pipe if (!CreatePipe(&hReadPipe, &hWritePipe, &saPipe, 0)) { SHOW_SYSTEM_ERROR(0); return FALSE; } m_ReadPipe.SetFileHandle(hReadPipe); m_WritePipe.SetFileHandle(hWritePipe); return TRUE; } CFileIO *CFileIO_Pipe::GetReadPipe() { //MEMBERASSERT(); return &m_ReadPipe; } CFileIO *CFileIO_Pipe::GetWritePipe() { //MEMBERASSERT(); return &m_WritePipe; } #ifdef TESTBED #define WRITETEST 1 #define READTEST 1 int main(int argc, char **argv) { const char szFilename[] = "D:\\Bigfile.tmp"; const LONGLONG llFileLen = LONGLONG(1024 * 1024 * 1024) * 3; const char szWriteText[] = "Bruce's big file writing test."; const int nTextLen = strlen(szWriteText); #if WRITETEST { CFileIO File; //VERIFY(File.Create(szFilename, FALSE)); LONGLONG llOffset = 0; // VERIFY(File.Seek(llFileLen, FILE_BEGIN, &llOffset)); // ASSERT(llOffset == llFileLen); printf("llOffset = %d MB\n", int(llOffset / (1024 * 1024))); //VERIFY(File.Write(szWriteText, nTextLen)); LONGLONG llFileSize = File.GetFileSize(); // ASSERT(llFileSize > 0); // ASSERT(llFileSize == llFileLen + nTextLen); printf("llFileSize = %d MB\n", int(llFileSize / (1024 * 1024))); // VERIFY(File.Seek(-nTextLen, FILE_CURRENT, &llOffset)); char szReadText[128] = ""; // VERIFY(File.Read(szReadText, nTextLen)); szReadText[nTextLen] = '\0'; // ASSERT(strcmp(szWriteText, szReadText)==0); printf("szReadText = %s\n", szReadText); // VERIFY(File.Close()); } #endif #if READTEST { CFileIO File; //VERIFY(File.Create(szFilename, TRUE)); LONGLONG llOffset = 0; //VERIFY(File.Seek(llFileLen, FILE_BEGIN, &llOffset)); printf("llOffset = %d MB\n", int(llOffset / (1024 * 1024))); LONGLONG llFileSize = File.GetFileSize(); ASSERT(llFileSize > 0); ASSERT(llFileSize == llFileLen + nTextLen); printf("llFileSize = %d MB\n", int(llFileSize / (1024 * 1024))); char szReadText[128] = ""; //VERIFY(File.Read(szReadText, nTextLen)); szReadText[nTextLen] = '\0'; ASSERT(strcmp(szWriteText, szReadText)==0); printf("szReadText = %s\n", szReadText); //VERIFY(File.Close()); } #endif return 0; } #endif // TESTBED #endif stimfit-0.16.0/src/libstfio/abf/axon/Common/ArrayPtr.hpp0000775000175000017500000004166713567226230020033 00000000000000//*********************************************************************************************** // // Copyright (c) 1996-1997 Axon Instruments. // All rights reserved. // //*********************************************************************************************** // HEADER: ARRAYPTR.HPP // PURPOSE: Define the template class CArrayPtr // AUTHOR: BHI Sep 1996 // // #ifndef INC_ARRAYPTR_HPP #define INC_ARRAYPTR_HPP #pragma once #include #if (__cplusplus < 201402L) # include #else # include #endif #if defined(__UNIX__) || defined(__STF__) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif //*********************************************************************************************** // CLASS: CArrayPtr // PURPOSE: A smart pointer class for arrays of objects or primitive ITEMs. // template class CArrayPtr { private: // Private data. #if (__cplusplus < 201402L) boost::shared_array m_pArray; #else std::shared_ptr m_pArray; #endif private: // Prevent copy constructors and operator=(). CArrayPtr(const CArrayPtr &); const CArrayPtr &operator=(const CArrayPtr &); public: // Public member functions. // Constructors & destructor. See notes below. CArrayPtr(ITEM *pItem = NULL); CArrayPtr(UINT uCount); ~CArrayPtr(); // Allocation and destruction of memory pointed to by this object. BOOL Alloc(UINT uCount); /* BOOL Realloc(UINT uOldCount, UINT uNewCount, BOOL bZero=FALSE); BOOL Clone(const ITEM *pItem, UINT uCount); */ void Free(); // Accessor functions to get at the wrapped array. operator ITEM *() const; ITEM *Get() const; /* // Destroys the held array and replaces it with another. void Set(ITEM *); // Non-destructive release of the held pointer. ITEM *Release(); // Zero the held array from 0 for uCount items. void Zero(UINT uCount); // Sorts the data held in the pointer according to a user-supplied callback. void Sort(UINT uCount, int (__cdecl *FnCompare )(const void *elem1, const void *elem2 )); */ }; //================================================================================================ // FUNCTION: Constructor // PURPOSE: Create a new object that wraps a passed pointer. // NOTES: If the passed pointer is non-NULL, it *MUST* have been created on the // heap using the array allocater new[]. // Unfortunately there is no reliable way to ASSERT this. // // The definition of this constructor contains a default parameter of NULL // so that CArrayPtr objects can be created that do not hold anything. // template inline CArrayPtr::CArrayPtr/*CSH*/(ITEM *pItem) { // MEMBERASSERT(); ASSERT_NOTONSTACK(pItem); m_pArray = pItem; } //================================================================================================ // FUNCTION: Constructor // PURPOSE: Create a new object and allocate a buffer of the passed size. // template inline CArrayPtr::CArrayPtr/*CSH*/(UINT uCount) { // MEMBERASSERT(); m_pArray.reset((ITEM*)0); Alloc(uCount); } //================================================================================================ // FUNCTION: Destructor // PURPOSE: Frees a held pointer if non-NULL. // template inline CArrayPtr::~CArrayPtr/*CSH*/() { // MEMBERASSERT(); // delete[] m_pArray; // m_pArray = NULL; } //================================================================================================ // FUNCTION: Alloc // PURPOSE: Frees any held pointer and allocates a new array of the wrapped ITEM. // template inline BOOL CArrayPtr::Alloc(UINT uCount) { // MEMBERASSERT(); // Free any existing array. Free(); // Return now if nothing is to be allocated. if (uCount == 0) return TRUE; // Allocate the new array. m_pArray.reset(new ITEM[uCount]); return (m_pArray!=NULL); } /* //================================================================================================ // FUNCTION: Realloc // PURPOSE: Reallocates the held pointer keeping the held data. // template inline BOOL CArrayPtr::Realloc(UINT uOldCount, UINT uNewCount, BOOL bZero) { MEMBERASSERT(); ARRAYASSERT(m_pArray, uOldCount); CArrayPtr pNewArray; if (uNewCount && !pNewArray.Alloc(uNewCount)) return FALSE; for (UINT i=0; i inline BOOL CArrayPtr::Clone(const ITEM *pItem, UINT uCount) { MEMBERASSERT(); // Reallocate the held pointer. if (!Alloc(uCount)) return FALSE; // Check that we have valid parameters. ARRAYASSERT(pItem, uCount); // If this object was only for wrapping primitive types, a memcpy call // would be most efficient for cloning, but this is inappropriate for // arrays of objects. // memcpy(m_pArray, pItem, uCount*sizeof(ITEM)); // Use a for loop to copy the array into the new buffer. for (UINT i=0; i inline void CArrayPtr::Free() { // MEMBERASSERT(); m_pArray.reset((ITEM*)0); } //================================================================================================ // FUNCTION: Get // PURPOSE: Returns the held pointer without giving up ownership of it. // template inline ITEM *CArrayPtr::Get() const { // MEMBERASSERT(); return m_pArray.get(); } /* //================================================================================================ // FUNCTION: Set // PURPOSE: Destroys the held array and replaces it with another. // template inline void CArrayPtr::Set(ITEM *pItem) { ASSERT_NOTONSTACK(pItem); Free(); m_pArray = pItem; } */ //================================================================================================ // FUNCTION: Overloaded cast operator // PURPOSE: Returns the held pointer without giving up ownership of it. // template inline CArrayPtr::operator ITEM *() const { // MEMBERASSERT(); return Get(); } /* //================================================================================================ // FUNCTION: Release // PURPOSE: Returns the held pointer, giving up ownership of it. // template inline ITEM *CArrayPtr::Release() { MEMBERASSERT(); ITEM *rval = m_pArray; m_pArray = NULL; return rval; } //================================================================================================ // FUNCTION: Zero // PURPOSE: Zero's out the held pointer from item 0 for uCount items. // template inline void CArrayPtr::Zero(UINT uCount) { MEMBERASSERT(); ARRAYASSERT(m_pArray, uCount); memset(m_pArray, 0, uCount*sizeof(ITEM)); } //================================================================================================ // FUNCTION: Sort // PURPOSE: Sorts the data held in the pointer according to a user-supplied callback. // template inline void CArrayPtr::Sort(UINT uCount, int (__cdecl *FnCompare )(const void *elem1, const void *elem2 )) { MEMBERASSERT(); ARRAYASSERT(m_pArray, uCount); qsort(m_pArray, uCount, sizeof(ITEM), FnCompare); } */ /* //################################################################################################ //################################################################################################ //### //### CLASS: CArrayPtrEx //### PURPOSE: Extended smart pointer that also holds the count of objects held. //### //################################################################################################ //################################################################################################ // *********************************************************************************************** // CLASS: CArrayPtrEx // PURPOSE: A vector class for arrays of objects or primitive ITEMs. // template class CArrayPtrEx { private: // Private data. ITEM *m_pArray; UINT m_uCount; private: // Prevent copy constructors and operator=(). CArrayPtrEx(const CArrayPtrEx &); const CArrayPtrEx &operator=(const CArrayPtrEx &); public: // Public member functions. // Constructors & destructor. See notes below. CArrayPtrEx(); CArrayPtrEx(UINT uCount); ~CArrayPtrEx(); // Allocation and destruction of memory pointed to by this object. BOOL Alloc(UINT uCount); BOOL Realloc(UINT uNewCount, BOOL bZero=FALSE); BOOL Clone(const ITEM *pItem, UINT uCount); void Free(); // Accessor functions to get at the wrapped array. operator ITEM *() const; ITEM *Get() const; // Destroys the held array and replaces it with another. void Set(ITEM *, UINT uCount); // Non-destructive release of the held pointer. ITEM *Release(); // Returns number of items held. UINT GetCount() const; // Zero the held array. void Zero(); // Sorts the data held in the pointer according to a user-supplied callback. void Sort(int (__cdecl *FnCompare )(const void *elem1, const void *elem2 )); }; //================================================================================================ // FUNCTION: Constructor // PURPOSE: Create a new object that wraps a passed pointer. // NOTES: If the passed pointer is non-NULL, it *MUST* have been created on the // heap using the array allocater new[]. // Unfortunately there is no reliable way to ASSERT this. // // The definition of this constructor contains a default parameter of NULL // so that CArrayPtrEx objects can be created that do not hold anything. // template inline CArrayPtrEx::CArrayPtrEx() { MEMBERASSERT(); m_pArray = NULL; m_uCount = 0; } //================================================================================================ // FUNCTION: Constructor // PURPOSE: Create a new object and allocate a buffer of the passed size. // template inline CArrayPtrEx::CArrayPtrEx(UINT uCount) { MEMBERASSERT(); m_pArray = NULL; m_uCount = 0; Alloc(uCount); } //================================================================================================ // FUNCTION: Destructor // PURPOSE: Frees a held pointer if non-NULL. // template inline CArrayPtrEx::~CArrayPtrEx() { MEMBERASSERT(); Free(); } //================================================================================================ // FUNCTION: Alloc // PURPOSE: Frees any held pointer and allocates a new array of the wrapped ITEM. // template inline BOOL CArrayPtrEx::Alloc(UINT uCount) { MEMBERASSERT(); // Check if we already have the right size. if (m_uCount == uCount) return TRUE; // Free any existing array. Free(); // Return now if nothing is to be allocated. if (uCount == 0) return TRUE; // Allocate the new array. m_pArray = new ITEM[uCount]; if (m_pArray) m_uCount = uCount; return (m_pArray!=NULL); } //================================================================================================ // FUNCTION: Realloc // PURPOSE: Reallocates the held pointer keeping the held data. // template inline BOOL CArrayPtrEx::Realloc(UINT uNewCount, BOOL bZero) { MEMBERASSERT(); ARRAYASSERT(m_pArray, m_uCount); if (m_uCount == uNewCount) return TRUE; UINT uOldCount = m_uCount; CArrayPtrEx pNewArray; if (uNewCount && !pNewArray.Alloc(uNewCount)) return FALSE; for (UINT i=0; i inline BOOL CArrayPtrEx::Clone(const ITEM *pItem, UINT uCount) { MEMBERASSERT(); // Reallocate the held pointer. if (!Alloc(uCount)) return FALSE; // Check that we have valid parameters. ARRAYASSERT(pItem, uCount); // If this object was only for wrapping primitive types, a memcpy call // would be most efficient for cloning, but this is inappropriate for // arrays of objects. // memcpy(m_pArray, pItem, uCount*sizeof(ITEM)); // Use a for loop to copy the array into the new buffer. for (UINT i=0; i inline void CArrayPtrEx::Free() { MEMBERASSERT(); delete[] m_pArray; m_pArray = NULL; m_uCount = 0; } //================================================================================================ // FUNCTION: Get // PURPOSE: Returns the held pointer without giving up ownership of it. // template inline ITEM *CArrayPtrEx::Get() const { MEMBERASSERT(); return m_pArray; } //================================================================================================ // FUNCTION: GetCount // PURPOSE: Returns the count of items held. // template inline UINT CArrayPtrEx::GetCount() const { MEMBERASSERT(); return m_uCount; } //================================================================================================ // FUNCTION: Set // PURPOSE: Destroys the held array and replaces it with another. // template inline void CArrayPtrEx::Set(ITEM *pItem, UINT uCount) { ASSERT_NOTONSTACK(pItem); Free(); m_pArray = pItem; m_uCount = uCount; } //================================================================================================ // FUNCTION: Overloaded cast operator // PURPOSE: Returns the held pointer without giving up ownership of it. // template inline CArrayPtrEx::operator ITEM *() const { MEMBERASSERT(); return Get(); } //================================================================================================ // FUNCTION: Release // PURPOSE: Returns the held pointer, giving up ownership of it. // template inline ITEM *CArrayPtrEx::Release() { MEMBERASSERT(); ITEM *rval = m_pArray; m_pArray = NULL; m_uCount = 0; return rval; } //================================================================================================ // FUNCTION: Zero // PURPOSE: Zero's out the held pointer from item 0 for uCount items. // template inline void CArrayPtrEx::Zero() { MEMBERASSERT(); ARRAYASSERT(m_pArray, m_uCount); memset(m_pArray, 0, m_uCount*sizeof(ITEM)); } //================================================================================================ // FUNCTION: Sort // PURPOSE: Sorts the data held in the pointer according to a user-supplied callback. // template inline void CArrayPtrEx::Sort(int (__cdecl *FnCompare )(const void *elem1, const void *elem2 )) { MEMBERASSERT(); ARRAYASSERT(m_pArray, m_uCount); qsort(m_pArray, m_uCount, sizeof(ITEM), FnCompare); } */ #endif // INC_ARRAYPTR_HPP stimfit-0.16.0/src/libstfio/abf/axon/Common/axodefn.h0000775000175000017500000001443013277303516017340 00000000000000/************************************************************************************************ ** ** Copyright (c) 1993-1997 Axon Instruments. ** All rights reserved. ** ************************************************************************************************* ** HEADER: AXODEFN.H ** PURPOSE: Contains standard Axon definitions and prototypes. ** AUTHOR: BHI Oct 1993 ** NOTES: * The following compilers are supported: ** - Microsoft C/C++ (COMPILER = "Mircosoft") ** - Borland C/C++ (COMPILER = "Borland") ** * The following platforms are supported: ** - MSDOS (if _DOS #defined) ** - WIN32 (if _WIN32 #defined) */ #ifndef INC_AXODEFN_H #define INC_AXODEFN_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #undef COMPILER /*============================================================================================== ** Microsoft C compiler */ #ifdef _MSC_VER #ifndef __STF__ #define COMPILER "Microsoft" /* Pragmas to cutdown on MSVC warnings. */ #pragma warning(disable:4001) // warning C4001: nonstandard extension 'single line comment' was used #pragma warning(disable:4100) // warning C4100: 'lParam' : unreferenced formal parameter #pragma warning(disable:4206) // warning C4206: nonstandard extension used : translation unit is empty #pragma warning(disable:4505) // warning C4505: 'GetFont' : unreferenced local function has been removed #pragma warning(disable:4704) // warning C4704: 'AXODBG_WriteProtectSelector' : in-line assembler precludes global optimizations #pragma warning(disable:4705) // warning C4705: statement has no effect #pragma warning(disable:4710) // warning C4710: function 'FunctionName(void)' not expanded #if !defined(_M_IX86) && defined(_M_I86) #define _M_IX86 _M_I86 // Define the MSVC2x _M_IX86 symbol. #endif #if !defined(_M_I86) && defined(_M_IX86) #define _M_I86 _M_IX86 // Define the MSVC1x _M_I86 symbol. #endif #if !defined(_M_I86LM) && !defined(_WIN32) #error "ERROR: Large memory model must be used for 16 bit compiles." #endif #endif #endif /* _MSC_VER */ /*=============================================================================================== ** Borland C/C++ compiler. */ #ifdef __BORLANDC__ #define COMPILER "Borland" // Compatibility #defines for Borland C/C++ to behave like MSVC. #define _M_I86 // Assume that Borland ONLY targets 80X86 processors. #define _M_IX86 300 // Assume that Borland ONLY targets 80X86 processors. #ifdef _Windows #define _WINDOWS #endif #ifdef __WIN32__ #define _WIN32 #elif !defined(__LARGE__) #error "ERROR: Large memory model must be used for 16 bit compiles." #endif #ifdef __DLL__ #ifdef _WINDOWS #define _WINDLL #else #define _DLL #endif #endif #endif /* __BORLANDC__ */ /*=============================================================================================== ** Microsoft Resource Compiler */ #ifdef RC_INVOKED #define COMPILER "Resource Compiler" #define _WINDOWS #endif /* RC_INVOKED */ /*=============================================================================================== ** Add other compiler dependant code HERE! ** Treat everything else as gcc */ #ifndef COMPILER #define COMPILER "gcc" #include "unix.h" #endif //=============================================================================================== // // If compiler is unknown, abort with an error. // #ifndef COMPILER #error "Compiler not recognised... check AXODEFN.H" #endif //=============================================================================================== // AXOAPI should be used in the declaration of all cross platform API functions. // e.g. void AXOAPI ABF_Initialize(void); #ifdef _WINDOWS #define AXOAPI WINAPI #else #define AXOAPI PASCAL #endif //=============================================================================================== // MACRO: ELEMENTS_IN // PURPOSE: Returns the count of the elements in an array. // NOTES: *only* use this on an array. // Do not use this on a pointer or it will not return the correct value. // #ifndef ELEMENTS_IN #define ELEMENTS_IN(p) (sizeof(p)/sizeof((p)[0])) #endif //=============================================================================================== // // 16/32 bit compatibility #defines // #if defined(_WIN32) #ifndef __STF__ #define PLATFORM "Win32" #ifndef _WINDOWS #define _WINDOWS #endif #ifndef __MINGW32__ #include "..\common\win32.h" #endif #endif #elif defined(_DOS) #define PLATFORM "DOS" #include "..\common\msdos.h" #elif defined(_WINDOWS) #error "ERROR: WIN16 is not supported any more." #elif defined(__linux__) #define PLATFORM "Unix" #elif defined(__APPLE__) #define PLATFORM "Mac" #else // Treat everything else as Unix #define PLATFORM "Unix" #endif //======================================================================================= // Macros used to stringize an argument. // // Helper macro for the stringize macro. // Sometimes a nested call is necessary to get correct expansion by the preprocessor. #ifndef AX_STRINGIZE_HELPER #define AX_STRINGIZE_HELPER(a) #a #endif #ifndef AX_STRINGIZE #define AX_STRINGIZE(a) AX_STRINGIZE_HELPER(a) #endif // This macro formats the module and line number to prefix the message in the way that // MSVC likes so that you can simply double click on the line to go to the location. #ifndef AX_FILELINEMSG #define AX_FILELINEMSG(msg) __FILE__ "(" AX_STRINGIZE(__LINE__) ") : " msg #endif // Usage: // #pragma message( __FILE__ "(" AX_STRINGIZE(__LINE__) ") : warning - MFC version change.") // or // #pragma message( AX_FILELINEMSG("warning - MFC version change.") ) // //======================================================================================= // Macros to declare and use string constants based on a symbol. #if !defined(DECLARE_STR) && !defined(USE_STR) #define DECLARE_STR(Name) static const char s__sz##Name[] = #Name #define USE_STR(Name) s__sz##Name #endif #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __AXODEFN_H__ */ stimfit-0.16.0/src/libstfio/abf/axon/Common/FileIO.hpp0000775000175000017500000001261113277303516017362 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-1997 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // // MODULE: FileIO.HPP // PURPOSE: Contains the class definition for the CFileIO class, a simple wrapper // around the WIN32 file I/O API. // #ifndef INC_FileIO_HPP #define INC_FileIO_HPP #include "axodefn.h" #include "./../Common/wincpp.hpp" #include "./../AxAbfFio32/abffiles.h" // ABF file I/O API and error codes. #include "./../AxAbfFio32/csynch.hpp" // Virtual synch array object class CFileIO { private: // Member variables and constants. TCHAR m_szFileName[_MAX_PATH]; // The complete filename of the file FILEHANDLE m_hFileHandle; // The DOS file handle for data file DWORD m_dwLastError; // Error number for last error. private: // Prevent default copy constructor and operator=() CFileIO(const CFileIO &FI); const CFileIO &operator=(const CFileIO &FI); private: // Internal functions. BOOL SeekFailure(DWORD dwOffset); public: CFileIO(); CFileIO(FILEHANDLE hFile); #if !defined(_MSC_VER) CFileIO(HANDLE hFile); #endif ~CFileIO(); BOOL Create(LPCTSTR szFileName, BOOL bReadOnly, DWORD dwAttributes=FILE_ATTRIBUTE_NORMAL); BOOL CreateEx(LPCTSTR szFileName, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes); BOOL Close(); /* BOOL IsOpen() const; BOOL Write(const void *pvBuffer, DWORD dwSizeInBytes, DWORD *pdwBytesWritten=NULL); */ BOOL Read(void *pvBuffer, DWORD dwSizeInBytes, DWORD *pdwBytesRead=NULL); BOOL Seek(LONGLONG lOffset, UINT uFlag=FILE_BEGIN, LONGLONG *plNewOffset=NULL); /* BOOL GetCurrentPosition(LONGLONG *plCurrentPosition); BOOL Flush(); BOOL SetEndOfFile(); */ LONGLONG GetFileSize(); /* BOOL GetFileTime( LPFILETIME pCreationTime, LPFILETIME pLastAccessTime=NULL, LPFILETIME pLastWriteTime=NULL); BOOL SetFileTime( LPFILETIME pCreationTime, LPFILETIME pLastAccessTime=NULL, LPFILETIME pLastWriteTime=NULL); BOOL GetFileInformation(LPBY_HANDLE_FILE_INFORMATION lpFileInformation); */ void SetFileHandle(FILEHANDLE hFile); FILEHANDLE GetFileHandle() const; LPCTSTR GetFileName() const; FILEHANDLE Release(); /* BOOL Duplicate(CFileIO *pNewFile, BOOL bInheritable=TRUE); BOOL SetInheritable(BOOL bInheritable=TRUE); */ BOOL SetLastError(); BOOL SetLastError(DWORD nError); DWORD GetLastError() const; }; //=============================================================================================== // FUNCTION: GetFileName // PURPOSE: Get the name of the file. // inline LPCTSTR CFileIO::GetFileName() const { // MEMBERASSERT(); return m_szFileName; } //=============================================================================================== // FUNCTION: GetFileHandle // PURPOSE: Returns the file handle opened in the object. // inline FILEHANDLE CFileIO::GetFileHandle() const { // MEMBERASSERT(); return m_hFileHandle; } #if 0 //=============================================================================================== // FUNCTION: IsOpen // PURPOSE: Returns TRUE if an open file handle is held. // inline BOOL CFileIO::IsOpen() const { MEMBERASSERT(); return (m_hFileHandle != INVALID_HANDLE_VALUE); } //=============================================================================================== // FUNCTION: SetEndOfFile // PURPOSE: Truncates the file to the current position. // inline BOOL CFileIO::SetEndOfFile() { MEMBERASSERT(); return ::SetEndOfFile(m_hFileHandle) ? TRUE : SetLastError(); } #endif //=============================================================================================== // CLASS: CFileIO_NoClose // PURPOSE: Derivation of CFileIO that does not close the file when destroyed. // NOTES: N.B. Not polymorphic -- do NOT use through base class pointer. // class CFileIO_NoClose : public CFileIO { private: // Prevent default copy constructor and operator=() CFileIO_NoClose(const CFileIO_NoClose &FI); const CFileIO_NoClose &operator=(const CFileIO_NoClose &FI); public: CFileIO_NoClose(HANDLE hFile); ~CFileIO_NoClose(); }; #if 0 //=============================================================================================== // CLASS: CFileIO_Pipe // PURPOSE: Class wrapper around a Win32 pipe. // NOTES: Poor encapsulation as internal CFileIO objects are returned. // class CFileIO_Pipe { private: CFileIO m_ReadPipe; CFileIO m_WritePipe; private: // Prevent default copy constructor and operator=() CFileIO_Pipe(const CFileIO_Pipe &); const CFileIO_Pipe &operator=(const CFileIO_Pipe &); public: CFileIO_Pipe(); ~CFileIO_Pipe(); BOOL Create(BOOL bInheritable); CFileIO *GetReadPipe(); CFileIO *GetWritePipe(); }; #endif #endif // INC_FileIO_HPP stimfit-0.16.0/src/libstfio/abf/axon/Common/unix.cpp0000775000175000017500000001673213277303516017241 00000000000000#include "../Common/axodefn.h" #include #include int WINAPI AXODBG_printf( char *lpsz, ... ) { printf("%s", lpsz); return 0; } /********************************************************************* * CloseW32Handle (KERNEL.474) * CloseHandle (KERNEL32.@) * * Closes a handle. * * PARAMS * handle [I] Handle to close. * * RETURNS * Success: TRUE. * Failure: FALSE, check GetLastError(). */ BOOL WINAPI c_CloseHandle( FILEHANDLE handle ) { // returns the opposite of the Windows-function #if !defined(_MSC_VER) return (!fclose(handle)); #else return CloseHandle( handle ); #endif } /*********************************************************************** * GetFileSize (KERNEL32.@) * * Retrieve the size of a file. * * PARAMS * hFile [I] File to retrieve size of. * filesizehigh [O] On return, the high bits of the file size. * * RETURNS * Success: The low bits of the file size. * Failure: INVALID_FILE_SIZE. As this is could also be a success value, * check GetLastError() for values other than ERROR_SUCCESS. */ DWORD WINAPI c_GetFileSize( FILEHANDLE hFile, LPDWORD filesizehigh ) { #if !defined(_MSC_VER) long lSize; fpos_t cur; if (fgetpos(hFile,&cur)!=0) return -1; if (fseek (hFile, 0, SEEK_END)!=0) return -1; lSize=ftell (hFile); if (fsetpos(hFile,&cur)!=0) return -1; return lSize; #else return GetFileSize( hFile, filesizehigh ); #endif } /*********************************************************************** * ReadFile (KERNEL32.@) */ BOOL WINAPI c_ReadFile( FILEHANDLE hFile, LPVOID buffer, DWORD bytesToRead, LPDWORD bytesRead, LPOVERLAPPED overlapped ) { #if !defined(_MSC_VER) *bytesRead=(DWORD)fread(buffer,1,bytesToRead,hFile); if ( *bytesRead != bytesToRead) return FALSE; else return TRUE; #else return ReadFile( hFile, buffer, bytesToRead, bytesRead, overlapped ); #endif } /*********************************************************************** * SetFilePointer (KERNEL32.@) */ DWORD WINAPI c_SetFilePointer( FILEHANDLE hFile, LONG distance, LONG *highword, DWORD method ) { #if !defined(_MSC_VER) /*long res;*/ short origin = 0; switch (method) { case FILE_BEGIN : origin = SEEK_SET; /* start of file */ break; case FILE_CURRENT : origin = SEEK_CUR; /* current position of file pointer */ break; case FILE_END : origin = SEEK_END; /* end of file */ break; } /* res = */ fseek (hFile, distance, origin); /* stdio read */ return (DWORD) ftell(hFile); #else return SetFilePointer( hFile, distance, highword, method ); #endif } #if !defined(_WINDOWS) /********************************************************************* * _splitpath (NTDLL.@) * * Split a path into its component pieces. * * PARAMS * inpath [I] Path to split * drv [O] Destination for drive component (e.g. "A:"). Must be at least 3 characters. * dir [O] Destination for directory component. Should be at least MAX_PATH characters. * fname [O] Destination for File name component. Should be at least MAX_PATH characters. * ext [O] Destination for file extension component. Should be at least MAX_PATH characters. * * RETURNS * Nothing. */ void /*CSH __cdecl */ _splitpath(const char* inpath, char * drv, char * dir, char* fname, char * ext ) { const char *p, *end; if (inpath[0] && inpath[1] == ':') { if (drv) { drv[0] = inpath[0]; drv[1] = inpath[1]; drv[2] = 0; } inpath += 2; } else if (drv) drv[0] = 0; /* look for end of directory part */ end = NULL; for (p = inpath; *p; p++) if (*p == '/' || *p == '\\') end = p + 1; if (end) /* got a directory */ { if (dir) { memcpy( dir, inpath, end - inpath ); dir[end - inpath] = 0; } inpath = end; } else if (dir) dir[0] = 0; /* look for extension: what's after the last dot */ end = NULL; for (p = inpath; *p; p++) if (*p == '.') end = p; if (!end) end = p; /* there's no extension */ if (fname) { memcpy( fname, inpath, end - inpath ); fname[end - inpath] = 0; } if (ext) strcpy( ext, end ); } /********************************************************************* * _strnicmp (NTDLL.@) */ int /*CSH __cdecl*/ _strnicmp( LPCSTR str1, LPCSTR str2, size_t n ) { return strncasecmp( str1, str2, n ); } /********************************************************************* * _makepath (MSVCRT.@) * * Create a pathname. * * PARAMS * path [O] Destination for created pathname * drive [I] Drive letter (e.g. "A:") * directory [I] Directory * filename [I] Name of the file, excluding extension * extension [I] File extension (e.g. ".TXT") * * RETURNS * Nothing. If path is not large enough to hold the resulting pathname, * random process memory will be overwritten. */ void cdecl _makepath(char * path, const char * drive, const char *directory, const char * filename, const char * extension) { char ch; // TRACE("(%s %s %s %s)\n", debugstr_a(drive), debugstr_a(directory), // debugstr_a(filename), debugstr_a(extension) ); if ( !path ) return; path[0] = '\0'; if (drive && drive[0]) { path[0] = drive[0]; path[1] = ':'; path[2] = 0; } if (directory && directory[0]) { strcat(path, directory); ch = path[strlen(path)-1]; if (ch != '/' && ch != '\\') strcat(path,"\\"); } if (filename && filename[0]) { strcat(path, filename); if (extension && extension[0]) { if ( extension[0] != '.' ) strcat(path,"."); strcat(path,extension); } } // TRACE("returning %s\n",path); } #endif /*********************************************************************** * WriteFile (KERNEL32.@) */ BOOL WINAPI c_WriteFile( FILEHANDLE hFile, LPCVOID buffer, DWORD bytesToWrite, LPDWORD bytesWritten, LPOVERLAPPED overlapped ) { #if !defined(_MSC_VER) *bytesWritten=(DWORD)fwrite(buffer, 1, bytesToWrite, hFile); return (*bytesWritten==bytesToWrite); #else return WriteFile( hFile, buffer, bytesToWrite, bytesWritten, overlapped ); #endif } /************************************************************************* * CreateFileA (KERNEL32.@) * * See CreateFileW. */ #if !defined(_MSC_VER) FILEHANDLE WINAPI c_CreateFile( LPCSTR filename, DWORD access, DWORD sharing, LPSECURITY_ATTRIBUTES sa, DWORD creation, DWORD attributes, HANDLE templ) { char fname[1024]; /* To get near variable holding string */ char* omode; switch (access) /* use C library constants to set mode */ { case GENERIC_WRITE: omode = (char*)"w"; break; case GENERIC_READ | GENERIC_WRITE: omode = (char*)"w+"; break; default: omode = (char*)"r"; break; } strncpy(fname, filename, 1024); /* Get filename in near var */ return fopen(fname,omode); } #endif stimfit-0.16.0/src/libstfio/abf/axon/AxAbfFio32/0000775000175000017500000000000013567226445016161 500000000000000stimfit-0.16.0/src/libstfio/abf/axon/AxAbfFio32/Oldheadr.cpp0000775000175000017500000022651113277303516020332 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-1997 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // This is OLDHEADR.CPP; the routines that cope with reading the data file // parameters block for old AXON pCLAMP binary file formats. // // An ANSI C compiler should be used for compilation. // Compile with the large memory model option. // (e.g. CL -c -AL ABFHEADR.C) #include "../Common/wincpp.hpp" #include "abffiles.h" // header definition & constants #include "oldheadr.h" // prototypes for this file. #include "abfoldnx.h" // Indices for old pCLAMP files (< V6.0) #include "msbincvt.h" // Conversion routines MSBIN <==> IEEE float #include "abfutil.h" // Utility functions. #include #include #include #define ABF_OLDPARAMSIZE 260 // size of old acquisition parameter array //#define (sz) OemToCharBuff(sz, sz, sizeof(sz)) #pragma pack(1) // pack structure on byte boundaries struct ABFTopOfFile { ABFLONG lFileSignature; float fFileVersionNumber; short nOperationMode; ABFLONG lActualAcqLength; short nNumPointsIgnored; ABFLONG lActualEpisodes; ABFLONG lFileStartDate; ABFLONG lFileStartTime; ABFLONG lStopwatchTime; float fHeaderVersionNumber; short nFileType; short nMSBinFormat; }; typedef union { struct ABFTopOfFile ABF; float Param[10]; } TopOfFile; #pragma pack() // return to default packing // // #defines for diagnosing ATF files. // /* #ifdef BIGENDIAN #error Big endian computers are no longer supported by ABF. #endif */ #define ATF_MASK 0x00FFFFFF #define ATF_SIGNATURE 0x00465441 // "FTA" //----------------------------------------------------------------------------------------------- // Macros and functions to deal with returning error return codes through a pointer if given. #define ERRORRETURN(p, e) return ErrorReturn(p, e); static BOOL ErrorReturn(int *pnError, int nErrorNum) { if (pnError) *pnError = nErrorNum; return FALSE; } //=============================================================================================== // FUNCTION: IsValidFloat // PURPOSE: Check if the number is a valid float, to protect against math exceptions. // RETURNS: TRUE = number is a valid float. // static BOOL IsValidFloat( double dNumber, float fMaxMantissa, int nMaxExponent ) { int nExponent = 0; double dMantissa = 0.0; // Get the mantissa and exponent. dMantissa = frexp( dNumber, &nExponent ); // Check they are OK. if( dMantissa > fMaxMantissa || nExponent > nMaxExponent ) return FALSE; return TRUE; } //=============================================================================================== // FUNCTION: GetFileVersion // PURPOSE: Find out the version number and data format of a data file, given a DOS file handle. // RETURNS: TRUE = File is an ABF file, file version retrieved OK. // BOOL OLDH_GetFileVersion( FILEHANDLE hFile, UINT *puFileType, float *pfFileVersion, BOOL *pbMSBinFormat) { TopOfFile TOF; *puFileType = 0L; *pfFileVersion = 0.0F; *pbMSBinFormat = FALSE; // Seek to the start of the file. #if defined(_MSC_VER) SetFilePointer(hFile, 0L, NULL, FILE_BEGIN); #else c_SetFilePointer(hFile, 0L, NULL, FILE_BEGIN); #endif // Read top of file, to determine the file version if (!ABFU_ReadFile(hFile, &TOF, sizeof(TOF))) return FALSE; #ifdef _STFDEBUG std::cout << "Detected ABF Version " << TOF.ABF.fFileVersionNumber << std::endl; #endif // If the file is byte swapped, return as invalid file. // Big-endian computers are no longer supported. if (TOF.ABF.lFileSignature == ABF_REVERSESIGNATURE) return FALSE; // Check if it is an ABF file. if (TOF.ABF.lFileSignature == ABF_NATIVESIGNATURE) { *puFileType = ABF_ABFFILE; *pfFileVersion = TOF.ABF.fFileVersionNumber; return TRUE; } // check for AXON ATF text file format. if ((TOF.ABF.lFileSignature & ATF_MASK) == ATF_SIGNATURE) return FALSE; // Now we must determine if the file is an old pCLAMP file (< V6.0). // Check whether the file is in old MS binary format. This was a floating point format // with a different exponent and mantissa length than IEEE. // Make sure the experiment type and file version are valid floating point numbers. if( !IsValidFloat( TOF.Param[F53_EXPERIMENTTYPE], 10.0F, 4 ) || !IsValidFloat( TOF.Param[F53_FILEVERSIONNUMBER], 10.0F, 4 ) || !IsValidFloat( TOF.Param[F53_ADCNUMCHANNELS], 10.0F, 4 ) || !IsValidFloat( TOF.Param[F53_SAMPLESPEREPISODE], 10.0F, 50 ) ) return FALSE; if( !IsValidFloat( TOF.Param[F53_FILEVERSIONNUMBER], 10.0F, 4 ) ) return FALSE; if ((TOF.Param[F53_EXPERIMENTTYPE] < 0.0F) || (TOF.Param[F53_FILEVERSIONNUMBER] < 0.0F)) { for (int i=0; i < 10; i++) fMSBintoIeee(&(TOF.Param[i]), &(TOF.Param[i])); *pbMSBinFormat = TRUE; } // Set type for very old data files if (TOF.Param[F53_EXPERIMENTTYPE] == 0.0F) TOF.Param[F53_EXPERIMENTTYPE] = 10.0F; // Set return file type. if (TOF.Param[F53_EXPERIMENTTYPE] == 1.0F) *puFileType = ABF_CLAMPEX; else if (TOF.Param[F53_EXPERIMENTTYPE] == 10.0F) *puFileType = ABF_FETCHEX; else return FALSE; // Check for minimal sanity in critical parameters. if ((TOF.Param[F53_ADCNUMCHANNELS] < 1.0F) || (TOF.Param[F53_ADCNUMCHANNELS] > 8.0F) || (TOF.Param[F53_SAMPLESPEREPISODE] < 0.0F) || (TOF.Param[F53_FILEVERSIONNUMBER] < 0.0F) || (TOF.Param[F53_FILEVERSIONNUMBER] > 10.0F) ) return FALSE; // Return the file version. *pfFileVersion = TOF.Param[F53_FILEVERSIONNUMBER]; return TRUE; } //============================================================================================== // FUNCTION: CorrectDACFilePath // PURPOSE: Combines the old DACFileName with the old DACFilePath into the new DACFilePath. // static void CorrectDACFilePath(ABFFileHeader *pFH) { // Get the old DACFileName from the header. char szOldName[ABF_OLDDACFILENAMELEN+1]; ABFU_GetABFString(szOldName, sizeof(szOldName), pFH->_sDACFilePath, ABF_OLDDACFILENAMELEN); // Split it into filename and extension components. char szName[_MAX_FNAME]; char szExt[_MAX_EXT]; _splitpath( szOldName, NULL, NULL, szName, szExt ); // pCLAMP 6 substituted DAT for a non-existent extension. if (szExt[0] == '\0') strcpy(szExt, ".DAT"); // Get the old DACFilePath from the header. char szOldPath[ABF_OLDDACFILEPATHLEN+1]; ABFU_GetABFString(szOldPath, sizeof(szOldPath), pFH->_sDACFilePath+ABF_OLDDACFILENAMELEN, ABF_OLDDACFILEPATHLEN); // Build the complete path and set it in the header again. char szPath[_MAX_PATH]; _makepath( szPath, NULL, szOldPath, szName, szExt ); ABF_SET_STRING(pFH->_sDACFilePath, szPath); } //=============================================================================================== // FUNCTION: CorrectDACScaling // PURPOSE: Correct the DAC scaling factors in the header. // NOTES: Previously the DAC file scale factor scaled 2-byte ADC values // from the DAC file directly into DAC values for output. // Now the scale and offset convert the UU values in the input file // to UU output values, so old scale & offset values must be adjusted. // static void CorrectDACScaling(ABFFileHeader *pFH) { // Now: // DACuu = ADCuu x S + O // // Previously: // DAC = ADC x S + O // // DACuu = (ADC x S + O) x Sdac + Odac // DACuu = ((ADCuu - Oadc)/Sadc x S + O) x Sdac + Odac // DACuu = ADCuu x (S/Sadc x Sdac) // + Odac + O x Sdac - Oadc x (S/Sadc x Sdac) // // => fNewScale = fOldScale * Sdac / Sadc // => fNewOffset = fOldOffset * Sdac + Odac // - Oadc x fNewScale // Initialize a header structure to use on the DAC file. ABFFileHeader DH; ABFH_Initialize(&DH); // Try and open the file as an ABF binary file, if this fails, // just return, the user will have to sort things out for themselves. { char szFilename[_MAX_PATH]; ABF_GET_STRING(szFilename, pFH->_sDACFilePath, sizeof(szFilename)); UINT uMaxSamples = 0; DWORD dwMaxEpi = 0; int hFile; #if defined(_MSC_VER) int fnsize = 0; std::wstring wfName; while (szFilename[fnsize++] != '\0') { wfName += wchar_t(szFilename[fnsize-1]); } wfName += wchar_t('\0'); if (!ABF_ReadOpen(wfName.c_str(), &hFile, ABF_DATAFILE, #else if (!ABF_ReadOpen(szFilename, &hFile, ABF_DATAFILE, #endif // if (!ABF_ReadOpen(wca.cMB2WX(szFilename), &hFile, ABF_DATAFILE, &DH, &uMaxSamples, &dwMaxEpi, NULL)) return; ABF_Close(hFile, NULL); } // Check that the channel was acquired. UINT uChannelOffset = 0; if (!ABFH_GetChannelOffset( &DH, pFH->_nDACFileADCNum, &uChannelOffset )) return; // Save the old sacle and offset. float fOldScale = pFH->_fDACFileScale; float fOldOffset = pFH->_fDACFileOffset; // Get the ADC-to-UU factors for the ADC channel in the DAC file. float fSadc, fOadc; ABFH_GetADCtoUUFactors( &DH, pFH->_nDACFileADCNum, &fSadc, &fOadc); // Get the DAC-to-UU factors for target DAC channel. float fSdac, fOdac; ABFH_GetDACtoUUFactors( pFH, pFH->nActiveDACChannel, &fSdac, &fOdac ); // Update the scaling factors. float fNewScale = fOldScale * fSdac / fSadc; float fNewOffset = fOldOffset * fSdac + fOdac - fOadc * fNewScale; pFH->fDACFileScale[pFH->nActiveDACChannel] = fNewScale; pFH->fDACFileOffset[pFH->nActiveDACChannel] = fNewOffset; } //=============================================================================================== // FUNCTION: OLDH_ABFtoABF15 // PURPOSE: Brings an ABF file header up to ABF version 1.5. // void OLDH_ABFtoABF15(ABFFileHeader *pFH) { for (int i=0; inBellEnable[i] = 0; pFH->nBellLocation[i] = 1; pFH->nBellRepetitions[i] = 1; } ASSERT(pFH->lFileSignature==ABF_NATIVESIGNATURE); // Convert DOS strings to ANSI char set. static char s_szAxEngine[] = "AXENGN"; if ((pFH->fFileVersionNumber < 1.4) && (_strnicmp(pFH->sCreatorInfo, s_szAxEngine, strlen(s_szAxEngine))!=0)) { /* ABF_OEM_TO_ANSI(pFH->_sFileComment); for (int i=0; isADCChannelName[i]); ABF_OEM_TO_ANSI(pFH->sADCUnits[i]); } for (int i=0; isDACChannelName[i]); ABF_OEM_TO_ANSI(pFH->sDACChannelUnits[i]); } ABF_OEM_TO_ANSI(pFH->sArithmeticUnits); */ } if (pFH->fFileVersionNumber < 1.4) { // Fix trigger source parameter for FETCHEX files pre-ABF1.3. if ((pFH->nOperationMode==ABF_GAPFREEFILE) && (pFH->nTriggerSource > 0)) pFH->nTriggerSource = 0; // Synthesize statistics period from old lCalculationPeriod. pFH->fStatisticsPeriod = pFH->lCalculationPeriod * pFH->fADCSampleInterval / 1E6F; // Fill in the new filter type fields. for (int i=0; ifSignalLowpassFilter[i] != ABF_FILTERDISABLED) pFH->nLowpassFilterType[i] = ABF_FILTER_EXTERNAL; if (pFH->fSignalHighpassFilter[i] != 0.0F) pFH->nHighpassFilterType[i] = ABF_FILTER_EXTERNAL; } // Synthesize the new trial trigger field (new for 1.4). if ((pFH->nOperationMode==ABF_WAVEFORMFILE) && (pFH->nTriggerAction==ABF_TRIGGER_STARTTRIAL)) { switch (pFH->nTriggerSource) { case ABF_TRIGGERSPACEBAR: pFH->nTrialTriggerSource = ABF_TRIALTRIGGER_SPACEBAR; break; case ABF_TRIGGEREXTERNAL: pFH->nTrialTriggerSource = ABF_TRIALTRIGGER_EXTERNAL; break; default: pFH->nTrialTriggerSource = ABF_TRIALTRIGGER_NONE; break; } pFH->nTriggerAction = ABF_TRIGGER_STARTEPISODE; pFH->nTriggerSource = 0; } // Correct the DAC file scaling parameters. if ((pFH->nOperationMode==ABF_WAVEFORMFILE) && (pFH->_nWaveformSource == ABF_DACFILEWAVEFORM)) { CorrectDACFilePath(pFH); CorrectDACScaling(pFH); } UINT nStatsRegionID = 0; // Temporary statistics region ID. pFH->lStatisticsMeasurements = ABF_STATISTICS_ABOVETHRESHOLD | ABF_STATISTICS_MEANOPENTIME; pFH->lStatsMeasurements[ nStatsRegionID ] = ABF_PEAK_MEASURE_PEAK | ABF_PEAK_MEASURE_PEAKTIME; } if (pFH->fFileVersionNumber < 1.5F) { // Changes for V1.5: // * Change ABFSignal parameters from UUTop & UUBottom to fDisplayGain & fDisplayOffset. // * Addition of the external tag type parameter. pFH->nExternalTagType = ABF_EXTERNALTAG; } } //=============================================================================================== // FUNCTION: OLDH_ABFtoCurrentVersion // PURPOSE: Brings an ABF file header up to the current ABF version. // void OLDH_ABFtoCurrentVersion(ABFFileHeader *pFH) { if( (pFH->fFileVersionNumber < ABF_V16) || (pFH->nFileType != ABF_ABFFILE) ) { // Changes for V1.6: // 1. Expanded header to 6k bytes // 2. New entries to accommodate 2 waveform channels. // 3. Date changed to 4 digit year // 4. New entries to accommodate 2 presweep trains, user lists and P/N leak subtractions. // 5. Longer file comment. // 6. Extra 'enable' fields. // 7. Protocol name in header. // Copy the waveform info to the new header parameters. UINT uDAC = pFH->nActiveDACChannel; pFH->lDACFilePtr[uDAC] = pFH->_lDACFilePtr; pFH->lDACFilePtr[uDAC] = 0; pFH->lDACFileNumEpisodes[uDAC] = pFH->_lDACFileNumEpisodes; pFH->lDACFileNumEpisodes[1-uDAC] = 0; pFH->nWaveformEnable[uDAC] = (pFH->_nWaveformSource != ABF_WAVEFORMDISABLED); pFH->nWaveformEnable[1-uDAC] = 0; pFH->nWaveformSource[uDAC] = pFH->_nWaveformSource; pFH->nWaveformSource[1-uDAC] = ABF_EPOCHTABLEWAVEFORM; pFH->nInterEpisodeLevel[uDAC] = pFH->_nInterEpisodeLevel; pFH->nInterEpisodeLevel[1-uDAC] = 0; for( UINT i=0; inEpochType[uDAC][i] = pFH->_nEpochType[i]; pFH->nEpochType[1-uDAC][i] = 0; pFH->fEpochInitLevel[uDAC][i] = pFH->_fEpochInitLevel[i]; pFH->fEpochInitLevel[1-uDAC][i] = 0.0F; pFH->fEpochLevelInc[uDAC][i] = pFH->_fEpochLevelInc[i]; pFH->fEpochLevelInc[1-uDAC][i] = 0.0F; pFH->lEpochInitDuration[uDAC][i] = pFH->_nEpochInitDuration[i]; pFH->lEpochInitDuration[1-uDAC][i] = 0; pFH->lEpochDurationInc[uDAC][i] = pFH->_nEpochDurationInc[i]; pFH->lEpochDurationInc[1-uDAC][i] = 0; } pFH->fDACFileScale[uDAC] = pFH->_fDACFileScale; pFH->fDACFileScale[1-uDAC] = 0.0F; pFH->fDACFileOffset[uDAC] = pFH->_fDACFileOffset; pFH->fDACFileOffset[1-uDAC] = 0.0F; pFH->lDACFileEpisodeNum[uDAC] = pFH->_nDACFileEpisodeNum; pFH->lDACFileEpisodeNum[1-uDAC] = 0; pFH->nDACFileADCNum[uDAC] = pFH->_nDACFileADCNum; pFH->nDACFileADCNum[1-uDAC] = 0; strncpy( pFH->sDACFilePath[uDAC], pFH->_sDACFilePath, ABF_DACFILEPATHLEN ); strncpy( pFH->sDACFilePath[1-uDAC], "", ABF_DACFILEPATHLEN ); // Telegraph settings pFH->nTelegraphEnable[pFH->_nAutosampleADCNum] = pFH->_nAutosampleEnable; pFH->nTelegraphInstrument[pFH->_nAutosampleADCNum] = pFH->_nAutosampleInstrument; pFH->fTelegraphAdditGain[pFH->_nAutosampleADCNum] = pFH->_fAutosampleAdditGain; pFH->fTelegraphFilter[pFH->_nAutosampleADCNum] = pFH->_fAutosampleFilter; pFH->fTelegraphMembraneCap[pFH->_nAutosampleADCNum] = pFH->_fAutosampleMembraneCap; // Presweep trains. if( uDAC == (UINT)pFH->_nConditChannel ) { pFH->nConditEnable[uDAC] = pFH->_nConditEnable; pFH->lConditNumPulses[uDAC] = pFH->_lConditNumPulses; pFH->fBaselineDuration[uDAC] = pFH->_fBaselineDuration; pFH->fBaselineLevel[uDAC] = pFH->_fBaselineLevel; pFH->fStepDuration[uDAC] = pFH->_fStepDuration; pFH->fStepLevel[uDAC] = pFH->_fStepLevel; pFH->fPostTrainLevel[uDAC] = pFH->_fPostTrainLevel; } if( uDAC == (UINT)pFH->nActiveDACChannel ) { // P/N Leak subtraction parameters. pFH->nPNEnable[uDAC] = pFH->_nPNEnable; pFH->nPNPolarity[uDAC] = pFH->_nPNPolarity; pFH->fPNHoldingLevel[uDAC] = pFH->_fPNHoldingLevel; pFH->nPNADCSamplingSeq[uDAC][0] = LOBYTE( pFH->_nPNADCNum ); // Sanity check the channel number. ASSERT( pFH->nPNADCSamplingSeq[uDAC][0] == pFH->_nPNADCNum ); // User list parameters. pFH->nULEnable[uDAC] = pFH->_nListEnable; pFH->nULParamToVary[uDAC] = pFH->_nParamToVary; strncpy( pFH->sULParamValueList[uDAC], pFH->_sParamValueList, ABF_VARPARAMLISTLEN ); } // DAC Calibration Factors. for(int i=0; ifDACCalibrationFactor[i] = 1.0F; pFH->fDACCalibrationOffset[i] = 0.0F; } // File Comment. strncpy( pFH->sFileComment, pFH->_sFileComment, ABF_OLDFILECOMMENTLEN ); // Fix the date if needed. pFH->lFileStartDate = ABFU_FixFileStartDate ( pFH->lFileStartDate ); // Extra 'enable' fields. pFH->nCommentsEnable = (pFH->nManualInfoStrategy != ABF_ENV_DONOTWRITE); // Turn on the 'Analyse Me' flag. pFH->nAutoAnalyseEnable = ABF_AUTOANALYSE_DEFAULT; } if( (pFH->fFileVersionNumber < ABF_V170) || (pFH->nFileType != ABF_ABFFILE) ) { // Set stats variables for ( UINT uRegion = 0; uRegion < ABF_STATS_REGIONS; uRegion++ ) { pFH->lStatsMeasurements[uRegion] = pFH->_lAutopeakMeasurements; // Copy stats measurements across all regions. pFH->nRiseBottomPercentile[uRegion] = 10; pFH->nRiseTopPercentile[uRegion] = 90; pFH->nDecayBottomPercentile[uRegion] = 10; pFH->nDecayTopPercentile[uRegion] = 90; } pFH->nStatsEnable = pFH->_nAutopeakEnable; pFH->nStatsSmoothing = pFH->_nAutopeakSmoothing; pFH->nStatsBaseline = pFH->_nAutopeakBaseline; pFH->lStatsBaselineStart = pFH->_lAutopeakBaselineStart; pFH->lStatsBaselineEnd = pFH->_lAutopeakBaselineEnd; // Polarity is channel specific for ( UINT uChannel = 0; uChannel < ABF_ADCCOUNT; uChannel++ ) pFH->nStatsChannelPolarity[uChannel] = pFH->_nAutopeakPolarity;; // Convert the old channel selection to an active channel. UINT nStatsADCNum = pFH->_nAutopeakADCNum; // Shift the uBitmask by nStatsADCNum of bits. UINT uBitMask = 0x01 << nStatsADCNum; pFH->nStatsActiveChannels = (short)uBitMask; // Convert the old search region into the statistics regions. for ( UINT uRegion = 0; uRegion < ABF_STATS_REGIONS; uRegion++ ) { pFH->nStatsSearchMode[ uRegion ] = pFH->_nAutopeakSearchMode; pFH->lStatsStart[ uRegion ] = pFH->_lAutopeakStart; pFH->lStatsEnd[ uRegion ] = pFH->_lAutopeakEnd; } // Select statistics region zero. pFH->nStatsSearchRegionFlags = ABF_PEAK_SEARCH_REGION0; pFH->nStatsSelectedRegion = 0; // Telegraph settings pFH->nTelegraphEnable[pFH->_nAutosampleADCNum] = pFH->_nAutosampleEnable; pFH->nTelegraphInstrument[pFH->_nAutosampleADCNum] = pFH->_nAutosampleInstrument; pFH->fTelegraphAdditGain[pFH->_nAutosampleADCNum] = pFH->_fAutosampleAdditGain; pFH->fTelegraphFilter[pFH->_nAutosampleADCNum] = pFH->_fAutosampleFilter; pFH->fTelegraphMembraneCap[pFH->_nAutosampleADCNum] = pFH->_fAutosampleMembraneCap; } if( (pFH->fFileVersionNumber < ABF_V171) || (pFH->nFileType != ABF_ABFFILE) ) { for( int i = 0; i < ABF_WAVEFORMCOUNT; i++ ) { sprintf( pFH->sEpochResistanceSignalName[ i ], "IN #%d", i); pFH->nEpochResistanceState[ i ] = 0; } } if( (pFH->fFileVersionNumber < ABF_V172) || (pFH->nFileType != ABF_ABFFILE) ) { pFH->nAlternateDACOutputState = 0; for( int nEpoch = 0; nEpoch < ABF_EPOCHCOUNT; nEpoch ++ ) { pFH->nAlternateDigitalValue[ nEpoch ] = 0; pFH->nAlternateDigitalTrainValue[ nEpoch ] = 0; } } if( (pFH->fFileVersionNumber < ABF_V173) || (pFH->nFileType != ABF_ABFFILE) ) { //Post-processing values. for( int i=0; ifPostProcessLowpassFilter[i] = ABF_FILTERDISABLED; pFH->nPostProcessLowpassFilterType[i] = ABF_POSTPROCESS_FILTER_NONE; } } if( (pFH->fFileVersionNumber < ABF_V174) || (pFH->nFileType != ABF_ABFFILE) ) pFH->channel_count_acquired = 0; if( (pFH->fFileVersionNumber < ABF_V175) || (pFH->nFileType != ABF_ABFFILE) ) { for( int i=0; inStatsChannelPolarity[ i ] = ABF_PEAK_ABSOLUTE; } if( (pFH->fFileVersionNumber < ABF_V176) || (pFH->nFileType != ABF_ABFFILE) ) pFH->nDD132xTriggerOut = 0; if( (pFH->fFileVersionNumber < ABF_V177) || (pFH->nFileType != ABF_ABFFILE) ) { pFH->nCreatorMajorVersion = 0; pFH->nCreatorMinorVersion = 0; pFH->nCreatorBugfixVersion = 0; pFH->nCreatorBuildVersion = 0; } if( (pFH->fFileVersionNumber < ABF_V178) || (pFH->nFileType != ABF_ABFFILE) ) pFH->nAlternateDigitalOutputState = 0; if( (pFH->fFileVersionNumber < ABF_V180 && pFH->fFileVersionNumber > ABF_V174) || (pFH->nFileType != ABF_ABFFILE) ) { for( UINT uRegion = 0; uRegion < ABF_STATS_REGIONS; uRegion++ ) pFH->nStatsSearchMode[ uRegion ] = pFH->_nStatsSearchMode; } // When updating the header version copy this else if statement but use your parameters and the current version number if( (pFH->fFileVersionNumber < ABF_V180) || (pFH->nFileType != ABF_ABFFILE) ) { // Clear the annotations since they will not be copied. pFH->lAnnotationSectionPtr = 0; pFH->lNumAnnotations = 0; } } /* //=============================================================================================== // FUNCTION: OLDH_CorrectScopeConfig // PURPOSE: Corrects the display gain and offset in the scope parameters. // void OLDH_CorrectScopeConfig(ABFFileHeader *pFH, ABFScopeConfig *pCfg) { ABFSignal *pT = pCfg->TraceList; for (int i=0; inTraceCount; i++, pT++) { if (pT->bFloatData) { float fUUTop = pT->fDisplayGain; float fUUBottom = pT->fDisplayOffset; float fDisplayRange = fUUTop - fUUBottom; float fDisplayOffset = (fUUTop + fUUBottom)/2; // FIX FIX FIX FIX FIX float fInputRange = pFH->fArithmeticUpperLimit - pFH->fArithmeticLowerLimit; float fInputOffset = (pFH->fArithmeticUpperLimit + pFH->fArithmeticLowerLimit)/2; pT->fDisplayGain = fInputRange / fDisplayRange; pT->fDisplayOffset = fDisplayOffset - fInputOffset; } else { ABFH_DisplayRangeToGainOffset( pFH, pFH->nADCSamplingSeq[pT->nMxOffset], pT->fDisplayGain, pT->fDisplayOffset, &pT->fDisplayGain, &pT->fDisplayOffset); } } } */ //*********************************************************************************************** // The following three utility functions work for both old FETCHEX and old // CLAMPEX files, the array indices being the same for each case. //=============================================================================================== // FUNCTION: GetOldDACUnits // PURPOSE: Extract the units-of-measure string for DAC channel 0 from the second label. // static void GetOldDACUnits(char *Label, char *DACLabel) { strncpy(DACLabel, Label+ABF_OLDUNITLEN, ABF_DACUNITLEN); } //=============================================================================================== // FUNCTION: GetOldADCUnits // PURPOSE: Extract the units-of-measure strings for ADC channels 0 and 1 from the // fourth and fifth labels, respectively. // static void GetOldADCUnits(char *Label, char *ADCLabel) { strncpy(ADCLabel, Label+3*ABF_OLDUNITLEN, ABF_ADCUNITLEN); strncpy(ADCLabel+(ABF_ADCCOUNT-2)*ABF_ADCUNITLEN, Label+3*ABF_OLDUNITLEN, ABF_ADCUNITLEN); strncpy(ADCLabel+8, Label+4*ABF_OLDUNITLEN, ABF_ADCUNITLEN); strncpy(ADCLabel+(ABF_ADCCOUNT-1)*ABF_ADCUNITLEN, Label+4*ABF_OLDUNITLEN, ABF_ADCUNITLEN); } //=============================================================================================== // FUNCTION: ReadADCInfo // PURPOSE: Read ADC channel scaling factors etc. // static BOOL ReadADCInfo(FILEHANDLE hFile, float *Param, char *ADCLabel ) { // Seek to the start of the ADC channel information. #if defined(_MSC_VER) SetFilePointer(hFile, 640L, NULL, FILE_BEGIN); #else c_SetFilePointer(hFile, 640L, NULL, FILE_BEGIN); #endif // Read the ADC channel information and display parameters (97-160). // 4 arrays of ABF_ADCCOUNT x 4 byte floats if (!ABFU_ReadFile(hFile, Param+F53_INSTOFFSET, 4 * ABF_ADCCOUNT * sizeof(float))) return FALSE; // Read the ADC channel units strings into a single string return ABFU_ReadFile(hFile, ADCLabel, ABF_ADCCOUNT * ABF_ADCUNITLEN); } //=============================================================================================== // Code for translation of old FETCHEX parameter and data file headers. // It will handle two different file formats: // // 1. Data files (program versions before 5.1): // // 320 80 single-precision (4-byte) values in Microsoft BASIC binary format // 77 77-byte ASCII character string for file comment // 80 5 16-byte ASCII character strings for units-of-measure: // time-scale "us" // DAC channel #0 // (unused) // ADC channel #0 // (unused) // 35 35 bytes of environment data // 512 bytes of unused header // ---- --------------------------- // 1024 bytes total for file header // // 2. Parameter and data files (program versions 5.1 and later): // // 320 80 single-precision (4-byte) values in IEEE floating-point format // 77 77-byte ASCII character string for file comment // 80 5 16-byte ASCII character strings (80 bytes) for units-of-measure: // time-scale "us" // DAC channel #0 // DAC channel #1 // (unused) // (unused) // 3 3 bytes of unused space // 160 16 10-byte strings (160 bytes) of channel names // 256 64 single-precision (4-byte) values in IEEE floating-point format // 128 16 8-byte ASCII character strings (128 bytes) for units-of-measure: // ADC channel #0 // . // . // . // ADC channel #15 // ---- --------------------------- // 1024 bytes total for file header // // See also the extensive documentation for the format of the Version 5.1 // parameter array. // // NOTE: the parameter version number (Param[9]) is NOT updated here. // //----------------------------------------------------------------------------- //=============================================================================================== // FUNCTION: ReadADCNames // PURPOSE: Read the channel names array. // static BOOL ReadADCNames(FILEHANDLE hFile, char *ChannelName) { // Seek to the channel names area. #if defined(_MSC_VER) SetFilePointer(hFile, 480L, NULL, FILE_BEGIN); #else c_SetFilePointer(hFile, 480L, NULL, FILE_BEGIN); #endif // Read the ADC channel name strings into a single string. return ABFU_ReadFile(hFile, ChannelName, ABF_ADCCOUNT * ABF_ADCNAMELEN); } //=============================================================================================== // FUNCTION: FetchexToV5_3 // PURPOSE: Convert fetchex parameters prior to file version 5.3 to the V5.3 format. // static BOOL FetchexToV5_3( float *Param ) { // Correct the acquisition mode. if (Param[F53_OPERATIONMODE] == 1.0F) Param[F53_OPERATIONMODE] = 2.0F; // Convert old parameter 22 to event-triggered mode. if (Param[22] == -1.0F) { Param[22] = 0.0F; Param[F53_OPERATIONMODE] = 0.0F; } // Set the default DAC channel 0 gain. if (Param[F53_GAINDACTOCELL] == 0.0F) Param[F53_GAINDACTOCELL] = 1.0F; // Convert the DAC channel 0 gain from milli-volts to volts. Param[F53_GAINDACTOCELL] = Param[F53_GAINDACTOCELL] * 1000.0F; // Initialize the amplification factors for (int i=0; i 0 & 15 Param[F53_ADCDISPLAYOFFSET] = Param[F53_VERTICALOFFSET]; Param[F53_ADCDISPLAYOFFSET+ABF_ADCCOUNT-1] = Param[F53_ADCDISPLAYOFFSET]; // Check the number of 512-sample segments per episode (old versions // allowed values of 8, 16, 24, ..., 2048), and adjust if necessary. int nSamplesPerEpisode = short(Param[F53_OLDSAMPLESPEREPISODE]); // if FETCHEX can't read the data, return an error. if ((nSamplesPerEpisode == 0) || (nSamplesPerEpisode % 512 != 0)) return FALSE; Param[F53_SEGMENTSPEREPISODE] = (float)(nSamplesPerEpisode / 512); // Check that ADC range and resolution were set properly if (Param[F53_ADCRANGE] == 0.0F) Param[F53_ADCRANGE] = 10.0F; if (Param[F53_DACRANGE] == 0.0F) Param[F53_DACRANGE] = 10.0F; if (Param[F53_ADCRESOLUTION] == 0.0F) Param[F53_ADCRESOLUTION] = 12.0F; if (Param[F53_DACRESOLUTION] == 0.0F) Param[F53_DACRESOLUTION] = 12.0F; Param[F53_INVALIDLASTDATA] = 0.0F; return TRUE; } //=============================================================================================== // FUNCTION: DataResolution // PURPOSE: Return the data resolution given the number of bits used. // static ABFLONG DataResolution( float fNumberOfBits ) { switch (short(fNumberOfBits)) { case 16: return(32768L); case 14: return(8192L); default: return(2048L); } } //=============================================================================================== // FUNCTION: FetchexToABF1_x // PURPOSE: Converts FETCHEX parameters to ABF format. // static void FetchexToABF1_x( float *Param, char *ADCLabel, char *DACLabel, char *ChannelName, char *Comment, ABFFileHeader *pFH ) { short i, n; ABFLONG OldSynchArraySize; // Initialize structure to all NULL's ABFH_Initialize(pFH); pFH->lFileSignature = ABF_OLDPCLAMP; pFH->lActualEpisodes = 1; // Gap-free, EventLen files fixed later pFH->lActualAcqLength = (ABFLONG)(Param[F53_SAMPLESPEREPISODE]) * (ABFLONG)(Param[F53_ACTUALEPISODESPERFILE]) - (ABFLONG)(Param[F53_NUMPOINTSIGNORED]) - (ABFLONG)(Param[F53_INVALIDLASTDATA]); pFH->lFileStartTime = (ABFLONG)(Param[F53_FILESTARTTIME]); pFH->lStopwatchTime = (ABFLONG)(Param[F53_FILESTARTTIME] - Param[F53_FILEELAPSEDTIME]); pFH->fFileVersionNumber = Param[F53_FILEVERSIONNUMBER]; pFH->fHeaderVersionNumber = ABF_CURRENTVERSION; pFH->lFileStartDate = (ABFLONG)(Param[F53_FILESTARTDATE]); pFH->nExperimentType = ABF_VOLTAGECLAMP; // Voltage Clamp pFH->fADCSecondSampleInterval = 0.0F; // CLAMPEX only pFH->fADCSampleInterval = Param[F53_ADCSAMPLEINTERVAL]; pFH->lPreTriggerSamples = 0; // default to 0 pFH->nManualInfoStrategy = ABF_ENV_WRITEEACHTRIAL; // default to write-each-trial if (Param[F53_OPERATIONMODE] == 0.0F) { pFH->nOperationMode = ABF_VARLENEVENTS; pFH->fSecondsPerRun = 0.0F; pFH->lPreTriggerSamples = (ABFLONG)((1.0F-Param[F53_POSTTRIGGERPORTION]) * Param[F53_SAMPLESPEREPISODE]); } else { pFH->nOperationMode = ABF_GAPFREEFILE; pFH->fSecondsPerRun = Param[F53_SAMPLESPEREPISODE] / 1E6F * Param[F53_EPISODESPERFILE] * Param[F53_REQUESTEDSAMPLEINTERVAL]; } pFH->nNumPointsIgnored = short(Param[F53_NUMPOINTSIGNORED]); pFH->lTagSectionPtr = ABFLONG(Param[F53_TAGSECTIONPTR]); pFH->lNumTagEntries = ABFLONG(Param[F53_NUMTAGENTRIES]); if (Param[F53_SEGMENTSPEREPISODE] > 4) // Fixup for AXOTAPE bug. pFH->lNumSamplesPerEpisode = 512L; else pFH->lNumSamplesPerEpisode = (ABFLONG)(Param[F53_SEGMENTSPEREPISODE]) * 512L; pFH->lClockChange = 0; // CLAMPEX only pFH->_lDACFilePtr = 0; // CLAMPEX only pFH->_lDACFileNumEpisodes = 0; // CLAMPEX only pFH->lStartDisplayNum = 0; // CLAMPEX only pFH->lFinishDisplayNum = 0; // CLAMPEX only pFH->nMultiColor = 1; // CLAMPEX only switch (short(Param[F53_AUTOSAMPLEINSTRUMENT])) { case 0: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEMANUAL; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1; break; case 1: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEAUTOMATIC; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1; break; case 2: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEAUTOMATIC; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1B; break; case 3: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEDISABLED; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1; break; case 4: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEAUTOMATIC; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH201; break; default: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEDISABLED; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1; break; } pFH->fCellID1 = Param[F53_CELLID1]; pFH->fCellID2 = Param[F53_CELLID2]; pFH->_fAutosampleMembraneCap = 0.0F; pFH->fCellID3 = Param[F53_THRESHOLDCURRENT]; if (Param[F53_ADDITINSTGAIN] != 0.0F) pFH->_fAutosampleAdditGain = Param[F53_ADDITINSTGAIN]; else pFH->_fAutosampleAdditGain = 1.0F; pFH->_fAutosampleFilter = Param[F53_INSTRUMENTFILTER]; pFH->_nAutosampleADCNum = short(Param[F53_ADCFIRSTLOGICALCHANNEL]); pFH->lNumberOfTrials = 1; // CLAMPEX only pFH->lRunsPerTrial = 1; // CLAMPEX only pFH->lEpisodesPerRun = 1; // CLAMPEX only pFH->nADCNumChannels = short(Param[F53_ADCNUMCHANNELS]); pFH->nFirstEpisodeInRun = 0; // CLAMPEX only pFH->fTrialStartToStart = 0.0F; // CLAMPEX only pFH->fEpisodeStartToStart = 0.0F; // CLAMPEX only pFH->fScopeOutputInterval = 0.0F; // CLAMPEX only pFH->fADCRange = Param[F53_ADCRANGE]; pFH->fDACRange = Param[F53_DACRANGE]; pFH->lADCResolution = DataResolution(Param[F53_ADCRESOLUTION]); pFH->lDACResolution = DataResolution(Param[F53_DACRESOLUTION]); pFH->lDeltaArrayPtr = 0; pFH->lNumDeltas = 0; pFH->nDrawingStrategy = 1; // Display data in real time pFH->nTiledDisplay = 1; // CLAMPEX only pFH->nEraseStrategy = 1; // Erase after each trace pFH->nChannelStatsStrategy = 1; // Show channel stats in gap free pFH->lDisplayAverageUpdate = 0; // CLAMPEX only pFH->nDataDisplayMode = short(Param[F53_DATADISPLAYMODE]); pFH->fTriggerThreshold = 0.0F; pFH->nTriggerSource = short(Param[F53_ADCFIRSTLOGICALCHANNEL]); pFH->nTriggerPolarity = 0; pFH->nAveragingMode = ABF_NOAVERAGING; // AXOTAPE only pFH->fSynchTimeUnit = 0.0F; // use samples for all old files pFH->lSynchArraySize = 0; // These parameters will be reset later on pFH->lSynchArrayPtr = 0; // for files that contain a Synch array pFH->lCalculationPeriod = 16384; // Calculate stats every 16k samples pFH->lSamplesPerTrace = 16384; // 16k samples per trace during acqn. pFH->nTriggerAction = ABF_TRIGGER_STARTEPISODE; // CLAMPEX only pFH->nUndoRunCount = 0; // CLAMPEX only pFH->lAverageCount = 0; pFH->fStatisticsPeriod = pFH->lCalculationPeriod * pFH->fADCSampleInterval / 1E3F; pFH->_nPNPolarity = ABF_PN_SAME_POLARITY; // CLAMPEX only pFH->nStatsSmoothing = 1; strncpy(pFH->_sFileComment, Comment, ABF_OLDFILECOMMENTLEN); // Set up the channel mapping if (Param[F53_ADCNUMBERINGSTRATEGY] == 0.0F) { // Channel numbers are ascending // (AXOLAB-1, AXOLAB 1100, TL-1-125, TL-1-40, TL-3) // NOTE: AXOLAB 1100 only supports 8 channels (0-7) for (i=0; inADCPtoLChannelMap[i] = i; n = short(Param[F53_ADCFIRSTLOGICALCHANNEL]); for (i=0; inADCNumChannels; i++, n++) pFH->nADCSamplingSeq[i] = n; } else { // Channel numbers are decending // (TL-2 only at this stage) for (i=0; i<8; i++) pFH->nADCPtoLChannelMap[i] = short(7 - i); for (i=8; inADCPtoLChannelMap[i] = -1; n = short(8 - pFH->nADCNumChannels); for (i=0; inADCNumChannels; i++, n++) pFH->nADCSamplingSeq[i] = n; } // Set rest of sampling sequence to -1 for (i=pFH->nADCNumChannels; inADCSamplingSeq[i] = -1; // Set up the ADC channel info for (i=0; i < ABF_ADCCOUNT; i++) { pFH->fInstrumentOffset[i] = 0.0F; pFH->fInstrumentScaleFactor[i] = 1.0F; pFH->fADCDisplayAmplification[i] = 1.0F; pFH->fADCDisplayOffset[i] = 0.0F; pFH->fSignalLowpassFilter[i] = ABF_FILTERDISABLED; pFH->fSignalHighpassFilter[i] = 0.0F; pFH->fADCProgrammableGain[i] = 1.0F; pFH->fSignalGain[i] = 1.0F; pFH->fSignalOffset[i] = 0.0F; } for (i=0; i < ABF_ADCCOUNT; i++) { n = pFH->nADCPtoLChannelMap[i]; if (n == -1) break; strncpy(pFH->sADCChannelName[n], ChannelName+ABF_ADCNAMELEN*i, ABF_ADCNAMELEN); strncpy(pFH->sADCUnits[n], ADCLabel+ABF_ADCUNITLEN*i, ABF_ADCUNITLEN); pFH->fInstrumentOffset[n] = Param[F53_INSTOFFSET + i]; // protect against divide by zero errors from bad gains. if (Param[F53_INSTSCALEFACTOR + i] != 0.0F) pFH->fInstrumentScaleFactor[n] = Param[F53_INSTSCALEFACTOR + i]; if (Param[F53_ADCDISPLAYGAIN + i] != 0.0F) pFH->fADCDisplayAmplification[n] = Param[F53_ADCDISPLAYGAIN + i]; // convert offset from percentage of fullscreen to user units pFH->fADCDisplayOffset[n] = Param[F53_ADCDISPLAYOFFSET + i] * pFH->fADCRange / pFH->fInstrumentScaleFactor[i] / pFH->fADCDisplayAmplification[i]; if ((pFH->_nAutosampleEnable != 0) && (n == pFH->_nAutosampleADCNum)) pFH->fADCDisplayOffset[n] /= pFH->_fAutosampleAdditGain; } strncpy(pFH->sDACChannelUnits[0], DACLabel, ABF_DACUNITLEN); for (i=0; i < ABF_DACCOUNT; i++) { pFH->fDACScaleFactor[i] = Param[F53_GAINDACTOCELL]; pFH->fDACHoldingLevel[i] = Param[F53_DAC0HOLDINGLEVEL]; } // Set up the data and Csynch array pointers if (pFH->nOperationMode != ABF_GAPFREEFILE) { pFH->lActualEpisodes = (ABFLONG)(Param[F53_ACTUALEPISODESPERFILE]); pFH->lSynchArraySize = pFH->lActualEpisodes; if (Param[F53_FILEVERSIONNUMBER] >= 5.0F) { // In version 5.0 and later data files the Csynch array is at the // end of the file. pFH->lDataSectionPtr = 2L; pFH->lSynchArrayPtr = 2L + (pFH->lActualAcqLength*2L + 511L) / 512L; } else { // For older data files just adjust the data pointer to allow // for the presence of the Csynch array before the data pFH->lSynchArrayPtr = 2L; pFH->lDataSectionPtr = 2L + (pFH->lSynchArraySize*4L + 511L) / 512L; } } else { pFH->lSynchArrayPtr = 0; pFH->lSynchArraySize = 0; if (Param[F53_FILEVERSIONNUMBER] >= 5.0F) { pFH->lDataSectionPtr = 2; } else { // Adjust for older throughput data files that have a Csynch array // before the data anyway OldSynchArraySize = pFH->lActualAcqLength / (UINT)pFH->lNumSamplesPerEpisode; pFH->lDataSectionPtr = 2L + (OldSynchArraySize*4L + 511L) / 512L; } } } //=============================================================================================== // FUNCTION: FetchexConvert // PURPOSE: Convert an old FETCHEX file into the current ABF format. // static BOOL FetchexConvert( FILEHANDLE hFile, ABFFileHeader *pFH, float *Param, char *Comment, char *Label, int *pnError ) { char ADCLabel[ABF_ADCCOUNT*ABF_ADCUNITLEN]; char ChannelName[ABF_ADCCOUNT*ABF_ADCNAMELEN]; char DACLabel[ABF_DACCOUNT*ABF_DACUNITLEN]; // Handle the case of old (pre-version 5.1) files. ABF_BLANK_FILL(ADCLabel); ABF_BLANK_FILL(DACLabel); ABF_BLANK_FILL(ChannelName); GetOldDACUnits(Label, DACLabel); if (Param[F53_FILEVERSIONNUMBER] < 5.0999F) // MAC doen't like 5.1F { if (!FetchexToV5_3(Param)) ERRORRETURN(pnError, ABFH_EINVALIDFILE); GetOldADCUnits(Label, ADCLabel); } else { // Handle the case of version 5.1 (and later) files. if (!ReadADCNames(hFile, ChannelName)) ERRORRETURN(pnError, ABFH_EHEADERREAD); if (!ReadADCInfo(hFile, Param, ADCLabel)) ERRORRETURN(pnError, ABFH_EHEADERREAD); // Get number of Tags if present if (Param[F53_TAGSECTIONPTR] != 0.0F) { int nNumTags = 0; // Some old versions of fetchex set this value to 2 if (Param[F53_TAGSECTIONPTR] >= 3.0F) { // Seek to start of tag entries block ABFLONG lNumBytes = (ABFLONG)(Param[F53_TAGSECTIONPTR]) * 512L; #if defined(_MSC_VER) SetFilePointer(hFile, lNumBytes, NULL, FILE_BEGIN); #else c_SetFilePointer(hFile, lNumBytes, NULL, FILE_BEGIN); #endif if (!ABFU_ReadFile(hFile, &nNumTags, 2)) ERRORRETURN(pnError, ABFH_EHEADERREAD); } Param[F53_NUMTAGENTRIES] = (float)nNumTags; } } FetchexToABF1_x(Param, ADCLabel, DACLabel, ChannelName, Comment, pFH); return TRUE; } //=============================================================================================== // Code for translation of old CLAMPEX parameter and data file headers. // It will handle two different file formats: // // 1. Data files (program versions before 5): // 320 80 single-precision (4-byte) values in Microsoft BASIC binary format // 77 77-byte ASCII character string for file comment // 80 5 16-byte ASCII character strings for units-of-measure: // time-scale "us" // DAC channel #0 // (unused) // ADC channel #0 // ADC channel #1 // 35 35 bytes of environment data // 64 64-byte ASCII character string for the presweep (conditioning) pulse parameters // 448 bytes of unused header // ---- --------------------------- // 1024 bytes total for file header // // 2. Parameter and data files (program versions 5 and later): // // 320 80 single-precision (4-byte) values in IEEE floating-point format // 77 77-byte ASCII character string for file comment // 80 5 16-byte ASCII character strings (80 bytes) for units-of-measure: // time-scale "us" // DAC channel #0 // (unused) // (unused) // (unused) // 35 35 bytes of environment data // 64 64-byte ASCII character string for the presweep (conditioning) pulse parameters // 320 80 single-precision (4-byte) values in IEEE floating-point format // 128 16 8-byte ASCII character strings for units-of-measure: // ADC channel #0 // . // . // . // ADC channel #15 // ---- --------------------------- // 1024 bytes total for file header // // See also the extensive documentation for the format of the Version 5 // parameter array. // // Support for pre- version 5 parameter has been dropped. // // NOTE: the parameter version number (Param[C52_FILEVERSIONNUMBER]) is NOT // updated here, since the trial routines need it to decide whether the // data is in averaged form (version 5+) or accumulated form (Version < 5). //=============================================================================================== // FUNCTION: ReadCondit // PURPOSE: Read presweep (conditioning) train parameters from an old file. // static BOOL ReadCondit(FILEHANDLE hFile, char *Condit) { // Seek to the presweep (conditioning) string #if defined(_MSC_VER) SetFilePointer(hFile, 512L, NULL, FILE_BEGIN); #else c_SetFilePointer(hFile, 512L, NULL, FILE_BEGIN); #endif // Read the presweep (conditioning) pulse string. return ABFU_ReadFile(hFile, Condit, ABF_OLDCONDITLEN); } //=============================================================================================== // FUNCTION: ClampexToV5_2 // PURPOSE: Convert CLAMPEX files prior to file version 5.2 to V5.2 format. // #define STEPPED 1 // stepped waveform #define RAMPED 2 // ramp waveform static void ClampexToV5_2(float *Param) { int i; // Set the default for the number of runs per trial. if (Param[C52_RUNSPERFILE] < 1.0F) Param[C52_RUNSPERFILE] = 1.0F; // Set the default for the number of episodes per run. if (Param[C52_EPISODESPERRUN] < 1.0F) Param[C52_EPISODESPERRUN] = 1.0F; // Set the default for the number of trials. if (Param[C52_NUMTRIALS] == 0.0F) Param[C52_NUMTRIALS] = 1.0F; // Set the default for the starting episode number. if (Param[C52_STARTEPISODENUM] == 0.0F) Param[C52_STARTEPISODENUM] = 1.0F; // Set the default for the number of data samples per episode. // (Very old versions of the program didn// t set Param[C52_SEGMENTSPEREPISODE], // since all episodes were 512 samples long) if (Param[C52_SEGMENTSPEREPISODE] < 1.0F) Param[C52_SEGMENTSPEREPISODE] = 1.0F; // Convert the DAC channel 0 gain from milli-volts to volts. Param[C52_GAINDACTOCELL] = Param[C52_GAINDACTOCELL] * 1000.0F; // Change the ADC multiplexer code (48) to the number of channels to sample. Param[C52_ADCNUMCHANNELS] = Param[C52_OLDMULTIPLEXCODE] + 1.0F; // Check that the number of channels is within range. if (Param[C52_ADCNUMCHANNELS] < 1) Param[C52_ADCNUMCHANNELS] = 1.0F; // Set the default for the stimulus duration to 10 samples. if (Param[C52_CH1PULSE] == 0.0F) Param[C52_CH1PULSE] = 10.0F; if (Param[C52_CH2PULSE] == 0.0F) Param[C52_CH2PULSE] = 10.0F; // Initialize the ADC scaling factors to 1.0 for (i=0; i= 2.0F) Param[C52_AUTOPEAKSEARCHMODE] += 2.0F; // Set the number of the search channel. if (Param[C52_ADCNUMCHANNELS] == 2.0F) Param[C52_AUTOPEAKCHANNEL] = 1.0F; else Param[C52_AUTOPEAKCHANNEL] = 0.0F; } Param[C52_PNNUMPULSES] = 0.0F; Param[C52_PNADCNUM] = 0.0F; Param[C52_PNHOLDINGLEVEL] = 0.0F; Param[C52_PNSETTLINGTIME] = 0.0F; Param[C52_PNINTERPULSE] = 0.0F; } //=============================================================================================== // FUNCTION: ClampexToABF1_x // PURPOSE: Convert old CLAMPEX parameters to ABF format. // static void ClampexToABF1_x( float *Param, char *ADCLabel, char *DACLabel, char *Condit, char *Comment, ABFFileHeader *pFH ) { short i, n; float EpiTime; // Initialize structure to all NULL's ABFH_Initialize(pFH); pFH->lFileSignature = ABF_OLDPCLAMP; pFH->lActualEpisodes = (ABFLONG)(Param[C52_EPISODESPERFILE]); // 4 pFH->lActualAcqLength = (ABFLONG)(Param[C52_SAMPLESPEREPISODE]) * (ABFLONG)(Param[C52_EPISODESPERFILE]); pFH->lFileStartTime = (ABFLONG)(Param[C52_FILESTARTTIME]); pFH->lStopwatchTime = (ABFLONG)(Param[F53_FILESTARTTIME] - Param[F53_FILEELAPSEDTIME]); pFH->fFileVersionNumber = Param[C52_FILEVERSIONNUMBER]; pFH->fHeaderVersionNumber = ABF_CURRENTVERSION; pFH->lFileStartDate = (ABFLONG)(Param[C52_FILESTARTDATE]); pFH->nExperimentType = ABF_VOLTAGECLAMP; // Voltage Clamp pFH->fADCSecondSampleInterval = Param[C52_SECONDCLOCKPERIOD]; pFH->fADCSampleInterval = Param[C52_FIRSTCLOCKPERIOD]; pFH->nOperationMode = ABF_WAVEFORMFILE; // CLAMPEX file - waveform mode pFH->lPreTriggerSamples = 0; // Fetchex only pFH->nManualInfoStrategy = ABF_ENV_WRITEEACHTRIAL; // default to write-each-trial pFH->nNumPointsIgnored = 0; // Fetchex only pFH->lTagSectionPtr = 0; pFH->lNumTagEntries = 0; pFH->lNumSamplesPerEpisode = (ABFLONG)(Param[C52_SEGMENTSPEREPISODE]) * 512L; pFH->lClockChange = 0; pFH->fSecondsPerRun = 0.0F; pFH->_lDACFilePtr = 0; pFH->_lDACFileNumEpisodes = 0; pFH->lStartDisplayNum = 1; pFH->lFinishDisplayNum = 0; pFH->nMultiColor = 1; if (Param[C52_DISPLAYSEGMENTNUM] != 0.0F) { pFH->lFinishDisplayNum = (ABFLONG)(Param[C52_DISPLAYSEGMENTNUM]) * 512L; pFH->lStartDisplayNum = pFH->lFinishDisplayNum - 511L; } switch (short(Param[C52_AUTOSAMPLEINSTRUMENT])) { case 0: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEMANUAL; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1; break; case 1: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEAUTOMATIC; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1; break; case 2: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEAUTOMATIC; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1B; break; case 3: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEDISABLED; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1; break; case 4: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEAUTOMATIC; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH201; break; default: pFH->_nAutosampleEnable = ABF_AUTOSAMPLEDISABLED; pFH->_nAutosampleInstrument = ABF_INST_AXOPATCH1; break; } pFH->fCellID1 = 0.0F; pFH->fCellID2 = 0.0F; pFH->_fAutosampleMembraneCap = 0.0F; pFH->fCellID3 = 0.0F; if (Param[C52_GAINMULTIPLIER] == 0.0F) pFH->_fAutosampleAdditGain = 1.0F; else pFH->_fAutosampleAdditGain = Param[C52_GAINMULTIPLIER]; pFH->_fAutosampleFilter = Param[C52_FILTERCUTOFF]; // 41 pFH->_nAutosampleADCNum = short(Param[C52_AUTOSAMPLEADCNUM]); // 96 pFH->lNumberOfTrials = ABFLONG(Param[C52_NUMTRIALS]); // 16 pFH->lRunsPerTrial = ABFLONG(Param[C52_RUNSPERFILE]); // 12 pFH->lEpisodesPerRun = ABFLONG(Param[C52_EPISODESPERRUN]); // 13 pFH->nADCNumChannels = short(Param[C52_ADCNUMCHANNELS]); pFH->nFirstEpisodeInRun = short(Param[C52_STARTEPISODENUM]); // 17 pFH->fTrialStartToStart = 0.0F; pFH->fEpisodeStartToStart = Param[C52_INTEREPISODETIME]; // 11 pFH->fScopeOutputInterval = Param[C52_STARTDELAY]; // 15 pFH->fADCRange = Param[C52_ADCRANGE]; pFH->fDACRange = Param[C52_DACRANGE]; pFH->lADCResolution = DataResolution(Param[C52_ADCRESOLUTION]); pFH->lDACResolution = DataResolution(Param[C52_DACRESOLUTION]); pFH->lDeltaArrayPtr = 0; pFH->lNumDeltas = 0; pFH->nDrawingStrategy = 1; // Display data in real time pFH->nTiledDisplay = 0; pFH->nEraseStrategy = short(Param[C52_AUTOERASE]); // 69 pFH->nChannelStatsStrategy = 1; // FETCHEX only pFH->lDisplayAverageUpdate = short(Param[C52_AVERAGEDDATADISPLAY]); // 65 pFH->nDataDisplayMode = short(Param[C52_DATADISPLAYMODE]); pFH->fTriggerThreshold = 0.0F; // FETCHEX only if (Param[C52_TRIGGERMODE] == 0.0F) pFH->nTriggerSource = short(Param[C52_ADCFIRSTLOGICALCHANNEL]); else pFH->nTriggerSource = short(-Param[C52_TRIGGERMODE]); pFH->nTriggerPolarity = 0; // FETCHEX only pFH->nAveragingMode = ABF_NOAVERAGING; // AXOTAPE only pFH->fSynchTimeUnit = 0.0F; pFH->lSynchArraySize = 0; // FETCHEX only pFH->lSynchArrayPtr = 0; // FETCHEX only pFH->lCalculationPeriod = 16384; // FETCHEX only pFH->lSamplesPerTrace = 16384; // FETCHEX only pFH->nTriggerAction = ABF_TRIGGER_STARTEPISODE; // Start one episode pFH->nUndoRunCount = 0; // Disabled pFH->lDataSectionPtr = 2; pFH->lAverageCount = (ABFLONG)(Param[C52_RUNSPERFILE]); pFH->fStatisticsPeriod = pFH->lCalculationPeriod * pFH->fADCSampleInterval / 1E3F; strncpy(pFH->_sFileComment, Comment, ABF_OLDFILECOMMENTLEN); // Set up the channel mapping // Channel numbers are always ascending for old CLAMPEX files // (AXOLAB-1, AXOLAB 1100, TL-1-125, TL-1-40, TL-3) // NOTE: AXOLAB 1100 only supports 8 channels (0-7) for (i=0; inADCPtoLChannelMap[i] = i; n = short(Param[C52_ADCFIRSTLOGICALCHANNEL]); for (i=0; inADCNumChannels; i++, n++) pFH->nADCSamplingSeq[i] = n; // Set rest of sampling sequence to -1 for (i=pFH->nADCNumChannels; inADCSamplingSeq[i] = -1; // Set up the ADC channel info for (i=0; ifInstrumentOffset[i] = 0.0F; pFH->fInstrumentScaleFactor[i] = 1.0F; pFH->fADCDisplayAmplification[i] = 1.0F; pFH->fADCDisplayOffset[i] = 0.0F; pFH->fSignalLowpassFilter[i] = ABF_FILTERDISABLED; pFH->fSignalHighpassFilter[i] = 0.0F; pFH->fADCProgrammableGain[i] = 1.0F; pFH->fSignalGain[i] = 1.0F; pFH->fSignalOffset[i] = 0.0F; } for (i=0; i < ABF_ADCCOUNT; i++) { // no physical to logical mapping necessary as CLAMPEX never supported // the TL2 strncpy(pFH->sADCUnits[i], ADCLabel+ABF_ADCUNITLEN*i, ABF_ADCUNITLEN); // protect against divide by zero errors from bad gains. if (Param[C52_INSTSCALEFACTOR + i] != 0.0F) pFH->fInstrumentScaleFactor[i] = Param[C52_INSTSCALEFACTOR + i]; if (Param[C52_ADCDISPLAYGAIN + i] != 0.0F) pFH->fADCDisplayAmplification[i] = Param[C52_ADCDISPLAYGAIN + i]; pFH->fInstrumentOffset[i] = Param[C52_INSTOFFSET + i]; pFH->fADCDisplayOffset[i] = Param[C52_ADCDISPLAYOFFSET + i] * pFH->fADCRange / pFH->fInstrumentScaleFactor[i] / pFH->fADCDisplayAmplification[i]; if ((pFH->_nAutosampleEnable != 0) && (i == pFH->_nAutosampleADCNum)) pFH->fADCDisplayOffset[i] /= pFH->_fAutosampleAdditGain; } strncpy(pFH->sDACChannelUnits[0], DACLabel, ABF_DACUNITLEN); for (i=0; ifDACScaleFactor[i] = Param[C52_GAINDACTOCELL]; pFH->fDACHoldingLevel[i] = Param[C52_DAC0HOLDINGLEVEL]; } // CLAMPEX specific parameter sections follow ... // GROUP #6 (14 bytes) - Synchronous timer outputs. if (((Param[C52_CH1PULSE] != 0.0F) || (Param[C52_CH2PULSE] != 0.0F)) && (Param[C52_LASTTRIGGEREPISODE] != 0.0F) ) pFH->nOUTEnable = 1; else pFH->nOUTEnable = 0; pFH->nSampleNumberOUT1 = short(Param[C52_PULSESAMPLECH1]); pFH->nSampleNumberOUT2 = short(Param[C52_PULSESAMPLECH2]); pFH->nFirstEpisodeOUT = short(Param[C52_FIRSTTRIGGEREPISODE]); pFH->nLastEpisodeOUT = short(Param[C52_LASTTRIGGEREPISODE]); pFH->nPulseSamplesOUT1 = short(Param[C52_CH1PULSE]); pFH->nPulseSamplesOUT2 = short(Param[C52_CH2PULSE]); // GROUP #7 (172 bytes) - Epoch Output Waveform and Pulses pFH->nDigitalEnable = 0; pFH->_nWaveformSource = 1; // Waveform from epochs. pFH->nActiveDACChannel = 0; pFH->_nInterEpisodeLevel = short(Param[C52_INTEREPISODEAMP]); pFH->_nEpochType[0] = short(Param[C52_EPOCHATYPE]); pFH->_fEpochInitLevel[0] = Param[C52_EPOCHALEVELINIT]; pFH->_fEpochLevelInc[0] = Param[C52_EPOCHAINCREMENT]; pFH->_nEpochInitDuration[0] = short(int(Param[C52_EPOCHAINITDURATION]) / pFH->nADCNumChannels); pFH->_nEpochDurationInc[0] = short(int(Param[C52_EPOCHADURATIONINC]) / pFH->nADCNumChannels); pFH->_nEpochType[1] = short(Param[C52_EPOCHBTYPE]); pFH->_fEpochInitLevel[1] = Param[C52_EPOCHBLEVELINIT]; pFH->_fEpochLevelInc[1] = Param[C52_EPOCHBINCREMENT]; pFH->_nEpochInitDuration[1] = short(int(Param[C52_EPOCHBINITDURATION]) / pFH->nADCNumChannels); pFH->_nEpochDurationInc[1] = short(int(Param[C52_EPOCHBDURATIONINC]) / pFH->nADCNumChannels); pFH->_nEpochType[2] = short(Param[C52_EPOCHCTYPE]); pFH->_fEpochInitLevel[2] = Param[C52_EPOCHCLEVELINIT]; pFH->_fEpochLevelInc[2] = Param[C52_EPOCHCINCREMENT]; pFH->_nEpochInitDuration[2] = short(int(Param[C52_EPOCHCINITDURATION]) / pFH->nADCNumChannels); pFH->_nEpochDurationInc[2] = short(int(Param[C52_EPOCHCDURATIONINC]) / pFH->nADCNumChannels); pFH->_nEpochType[3] = short(Param[C52_EPOCHDTYPE]); pFH->_fEpochInitLevel[3] = Param[C52_EPOCHDLEVELINIT]; pFH->_fEpochLevelInc[3] = Param[C52_EPOCHDINCREMENT]; pFH->_nEpochInitDuration[3] = short(int(Param[C52_EPOCHDINITDURATION]) / pFH->nADCNumChannels); pFH->_nEpochDurationInc[3] = short(int(Param[C52_EPOCHDDURATIONINC]) / pFH->nADCNumChannels); for (i=0; i<4; i++) { if ((pFH->_nEpochInitDuration[i] == 0) && (pFH->_nEpochDurationInc[i] == 0)) pFH->_nEpochType[i] = 0; } for (i=4; i_nEpochType[i] = 0; pFH->_fEpochInitLevel[i] = 0.0F; pFH->_fEpochLevelInc[i] = 0.0F; pFH->_nEpochInitDuration[i]= 0; pFH->_nEpochDurationInc[i] = 0; } pFH->nDigitalHolding = 0; pFH->nDigitalInterEpisode = 0; pFH->nDigitalTrainActiveLogic= 1; for (i=0; inDigitalValue[i] = 0; pFH->nDigitalTrainValue[i] = 0; } // GROUP #8 (80 bytes) - Analog Output File Waveform pFH->_fDACFileScale = 1.0F; pFH->_fDACFileOffset = 0.0F; pFH->_nDACFileEpisodeNum = 1; pFH->_nDACFileADCNum = 1; // GROUP #9 (32 bytes) - Presweep (conditioning) pulse train. if (Param[C52_PULSESINTRAIN] != 0.0F) pFH->_nConditEnable = 1; else pFH->_nConditEnable = 0; pFH->_nConditChannel = 0; pFH->_lConditNumPulses = (ABFLONG)(Param[C52_PULSESINTRAIN]); pFH->_fBaselineDuration = Param[C52_PRECONDURATION]; pFH->_fBaselineLevel = Param[C52_PRECONLEVEL]; pFH->_fStepDuration = Param[C52_CONDURATION]; pFH->_fStepLevel = Param[C52_CONLEVEL]; pFH->_fPostTrainPeriod = Param[C52_POSTCONDURATION]; pFH->_fPostTrainLevel = Param[C52_POSTCONLEVEL]; // GROUP #10 ( 82 bytes) - Variable parameter list. // remap old parameter number to start at 1 for C52_PULSESINTRAIN. See const // definitions in ABFFILES.INC if (Param[C52_CONDITVARIABLE] != 0) { pFH->_nListEnable = 1; pFH->_nParamToVary = short(Param[C52_CONDITVARIABLE] - C52_PULSESINTRAIN + 0.5F); } else { pFH->_nListEnable = 0; pFH->_nParamToVary = 0; } strncpy(pFH->_sParamValueList, Condit, ABF_OLDCONDITLEN); // GROUP #11 (14 bytes) - Autopeak measurement. if (Param[C52_AUTOPEAKSEARCHMODE] == 0) pFH->nStatsEnable = 0; else pFH->nStatsEnable = 1; UINT uBitMask = 0x01 << short(Param[C52_AUTOPEAKCHANNEL]); pFH->nStatsActiveChannels = (short)uBitMask; n = short(Param[C52_AUTOPEAKSEARCHMODE]); for (UINT uRegion = 0; uRegion < ABF_STATS_REGIONS; uRegion++) { switch (n) { case 5: pFH->nStatsSearchMode[ uRegion ] = ABF_PEAK_SEARCH_ALL; break; case 6: pFH->nStatsSearchMode[ uRegion ] = 0; break; default: pFH->nStatsSearchMode[ uRegion ] = short(Param[C52_AUTOPEAKSEARCHMODE]); break; } pFH->lStatsStart[ uRegion ] = 0; pFH->lStatsEnd[ uRegion ] = 0; } for (UINT uChannel = 0; uChannel < ABF_ADCCOUNT; uChannel++) { if (Param[C52_AUTOPEAKCENTER] < 0) pFH->nStatsChannelPolarity[ uChannel ] = ABF_PEAK_NEGATIVE; else pFH->nStatsChannelPolarity[ uChannel ] = ABF_PEAK_POSITIVE; } pFH->nStatsBaseline = short(Param[C52_BASELINECALCULATION]); pFH->nStatsSmoothing = short(Param[C52_AUTOPEAKAVPOINTS]); if (pFH->nStatsSmoothing < 1) pFH->nStatsSmoothing = 1; // GROUP #12 (40 bytes) - Channel Arithmetic pFH->nArithmeticEnable = 0; pFH->fArithmeticUpperLimit = 0.0F; pFH->fArithmeticLowerLimit = 0.0F; pFH->nArithmeticADCNumA = 0; pFH->nArithmeticADCNumB = 0; pFH->fArithmeticK1 = 0.0F; pFH->fArithmeticK2 = 0.0F; pFH->fArithmeticK3 = 0.0F; pFH->fArithmeticK4 = 0.0F; pFH->fArithmeticK5 = 0.0F; pFH->fArithmeticK6 = 0.0F; strncpy(pFH->sArithmeticOperator, "+ ", ABF_ARITHMETICOPLEN); pFH->nArithmeticExpression = ABF_SIMPLE_EXPRESSION; // GROUP #13 (20 bytes) - On-line subtraction. if (Param[C52_PNNUMPULSES] != 0) { pFH->_nPNEnable = 1; pFH->nPNNumPulses = short(fabs(Param[C52_PNNUMPULSES])); } else { pFH->_nPNEnable = 0; pFH->nPNNumPulses = 1; } if (Param[C52_PNNUMPULSES] < 0) pFH->_nPNPolarity = ABF_PN_SAME_POLARITY; else pFH->_nPNPolarity = ABF_PN_OPPOSITE_POLARITY; pFH->nPNPosition = 0; pFH->_nPNADCNum = short(Param[C52_PNADCNUM]); pFH->_fPNHoldingLevel = Param[C52_PNHOLDINGLEVEL]; pFH->fPNSettlingTime = Param[C52_PNSETTLINGTIME]; pFH->fPNInterpulse = Param[C52_PNINTERPULSE]; if (pFH->fPNInterpulse > 0.0F) { if (pFH->fADCSecondSampleInterval == 0.0F) EpiTime = pFH->fADCSampleInterval * pFH->lNumSamplesPerEpisode; else EpiTime = (pFH->fADCSampleInterval + pFH->fADCSecondSampleInterval) * pFH->lNumSamplesPerEpisode/2; pFH->fPNInterpulse += EpiTime / 1E3F; } } //=============================================================================================== // FUNCTION: ClampexConvert // PURPOSE: Convert an old CLAMPEX file to the current ABF format. // static int ClampexConvert( FILEHANDLE hFile, ABFFileHeader *pFH, float *Param, char *Comment, char *Label, int *pnError ) { char ADCLabel[ABF_ADCCOUNT*ABF_ADCUNITLEN]; char DACLabel[ABF_DACCOUNT*ABF_DACUNITLEN]; char ConditStr[ABF_OLDCONDITLEN]; ABF_BLANK_FILL(ADCLabel); ABF_BLANK_FILL(DACLabel); ABF_BLANK_FILL(ConditStr); GetOldDACUnits(Label, DACLabel); // Handle the case of old (pre-version 5) files. if (Param[C52_FILEVERSIONNUMBER] < 5.0F) { ClampexToV5_2(Param); GetOldADCUnits(Label, ADCLabel); // Read in the conditioning string if (!ReadCondit(hFile, ConditStr)) ERRORRETURN(pnError, ABFH_EHEADERREAD); } else // Handle the case of version 5 (and later) files. { if (Param[C52_FILEVERSIONNUMBER] < 5.1999F) // MAC doen't like 5.2F { Param[C52_GAINMULTIPLIER] = 1.0F; Param[C52_FILTERCUTOFF] = ABF_FILTERDISABLED; Param[C52_AUTOSAMPLEINSTRUMENT] = 3.0F; Param[C52_INTEREPISODEAMP] = 0.0F; Param[C52_INTEREPISODEWRITE] = 0.0F; } else if (Param[C52_AUTOSAMPLEINSTRUMENT] == 3.0F) { Param[C52_GAINMULTIPLIER] = 1.0F; Param[C52_FILTERCUTOFF] = ABF_FILTERDISABLED; } // Read in the conditioning string if (!ReadCondit(hFile, ConditStr)) ERRORRETURN(pnError, ABFH_EHEADERREAD); // Read the extended parameters (81-96). (16 x 4-byte floats) if (!ABFU_ReadFile(hFile, Param+80, 16 * sizeof(float))) ERRORRETURN(pnError, ABFH_EHEADERREAD); if (!ReadADCInfo(hFile, Param, ADCLabel)) ERRORRETURN(pnError, ABFH_EHEADERREAD); } ClampexToABF1_x(Param, ADCLabel, DACLabel, ConditStr, Comment, pFH); return TRUE; } //=============================================================================================== // FUNCTION: ReadOldHeader // PURPOSE: This is the main routine to read old FETCHEX and CLAMPEX data headers. // BOOL OLDH_ReadOldHeader( FILEHANDLE hFile, UINT uFileType, int bMSBinFormat, ABFFileHeader *pFH, ABFLONG lFileLength, int *pnError) { // ABFH_WASSERT(pFH); int i; BOOL bRval; float Param[ABF_OLDPARAMSIZE]; // Allocate old arrays for reading the data char Comment[ABF_OLDCOMMENTLEN]; char Label[5 * ABF_OLDUNITLEN]; // Read parameters 1-80 (80 x 4-byte floats) if (!ABFU_ReadFile(hFile, Param, 80 * sizeof(float))) ERRORRETURN(pnError, ABFH_EHEADERREAD); // convert the parameters to IEEE floating-point format if necessary. if (bMSBinFormat) { for (i=0; i < 80; i++) fMSBintoIeee(Param+i, Param+i); for(i=80; i < ABF_OLDPARAMSIZE; i++) Param[i] = 0.0F; } // Read the file comment. if (!ABFU_ReadFile(hFile, Comment, ABF_OLDCOMMENTLEN)) ERRORRETURN(pnError, ABFH_EHEADERREAD); // Read the units-of-measure strings into a single string. if (!ABFU_ReadFile(hFile, Label, sizeof(Label))) ERRORRETURN(pnError, ABFH_EHEADERREAD); if (uFileType == ABF_FETCHEX) bRval = FetchexConvert(hFile, pFH, Param, Comment, Label, pnError); else bRval = ClampexConvert(hFile, pFH, Param, Comment, Label, pnError); pFH->nFileType = short(uFileType); pFH->nMSBinFormat = short(bMSBinFormat); // // Check data length against the length of the file. Some old versions of AXOTAPE // incorrectly set the number of 512 byte blocks per episode to 512. // ABFLONG lMaxLength = (lFileLength - pFH->lDataSectionPtr * 512L - pFH->lSynchArraySize * 8L) / 2L; if (pFH->lActualAcqLength > lMaxLength) { if ((pFH->nOperationMode != ABF_VARLENEVENTS) && (pFH->nOperationMode != ABF_GAPFREEFILE)) { ABFLONG lNumEpisodes = lMaxLength / pFH->lNumSamplesPerEpisode; pFH->lActualEpisodes = lNumEpisodes; if (pFH->lSynchArraySize != 0L) pFH->lSynchArraySize = lNumEpisodes; lMaxLength = lNumEpisodes * pFH->lNumSamplesPerEpisode; } pFH->lActualAcqLength = lMaxLength; } // Bring the header up to the current version. OLDH_ABFtoABF15(pFH); OLDH_ABFtoCurrentVersion(pFH); return bRval; } stimfit-0.16.0/src/libstfio/abf/axon/AxAbfFio32/abfutil.h0000775000175000017500000000467213277303516017705 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-1999 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // // HEADER: ABFUTIL.H Prototypes for functions in ABFUTIL.CPP // AUTHOR: BHI Feb 1995 #ifndef INC_ABFUTIL_H #define INC_ABFUTIL_H #ifdef __cplusplus extern "C" { #endif #include "AxAbffio32.h" #include "abfheadr.h" #if defined(_WINDOWS) && !defined(__MINGW32__) UINT WINAPI ABFU_GetTempFileName(LPCSTR szPrefix, UINT uUnique, LPSTR lpTempName); #endif BOOL WINAPI ABFU_ReadFile(FILEHANDLE hFile, LPVOID lpBuf, DWORD dwBytesToRead); /* BOOL WINAPI ABFU_FormatDouble(double dNum, int nDigits, char *pszString, UINT uSize); int WINAPI ABFU_FormatHMS( UINT uSeconds, char *pszBuffer, UINT uMaxLen ); */ void WINAPI ABFU_SetABFString(LPSTR psDest, LPCSTR psSrce, int nMaxLength); void WINAPI ABFU_GetABFString(LPSTR psDest, int nMaxDest, LPCSTR psSrce, int nMaxSrce); /* BOOL WINAPI ABFU_IsValidSignalName(LPCSTR pszName); LPCSTR WINAPI ABFU_GetValidSignalNameChars(); void WINAPI ABFU_FixSignalName( LPSTR pszSignalName ); */ // Checks the date is Y2K compliant and fixes it if needed. long WINAPI ABFU_FixFileStartDate( long lDate ); #define ABF_BLANK_FILL(d) (memset((void *)(d), ' ', sizeof(d))) #define ABF_SET_STRING(d, s) (ABFU_SetABFString(d, s, sizeof(d))) #define ABF_GET_STRING(d, s, n) (ABFU_GetABFString(d, n, s, sizeof(s))) /* // Assert that an ABF header is writeable - accounting for the header size. inline void ABFH_WASSERT( ABFFileHeader * pFH ) { #ifdef _DEBUG UINT uHeaderSize = ABFH_IsNewHeader(pFH) ? ABF_HEADERSIZE : ABF_OLDHEADERSIZE; ASSERT(pFH != NULL && !IsBadWritePtr( pFH, uHeaderSize )); //TRACE1( "ABF Header is writeable (%d bytes).\n", uHeaderSize ); #endif } // Assert that an ABF header is readable - accounting for the header size. inline void ABFH_ASSERT( const ABFFileHeader * pFH ) { #ifdef _DEBUG UINT uHeaderSize = ABFH_IsNewHeader(pFH) ? ABF_HEADERSIZE : ABF_OLDHEADERSIZE; ASSERT(pFH != NULL && !IsBadReadPtr( pFH, uHeaderSize )); //TRACE1( "ABF Header is readable (%d bytes).\n", uHeaderSize ); #endif } */ #ifdef __cplusplus } #endif #endif // INC_ABFUTIL_H stimfit-0.16.0/src/libstfio/abf/axon/AxAbfFio32/csynch.cpp0000775000175000017500000004671113277303516020101 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-2002 Axon Instruments, Inc. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // MODULE: CSYNCH.CPP // PURPOSE: Contains member function code for the CSynch class. // AUTHOR: BHI May 1994 // NOTES: // #include "../Common/wincpp.hpp" #include "./csynch.hpp" #include "../Common/FileIO.hpp" #include "./abfutil.h" #if !defined(_WINDOWS) || defined(__MINGW32__) || defined(__STF__) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif //=============================================================================================== // PROCEDURE: _Initialize // PURPOSE: Internal initialization routine. // void CSynch::_Initialize() { #if defined(_WINDOWS) && !defined(__MINGW32__) m_szFileName[0] = '\0'; // Filename for array virtualization #endif m_hfSynchFile = NULL; // Handle to temporary file. m_eMode = eWRITEMODE; // Mode flag for buffering algorithm. m_uSynchCount = 0; // Total count of entries in the synch array m_uCacheCount = 0; // Count of entries in the cache m_uCacheStart = 0; // Number of first entry in the cache. memset(m_SynchBuffer, 0, sizeof(m_SynchBuffer)); // Buffer for caching synch entries. memset(&m_LastEntry, 0, sizeof(m_LastEntry)); // Last entry written (write only). } //=============================================================================================== // PROCEDURE: CSynch // PURPOSE: Constructor. // CSynch::CSynch() { /*MEMBERASSERT();*/ _Initialize(); } //=============================================================================================== // PROCEDURE: ~CSynch // PURPOSE: Destructor. Closes the temporary file and deletes it. // CSynch::~CSynch() { /*MEMBERASSERT();*/ CloseFile(); } //=============================================================================================== // PROCEDURE: Clone // PURPOSE: Clone a passed CSynch array. Ownership is transfered of the temp file etc. // void CSynch::Clone(CSynch *pCS) { /*MEMBERASSERT();*/ CloseFile(); // Clone the settings. // strcpy(m_szFileName, pCS->m_szFileName); m_hfSynchFile = pCS->m_hfSynchFile; m_eMode = pCS->m_eMode; m_uSynchCount = pCS->m_uSynchCount; m_uCacheCount = pCS->m_uCacheCount; m_uCacheStart = pCS->m_uCacheStart; m_LastEntry = pCS->m_LastEntry; // Clone the data. memcpy(m_SynchBuffer, pCS->m_SynchBuffer, sizeof(m_SynchBuffer)); // Initialize the source CSynch object so that it doesn't delete the backing file. pCS->_Initialize(); } //=============================================================================================== // PROCEDURE: CreateFile // PURPOSE: Gets a unique filename and opens it as a temporary file. // BOOL CSynch::OpenFile() { /*MEMBERASSERT();*/ _Initialize(); #if !defined(_WINDOWS) || defined(__MINGW32__) // Create the temporary file. m_hfSynchFile = tmpfile(); ASSERT(m_hfSynchFile != FILE_NULL); return (m_hfSynchFile != NULL); #else // Get a unique temporary file name. // AXU_GetTempFileName("synch", 0, m_szFileName); ABFU_GetTempFileName("synch", 0, m_szFileName); // Create the temporary file. m_hfSynchFile = CreateFileA(m_szFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL); ASSERT(m_hfSynchFile != INVALID_HANDLE_VALUE); return (m_hfSynchFile != INVALID_HANDLE_VALUE); #endif } //=============================================================================================== // PROCEDURE: CloseFile // PURPOSE: Closes the file if it was opened previously. // void CSynch::CloseFile() { /*MEMBERASSERT();*/ if (m_hfSynchFile != NULL) { #if !defined(_MSC_VER) c_CloseHandle(m_hfSynchFile); #else CloseHandle(m_hfSynchFile); #endif m_hfSynchFile = NULL; } _Initialize(); } //=============================================================================================== // PROCEDURE: SetMode // PURPOSE: Sets the buffering mode of the CSynch object. // void CSynch::SetMode(eMODE eMode) { /*MEMBERASSERT();*/ if ((m_eMode==eMode) || !_IsFileOpen()) return; // If the old mode was for writing, flush the cache to disk. if (m_eMode==eWRITEMODE) _Flush(); // Set the new mode. m_eMode = eMode; m_uCacheStart = m_uSynchCount; // If the new mode is for writing, preload the cache with the last n entries. if (m_eMode==eWRITEMODE) { UINT uCount = SYNCH_BUFFER_SIZE; if (m_uSynchCount < SYNCH_BUFFER_SIZE) { m_uCacheStart = 0; uCount = m_uSynchCount; } else m_uCacheStart = m_uSynchCount - SYNCH_BUFFER_SIZE; // Read the data out of the file. Read( m_SynchBuffer, m_uCacheStart, uCount ); // Set the current position to the start of the bit we last read, and truncate the file here. #if defined(_MSC_VER) SetFilePointer(m_hfSynchFile, m_uCacheStart * sizeof(Synch), NULL, FILE_BEGIN); #else c_SetFilePointer(m_hfSynchFile, m_uCacheStart * sizeof(Synch), NULL, FILE_BEGIN); #endif //TRACE1( "CSynch::SetMode file position is %d.\n", // SetFilePointer(m_hfSynchFile, 0, NULL, FILE_CURRENT) ); // VERIFY(SetEndOfFile(m_hfSynchFile)); m_uCacheCount = uCount; m_LastEntry = m_SynchBuffer[uCount-1]; } else { // Set the start index of the cache to the count of items in the file to // cause the cache to be invalid and filled on the next get. m_uCacheStart = m_uSynchCount; } } //=============================================================================================== // PROCEDURE: _GetWriteMode // PURPOSE: Retrieves synch entries from the virtualized array. // BOOL CSynch::_GetWriteMode( UINT uFirstEntry, Synch *pSynch, UINT uEntries ) { /*MEMBERASSERT();*/ ASSERT(uFirstEntry+uEntries <= m_uSynchCount); ASSERT(uEntries > 0); /*ARRAYASSERT(pSynch, uEntries);*/ ASSERT(m_eMode == eWRITEMODE); // If just the last entry is required, return it and get out. if (uFirstEntry == m_uSynchCount-1) { *pSynch = m_LastEntry; return TRUE; } // If the block requested is not contained completely in the cache, // read the file for it, reading straight into the passed buffer. if (m_uSynchCount - uFirstEntry > SYNCH_BUFFER_SIZE) { // Rather than checking whether the file has been opened in this case // we will just assert that this is so here. This means that it is the // responsibility of the caller to ensure that synch entries are not // requested outside the synch buffer if the cache is not backed by a file. ASSERT(m_hfSynchFile != FILE_NULL); // Calculate how many entries there are from the requested first entry until // we hit the ones currently in the cache. UINT uCount = m_uSynchCount - uFirstEntry - SYNCH_BUFFER_SIZE; // Limit the count to no greater than the requested amount. if (uCount > uEntries) uCount = uEntries; // Read the data out of the file. if( !Read( pSynch, uFirstEntry, uCount) ) return FALSE; // Update pointers and counters. pSynch += uCount; uFirstEntry += uCount; uEntries -= uCount; if (uEntries == 0) return TRUE; } // Transfer the part of the buffer that is "invalidated", i.e. about to be overwritten. if (uFirstEntry < m_uCacheStart) { UINT uCount = m_uCacheStart - uFirstEntry; ASSERT(uCount <= SYNCH_BUFFER_SIZE - m_uCacheCount); Synch *pS = m_SynchBuffer + SYNCH_BUFFER_SIZE - uCount; if (uCount > uEntries) uCount = uEntries; memcpy(pSynch, pS, uCount*sizeof(Synch)); pSynch += uCount; uFirstEntry += uCount; uEntries -= uCount; if (uEntries == 0) return TRUE; } // Transfer the more recently written part of the cache. ASSERT(uFirstEntry >= m_uCacheStart); ASSERT(uFirstEntry - m_uCacheStart + uEntries <= m_uCacheCount); memcpy(pSynch, m_SynchBuffer + uFirstEntry - m_uCacheStart, uEntries*sizeof(Synch)); return TRUE; } //=============================================================================================== // PROCEDURE: _GetReadMode // PURPOSE: Retrieves synch entries from the virtualized array. // BOOL CSynch::_GetReadMode( UINT uFirstEntry, Synch *pSynch, UINT uEntries ) { /*MEMBERASSERT();*/ ASSERT(m_hfSynchFile != FILE_NULL); ASSERT(uEntries > 0); /*ARRAYASSERT(pSynch, uEntries);*/ ASSERT(uFirstEntry+uEntries <= m_uSynchCount); ASSERT(m_eMode == eREADMODE); // Loop until the get() has been satisfied. while (uEntries) { // If the first entry is not in the cache, reload the cache. if ((uFirstEntry < m_uCacheStart) || (uFirstEntry >= m_uCacheStart + m_uCacheCount)) { m_uCacheStart = uFirstEntry - (uFirstEntry % SYNCH_BUFFER_SIZE); m_uCacheCount = m_uSynchCount - m_uCacheStart; if (m_uCacheCount > SYNCH_BUFFER_SIZE) m_uCacheCount = SYNCH_BUFFER_SIZE; Read( m_SynchBuffer, m_uCacheStart, m_uCacheCount ); } // Calculate how many entries intersect the cache. UINT uCount = min(uEntries, m_uCacheCount); // Copy the entries out of the cache. memcpy(pSynch, m_SynchBuffer+uFirstEntry-m_uCacheStart, uCount*sizeof(Synch)); uFirstEntry += uCount; pSynch += uCount; uEntries -= uCount; } return TRUE; } //=============================================================================================== // PROCEDURE: _Flush // PURPOSE: Flushes the Synch cache to disk. // BOOL CSynch::_Flush() { /*MEMBERASSERT();*/ ASSERT(m_eMode==eWRITEMODE); if (m_uCacheCount == 0) return TRUE; BOOL bRval = TRUE; DWORD dwBytesWritten = 0; if (_IsFileOpen()) { //TRACE1( "CSynch::_Flush current file pointer is %d on entry.\n", // SetFilePointer(m_hfSynchFile, 0, NULL, FILE_CURRENT) ); // Write out the current contents of the cache. UINT uBytesToWrite = m_uCacheCount * sizeof(Synch); #if defined(_MSC_VER) bRval = WriteFile(m_hfSynchFile, m_SynchBuffer, uBytesToWrite, &dwBytesWritten, NULL); #else bRval = c_WriteFile(m_hfSynchFile, m_SynchBuffer, uBytesToWrite, &dwBytesWritten, NULL); #endif //TRACE1( "CSynch::_Flush current file pointer is %d after WriteFile.\n", // SetFilePointer(m_hfSynchFile, 0, NULL, FILE_CURRENT) ); } // If a disk full error occurs, save what was actually written and rotate the buffer // ready for the next attempt(?). if (!bRval) { UINT uEntriesWritten = dwBytesWritten/sizeof(Synch); UINT uEntriesUnwritten = m_uCacheCount - uEntriesWritten; Synch *pTemp = new Synch[uEntriesWritten]; if (pTemp) memcpy(pTemp, m_SynchBuffer, uEntriesWritten*sizeof(Synch)); for (UINT i=0; idwFileOffset/uSampleSize + pS->dwLength > uAcquiredSamples) { uEntries = i; return FALSE; } *pdwDest++ = pS->dwStart; *pdwDest++ = pS->dwLength; pS++; } return TRUE; } //=============================================================================================== // PROCEDURE: Write // PURPOSE: Copies the complete synch array to another file, packing out the file-offset entry. // BOOL CSynch::Write( HANDLE hDataFile, UINT uAcquiredSamples, UINT *puSynchCount, UINT uSampleSize ) { MEMBERASSERT(); ASSERT( hDataFile != INVALID_HANDLE_VALUE ); WPTRASSERT(puSynchCount); // Flush any cached Synch entries to the temp file. This should not fail as the reserve file // will have been released just prior to calling this function. If it does fail, we will // still be able to work with the Synch entries that were saved ok. if (m_uCacheCount) _Flush(); // Set the return value for the number of synch entries. If none exist, return. *puSynchCount = 0; if (m_uSynchCount == 0) return TRUE; // Seek to the end of the passed file. This will only fail for invalid file handles. CFileIO_NoClose OutFile(hDataFile); LONGLONG llCurrentPos = 0; if (!OutFile.Seek(0, FILE_END, &llCurrentPos)) return FALSE; // Seek to the start of the temporary file. SetFilePointer(m_hfSynchFile, 0L, NULL, FILE_BEGIN); // Read the Synch data in a buffer at a time and write it out to the passed file. UINT uEntries = m_uSynchCount; UINT uWritten = 0; UINT uCount = 0; while ( uEntries > 0 ) { uCount = min(uEntries, SYNCH_BUFFER_SIZE); // Read in a buffer from the temp file. VERIFY(Read( m_SynchBuffer, uWritten, uCount)); // Pack the buffer, removing the dwFileOffset members and checking for invalid synch entries. // If an invalid entry is found, the count is truncated at the last valid entry. if (!_PackBuffer(uAcquiredSamples, uCount, uSampleSize)) uEntries = uCount; // Write the packed buffer out to the temp file. if ( !OutFile.Write( m_SynchBuffer, uCount * 2 * sizeof(DWORD) )) { // If an error occurs, go back to the start of the block and truncate the file // ready for the next attempt after the user has freed up some disk space. VERIFY(OutFile.Seek(llCurrentPos, FILE_BEGIN)); VERIFY(OutFile.SetEndOfFile()); return FALSE; } uEntries -= uCount; uWritten += uCount; } // Seek back to end of the temporary file. SetFilePointer(m_hfSynchFile, 0L, NULL, FILE_END); //TRACE1( "CSynch::Write current file pointer is %d after seek to end.\n", // SetFilePointer(m_hfSynchFile, 0, NULL, FILE_CURRENT) ); *puSynchCount = uWritten; return TRUE; } */ //=============================================================================================== // PROCEDURE: Put // PURPOSE: Puts a new Synch entry into the synch array, flushing to disk if full. // BOOL CSynch::Put( UINT uStart, UINT uLength, UINT uOffset ) { /*MEMBERASSERT();*/ ASSERT(m_eMode==eWRITEMODE); ASSERT((m_uSynchCount == 0) || (m_LastEntry.dwStart <= uStart)); // Flush the cache if it is full. if ((m_uCacheCount >= SYNCH_BUFFER_SIZE) && (!_Flush())) return FALSE; // If a value of zero is passed as the file offset, the file offset for this // entry is derived from the previous one. if (uOffset == 0) m_LastEntry.dwFileOffset += m_LastEntry.dwLength * 2; else m_LastEntry.dwFileOffset = uOffset; m_LastEntry.dwStart = uStart; m_LastEntry.dwLength = uLength; m_SynchBuffer[m_uCacheCount++] = m_LastEntry; m_uSynchCount++; return TRUE; } /* //=============================================================================================== // PROCEDURE: Update // PURPOSE: Updates an entry in the SynchArray. // BOOL CSynch::Update( UINT uEntry, const Synch *pSynch ) { ASSERT(uEntry < m_uSynchCount); ASSERT(m_eMode!=eREADMODE); ASSERT(m_hfSynchFile != INVALID_HANDLE_VALUE); // Save current file position. ABFLONG lCurrentPos = SetFilePointer(m_hfSynchFile, 0, NULL, FILE_CURRENT); //TRACE1( "CSynch::Update current file pointer is %d on entry.\n", // SetFilePointer(m_hfSynchFile, 0, NULL, FILE_CURRENT) ); if (lCurrentPos == INVALID_SEEK_VALUE) return FALSE; // Seek to the entry. SetFilePointer(m_hfSynchFile, uEntry * sizeof(Synch), NULL, FILE_BEGIN); //TRACE1( "CSynch::Update current file pointer is %d after seek to current entry.\n", // SetFilePointer(m_hfSynchFile, 0, NULL, FILE_CURRENT) ); // Write the data out of the file. DWORD dwBytesWritten = 0; BOOL bOK = WriteFile(m_hfSynchFile, pSynch, sizeof(pSynch), &dwBytesWritten, NULL); // Reset the pointer to the original position. SetFilePointer(m_hfSynchFile, lCurrentPos, NULL, FILE_BEGIN); //TRACE1( "CSynch::Update current file pointer is %d after seek to original position.\n", // SetFilePointer(m_hfSynchFile, 0, NULL, FILE_CURRENT) ); if (!bOK) return FALSE; // If the entry requested is contained in the cache, update the cache. if (m_uSynchCount - uEntry <= SYNCH_BUFFER_SIZE) { int nIndex = int(uEntry - m_uCacheStart); if (nIndex < 0) nIndex += SYNCH_BUFFER_SIZE; ASSERT(nIndex >= 0); ASSERT(nIndex < SYNCH_BUFFER_SIZE); m_SynchBuffer[nIndex] = *pSynch; if (uEntry==m_uSynchCount-1) m_LastEntry = *pSynch; } return TRUE; } //=============================================================================================== // PROCEDURE: UpdateLength // PURPOSE: Updates the length of the last entry put in the SynchArray. // void CSynch::UpdateLength(DWORD dwLength) { MEMBERASSERT(); ASSERT(m_eMode==eWRITEMODE); ASSERT(m_uCacheCount > 0); m_LastEntry.dwLength = dwLength; m_SynchBuffer[m_uCacheCount-1] = m_LastEntry; } //=============================================================================================== // PROCEDURE: IncreaseLastLength // PURPOSE: Increases the length of the last entry put in the SynchArray. // void CSynch::IncreaseLastLength( DWORD dwIncrease ) { MEMBERASSERT(); ASSERT(m_eMode==eWRITEMODE); ASSERT(m_uCacheCount > 0); m_LastEntry.dwLength += dwIncrease; m_SynchBuffer[m_uCacheCount-1] = m_LastEntry; } //=============================================================================================== // PROCEDURE: GetLastEntry // PURPOSE: Returns the last Synch structure added to the synch array. // BOOL CSynch::GetLastEntry(Synch *pSynch) { MEMBERASSERT(); WPTRASSERT(pSynch); if (!m_uSynchCount) return FALSE; *pSynch = m_LastEntry; return TRUE; } */ stimfit-0.16.0/src/libstfio/abf/axon/AxAbfFio32/AxAbffio32.h0000775000175000017500000000150113277303516020067 00000000000000//*********************************************************************************************** // // Copyright (c) 1997 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // HEADER: AXABFFIO32.H. // PURPOSE: Defines the export/import specifiers used by all functions // exported by this DLL. #ifndef INC_AXABFFIO32_H #define INC_AXABFFIO32_H // __declspec(dllexport) retired for DLLs given to 3rd parties because of the name mangling on exports. #include #if ( __WORDSIZE == 64 ) || defined (__APPLE__) #define ABFLONG int #else #define ABFLONG long #endif #endif /* INC_AXABFFIO32_H */ stimfit-0.16.0/src/libstfio/abf/axon/AxAbfFio32/abfutil.cpp0000775000175000017500000001751113277303516020234 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-1999 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // FILE: ABFUTIL.CPP A utilities module for the ABF file routines. // #include "../Common/wincpp.hpp" #include "abfutil.h" #include "abffiles.h" #include "abfheadr.h" #if defined(_WINDOWS) && !defined(__MINGW32__) #define USE_AXOVDATE #endif #define ABFU_VALID_SIG_CHARS " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_#" #if !defined(_WINDOWS) || defined(__MINGW32__) || defined(__STF__) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif //============================================================================================== // FUNCTION: ABFU_GetTempFileName // PURPOSE: Gets a temporary file name in the directory pointed to by the %TEMP% environment // variable. // #if !defined(__MINGW32__) // TODO: check what this is used for and whether this is a critical component UINT WINAPI ABFU_GetTempFileName(LPCSTR szPrefix, UINT uUnique, LPSTR lpTempName) { #if defined(_WINDOWS) && !defined(__MINGW32__) ARRAYASSERT(lpTempName, _MAX_PATH); char szTempPath[_MAX_PATH]; if (!GetTempPathA(_MAX_PATH, szTempPath)) strcpy(szTempPath, "C:\\"); return GetTempFileNameA(szTempPath, szPrefix, uUnique, lpTempName); #else strcpy(lpTempName,"ABFTMPXXXXXX"); int res = mkstemp((char*)lpTempName); if (res == -1) return 0; return 1; #endif } #endif // tmpnam (lpTempName); // return 1; //} //=============================================================================================== // FUNCTION: ABFU_ReadFile // PURPOSE: Wrapper on the ReadFile function that returns FALSE at EOF. // BOOL WINAPI ABFU_ReadFile(FILEHANDLE hFile, LPVOID lpBuf, DWORD dwBytesToRead) { DWORD dwBytesRead; #if defined(_WINDOWS) && !defined(__MINGW32__) BOOL bOK = ReadFile(hFile, lpBuf, dwBytesToRead, &dwBytesRead, NULL); #else BOOL bOK = c_ReadFile(hFile, lpBuf, dwBytesToRead, &dwBytesRead, NULL); #endif return (bOK && (dwBytesRead==dwBytesToRead)); } /* //=============================================================================================== // FUNCTION: ABFU_FormatDouble // PURPOSE: Formats the digits of dNum into pszString, suppressing trailing zeros. // In the event that "0." is produced as output from gcvt, truncate to "0" // // RETURNS: TRUE if success; FALSE if failure // #ifdef USE_AXOVDATE #include "..\AxonValidation\AxonValidation.h" // for VAL_* functions (standard Axon float/double->string formatting) #endif BOOL WINAPI ABFU_FormatDouble(double dNum, int nDigits, char *pszString, UINT uSize) { #ifndef USE_AXOVDATE gcvt(dNum, nDigits, pszString); int l = strlen(pszString); if ((l > 0) && (pszString[l-1]=='.')) pszString[l-1] = '\0'; return TRUE; #else return VAL_ConvertDblToStr(dNum, pszString, uSize, VAL_FMT_SIG_DIGITS, 0, nDigits, NULL); #endif } //=============================================================================================== // FUNCTION: ABFU_FormatHMS // PURPOSE: Formats the time in HH:MM:SS. // RETURNS: The number of characters written to the buffer. // NOTE: The buffer passed in should be at least AXU_MAXHMSLENGTH characters long. // int WINAPI ABFU_FormatHMS( UINT uSeconds, char *pszBuffer, UINT uMaxLen ) { UINT uHours = (uSeconds / 3600U) % 100U; UINT uMinutes = (uSeconds % 3600U) / 60U; uSeconds %= 60U; return _snprintf(pszBuffer, uMaxLen, "%02u:%02u:%02u", uHours, uMinutes, uSeconds); } */ //=============================================================================================== // FUNCTION: ABFU_SetABFString // PURPOSE: Fill a non zero-terminated string, padding with spaces if necessary. // void WINAPI ABFU_SetABFString(LPSTR psDest, LPCSTR psSrce, int nMaxLength) { // ARRAYASSERT(psDest, nMaxLength); #if 0 LPSZASSERT(psSrce); #endif strncpy(psDest, psSrce, nMaxLength); int l = (int)strlen(psSrce); while (l < nMaxLength) psDest[l++] = ' '; } //=============================================================================================== // FUNCTION: ABFU_GetABFString // PURPOSE: Fill a zero-terminated string, from an ABF string, stripping spaces if necessary. // void WINAPI ABFU_GetABFString(LPSTR psDest, int nMaxDest, LPCSTR psSrce, int nMaxSrce) { // ARRAYASSERT(psDest, nMaxDest); // ARRAYASSERT(psSrce, nMaxSrce); // Skip any leading blank spaces. while (nMaxSrce > 0) { if (*psSrce!=' ') break; psSrce++; nMaxSrce--; } // copy to the limit of the destination or the source, whichever comes first. int l = min(nMaxDest-1, nMaxSrce); strncpy(psDest, psSrce, l); psDest[l] = '\0'; // Zero out any trailing spaces. while (l > 0) { l--; if (psDest[l]!=' ') return; psDest[l] = '\0'; } } //=============================================================================================== // FUNCTION: ABFU_FixFileStartDate // PURPOSE: Checks the lFileStartDate parameter contains a 4 digit year and fixes it if needed. // long WINAPI ABFU_FixFileStartDate( long lDate ) { long lStartDay = lDate % 100L; long lStartMonth = (lDate % 10000L) / 100L; long lStartYear = lDate / 10000L; if ( lStartYear < 1000) { if (lStartYear < 80L) lStartYear += 2000L; else lStartYear += 1900L; } return long(lStartYear*10000 + lStartMonth*100 + lStartDay); } /* //=============================================================================================== // FUNCTION: ABFU_IsValidSignalName // PURPOSE: Checks if the signal name is valid. // RETURNS: TRUE if name is valid. // BOOL WINAPI ABFU_IsValidSignalName( LPCSTR pszSignalName ) { LPSZASSERT( pszSignalName ); // Signals cannot have the same name as the math channel. char szMathChannel[ ABF_ADCNAMELEN + 1 ]; ABFH_GetMathChannelName( szMathChannel, sizeof( szMathChannel ) ); if ( stricmp( pszSignalName, szMathChannel ) == 0 ) return FALSE; if ( *pszSignalName == ' ' ) return FALSE; if ( *pszSignalName == '\0' ) return FALSE; // Check for invalid characters. int len = strlen( pszSignalName ); int pos = strspn( pszSignalName, ABFU_GetValidSignalNameChars() ); // If pos < len, then an invalid char was found. return (pos == len); } //=============================================================================================== // FUNCTION: ABFU_GetValidSignalNameChars // PURPOSE: Returns the set of valid characters for signal names. // LPCSTR WINAPI ABFU_GetValidSignalNameChars() { return ABFU_VALID_SIG_CHARS; } //=============================================================================================== // FUNCTION: ABFU_FixSignalName // PURPOSE: Replaces invalid characters in a signal name with valid ones. // RETURNS: TRUE if name is valid. // void WINAPI ABFU_FixSignalName( LPSTR pszSignalName ) { LPSZASSERT( pszSignalName ); // Check for invalid characters. int len = strlen( pszSignalName ); for( int i=0; i #include "./../../../stfio.h" // #include "../AxAbfFio32/filedesc.hpp" // File descriptors for ABF files. #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ // This is ABFFILES.H; a companion file to ABFFILES.C #define ABF_INVALID_HANDLE NULL //-1 // Error numbers for routines in this module. // Only positive numbers are used. #define ABF_SUCCESS 0 #define ABF_EUNKNOWNFILETYPE 1001 #define ABF_EBADFILEINDEX 1002 #define ABF_TOOMANYFILESOPEN 1003 #define ABF_EOPENFILE 1004 #define ABF_EBADPARAMETERS 1005 #define ABF_EREADDATA 1006 #define ABF_OUTOFMEMORY 1008 #define ABF_EREADSYNCH 1009 #define ABF_EBADSYNCH 1010 #define ABF_EEPISODERANGE 1011 #define ABF_EINVALIDCHANNEL 1012 #define ABF_EEPISODESIZE 1013 #define ABF_EREADONLYFILE 1014 #define ABF_EDISKFULL 1015 #define ABF_ENOTAGS 1016 #define ABF_EREADTAG 1017 #define ABF_ENOSYNCHPRESENT 1018 #define ABF_EREADDACEPISODE 1019 #define ABF_ENOWAVEFORM 1020 #define ABF_EBADWAVEFORM 1021 #define ABF_BADMATHCHANNEL 1022 #define ABF_BADTEMPFILE 1023 #define ABF_NODOSFILEHANDLES 1025 #define ABF_ENOSCOPESPRESENT 1026 #define ABF_EREADSCOPECONFIG 1027 #define ABF_EBADCRC 1028 #define ABF_ENOCOMPRESSION 1029 #define ABF_EREADDELTA 1030 #define ABF_ENODELTAS 1031 #define ABF_EBADDELTAID 1032 #define ABF_EWRITEONLYFILE 1033 #define ABF_ENOSTATISTICSCONFIG 1034 #define ABF_EREADSTATISTICSCONFIG 1035 #define ABF_EWRITERAWDATAFILE 1036 #define ABF_EWRITEMATHCHANNEL 1037 #define ABF_EWRITEANNOTATION 1038 #define ABF_EREADANNOTATION 1039 #define ABF_ENOANNOTATIONS 1040 #define ABF_ECRCVALIDATIONFAILED 1041 // Notifications that can be passed to the registered callback function. #define ABF_NVOICETAGSTART 2000 #define ABF_NWRITEVOICETAG 2001 #define ABF_NVOICETAGEND 2002 // Constants for the ABF_ReadOpen and ABF_WriteOpen functions #define ABF_DATAFILE 0 #define ABF_PARAMFILE 1 #define ABF_ALLOWOVERLAP 2 // If this flag is not set, overlapping data in fixed-length // event-detected data will be edited out by adjustment of // the synch array. (ABF_ReadOpen only!) // Constants for ABF_MultiplexWrite #define ABF_APPEND 2 // Episodes may be appended to the current // episode when writing ABF_VARLNEEVENTS files // Constant for ABF_FormatTag #define ABF_MAXTAGFORMATLEN 84 // Start time saved in the synch array for the oscilloscope mode average sweep #define ABF_AVERAGESWEEPSTART DWORD(-1) //---------------------- Exported Function Definitions ------------------------- // Definitions of the procedures provided by Module ABFFILES.BAS BOOL ABF_Initialize(); /* void ABF_Cleanup(void); */ BOOL WINAPI ABF_ReadOpen( LPCTSTR szFileName, int *phFile, UINT fFlags, ABFFileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError ); /* BOOL WINAPI ABF_WriteOpen( LPCSTR szFileName, int *phFile, UINT fFlags, ABFFileHeader *pFH, int *pnError ); BOOL WINAPI ABF_UpdateHeader(int nFile, ABFFileHeader *pFH, int *pnError); BOOL WINAPI ABF_IsABFFile(const char *szFileName, int *pnDataFormat, int *pnError); */ BOOL WINAPI ABF_HasData(int nFile, const ABFFileHeader *pFH); BOOL WINAPI ABF_Close(int nFile, int *pnError); BOOL WINAPI ABF_MultiplexRead(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, void *pvBuffer, UINT uBufferSize, UINT *puSizeInSamples, int *pnError); BOOL WINAPI ABF2_MultiplexRead(int nFile, const ABF2FileHeader *pFH, DWORD dwEpisode, void *pvBuffer, UINT uBufferSize, UINT *puSizeInSamples, int *pnError); /* BOOL WINAPI ABF_MultiplexWrite(int nFile, ABFFileHeader *pFH, UINT uFlags, const void *pvBuffer, DWORD dwEpiStart, UINT uSizeInSamples, int *pnError); BOOL WINAPI ABF_WriteRawData(int nFile, const void *pvBuffer, DWORD dwSizeInBytes, int *pnError); */ BOOL WINAPI ABF_ReadChannel(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode, Vector_float& pfBuffer, UINT *puNumSamples, int *pnError); BOOL WINAPI ABF2_ReadChannel(int nFile, const ABF2FileHeader *pFH, int nChannel, DWORD dwEpisode, Vector_float& pfBuffer, UINT *puNumSamples, int *pnError); /* BOOL WINAPI ABF_ReadRawChannel(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode, void *pvBuffer, UINT *puNumSamples, int *pnError); BOOL WINAPI ABF_ReadDACFileEpi(int nFile, const ABFFileHeader *pFH, short *pnDACArray, DWORD dwEpisode, int *pnError); BOOL WINAPI ABF_ReadDACFileEpiEx(int nFile, const ABFFileHeader *pFH, short *pnDACArray, UINT nChannel, DWORD dwEpisode, int *pnError); BOOL WINAPI ABF_WriteDACFileEpi(int nFile, ABFFileHeader *pFH, const short *pnDACArray, int *pnError); BOOL WINAPI ABF_WriteDACFileEpiEx(int nFile, ABFFileHeader *pFH, UINT uDACChannel, const short *pnDACArray, int *pnError); BOOL WINAPI ABF_GetWaveform(int nFile, const ABFFileHeader *pFH, int nADCChannel, DWORD dwEpisode, float *pfBuffer, int *pnError); BOOL WINAPI ABF_GetWaveformEx(int nFile, const ABFFileHeader *pFH, UINT uDACChannel, DWORD dwEpisode, float *pfBuffer, int *pnError); BOOL WINAPI ABF_WriteTag(int nFile, ABFFileHeader *pFH, const ABFTag *pTag, int *pnError); BOOL WINAPI ABF_UpdateTag(int nFile, UINT uTag, const ABFTag *pTag, int *pnError); BOOL WINAPI ABF_ReadTags(int nFile, const ABFFileHeader *pFH, DWORD dwFirstTag, ABFTag *pTagArray, UINT uNumTags, int *pnError); BOOL WINAPI ABF_FormatTag(int nFile, const ABFFileHeader *pFH, ABFLONG lTagNumber, char *pszBuffer, UINT uSize, int *pnError); BOOL WINAPI ABF_EpisodeFromSynchCount(int nFile, const ABFFileHeader *pFH, DWORD *pdwSynchCount, DWORD *pdwEpisode, int *pnError); BOOL WINAPI ABF_SynchCountFromEpisode(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, DWORD *pdwSynchCount, int *pnError); BOOL WINAPI ABF_GetEpisodeFileOffset(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, DWORD *pdwFileOffset, int *pnError); BOOL WINAPI ABF_GetMissingSynchCount(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, DWORD *pdwMissingSynchCount, int *pnError); BOOL WINAPI ABF_HasOverlappedData(int nFile, BOOL *pbHasOverlapped, int *pnError); */ BOOL WINAPI ABF_GetNumSamples(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, UINT *puNumSamples, int *pnError); BOOL WINAPI ABF2_GetNumSamples(int nFile, const ABF2FileHeader *pFH, DWORD dwEpisode, UINT *puNumSamples, int *pnError); /* BOOL WINAPI ABF_GetStartTime(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode, double *pdStartTime, int *pnError); BOOL WINAPI ABF_GetEpisodeDuration(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, double *pdDuration, int *pnError); BOOL WINAPI ABF_GetTrialDuration(int nFile, const ABFFileHeader *pFH, double *pdDuration, int *pnError); BOOL WINAPI ABF_WriteScopeConfig( int nFile, ABFFileHeader *pFH, int nScopes, const ABFScopeConfig *pCfg, int *pnError); BOOL WINAPI ABF_ReadScopeConfig( int nFile, ABFFileHeader *pFH, ABFScopeConfig *pCfg, UINT uMaxScopes, int *pnError); BOOL WINAPI ABF_WriteStatisticsConfig( int nFile, ABFFileHeader *pFH, const ABFScopeConfig *pCfg, int *pnError); BOOL WINAPI ABF_ReadStatisticsConfig( int nFile, const ABFFileHeader *pFH, ABFScopeConfig *pCfg, int *pnError); BOOL WINAPI ABF_SaveVoiceTag( int nFile, LPCSTR pszFileName, ABFLONG lDataOffset, ABFVoiceTagInfo *pVTI, int *pnError); BOOL WINAPI ABF_GetVoiceTag( int nFile, const ABFFileHeader *pFH, UINT uTag, LPCSTR pszFileName, ABFLONG lDataOffset, ABFVoiceTagInfo *pVTI, int *pnError); BOOL WINAPI ABF_PlayVoiceTag( int nFile, const ABFFileHeader *pFH, UINT uTag, int *pnError); BOOL WINAPI ABF_WriteDelta(int nFile, ABFFileHeader *pFH, const ABFDelta *pDelta, int *pnError); BOOL WINAPI ABF_ReadDeltas(int nFile, const ABFFileHeader *pFH, DWORD dwFirstDelta, ABFDelta *pDeltaArray, UINT uNumDeltas, int *pnError); BOOL WINAPI ABF_FormatDelta(const ABFFileHeader *pFH, const ABFDelta *pDelta, char *pszText, UINT uTextLen, int *pnError); BOOL WINAPI ABF_GetFileHandle(int nFile, HANDLE *phHandle, int *pnError); BOOL WINAPI ABF_GetFileName( int nFile, LPSTR pszFilename, UINT uTextLen, int *pnError ); */ BOOL WINAPI ABF_BuildErrorText(int nErrorNum, const char *szFileName, char *sTxtBuf, UINT uMaxLen); /* typedef BOOL (CALLBACK *ABFCallback)(void *pvThisPointer, int nError); BOOL WINAPI ABF_SetErrorCallback(int nFile, ABFCallback fnCallback, void *pvThisPointer, int *pnError); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BOOL WINAPI ABF_AppendOpen(LPCSTR szFileName, int *phFile, ABFFileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError); BOOL WINAPI ABF_UpdateEpisodeSamples(int nFile, const ABFFileHeader *pFH, int nChannel, UINT uEpisode, UINT uStartSample, UINT uNumSamples, float *pfBuffer, int *pnError); */ BOOL WINAPI ABF2_SetChunkSize( int hFile, ABF2FileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError ); /* BOOL WINAPI ABF_SetOverlap(int nFile, const ABFFileHeader *pFH, BOOL bAllowOverlap, int *pnError); BOOL WINAPI ABF_SetEpisodeStart(int nFile, UINT uEpisode, UINT uEpiStart, int *pnError); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void *WINAPI ABF_GetSynchArray(int nFile, int *pnError); BOOL WINAPI ABF_WriteAnnotation( int nFile, ABFFileHeader *pFH, LPCSTR pszText, int *pnError ); BOOL WINAPI ABF_ReadAnnotation( int nFile, const ABFFileHeader *pFH, DWORD dwIndex, LPSTR pszText, DWORD dwBufSize, int *pnError ); DWORD WINAPI ABF_GetMaxAnnotationSize( int nFile, const ABFFileHeader *pFH ); BOOL WINAPI ABF_WriteStringAnnotation( int nFile, ABFFileHeader *pFH, LPCSTR pszName, LPCSTR pszData, int *pnError ); BOOL WINAPI ABF_WriteIntegerAnnotation( int nFile, ABFFileHeader *pFH, LPCSTR pszName, int nData, int *pnError ); BOOL WINAPI ABF_ReadStringAnnotation( int nFile, const ABFFileHeader *pFH, DWORD dwIndex, LPSTR pszName, UINT uSizeName, LPSTR pszValue, UINT uSizeValue, int *pnError ); BOOL WINAPI ABF_ReadIntegerAnnotation( int nFile, const ABFFileHeader *pFH, DWORD dwIndex, LPSTR pszName, UINT uSizeName, int *pnValue, int *pnError ); BOOL WINAPI ABF_ParseStringAnnotation( LPCSTR pszAnn, LPSTR pszName, UINT uSizeName, LPSTR pszValue, UINT uSizeValue, int *pnError); BOOL WINAPI ABF_ValidateFileCRC( int nFile, int *pnError ); */ //=============================================================================================== // Macros and functions to deal with returning error return codes through a pointer if given. #define ERRORRETURN(p, e) return ErrorReturn(p, e); // BOOL ErrorReturn(int *pnError, int nErrorNum); //=============================================================================================== // FUNCTION: GetNewFileDescriptor // PURPOSE: Allocate a new file descriptor and return it. // #ifdef __cplusplus } #endif #endif // INC_ABFFILES_H stimfit-0.16.0/src/libstfio/abf/axon/AxAbfFio32/abffiles.cpp0000664000175000017500000051513513277303516020363 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-2000 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // // MODULE: ABFFILES.CPP // PURPOSE: Contains the low level multi data file I/O package for ABF data files. // // An ANSI C++ compiler should be used for compilation. // Compile with the large memory model option. // (e.g. CL -c -AL ABFFILES.C) #include "../Common/wincpp.hpp" #include "abffiles.h" #include "../../axon2/abf2headr.h" #include "csynch.hpp" // Virtual synch array object #include "filedesc.hpp" // File descriptors for ABF files. #include "./../Common/ArrayPtr.hpp" // Smart array pointer template class. #include "./../Common/FileReadCache.hpp" // // Set the maximum number of files that can be open simultaneously. // This can be overridden from the compiler command line. // #ifndef ABF_MAXFILES #define ABF_MAXFILES 64 #endif #define ABF_DEFAULTCHUNKSIZE 8192 // Default chunk size for reading gap-free amd var-len files. #if !defined(_WINDOWS) || defined(__MINGW32__) || defined(__STF__) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif /* // Set USE_DACFILE_FIX to 1 to use the fix (incomplete) for DAC File channels. #define USE_DACFILE_FIX 0 //------------------------------------ Shared Variables ----------------------------------------- */ static CFileDescriptor *g_FileData[ABF_MAXFILES]; HINSTANCE g_hInstance = NULL; //=============================================================================================== static BOOL ReadEDVarLenSynch(CFileDescriptor *pFI, ABFFileHeader *pFH, DWORD *pdwMaxEpi, UINT *puMaxSamples, int *pnError); static BOOL ReadEDFixLenSynch(CFileDescriptor *pFI, const ABFFileHeader *pFH, DWORD *pdwMaxEpi, BOOL bAllowOverlap, int *pnError); static BOOL ReadOldSynchArray(CFileDescriptor *pFI, ABFFileHeader *pFH, DWORD *pdwMaxEpi, int *pnError); //=============================================================================================== // Macros and functions to deal with returning error return codes through a pointer if given. #define ERRORRETURN(p, e) return ErrorReturn(p, e); static BOOL ErrorReturn(int *pnError, int nErrorNum) { if (pnError) *pnError = nErrorNum; return FALSE; } //=============================================================================================== // FUNCTION: GetNewFileDescriptor // PURPOSE: Allocate a new file descriptor and return it. // BOOL GetNewFileDescriptor(CFileDescriptor **ppFI, int *pnFile, int *pnError) { // WPTRASSERT(ppFI); // WPTRASSERT(pnFile); int nFile; // Find an empty slot. for (nFile=0; nFile < ABF_MAXFILES; nFile++) if (g_FileData[nFile] == NULL) break; // Return an error if no space left. if (nFile == ABF_MAXFILES) return ErrorReturn(pnError, ABF_TOOMANYFILESOPEN); // Allocate a new descriptor. CFileDescriptor *pFI = new CFileDescriptor; if (pFI == NULL) return ErrorReturn(pnError, ABF_OUTOFMEMORY); if (!pFI->IsOK()) { delete pFI; return ErrorReturn(pnError, ABF_BADTEMPFILE); } *ppFI = g_FileData[nFile] = pFI; *pnFile = nFile; return TRUE; } //----------------------------------------------------------------------------------------------- // FUNCTION: GetFileDescriptor // PURPOSE: Retreive an existing file descriptor. // BOOL GetFileDescriptor(CFileDescriptor **ppFI, int nFile, int *pnError) { // WPTRASSERT(ppFI); // Check that index is within range. if ((nFile < 0) || (nFile >= ABF_MAXFILES)) return ErrorReturn(pnError, ABF_EBADFILEINDEX); // Get a pointer to the descriptor. CFileDescriptor *pFI = g_FileData[nFile]; if (pFI == NULL) return ErrorReturn(pnError, ABF_EBADFILEINDEX); // Return the descriptor. *ppFI = pFI; return TRUE; } //----------------------------------------------------------------------------------------------- // FUNCTION: ReleaseFileDescriptor // PURPOSE: Release an existing file descriptor. // void ReleaseFileDescriptor(int nFile) { delete g_FileData[nFile]; g_FileData[nFile] = NULL; } //=============================================================================================== // FUNCTION: SampleSize // PURPOSE: Get the sample size used in the data described by the header. // static UINT SampleSize(const ABFFileHeader *pFH) { // ABFH_ASSERT(pFH); return (pFH->nDataFormat != ABF_INTEGERDATA) ? sizeof(float) : sizeof(short); } //=============================================================================================== // FUNCTION: SampleSize // PURPOSE: Get the sample size used in the data described by the header. // static UINT ABF2_SampleSize(const ABF2FileHeader *pFH) { // ABFH_ASSERT(pFH); return (pFH->nDataFormat != ABF_INTEGERDATA) ? sizeof(float) : sizeof(short); } //=============================================================================================== // FUNCTION: GetDataOffset // PURPOSE: Get the file offset to the data allowing for "ignored" points from old AxoLab files. // static ABFLONG GetDataOffset(const ABFFileHeader *pFH) { // ABFH_ASSERT(pFH); ABFLONG lDataOffset = pFH->lDataSectionPtr * ABF_BLOCKSIZE; // Adjust the data pointer for any garbage data words at the start of // the data portion of the file. (Created by AxoLab in continuous // files only) if (pFH->nOperationMode == ABF_GAPFREEFILE) lDataOffset += pFH->nNumPointsIgnored * SampleSize(pFH); return lDataOffset; } //=============================================================================================== // FUNCTION: GetDataOffset // PURPOSE: Get the file offset to the data allowing for "ignored" points from old AxoLab files. // static ABFLONG ABF2_GetDataOffset(const ABF2FileHeader *pFH) { // ABFH_ASSERT(pFH); ABFLONG lDataOffset = pFH->lDataSectionPtr * ABF_BLOCKSIZE; // Adjust the data pointer for any garbage data words at the start of // the data portion of the file. (Created by AxoLab in continuous // files only) if (pFH->nOperationMode == ABF_GAPFREEFILE) lDataOffset += pFH->nNumPointsIgnored * ABF2_SampleSize(pFH); return lDataOffset; } #if 0 //============================================================================================== // FUNCTION: CalculateCRC // PURPOSE: Return checksum Cyclic Redundancy Code CRC. // unsigned ABFLONG CalculateCRC( CFileDescriptor *pFI ) { WPTRASSERT( pFI); LONGLONG llReadPointer = 0L; BOOL bReadOk = FALSE; char acBuffer[ ABF_BLOCKSIZE ] = {0}; CRC crc(CRC::CRC_32); // Get the total length of the file. LONGLONG llFileLength = pFI->GetFileSize(); ASSERT(llFileLength >= sizeof(ABFFileHeader)); VERIFY(pFI->Seek( 0L, FILE_BEGIN)); while( llReadPointer < llFileLength ) { // Read a file block into the buffer. bReadOk = pFI->Read( acBuffer, ABF_BLOCKSIZE ); ASSERT( bReadOk ); // Update the CRC of the buffer crc.Update(acBuffer, ABF_BLOCKSIZE ); llReadPointer += ABF_BLOCKSIZE; } //#ifdef _DEBUG // TRACE1("Calculate CRC Value %X\n", crc.Value() ); //#endif // Set pointer at the beggining. VERIFY(pFI->Seek( 0L, FILE_BEGIN)); return crc.Value(); } //============================================================================================== // FUNCTION: ValidateFileCRC // PURPOSE: // static BOOL ValidateFileCRC( CFileDescriptor *pFI, ABFFileHeader *pFH, int nSizeOfHeader ) { WPTRASSERT( pFI ); WPTRASSERT( pFH ); // Validate CRC for files that support it. // The versions of ABF 1.82 and higher support CRC checksum. if( pFH->fFileVersionNumber < ABF_V182 ) return TRUE; // Valid and no checking. unsigned ABFLONG ulExpectedCRC = 0L; LONGLONG llReadPointer = 0L; BOOL bReadOk = FALSE; char acBuffer[ ABF_BLOCKSIZE ] = {0}; CRC crc(CRC::CRC_32); // Keep expected CRC value from header. ulExpectedCRC = pFH->ulFileCRC; // Zero the lFileCRC. The CRC is generated with this field as zero. pFH->ulFileCRC = 0; // Get the total length of the file. LONGLONG llFileLength = pFI->GetFileSize(); ASSERT(llFileLength >= nSizeOfHeader ); crc.Update( pFH, nSizeOfHeader ); llReadPointer = nSizeOfHeader; VERIFY(pFI->Seek( llReadPointer, FILE_BEGIN)); while( llReadPointer < llFileLength ) { // Read a file block into the buffer. bReadOk = pFI->Read( acBuffer, ABF_BLOCKSIZE ); ASSERT( bReadOk ); // Update the CRC of the buffer crc.Update(acBuffer, ABF_BLOCKSIZE ); llReadPointer += ABF_BLOCKSIZE; } #ifdef _DEBUG TRACE1("Validate CRC Value %X\n", crc.Value() ); #endif // Set pointer at the beggining. VERIFY(pFI->Seek( 0L, FILE_BEGIN)); unsigned ABFLONG ulFileCRC = crc.Value(); // Compare expected CRC with file CRC. if ( ulFileCRC != ulExpectedCRC ) { #ifdef _DEBUG TRACE( "File CRC Validation Failed\n" ); #endif return FALSE; } #ifdef _DEBUG TRACE( "File CRC Validation OK\n" ); #endif return TRUE; } #endif //=============================================================================================== // FUNCTION: ABF_Initialize() // PARAMETERS: // hInstance - Instance handle from which resources will be taken. // RETURNS: // BOOL - TRUE = Initialization was successful. // // PURPOSE: This function should be called before any of the other API functions. // NOTES: This function is not exported as it is called from the DLL startup code. If the // API is bound into an executable rather than a DLL it will need to be called // explicitly. // BOOL ABF_Initialize() { // Protect against multiple calls. /* if (g_hInstance != NULL) return TRUE; // Save the DLL instance handle. g_hInstance = hDLL; */ for (int i=0; i 15) // UINT uAvailableFiles = SetHandleCount(ABF_MAXFILES); uAvailableFiles = uAvailableFiles; #endif return TRUE; } #if 0 //=============================================================================================== // FUNCTION: ABF_Cleanup // PURPOSE: Cleanup function, only applicable to DOS & Windows programs, not DLLs. // NOTES: This function is not exported as it is called from the DLL startup code. If the // API is bound into an executable rather than a DLL it will need to be called // explicitly. // void ABF_Cleanup(void) { for (int i=0; iGetFileName()); ABF_Close(i, NULL); } } } #endif //=============================================================================================== // FUNCTION: ABF_ReadOpen // PURPOSE: This routine opens an existing data file for reading. It reads the acquisition // parameters, ADC/DAC unit strings and comment string from the file header. // INPUT: // szFileName the name of the data file that will be opened // fFlags Flag for whether the file is a parameter file // puMaxSamples points to the requested size of data blocks to be returned. // This is only used in the case of GAPFREE and EVENT-DETECTED- // VARIABLE-LENGTH acquisitions. Otherwise the size of the // Episode is used. 80x86 limitations require this to be // less than or equal to 64k. // pdwMaxEpi The maximum number of episodes to be read. // OUTPUT: // pFH the acquisition parameters that were read from the data file // phFile pointer to the ABF file number of this file (NOT the DOS handle) // puMaxSamples the maximum number of samples that can be read contiguously // from the data file. // pdwMaxEpi the number of episodes of puMaxSamples points that exist // in the data file. // BOOL WINAPI ABF_ReadOpen(LPCTSTR szFileName, int *phFile, UINT fFlags, ABFFileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError) { //LPSZASSERT(szFileName); WPTRASSERT(phFile); // CSH ABFH_WASSERT(pFH); // Take a copy of the passed in header to ensure it is 6k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); int nError = 0; CFileDescriptor *pFI = NULL; UINT uDAC = 0; // Get a new file descriptor if available. if (!GetNewFileDescriptor(&pFI, phFile, pnError)) return FALSE; // Now open the file for reading. if (!pFI->Open(szFileName, TRUE)) { nError = pFI->GetLastError(); goto RCloseAndAbort; } // Read the data file parameters. if (!ABFH_ParamReader(pFI->GetFileHandle(), &NewFH, &nError)) { nError = (nError == ABFH_EUNKNOWNFILETYPE) ? ABF_EUNKNOWNFILETYPE : ABF_EBADPARAMETERS; goto RCloseAndAbort; } if (NewFH.lFileSignature == ABF_REVERSESIGNATURE) { nError = ABF_EBADPARAMETERS; goto RCloseAndAbort; } // if we are reading a parameter file, we are done. if (fFlags & ABF_PARAMFILE) { // If it is an old (pre-ABF file), update file version and file type. if( (NewFH.nFileType == ABF_CLAMPEX) || (NewFH.nFileType == ABF_FETCHEX) ) { NewFH.nFileType = ABF_ABFFILE; NewFH.fFileVersionNumber = ABF_CURRENTVERSION; } pFI->SetFlag(FI_PARAMFILE); // Restore the original header. ABFH_DemoteHeader( pFH, &NewFH ); return TRUE; } // Check for valid parameters. // WPTRASSERT(puMaxSamples); // WPTRASSERT(pdwMaxEpi); // Check that the data file actually contains data. if ((NewFH.lActualAcqLength <= 0) || (NewFH.nADCNumChannels <= 0)) { nError = ABF_EBADPARAMETERS; goto RCloseAndAbort; } // Disable stimulus file output if data file does not include any // stimulus file sweeps. This is to prevent problems later when // looking for a non-existent DACFile section. for( uDAC=0; uDACSetAcquiredEpisodes(*pdwMaxEpi); pFI->SetAcquiredSamples(NewFH.lActualAcqLength); // Seek to start of Data section pFI->Seek(GetDataOffset(&NewFH), FILE_BEGIN); // Restore the original header. ABFH_DemoteHeader( pFH, &NewFH ); return TRUE; RCloseAndAbort: ASSERT(nError!=0); ReleaseFileDescriptor(*phFile); phFile = ABF_INVALID_HANDLE; return ErrorReturn(pnError, nError); } #if 0 //=============================================================================================== // FUNCTION: ABF_IsABFFile // PURPOSE: This routine opens a file and determines if it is an ABF file or not. // RETURNS: TRUE if the file is an ABF file. The type of ABF file is returned in // *pnDataFormat: ABF_INTEGERDATA or ABF_FLOATDATA. // BOOL WINAPI ABF_IsABFFile(const char *szFileName, int *pnDataFormat, int *pnError) { LPSZASSERT(szFileName); int nError = 0; // Now open the file for reading. HANDLE hHandle = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hHandle == INVALID_HANDLE_VALUE) { if (GetLastError()==ERROR_TOO_MANY_OPEN_FILES) return ErrorReturn(pnError, ABF_NODOSFILEHANDLES); return ErrorReturn(pnError, ABF_EOPENFILE); } // Read the data file parameters. ABFFileHeader FH; if (!ABFH_ParamReader(hHandle, &FH, &nError)) { if (nError == ABFH_EUNKNOWNFILETYPE) nError = ABF_EUNKNOWNFILETYPE; else nError = ABF_EBADPARAMETERS; } CloseHandle(hHandle); if (nError) return ErrorReturn(pnError, nError); if (pnDataFormat) *pnDataFormat = FH.nDataFormat; return TRUE; } //=============================================================================================== // FUNCTION: ABF_WriteOpen // PURPOSE: This routine opens an existing data file for writing. // It writes all the acquisition parameters to the file header. // INPUT: // szFileName the name of the data file that will be opened // phFile pointer to the ABF file number of this file (NOT the DOS handle) // fFlags Flag for whether the file is a parameter file // pFH the acquisition parameters to be written to the data file // // OUTPUT: // NONE. // BOOL WINAPI ABF_WriteOpen(LPCSTR szFileName, int *phFile, UINT fFlags, ABFFileHeader *pFH, int *pnError) { LPSZASSERT(szFileName); WPTRASSERT(phFile); ABFH_WASSERT(pFH); // Get a new file descriptor if available. CFileDescriptor *pFI = NULL; if (!GetNewFileDescriptor(&pFI, phFile, pnError)) return FALSE; // Now create and open the file for writing if (!pFI->Open(szFileName, FALSE)) { // An error has occurred, cleanup and return the error. int nError = pFI->GetLastError(); ReleaseFileDescriptor(*phFile); *phFile = ABF_INVALID_HANDLE; return ErrorReturn(pnError, nError); } // Take a copy of the passed in header to ensure it is 6k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); NewFH.lDataSectionPtr = sizeof(ABFFileHeader) / ABF_BLOCKSIZE; NewFH.lScopeConfigPtr = 0; NewFH.lStatisticsConfigPtr = 0; NewFH.lNumScopes = 0; NewFH.lActualAcqLength = 0; NewFH.lActualEpisodes = 0; NewFH.nNumPointsIgnored = 0; NewFH.lTagSectionPtr = 0; NewFH.lNumTagEntries = 0; NewFH._lDACFilePtr = 0; NewFH._lDACFileNumEpisodes = 0; NewFH.lDeltaArrayPtr = 0; NewFH.lNumDeltas = 0; NewFH.lSynchArrayPtr = 0; NewFH.lSynchArraySize = 0; NewFH.lVoiceTagPtr = 0; NewFH.lVoiceTagEntries = 0; NewFH.lAnnotationSectionPtr= 0; NewFH.lNumAnnotations = 0; NewFH.ulFileCRC = 0; for( UINT i=0; iSetFlag(FI_PARAMFILE); // Create a GUID for this file. NewFH.FileGUID = GUID_NULL; ::CoCreateGuid(&NewFH.FileGUID); // Write the data file parameters, returning if successful. if (!ABFH_ParamWriter(pFI->GetFileHandle(), &NewFH, NULL)) { // An error has occurred, cleanup and return the error. ReleaseFileDescriptor(*phFile); *phFile = ABF_INVALID_HANDLE; remove(szFileName); return ErrorReturn(pnError, ABF_EDISKFULL); } // Calculate CRC in current file descriptor. // lFileCRC needs to be zero during the calculation. NewFH.ulFileCRC = CalculateCRC( pFI ); // Update the header in the file descriptor with CRC in place. VERIFY(pFI->Seek( 0L, FILE_BEGIN)); if (!ABFH_ParamWriter(pFI->GetFileHandle(), &NewFH, NULL)) return ErrorReturn(pnError, ABF_EDISKFULL); // Restore the original header. ABFH_DemoteHeader( pFH, &NewFH ); return TRUE; } //=============================================================================================== // FUNCTION: WriteSynchArray // PURPOSE: This routine writes the Synch array out to disk // static BOOL WriteSynchArray(CFileDescriptor *pFI, ABFFileHeader *pFH, int *pnError) { WPTRASSERT(pFI); ABFH_WASSERT(pFH); // Return if no write is required. if (pFI->TestFlag(FI_PARAMFILE)) return TRUE; // Transfer the synch array to the ABF file, checking to see that the synch array // only refers to data that was actually saved. if (!pFI->WriteSynchArray( &pFH->lSynchArrayPtr, &pFH->lSynchArraySize, SampleSize(pFH) )) return ErrorReturn(pnError, ABF_EDISKFULL); pFH->lActualEpisodes = pFH->lSynchArraySize; pFH->lActualAcqLength = pFI->GetAcquiredSamples(); return TRUE; } //=============================================================================================== // FUNCTION: WriteTags // PURPOSE: This routine writes the accumulated tags out to disk // static BOOL WriteTags(CFileDescriptor *pFI, ABFFileHeader *pFH, int *pnError) { WPTRASSERT(pFI); ABFH_WASSERT(pFH); if (!pFI->WriteTags( &pFH->lTagSectionPtr, &pFH->lNumTagEntries )) return ErrorReturn(pnError, ABF_EDISKFULL); if (!pFI->WriteVoiceTags( &pFH->lVoiceTagPtr, &pFH->lVoiceTagEntries )) return ErrorReturn(pnError, ABF_EDISKFULL); return TRUE; } #endif //=============================================================================================== // FUNCTION: ABF_HasData // PURPOSE: This routine returns TRUE if data has been written to the file since opening it. // BOOL WINAPI ABF_HasData(int nFile, const ABFFileHeader *pFH) { // ABFH_ASSERT(pFH); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, NULL)) return FALSE; // Take a copy of the passed in header to ensure it is 5k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); if (NewFH.lDataSectionPtr==0) return FALSE; // Assume that only data has been written to the file at this point. ASSERT(NewFH.lSynchArrayPtr==0); ASSERT(NewFH.lTagSectionPtr==0); ASSERT(NewFH.lVoiceTagPtr==0); ASSERT(NewFH.lDeltaArrayPtr==0); ASSERT(NewFH.lAnnotationSectionPtr==0); ASSERT(NewFH.lDACFilePtr[0]==0); ASSERT(NewFH.lDACFilePtr[1]==0); return (pFI->GetFileSize() > NewFH.lDataSectionPtr * ABF_BLOCKSIZE); } #if 0 //=============================================================================================== // FUNCTION: ABF_UpdateHeader // PURPOSE: This routine should always be called before closing a file opened with // ABF_WriteOpen. It updates the file header and writes the synch array out // to disk if required. // BOOL WINAPI ABF_UpdateHeader(int nFile, ABFFileHeader *pFH, int *pnError) { ABFH_WASSERT(pFH); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (pFI->TestFlag(FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); // Take a copy of the passed in header to ensure it is 6k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); // Assume that only data has been written to the file at this point. //GR 12-Jan-2001: These used to be asserts to assert that these values //were all equal to 0. This was causing assertion failures when //attempting to copy part or all of an analysis window file as an //atf file for the second time. //The logic is that if these variables are no longer 0, then we have //already written the file header and don't need to write it again. //And what if the header settings have changed since last time we //wrote them? Then the temporary file should have been re-written //and these variables will be 0 again. I think. if( (NewFH.lSynchArrayPtr!=0) || (NewFH.lTagSectionPtr!=0) || (NewFH.lVoiceTagPtr!=0) || (NewFH.lAnnotationSectionPtr!=0) || (NewFH.lDeltaArrayPtr!=0) ) { return TRUE; } for( UINT i=0; iGetFileSize(); ASSERT(llFileLength >= sizeof(ABFFileHeader)); // Calculate the number of data samples in the file. UINT uAcquiredSamples = UINT((llFileLength - NewFH.lDataSectionPtr * ABF_BLOCKSIZE)/SampleSize(&NewFH)); pFI->SetAcquiredSamples(uAcquiredSamples); if (pFI->GetSynchCount() != 0) { // Write the synch array out to disk, storing the size and location // of the Synch array in the header in the process. if (!WriteSynchArray(pFI, &NewFH, pnError)) { // Truncate the file at the end of the data section. VERIFY(pFI->Seek( llFileLength, FILE_END)); VERIFY(pFI->SetEndOfFile()); return FALSE; } // Switch the synch array to read mode to allow access to synch array in Save As (PRC 6/99) pFI->SetSynchMode( CSynch::eREADMODE ); } else if (NewFH.nOperationMode == ABF_GAPFREEFILE) { NewFH.lEpisodesPerRun = 1; NewFH.lRunsPerTrial = 1; NewFH.lActualAcqLength = uAcquiredSamples; NewFH.lActualEpisodes = uAcquiredSamples / NewFH.lNumSamplesPerEpisode; // Allow for the last (possibly incomplete) episode. if( uAcquiredSamples % NewFH.lNumSamplesPerEpisode ) NewFH.lActualEpisodes++; } else if (NewFH.nOperationMode == ABF_WAVEFORMFILE) { UINT uAcquiredEpisodes = uAcquiredSamples / NewFH.lNumSamplesPerEpisode; uAcquiredSamples = uAcquiredEpisodes * NewFH.lNumSamplesPerEpisode; pFI->SetAcquiredEpisodes(uAcquiredEpisodes); pFI->SetAcquiredSamples(uAcquiredSamples); NewFH.lActualEpisodes = uAcquiredEpisodes; NewFH.lActualAcqLength = uAcquiredSamples; } if (pFI->GetTagCount() > 0) { // Write the tags out to disk, storing the size and location // of the tag block in the header in the process. if (!WriteTags(pFI, &NewFH, pnError)) { // Truncate the file at the end of the data section. VERIFY(pFI->Seek( llFileLength, FILE_END)); VERIFY(pFI->SetEndOfFile()); return FALSE; } } if (pFI->GetDeltaCount() > 0) { // Write the deltas out to disk, storing the size and location // of the delta array in the header in the process. if (!pFI->WriteDeltas( &NewFH.lDeltaArrayPtr, &NewFH.lNumDeltas )) { // Truncate the file at the end of the data section. VERIFY(pFI->Seek( llFileLength, FILE_END)); VERIFY(pFI->SetEndOfFile()); return ErrorReturn(pnError, ABF_EDISKFULL); } } if (pFI->GetAnnotationCount() > 0) { // Write the annotations out to disk, storing the size and location // of the annotations section in the header in the process. if(!pFI->WriteAnnotations( &NewFH.lAnnotationSectionPtr, &NewFH.lNumAnnotations ) ) { // Truncate the file at the end of the data section. VERIFY(pFI->Seek( llFileLength, FILE_END)); VERIFY(pFI->SetEndOfFile()); return ErrorReturn(pnError, ABF_EDISKFULL); } } for(int i=0; iGetDACFileSweepCount(i) > 0) { // Write the deltas out to disk, storing the size and location // of the delta array in the header in the process. if (!pFI->WriteDACFileSweeps( i, &NewFH.lDACFilePtr[i], &NewFH.lDACFileNumEpisodes[i] )) { // Truncate the file at the end of the data section. VERIFY(pFI->Seek( llFileLength, FILE_END)); VERIFY(pFI->SetEndOfFile()); return ErrorReturn(pnError, ABF_EDISKFULL); } } } // Read back the header image that was written when the file was opened. ABFFileHeader OldHeader; VERIFY(pFI->Seek( 0L, FILE_BEGIN)); UINT uHeaderSize = ABF_OLDHEADERSIZE; if( ABFH_IsNewHeader(&NewFH) ) uHeaderSize = ABF_HEADERSIZE; VERIFY(pFI->Read(&OldHeader, uHeaderSize)); // Create a copy of the header as it stands now (post acquisition). ABFFileHeader NewHeader = NewFH; // Copy the original values of items that can be subject to deltas into the new header. // This ensures the copy on disk is the original values (with delta info) and the client // has the current (updated with deltas) settings. // This list should be maintained along with the enumeration for delta types in ABFHEADR.H // Delta type: ABF_DELTA_HOLDING0 .. ABF_DELTA_HOLDING3 for (int i=0; iSeek( 0L, FILE_BEGIN)); if (!ABFH_ParamWriter(pFI->GetFileHandle(), &NewHeader, NULL)) return ErrorReturn(pnError, ABF_EDISKFULL); // Update the current file length. ABFLONG lCurrentFileSize = (ABFLONG)pFI->GetFileSize(); // Pad with zeroes to the nearest block boundary. pFI->FillToNextBlock( &lCurrentFileSize ); // Calculate CRC in current file descriptor. NewHeader.ulFileCRC = CalculateCRC( pFI ); // Update the header in the file descriptor with CRC in place. VERIFY(pFI->Seek( 0L, FILE_BEGIN)); if (!ABFH_ParamWriter(pFI->GetFileHandle(), &NewHeader, NULL)) return ErrorReturn(pnError, ABF_EDISKFULL); ABFH_DemoteHeader( pFH, &NewFH ); return TRUE; } #endif //=============================================================================================== // FUNCTION: ABF_Close // PURPOSE: This routine closes the current data file and cleans up any work buffers that // were allocated for processing the data. // BOOL WINAPI ABF_Close(int nFile, int *pnError) { CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) { // TRACE("ABF_Close failed.\n"); return FALSE; } ReleaseFileDescriptor(nFile); return TRUE; } //=============================================================================================== // FUNCTION: SamplesToSynchCounts // PURPOSE: Converts a value in multiplexed samples to Synch Time Units. // static UINT SamplesToSynchCounts(const ABFFileHeader *pFH, UINT uSamples) { DWORD dwLengthInSynchUnits = uSamples; if( pFH->fSynchTimeUnit != 0.0F ) { double dLen = dwLengthInSynchUnits * ABFH_GetFirstSampleInterval(pFH) * pFH->nADCNumChannels / 1E3; dLen = floor( dLen + 0.5 ); dwLengthInSynchUnits = DWORD( dLen ); } return dwLengthInSynchUnits; } //=============================================================================================== // FUNCTION: SamplesToSynchCounts // PURPOSE: Converts a value in multiplexed samples to Synch Time Units. // static UINT ABF2_SamplesToSynchCounts(const ABF2FileHeader *pFH, UINT uSamples) { DWORD dwLengthInSynchUnits = uSamples; if( pFH->fSynchTimeUnit != 0.0F ) { double dLen = dwLengthInSynchUnits * ABF2H_GetFirstSampleInterval(pFH) * pFH->nADCNumChannels / 1E3; dLen = floor( dLen + 0.5 ); dwLengthInSynchUnits = DWORD( dLen ); } return dwLengthInSynchUnits; } //=============================================================================================== // FUNCTION: ExpandSynchEntry // PURPOSE: Unpacks a synch entry into one or more chunks no greater than the max chunk size. // static void ExpandSynchEntry(const ABFFileHeader *pFH, CSynch &SynchArray, Synch *pItem, UINT uChunkSize, UINT uSampleSize) { UINT uStart = pItem->dwStart; UINT uLength = pItem->dwLength; UINT uFileOffset = pItem->dwFileOffset; while (uLength > uChunkSize) { SynchArray.Put(uStart, uChunkSize, uFileOffset); uStart += SamplesToSynchCounts( pFH, uChunkSize ); uFileOffset += uChunkSize * uSampleSize; uLength -= uChunkSize; } SynchArray.Put(uStart, uLength, uFileOffset); } //=============================================================================================== // FUNCTION: ExpandSynchEntry // PURPOSE: Unpacks a synch entry into one or more chunks no greater than the max chunk size. // static void ABF2_ExpandSynchEntry(const ABF2FileHeader *pFH, CSynch &SynchArray, Synch *pItem, UINT uChunkSize, UINT uSampleSize) { UINT uStart = pItem->dwStart; UINT uLength = pItem->dwLength; UINT uFileOffset = pItem->dwFileOffset; while (uLength > uChunkSize) { SynchArray.Put(uStart, uChunkSize, uFileOffset); uStart += ABF2_SamplesToSynchCounts( pFH, uChunkSize ); uFileOffset += uChunkSize * uSampleSize; uLength -= uChunkSize; } SynchArray.Put(uStart, uLength, uFileOffset); } //=============================================================================================== // FUNCTION: _SetChunkSize // PURPOSE: This routine can be called on files of type ABF_GAPFREEFILE or ABF_VARLENEVENTS to change // the size of the data chunks returned by the read routines. // INPUT: // hFile ABF file number of this file (NOT the DOS handle) // pFH the current acquisition parameters for the data file // puMaxSamples points to the requested size of data blocks to be returned. // This is only used in the case of GAPFREE and EVENT-DETECTED- // VARIABLE-LENGTH acquisitions. Otherwise the size of the // Episode is used. 80x86 limitations require this to be // less than or equal to 64k. // pdwMaxEpi The maximum number of episodes to be read. // OUTPUT: // pFH the acquisition parameters that were read from the data file // puMaxSamples the maximum number of samples that can be read contiguously // from the data file. // pdwMaxEpi the number of episodes of puMaxSamples points that exist // in the data file. // static BOOL _SetChunkSize( CFileDescriptor *pFI, ABFFileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError ) { // Check for valid parameters. // WPTRASSERT(puMaxSamples); // WPTRASSERT(pdwMaxEpi); // Check that requested chunk size is reasonable. // If chunk-size is zero, it is treated as a request for ABF to set a reasonable // chunk-size. An error is returned if chunk-size is given but too small. // If the size given is too big, it is set to the largest possible size. UINT uLimSamples = PCLAMP7_MAXSWEEPLEN_PERCHAN; UINT uMaxSamples = *puMaxSamples; // if uMaxSamples == -1, restore the chunk size to the "raw" value (i.e. from disk). if ((int)uMaxSamples != -1 ) { if (uMaxSamples == 0) uMaxSamples = ABF_DEFAULTCHUNKSIZE / pFH->nADCNumChannels; else if (uMaxSamples > uLimSamples) uMaxSamples = uLimSamples; } UINT uAcqLenPerChannel = UINT(pFH->lActualAcqLength / pFH->nADCNumChannels); if (uMaxSamples > uAcqLenPerChannel) uMaxSamples = uAcqLenPerChannel; pFH->lNumSamplesPerEpisode = ABFLONG(uMaxSamples * pFH->nADCNumChannels); // Set the return value for the read chunk size. *puMaxSamples = (UINT)(pFH->lNumSamplesPerEpisode / pFH->nADCNumChannels); // Scan through the synch array building up into full event sizes and then // subdividing down into multiples of the chunk size. if (pFI->GetSynchCount() <= 0) { // Only ABF_GAPFREEFILEs and ABF_WAVEFORMFILEs can optionally have synch arrays. ASSERT((pFH->nOperationMode == ABF_GAPFREEFILE) || (pFH->nOperationMode == ABF_WAVEFORMFILE)); // Gap-free files only have synch arrays if they have been paused during recording // If there is no synch array, work out how many chunks we have etc. // // Gapfree files without synch arrays need to know the size of the last episode // (this can be less than the episode size for gap-free data) UINT uMaxEpi = uAcqLenPerChannel / uMaxSamples; UINT uLastEpiSize = uAcqLenPerChannel % uMaxSamples; if (uLastEpiSize > 0) { uMaxEpi++; ASSERT(pFH->nOperationMode == ABF_GAPFREEFILE); } else uLastEpiSize = uMaxSamples; *pdwMaxEpi = uMaxEpi; pFI->SetLastEpiSize(uLastEpiSize * pFH->nADCNumChannels); } else if ((pFH->nOperationMode == ABF_GAPFREEFILE) || (pFH->nOperationMode == ABF_VARLENEVENTS)) { // Create a new synch array that we can build from the old one. CSynch NewSynchArray; if (!NewSynchArray.OpenFile()) return ErrorReturn(pnError, ABF_BADTEMPFILE); // Cache some useful constants const UINT uSampleSize = SampleSize(pFH); const UINT uSynchCount = pFI->GetSynchCount(); const UINT uMaxChunkSize = *puMaxSamples * UINT(pFH->nADCNumChannels); // Get the first entry. Synch LastItem = { 0 }; pFI->GetSynchEntry(1, &LastItem); // Loop through the rest of the entries. for (UINT i=2; i<=uSynchCount; i++) { // For event detected variable length data files, episodes may be larger then // wFullEpisodeSize. These will be broken up into multiple units of length // uMaxChunkSize or less, and the Synch array adjusted accordingly. // Calculate file offsets and expand out any episodes longer than // uMaxChunkSize to span multiple Synch entries. Synch SynchItem; pFI->GetSynchEntry(i, &SynchItem); // if there are no missing samples, add this length to the previous entry. if( SynchItem.dwStart == LastItem.dwStart + SamplesToSynchCounts(pFH, LastItem.dwLength) ) LastItem.dwLength += SynchItem.dwLength; else { ExpandSynchEntry(pFH, NewSynchArray, &LastItem, uMaxChunkSize, uSampleSize); LastItem = SynchItem; } } ExpandSynchEntry(pFH, NewSynchArray, &LastItem, uMaxChunkSize, uSampleSize); if (pFI->TestFlag(FI_READONLY)) NewSynchArray.SetMode(CSynch::eREADMODE); pFI->ChangeSynchArray(&NewSynchArray); *pdwMaxEpi = pFI->GetSynchCount(); } else { // ERRORMSG("ABF_SetChunkSize should only be used on ABF_GAPFREEFILE or ABF_VARLENEVENTS ABF files"); } // Set header variable for the number of episodes in the file. pFH->lActualEpisodes = *pdwMaxEpi; pFI->SetAcquiredEpisodes(*pdwMaxEpi); pFI->FreeReadBuffer(); return TRUE; } //=============================================================================================== // FUNCTION: _SetChunkSize // PURPOSE: This routine can be called on files of type ABF_GAPFREEFILE or ABF_VARLENEVENTS to change // the size of the data chunks returned by the read routines. // INPUT: // hFile ABF file number of this file (NOT the DOS handle) // pFH the current acquisition parameters for the data file // puMaxSamples points to the requested size of data blocks to be returned. // This is only used in the case of GAPFREE and EVENT-DETECTED- // VARIABLE-LENGTH acquisitions. Otherwise the size of the // Episode is used. 80x86 limitations require this to be // less than or equal to 64k. // pdwMaxEpi The maximum number of episodes to be read. // OUTPUT: // pFH the acquisition parameters that were read from the data file // puMaxSamples the maximum number of samples that can be read contiguously // from the data file. // pdwMaxEpi the number of episodes of puMaxSamples points that exist // in the data file. // static BOOL ABF2_SetChunkSize( CFileDescriptor *pFI, ABF2FileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError ) { // Check for valid parameters. // WPTRASSERT(puMaxSamples); // WPTRASSERT(pdwMaxEpi); // Check that requested chunk size is reasonable. // If chunk-size is zero, it is treated as a request for ABF to set a reasonable // chunk-size. An error is returned if chunk-size is given but too small. // If the size given is too big, it is set to the largest possible size. UINT uLimSamples = PCLAMP7_MAXSWEEPLEN_PERCHAN; UINT uMaxSamples = *puMaxSamples; // if uMaxSamples == -1, restore the chunk size to the "raw" value (i.e. from disk). if ((int)uMaxSamples != -1 ) { if (uMaxSamples == 0) uMaxSamples = ABF_DEFAULTCHUNKSIZE / pFH->nADCNumChannels; else if (uMaxSamples > uLimSamples) uMaxSamples = uLimSamples; } UINT uAcqLenPerChannel = UINT(pFH->lActualAcqLength / pFH->nADCNumChannels); if (uMaxSamples > uAcqLenPerChannel) uMaxSamples = uAcqLenPerChannel; pFH->lNumSamplesPerEpisode = ABFLONG(uMaxSamples * pFH->nADCNumChannels); // Set the return value for the read chunk size. *puMaxSamples = (UINT)(pFH->lNumSamplesPerEpisode / pFH->nADCNumChannels); // Scan through the synch array building up into full event sizes and then // subdividing down into multiples of the chunk size. if (pFI->GetSynchCount() <= 0) { // Only ABF_GAPFREEFILEs and ABF_WAVEFORMFILEs can optionally have synch arrays. ASSERT((pFH->nOperationMode == ABF_GAPFREEFILE) || (pFH->nOperationMode == ABF_WAVEFORMFILE)); // Gap-free files only have synch arrays if they have been paused during recording // If there is no synch array, work out how many chunks we have etc. // // Gapfree files without synch arrays need to know the size of the last episode // (this can be less than the episode size for gap-free data) UINT uMaxEpi = uAcqLenPerChannel / uMaxSamples; UINT uLastEpiSize = uAcqLenPerChannel % uMaxSamples; if (uLastEpiSize > 0) { uMaxEpi++; ASSERT(pFH->nOperationMode == ABF_GAPFREEFILE); } else uLastEpiSize = uMaxSamples; *pdwMaxEpi = uMaxEpi; pFI->SetLastEpiSize(uLastEpiSize * pFH->nADCNumChannels); } else if ((pFH->nOperationMode == ABF_GAPFREEFILE) || (pFH->nOperationMode == ABF_VARLENEVENTS)) { // Create a new synch array that we can build from the old one. CSynch NewSynchArray; if (!NewSynchArray.OpenFile()) return ErrorReturn(pnError, ABF_BADTEMPFILE); // Cache some useful constants const UINT uSampleSize = ABF2_SampleSize(pFH); const UINT uSynchCount = pFI->GetSynchCount(); const UINT uMaxChunkSize = *puMaxSamples * UINT(pFH->nADCNumChannels); // Get the first entry. Synch LastItem = { 0 }; pFI->GetSynchEntry(1, &LastItem); // Loop through the rest of the entries. for (UINT i=2; i<=uSynchCount; i++) { // For event detected variable length data files, episodes may be larger then // wFullEpisodeSize. These will be broken up into multiple units of length // uMaxChunkSize or less, and the Synch array adjusted accordingly. // Calculate file offsets and expand out any episodes longer than // uMaxChunkSize to span multiple Synch entries. Synch SynchItem; pFI->GetSynchEntry(i, &SynchItem); // if there are no missing samples, add this length to the previous entry. if( SynchItem.dwStart == LastItem.dwStart + ABF2_SamplesToSynchCounts(pFH, LastItem.dwLength) ) LastItem.dwLength += SynchItem.dwLength; else { ABF2_ExpandSynchEntry(pFH, NewSynchArray, &LastItem, uMaxChunkSize, uSampleSize); LastItem = SynchItem; } } ABF2_ExpandSynchEntry(pFH, NewSynchArray, &LastItem, uMaxChunkSize, uSampleSize); if (pFI->TestFlag(FI_READONLY)) NewSynchArray.SetMode(CSynch::eREADMODE); pFI->ChangeSynchArray(&NewSynchArray); *pdwMaxEpi = pFI->GetSynchCount(); } else { // ERRORMSG("ABF_SetChunkSize should only be used on ABF_GAPFREEFILE or ABF_VARLENEVENTS ABF files"); } // Set header variable for the number of episodes in the file. pFH->lActualEpisodes = *pdwMaxEpi; pFI->SetAcquiredEpisodes(*pdwMaxEpi); pFI->FreeReadBuffer(); return TRUE; } //=============================================================================================== // FUNCTION: ReadEDVarLenSynch // PURPOSE: This function shifts and expands the temporary Synch buffer to the Synch // array for a Variable-Length-Event-Detected file. // static BOOL ReadEDVarLenSynch(CFileDescriptor *pFI, ABFFileHeader *pFH, DWORD *pdwMaxEpi, UINT *puMaxSamples, int *pnError) { WPTRASSERT(pFI); // ABFH_WASSERT(pFH); WPTRASSERT(pdwMaxEpi); // If a synch array exists, read it into the virtual synch array as is. if ((pFH->lSynchArraySize > 0) && (pFH->lSynchArrayPtr > 0)) { // All variable length and gapfree ABF files use use samples as synch time counts. // However, statistics ATF files read in via ATF2ABF32 use synch time units which // are NOT samples, so we need to handle that situation. // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . // Read the synch array in chunks, writing it out to the virtual synch array. // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CFileReadCache SynchFile; if (!SynchFile.Initialize(sizeof(ABFSynch), SYNCH_BUFFER_SIZE, pFI->GetFileHandle(), LONGLONG(pFH->lSynchArrayPtr) * ABF_BLOCKSIZE, pFH->lSynchArraySize)) return ErrorReturn(pnError, ABF_OUTOFMEMORY); UINT uSampleSize = SampleSize(pFH); UINT uAcqLength = UINT(pFH->lActualAcqLength); UINT uFileOffset = 0; UINT uLastStart = 0; for (UINT i=0; ilSynchArraySize); i++) { ABFSynch *pS = (ABFSynch *)SynchFile.Get(i); if (!pS) return ErrorReturn(pnError, ABF_EBADSYNCH); UINT uStart = pS->lStart; UINT uLength = pS->lLength; // Check synch entry length. if (uLength > uAcqLength) return ErrorReturn(pnError, ABF_EBADSYNCH); // check that entries are consecutive if( uStart < uLastStart ) return ErrorReturn(pnError, ABF_EBADSYNCH); uLastStart = uStart; pFI->PutSynchEntry(uStart, uLength, uFileOffset); uFileOffset += uLength * uSampleSize; uAcqLength -= uLength; } pFI->SetSynchMode( CSynch::eREADMODE ); } return _SetChunkSize( pFI, pFH, puMaxSamples, pdwMaxEpi, pnError ); } //=============================================================================================== // FUNCTION: _SetOverlap // PURPOSE: Changes the overlap flag and processes the synch array to edit redundant data out if no overlap. // static BOOL _SetOverlap(CFileDescriptor *pFI, const ABFFileHeader *pFH, BOOL bAllowOverlap, int *pnError) { // ABFH_ASSERT(pFH); // Only fixed length events files have overlapping events. if (pFH->nOperationMode != ABF_FIXLENEVENTS) return TRUE; // Fixed length events files always use samples for synch time units. ASSERT(pFH->fSynchTimeUnit==0.0F); // If none of the sweeps overlap there is nothing to do, get out now. if (!pFI->GetOverlappedFlag()) return TRUE; // Create a new synch array that we can build from the old one. CSynch NewSynchArray; if (!NewSynchArray.OpenFile()) return ErrorReturn(pnError, ABF_BADTEMPFILE); // Cache some useful constants const UINT uSynchCount = pFI->GetSynchCount(); if (bAllowOverlap) { Synch Item = { 0 }; UINT uSweepLength = UINT(pFH->lNumSamplesPerEpisode); // Loop through entries setting them all to the sweep length. for (UINT i=1; i<=uSynchCount; i++) { pFI->GetSynchEntry(i, &Item); NewSynchArray.Put(Item.dwStart, uSweepLength, Item.dwFileOffset); } } else { // Get the first entry. Synch LastItem = { 0 }; pFI->GetSynchEntry(1, &LastItem); // Loop through the rest of the entries. for (UINT i=2; i<=uSynchCount; i++) { Synch SynchItem; pFI->GetSynchEntry(i, &SynchItem); if ((SynchItem.dwStart != ABF_AVERAGESWEEPSTART) && (LastItem.dwStart != ABF_AVERAGESWEEPSTART)) { // If redundant data is found, then truncate this episode if // overlapped data is not to be allowed. if (LastItem.dwStart + LastItem.dwLength > SynchItem.dwStart) LastItem.dwLength = SynchItem.dwStart - LastItem.dwStart; } NewSynchArray.Put(LastItem.dwStart, LastItem.dwLength, LastItem.dwFileOffset); LastItem = SynchItem; } NewSynchArray.Put(LastItem.dwStart, LastItem.dwLength, LastItem.dwFileOffset); } if (pFI->TestFlag(FI_READONLY)) NewSynchArray.SetMode(CSynch::eREADMODE); pFI->ChangeSynchArray(&NewSynchArray); return TRUE; } //=============================================================================================== // FUNCTION: ReadEDFixLenSynch // PURPOSE: Reads a fixed length synch array off disk and stores it away in a synch buffer. // Overlapping episodes are truncated so that the user is only returned data once. // static BOOL ReadEDFixLenSynch(CFileDescriptor *pFI, const ABFFileHeader *pFH, DWORD *pdwMaxEpi, BOOL bAllowOverlap, int *pnError) { WPTRASSERT(pFI); WPTRASSERT(pdwMaxEpi); // ABFH_ASSERT(pFH); if ((pFH->lSynchArraySize <= 0) || (pFH->lSynchArrayPtr <= 0)) { // Only waveform files can optionally have a synch array. if (pFH->nOperationMode!=ABF_WAVEFORMFILE) return ErrorReturn(pnError, ABF_ENOSYNCHPRESENT); *pdwMaxEpi = pFH->lActualEpisodes; return TRUE; } // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . // read the synch array in chunks, writing it out to the virtual synch array. // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CFileReadCache SynchFile; if (!SynchFile.Initialize(sizeof(ABFSynch), SYNCH_BUFFER_SIZE, pFI->GetFileHandle(), LONGLONG(pFH->lSynchArrayPtr) * ABF_BLOCKSIZE, pFH->lSynchArraySize)) return ErrorReturn(pnError, ABF_OUTOFMEMORY); BOOL bOverlapFound = FALSE; UINT uFileOffset = 0; UINT uSampleSize = SampleSize(pFH); UINT uAcqLength = UINT(pFH->lActualAcqLength); // Get the first entry. ABFSynch *pS = (ABFSynch *)SynchFile.Get(0); if (!pS) return ErrorReturn(pnError, ABF_EBADSYNCH); UINT uStart = pS->lStart; UINT uLength = pS->lLength; // Loop n-1 times checking the entry against the following one. for (UINT i=1; ilSynchArraySize); i++) { // All episodes should be of the same length. ASSERT(uLength == UINT(pFH->lNumSamplesPerEpisode)); // Check synch entry range if (uLength > uAcqLength) return ErrorReturn(pnError, ABF_EBADSYNCH); // Event detected modes are described by a Synch array that specifies each // episode's position and length in the data file. pS = (ABFSynch *)SynchFile.Get(i); if (!pS) return ErrorReturn(pnError, ABF_EBADSYNCH); if ((pFH->nOperationMode!=ABF_WAVEFORMFILE) && (uStart!=ABF_AVERAGESWEEPSTART)) { // Only fix-len event detected files can have overlapping sweeps, and these // always use samples as synch time counts -- this simplifies comparisons. ASSERT(pFH->fSynchTimeUnit==0.0); // Some versions of AxoTape produced negative entries in the synch array. // DEMOTAPE (Axotape-for-DOS demo version) creates corrupted synch arrays... if (ABFLONG(uStart) < 0) return ErrorReturn(pnError, ABF_EBADSYNCH); // Check for redundant data in following episodes if (pS->lStart > -1) { // check that entries are consecutive if (UINT(pS->lStart) <= uStart) return ErrorReturn(pnError, ABF_EBADSYNCH); // If redundant data is found, then truncate this episode if // overlapped data is not to be allowed. if (uStart + uLength > UINT(pS->lStart)) bOverlapFound = TRUE; } } pFI->PutSynchEntry(uStart, uLength, uFileOffset); uFileOffset += uLength * uSampleSize; uAcqLength -= uLength; uStart = pS->lStart; uLength = pS->lLength; } // Put the last entry into the synch array. pFI->PutSynchEntry(uStart, uLength, uFileOffset); *pdwMaxEpi = UINT(pFH->lSynchArraySize); pFI->SetSynchMode( CSynch::eREADMODE ); pFI->SetOverlappedFlag(bOverlapFound); return _SetOverlap(pFI, pFH, bAllowOverlap, pnError); } //=============================================================================================== // FUNCTION: ReadOldSynchArray // PURPOSE: Reads a synch array from an old (pre ABF) data file and stores it away in the synch // buffer. Copes with the complexities of old synch arrays (non-trivial). // static BOOL ReadOldSynchArray(CFileDescriptor *pFI, ABFFileHeader *pFH, DWORD *pdwMaxEpi, int *pnError) { // WPTRASSERT(pFI); // ABFH_WASSERT(pFH); // WPTRASSERT(pdwMaxEpi); if ((pFH->lSynchArraySize <= 0) || (pFH->lSynchArrayPtr <= 0)) { if (pFH->nOperationMode != ABF_WAVEFORMFILE) return ErrorReturn(pnError, ABF_ENOSYNCHPRESENT); *pdwMaxEpi = UINT(pFH->lActualAcqLength / pFH->lNumSamplesPerEpisode); return TRUE; } // Get the length of the file. ABFLONG lFileLength = ABFLONG(pFI->GetFileSize()); ASSERT(lFileLength > 0); // Old Csynch arrays must be converted to the new style Synch array. // dwMaxEpi may be reduced as deleated and empty episodes are stripped out. // This conversion process also fills in file offset entries for each episode. // Allocate a temporary buffer and read the Synch array into it. // Old synch arrays are guaranteed to be less than 64k, so one read will do it. UINT uSize = (UINT)pFH->lSynchArraySize * 2; // two short entries per episode CArrayPtr pnOldSynch(uSize); if (pnOldSynch == NULL) return ErrorReturn(pnError, ABF_OUTOFMEMORY); // Seek to the start of the synch block. // VERIFY(pFI->Seek( LONGLONG(pFH->lSynchArrayPtr) * ABF_BLOCKSIZE, FILE_BEGIN)); // Read the Synch array into the buffer if (!pFI->Read(pnOldSynch, uSize*sizeof(short))) return ErrorReturn(pnError, ABF_EREADSYNCH); // Convert old Synch array to new Synch array, checking for edited // (missing) episodes in older file versions. UINT uMissing = 0; ABFLONG lStart = 0L; short *pn = pnOldSynch; for (ABFLONG lSrc=0; lSrc < pFH->lSynchArraySize; lSrc++) { int nCount = *pn++; int nLength = *pn++; ABFLONG lFileOffset = pFH->lNumSamplesPerEpisode * sizeof(short) * lSrc; if (nLength < 0) { // Zero length acquisition found (i.e. an episode with invalid // data) increment Missing% count, but not // destination index to effectively edit it out of the file for // analysis. // Negative Synch entry means that an episode was deleated. // Destination index is not incremented, and Missing% count is // updated. uMissing++; } else { ABFLONG lLength, lSkip; if (nCount == 0) { // Adjust the offset for incomplete episodes. lFileOffset += pFH->lNumSamplesPerEpisode * sizeof(short) - nLength; lSkip = 0; lLength = nLength / sizeof(short); // convert bytes to samples } else { // If count is != 0 a full episode was acquired, with possibly missing data before it started. lLength = pFH->lNumSamplesPerEpisode; lSkip = pFH->lNumSamplesPerEpisode * ABFLONG(nCount-1) + ABFLONG(nLength / sizeof(short)); // Old fetchan source code disregards MissingSamples if they are less than zero. if (lSkip < 0) lSkip = 0; } lStart += lSkip; // Check that episode is within the physical file. if (lFileOffset+lLength*ABFLONG(sizeof(short)) > lFileLength-1024) return ErrorReturn(pnError, ABF_EBADSYNCH); pFI->PutSynchEntry(lStart, lLength, lFileOffset); lStart += lLength; } } pFH->lSynchArraySize -= uMissing; *pdwMaxEpi = UINT(pFH->lSynchArraySize); pFI->SetSynchMode( CSynch::eREADMODE ); return TRUE; } //=============================================================================================== // FUNCTION: GetSynchEntry // PURPOSE: Gets a synch entry describing the requested episode (if possible). // RETURNS: TRUE = OK, FALSE = Episode number out of range. // NOTES: Episode number is one-relative! // static BOOL GetSynchEntry( const ABFFileHeader *pFH, CFileDescriptor *pFI, UINT uEpisode, Synch *pSynchEntry ) { if (!pFI->CheckEpisodeNumber(uEpisode)) return FALSE; // If a synch array is not present, create a synch entry for this chunk, // otherwise, read it from the synch array. if (pFI->GetSynchCount() == 0) { UINT uSampleSize = SampleSize(pFH); UINT uChunkSize = UINT(pFH->lNumSamplesPerEpisode); // Chunk size in samples // In continuous files, the last episode may be smaller than the episode size used // for the rest of the file. This is calculated in the ABF.Open routine. if ((pFH->nOperationMode == ABF_GAPFREEFILE) && (uEpisode == pFI->GetAcquiredEpisodes())) pSynchEntry->dwLength = pFI->GetLastEpiSize(); else pSynchEntry->dwLength = uChunkSize; pSynchEntry->dwFileOffset = uChunkSize * uSampleSize * (uEpisode - 1); pSynchEntry->dwStart = pSynchEntry->dwFileOffset / uSampleSize; return TRUE; } return pFI->GetSynchEntry( uEpisode, pSynchEntry ); } //=============================================================================================== // FUNCTION: GetSynchEntry // PURPOSE: Gets a synch entry describing the requested episode (if possible). // RETURNS: TRUE = OK, FALSE = Episode number out of range. // NOTES: Episode number is one-relative! // static BOOL ABF2_GetSynchEntry( const ABF2FileHeader *pFH, CFileDescriptor *pFI, UINT uEpisode, Synch *pSynchEntry ) { if (!pFI->CheckEpisodeNumber(uEpisode)) return FALSE; // If a synch array is not present, create a synch entry for this chunk, // otherwise, read it from the synch array. if (pFI->GetSynchCount() == 0) { UINT uSampleSize = ABF2_SampleSize(pFH); UINT uChunkSize = UINT(pFH->lNumSamplesPerEpisode); // Chunk size in samples // In continuous files, the last episode may be smaller than the episode size used // for the rest of the file. This is calculated in the ABF.Open routine. if ((pFH->nOperationMode == ABF_GAPFREEFILE) && (uEpisode == pFI->GetAcquiredEpisodes())) pSynchEntry->dwLength = pFI->GetLastEpiSize(); else pSynchEntry->dwLength = uChunkSize; pSynchEntry->dwFileOffset = uChunkSize * uSampleSize * (uEpisode - 1); pSynchEntry->dwStart = pSynchEntry->dwFileOffset / uSampleSize; return TRUE; } return pFI->GetSynchEntry( uEpisode, pSynchEntry ); } //=============================================================================================== // FUNCTION: ABF_MultiplexRead // PURPOSE: This routine reads an episode of data from the data file previously opened. // // INPUT: // nFile the file index into the g_FileData structure array // dwEpisode the episode number to be read. Episodes start at 1 // // OUTPUT: // pvBuffer the data buffer for the data // puSizeInSamples the number of valid points in the data buffer // BOOL WINAPI ABF_MultiplexRead(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, void *pvBuffer, UINT uBufferSize, UINT *puSizeInSamples, int *pnError) { // ABFH_ASSERT(pFH); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->CheckEpisodeNumber(dwEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); // Set the sample size in the data. UINT uSampleSize = SampleSize(pFH); // UINT uBytesPerEpisode = UINT(pFH->lNumSamplesPerEpisode) * uSampleSize; // If a synch array is not present, create a synch entry for this chunk, // otherwise, read it from the synch array. Synch SynchEntry; if (!GetSynchEntry( pFH, pFI, dwEpisode, &SynchEntry )) return ErrorReturn(pnError, ABF_EEPISODERANGE); // return the size of the episode to be read. if (puSizeInSamples) *puSizeInSamples = UINT(SynchEntry.dwLength); // Add the distance to the start of the data to the data offset LONGLONG lFileOffset = LONGLONG(GetDataOffset(pFH)) + SynchEntry.dwFileOffset; // Seek to the calculated file position. VERIFY(pFI->Seek(lFileOffset, FILE_BEGIN)); UINT uSizeInBytes = SynchEntry.dwLength * uSampleSize; // ARRAYASSERT((BYTE *)pvBuffer, uSizeInBytes); // Do the file read if (!pFI->Read(pvBuffer, uSizeInBytes)) return ErrorReturn(pnError, ABF_EREADDATA); // If episode is not full, pad it out with 0's // Make sure that it is zero-padded to avoid this adventurous memset #if 0 if (uSizeInBytes < uBufferSize * uSampleSize) memset((char *)pvBuffer + uSizeInBytes, '\0', uBufferSize*uSampleSize - uSizeInBytes); #endif return TRUE; } //=============================================================================================== // FUNCTION: ABF_MultiplexRead // PURPOSE: This routine reads an episode of data from the data file previously opened. // // INPUT: // nFile the file index into the g_FileData structure array // dwEpisode the episode number to be read. Episodes start at 1 // // OUTPUT: // pvBuffer the data buffer for the data // puSizeInSamples the number of valid points in the data buffer // BOOL WINAPI ABF2_MultiplexRead(int nFile, const ABF2FileHeader *pFH, DWORD dwEpisode, void *pvBuffer, UINT uBufferSize, UINT *puSizeInSamples, int *pnError) { // ABFH_ASSERT(pFH); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->CheckEpisodeNumber(dwEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); // Set the sample size in the data. UINT uSampleSize = ABF2_SampleSize(pFH); // UINT uBytesPerEpisode = UINT(pFH->lNumSamplesPerEpisode) * uSampleSize; // If a synch array is not present, create a synch entry for this chunk, // otherwise, read it from the synch array. Synch SynchEntry; if (!ABF2_GetSynchEntry( pFH, pFI, dwEpisode, &SynchEntry )) return ErrorReturn(pnError, ABF_EEPISODERANGE); // return the size of the episode to be read. if (puSizeInSamples) *puSizeInSamples = UINT(SynchEntry.dwLength); // Add the distance to the start of the data to the data offset LONGLONG lFileOffset = LONGLONG(ABF2_GetDataOffset(pFH)) + SynchEntry.dwFileOffset; // Seek to the calculated file position. VERIFY(pFI->Seek(lFileOffset, FILE_BEGIN)); UINT uSizeInBytes = SynchEntry.dwLength * uSampleSize; // ARRAYASSERT((BYTE *)pvBuffer, uSizeInBytes); // Do the file read if (!pFI->Read(pvBuffer, uSizeInBytes)) return ErrorReturn(pnError, ABF_EREADDATA); // If episode is not full, pad it out with 0's // Make sure that it is zero-padded to avoid this adventurous memset #if 0 if (uSizeInBytes < uBufferSize * uSampleSize) memset((char *)pvBuffer + uSizeInBytes, '\0', uBufferSize*uSampleSize - uSizeInBytes); #endif return TRUE; } #if 0 //=============================================================================================== // FUNCTION: SynchCountToSamples // PURPOSE: Rounds a synch count to the nearest sample count. // inline UINT SynchCountToSamples(const ABFFileHeader *pFH, UINT uSynchStart) { double dMS = 0.0; ABFH_SynchCountToMS(pFH, uSynchStart, &dMS); double dSampleInterval = ABFH_GetFirstSampleInterval(pFH); return UINT(dMS/dSampleInterval*1E3 + 0.5); } //=============================================================================================== // FUNCTION: ABF_MultiplexWrite // PURPOSE: This routine writes an episode of data from the end of the data file // previously opened with a ABF_WriteOpen call. Episodes may only be written // sequentially. // INPUT: // nFile the file index into the g_FileData structure array // uFlags flags governing the write process // uSizeInSamples the number of valid points in the data buffer // dwEpiStart the start time (in synch time units) of this episode // pvBuffer the data buffer for the data // BOOL WINAPI ABF_MultiplexWrite(int nFile, ABFFileHeader *pFH, UINT uFlags, const void *pvBuffer, DWORD dwEpiStart, UINT uSizeInSamples, int *pnError) { ABFH_WASSERT(pFH); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Return an error if writing is inappropriate. if (pFI->TestFlag(FI_PARAMFILE | FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); // Check parameters in a debug build. #ifdef _DEBUG if ((pFH->nOperationMode==ABF_WAVEFORMFILE) || (pFH->nOperationMode==ABF_HIGHSPEEDOSC) || (pFH->nOperationMode==ABF_FIXLENEVENTS)) { ASSERT(pFH->lNumSamplesPerEpisode==long(uSizeInSamples)); ASSERT((uFlags & ABF_APPEND) == 0); } #endif // Set the sample size in the data. UINT uSampleSize = SampleSize(pFH); UINT uSizeInBytes = uSizeInSamples * uSampleSize; ARRAYASSERT((short *)pvBuffer, uSizeInBytes/2); // Seek to the end of the file. VERIFY(pFI->Seek( 0L, FILE_END)); if (!pFI->Write(pvBuffer, uSizeInBytes)) return ErrorReturn(pnError, ABF_EDISKFULL); UINT uAcquiredEpisodes = pFI->GetAcquiredEpisodes(); UINT uAcquiredSamples = pFI->GetAcquiredSamples(); UINT uSynchCount = pFI->GetSynchCount(); // Clear the append flag if there is nothing to append to. if (uSynchCount == 0) uFlags &= ~ABF_APPEND; switch (pFH->nOperationMode) { case ABF_GAPFREEFILE: { UINT uEpiStartInSamples = SynchCountToSamples(pFH, dwEpiStart); // If there is a synch array already... if (uSynchCount != 0) { UINT uStartOfLast = SynchCountToSamples(pFH, pFI->EpisodeStart( uAcquiredEpisodes )); UINT uEndOfLast = uStartOfLast + pFI->EpisodeLength( uAcquiredEpisodes ); if (uEpiStartInSamples <= uEndOfLast) // If we are just appending onto the previous event... uFlags |= ABF_APPEND; // FALL THROUGH TO DEFAULT CASE FOR SYNCH ARRAY PROCESSING!!! } else // No synch array as yet - either append or add one. { // if the first block is being extended - no synch array required. if (uEpiStartInSamples <= uAcquiredSamples) { pFI->SetAcquiredEpisodes( 1 ); break; } // If some data has been acquired but no synch entries added... if (uAcquiredSamples > 0) { // Add in the first synch entry for data already written pFI->PutSynchEntry(0, uAcquiredSamples, 0); pFI->SetAcquiredEpisodes( 1 ); } // FALL THROUGH TO DEFAULT CASE FOR SYNCH ARRAY PROCESSING!!! } } default: if (uFlags & ABF_APPEND) pFI->IncreaseEventLength( uSizeInSamples ); else { pFI->PutSynchEntry(dwEpiStart, uSizeInSamples, uAcquiredSamples * uSampleSize); pFI->SetAcquiredEpisodes(++uAcquiredEpisodes); } break; } uAcquiredSamples += uSizeInSamples; pFI->SetAcquiredSamples(uAcquiredSamples); pFH->lActualAcqLength = (ABFLONG)uAcquiredSamples; pFH->lActualEpisodes = (ABFLONG)pFI->GetAcquiredEpisodes(); return TRUE; } //=============================================================================================== // FUNCTION: ABF_SetEpisodeStart // PURPOSE: Sets the start time of a given sweep in synch time units. // INPUT: // nFile the file index into the g_FileData structure array // uEpisode the (one based) episode number. // uEpiStart the start time (in synch time units) of this episode // BOOL WINAPI ABF_SetEpisodeStart(int nFile, UINT uEpisode, UINT uEpiStart, int *pnError) { CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Return an error if writing is inappropriate. if (pFI->TestFlag(FI_PARAMFILE | FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); UINT uSynchCount = pFI->GetSynchCount(); if (uEpisode > uSynchCount) return ErrorReturn(pnError, ABF_EEPISODERANGE); pFI->SetEpisodeStart(uEpisode, uEpiStart); return TRUE; } //=============================================================================================== // FUNCTION: ABF_WriteRawData // PURPOSE: This routine writes a raw buffer of binary data to the current position of an // ABF file previously opened with a ABF_WriteOpen call. This routine is provided // for acquisition programs that buffer up episodic data and then write it out in // large chunks. This provides an alternative to retrieving the low-level file handle // and acting on it, as this can be non-portable, and assumptions would have to be // made regarding the type of file handle returned (DOS or C runtime). // INPUT: // nFile the file index into the g_FileData structure array // pvBuffer the data buffer for the data // dwSizeInBytes the number of bytes of data to write // BOOL WINAPI ABF_WriteRawData(int nFile, const void *pvBuffer, DWORD dwSizeInBytes, int *pnError) { CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; #ifdef _DEBUG // Return an error if writing is inappropriate. if (pFI->TestFlag( FI_PARAMFILE | FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); #endif ARRAYASSERT((short *)pvBuffer, UINT(dwSizeInBytes/2)); if (!pFI->Write(pvBuffer, dwSizeInBytes)) return ErrorReturn(pnError, ABF_EDISKFULL); return TRUE; } #endif //=============================================================================================== // FUNCTION: PackSamples // PURPOSE: Packs the samples from the source array into the destination array, // assuming the given skip factor // INPUT: // pvSource the pointer to the source of data. // pvDestination the pointer to the destination of data. // uSourceLen the length of the data to be packed // uFirstSample the starting index of the first element // uSkip the skip factor for the packing // static void PackSamples(void *pvSource, void *pvDestination, UINT uSourceLen, UINT uFirstSample, UINT uSampleSize, UINT uSkip) { ASSERT(uSkip > 0); // ARRAYASSERT((BYTE *)pvSource, uSourceLen * uSampleSize); // ARRAYASSERT((BYTE *)pvDestination, (uSourceLen / uSkip) * uSampleSize); if (uSampleSize == sizeof(short)) { // adjust the starting offset short *piSource = (short *)pvSource; short *piDestination = (short *)pvDestination; for (UINT i=uFirstSample; ilNumSamplesPerEpisode/pFH->nADCNumChannels)); ARRAYASSERT(pnSource, (UINT)(pFH->lNumSamplesPerEpisode)); UINT uSkip = (UINT)pFH->nADCNumChannels; UINT uSourceLen = (UINT)pFH->lNumSamplesPerEpisode; float fValToUUFactor, fValToUUShift; ABFH_GetADCtoUUFactors( pFH, nChannel, &fValToUUFactor, &fValToUUShift); for (UINT i=uChannelOffset; ilNumSamplesPerEpisode/pFH->nADCNumChannels)); // ARRAYASSERT(pnSource, (UINT)(pFH->lNumSamplesPerEpisode)); UINT uSkip = (UINT)pFH->nADCNumChannels; UINT uSourceLen = (UINT)pFH->lNumSamplesPerEpisode; float fValToUUFactor, fValToUUShift; ABF2H_GetADCtoUUFactors( pFH, nChannel, &fValToUUFactor, &fValToUUShift); for (UINT i=uChannelOffset; i=0; i--) pfDestination[i] = pnSource[i] * fValToUUFactor + fValToUUShift; } //=============================================================================================== // FUNCTION: ConvertInPlace // PURPOSE: Convert a single channel of two byte integers to floats, in-place. // static void ABF2_ConvertInPlace(const ABF2FileHeader *pFH, int nChannel, UINT uNumSamples, void *pvBuffer) { // ABFH_ASSERT(pFH); // ARRAYASSERT((float *)pvBuffer, uNumSamples); ADC_VALUE *pnSource = ((ADC_VALUE *)pvBuffer); float *pfDestination = ((float *)pvBuffer); float fValToUUFactor, fValToUUShift; ABF2H_GetADCtoUUFactors( pFH, nChannel, &fValToUUFactor, &fValToUUShift); for (int i=uNumSamples-1; i>=0; i--) pfDestination[i] = pnSource[i] * fValToUUFactor + fValToUUShift; } //=============================================================================================== // FUNCTION: ConvertADCToResults // PURPOSE: Get the results array for the math channel. // static BOOL ConvertADCToResults(const ABFFileHeader *pFH, float *pfDestination, UINT uDestArrayLen, short *pnSource) { // ABFH_ASSERT(pFH); // ARRAYASSERT(pfDestination, (UINT)(pFH->lNumSamplesPerEpisode/pFH->nADCNumChannels)); ARRAYASSERT(pnSource, (UINT)(pFH->lNumSamplesPerEpisode)); UINT uAOffset, uBOffset; short *pnSourceA, *pnSourceB; int nChannelA = pFH->nArithmeticADCNumA; int nChannelB = pFH->nArithmeticADCNumB; UINT i, uSkip = pFH->nADCNumChannels; UINT uSourceArrayLen = (UINT)pFH->lNumSamplesPerEpisode; float fValToUUFactorA, fValToUUShiftA; float fValToUUFactorB, fValToUUShiftB; float fUserUnitA, fUserUnitB; if (!ABFH_GetChannelOffset(pFH, nChannelA, &uAOffset)) return FALSE; if (!ABFH_GetChannelOffset(pFH, nChannelB, &uBOffset)) return FALSE; ABFH_GetADCtoUUFactors( pFH, nChannelA, &fValToUUFactorA, &fValToUUShiftA); ABFH_GetADCtoUUFactors( pFH, nChannelB, &fValToUUFactorB, &fValToUUShiftB); pnSourceA = pnSource + uAOffset; // adjust the starting offset pnSourceB = pnSource + uBOffset; // adjust the starting offset uSourceArrayLen -= max(uAOffset, uBOffset); for (i=0; ilNumSamplesPerEpisode/pFH->nADCNumChannels)); ARRAYASSERT(pnSource, (UINT)(pFH->lNumSamplesPerEpisode)); UINT uAOffset, uBOffset; short *pnSourceA, *pnSourceB; int nChannelA = pFH->nArithmeticADCNumA; int nChannelB = pFH->nArithmeticADCNumB; UINT i, uSkip = pFH->nADCNumChannels; UINT uSourceArrayLen = (UINT)pFH->lNumSamplesPerEpisode; float fValToUUFactorA, fValToUUShiftA; float fValToUUFactorB, fValToUUShiftB; float fUserUnitA, fUserUnitB; if (!ABF2H_GetChannelOffset(pFH, nChannelA, &uAOffset)) return FALSE; if (!ABF2H_GetChannelOffset(pFH, nChannelB, &uBOffset)) return FALSE; ABF2H_GetADCtoUUFactors( pFH, nChannelA, &fValToUUFactorA, &fValToUUShiftA); ABF2H_GetADCtoUUFactors( pFH, nChannelB, &fValToUUFactorB, &fValToUUShiftB); pnSourceA = pnSource + uAOffset; // adjust the starting offset pnSourceB = pnSource + uBOffset; // adjust the starting offset uSourceArrayLen -= max(uAOffset, uBOffset); for (i=0; ilNumSamplesPerEpisode/pFH->nADCNumChannels); ARRAYASSERT(pfSource, pFH->lNumSamplesPerEpisode); int nChannelA = pFH->nArithmeticADCNumA; int nChannelB = pFH->nArithmeticADCNumB; UINT uSkip = pFH->nADCNumChannels; UINT uSourceArrayLen = (UINT)pFH->lNumSamplesPerEpisode; UINT uAOffset, uBOffset; if (!ABFH_GetChannelOffset(pFH, nChannelA, &uAOffset)) return FALSE; if (!ABFH_GetChannelOffset(pFH, nChannelB, &uBOffset)) return FALSE; float *pfSourceA = pfSource + uAOffset; // adjust the starting offset float *pfSourceB = pfSource + uBOffset; // adjust the starting offset uSourceArrayLen -= max(uAOffset, uBOffset); for (UINT i=0; ilNumSamplesPerEpisode/pFH->nADCNumChannels); ARRAYASSERT(pfSource, pFH->lNumSamplesPerEpisode); int nChannelA = pFH->nArithmeticADCNumA; int nChannelB = pFH->nArithmeticADCNumB; UINT uSkip = pFH->nADCNumChannels; UINT uSourceArrayLen = (UINT)pFH->lNumSamplesPerEpisode; UINT uAOffset, uBOffset; if (!ABF2H_GetChannelOffset(pFH, nChannelA, &uAOffset)) return FALSE; if (!ABF2H_GetChannelOffset(pFH, nChannelB, &uBOffset)) return FALSE; float *pfSourceA = pfSource + uAOffset; // adjust the starting offset float *pfSourceB = pfSource + uBOffset; // adjust the starting offset uSourceArrayLen -= max(uAOffset, uBOffset); for (UINT i=0; i pFH->lNumSamplesPerEpisode / pFH->nADCNumChannels (floats) // BOOL WINAPI ABF_ReadChannel(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode, Vector_float& pfBuffer, UINT *puNumSamples, int *pnError) { #if defined(_WINDOWS) && !defined(__MINGW32__) // ABFH_ASSERT(pFH); // ARRAYASSERT(&pfBuffer[0], (UINT)(pFH->lNumSamplesPerEpisode/pFH->nADCNumChannels)); #endif CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->CheckEpisodeNumber(dwEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); // Get the offset into the multiplexed data array for the first point UINT uChannelOffset; if (!ABFH_GetChannelOffset(pFH, nChannel, &uChannelOffset)) return ErrorReturn(pnError, ABF_EINVALIDCHANNEL); // If there is only one channel, read the data directly into the passed buffer, // converting it in-place if required. if ((pFH->nADCNumChannels == 1) && (nChannel >= 0)) { if (!ABF_MultiplexRead(nFile, pFH, dwEpisode, &pfBuffer[0], (UINT)pfBuffer.size(), puNumSamples, pnError)) return FALSE; if (pFH->nDataFormat == ABF_INTEGERDATA) // if data is 2byte ints, convert to floats ConvertInPlace(pFH, nChannel, *puNumSamples, &pfBuffer[0]); return TRUE; } // Set the sample size in the data. UINT uSampleSize = SampleSize(pFH); // Only create the read buffer on demand, it is freed when the file is closed. if (!pFI->GetReadBuffer()) { if (!pFI->AllocReadBuffer(pFH->lNumSamplesPerEpisode * uSampleSize)) return ErrorReturn(pnError, ABF_OUTOFMEMORY); } // Read the whole episode from the ABF file only if it is not already cached. UINT uEpisodeSize = pFI->GetCachedEpisodeSize(); if (dwEpisode != pFI->GetCachedEpisode()) { uEpisodeSize = (UINT)pFH->lNumSamplesPerEpisode; if (!ABF_MultiplexRead(nFile, pFH, dwEpisode, pFI->GetReadBuffer(), pFH->lNumSamplesPerEpisode * uSampleSize, &uEpisodeSize, pnError)) { pFI->SetCachedEpisode(UINT(-1), 0); return FALSE; } pFI->SetCachedEpisode(dwEpisode, uEpisodeSize); } // if data is 2byte ints, convert to floats if (pFH->nDataFormat == ABF_INTEGERDATA) { // Cast the read buffer to the appropriate format. ADC_VALUE *pnReadBuffer = (ADC_VALUE *)pFI->GetReadBuffer(); // A channel number of -1 refers to the results channel if (nChannel >= 0) ConvertADCToFloats(pFH, nChannel, uChannelOffset, &pfBuffer[0], (UINT)pfBuffer.size(), pnReadBuffer); else if (!ConvertADCToResults(pFH, &pfBuffer[0], (UINT)pfBuffer.size(), pnReadBuffer)) return ErrorReturn(pnError, ABF_BADMATHCHANNEL); } else // Data is 4-byte floats. { // Cast the read buffer to the appropriate format. float *pfReadBuffer = (float *)pFI->GetReadBuffer(); // A channel number of -1 refers to the results channel if (nChannel >= 0) PackSamples(pfReadBuffer, &pfBuffer[0], uEpisodeSize, uChannelOffset, uSampleSize, pFH->nADCNumChannels); else if (!ConvertToResults(pFH, &pfBuffer[0], (UINT)pfBuffer.size(), pfReadBuffer)) return ErrorReturn(pnError, ABF_BADMATHCHANNEL); } // Return the length of the data block. if (puNumSamples) *puNumSamples = uEpisodeSize / pFH->nADCNumChannels; return TRUE; } //=============================================================================================== // FUNCTION: ABF_ReadChannel // PURPOSE: This function reads a complete multiplexed episode from the data file and // then converts a single de-multiplexed channel to "UserUnits" in pfBuffer. // // The required size of the passed buffer is: // pfBuffer -> pFH->lNumSamplesPerEpisode / pFH->nADCNumChannels (floats) // BOOL WINAPI ABF2_ReadChannel(int nFile, const ABF2FileHeader *pFH, int nChannel, DWORD dwEpisode, Vector_float& pfBuffer, UINT *puNumSamples, int *pnError) { // ABFH_ASSERT(pFH); // ARRAYASSERT(pfBuffer, (UINT)(pFH->lNumSamplesPerEpisode/pFH->nADCNumChannels)); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->CheckEpisodeNumber(dwEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); // Get the offset into the multiplexed data array for the first point UINT uChannelOffset; if (!ABF2H_GetChannelOffset(pFH, nChannel, &uChannelOffset)) return ErrorReturn(pnError, ABF_EINVALIDCHANNEL); // If there is only one channel, read the data directly into the passed buffer, // converting it in-place if required. if ((pFH->nADCNumChannels == 1) && (nChannel >= 0)) { if (!ABF2_MultiplexRead(nFile, pFH, dwEpisode, &pfBuffer[0], (UINT)pfBuffer.size(), puNumSamples, pnError)) return FALSE; if (pFH->nDataFormat == ABF_INTEGERDATA) // if data is 2byte ints, convert to floats ABF2_ConvertInPlace(pFH, nChannel, *puNumSamples, &pfBuffer[0]); return TRUE; } // Set the sample size in the data. UINT uSampleSize = ABF2_SampleSize(pFH); // Only create the read buffer on demand, it is freed when the file is closed. if (!pFI->GetReadBuffer()) { if (!pFI->AllocReadBuffer(pFH->lNumSamplesPerEpisode * uSampleSize)) return ErrorReturn(pnError, ABF_OUTOFMEMORY); } // Read the whole episode from the ABF file only if it is not already cached. UINT uEpisodeSize = pFI->GetCachedEpisodeSize(); if (dwEpisode != pFI->GetCachedEpisode()) { uEpisodeSize = (UINT)pFH->lNumSamplesPerEpisode; if (!ABF2_MultiplexRead(nFile, pFH, dwEpisode, pFI->GetReadBuffer(), pFH->lNumSamplesPerEpisode * uSampleSize, &uEpisodeSize, pnError)) { pFI->SetCachedEpisode(UINT(-1), 0); return FALSE; } pFI->SetCachedEpisode(dwEpisode, uEpisodeSize); } // if data is 2byte ints, convert to floats if (pFH->nDataFormat == ABF_INTEGERDATA) { // Cast the read buffer to the appropriate format. ADC_VALUE *pnReadBuffer = (ADC_VALUE *)pFI->GetReadBuffer(); // A channel number of -1 refers to the results channel if (nChannel >= 0) ABF2_ConvertADCToFloats(pFH, nChannel, uChannelOffset, &pfBuffer[0], (UINT)pfBuffer.size(), pnReadBuffer); else if (!ABF2_ConvertADCToResults(pFH, &pfBuffer[0], (UINT)pfBuffer.size(), pnReadBuffer)) return ErrorReturn(pnError, ABF_BADMATHCHANNEL); } else // Data is 4-byte floats. { // Cast the read buffer to the appropriate format. float *pfReadBuffer = (float *)pFI->GetReadBuffer(); // A channel number of -1 refers to the results channel if (nChannel >= 0) PackSamples(pfReadBuffer, &pfBuffer[0], uEpisodeSize, uChannelOffset, uSampleSize, pFH->nADCNumChannels); else if (!ABF2_ConvertToResults(pFH, &pfBuffer[0], (UINT)pfBuffer.size(), pfReadBuffer)) return ErrorReturn(pnError, ABF_BADMATHCHANNEL); } // Return the length of the data block. if (puNumSamples) *puNumSamples = uEpisodeSize / pFH->nADCNumChannels; return TRUE; } #if 0 //=============================================================================================== // FUNCTION: ABF_ReadRawChannel // PURPOSE: This function reads a complete multiplexed episode from the data file and // then decimates it, returning single de-multiplexed channel in the raw data format. // // The required size of the passed buffer is: // pfBuffer -> pFH->lNumSamplesPerEpisode / pFH->nADCNumChannels (floats) // BOOL WINAPI ABF_ReadRawChannel(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode, void *pvBuffer, UINT *puNumSamples, int *pnError) { ABFH_ASSERT(pFH); // Set the sample size in the data. UINT uSampleSize = SampleSize(pFH); ARRAYASSERT((short *)pvBuffer, pFH->lNumSamplesPerEpisode/pFH->nADCNumChannels*uSampleSize/2); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->CheckEpisodeNumber(dwEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); // Get the offset into the multiplexed data array for the first point UINT uChannelOffset; if (!ABFH_GetChannelOffset(pFH, nChannel, &uChannelOffset) || (nChannel < 0)) return ErrorReturn(pnError, ABF_EINVALIDCHANNEL); // If there is only one channel, read the data directly into the passed buffer, if (pFH->nADCNumChannels == 1) return ABF_MultiplexRead(nFile, pFH, dwEpisode, pvBuffer, puNumSamples, pnError); // Only create the read buffer on demand, it is freed when the file is closed. if (!pFI->GetReadBuffer()) { if (!pFI->AllocReadBuffer(pFH->lNumSamplesPerEpisode * uSampleSize)) return ErrorReturn(pnError, ABF_OUTOFMEMORY); } // Read the whole episode from the ABF file only if it is not already cached. UINT uEpisodeSize = pFI->GetCachedEpisodeSize(); if (dwEpisode != pFI->GetCachedEpisode()) { uEpisodeSize = (UINT)pFH->lNumSamplesPerEpisode; if (!ABF_MultiplexRead(nFile, pFH, dwEpisode, pFI->GetReadBuffer(), &uEpisodeSize, pnError)) { pFI->SetCachedEpisode(UINT(-1), 0); return FALSE; } pFI->SetCachedEpisode(dwEpisode, uEpisodeSize); } PackSamples(pFI->GetReadBuffer(), pvBuffer, uEpisodeSize, uChannelOffset, uSampleSize, pFH->nADCNumChannels); // Return the length of the data block. if (puNumSamples) *puNumSamples = uEpisodeSize / pFH->nADCNumChannels; return TRUE; } //=============================================================================================== // FUNCTION: ABF_ReadDACFileEpi // PURPOSE: This function reads an episode from the DACFile section. Users will normally // retrieve DAC file information transparently through the Get Waveform call. // BOOL WINAPI ABF_ReadDACFileEpi(int nFile, const ABFFileHeader *pFH, short *pnDACArray, DWORD dwEpisode, int *pnError) { return ABF_ReadDACFileEpiEx(nFile, pFH, pnDACArray, pFH->nActiveDACChannel, dwEpisode, pnError); } BOOL WINAPI ABF_ReadDACFileEpiEx(int nFile, const ABFFileHeader *pFH, short *pnDACArray, UINT nChannel, DWORD dwEpisode, int *pnError) { ABFH_ASSERT(pFH); // Take a copy of the passed in header to ensure it is 6k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); #if USE_DACFILE_FIX // PRC DEBUG // UINT uNumSamples = NewFH.lNumSamplesPerEpisode / NewFH.nADCNumChannels; UINT uNumSamples = NewFH.lNumSamplesPerEpisode; #else UINT uNumSamples = NewFH.lNumSamplesPerEpisode / NewFH.nADCNumChannels; #endif ARRAYASSERT( pnDACArray, uNumSamples ); ASSERT( nChannel < ABF_WAVEFORMCOUNT ); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // If the requested episode is after the last one, then use the last one in the file. if( NewFH.lDACFileNumEpisodes[nChannel] < (ABFLONG)dwEpisode ) dwEpisode = (DWORD) NewFH.lDACFileNumEpisodes[nChannel]; if (NewFH.lDACFilePtr[nChannel]==0) { if (!pFI->GetDACFileSweep(nChannel, dwEpisode-1, pnDACArray, uNumSamples)) return ErrorReturn(pnError, ABF_EREADDACEPISODE); } else { UINT uOffset = NewFH.lDACFilePtr[nChannel] * ABF_BLOCKSIZE + (dwEpisode-1) * uNumSamples * sizeof(short); VERIFY(pFI->Seek( uOffset, FILE_BEGIN)); // Read the DACFile episode into the passed buffer UINT uBytesToRead = uNumSamples * sizeof(short); if (!pFI->Read(pnDACArray, uBytesToRead)) return ErrorReturn(pnError, ABF_EREADDACEPISODE); #if USE_DACFILE_FIX // PRC DEBUG // Tempory hack to decimate by number of channels. int nNumChans = NewFH.nADCNumChannels; if( nNumChans > 1 ) { for( UINT i=0; inActiveDACChannel, pnDACArray, pnError); } BOOL WINAPI ABF_WriteDACFileEpiEx(int nFile, ABFFileHeader *pFH, UINT uDACChannel, const short *pnDACArray, int *pnError) { ABFH_WASSERT(pFH); ASSERT( uDACChannel < ABF_WAVEFORMCOUNT ); // Coerce to safe value. if( uDACChannel >= ABF_WAVEFORMCOUNT ) { TRACE1( "ABF_WriteDACFileEpi: uDACChannel changed from %d to 0.\n", uDACChannel ); uDACChannel = 0; } ARRAYASSERT(pnDACArray, (UINT)(pFH->lNumSamplesPerEpisode)); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Return an error if writing is inappropriate. if (pFI->TestFlag( FI_PARAMFILE | FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); // Take a copy of the passed in header to ensure it is 5k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); if (!pFI->PutDACFileSweep( uDACChannel, NewFH.lDACFileNumEpisodes[uDACChannel], pnDACArray, NewFH.lNumSamplesPerEpisode )) return ErrorReturn(pnError, ABF_EDISKFULL); NewFH.lDACFileNumEpisodes[uDACChannel]++; // Copy the original parameters back into the old header. ABFH_DemoteHeader( pFH, &NewFH ); return TRUE; } #if USE_DACFILE_FIX // PRC DEBUG static int s_nFudgeChannels = -1; #endif //=============================================================================================== // FUNCTION: ScaleDACBuffer // PURPOSE: Fill the float buffer with DAC UU values that correspond to a particular // multiplex offset. // static void ScaleDACBuffer(const ABFFileHeader *pFH, UINT uDACChannel, UINT uADCChannelOffset, short *pnReadBuffer, float *pfBuffer) { ABFH_ASSERT(pFH); ASSERT( uDACChannel < ABF_WAVEFORMCOUNT ); // Coerce to safe value. if( uDACChannel >= ABF_WAVEFORMCOUNT ) { TRACE1( "ScaleDACBuffer: uDACChannel changed from %d to 0.\n", uDACChannel ); uDACChannel = 0; } UINT uNumSamples = (UINT)pFH->lNumSamplesPerEpisode / pFH->nADCNumChannels; #if USE_DACFILE_FIX // PRC DEBUG ARRAYASSERT(pnReadBuffer, pFH->lNumSamplesPerEpisode ); #else ARRAYASSERT(pnReadBuffer, uNumSamples); #endif ARRAYASSERT(pfBuffer, uNumSamples); float fDACToUUFactor, fDACToUUShift; ABFH_GetDACtoUUFactors( pFH, uDACChannel, &fDACToUUFactor, &fDACToUUShift ); #if USE_DACFILE_FIX UINT uNumDACFileChannels = pFH->nADCNumChannels + s_nFudgeChannels; for (UINT i=uADCChannelOffset; inActiveDACChannel, dwEpisode, pfBuffer, pnError); } BOOL WINAPI ABF_GetWaveformEx(int nFile, const ABFFileHeader *pFH, UINT uDACChannel, DWORD dwEpisode, float *pfBuffer, int *pnError) { ABFH_ASSERT(pFH); ARRAYASSERT(pfBuffer, (UINT)(pFH->lNumSamplesPerEpisode / pFH->nADCNumChannels)); if( pFH->nOperationMode != ABF_WAVEFORMFILE ) return ErrorReturn(pnError, ABF_ENOWAVEFORM); // Take a copy of the passed in header to ensure it is 6k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); if( (NewFH.nWaveformEnable[uDACChannel] == FALSE) || (NewFH.nWaveformSource[uDACChannel] == ABF_WAVEFORMDISABLED)) return ErrorReturn(pnError, ABF_ENOWAVEFORM); if (NewFH.nWaveformSource[uDACChannel] == ABF_EPOCHTABLEWAVEFORM) { if (!ABFH_GetWaveformEx( &NewFH, uDACChannel, dwEpisode, pfBuffer, NULL)) return ErrorReturn(pnError, ABF_EBADWAVEFORM); return TRUE; } ASSERT(NewFH.nWaveformSource[uDACChannel] == ABF_DACFILEWAVEFORM); #if USE_DACFILE_FIX // PRC DEBUG CArrayPtr pnWorkBuffer(NewFH.lNumSamplesPerEpisode); #else CArrayPtr pnWorkBuffer(NewFH.lNumSamplesPerEpisode / NewFH.nADCNumChannels); #endif if (!pnWorkBuffer) return ErrorReturn(pnError, ABF_OUTOFMEMORY); if (!ABF_ReadDACFileEpiEx(nFile, &NewFH, pnWorkBuffer, uDACChannel, dwEpisode, pnError)) return FALSE; ScaleDACBuffer(&NewFH, uDACChannel, 0, pnWorkBuffer, pfBuffer); return TRUE; } //=============================================================================================== // FUNCTION: ABF_WriteTag // PURPOSE: This function buffers tags to a temporary file through the CABFItem object in the // file descriptor. // BOOL WINAPI ABF_WriteTag(int nFile, ABFFileHeader *pFH, const ABFTag *pTag, int *pnError) { ABFH_WASSERT(pFH); WPTRASSERT(pTag); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Return an error if writing is inappropriate. if (pFI->TestFlag( FI_PARAMFILE | FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); if (!pFI->PutTag(pTag)) return ErrorReturn(pnError, pFI->GetLastError()); pFH->lNumTagEntries = pFI->GetTagCount(); return TRUE; } //=============================================================================================== // FUNCTION: ABF_UpdateTag // PURPOSE: This function updates a tag entry in a writeable file. // BOOL WINAPI ABF_UpdateTag(int nFile, UINT uTag, const ABFTag *pTag, int *pnError) { WPTRASSERT(pTag); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Return an error if writing is inappropriate. if (pFI->TestFlag( FI_PARAMFILE | FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); if (!pFI->UpdateTag(uTag, pTag)) return ErrorReturn(pnError, pFI->GetLastError()); return TRUE; } //=============================================================================================== // FUNCTION: ABF_ReadTags // PURPOSE: This function reads a tag array from the TagArray section // BOOL WINAPI ABF_ReadTags(int nFile, const ABFFileHeader *pFH, DWORD dwFirstTag, ABFTag *pTagArray, UINT uNumTags, int *pnError) { ABFH_ASSERT(pFH); ARRAYASSERT(pTagArray, uNumTags); UINT i; CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // If this file is being written, the tags will be in the virtual tag buffer. if (pFI->GetTagCount() > 0) { if (!pFI->ReadTags(dwFirstTag, pTagArray, uNumTags)) return ErrorReturn(pnError, ABF_EREADTAG); return TRUE; } // If there are no tags present, return an error. if ((pFH->lTagSectionPtr==0) || (pFH->lNumTagEntries==0)) return ErrorReturn(pnError, ABF_ENOTAGS); if (dwFirstTag+uNumTags > UINT(pFH->lNumTagEntries)) return ErrorReturn(pnError, ABF_EREADTAG); // Read and convert old FETCHEX tags. if (pFH->nFileType != ABF_ABFFILE) { // Seek to the start of the requested segment (first entry is the count of tags, this is // placed in pFH->lNumTagEntries when the header is read). UINT uSeekPos = UINT(pFH->lTagSectionPtr) * ABF_BLOCKSIZE + dwFirstTag * sizeof(ABFLONG) + sizeof(ABFLONG); VERIFY(pFI->Seek(uSeekPos, FILE_BEGIN)); // Allocate a temporary buffer to read the old tags into. CArrayPtr plTags(uNumTags); if (!plTags) return ErrorReturn(pnError, ABF_OUTOFMEMORY); // Do the read. if (!pFI->Read(plTags, uNumTags * sizeof(ABFLONG))) { TRACE( "Tags could not be read from the file.\n" ); // Do not flag the error - this allows the tags to be quietly ignored. // return ErrorReturn(pnError, ABF_EREADTAG); } // Convert the tags to ABFtags. for (i=0; i= 0 ) { pTagArray[i].lTagTime = plTags[i]; memset(pTagArray[i].sComment, ' ', ABF_TAGCOMMENTLEN); pTagArray[i].nTagType = ABF_TIMETAG; pTagArray[i].nVoiceTagNumber = 0; } } } else { // Seek to the start of the requested segment. LONGLONG llSeekPos = LONGLONG(pFH->lTagSectionPtr) * ABF_BLOCKSIZE + dwFirstTag * sizeof(ABFTag); VERIFY(pFI->Seek(llSeekPos, FILE_BEGIN)); // Read the Tag Array directly into the passed buffer UINT uBytesToRead = uNumTags * sizeof(ABFTag); if (!pFI->Read(pTagArray, uBytesToRead)) return ErrorReturn(pnError, ABF_EREADTAG); } // AxoTape V2.0 filled the comment field with '\0's - convert to spaces. if (pFH->fFileVersionNumber < 1.3F) { // Set the comment string to all spaces. for (i=0; isComment; UINT i=0; for (i=0; isComment, ABF_TAGCOMMENTLEN-i); szRval[ABF_TAGCOMMENTLEN-i] = '\0'; } else LoadString(g_hInstance, IDS_NONE, szRval, sizeof(szRval)); return szRval; } //=============================================================================================== // FUNCTION: ABF_FormatTag // PURPOSE: This function reads a tag TagArray section and formats it as ASCII text. // NOTE: If tag number -1 is requested, the ASCII text returns column headings. // BOOL WINAPI ABF_FormatTag(int nFile, const ABFFileHeader *pFH, ABFLONG lTagNumber, char *pszBuffer, UINT uSize, int *pnError) { ABFH_ASSERT(pFH); ARRAYASSERT(pszBuffer, uSize); BOOL bEpisodic = ((pFH->nOperationMode==ABF_WAVEFORMFILE) || (pFH->nOperationMode==ABF_HIGHSPEEDOSC)); if (lTagNumber < 0) { int nStringID = bEpisodic ? IDS_EPITAGHEADINGS : IDS_CONTTAGHEADINGS; return (BOOL)LoadString(g_hInstance, nStringID, pszBuffer, uSize); } ABFTag Tag; char szBuf[ABF_MAXTAGFORMATLEN+4]; if (!ABF_ReadTags(nFile, pFH, UINT(lTagNumber), &Tag, 1, pnError)) return FALSE; double dTimeInMS = 0.0; ABFH_SynchCountToMS(pFH, Tag.lTagTime, &dTimeInMS); char szTagTime[32]; ABFU_FormatDouble(dTimeInMS/1E3, 10, szTagTime, sizeof(szTagTime)); char *ps = GetTagComment(&Tag); if (bEpisodic) { DWORD dwEpisode = 1; DWORD dwSynchCount = Tag.lTagTime; ABF_EpisodeFromSynchCount(nFile, pFH, &dwSynchCount, &dwEpisode, NULL); // "Tag # Time (s) Episode Comment" sprintf(szBuf, "%4ld %11.11s %4ld %-56.56s", lTagNumber+1, szTagTime, dwEpisode, ps); // NOTE: the above must NOT expand out to more than ABF_MAXTAGFORMATLEN } else // "Tag # Time (s) Comment" sprintf(szBuf, "%4ld %11.11s %-56.56s", lTagNumber+1, szTagTime, ps); strncpy(pszBuffer, szBuf, uSize-1); pszBuffer[uSize-1] = '\0'; return TRUE; } //=============================================================================================== // FUNCTION: ABF_WriteDelta // PURPOSE: This function buffers tags to a temporary file through the CABFItem object in the // file descriptor. // BOOL WINAPI ABF_WriteDelta(int nFile, ABFFileHeader *pFH, const ABFDelta *pDelta, int *pnError) { ABFH_WASSERT(pFH); WPTRASSERT(pDelta); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Return an error if writing is inappropriate. if (pFI->TestFlag( FI_PARAMFILE | FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); if (!pFI->PutDelta(pDelta)) return ErrorReturn(pnError, pFI->GetLastError()); pFH->lNumDeltas = pFI->GetDeltaCount(); return TRUE; } //=============================================================================================== // FUNCTION: ABF_ReadDeltas // PURPOSE: This function reads a Delta array from the DeltaArray section // BOOL WINAPI ABF_ReadDeltas(int nFile, const ABFFileHeader *pFH, DWORD dwFirstDelta, ABFDelta *pDeltaArray, UINT uNumDeltas, int *pnError) { ABFH_ASSERT(pFH); ARRAYASSERT(pDeltaArray, uNumDeltas); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // If this file is being written, the Deltas will be in the virtual Delta buffer. if (pFI->GetDeltaCount() > 0) { if (!pFI->ReadDeltas(dwFirstDelta, pDeltaArray, uNumDeltas)) return ErrorReturn(pnError, ABF_EREADDELTA); return TRUE; } // If there are no Deltas present, return an error. if ((pFH->lDeltaArrayPtr==0) || (pFH->lNumDeltas==0)) return ErrorReturn(pnError, ABF_ENODELTAS); if (dwFirstDelta+uNumDeltas > UINT(pFH->lNumDeltas)) return ErrorReturn(pnError, ABF_EREADDELTA); // Seek to the start of the requested segment. LONGLONG llSeekPos = LONGLONG(pFH->lDeltaArrayPtr) * ABF_BLOCKSIZE + dwFirstDelta * sizeof(ABFDelta); VERIFY(pFI->Seek(llSeekPos, FILE_BEGIN)); // Read the Delta Array directly into the passed buffer UINT uBytesToRead = uNumDeltas * sizeof(ABFDelta); if (!pFI->Read(pDeltaArray, uBytesToRead)) return ErrorReturn(pnError, ABF_EREADTAG); return TRUE; } //=============================================================================================== // FUNCTION: FormatAsBinary // PURPOSE: Formats a . // static int FormatAsBinary(UINT uValue, LPSTR pszBuffer, UINT uBufferLength) { UINT uNumBits = 8; if (uNumBits >= uBufferLength) uNumBits = uBufferLength - 1; for (UINT i=0; ilParameterID) { case ABF_DELTA_HOLDING0: case ABF_DELTA_HOLDING1: case ABF_DELTA_HOLDING2: case ABF_DELTA_HOLDING3: { UINT uDAC = pDelta->lParameterID - ABF_DELTA_HOLDING0; char szSignal[ABF_DACNAMELEN+1] = { '#', char(uDAC+'0'), '\0' }; char szUnits[ABF_DACUNITLEN+2] = { ' ', '\0' }; ABF_GET_STRING(szSignal, pFH->sDACChannelName[uDAC], sizeof(szSignal)); ABF_GET_STRING(szUnits+1, pFH->sDACChannelUnits[uDAC], sizeof(szUnits)-1); _snprintf(szText, sizeof(szText), "Holding on '%s' => %g", szSignal, pDelta->fNewParamValue); if (szUnits[1] != '\0') strcat(szText, szUnits); break; } case ABF_DELTA_DIGITALOUTS: { char szBuffer[9]; FormatAsBinary(UINT(pDelta->lNewParamValue), szBuffer, sizeof(szBuffer)); _snprintf(szText, sizeof(szText), "Digital Outputs => %s", szBuffer); break; } case ABF_DELTA_THRESHOLD: _snprintf(szText, sizeof(szText), "Threshold => %g", pDelta->fNewParamValue); break; case ABF_DELTA_PRETRIGGER: _snprintf(szText, sizeof(szText), "Pre-trigger => %d", (int)( pDelta->lNewParamValue / pFH->nADCNumChannels ) ); break; default: if ((pDelta->lParameterID >= ABF_DELTA_AUTOSAMPLE_GAIN) && (pDelta->lParameterID < ABF_DELTA_AUTOSAMPLE_GAIN+ABF_ADCCOUNT)) { _snprintf(szText, sizeof(szText), "Autosample gain => %g", pDelta->fNewParamValue); break; } ERRORMSG1("ABFDelta: Unexpected parameter ID '%d'.", pDelta->lParameterID); return ErrorReturn(pnError, ABF_EBADDELTAID); } strncpy(pszText, szText, uTextLen-1); pszText[uTextLen-1] = '\0'; return TRUE; } //=============================================================================================== // FUNCTION: ABF_EpisodeFromSynchCount // PURPOSE: This routine returns the episode number for the synch count that is // passed as an argument. // INPUT: // nFile the file index into the g_FileData structure array // pdwSynchCount the synch count to search for. // // OUTPUT: // pdwEpisode the episode number which contains the requested sample // pdwSynchCount the synch count of the start of the episode // BOOL WINAPI ABF_EpisodeFromSynchCount(int nFile, const ABFFileHeader *pFH, DWORD *pdwSynchCount, DWORD *pdwEpisode, int *pnError) { ABFH_ASSERT(pFH); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; UINT uAcquiredEpisodes = pFI->GetAcquiredEpisodes(); // For data that is continuous in time or for a Waveform data file, just // calculate the episode number by dividing the synch count by the episode // size in samples. if (pFI->GetSynchCount() == 0) // (old ABF_WAVEFORMFILE or ABF_GAPFREEFILE) { UINT uEpiSize = UINT(pFH->lNumSamplesPerEpisode); UINT uEpisode = *pdwSynchCount / uEpiSize + 1; if (uEpisode > uAcquiredEpisodes) uEpisode = uAcquiredEpisodes; *pdwSynchCount = uEpiSize * (uEpisode - 1); *pdwEpisode = uEpisode; return TRUE; } // Search the data file for the target sample number, taking into account // the missing samples between episodes. UINT uEpiStart = pFI->EpisodeStart(1); if (uEpiStart > *pdwSynchCount) { *pdwEpisode = 1; *pdwSynchCount = uEpiStart; return TRUE; } // Do a linear search on the synch array to find the episode that corresponds // to this sample number. This may be changed to a binary search in the future if // it seems to be too slow on really big data files. UINT uCounter = uEpiStart; for (UINT i=2; i <= uAcquiredEpisodes; i++) { uEpiStart = pFI->EpisodeStart(i); if (uEpiStart > *pdwSynchCount) { *pdwEpisode = i - 1; *pdwSynchCount = uCounter; return TRUE; } uCounter = uEpiStart; } // Return the results. *pdwEpisode = uAcquiredEpisodes; *pdwSynchCount = uCounter; return TRUE; } //=============================================================================================== // FUNCTION: ABF_SynchCountFromEpisode // PURPOSE: This routine returns the synch count for the start of the given // episode number that is passed as an argument. // INPUT: // nFile the file index into the g_FileData structure array // pdwEpisode the episode number which is being searched for // // OUTPUT: // pdwSynchCount the synch count of the start of the episode // BOOL WINAPI ABF_SynchCountFromEpisode(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, DWORD *pdwSynchCount, int *pnError) { ABFH_ASSERT(pFH); WPTRASSERT(pdwSynchCount); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->CheckEpisodeNumber(dwEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); // For data that is continuous in time or is a Waveform data file then just // calculate the synch count by multiplying the episode number by the // episode size in samples. if (pFI->GetSynchCount() != 0) *pdwSynchCount = pFI->EpisodeStart(dwEpisode); else if (pFH->nOperationMode != ABF_WAVEFORMFILE) *pdwSynchCount = UINT(pFH->lNumSamplesPerEpisode) * (dwEpisode - 1); else { // (old ABF_WAVEFORMFILE) double dStartToStartUS = 0.0; ABFH_GetEpisodeStartToStart(pFH, &dStartToStartUS); *pdwSynchCount= ABFH_MSToSynchCount(pFH, dStartToStartUS/1E3 * (dwEpisode-1)); } return TRUE; } //=============================================================================================== // FUNCTION: ABF_GetEpisodeFileOffset // PURPOSE: This routine returns the sample point offset in the ABF file for the start of the given // episode number that is passed as an argument. // INPUT: // nFile the file index into the g_FileData structure array // pdwEpisode the episode number which is being searched for // // OUTPUT: // plFileOffset the Sample point number of the first point in the episode (per channel). // BOOL WINAPI ABF_GetEpisodeFileOffset(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, DWORD *pdwFileOffset, int *pnError) { ABFH_ASSERT(pFH); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->CheckEpisodeNumber(dwEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); // For data that is continuous in time or is a Waveform data file then just // calculate the sample number by multiplying the episode number by the // episode size in samples. if (pFI->GetSynchCount() == 0) // (ABF_WAVEFORMFILE or ABF_GAPFREEFILE) { UINT uEpiSize = (UINT)(pFH->lNumSamplesPerEpisode / pFH->nADCNumChannels); *pdwFileOffset = uEpiSize * (dwEpisode - 1); } else *pdwFileOffset = pFI->FileOffset(dwEpisode) / pFH->nADCNumChannels / SampleSize(pFH); return TRUE; } //=============================================================================================== // FUNCTION: ABF_GetMissingSynchCount // PURPOSE: This routine returns the number of samples missing for event detected data for // the episode number passed as an argument. // INPUT: // nFile the file index into the g_FileData structure array // dwEpisode the episode number of interest // // OUTPUT: // pdwMissingSynchCount the number of synch counts absent prior to this episode // BOOL WINAPI ABF_GetMissingSynchCount(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, DWORD *pdwMissingSynchCount, int *pnError) { ABFH_ASSERT(pFH); DWORD dwSynchCount = 0; if (!ABF_SynchCountFromEpisode(nFile, pFH, dwEpisode, &dwSynchCount, pnError)) return FALSE; UINT uMissing = 0; if (dwEpisode == 1) uMissing = dwSynchCount; else { ASSERT(dwEpisode > 1); DWORD dwLastSynchCount = 0; if (!ABF_SynchCountFromEpisode(nFile, pFH, dwEpisode-1, &dwLastSynchCount, pnError)) return FALSE; // Get the duration in ms. double dDurationMS = 0.0; if (!ABF_GetEpisodeDuration(nFile, pFH, dwEpisode-1, &dDurationMS, pnError)) return FALSE; // Convert the duration to synch count. dwLastSynchCount += ABFH_MSToSynchCount(pFH, dDurationMS); // Calculate the number of missing synch counts. if (dwLastSynchCount > dwSynchCount) uMissing = 0; else uMissing = dwSynchCount - dwLastSynchCount; } *pdwMissingSynchCount = uMissing; return TRUE; } //=============================================================================================== // FUNCTION: ABF_HasOverlappedData // PURPOSE: Returns true if the file contains overlapped data. // BOOL WINAPI ABF_HasOverlappedData(int nFile, BOOL *pbHasOverlapped, int *pnError) { WPTRASSERT(pbHasOverlapped); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Return an error if writing is inappropriate. if (!pFI->TestFlag(FI_READONLY)) return ErrorReturn(pnError, ABF_EWRITEONLYFILE); *pbHasOverlapped = pFI->GetOverlappedFlag(); return TRUE; } #endif //=============================================================================================== // FUNCTION: ABF_GetNumSamples // PURPOSE: This routine returns the number of samples per channel in a given episode. // INPUT: // nFile the file index into the g_FileData structure array // dwEpisode the episode number of interest // // OUTPUT: // NumSamples% the number of data points in this episode // BOOL WINAPI ABF_GetNumSamples(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, UINT *puNumSamples, int *pnError) { // ABFH_ASSERT(pFH); UINT uRealSize; CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->CheckEpisodeNumber(dwEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); if (pFI->GetSynchCount() == 0) /// (ABF_WAVEFORMFILE or ABF_GAPFREEFILE) { if ((pFH->nOperationMode == ABF_GAPFREEFILE) && (dwEpisode == pFI->GetAcquiredEpisodes())) uRealSize = pFI->GetLastEpiSize(); else uRealSize = UINT(pFH->lNumSamplesPerEpisode); } else uRealSize = (UINT)pFI->EpisodeLength(dwEpisode); *puNumSamples = uRealSize / pFH->nADCNumChannels; return TRUE; } //=============================================================================================== // FUNCTION: ABF_GetNumSamples // PURPOSE: This routine returns the number of samples per channel in a given episode. // INPUT: // nFile the file index into the g_FileData structure array // dwEpisode the episode number of interest // // OUTPUT: // NumSamples% the number of data points in this episode // BOOL WINAPI ABF2_GetNumSamples(int nFile, const ABF2FileHeader *pFH, DWORD dwEpisode, UINT *puNumSamples, int *pnError) { // ABFH_ASSERT(pFH); UINT uRealSize; CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->CheckEpisodeNumber(dwEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); if (pFI->GetSynchCount() == 0) /// (ABF_WAVEFORMFILE or ABF_GAPFREEFILE) { if ((pFH->nOperationMode == ABF_GAPFREEFILE) && (dwEpisode == pFI->GetAcquiredEpisodes())) uRealSize = pFI->GetLastEpiSize(); else uRealSize = UINT(pFH->lNumSamplesPerEpisode); } else uRealSize = (UINT)pFI->EpisodeLength(dwEpisode); *puNumSamples = uRealSize / pFH->nADCNumChannels; return TRUE; } #if 0 //=============================================================================================== // FUNCTION: ABF_GetEpisodeDuration // PURPOSE: Get the duration of a given episode in ms. // BOOL WINAPI ABF_GetEpisodeDuration(int nFile, const ABFFileHeader *pFH, DWORD dwEpisode, double *pdDuration, int *pnError) { ABFH_ASSERT(pFH); ASSERT(dwEpisode >0); WPTRASSERT(pdDuration); *pdDuration = 0.0; double dDurationUS = 0.0; if (pFH->nOperationMode == ABF_WAVEFORMFILE) ABFH_GetEpisodeDuration(pFH, &dDurationUS); else { UINT uNumSamples; if (!ABF_GetNumSamples(nFile, pFH, dwEpisode, &uNumSamples, pnError)) return FALSE; // Calculate the duration in us. dDurationUS = ABFH_GetFirstSampleInterval(pFH) * uNumSamples * pFH->nADCNumChannels; } *pdDuration = dDurationUS / 1E3; // Convert from us to ms. ASSERT(*pdDuration != 0.0); return TRUE; } //=============================================================================================== // FUNCTION: ABF_GetTrialDuration // PURPOSE: Calculate the trial duration in ms. // This is the duration between the start of the file and the last sample in the file. // BOOL WINAPI ABF_GetTrialDuration(int nFile, const ABFFileHeader *pFH, double *pdDuration, int *pnError) { ABFH_ASSERT(pFH); WPTRASSERT(pdDuration); *pdDuration = 0.0; // Get the start time of the last sweep. double dLastSweepStart = 0; if( !ABF_GetStartTime( nFile, pFH, pFH->nADCSamplingSeq[0], pFH->lActualEpisodes, &dLastSweepStart, pnError ) ) return FALSE; // Now the duration of the last sweep. double dLastSweepDuration = 0; if( !ABF_GetEpisodeDuration( nFile, pFH, pFH->lActualEpisodes, &dLastSweepDuration, pnError ) ) return FALSE; double dTotalDuration = dLastSweepStart + dLastSweepDuration; ASSERT( dTotalDuration > 0 ); *pdDuration = dTotalDuration; return TRUE; } //=============================================================================================== // FUNCTION: ABF_GetStartTime // PURPOSE: Get the start time for the first sample of the given episode in ms. // BOOL WINAPI ABF_GetStartTime(int nFile, const ABFFileHeader *pFH, int nChannel, DWORD dwEpisode, double *pdStartTime, int *pnError) { ABFH_ASSERT(pFH); WPTRASSERT(pdStartTime); ASSERT(dwEpisode > 0); DWORD dwSynchCount = 0; if (!ABF_SynchCountFromEpisode(nFile, pFH, dwEpisode, &dwSynchCount, pnError)) return FALSE; // test for the average sweep if ( dwSynchCount == ABF_AVERAGESWEEPSTART ) { *pdStartTime = 0.0; return TRUE; } ABFH_SynchCountToMS(pFH, dwSynchCount, pdStartTime); // Get the offset into the multiplexed data array for the first point UINT uChannelOffset; if (!ABFH_GetChannelOffset(pFH, nChannel, &uChannelOffset)) return ErrorReturn(pnError, ABF_EINVALIDCHANNEL); *pdStartTime += uChannelOffset * ABFH_GetFirstSampleInterval(pFH) / 1E3; return TRUE; } //############################################################################################### //### //### Functions to read and write scope configuration data. //### //############################################################################################### //=============================================================================================== // FUNCTION: _UpdateOldDisplayEntries // PURPOSE: Updates the old display entries in the ABF header for backward compatability. // static void _UpdateOldDisplayEntries(ABFFileHeader *pFH, const ABFScopeConfig *pCfg) { if ((pFH->nOperationMode == ABF_WAVEFORMFILE) || (pFH->nOperationMode == ABF_HIGHSPEEDOSC)) { pFH->lStartDisplayNum = ABFLONG(pCfg->fDisplayStart); pFH->lFinishDisplayNum= ABFLONG(pCfg->fDisplayEnd); } else pFH->lSamplesPerTrace = ABFLONG(pCfg->fDisplayEnd); for (int i=0; inADCNumChannels); i++) { float fGain = 1.0F; float fOffset = 0.0F; int nChannel = pFH->nADCSamplingSeq[i]; const ABFSignal *pT = pCfg->TraceList; for (int j=0; jnTraceCount; j++, pT++) if ((pT->nMxOffset==i) && !pT->bFloatData) { fGain = pT->fDisplayGain; fOffset = pT->fDisplayOffset; break; } pFH->fADCDisplayAmplification[nChannel] = fGain; pFH->fADCDisplayOffset[nChannel] = fOffset; } } #include //=============================================================================================== // FUNCTION: ABF_WriteScopeConfig // PURPOSE: Saves the current scope configuration info to the data file. // BOOL WINAPI ABF_WriteScopeConfig(int nFile, ABFFileHeader *pFH, int nScopes, const ABFScopeConfig *pCfg, int *pnError) { ABFH_WASSERT(pFH); if (nScopes == 0) { pFH->lNumScopes = 0; pFH->lScopeConfigPtr = 0; return TRUE; } BOOL bHasData = ABF_HasData(nFile, pFH); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Return an error if writing is inappropriate. if (pFI->TestFlag(FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); if (!pFI->FillToNextBlock(&pFH->lScopeConfigPtr)) return ErrorReturn(pnError, ABF_EDISKFULL); // The ABFScopeConfig has been extended for ABF file v1.68. // The original scope configurations defined as 'Section1' are written out to file first, // to keep backwards comapatability. // The new configuration data, known as 'Section2' will be appended to the scope configuration data. UINT uSizeofVersion1 = offsetof(ABFScopeConfig,nSizeofOldStructure); UINT uSizeofVersion2 = sizeof(ABFScopeConfig) - uSizeofVersion1; UINT uSizeofWhole = uSizeofVersion2 + uSizeofVersion1; ASSERT( uSizeofWhole == sizeof(ABFScopeConfig) ); // Prevent compiler warnings. uSizeofWhole = uSizeofWhole; // Write out section1 ABF scope configuration for backwards compatability. for( int i = 0; i < nScopes; i ++ ) { if (!pFI->Write( &pCfg[i], uSizeofVersion1 )) { pFH->lScopeConfigPtr = 0; return ErrorReturn(pnError, ABF_EDISKFULL); } } // Write the new section2 ABFScopeConfig data. for(int i = 0; i < nScopes; i ++ ) { if (!pFI->Write( (char*)&pCfg[i] + uSizeofVersion1, uSizeofVersion2 )) { pFH->lScopeConfigPtr = 0; return ErrorReturn(pnError, ABF_EDISKFULL); } } // Update the number of scopes in the header. pFH->lNumScopes = nScopes; if (!bHasData && !pFI->FillToNextBlock(&pFH->lDataSectionPtr)) return ErrorReturn(pnError, ABF_EDISKFULL); _UpdateOldDisplayEntries(pFH, pCfg); LONGLONG llHere = 0; VERIFY(pFI->Seek(0, FILE_CURRENT, &llHere)); // Update the header on disk. VERIFY(pFI->Seek( 0, FILE_BEGIN)); UINT uBytesToWrite = sizeof(ABFFileHeader); if (!pFI->Write( pFH, uBytesToWrite )) { pFH->lScopeConfigPtr = 0; return ErrorReturn(pnError, ABF_EDISKFULL); } VERIFY(pFI->Seek(llHere, FILE_BEGIN)); return TRUE; } //=============================================================================================== // FUNCTION: ABF_ReadScopeConfig // PURPOSE: Retrieves the scope configuration info from the data file. // BOOL WINAPI ABF_ReadScopeConfig(int nFile, ABFFileHeader *pFH, ABFScopeConfig *pCfg, UINT uMaxScopes, int *pnError) { ABFH_WASSERT(pFH); ARRAYASSERT(pCfg, (UINT)(pFH->lNumScopes)); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if ((pFH->lNumScopes < 1) || (pFH->lScopeConfigPtr == 0)) { pFH->lNumScopes = 1; ABFH_InitializeScopeConfig(pFH, pCfg); return TRUE; } UINT uOffset = pFH->lScopeConfigPtr * ABF_BLOCKSIZE; VERIFY(pFI->Seek( uOffset, FILE_BEGIN)); UINT uScopes = (uMaxScopes < UINT(pFH->lNumScopes)) ? uMaxScopes : UINT(pFH->lNumScopes); // The ABFScopeConfig has been extended for ABF file v1.68. // The original scope configurations defined as 'Section1' are read in first, // to keep backwards compatability. // The new configuration data, known as 'Section2' is appended after the scope configuration data // and is read last, and only for the new files that support it. UINT uSizeofSection1 = offsetof(ABFScopeConfig,nSizeofOldStructure); UINT uSizeofSection2 = sizeof(ABFScopeConfig) - uSizeofSection1; UINT uSizeofWhole = uSizeofSection2 + uSizeofSection1; ASSERT( uSizeofWhole == sizeof(ABFScopeConfig) ); // Prevent compiler warnings. uSizeofWhole = uSizeofWhole; // Read old section of the scope config structure for( int i = 0; i < pFH->lNumScopes; i ++ ) { if (!pFI->Read( &pCfg[i], uSizeofSection1)) return ErrorReturn(pnError, ABF_EREADSCOPECONFIG); } // Read the new section ABFScopeConfig structures into the buffer if( pFH->fHeaderVersionNumber >= 1.68F ) { for(int i = 0; i < pFH->lNumScopes; i++ ) { if (!pFI->Read( (char*)&pCfg[i] + uSizeofSection1, uSizeofSection2)) return ErrorReturn(pnError, ABF_EREADSCOPECONFIG); } } pFH->lNumScopes = uScopes; if (pFH->fFileVersionNumber < 1.5) { for (UINT i=0; iTestFlag(FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); if (!pFI->FillToNextBlock(&pFH->lStatisticsConfigPtr)) return ErrorReturn(pnError, ABF_EDISKFULL); if (!pFI->Write( pCfg, sizeof(ABFScopeConfig))) { pFH->lStatisticsConfigPtr = 0; return ErrorReturn(pnError, ABF_EDISKFULL); } if (!bHasData && !pFI->FillToNextBlock(&pFH->lDataSectionPtr)) return ErrorReturn(pnError, ABF_EDISKFULL); LONGLONG llHere = 0; VERIFY(pFI->Seek(0, FILE_CURRENT, &llHere)); // Update the header on disk. VERIFY(pFI->Seek( 0, FILE_BEGIN)); if (!pFI->Write( pFH, sizeof(ABFFileHeader) )) { pFH->lStatisticsConfigPtr = 0; return ErrorReturn(pnError, ABF_EDISKFULL); } VERIFY(pFI->Seek(llHere, FILE_BEGIN)); return TRUE; } //=============================================================================================== // FUNCTION: ABF_ReadStatisticsConfig // PURPOSE: Read the scope config structure for the statistics window in form the ABF file. // BOOL WINAPI ABF_ReadStatisticsConfig( int nFile, const ABFFileHeader *pFH, ABFScopeConfig *pCfg, int *pnError) { ABFH_ASSERT(pFH); WPTRASSERT(pCfg); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (pFH->lStatisticsConfigPtr == 0) return ErrorReturn(pnError, ABF_ENOSTATISTICSCONFIG); UINT uOffset = pFH->lStatisticsConfigPtr * ABF_BLOCKSIZE; VERIFY(pFI->Seek( uOffset, FILE_BEGIN)); // The ABFScopeConfig structure has been extended for ABF file version 1.68. // If the file is a new file, reading is unaffected as only one structure is saved for the statistics config. // If the file is an older file, only the size of section1 of the scope config is read to avoid reading junk data. if( pFH->fFileVersionNumber >= 1.68F ) { if (!pFI->Read(pCfg, sizeof(ABFScopeConfig))) return ErrorReturn(pnError, ABF_EREADSTATISTICSCONFIG); } else { UINT uSizeofSection1 = offsetof(ABFScopeConfig,nSizeofOldStructure); // Read only size of version 1. if ( !pFI->Read(pCfg, uSizeofSection1 )) return ErrorReturn(pnError, ABF_EREADSTATISTICSCONFIG); } return TRUE; } //############################################################################################### //### //### Functions to read and write voice tags. //### //############################################################################################### //=============================================================================================== // FUNCTION: ABF_SaveVoiceTag // PURPOSE: Saves a reference to a temporary file containing a voice tag. // BOOL WINAPI ABF_SaveVoiceTag( int nFile, LPCSTR pszFileName, ABFLONG lDataOffset, ABFVoiceTagInfo *pVTI, int *pnError) { LPSZASSERT(pszFileName); WPTRASSERT(pVTI); // Get the file descriptor for this ABF file. CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (!pFI->SaveVoiceTag( pszFileName, lDataOffset, pVTI )) return ErrorReturn( pnError, pFI->GetLastError() ); return TRUE; } //=============================================================================================== // FUNCTION: ABF_GetVoiceTag // PURPOSE: Retrieves a voice tag into a new file, leaving space for a header. // BOOL WINAPI ABF_GetVoiceTag( int nFile, const ABFFileHeader *pFH, UINT uTag, LPCSTR pszFileName, ABFLONG lDataOffset, ABFVoiceTagInfo *pVTI, int *pnError) { LPSZASSERT(pszFileName); WPTRASSERT(pVTI); // Get the file descriptor for this ABF file. CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; if (ABFLONG(uTag) >= pFH->lVoiceTagEntries) return ErrorReturn( pnError, ABF_EREADTAG ); if (!pFI->GetVoiceTag( uTag, pszFileName, lDataOffset, pVTI, pFH->lVoiceTagPtr )) return ErrorReturn( pnError, pFI->GetLastError() ); return TRUE; } #endif //=============================================================================================== // FUNCTION: ABF_BuildErrorText // PURPOSE: This routine returns the last error as a text string. // BOOL WINAPI ABF_BuildErrorText(int nErrorNum, const char *szFileName, char *sTxtBuf, UINT uMaxLen) { // LPSZASSERT(szFileName); // ARRAYASSERT(sTxtBuf, uMaxLen); if (uMaxLen < 2) { // ERRORMSG("String too short!"); return FALSE; } if (nErrorNum > ABFH_FIRSTERRORNUMBER) return ABFH_GetErrorText( nErrorNum, sTxtBuf, uMaxLen); BOOL rval = TRUE; // OK return value char szTemplate[128]; #if defined(_WINDOWS) && !defined(__MINGW32__) if (!LoadStringA(g_hInstance, nErrorNum, szTemplate, sizeof(szTemplate))) #else if (!c_LoadString(g_hInstance, nErrorNum, szTemplate, sizeof(szTemplate))) #endif { char szErrorMsg[128]; #if defined(_WINDOWS) && !defined(__MINGW32__) LoadStringA(g_hInstance, IDS_ENOMESSAGESTR, szTemplate, sizeof(szTemplate)); #else c_LoadString(g_hInstance, IDS_ENOMESSAGESTR, szTemplate, sizeof(szTemplate)); #endif sprintf(szErrorMsg, szTemplate, nErrorNum); // ERRORMSG(szErrorMsg); strncpy(sTxtBuf, szErrorMsg, uMaxLen-1); sTxtBuf[uMaxLen-1] = '\0'; rval = FALSE; } else #if defined(_WINDOWS) && !defined(__MINGW32__) _snprintf(sTxtBuf, uMaxLen, szTemplate, szFileName); #else snprintf(sTxtBuf, uMaxLen, szTemplate, szFileName); #endif return rval; } #if 0 //=============================================================================================== // FUNCTION: ABF_SetErrorCallback // PURPOSE: This routine sets a callback function to be called in the event of an error occuring. // BOOL WINAPI ABF_SetErrorCallback(int nFile, ABFCallback fnCallback, void *pvThisPointer, int *pnError) { CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; return pFI->SetErrorCallback(fnCallback, pvThisPointer); } // *********************************************************************************************** // *********************************************************************************************** // *** // *** ABF_GetSynchArray exposes an internal synch object to enable direct access to the // *** synch array by real-time data acquisition components. // *** // *********************************************************************************************** // *********************************************************************************************** //=============================================================================================== // FUNCTION: ABF_GetFileHandle // PURPOSE: Returns the DOS file handle for the ABF file. // BOOL WINAPI ABF_GetFileHandle(int nFile, HANDLE *phHandle, int *pnError) { CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; *phHandle = pFI->GetFileHandle(); return TRUE; } //=============================================================================================== // FUNCTION: ABF_GetSynchArray // PURPOSE: Returns a pointer to the CSynch object used to buffer the Synch array to disk. // Use with care!! // void *WINAPI ABF_GetSynchArray(int nFile, int *pnError) { CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return NULL; return pFI->GetSynchObject(); } // *********************************************************************************************** // *********************************************************************************************** // *** // *** Functions used to implement "modifiable ABF". // *** // *********************************************************************************************** // *********************************************************************************************** //=============================================================================================== // FUNCTION: ABF_UpdateEpisodeSamples // PURPOSE: This function updates a selection of samples in a particular episode. // NOTES: Only floating point data may be modified with this function -- integer data is sacrosanct. // Math channels may not be written to. // uStartSample is zero-based // uNumSamples os on-based. // BOOL WINAPI ABF_UpdateEpisodeSamples(int nFile, const ABFFileHeader *pFH, int nChannel, UINT uEpisode, UINT uStartSample, UINT uNumSamples, float *pfBuffer, int *pnError) { ABFH_ASSERT(pFH); ASSERT( uNumSamples > 0 ); ARRAYASSERT(pfBuffer, uNumSamples); UINT uPerChannel = (UINT)(pFH->lNumSamplesPerEpisode/pFH->nADCNumChannels); ASSERT(uStartSample+uNumSamples <= uPerChannel); // Prevent compiler warnings. uPerChannel = uPerChannel; // Writing is not allowed for two-byte integer files. ASSERT(pFH->nDataFormat != ABF_INTEGERDATA); if (pFH->nDataFormat == ABF_INTEGERDATA) return ErrorReturn(pnError, ABF_EWRITERAWDATAFILE); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Check that the episode number is in range. if (!pFI->CheckEpisodeNumber(uEpisode)) return ErrorReturn(pnError, ABF_EEPISODERANGE); // Cannot write to a math channel. if (nChannel < 0) return ErrorReturn(pnError, ABF_EWRITEMATHCHANNEL); // Get the offset into the multiplexed data array for the first point UINT uChannelOffset; if (!ABFH_GetChannelOffset(pFH, nChannel, &uChannelOffset)) return ErrorReturn(pnError, ABF_EINVALIDCHANNEL); // Set the sample size in the data. UINT uSampleSize = SampleSize(pFH); // Only create the read buffer on demand, it is freed when the file is closed. if (!pFI->GetReadBuffer()) { if (!pFI->AllocReadBuffer(pFH->lNumSamplesPerEpisode * uSampleSize)) return ErrorReturn(pnError, ABF_OUTOFMEMORY); } // Read the whole episode from the ABF file only if it is not already cached. if (uEpisode != pFI->GetCachedEpisode()) { UINT uEpisodeSize = (UINT)pFH->lNumSamplesPerEpisode; if (!ABF_MultiplexRead(nFile, pFH, uEpisode, pFI->GetReadBuffer(), &uEpisodeSize, pnError)) { pFI->SetCachedEpisode(UINT(-1), 0); return FALSE; } pFI->SetCachedEpisode(uEpisode, uEpisodeSize); } // Update the samples in the episode cache. UINT uEpisodeOffset = uStartSample * pFH->nADCNumChannels; float *pfEpisodeBuffer = (float *)pFI->GetReadBuffer() + uEpisodeOffset; float *pfData = pfEpisodeBuffer + uChannelOffset; for (UINT i=0; inADCNumChannels; } // Commit the change to file. BOOL bReadOnly = pFI->TestFlag(FI_READONLY); if (bReadOnly) VERIFY(pFI->Reopen(FALSE)); Synch SynchEntry = { 0 }; VERIFY(GetSynchEntry( pFH, pFI, uEpisode, &SynchEntry )); UINT uOffset = GetDataOffset(pFH) + SynchEntry.dwFileOffset + uEpisodeOffset * sizeof(float); pFI->Seek(uOffset, FILE_BEGIN); pFI->Write(pfEpisodeBuffer, uNumSamples*pFH->nADCNumChannels*sizeof(float)); if (bReadOnly) VERIFY(pFI->Reopen(TRUE)); return TRUE; } #endif //=============================================================================================== // FUNCTION: ABF2_SetChunkSize // PURPOSE: This routine can be called on files of type ABF_GAPFREEFILE or ABF_VARLENEVENTS to change // the size of the data chunks returned by the read routines. // INPUT: // hFile ABF file number of this file (NOT the DOS handle) // pFH the current acquisition parameters for the data file // puMaxSamples points to the requested size of data blocks to be returned. // This is only used in the case of GAPFREE and EVENT-DETECTED- // VARIABLE-LENGTH acquisitions. Otherwise the size of the // Episode is used. 80x86 limitations require this to be // less than or equal to 64k. // pdwMaxEpi The maximum number of episodes to be read. // OUTPUT: // pFH the acquisition parameters that were read from the data file // puMaxSamples the maximum number of samples that can be read contiguously // from the data file. // pdwMaxEpi the number of episodes of puMaxSamples points that exist // in the data file. // BOOL WINAPI ABF2_SetChunkSize( int nFile, ABF2FileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError ) { // ASSERT(nFile != ABF_INVALID_HANDLE); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; return ABF2_SetChunkSize( pFI, pFH, puMaxSamples, pdwMaxEpi, pnError ); } #if 0 //=============================================================================================== // FUNCTION: ABF_SetOverlap // PURPOSE: Changes the overlap flag and processes the synch array to edit redundant data out if no overlap. // BOOL WINAPI ABF_SetOverlap(int nFile, const ABFFileHeader *pFH, BOOL bAllowOverlap, int *pnError) { ASSERT(nFile != ABF_INVALID_HANDLE); ABFH_ASSERT(pFH); // Get the file descriptor. CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; return _SetOverlap(pFI, pFH, bAllowOverlap, pnError); } // *********************************************************************************************** // *********************************************************************************************** // *** // *** Functions used to read and write annotations. // *** // *********************************************************************************************** // *********************************************************************************************** //=============================================================================================== // FUNCTION: ABF_WriteAnnotation // PURPOSE: Write an annotation to the Annotations Section of the ABF file. // BOOL WINAPI ABF_WriteAnnotation( int nFile, ABFFileHeader *pFH, LPCSTR pszText, int *pnError ) { ASSERT(nFile != ABF_INVALID_HANDLE); ABFH_ASSERT(pFH); // Take a copy of the passed in header to ensure it is 6k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Return an error if writing is inappropriate. if (pFI->TestFlag( FI_PARAMFILE | FI_READONLY)) return ErrorReturn(pnError, ABF_EREADONLYFILE); if (!pFI->PutAnnotation( pszText)) return ErrorReturn(pnError, pFI->GetLastError()); NewFH.lNumAnnotations = pFI->GetAnnotationCount(); ABFH_DemoteHeader( pFH, &NewFH ); return TRUE; } BOOL WINAPI ABF_WriteStringAnnotation( int nFile, ABFFileHeader *pFH, LPCSTR pszName, LPCSTR pszData, int *pnError ) { LPSZASSERT(pszName); LPSZASSERT(pszData); const char c_pszTag[] = ""; CArrayPtrEx Ann(strlen(pszName)+strlen(c_pszTag)+strlen(pszData)+1); if (!Ann) return ErrorReturn(pnError, ABF_OUTOFMEMORY); AXU_strncpyz(Ann, pszName, Ann.GetCount()); AXU_strncatz(Ann, c_pszTag, Ann.GetCount()); AXU_strncatz(Ann, pszData, Ann.GetCount()); return ABF_WriteAnnotation( nFile, pFH, Ann, pnError ); } BOOL WINAPI ABF_WriteIntegerAnnotation( int nFile, ABFFileHeader *pFH, LPCSTR pszName, int nData, int *pnError ) { LPSZASSERT(pszName); const char c_pszTag[] = ""; CArrayPtrEx Ann(strlen(pszName)+strlen(c_pszTag)+32+1); if (!Ann) return ErrorReturn(pnError, ABF_OUTOFMEMORY); AXU_strncpyz(Ann, pszName, Ann.GetCount()); AXU_strncatz(Ann, c_pszTag, Ann.GetCount()); itoa(nData, Ann+strlen(Ann), 10); return ABF_WriteAnnotation( nFile, pFH, Ann, pnError ); } //=============================================================================================== // FUNCTION: ABF_ReadAnnotation // PURPOSE: Read an annotation to the Annotations Section of the ABF file.. // BOOL WINAPI ABF_ReadAnnotation( int nFile, const ABFFileHeader *pFH, DWORD dwIndex, LPSTR pszText, DWORD dwBufSize, int *pnError ) { ASSERT( nFile != ABF_INVALID_HANDLE ); ABFH_ASSERT( pFH ); ARRAYASSERT( pszText, dwBufSize); // Take a copy of the passed in header to ensure it is 6k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // If there are no annotations present, return an error. if( NewFH.lNumAnnotations==0 ) return ErrorReturn(pnError, ABF_ENOANNOTATIONS); // If there are annotations in the file, but not in the virtual buffer, read them now. if( (NewFH.lAnnotationSectionPtr>0) && (pFI->GetAnnotationCount() == 0) ) { if( !pFI->ReadAllAnnotations( NewFH.lAnnotationSectionPtr ) ) return ErrorReturn(pnError, ABF_EREADANNOTATION); } if( !pFI->ReadAnnotation( dwIndex, pszText, dwBufSize ) ) return ErrorReturn(pnError, ABF_EREADANNOTATION); return TRUE; } //=============================================================================================== // FUNCTION: ABF_ParseStringAnnotation // PURPOSE: This function parses a String annotation. // e.g. NameValue // BOOL WINAPI ABF_ParseStringAnnotation( LPCSTR pszAnn, LPSTR pszName, UINT uSizeName, LPSTR pszValue, UINT uSizeValue, int *pnError) { LPCSTR pszStart = pszAnn; while (*pszStart==' ') ++pszStart; LPCSTR pszEnd = strchr(pszStart, '<'); if (pszEnd) { AXU_strncpyz(pszName, pszStart, min(uSizeName, UINT(pszEnd-pszStart+1))); pszEnd = strchr(pszEnd, '>'); if (!pszEnd) return ErrorReturn(pnError, ABF_EREADANNOTATION); pszStart = pszEnd+1; } AXU_strncpyz(pszValue, pszStart, uSizeValue); return true; } //=============================================================================================== // FUNCTION: ABF_ReadStringAnnotation // PURPOSE: This function reads and parses a String annotation. // e.g. NameValue // BOOL WINAPI ABF_ReadStringAnnotation( int nFile, const ABFFileHeader *pFH, DWORD dwIndex, LPSTR pszName, UINT uSizeName, LPSTR pszValue, UINT uSizeValue, int *pnError ) { ARRAYASSERT( pszName, uSizeName); ARRAYASSERT( pszValue, uSizeValue); UINT uLen = ABF_GetMaxAnnotationSize( nFile, pFH ); if (!uLen) return ErrorReturn(pnError, ABF_EREADANNOTATION); CArrayPtrEx Ann(uLen); if (!Ann) return ErrorReturn(pnError, ABF_OUTOFMEMORY); if (!ABF_ReadAnnotation( nFile, pFH, dwIndex, Ann, Ann.GetCount(), pnError )) return FALSE; return ABF_ParseStringAnnotation( Ann, pszName, uSizeName, pszValue, uSizeValue, pnError); } //=============================================================================================== // FUNCTION: ABF_ReadIntegerAnnotation // PURPOSE: This function reads and parses an integer annotation. // e.g. NameValue // and parses the name and value // BOOL WINAPI ABF_ReadIntegerAnnotation( int nFile, const ABFFileHeader *pFH, DWORD dwIndex, LPSTR pszName, UINT uSizeName, int *pnValue, int *pnError ) { ARRAYASSERT( pszName, uSizeName); UINT uLen = ABF_GetMaxAnnotationSize( nFile, pFH ); if (!uLen) return ErrorReturn(pnError, ABF_EREADANNOTATION); CArrayPtrEx Ann(uLen); if (!Ann) return ErrorReturn(pnError, ABF_OUTOFMEMORY); if (!ABF_ReadAnnotation( nFile, pFH, dwIndex, Ann, Ann.GetCount(), pnError )) return FALSE; LPCSTR pszStart = AXU_StripWhiteSpace(Ann); LPCSTR pszEnd = strchr(pszStart, '<'); if (pszEnd) { AXU_strncpyz(pszName, pszStart, min(uSizeName, UINT(pszEnd-pszStart+1))); pszEnd = strchr(pszEnd, '>'); if (!pszEnd) return ErrorReturn(pnError, ABF_EREADANNOTATION); pszStart = pszEnd+1; if (pszStart[0]!='i' || pszStart[1] != ',') return ErrorReturn(pnError, ABF_EREADANNOTATION); } if (pnValue) *pnValue = atoi(pszStart); return true; } //=============================================================================================== // FUNCTION: ABF_GetMaxAnnotationSize // PURPOSE: Return the size in bytes of the largest annotation in the file. // DWORD WINAPI ABF_GetMaxAnnotationSize( int nFile, const ABFFileHeader *pFH ) { ASSERT(nFile != ABF_INVALID_HANDLE); ABFH_ASSERT( pFH ); // Take a copy of the passed in header to ensure it is 6k long. ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); CFileDescriptor *pFI = NULL; int nError = 0; if( !GetFileDescriptor( &pFI, nFile, &nError ) ) return 0; // If there are annotations in the file, but not in the virtual buffer, read them now. if( (NewFH.lAnnotationSectionPtr>0) && (pFI->GetAnnotationCount() == 0) ) { if( !pFI->ReadAllAnnotations( pFH->lAnnotationSectionPtr ) ) return ErrorReturn( &nError, ABF_EREADANNOTATION); } // If this file is being written, the annotations will be in the virtual buffer. if (pFI->GetAnnotationCount() > 0) return pFI->GetMaxAnnotationSize(); return 0; } //=============================================================================================== // FUNCTION: ABF_GetFileName // PURPOSE: Return the filename from a currently open file. // BOOL WINAPI ABF_GetFileName( int nFile, LPSTR pszFilename, UINT uTextLen, int *pnError ) { WARRAYASSERT( pszFilename, uTextLen ); // Get the File Descriptor. CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; AXU_strncpyz( pszFilename, pFI->GetFileName(), uTextLen ); return TRUE; } //============================================================================================== // FUNCTION: ABF_ValidateFileCRC // PURPOSE: Function to validate the file using the CRC embedded in the ABF header. // The CRC is generated at the time of writing the file and can be used to // check if the file has been modified outside the application. // RETURNS: TRUE if CRC validation is OK. // FALSE if validation failed. // BOOL WINAPI ABF_ValidateFileCRC( int nFile, int *pnError ) { int nError = 0; ABFFileHeader NewFH; CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, nFile, pnError)) return FALSE; // Read the data file parameters. if (!ABFH_ParamReader(pFI->GetFileHandle(), &NewFH, &nError)) { nError = (nError == ABFH_EUNKNOWNFILETYPE) ? ABF_EUNKNOWNFILETYPE : ABF_EBADPARAMETERS; return ErrorReturn( pnError, nError ); } // Validate checksum. if( !ValidateFileCRC( pFI, &NewFH, sizeof( ABFFileHeader ) ) ) { nError = ABF_ECRCVALIDATIONFAILED; return ErrorReturn(pnError, nError); } return TRUE; } // *********************************************************************************************** // *********************************************************************************************** // *** // *** Superceded functions. // *** // *********************************************************************************************** // *********************************************************************************************** #ifdef __cplusplus extern "C" { #endif // __cplusplus BOOL WINAPI ABF_UpdateAfterAcquisition(int nFile, ABFFileHeader *pFH, DWORD dwAcquiredEpisodes, DWORD dwAcquiredSamples, int *pnError); #ifdef __cplusplus } #endif //=============================================================================================== // FUNCTION: ABF_UpdateAfterAcquisition // PURPOSE: Update ABF internal housekeeping of acquired data, this must be called // before ABF_UpdateHeader if the file has been written to through the handle // retrieved by ABF_GetFileHandle. // BOOL WINAPI ABF_UpdateAfterAcquisition(int nFile, ABFFileHeader *pFH, DWORD dwAcquiredEpisodes, DWORD dwAcquiredSamples, int *pnError) { ABFH_ASSERT(pFH); ERRORMSG("ABF_UpdateAfterAcquisition has been retired.\n"); return FALSE; } #if 0 //=============================================================================================== // FUNCTION: ABF_AppendOpen // PURPOSE: This routine opens an existing data file for appending. // INPUT: // szFileName the name of the data file that will be opened // puMaxSamples points to the requested size of data blocks to be returned. // This is only used in the case of GAPFREE and EVENT-DETECTED- // VARIABLE-LENGTH acquisitions. Otherwise the size of the // Episode is used. 80x86 limitations require this to be // less than or equal to 64k. // pdwMaxEpi The maximum number of episodes to be read. // OUTPUT: // pFH the acquisition parameters that were read from the data file // phFile pointer to the ABF file number of this file (NOT the DOS handle) // puMaxSamples the maximum number of samples that can be read contiguously // from the data file. // pdwMaxEpi the number of episodes of puMaxSamples points that exist // in the data file. // BOOL WINAPI ABF_AppendOpen(LPCSTR szFileName, int *phFile, ABFFileHeader *pFH, UINT *puMaxSamples, DWORD *pdwMaxEpi, int *pnError) { LPSZASSERT(szFileName); WPTRASSERT(phFile); ABFH_WASSERT(pFH); WPTRASSERT(puMaxSamples); WPTRASSERT(pdwMaxEpi); // Open the file for reading. int hFile = ABF_INVALID_HANDLE; if (!ABF_ReadOpen(szFileName, phFile, ABF_DATAFILE, pFH, puMaxSamples, pdwMaxEpi, pnError)) return FALSE; // Get the File Descriptor. CFileDescriptor *pFI = NULL; if (!GetFileDescriptor(&pFI, *phFile, pnError)) { ABF_Close(*phFile, NULL); return FALSE; } // Fix up file descriptor etc... // if (!pFI->ChangeStatus()) // { // ABF_Close(hFile, NULL); // return ErrorReturn( pnError, ABF_EOPENFILE ); // } // Read the tags into a temporary file. if (pFH->lNumTagEntries > 0) { ERRORMSG("Transfer tags to temp file!!!"); ABF_Close(hFile, NULL); return FALSE; } // Seek to the end of the Data section. UINT uOffset = GetDataOffset(pFH) + pFH->lActualAcqLength * SampleSize(pFH); pFI->Seek( uOffset, FILE_BEGIN); return TRUE; } #endif #endif stimfit-0.16.0/src/libstfio/abf/axon/AxAbfFio32/oldheadr.h0000775000175000017500000000200613277303516020026 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-1997 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // HEADER: OLDHEADR.H. // PURPOSE: Provides prototypes for functions implemented in OLDHEADR.CPP for // reading old ABF file header. #ifndef __OLDHEADR_H__ #define __OLDHEADR_H__ BOOL OLDH_GetFileVersion( FILEHANDLE hFile, UINT *puFileType, float *pfFileVersion, BOOL *pbMSBinFormat); void OLDH_ABFtoCurrentVersion(ABFFileHeader *pFH); /* void OLDH_CorrectScopeConfig(ABFFileHeader *pFH, ABFScopeConfig *pCfg); */ BOOL OLDH_ReadOldHeader( FILEHANDLE hFile, UINT uFileType, int bMSBinFormat, ABFFileHeader *pFH, ABFLONG lFileLength, int *pnError); #endif /* __OLDHEADR_H__ */ stimfit-0.16.0/src/libstfio/abf/axon/AxAbfFio32/abfheadr.cpp0000775000175000017500000016373413277303516020353 00000000000000//*********************************************************************************************** // // Copyright (c) 1993-2000 Axon Instruments. // All rights reserved. // Permission is granted to freely to use, modify and copy the code in this file. // //*********************************************************************************************** // This is ABFHEADR.CPP; the routines that cope with reading the data file // parameters block for all AXON pCLAMP binary file formats. // // An ANSI C compiler should be used for compilation. // Compile with the large memory model option. // (e.g. CL -c -AL ABFHEADR.C) #include "../Common/wincpp.hpp" #include "abfheadr.h" // header definition & constants #include "oldheadr.h" // old header conversion prototypes #include "abfutil.h" // Large memory allocation/free /* #include "StringResource.h" // Access to string resources. */ #define A_VERY_SMALL_NUMBER 1E-10 #define DEFAULT_LEVEL_HYSTERESIS 64 // Two LSBits of level hysteresis. #define DEFAULT_TIME_HYSTERESIS 1 // Two sequences of time hysteresis. #if !defined(_WINDOWS) || defined(__MINGW32__) || defined(__STF__) #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif const char c_szValidOperators[] = "+-*/"; const ABFLONG c_lMaxShort = 30000; //----------------------------------------------------------------------------------------------- // Uncomment the following line to display interface structure sizes. //#define SHOW_STRUCT_SIZES 1 //----------------------------------------------------------------------------------------------- // Macros and functions to deal with returning error return codes through a pointer if given. #define ERRORRETURN(p, e) return ErrorReturn(p, e); static BOOL ErrorReturn(int *pnError, int nErrorNum) { if (pnError) *pnError = nErrorNum; return FALSE; } //=============================================================================================== // FUNCTION: ABFH_Initialize // PURPOSE: Initialize an ABFFileHeader structure to a consistent set of parameters // void WINAPI ABFH_Initialize( ABFFileHeader *pFH ) { // ABFH_WASSERT(pFH); int i; ABFFileHeader NewFH; ABFH_PromoteHeader( &NewFH, pFH ); // Zero fill all to start with. memset(&NewFH, '\0', sizeof(NewFH)); // Blank fill all strings. ABF_BLANK_FILL(NewFH._sParamValueList); ABF_BLANK_FILL(NewFH.sADCChannelName); ABF_BLANK_FILL(NewFH.sADCUnits); ABF_BLANK_FILL(NewFH.sDACChannelName); ABF_BLANK_FILL(NewFH.sDACChannelUnits); ABF_BLANK_FILL(NewFH.sDACFilePath[0]); ABF_BLANK_FILL(NewFH.sDACFilePath[1]); ABF_SET_STRING(NewFH.sArithmeticOperator, "+"); ABF_BLANK_FILL(NewFH.sArithmeticUnits); NewFH.lFileSignature = ABF_NATIVESIGNATURE; NewFH.fFileVersionNumber = ABF_CURRENTVERSION; NewFH.fHeaderVersionNumber = ABF_CURRENTVERSION; NewFH.nOperationMode = ABF_GAPFREEFILE; NewFH.nADCNumChannels = 1; NewFH.fADCSampleInterval = 100.0F; NewFH.lNumSamplesPerEpisode = 512; NewFH.lEpisodesPerRun = 1; NewFH.lDataSectionPtr = sizeof(ABFFileHeader) / ABF_BLOCKSIZE; NewFH.nDrawingStrategy = ABF_DRAW_REALTIME; NewFH.nTiledDisplay = ABF_DISPLAY_TILED; NewFH.nEraseStrategy = 1; NewFH.nDataDisplayMode = ABF_DRAW_LINES; NewFH.nMultiColor = TRUE; NewFH.nFileType = ABF_ABFFILE; NewFH.nAutoTriggerStrategy = 1; // Allow auto triggering. NewFH.nChannelStatsStrategy = 0; // Don't calculate channel statistics. NewFH.fStatisticsPeriod = 1.0F; NewFH.lCalculationPeriod = ABFLONG(NewFH.fStatisticsPeriod / NewFH.fADCSampleInterval * 1E3F); NewFH.lStatisticsMeasurements = ABF_STATISTICS_ABOVETHRESHOLD | ABF_STATISTICS_MEANOPENTIME; NewFH.lSamplesPerTrace = 16384; NewFH.lPreTriggerSamples = 16; // default to 16 NewFH.fADCRange = 10.24F; NewFH.fDACRange = 10.24F; NewFH.lADCResolution = 32768L; NewFH.lDACResolution = 32768L; NewFH.nExperimentType = ABF_SIMPLEACQUISITION; ABF_BLANK_FILL(NewFH.sCreatorInfo); ABF_BLANK_FILL(NewFH.sModifierInfo); ABF_BLANK_FILL(NewFH.sFileComment); // ADC channel data for (i=0; inOperationMode) { case ABF_FIXLENEVENTS: case ABF_VARLENEVENTS: case ABF_GAPFREEFILE: return ABF_CONTINUOUSMODE; case ABF_HIGHSPEEDOSC: case ABF_WAVEFORMFILE: return ABF_EPISODICMODE; default: ERRORMSG1("Unexpected operation mode '%d'.", pFH->nOperationMode); return ABF_EPISODICMODE; } } //=============================================================================================== // FUNCTION: SetupSignal // PURPOSE: Sets up a signal descriptor from display parameters in an old ABF header. // static void _SetupSignal(const ABFFileHeader *pFH, ABFSignal *pS, UINT uMxOffset, UINT uTraces) { memset(pS, 0, sizeof(ABFSignal)); int nChannel = pFH->nADCSamplingSeq[uMxOffset]; ABFU_GetABFString(pS->szName, ABF_ADCNAMELEN+1, pFH->sADCChannelName[nChannel], ABF_ADCNAMELEN); pS->nMxOffset = short(uMxOffset); pS->rgbColor = RGB_BLUE; pS->nPenWidth = 1; pS->bDrawPoints = char(!pFH->nDataDisplayMode); pS->bHidden = FALSE; pS->bFloatData = FALSE; pS->fVertProportion = 1.0F / float(uTraces); pS->fDisplayGain = pFH->fADCDisplayAmplification[nChannel]; pS->fDisplayOffset = pFH->fADCDisplayOffset[nChannel]; } //=============================================================================================== // FUNCTION: SetupMathSignal // PURPOSE: Sets up a signal descriptor for a math channel from parameters in an ABF header. // static void _SetupMathSignal(const ABFFileHeader *pFH, ABFSignal *pS, UINT uTraces) { memset(pS, 0, sizeof(ABFSignal)); LoadString(g_hInstance, IDS_MATHCHANNEL, pS->szName, sizeof(pS->szName)); pS->nMxOffset = 0; pS->rgbColor = RGB_BLUE; pS->nPenWidth = 1; pS->bDrawPoints = char(!pFH->nDataDisplayMode); pS->bHidden = FALSE; pS->bFloatData = TRUE; pS->fVertProportion = 1.0F / float(uTraces); pS->fDisplayGain = 1.0F; pS->fDisplayOffset = 0.0F; } //=============================================================================================== // FUNCTION: MathChannelEnabled // PURPOSE: Returns TRUE if the math channel is enabled. // static BOOL MathChannelEnabled(const ABFFileHeader *pFH) { return (pFH->nArithmeticEnable && (pFH->nADCNumChannels < ABF_ADCCOUNT)); } //=============================================================================================== // FUNCTION: _GetTraceCount // PURPOSE: Gets the number of traces that should be displayed for this acquisition. // static UINT _GetTraceCount(const ABFFileHeader *pFH, BOOL *pbMathChannel=NULL) { UINT uTraces = UINT(pFH->nADCNumChannels); BOOL bMathChannel = MathChannelEnabled(pFH); if (bMathChannel) uTraces++; if (pbMathChannel) *pbMathChannel = bMathChannel; return uTraces; } //=============================================================================================== // FUNCTION: ABFH_InitializeScopeConfig // PURPOSE: Sets up a scope configuration structure from the old header locations for display // parameters. // void WINAPI ABFH_InitializeScopeConfig(const ABFFileHeader *pFH, ABFScopeConfig *pCfg) { // Zapp everything! memset(pCfg, 0, sizeof(*pCfg)); // Enable SC_CLIPPING pCfg->dwFlags = 0x00000008; // Set the scope mode. pCfg->wScopeMode = _GetDefaultScopeMode(pFH); // Set up the first ScopeConfig structure. pCfg->rgbColor[ABF_BACKGROUNDCOLOR] = RGB_WHITE; pCfg->rgbColor[ABF_GRIDCOLOR] = RGB_LTGRAY; pCfg->rgbColor[ABF_THRESHOLDCOLOR] = RGB_DKRED; pCfg->rgbColor[ABF_EVENTMARKERCOLOR]= RGB_RED; pCfg->rgbColor[ABF_SEPARATORCOLOR] = RGB_BLACK; pCfg->rgbColor[ABF_AVERAGECOLOR] = RGB_RED; pCfg->rgbColor[ABF_OLDDATACOLOR] = RGB_LTGRAY; pCfg->rgbColor[ABF_TEXTCOLOR] = RGB_BLACK; pCfg->rgbColor[ABF_AXISCOLOR] = GetSysColor(COLOR_3DFACE); pCfg->rgbColor[ABF_ACTIVEAXISCOLOR] = GetSysColor(COLOR_3DSHADOW); pCfg->fDisplayStart = 0.0F; // If fDisplayStart==fDisplayEnd a default pCfg->fDisplayEnd = 0.0F; // display scaling will be used. pCfg->nYAxisWidth = -1; pCfg->nEraseStrategy = ABF_ERASE_EACHRUN; // Set the Signals in the first scope configuration to match the // old entries in the header. BOOL bMathChannel = FALSE; UINT uTraces = _GetTraceCount(pFH, &bMathChannel); UINT uNormalTraces = uTraces; if (bMathChannel) uNormalTraces--; UINT i; for (i=0; iTraceList+i, i, uTraces); if (bMathChannel) _SetupMathSignal(pFH, pCfg->TraceList+i, uTraces); pCfg->nTraceCount = short(uTraces); // Initialize the extended ABFScopeConfig fields for ABF file version 1.68. pCfg->nAutoZeroState = 0; pCfg->nSizeofOldStructure = pCfg->nSizeofOldStructure; pCfg->rgbColorEx[ ABF_STATISTICS_REGION0 ] = RGB_BLACK; pCfg->rgbColorEx[ ABF_STATISTICS_REGION1 ] = RGB_DKRED; pCfg->rgbColorEx[ ABF_STATISTICS_REGION2 ] = RGB_DKGREEN; pCfg->rgbColorEx[ ABF_STATISTICS_REGION3 ] = RGB_DKYELLOW; pCfg->rgbColorEx[ ABF_STATISTICS_REGION4 ] = RGB_DKBLUE; pCfg->rgbColorEx[ ABF_STATISTICS_REGION5 ] = RGB_MAUVE; pCfg->rgbColorEx[ ABF_STATISTICS_REGION6 ] = RGB_BLUEGRAY; pCfg->rgbColorEx[ ABF_STATISTICS_REGION7 ] = RGB_DKGRAY; pCfg->rgbColorEx[ ABF_BASELINE_REGION ] = RGB_RED; pCfg->rgbColorEx[ ABF_STOREDSWEEPCOLOR ] = RGB_BLUEGRAY; } //=============================================================================================== // FUNCTION: SetMxOffset // PURPOSE: Returns TRUE if the passed signal is still in the sampling sequence. // static BOOL SetMxOffset(const ABFFileHeader *pFH, ABFSignal *pS) { // Initialize to failure case. pS->nMxOffset = -1; if (!pS->bFloatData) { char szName[ABF_ADCNAMELEN+1]; for (int i=0; inADCNumChannels); i++) { int nChannel = pFH->nADCSamplingSeq[i]; ABFU_GetABFString(szName, sizeof(szName), pFH->sADCChannelName[nChannel], ABF_ADCNAMELEN); if (strcmp(pS->szName, szName)==0) { pS->nMxOffset = short(i); break; } } } else if (MathChannelEnabled(pFH)) pS->nMxOffset = 0; return (pS->nMxOffset != -1); } //=============================================================================================== // FUNCTION: ABFH_CheckScopeConfig // PURPOSE: Checks a scope configuration structure against an ABFFileHeader structure, making // sure that both reference the same signals, in the same multiplex sequence. // RETURNS: FALSE if the configuration structure specified an innappropriate Scope mode. // BOOL WINAPI ABFH_CheckScopeConfig(ABFFileHeader *pFH, ABFScopeConfig *pCfg) { ASSERT(pFH->nADCNumChannels > 0); // Search through the ABFScopeConfig trace list to see if all signals are // included in the sampling list. BOOL bMathChannel = FALSE; UINT uNewTraceCount = _GetTraceCount(pFH, &bMathChannel); UINT uOldTraceCount = UINT(pCfg->nTraceCount); UINT uOldVisibleTraceCount = uOldTraceCount; UINT uGaps = 0; ABFSignal *pS = pCfg->TraceList; for (UINT i=0; i